Skip to content

eth/protocols/snap: check pivot ancestry against the header chain - #35930

Merged
rjl493456442 merged 2 commits into
ethereum:masterfrom
jrhea:snap2-pivot-move-reset
Oct 10, 2026
Merged

rjl493456442 merged 2 commits into
ethereum:masterfrom
jrhea:snap2-pivot-move-reset

Conversation

@jrhea

@jrhea jrhea commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Resolves #35922

When the pivot moves, snap/2 decides whether it can roll its state forward with BALs or has to start over because the old pivot was reorged out. It decided by looking up the canonical hash at the old pivot's height and treating a missing entry as a reorg. During snap sync that entry is usually missing even when nothing was reorged: the pivot block is only written to disk once its state is done, and the block download can trail the pivot by hours on a fresh sync. So a normal pivot move, a restart, or a lagging block download wiped all progress.

This PR checks the header chain instead. It follows parent hashes from the new pivot back to the old one's height, using the skeleton, which always has these headers. If it reaches the old pivot, we roll forward; otherwise we start over. The tests now keep their headers only in the skeleton, like a real sync, and fail with the old check. TestPivotMovement was passing on master by wiping and redownloading.

@jrhea
jrhea requested a review from rjl493456442 as a code owner October 9, 2026 23:21
@rjl493456442 rjl493456442 added this to the 1.17.9 milestone Oct 10, 2026
@rjl493456442
rjl493456442 merged commit 3a6c2e3 into ethereum:master Oct 10, 2026
10 checks passed
heathsanchez added a commit to metalogiclabs/go-ethereum that referenced this pull request Oct 10, 2026
@jrhea
jrhea deleted the snap2-pivot-move-reset branch October 10, 2026 19:37
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.

snap/2: forward pivot move restarts snap sync from scratch (state-sync retarget races the canonical-hash write)

2 participants