Skip to content

Commit

Permalink
chore: Improve gasLimit test (#4096)
Browse files Browse the repository at this point in the history
chore: allow higher priority fee and downgrade error to log
  • Loading branch information
albert-llimos committed Oct 10, 2023
1 parent 287e30f commit 3b72edd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bouncer/shared/gaslimit_ccm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MAX_TEST_GAS_CONSUMPTION = 4000000;
// The base overhead increases with message lenght. This is an approximation => BASE_GAS_OVERHEAD + messageLength * gasPerByte
// EVM requires 16 gas per calldata byte so a reasonable approximation is 17 to cover hashing and other operations over the data.
const GAS_PER_BYTE = 17;
const EXPECTED_PRIORITY_FEE = 1000000000;
const MIN_PRIORITY_FEE = 1000000000;

let stopObservingCcmReceived = false;

Expand Down Expand Up @@ -214,8 +214,10 @@ async function testGasLimitSwap(
const gasUsed = receipt.gasUsed;
const gasPrice = tx.gasPrice;
const totalFee = gasUsed * Number(gasPrice);

// Priority fee is not fully deterministic so we just log it for now
if (tx.maxFeePerGas !== maxFeePerGas.toString()) {
throw new Error(
console.log(
`${tag} Max fee per gas in the transaction ${tx.maxFeePerGas} different than expected ${maxFeePerGas}`,
);
}
Expand Down Expand Up @@ -259,7 +261,7 @@ export async function testGasLimitCcmSwaps() {
const spamming = spamEthereum();

// Wait for the fees to increase to the stable expected amount
while ((await getChainFees()).priorityFee !== EXPECTED_PRIORITY_FEE) {
while ((await getChainFees()).priorityFee >= MIN_PRIORITY_FEE) {
await sleep(500);
}

Expand Down

0 comments on commit 3b72edd

Please sign in to comment.