Skip to content

refactor(tests): enhance EIP-8037 test coverage part 2 - #3449

Merged
marioevz merged 7 commits into
ethereum:forks/amsterdamfrom
LouisTsai-Csie:enhance-8037-pt2
Aug 28, 2026
Merged

refactor(tests): enhance EIP-8037 test coverage part 2#3449
marioevz merged 7 commits into
ethereum:forks/amsterdamfrom
LouisTsai-Csie:enhance-8037-pt2

Conversation

@LouisTsai-Csie

@LouisTsai-Csie LouisTsai-Csie commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Strengthens the EIP-8037 state-gas tests. No spec changes and no new behavior under test, every edit either adds an assertion that was missing, corrects opcode metadata the framework needs to price gas, or removes a test whose premise cannot hold.

The same three problems recur across the suite, so the diff repeats the same three fixes. Reading one instance of each is enough to review the rest.

  1. Tests that asserted nothing: Several tests were named after a gas property but never checked gas, no header_verify, no expected_receipt, no post state, so they passed whether or not the property held. Each now pins Header(gas_used=...) and/or TransactionReceipt(cumulative_gas_used=...) derived from the fork model, with an assert naming which gas dimension is expected to dominate.
  2. Missing opcode metadata: execution_cost and state_cost are derived from opcode metadata, so a missing annotation silently mis-prices the budget a test builds around it.
  3. Recording SSTOREs that consumed the budget under test: Tests that recorded a sub-call result into a fresh slot paid STORAGE_SET state gas for the recording itself, so the reservoir no longer covered only the operation being measured. The slot is now pre-seeded, making the write a nonzero-to-nonzero modify that costs no state gas.

Moreover, where a test needs to prove state gas came from the reservoir rather than spilling out of gas_left, the operation now runs in a sub-call forwarded exactly its execution cost. With no gas_left left to spill from, it completes only if the reservoir funded it. CALL gas arguments are derived from the callee's execution_cost instead of round magic numbers.

Related Issues or PRs

Scope

  • test_state_gas_call.py
  • test_state_gas_calldata_floor.py
  • test_state_gas_multi_block.py
  • test_state_gas_ordering.py
  • test_state_gas_pricing.py
  • test_state_gas_sstore.py

Followup Idea

  • Duplication between test_calldata_floor_with_sstore and test_calldata_floor_higher_than_execution_with_state_ops
  • Remove test_sstore_restoration_reservoir_spillover, test_sstore_oog_reservoir_inflation_detection, test_call_oog_reservoir_inflation_detection, test_selfdestruct_oog_reservoir_inflation_detection and test_create_oog_reservoir_inflation_detection: these cases no longer follows the latest glamsterdam spec.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.90%. Comparing base (d8a126e) to head (0abdc8a).
⚠️ Report is 3 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #3449      +/-   ##
===================================================
+ Coverage            93.77%   93.90%   +0.13%     
===================================================
  Files                  624      624              
  Lines                36905    36905              
  Branches              3326     3326              
===================================================
+ Hits                 34606    34655      +49     
+ Misses                1597     1569      -28     
+ Partials               702      681      -21     
Flag Coverage Δ
unittests 93.90% <ø> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LouisTsai-Csie
LouisTsai-Csie marked this pull request as ready for review August 28, 2026 08:17
@marioevz
marioevz self-requested a review August 28, 2026 22:46

@marioevz marioevz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing improvements overall!

I added a few more parametrizations and checks in some of the tests.

Thanks for all the changes!

@marioevz
marioevz merged commit c4deda5 into ethereum:forks/amsterdam Aug 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants