Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZKS-02] Use the certificate round for committee lookback selection #3143

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions node/bft/src/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,15 +765,13 @@ impl<N: Network> Primary<N> {
// Store the certificate, after ensuring it is valid.
self.sync_with_certificate_from_peer(peer_ip, certificate).await?;

// If there are enough certificates to reach quorum threshold for the current round,
// If there are enough certificates to reach quorum threshold for the certificate round,
// then proceed to advance to the next round.

// Retrieve the current round.
let current_round = self.current_round();
// Retrieve the committee lookback.
let committee_lookback = self.ledger.get_committee_lookback_for_round(current_round)?;
let committee_lookback = self.ledger.get_committee_lookback_for_round(certificate_round)?;
// Retrieve the certificates.
let certificates = self.storage.get_certificates_for_round(current_round);
let certificates = self.storage.get_certificates_for_round(certificate_round);
// Construct a set over the authors.
let authors = certificates.iter().map(BatchCertificate::author).collect();
// Check if the certificates have reached the quorum threshold.
Expand All @@ -797,8 +795,11 @@ impl<N: Network> Primary<N> {
None => true,
};

// Retrieve the current round.
let current_round = self.current_round();

// Determine whether to advance to the next round.
if is_quorum && should_advance {
if is_quorum && should_advance && certificate_round >= current_round {
// If we have reached the quorum threshold and the round should advance, then proceed to the next round.
self.try_increment_to_the_next_round(current_round + 1).await?;
}
Expand Down