Skip to content

execution/state, execution/stagedsync: retain AuRa SystemAddress in all EIP-161 empty-removal paths (extend #21930 family)#21937

Merged
mh0lt merged 1 commit into
mainfrom
mh/aura-eip161-consolidated
Jun 22, 2026
Merged

execution/state, execution/stagedsync: retain AuRa SystemAddress in all EIP-161 empty-removal paths (extend #21930 family)#21937
mh0lt merged 1 commit into
mainfrom
mh/aura-eip161-consolidated

Conversation

@mh0lt

@mh0lt mh0lt commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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:

  1. execution/stagedsync: AuRa genesis bypass for parallel-exec emptyRemoval #21930 (already merged): Block-0 ZeroAddress at genesis. Mirrors serial's rules = &chain.Rules{} clobber at txtask.Execute so the AuRa CreateAccount(ZeroAddress, false) placeholder is retained in parallel. Gates emptyRemoval with be.blockNum != 0 at the callsite.
  2. This PR (cherry-pick of execution/state, execution/stagedsync: retain AuRa SystemAddress in all EIP-161 empty-removal paths #21916): AuRa SystemAddress carve-out everywhere. Extracts EIP161EmptyRemoval(spuriousDragon, isAura, addr) helper that exempts the SystemAddress under AuRa; applies it at updateAccount, printAccount, calcFees (coinbase + burnt), applyVersionedWrites, and normalizeWriteSet.

Both layers are now compatible: the block-0 gate sets emptyRemoval=false at genesis for any chain (preserves all empty allocs); the helper inside normalizeWriteSet then carves out SystemAddress on AuRa for blocks where emptyRemoval=true.

Verification

  • Existing tests: TestNormalize|TestFlushToUpdates|TestApplyWrites|TestSD|TestEIP161EmptyRemoval all green on this branch + lint clean + make erigon clean.
  • Gnosis tip-tracking wedge — fixed. I had a release/3.5 gnosis instance wedged for 6 days at block 46,710,713 with deterministic DependencyTxIndex=0 abort on the AuRa system-init at forkchoice.go:520 → exec3_parallel.go:301. I snapshotted the wedged chaindata (~42G real cost via hardlinked snapshots/), built yperbasis's branch at e3409b6, and ran it against the snapshot. Result: [4/6 Execution] parallel executed blk=46711620 blks=909909 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 through calcFees/normalizeWriteSet (no AuRa carve-out, unlike serial's updateAccount), 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

@mh0lt mh0lt requested a review from yperbasis as a code owner June 22, 2026 07:59
…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.
@mh0lt mh0lt force-pushed the mh/aura-eip161-consolidated branch from 3963643 to 20ee8f7 Compare June 22, 2026 08:03
@mh0lt mh0lt changed the title execution: consolidate AuRa EIP-161 empty-account carve-outs (SystemAddress + ZeroAddress-at-genesis) execution/state, execution/stagedsync: retain AuRa SystemAddress in all EIP-161 empty-removal paths (extend #21930 family) Jun 22, 2026
@yperbasis yperbasis requested review from Copilot and taratorio June 22, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (serial updateAccount/printAccount, apply-phase applyVersionedWrites, parallel calcFees, and parallel normalizeWriteSet).
  • Extends normalizeWriteSet with an isAura parameter 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
}
}
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>
@mh0lt mh0lt added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit e431ed4 Jun 22, 2026
93 checks passed
@mh0lt mh0lt deleted the mh/aura-eip161-consolidated branch June 22, 2026 10:24
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.
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.

3 participants