fix(ported_static): bump gas budgets for EIP-8037 state-gas headroom on Amsterdam#2796
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devnets/bal/7 #2796 +/- ##
================================================
Coverage ? 85.59%
================================================
Files ? 630
Lines ? 39606
Branches ? 3937
================================================
Hits ? 33899
Misses ? 5083
Partials ? 624
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:
|
cc41427 to
052496d
Compare
| @@ -70,7 +76,7 @@ def test_create2_contract_suicide_during_init_then_store_then_return( | |||
| contract_0 = pre.deploy_contract( # noqa: F841 | |||
| code=Op.POP( | |||
| Op.CALL( | |||
| gas=0x249F0, | |||
| gas=0x100000, | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Same comment for the rest of the tests.
|
Feel free to rebase on the latest |
Per review feedback (ethereum#2796 review by marioevz), all hardcoded gas bumps for EIP-8037 state-gas headroom on Amsterdam are now wrapped in an `if fork.is_eip_enabled(8037)` guard that preserves the original pre-EIP-8037 gas value as the default branch. The same call sites keep their bumped value on Amsterdam. Affected categories: - 35 stCallCodes/stCallDelegateCodes* tests — three inner-CALL gas values (`0x3D090` / `0x493E0` / `0x55730`) replaced with `inner_call_gas` / `middle_call_gas` / `outer_call_gas` variables that flip to the bumped values on EIP-8037. Three outlier files (test_callcode_dynamic_code{,2_self_call}, test_callcodecallcode callcode_111_suicide_end) use their own original values but the same conditional pattern. - 13 individual gas-bump tests (from the original PR 2796 commit and later follow-ups) — each gets fork-conditional `tx_gas_limit`, `tx_gas[]`, `inner_call_gas`, or sender funding variables that preserve the original literal pre-EIP-8037. The four gas-measurement tests already committed earlier this branch (test_storage_costs, test_varied_context, test_precomps_eip2929_ cancun, test_manual_create) and test_codesize_valid use the same pattern via the `sstore_set_delta` / `new_account_delta` / similar helpers — those are left unchanged. Verified full Amsterdam fill on `tests/ported_static/` still produces 18 051 passed / 0 failed / 879 skipped.
…ements
Rebase of branch wt-snobal-4-amsterdam-state-gas-fixes onto bal/7
HEAD. Two upstream changes drive the new revision:
- `bcc2a876d` raises `COST_PER_STATE_BYTE` from 1 174 to 1 530, so
per-storage state-gas is now `32 * 1530 = 48 960` and per-new-
account state-gas is `112 * 1530 = 171 360`.
- `2e707c22c` etc. add fresh entries to `amsterdam_skip_list.txt`
covering more tests broken by EIP-8037 on Amsterdam.
The 11 original commits on this branch collapsed to a single
revision because:
- test_sstore_change_from_external_call_in_init_code.py — bal/7's
upstream version (`tx_gas = [intrinsic + tx_data[d].gas_cost
(fork)]` with `inner_call_cost` annotations) supersedes the gas
bump this branch had. Keep bal/7's version, drop the bump.
- test_storage_costs, test_varied_context, test_manual_create,
test_precomps_eip2929_cancun — replace the hardcoded SSTORE-set
and NEW_ACCOUNT spillover deltas (20 468 / 106 488 / 126 956,
derived for CPSB = 1 174) with fork-helper expressions
(`fork.sstore_state_gas() - 17 100`, `fork.create_state_gas() -
25 000`, and their sum) so the deltas auto-adapt to the new
1 530 CPSB and any future change.
- All other gas-bump tests — keep their fork-conditional structure
from the prior `refactor(ported_static): make EIP-8037 gas bumps
fork-conditional` commit, but raise the EIP-8037 budgets where
1 530 CPSB pushes the previous bump under the new spill (test_
storage_costs, test_manual_create, test_codesize_valid,
test_callcode_dynamic_code, test_wallet_construction, test_
callcodecallcodecallcode_111_suicide_end). Pre-EIP-8037 values
are still preserved.
Skip list: start from bal/7's 1 062-entry list (which already
covered the new failures the CPSB bump introduced), then drop the
165 entries that point at files this branch fixes. New total: 732.
Verified across Cancun/Prague/Osaka/Amsterdam: 60 476 passed,
0 failed. Amsterdam alone: 16 482 passed, 0 failed, 2 448 skipped.
d9b6b5f to
e010aef
Compare
Apply `just fix` formatting to the 4 gas-measurement tests this branch touches (test_storage_costs, test_varied_context, test_manual_create, test_precomps_eip2929_cancun) plus an upstream-drift reformat picked up in test_state_gas_call.py. Shorten the E501-flagged docstring line in test_manual_create by dropping the inline assignment from the explanation. `just static` passes (exit 0).
|
@marioevz @spencer-tb rebased, added more tests fixes and did as Mario said with the conditional gas |
🗒️ Description
Make
tests/ported_static/pass on Amsterdam under EIP-8037's two-dimensional gas model. Fix categories:Gas-bump tests (OoG headroom): hardcoded
tx_gas/ inner-CALL gas in tests authored against pre-EIP-8037 budgets is too tight on Amsterdam (EIP-8037 splits SSTORE-set / CALL-with-value-to-new-account / SELFDESTRUCT-to-new-account into a smaller regular portion plus state-gas; when the reservoir is empty the state-gas spills back into regular gas). Each affected literal is replaced with a fork-conditional variable that keeps the original value on pre-EIP-8037 forks and uses a higher bump on Amsterdam.Gas-measurement tests (
Op.GASbefore/after a state-changing op, value stored as post-state): the observed regular-gas consumption changes by deterministic deltas under EIP-8037:fork.sstore_state_gas() - 17 100per fresh SSTORE-set spill (17 100 = the SSTORE-set base regular drop)fork.create_state_gas() - 25 000per NEW_ACCOUNT spill (25 000 = old CALL_NEW_ACCOUNT / SELFDESTRUCT base)Expected storage values become
original_value + (delta if fork.is_eip_enabled(8037) else 0). The fork-helper expressions auto-adapt to any futureCOST_PER_STATE_BYTEchange (this branch already saw 1 174 → 1 530 mid-flight without further hand-tuning).stCallCodes / stCallDelegateCodes* family (35 files): all share the same nested CALL/CALLCODE/DELEGATECALL pattern with three hardcoded inner gas values (
0x3D090/0x493E0/0x55730). Replaced with fork-conditionalinner_call_gas/middle_call_gas/outer_call_gasvariables across the family.Per review feedback (#2796 by @marioevz), every gas change preserves the original value as the
elsebranch ofif fork.is_eip_enabled(8037), so behavior on Cancun / Prague / Osaka is unchanged.Stats
Verification
Files by category
Gas-bump (fork-conditional
tx_gas/ inner CALL gas):stCreate2/test_create2collision_selfdestructed.py400 000 → 1 000 000, inner CALL0xC350 → 0x40000stCreate2/test_create2collision_selfdestructed2.py400 000 → 1 000 000, inner CALL0xC350 → 0x40000stCreate2/test_create2_smart_init_code.py400 000 → 1 000 000stCreate2/test_create2_contract_suicide_during_init_then_store_then_return.py600 000 → 5 000 000, inner CALL0x249F0 → 0x100000stCreateTest/test_create_transaction_call_data.py100 000 → 500 000stCreateTest/test_create_transaction_high_nonce.py90 000 → 500 000stCodeSizeLimit/test_codesize_valid.py15M → 40MstRevertTest/test_revert_opcode_in_init.py160 000 → 800 000stSStoreTest/test_sstore_change_from_external_call_in_init_code.pystInitCodeTest/test_call_the_contract_to_create_empty_contract.py100 000 → 500 000stWalletTest/test_day_limit_construction.py[817 083, 1 217 083] → [5 000 000, 7 000 000]stWalletTest/test_wallet_construction.py[1 225 023, 1 825 023] → [8 000 000, 10 000 000]stHomesteadSpecific/test_create_contract_via_transaction_cost53000.py100 000 → 500 000, sender0xF4240 → 0x4C4B40stPreCompiledContracts2/test_call_ecrecover_overflow.py100 000 → 500 000(inner ecrecover CALL0xBB8unchanged — that's the test premise)Gas-measurement (fork-conditional expected-value deltas via fork helpers):
stEIP2930/test_storage_costs.py+ fork.sstore_state_gas() - 17 100to 10 SSTORE-set measurementsstEIP2930/test_varied_context.pystEIP2930/test_manual_create.pystPreCompiledContracts/test_precomps_eip2929_cancun.pystCallCodes / stCallDelegateCodes* (35 files): uniform
inner_call_gas/middle_call_gas/outer_call_gasfork-conditional refactor.✅ 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