feat(tests): 8037-Add tests for 7702 interactions#2722
Draft
kclowes wants to merge 41 commits intoethereum:eips/amsterdam/eip-8037from
Draft
feat(tests): 8037-Add tests for 7702 interactions#2722kclowes wants to merge 41 commits intoethereum:eips/amsterdam/eip-8037from
kclowes wants to merge 41 commits intoethereum:eips/amsterdam/eip-8037from
Conversation
…se (ethereum#2363) * feat(spec-specs): update EIP-8037 to match latest spec revision * feat(tests): add EIP-8037 state creation gas cost increase tests
Co-authored-by: Ben Adams <thundercat@illyriad.co.uk>
Add sstore_state_gas(), code_deposit_state_gas(), and create_state_gas() calculator methods to Fork. Replace Spec constants and manual gas arithmetic across all EIP-8037 tests with dynamic fork method calls. Remove redundant Op.STOP, hardcoded numbers from docstrings, and add fork: Fork parameter to all test functions that use fork methods.
Test CREATE with max initcode size using proper regular/state gas split via the reservoir. Verifies gas boundary behavior with EIP-8037 two-dimensional metering.
Align EIP-8037 gas constant references with upstream renames: - GAS_STORAGE_UPDATE → GAS_COLD_STORAGE_WRITE - GAS_COLD_SLOAD → GAS_COLD_STORAGE_ACCESS - GAS_WARM_ACCOUNT_ACCESS → GAS_WARM_ACCESS Bump gas_limit on tests added to upstream after EIP-8037 branched, which now need extra gas for EIP-8037 state gas costs.
… format runs in withdrawal request contract tests (ethereum#2532) * fix(tests): prevent tx_gas_limit double-accumulation across fixture format runs in withdrawal request contract tests * fix: mypy * fix: ruff * fix: ruff * chore(tests): refactor fix to fork-aware transactions to prevent mutation * chore(test): add a warning to all tests that could mutate vars; address in later PR Add a lightweight repr-based snapshot hook to the filler plugin that warns whenever any ``pytest.param`` value is mutated during a test run. A subsequent PR could address this by returning values instead of mutating, then flipping the hook to a hard failure. --------- Co-authored-by: fselmo <fselmo2@gmail.com>
…hereum#2526) Co-authored-by: fselmo <fselmo2@gmail.com>
… gas validity test (ethereum#2583) Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
Conditionally increase tx gas_limit (and env gas_limit where needed) when fork >= Amsterdam to account for EIP-8037 state creation gas costs. 137 files, 9 with env gas_limit bumps. Headroom: 2,000,000.
Move MAX_CODE_SIZE check before gas charges, charge keccak hash cost (regular gas) before code deposit state gas, and add tests for over-max code size and reservoir preservation after OOG.
On CREATE/CREATE2 address collision the 63/64 gas allocation is burned but was not added to regular_gas_used, leaving it invisible to 2D block gas accounting. Per EIP-684 collision behaves as an immediate exceptional halt, so the burned gas belongs in the regular dimension.
…and subcall pattern Co-authored-by: Mario Vega <marioevz@gmail.com>
The static test skip list and conftest were a temporary workaround for EIP-8037 gas failures. The ported static tests in tests/ported_static/ replace this approach; failures are tracked in ethereum#2601.
…thereum#2603) * fix(execute): use --sender-fund-refund-gas-limit for all funding txs On EIP-8037 networks, simple value transfers to new accounts require more than 21000 gas due to GAS_NEW_ACCOUNT state gas (112 * cpsb). The default Transaction gas_limit of 21000 causes 'intrinsic gas too low' errors during test setup. Changes: - contracts.py: Use 200000 gas for deterministic factory deployer funding - pre_alloc.py: Pass sender_fund_refund_gas_limit to Alloc and use it for simple EOA funding transactions Usage: --sender-fund-refund-gas-limit 200000 * chore: additional fixes for execute remote funds w/ higher gas limits * fix: bump all gas limits to 200k for EIP-8037 state creation costs - sender.py: bump --sender-fund-refund-gas-limit default 21000 → 200000 - pre_alloc.py: bump funding_gas_limit default 21000 → 200000 - pre_alloc.py: use configurable gas limit for per-test refund txs - execute_recover.py: bump recovery refund gas limit 21000 → 200000 EIP-8037 charges GAS_NEW_ACCOUNT (112 × cost_per_state_byte = 131488) for transfers to new accounts, making 21000 gas insufficient for all funding, refund, and recovery transactions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Felipe Selmo <fselmo2@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… gas (ethereum#2595) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…ode size validation (ethereum#2608) * fix(spec): charge CREATE state gas after initcode size validation Move charge_state_gas(STATE_BYTES_PER_NEW_ACCOUNT) from create()/create2() into generic_create(), after the MAX_INIT_CODE_SIZE check. Previously, state gas was charged before the initcode size check, so a CREATE with oversized initcode would persist state_gas_used equal to the account creation state gas cost (STATE_BYTES_PER_NEW_ACCOUNT * cost_per_state_byte) even though no account was ever created and no state was touched. Reported by @AskDragan (reth): ethereum#2578 (comment) * fix(spec): check static context before gas in CREATE/CREATE2 Move the is_static check from generic_create() into create() and create2(), before stack pops and charge_gas(). This is consistent with SSTORE, CALL, and SELFDESTRUCT which all check static context before any gas charging.
… the correct token formula
…evel failure (ethereum#2689) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…hereum#2646) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
…e gas at end of tx (ethereum#2707)
…ck at tx inclusion (ethereum#2703) * feat(tests): 8037 Check 2d gas before tx inclusion * feat(spec-specs): More tests for 2d tx inclusion spec change * fix(tests): consolidate state gas boundary tests and clean docstrings Cleanups to the per-dimension block gas inclusion tests: - Combine `test_block_state_gas_limit_exact_fit` and `test_block_state_gas_limit_exceeded` into `test_block_state_gas_limit_boundary` parametrized `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the `_block_state_gas_limit_setup` helper. Removes ~45 lines with no coverage loss. - Fix docstring references in both boundary cases: state contribution is `tx.gas - intrinsic_regular`, not `tx.gas - TX_MAX_GAS_LIMIT`. - Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state` and add assertion messages that spell out the old-vs-new formula discrimination. - Apply ruff format (drop an unneeded line wrap on `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`). Co-authored-by: kclowes <kclowes@users.noreply.github.com> --------- Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
4 tasks
cc2cd47 to
44c4c15
Compare
de71eca to
f2049fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description
Tests to spark conversation from here.
🔗 Related Issues or PRs
N/A.
✅ 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