Repository navigation
Conversation
…gh_pc When a validator waiting on a stalled timeout view learns a higher ProposalCertificate without moving to a higher timeout view, OnNextSyncViewHandler signs a new `to_leader` TimeoutVote carrying the higher `high_pc_height` and persists it in `LastSentNewView`. Previously, `TimeoutVoteCollector::check_and_collect_vote` rejected that updated vote in both `certified_votes` and `pacing_votes` as a duplicate: - `certified_votes` kept the signer's earlier vote, so a TimeoutCertificate subsequently formed for the view attested to a stale `max_high_pc_height`. - `pacing_votes` set `duplicates_held_vote = true` on the upgraded NEWVIEW and every later re-send of `LastSentNewView.to_leader`, causing `is_waiting_on_a_counted_out_view` to suppress `answer_member_behind`. Allow `check_and_collect_vote` (where the caller has verified the accompanying `high_pc` certificate) to replace a held vote in `certified_votes` and `pacing_votes` when `incoming.high_pc_height > held.high_pc_height`, while keeping uncertified `TimeoutVote` messages on the existing duplicate rule so answers from counted-out members never trigger reply loops.
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
When a validator waiting on a stalled timeout view learns a higher
ProposalCertificatewhilenext_timeout_heightstill names the same view,OnNextSyncViewHandler::handle(crates/consensus/src/hotstuff/on_next_sync_view.rs:120-125) signs a newto_leaderTimeoutVotecarrying the higherhigh_pc_heightand persists it inLastSentNewView.to_leader, while keepingto_membersunchanged.Previously,
TimeoutVoteCollector::check_and_collect_voterejected that updatedto_leadervote asDuplicateVoteDetectedin bothcertified_votesandpacing_votes:certified_voteskept the earlier claim: if the leader already held an earlier vote for that view from the same signer, the higherhigh_pc_heightvote was discarded, so aTimeoutCertificatesubsequently formed for the view attested to a stalemax_high_pc_heightbelow what the quorum had signed and proven.pacing_votesflagged the waiting member'sNEWVIEWas an answer:duplicates_held_votewas set totrueon both the upgradedNEWVIEWand every subsequent re-send ofLastSentNewView.to_leaderwheneverpacing_votesstill held the signer's earlier vote (including when the node first receivedto_membersbefore a leader-skip boundary made it the effective leader of that view).is_waiting_on_a_counted_out_view(crates/consensus/src/hotstuff/on_receive_new_view.rs:546-559) then suppressedanswer_member_behindfor that waiting member on every retry.Changes:
VoteCollector::collect_vote_replacing(crates/consensus/src/hotstuff/vote_collector/collector.rs), which replaces a differently signed vote already held from the same signer at the same(epoch, height)whensupersedes(held, incoming)holds, without duplicating per-sender view tracking or re-emitting an already-formed quorum.TimeoutVoteCollector::check_and_collect_vote(crates/consensus/src/hotstuff/vote_collector/timeout_collector.rs) — called only afterOnReceiveNewViewHandler::handlehas verifiedtimeout_claim_matches_high_pc()andvalidate_qc(&high_pc)— supersede the held vote in bothpacing_votesandcertified_voteswhenincoming.high_pc_height > held.high_pc_height(has_higher_high_pc).TimeoutVoteCollector::check_and_count_voteunchanged (replace_higher_high_pc = false), because standaloneHotstuffMessage::TimeoutVotemessages carry no certificate and are howanswer_member_behinddelivers freshly signed answers, which must still setduplicates_held_vote = trueso two counted-out members do not answer each other's answers.Motivation and Context
Follow-up to #4074, which split
SentTimeoutVotesintoto_members(kept fixed acrossHighPcadvances) andto_leader(re-signed whenhigh_pc_heightadvances). Updating the collector on certifiedNEWVIEWs ensures thatTimeoutCertificate::max_high_pc_heightreflects the highest verified certificate claim a quorum has signed for that view, and keeps waiting members whoseHighPcadvanced answerable by a leader that has already counted the view out.How Has This Been Tested?
hotstuff::vote_collector::collector::tests::collect_vote_replacing_supersedes_held_vote_without_re_emitting_quorum: verifies in-place replacement underVoteStoreBound::PerSender, rejection of non-superseding votes without overwriting the higher vote, inclusion of the superseding vote when quorum is reached, and no second quorum emission after quorum.hotstuff::vote_collector::timeout_collector::tests::collector_behavior:a_certified_vote_with_a_higher_high_pc_supersedes_the_held_vote_and_stays_answerable: verifiesduplicates_held_votestaysfalseon both the upgradedNEWVIEWand its re-send, a lower re-signed vote is still flagged as duplicate without downgrading the claim, and the resultingTimeoutCertificatecarriesmax_high_pc_height() == NodeHeight(6)and passescheck_quorum_certificate_signatures.a_waiting_member_whose_newview_advances_high_pc_after_pacing_quorum_stays_answerable: verifies that after a node has already counted the view out via uncertified pacing votes, a waiting member's upgradedNEWVIEWand its re-send neither emit a second pacing quorum nor setduplicates_held_vote = true.an_uncertified_timeout_vote_with_a_higher_high_pc_still_duplicates_the_held_vote: verifies standaloneTimeoutVoteanswers with a higherhigh_pc_heightstill setduplicates_held_vote = true.tari_consensusunit test suite (413 passed) and clippy with workspace lints clean.What process can a PR reviewer use to test or verify this change?
cargo test -p tari_consensus --lib vote_collectorTo observe the original failure, revert
check_and_collect_voteincrates/consensus/src/hotstuff/vote_collector/timeout_collector.rstocollect_vote/replace_higher_high_pc = falseand re-run the command above.Breaking Changes