Repository navigation
blocksync: verify extended commits before storing them and stay in sync without a servable peer - #67
Merged
Merged
Conversation
Kefancao
approved these changes
Oct 28, 2026
tqin7
force-pushed
the
tq/blocksync-sync-hardening
branch
from
October 29, 2026 16:17
6a1b996 to
f35aac0
Compare
- ValidatorSet.VerifyExtendedCommit checks every precommit and extension signature and the +2/3 threshold, returning an error where ToExtendedVoteSet panics - the reactor runs it before SaveBlockWithExtendedCommit and treats a missing extended commit at a vote-extension height as a peer error instead of panicking
- updateMaxPeerHeight counts the peers whose base is at or below pool.height - IsCaughtUp returns false when that count is zero, so an all-pruned peer set no longer reads as being at the tip
tqin7
force-pushed
the
tq/blocksync-sync-hardening
branch
from
October 29, 2026 16:32
f35aac0 to
3c54ad7
Compare
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.
Two block-sync hardening changes, each its own commit.
Verify a peer's extended commit before persisting it. Block sync verified the next block's
LastCommitwithVerifyCommitLightand checked the extended commit only for shape withEnsureExtensions, then stored it. Consensus later rebuildsLastCommitfrom that stored extended commit throughToExtendedVoteSet, which panics on a bad signature, so a peer could leave a node unable to switch to consensus.ValidatorSet.VerifyExtendedCommitnow checks every precommit and extension signature plus the +2/3 threshold and returns an error, and the reactor runs it beforeSaveBlockWithExtendedCommit. A missing extended commit at a vote-extension height goes through the same peer-error path instead of the old "possible node store corruption" panic, since the block comes from a peer, not the store.Stay in block sync when no peer can serve the next height. Since #57,
updateMaxPeerHeightskips peers whose base is pastpool.height. When every peer is skipped,maxPeerHeightis 0, whichIsCaughtUpread as being at the tip, so a node could switch to consensus at a stale height. The pool now counts servable peers and reports not caught up when there are none. Peers at genesis still count, so a fresh network starts as before.