fix(sync): prevent validator duties on stale heads - #618
Open
dicethedev wants to merge 1 commit into
Open
dicethedev wants to merge 1 commit into
dicethedev wants to merge 1 commit into
Conversation
pablodeymo
reviewed
Sep 22, 2026
pablodeymo
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for picking this up, @dicethedev! The PR is well scoped, the description is clear, and the shared Arc<AtomicU64> marker is a nice fit, since both actors already share the Store. I ran fmt, clippy and the full workspace suite locally and everything passes.
A few comments below.
1. Future-head rejection changes range-sync behavior
handle_status_response now returns early for a peer whose head is more than one slot past our wall clock, so we no longer range-sync from that peer. The tolerance is also slot-granular and wall-clock based, while the block path uses store time plus GOSSIP_DISPARITY_INTERVALS. Could the two use the same bound?
Smaller items
Store::max_live_chain_slothas no callers left, so it can be removed.- The wall-clock slot calculation in
observe_peer_headis a third copy (seerpc/src/node.rsandbin/ethlambda/src/main.rs). A small helper would keep them from drifting apart. - Tests:
- Nothing exercises the actual wiring, where
update_sync_statusreads the store's marker. A test driving a pending block, or a peer head, through toduties_allowed()would pin the fix end to end. fresh_peer_head_blocks_duties_during_long_range_syncis effectively the same as the existingsync_status_detects_local_lag_when_fresh_blocks_are_known.- The new early return in
handle_status_responsehas no test.
- Nothing exercises the actual wiring, where
Thanks again, this closes a real gap!
This branch has not been deployed
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.
🗒️ Description / Motivation
This PR fixes the duty sync gate reporting
Syncedwhile the local node is far behind the network.Previously, the gate used the highest slot in the local
LiveChaintable. Pending blocks and peer-advertised heads were excluded, so the freshest-known slot advanced alongside the stale local head during backfill. The heuristic interpreted this as a network-wide stall and incorrectly allowed proposals and attestations.The node now tracks the highest block slot observed from valid peer status messages, pending blocks, imported blocks, and the persisted head after restart.
What Changed
Store.LiveChain.Correctness / Behavior Guarantees
Syncingand does not propose or attest on a stale head.Tests Added / Run
Added tests covering:
Related Issues / PRs
✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(cargo test --workspace --profile release-fast) — all passing