test(evm): make 'insufficient gas' test actually reject on autobahn#3394
Open
wen-coding wants to merge 3 commits intomainfrom
Open
test(evm): make 'insufficient gas' test actually reject on autobahn#3394wen-coding wants to merge 3 commits intomainfrom
wen-coding wants to merge 3 commits intomainfrom
Conversation
The test previously did `gasPrice: feeData.gasPrice - 1` and used
`expect(...).to.be.reverted` without an `await`, so two things went
wrong on Autobahn but not on V2:
1. Under V2 with idle blocks, eth_gasPrice == 1 gwei (the chain min),
so `gasPrice - 1` was below min and the tx was rejected. Under
Autobahn, basefee dynamics push eth_gasPrice slightly above 1 gwei
(we observe ~1.1 gwei idle), so `gasPrice - 1` stayed above the
min and the tx was accepted.
2. Without `await`, the chai matcher ran on a still-pending promise —
the assertion never actually checked anything.
The combination caused the "Should fail" test to silently leak a tx
that bumped the on-chain nonce, breaking the next test
("Should deduct correct amount even if higher gas price is used")
with an "incorrect account sequence" mempool error.
Fix: hardcode `gasPrice: 1` (1 wei, far below any plausible basefee),
add the missing `await`, and use `.to.be.rejected` since hardhat-ethers
rejects pre-flight via estimateGas (not an EVM revert, so
`.to.be.reverted` doesn't match).
Verified: 8/8 runs of `Gas tests` pass under Autobahn cluster.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Use rejectedWith(/max fee per gas less than block base fee/) instead of plain rejected so the test fails loud if the chain's rejection path or error message changes (e.g. admission vs estimateGas). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jewei1997
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Should fail if insufficient gas is providedtest incontracts/test/EVMCompatabilityTest.jswas silently passing under V2 but cascading into a nonce conflict under Autobahn. Two bugs combined:gasPrice: feeData.gasPrice - 1only crosses the chain's 1 gwei minimum wheneth_gasPrice == 1 gweiexactly. Under V2's idle blocks that's true; under Autobahn's faster basefee dynamicseth_gasPricesits at ~1.1 gwei, so-1 weidoes not bring the price below the min and the tx is accepted.expect(...).to.be.revertedran on a still-pending promise (noawait), so the assertion never actually checked anything. The submitted tx silently landed, bumped the sender's nonce, and broke the next test (Should deduct correct amount even if higher gas price is used) withincorrect account sequence.gasPrice: 1(1 wei, far below any plausible basefee), add the missingawait, and switch to.to.be.rejectedsince hardhat-ethers rejects pre-flight viaestimateGas— not an EVM revert, so the previous matcher would not match anyway.Test plan
npx hardhat test test/EVMCompatabilityTest.js --grep "Gas tests" --network seilocalagainst an Autobahn cluster: 8/8 runs, all 8 tests passing (was 5/5 failing before).🤖 Generated with Claude Code