execution/state, execution/stagedsync: retain AuRa SystemAddress in all EIP-161 empty-removal paths (extend #21930 family)#21937
Merged
Conversation
…ll EIP-161 empty-removal paths The AuRa hack — never EIP-161-remove the empty SystemAddress (0xff…fe), to match the reference implementation — lived only in the serial executor's updateAccount. Extract it into a shared EIP161EmptyRemoval helper and apply it at every empty-account-removal decision site: - updateAccount (serial executor) — refactored onto the helper - printAccount (debug mirror) - StateV3.applyVersionedWrites balance-increase apply (rw_v3.go) - calcFees coinbase and burnt fee accounts (parallel executor) - normalizeWriteSet, per touched account (parallel executor) The parallel-executor sites (calcFees, normalizeWriteSet, applyVersionedWrites) are EIP-7928/BAL paths that AuRa does not exercise today, so the change is correctness-by-construction / consistency there; the serial path is the consensus-relevant one for AuRa chains. Adds a table test for the helper and a normalizeWriteSet test pinning that an empty SystemAddress is retained under AuRa and removed otherwise.
3963643 to
20ee8f7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the AuRa EIP-161 “empty account removal” compatibility set by ensuring AuRa’s params.SystemAddress is never deleted when empty, across both serial and parallel execution paths (matching the reference AuRa implementation and preventing parallel OCC dependency wedges on Gnosis).
Changes:
- Adds a shared
EIP161EmptyRemoval(spuriousDragon, isAura, addr)helper and uses it at all empty-removal decision points (serialupdateAccount/printAccount, apply-phaseapplyVersionedWrites, parallelcalcFees, and parallelnormalizeWriteSet). - Extends
normalizeWriteSetwith anisAuraparameter and wires it through the parallel executor. - Adds/updates unit tests covering the helper and the AuRa SystemAddress retention behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| execution/state/intra_block_state.go | Introduces EIP161EmptyRemoval helper; refactors serial empty-removal gating and updates debug printing to be AuRa-aware. |
| execution/state/rw_v3.go | Uses the helper in applyVersionedWrites so apply-phase empty-removal also respects AuRa SystemAddress retention. |
| execution/stagedsync/exec3_parallel.go | Uses the helper in parallel fee handling and write-set normalization; threads isAura into normalizeWriteSet. |
| execution/state/versionedio_test.go | Adds table test for EIP161EmptyRemoval. |
| execution/stagedsync/exec3_finalize_test.go | Updates existing tests for new normalizeWriteSet signature and adds AuRa SystemAddress retention test. |
| execution/stagedsync/calc_state_test.go | Updates tests/comments for new normalizeWriteSet signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3450
to
3457
| emptyAddrs := make(map[accounts.Address]bool) | ||
| if emptyRemoval { | ||
| for addr, s := range acctStates { | ||
| if s.hasBal && s.hasNonce && s.hasCode && | ||
| s.balance.IsZero() && s.nonce == 0 && s.codeHash.IsEmpty() { | ||
| emptyAddrs[addr] = true | ||
| } | ||
| for addr, s := range acctStates { | ||
| if state.EIP161EmptyRemoval(emptyRemoval, isAura, addr) && | ||
| s.hasBal && s.hasNonce && s.hasCode && | ||
| s.balance.IsZero() && s.nonce == 0 && s.codeHash.IsEmpty() { | ||
| emptyAddrs[addr] = true | ||
| } | ||
| } |
yperbasis
approved these changes
Jun 22, 2026
mh0lt
added a commit
that referenced
this pull request
Jun 22, 2026
…ss in all EIP-161 empty-removal paths (#21938) Cherry-pick of #21937 to release/3.5. Completes the AuRa EIP-161 family on r3.5: #21931 (already merged) shipped the block-0 ZeroAddress-at-genesis carve-out (chiado #21712); this PR adds the SystemAddress carve-out for AuRa across all empty-account-removal sites. ## r3.5-specific adaptations - Dropped intermediate `TestAsBlockAccessList_Selfdestructed*` tests from `versionedio_test.go` that exist only on main. - Updated my `TestNormalizeWriteSet_GenesisBypass*` / `TestNormalizeWriteSet_PostGenesisEmptyAccountTriggersEIP161` (landed in r3.5 via #21931) to pass the new `isAura bool` arg. ## Verification - All new + existing `TestNormalize|TestFlushToUpdates|TestApplyWrites|TestSD|TestEIP161EmptyRemoval` tests green on r3.5. - `make lint` + `make erigon` clean. - The end-to-end "fixes gnosis tip-tracking dep-0 wedge" evidence is described in the main PR (#21937) — verified against the exact same diff applied to a r3.5 wedged datadir. Fixes the gnosis tip-tracking failure observed on release/3.5 QA runs (e.g. https://github.com/erigontech/erigon/actions/runs/27832904647). Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
yperbasis
added a commit
that referenced
this pull request
Jun 22, 2026
…empty-accounts Resolve EIP-161 family conflicts against #21937 (AuRa SystemAddress carve-out) and #21930 (genesis bypass): every empty-removal gate now flows through Rules.IsEIP161Enabled() while preserving the EIP161EmptyRemoval(spuriousDragon, isAura, addr) helper and the be.blockNum!=0 genesis bypass.
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.
Cherry-pick of #21916 (yperbasis/aura-retain-system-address) onto current main. The original ZeroAddress-at-genesis fix (#21930) is already merged; this PR adds the matching SystemAddress carve-out, completing the AuRa EIP-161 family.
Fixes the gnosis tip-tracking dep-0 abort wedge (verified locally — see verification below).
Background
Two AuRa-specific EIP-161 bugs in parallel exec share the same callsite (
normalizeWriteSet) and the same family:rules = &chain.Rules{}clobber attxtask.Executeso the AuRaCreateAccount(ZeroAddress, false)placeholder is retained in parallel. GatesemptyRemovalwithbe.blockNum != 0at the callsite.EIP161EmptyRemoval(spuriousDragon, isAura, addr)helper that exempts the SystemAddress under AuRa; applies it atupdateAccount,printAccount,calcFees(coinbase + burnt),applyVersionedWrites, andnormalizeWriteSet.Both layers are now compatible: the block-0 gate sets
emptyRemoval=falseat genesis for any chain (preserves all empty allocs); the helper insidenormalizeWriteSetthen carves out SystemAddress on AuRa for blocks whereemptyRemoval=true.Verification
TestNormalize|TestFlushToUpdates|TestApplyWrites|TestSD|TestEIP161EmptyRemovalall green on this branch + lint clean +make erigonclean.DependencyTxIndex=0abort on the AuRa system-init atforkchoice.go:520 → exec3_parallel.go:301. I snapshotted the wedged chaindata (~42G real cost via hardlinked snapshots/), built yperbasis's branch ate3409b6, and ran it against the snapshot. Result:[4/6 Execution] parallel executed blk=46711620 blks=909— 909 blocks applied past the wedge point in one clean cycle, zero errors. The dep-0 abort was the AuRa system-init writing an empty SystemAddress throughcalcFees/normalizeWriteSet(no AuRa carve-out, unlike serial'supdateAccount), which poisoned OCC dependency tracking for the next block's system-init in the same batch.Co-authored by
Andrew Ashikhmin / @yperbasis — author of the original #21916 commit, cherry-picked verbatim.
Backport
A
[r3.5]cherry-pick PR will follow.Supersedes