Skip to content

execution/stagedsync: AuRa genesis bypass for parallel-exec emptyRemoval#21930

Merged
AskAlexSharov merged 1 commit into
mainfrom
mh/chiado-aura-genesis-emptyremoval
Jun 22, 2026
Merged

execution/stagedsync: AuRa genesis bypass for parallel-exec emptyRemoval#21930
AskAlexSharov merged 1 commit into
mainfrom
mh/chiado-aura-genesis-emptyremoval

Conversation

@mh0lt

@mh0lt mh0lt commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #21712.

Summary

  • AuRa's CreateAccount(ZeroAddress, false) at genesis (genesiswrite/genesis_write.go) creates an empty account that serial deliberately retains via the rules-clobber at exec/txtask.go (rules = &chain.Rules{} at block 0 — "For Genesis, rules should be empty, so that empty accounts can be included").
  • Parallel's normalizeWriteSet ignored that override and applied EIP-161 emptyRemoval at block 0, emitting SelfDestructPath=true for ZeroAddress → calc_state produced DeleteUpdate → divergent trie root.
  • Fix: gate emptyRemoval at the parallel callsite with be.blockNum != 0, mirroring serial's bypass.

Tests

  • TestNormalizeWriteSet_GenesisBypassRetainsEmptyAccount — pins the new bypass (empty account at block 0 → no SelfDestructPath, FlushToUpdates emits the full account UPDATE).
  • TestNormalizeWriteSet_PostGenesisEmptyAccountTriggersEIP161 — contrast (block > 0: SelfDestructPath emitted, DeleteUpdate flushed).

Test plan

  • New unit tests green.
  • Existing `TestNormalize|TestFlushToUpdates|TestApplyWrites|TestSD` suite still green.
  • End-to-end on release/3.5: chiado parallel sync from empty datadir with `--prune.mode=archive --prune.include-commitment-history --persist.receipts --snap.skip-state-snapshot-download --sync.loop.block.limit=10000 --batchSize=512mb` reached chain tip (block 21,732,513, step 168.6) in ~1d13h with zero wrong-trie / invalid-block errors. Same code path on main, so identical behaviour expected.
  • CI green on the PR.

Backport

An `[r3.5]` cherry-pick PR will follow this one targeting `release/3.5`.

Mirror serial's txtask.Execute rules-clobber (rules = &chain.Rules{} at
block 0) at the parallel normalizeWriteSet callsite. Without this, the
AuRa CreateAccount(ZeroAddress) placeholder is treated as EIP-161-empty
in parallel, emitted as SelfDestructPath=true, and turned into a
DeleteUpdate by calc_state — diverging from serial's full-account
UPDATE and producing the wrong trie root reported in #21712.

Fixes #21712
AskAlexSharov pushed a commit that referenced this pull request Jun 22, 2026
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 3208ccf Jun 22, 2026
93 checks passed
@AskAlexSharov AskAlexSharov deleted the mh/chiado-aura-genesis-emptyremoval branch June 22, 2026 07:59
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.
pull Bot pushed a commit to Dustin4444/erigon that referenced this pull request Jun 22, 2026
…ll EIP-161 empty-removal paths (extend erigontech#21930 family) (erigontech#21937)

Cherry-pick of erigontech#21916 (yperbasis/aura-retain-system-address) onto
current main. The original ZeroAddress-at-genesis fix (erigontech#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. **erigontech#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 erigontech#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=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
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 erigontech#21916 commit,
cherry-picked verbatim.

## Backport

A `[r3.5]` cherry-pick PR will follow.

## Supersedes

- erigontech#21916 (this is the same diff, rebased onto current main on top of
erigontech#21930)

Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com>
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.

[r3.5] Wrong trie root on Chiado re-exec from 0

2 participants