Skip to content

Commit

Permalink
add better logging for limit updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dshiell committed Nov 7, 2024
1 parent 2df7377 commit 06da540
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ 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);
TX_GASPRICE_LIMIT = computeLimitEMA(gasPrice, TX_GASPRICE_LIMIT, TX_ALPHA);
const newGasLimit = computeLimitEMA(gasPrice, TX_GASPRICE_LIMIT, TX_ALPHA);
console.log('Updating TX_GASPRICE_LIMIT: %d -> %d', TX_GASPRICE_LIMIT, newGasLimit);
TX_GASPRICE_LIMIT = newGasLimit;
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 );
TX_BLOBPRICE_LIMIT = computeLimitEMA(maxFeePerBlobGas, TX_BLOBPRICE_LIMIT, TX_ALPHA);
const newBlobLimit = computeLimitEMA(maxFeePerBlobGas, TX_BLOBPRICE_LIMIT, TX_ALPHA);
console.log('Updating TX_BLOBPRICE_LIMIT: %d -> %d', TX_BLOBPRICE_LIMIT, newBlobLimit);
TX_BLOBPRICE_LIMIT = newBlobLimit;
return true;
}
}
Expand Down

0 comments on commit 06da540

Please sign in to comment.