cl/phase1/stages: fix EL backfill slot/block unit mix#21570
Merged
Conversation
destinationSlotForEL is a beacon slot, but the snapshot-gap path stored an EL block number (frozenBlocksInEL-1) in it. Post-merge the block number exceeds the slot, so the finished-gate tripped at the chain tip and the EL history backfill stalled, leaving the tip-to-head gap unfilled. The block collector then loops on "parent's total difficulty not found". Track the gap floor as a separate EL block number, compared against EL block progress rather than the beacon slot.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a unit mismatch in the Caplin history download stage where a beacon-slot floor (destinationSlotForEL) was incorrectly overwritten with an EL block number in the snapshot-gap path, causing EL history backfill to report “finished” at the chain tip and download nothing after behind-node restarts.
Changes:
- Introduces
elBackfillFinished(...)to decide EL-backfill completion using the correct unit (beacon slot vs EL block number for snapshot gaps). - Tracks snapshot-gap completion with a dedicated
destinationBlockForEL(EL block floor) instead of reusingdestinationSlotForEL. - Adds unit tests covering both snapshot-gap and no-gap completion behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cl/phase1/stages/stage_history_download.go |
Separates beacon-slot and EL-block backfill floors and centralizes completion logic in elBackfillFinished. |
cl/phase1/stages/stage_history_download_test.go |
Adds tests ensuring snapshot-gap completion uses EL block progress and no-gap completion uses the beacon-slot floor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
domiwei
approved these changes
Jun 2, 2026
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.
Problem
destinationSlotForELis a beacon slot, but the snapshot-gap path stored an EL block number (frozenBlocksInEL-1) in it. Post-merge the block number exceeds the slot, so the finished-gate (slot <= destinationSlotForEL) and the wait loop (Progress() > destinationSlotForEL) misfire: the EL history backfill reports finished at the chain tip and downloads nothing. The tip-to-head gap never fills, and the block collector loops:Hits any behind-node restart where
HasGapInSnapshotsis true.Fix
Track the gap floor as a separate EL block number compared against EL block progress (
currEth1Progress), not the beacon slot. Decision extracted toelBackfillFinishedwith a unit test for the gap and no-gap paths.