Skip to content

test(evm): make 'insufficient gas' test actually reject on autobahn (CON-256)#3394

Merged
wen-coding merged 4 commits intomainfrom
wen/fix_insufficient_gas_test_for_autobahn
May 7, 2026
Merged

test(evm): make 'insufficient gas' test actually reject on autobahn (CON-256)#3394
wen-coding merged 4 commits intomainfrom
wen/fix_insufficient_gas_test_for_autobahn

Conversation

@wen-coding
Copy link
Copy Markdown
Contributor

Summary

  • The Should fail if insufficient gas is provided test in contracts/test/EVMCompatabilityTest.js was silently passing under V2 but cascading into a nonce conflict under Autobahn. Two bugs combined:
    • gasPrice: feeData.gasPrice - 1 only crosses the chain's 1 gwei minimum when eth_gasPrice == 1 gwei exactly. Under V2's idle blocks that's true; under Autobahn's faster basefee dynamics eth_gasPrice sits at ~1.1 gwei, so -1 wei does not bring the price below the min and the tx is accepted.
    • The chai matcher expect(...).to.be.reverted ran on a still-pending promise (no await), 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) with incorrect account sequence.
  • Fix: hardcode gasPrice: 1 (1 wei, far below any plausible basefee), add the missing await, and switch to .to.be.rejected since hardhat-ethers rejects pre-flight via estimateGas — not an EVM revert, so the previous matcher would not match anyway.

Test plan

  • npx hardhat test test/EVMCompatabilityTest.js --grep "Gas tests" --network seilocal against an Autobahn cluster: 8/8 runs, all 8 tests passing (was 5/5 failing before).
  • CI / V2 path still green.

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 7, 2026, 6:38 AM

wen-coding and others added 2 commits May 5, 2026 10:42
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>
@wen-coding wen-coding requested review from jewei1997 and pompon0 May 5, 2026 23:56
@wen-coding wen-coding changed the title test(evm): make 'insufficient gas' test actually reject on autobahn test(evm): make 'insufficient gas' test actually reject on autobahn (CON-256) May 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.10%. Comparing base (ab54587) to head (e410e7b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3394      +/-   ##
==========================================
+ Coverage   59.03%   59.10%   +0.06%     
==========================================
  Files        2105     2100       -5     
  Lines      173300   172855     -445     
==========================================
- Hits       102312   102158     -154     
+ Misses      62104    61819     -285     
+ Partials     8884     8878       -6     
Flag Coverage Δ
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 64 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wen-coding wen-coding added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit fb4964c May 7, 2026
38 checks passed
@wen-coding wen-coding deleted the wen/fix_insufficient_gas_test_for_autobahn branch May 7, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants