Skip to content

fix(ported_static): bump gas budgets for EIP-8037 state-gas headroom on Amsterdam#2796

Open
leolara wants to merge 1 commit intoethereum:devnets/bal/7from
leolara:wt-snobal-4-amsterdam-state-gas-fixes
Open

fix(ported_static): bump gas budgets for EIP-8037 state-gas headroom on Amsterdam#2796
leolara wants to merge 1 commit intoethereum:devnets/bal/7from
leolara:wt-snobal-4-amsterdam-state-gas-fixes

Conversation

@leolara
Copy link
Copy Markdown
Member

@leolara leolara commented May 4, 2026

🗒️ Description

Bump gas budgets in 10 tests/ported_static/ files so they pass on fork_Amsterdam under EIP-8037's two-dimensional gas model. Each changed file gets @manually-enhanced so future regenerator runs skip them. Drop 24 corresponding entries from amsterdam_skip_list.txt.

Why

EIP-8037 raises NEW_ACCOUNT state gas to 112 × cost_per_state_byte = 131 488 and per-storage-set state gas to 32 × cpsb = 37 568. The affected tests were authored against pre-EIP-8037 gas budgets; on Amsterdam they OoG before reaching the operation the test exercises (SELFDESTRUCT-to-empty, nested CREATE, init-code SSTORE, multi-CREATE wallet construction, …).

On Cancun / Prague / Osaka the same Fork.create_state_gas / sstore_state_gas helpers return 0, so the bumped budget runs the same code path on the same accounting — no observable difference.

What changed

File Outer tx gas Inner CALL gas Class fixed
stCreate2/test_create2collision_selfdestructed.py 400 000 → 1 000 000 0xC350 → 0x40000 (3×) BalanceMismatchError × 9
stCreate2/test_create2collision_selfdestructed2.py 400 000 → 1 000 000 0xC350 → 0x40000 (2×) BalanceMismatchError × 6
stCreate2/test_create2_smart_init_code.py 400 000 → 1 000 000 MissingAccountError × 3
stCreate2/test_create2_contract_suicide_during_init_then_store_then_return.py 600 000 → 5 000 000 0x249F0 → 0x100000 MissingAccountError × 3
stCreateTest/test_create_transaction_call_data.py 100 000 → 500 000 UnexpectedExecutionFailError × 9
stRevertTest/test_revert_opcode_in_init.py 160 000 → 800 000 NonceMismatchError × 2 + UnexpectedExecutionFailError × 4
stSStoreTest/test_sstore_change_from_external_call_in_init_code.py 200 000 → 1 000 000 MissingAccountError × 6
stInitCodeTest/test_call_the_contract_to_create_empty_contract.py 100 000 → 500 000 NonceMismatchError × 3
stWalletTest/test_day_limit_construction.py [817 083, 1 217 083] → [5 000 000, 7 000 000] MissingAccountError × 6
stWalletTest/test_wallet_construction.py [1 225 023, 1 825 023] → [6 000 000, 8 000 000] MissingAccountError × 6

Verification

uv run fill <all 10 files> --fork Amsterdam --output ... --clean -n 4:

==================== 102 passed in 2.24s ====================

Same on --fork Cancun (102 passed, 1.99 s) — confirms the bumps don't change the test outcome on earlier forks.

Reduces the amsterdam_skip_list.txt from 5 458 to 5 445 entries (24 removed; 13 had already been pruned in the corresponding pre-@manually-enhanced cleanup).

What is not in this PR

Discovered while triaging: 7 files where a gas bump did let the tx run, but surfaced a post-state mismatch (coinbase-balance shift, refund-residue accounting, env-gas_limit-is-the-test-parameter, etc.) that can't be fixed without changing the test's premise. Those need either a fork-conditional formula in the post-state (the PR #2790 pattern) or per-parametrization analysis. They're documented under "Tried gas-bump, found NOT simple" in .mb/sync-ported-static-snobal-4/skipped-failures.md (not committed).

The bulk KeyValueMismatchError cluster (1 036 parametrizations) is also out of scope — different fix family.

🔗 Related Issues or PRs

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (devnets/bal/7@eb80b43). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             devnets/bal/7    #2796   +/-   ##
================================================
  Coverage                 ?   85.58%           
================================================
  Files                    ?      630           
  Lines                    ?    39600           
  Branches                 ?     3936           
================================================
  Hits                     ?    33891           
  Misses                   ?     5084           
  Partials                 ?      625           
Flag Coverage Δ
unittests 85.58% <ø> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

@leolara leolara marked this pull request as ready for review May 4, 2026 15:59
@leolara leolara changed the base branch from devnets/snøbal/4 to devnets/snobal/6 May 5, 2026 08:58
@leolara leolara requested a review from spencer-tb May 6, 2026 13:30
…on Amsterdam

EIP-8037's two-dimensional gas model raises NEW_ACCOUNT state gas
(112 × cost_per_state_byte = 131 488) and per-storage-set state gas
(32 × cpsb = 37 568). Several ported_static tests were authored
against the pre-EIP-8037 gas budgets, where these state-gas costs
didn't exist; on Amsterdam they OoG before reaching the operations
the test exercises (SELFDESTRUCT-to-empty, nested CREATE, init-code
SSTORE, multi-CREATE wallet construction, ...). Cancun/Prague/Osaka
post-state expectations are unaffected — the helpers return 0 for
state gas there, so the same code path runs on the same budget.

Bump the relevant `tx_gas` (or inner CALL gas) on tests where:
  - the failure is a CREATE/SELFDESTRUCT path running out of state-gas
    headroom (not a refund/coinbase accounting shift), and
  - the bump preserves the test's intent (post-state on all forks
    unchanged; the OoG-by-design parametrizations, where applicable,
    keep their original budget).

Each modified file gets a `@manually-enhanced` docstring marker so a
future regenerator skips them.

Files modified (10) and skip-list entries dropped (24):
- stCreate2/test_create2collision_selfdestructed{,2}.py
- stCreate2/test_create2_smart_init_code.py
- stCreate2/test_create2_contract_suicide_during_init_then_store_then_return.py
- stCreateTest/test_create_transaction_call_data.py
- stRevertTest/test_revert_opcode_in_init.py
- stSStoreTest/test_sstore_change_from_external_call_in_init_code.py
- stInitCodeTest/test_call_the_contract_to_create_empty_contract.py
- stWalletTest/test_{day_limit,wallet}_construction.py

Verified: all 10 files, --fork Amsterdam and --fork Cancun, 102 passed
0 failed. Reduces the still-failing fork_Amsterdam parametrization
count by 57 (1 269 -> 1 212).

Out of scope for this branch: tests where the post-state mismatch is
a coinbase-balance shift (formula-derived fix territory, like ethereum#2790),
tests where OoG/revert is the test premise, and the bulk
KeyValueMismatchError cluster (1 036) which needs a different fix
shape entirely.
@leolara leolara changed the base branch from devnets/snobal/6 to devnets/bal/7 May 8, 2026 12:56
@leolara leolara force-pushed the wt-snobal-4-amsterdam-state-gas-fixes branch from cc41427 to 052496d Compare May 8, 2026 12:56
Comment on lines 75 to +79
# { (CALL 150000 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 0 0 32) (SSTORE 1 (MLOAD 0)) } # noqa: E501
contract_0 = pre.deploy_contract( # noqa: F841
code=Op.POP(
Op.CALL(
gas=0x249F0,
gas=0x100000,
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.

Can we create a call_gas variable that has a different value depending on whether EIP-8037 is enabled in the fork where the test is being executed?

call_gas = 0x249F0
if fork.is_eip_enabled(8037):
  call_gas = 0x100000
# { (CALL 150000 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 0 0 32) (SSTORE 1 (MLOAD 0)) }  # noqa: E501
contract_0 = pre.deploy_contract(  # noqa: F841
code=Op.POP(
Op.CALL(
                gas=call_gas,

This will allow us to preserve the original gas value in case we need to do further modifications, and it also makes it more clear why this gas bump was done in the first place.

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.

Same comment for the rest of the tests.

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