From 06da540795ccfa1b6d13101f24274b5ccfcb2686 Mon Sep 17 00:00:00 2001 From: Derek Date: Thu, 7 Nov 2024 14:21:42 -0800 Subject: [PATCH] add better logging for limit updates --- src/server.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server.ts b/src/server.ts index 9bb71c3..aca9617 100644 --- a/src/server.ts +++ b/src/server.ts @@ -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; } }