fix(bft): proposer rebroadcasts proposal up to 3× at 3s intervals (#1d)#175
Merged
fix(bft): proposer rebroadcasts proposal up to 3× at 3s intervals (#1d)#175
Conversation
v2.1.3's PROPOSE_TIMEOUT bump 10s → 20s didn't close #1d — the
testnet tally logs (`BFT #1d: ... tally=[nil=4.5B]`) kept firing at
~72 times per 30 min. Cross-validator trace at the stuck heights
showed the real shape:
T+0.0s proposer broadcasts Proposal
T+0.0s 2 peers in verified_peers receive it, prevote block
T+12s prevote_timeout fires on those 2 peers → nil-precommit
(supermajority-for-block needed 3, only 2 arrived)
T+21s third peer finally hits propose_timeout, nil-prevotes
way too late — other 2 are already in precommit phase
→ round skipped, repeat
Longer propose_timeout widened the gap between fast and slow peers
instead of closing it. Real fix: proposer retries the broadcast
every few seconds while still in Propose phase, so peers that just
reconnected (and weren't in `verified_peers` at the initial send)
can still receive the proposal before their own propose-phase
expires.
Implementation:
- validator loop tracks `proposal_broadcast_at` + `rebroadcast_count`
- every tick, if we are proposer AND phase == Propose AND have a
proposed block AND ≥ 3s since last broadcast AND count < 3:
reconstruct Proposal from stored block, re-sign, re-broadcast,
bump count.
- reset both on new height; reset both at each propose site (late-
round skip/timeout re-proposals) via the ones that set
`proposed_block = Some(block)`.
- emits an `info!("BFT #1d: rebroadcast proposal...")` per retry so
the fix is observable in journalctl.
3s / 3 tries gives a ceiling of 9s of retries inside the 20s propose
window — plenty of room for a peer that takes a few seconds to
reconnect, without spamming.
Root-cause sequel of #171 (logging) + #174 (timeout bump). Left
further hardening as a #1d follow-up: peer-subscribe on newly-verified
peers so the proposer gets notified the moment a new peer joins
mid-round, instead of waiting for the retry timer.
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.
Summary
Closes the real root cause of the 2026-04-20 testnet livelock. PR
#174's 10→20s propose_timeout bump alone didn't help — tally logs
kept firing every ~25 seconds.
Cross-validator trace at a stuck height:
Longer propose_timeout widened the gap between fast and slow peers
instead of closing it. Proper fix: proposer retries the broadcast
every 3s up to 3 times while still in Propose phase, so peers that
just reconnected (and weren't in
verified_peersat initial send)still receive the proposal before their own propose-phase expires.
3s × 3 retries = up to 9s of retry window inside the 20s propose
phase. Plenty of headroom for reconnect stragglers, without spamming
the network.
Implementation
proposal_broadcast_at+proposal_rebroadcast_countphase == ProposeAND wehave a
proposed_blockAND last broadcast ≥ 3s ago AND count < 3→ re-sign + re-broadcast, bump count.
site (skip/timeout re-proposals).
BFT #1d: rebroadcast proposal...per retry so the fix isobservable in journalctl.
Test plan
cargo clippy --workspace --tests -- -D warningscleancargo test --workspace— all 38 suites passBFT #1d:logs (should drop sharply) and look forBFT #1d: rebroadcast proposallines (proves retry isactually firing).
Related
what that one couldn't.
peers so the proposer rebroadcasts the moment a peer joins
mid-round, instead of waiting for the retry timer.