fix(consensus): apply finalized peer block from local stash#793
Merged
github-actions[bot] merged 1 commit intoJun 5, 2026
Conversation
On FinalizeBlock for a peer-proposed block the node already held the block (it had voted for it; hash matches the action's block_hash, justification carries the 2/3 precommit certificate) but refused to apply it unless it was the local proposer — instead triggering libp2p sync and breaking. When NewBlock gossip missed, the node sat in Finalize re-requesting a block it already had, stalling/crawling the chain. Apply it locally like the self-propose arm; validate_block still re-checks structure + justification supermajority before the write. No state_root/format change.
6783d4d
into
fix/pass2-rollback-restore-staking-state
3 checks passed
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
After the Pass-2 rollback fix (#792) eliminated
#1estate_root mismatches,the testnet still crawled: blocks committed only via the slow
GetBlockssync fallback, ~1 block per several seconds, with nodes frequently stuck in
the BFT
Finalizephase.Root cause
In the peer-propose
FinalizeBlockarm, the node already held thefinalized block — it had received the proposal and voted for it, the
hash-match guard confirmed
proposed_block.hash == action.block_hash, andjustificationcarried the 2/3 precommit certificate. But the code appliedit only if the local node was the proposer; otherwise it logged
"waiting for libp2p NewBlock/sync instead of executing peer block",
triggered a sync, and broke. When NewBlock gossip missed (common after a
restart / on a small mesh), the node sat in
Finalizere-requesting a blockit was holding the whole time → stall/crawl.
Fix
Apply the held block locally regardless of proposer, mirroring the
self-propose arm. The hash-match guard already proved it is the canonical
finalized block, and
validate_blockstill re-checks structure + thejustification supermajority before the write. No change to block content or
state_root, so no fork gate — deploy fleet-wide.Validation
Deployed to the 4-validator internal testnet alongside #792: block production
went from a crawl to ~3 blk/s (catching up the backlog), all validators
converged to the same height, and the public RPC returned to 200.
Note
Stacks on #792 (base set to that branch). A benign log artifact remains: the
redundant libp2p receive path can
#1eon a block the finalize path alreadycommitted — non-fatal (committed state_root is identical across nodes), to be
quieted as a follow-up.