feat(tests): EIP-7778 admission gate uses pre-refund gas#2932
feat(tests): EIP-7778 admission gate uses pre-refund gas#2932danceratopz wants to merge 1 commit into
Conversation
Add `test_extra_tx_admission_uses_pre_refund_gas`: a 2-tx regression covering the case where a refund-bearing first tx is followed by a tx whose `gas_limit` exceeds its actual usage. The existing `test_multi_transaction_gas_accounting` parametrisations pin `extra_tx.gas_limit` to the intrinsic cost, so a post-refund admission gate is masked by the subsequent `header.gas_used > gas_limit` check. The added slack makes the bypass observable: a buggy implementation admits the trailing tx and computes a `header.gas_used` that no longer matches the fixture. Regression scenario from NethermindEth/nethermind#11794.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2932 +/- ##
================================================
Coverage 90.43% 90.43%
================================================
Files 535 535
Lines 32430 32430
Branches 3012 3012
================================================
Hits 29329 29329
Misses 2573 2573
Partials 528 528
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This a tricky one, so adding Claude's explanation for dummies 😆 SetupTwo transactions in one block. Tx 1 — the "refund tx"Hits a contract that performs 10
The receipt for this tx shows After tx 1 the block has two "running totals":
Tx 2 — the "trailing tx"Just calls a contract that runs The trick: we give tx 2 a Block
What the two clients do
The pointBoth clients reject the block — but for different reasons, at
The The whole trick of the test is the slack on tx 2's gas_limit. |
🗒️ Description
Add
test_extra_tx_admission_uses_pre_refund_gas: a 2-tx regression covering the case where a refund-bearing first tx is followed by a tx whosegas_limitexceeds its actual usage. The existingtest_multi_transaction_gas_accountingparametrisations pinextra_tx.gas_limitto the intrinsic cost, so a post-refund admission gate is masked by the subsequentheader.gas_used > gas_limitcheck. The added slack makes the bypass observable: a buggy implementation admits the trailing tx and computes aheader.gas_usedthat no longer matches the fixture.TODO revisit one 8037 hits
forks/amsterdamThis captures the bug when 8037 is not enabled. Verified by disabling 8037 on top of NethermindEth/nethermind@82590cbb10 and rebuilding
nethtest. I.e.,The behavior can be verified using
nethtestand manually verifying that the expected exception is produced with/without the bug. However, when 8037 is enabled, it masks the bug and it appears not to be reproducible. Will investigate further once 8037.fixtures.tar.gz
🔗 Related Issues or PRs
This coverage gap was discovered by:
✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture