Skip to content

Commit

Permalink
gas error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jlafiandra6 committed Oct 25, 2024
1 parent ed79dbb commit a6cd114
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ app.post('/', async (request, reply) => {

if (TX_BLOBPRICE_LIMIT > 0 || TX_GASPRICE_LIMIT > 0) {
let areFeesTooHigh = await feesTooHigh(result.data);
if (areFeesTooHigh) {
if (areFeesTooHigh) {
reply.code(400).send({error: `Fees too high TX_GAS_LIMIT|TX_BLOBPRICE_LIMIT [${TX_GASPRICE_LIMIT} |${TX_BLOBPRICE_LIMIT}] reached`});
return;
}
Expand Down Expand Up @@ -80,11 +80,13 @@ async function feesTooHigh(transactionArgs: TransactionArgs) {

var gasPrice = (maxFeePerGas + maxPriorityFeePerGas);
if (gasPrice > TX_GASPRICE_LIMIT) {
console.error('Tx fees too high: %d > %d', gasPrice, TX_GASPRICE_LIMIT);
return true;
}

if (transactionArgs.blobVersionedHashes && transactionArgs.blobVersionedHashes.length > 0) {
if (maxFeePerBlobGas > TX_BLOBPRICE_LIMIT) {
console.error('Blob fees too high: %d > %d', maxFeePerBlobGas, TX_BLOBPRICE_LIMIT );
return true;
}
}
Expand Down

0 comments on commit a6cd114

Please sign in to comment.