feat(spec-specs, tests): implement EIP-8253, bump nonce of zero-nonce storage accounts - #3535
jochem-brouwer wants to merge 8 commits into
Conversation
… block Set the nonce of the 28 Mainnet accounts with empty code, a zero nonce and non-empty storage to one at the start of the fork block, before the pre-execution system contract calls. The change is recorded in the block access list at block access index zero. `execute_block` derives whether a block activates the fork from `FORK_CRITERIA` and the parent header, and passes it to `apply_body`. `ForkLoad` exposes the new module to the transition tool.
…vation Add fork-transition tests for EIP-8253: the nonce bump and its block access list entries, a replay of each account's Mainnet creation colliding at the fork block, calls to a bumped account, untouched non-targeted accounts, and the unconditional bump of accounts absent from the pre-state. The blockchain filler now tells the transition tool when a block activates its fork (`fork_activation`), which the in-process spec t8n uses to apply the bump; the CLI and daemon accept `--state.fork-activation`. Forks expose `zero_nonce_storage_accounts()`. Pre-states are checked against the EIP-8253 invariants: before the bump, a listed address must have a zero nonce and no code; from the bump on, no account may have empty code, a zero nonce and non-empty storage. The EIP-7928 BAL size transition test budgets the extra fork-block entries.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #3535 +/- ##
===================================================
+ Coverage 94.01% 94.39% +0.38%
===================================================
Files 624 625 +1
Lines 36912 36949 +37
Branches 3326 3328 +2
===================================================
+ Hits 34702 34878 +176
+ Misses 1533 1459 -74
+ Partials 677 612 -65
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
(Dumping some extra output of Claude here) Tests capped by EIP-8253From Amsterdam on, no account may have empty code, a zero nonce, and
Alternative to cappingThe ported tests (3 to 17) all use the same pre-state line, |
|
Hi all, the review of this PR has two parts:
These can be done in parallel 😄 👍 |
…e EIP-8253 case map Add a `nonce-balance-storage` variant to the EXTCODEHASH empty-account test: a codeless account with storage and nonce one fails the EIP-684 creation check, so its storage can never be adopted and the case is valid at every fork. Bring `test_cases.md` in line with the consolidated tests: the renamed `test_targeted_accounts_without_storage`, the activation delay on the bump test, the synthetic factory wording, and the fact that the spec's own fork-block detection is exercised when `validate-blocks` replays transition fixtures (ethereum#3564).
|
This PR is blocked by #3557 which should first be merged 😄 👍 |
Description
Implements EIP-8253 for Amsterdam, with tests.
Spec. At the start of the fork block, before the pre-execution system calls, the nonce of the 28 Mainnet accounts with empty code, zero nonce and non-empty storage is set to one. Balance, code and storage are untouched. The BAL records one
NonceChange [0, 1]per account at block access index 0. The bump is unconditional, as the EIP specifies: the fixed address list selects the accounts, not their state, so a listed account is bumped even when it is absent or has empty storage.Fork block detection. The spec derives
is_fork_blockfromFORK_CRITERIAand the parent header. The filler passes an explicitfork_activationflag to the transition tool (--state.fork-activationfor the CLI and daemon); external t8n binaries do not receive it yet. The spec's own detection is exercised when thevalidate-blocksCI step replays the transition fixtures throughstate_transition, which needs #3564.Pre-states. The framework imposes no Mainnet-shape restriction on custom pre-states, at the listed addresses or elsewhere: the list only says which addresses are bumped. Existing tests that build codeless zero-nonce storage accounts keep running at Amsterdam. The EXTCODEHASH empty-account test gains a nonce-bearing storage variant, which is the only such shape reachable on Mainnet after Spurious Dragon.
Tests (
tests/amsterdam/eip8253_..., all fork-transition; see itstest_cases.md): nonce bump with full BAL and post-state checks, with the fork block at the fork timestamp or past it;CREATEcollision at and after the fork block from a synthetic factory at each account's historical creator address and nonce (verified against chain data), plusCREATEfailures before the target is accessed; calls to a bumped account; non-targeted and same-shape accounts untouched; listed accounts that are absent or have empty storage. BAL merging of the index-zero nonce change with reads, transfers, reverted transfers, OOG before access, EIP-2930 listings,SELFDESTRUCT, fee recipient, withdrawals, and the BAL size budget; and rejection of BALs with a missing, wrong, duplicated, split, mis-ordered, or non-canonically encoded bump. The EIP-7928 BAL size transition test budgets the 28 extra fork-block entries. The BAL modifier module gains anonce_block_access_indexscalar for the index-zero encoding test.None of the 28 addresses is reachable by
CREATEagain: 26 were created by EOA transactions whose nonces have moved on, and the 2 factory-created ones came from factories that self-destructed and, under EIP-161, could never again create from nonce 0. Replaying the original creation transactions is not possible either: under EIP-8037 state gas every one of them runs out of gas within its signed gas limit.Related Issues or PRs
Depends on #3564 for the spec-side fork-block coverage. Test cases follow the list proposed by @nerolation.
Checklist
just static<type>(<area>): <title>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.Cute Animal Picture