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

[Fix] Correct quorum threshold calculation in test function is_round_reached() #3384

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unnecessary use of doc comment
  • Loading branch information
ungaro committed Aug 24, 2024
commit eb20644cd53986935416452e3691ca87ecb965f0
6 changes: 3 additions & 3 deletions node/bft/tests/common/primary.rs
Original file line number Diff line number Diff line change
@@ -278,9 +278,9 @@ impl TestNetwork {
sleep(Duration::from_millis(100)).await;
}

/// Checks if a Byzantine fault-tolerant quorum of validators has reached the given round.
/// Assuming `N = 3f + 1 + k`, where `0 <= k < 3`, and '/' denotes integer division,
/// then `N - (N-1)/3 = 2N/3 + 1 = 2f + 1 + (2k+2)/3 = 2f + 1 + k = N - f`.
// Checks if a Byzantine fault-tolerant quorum of validators has reached the given round.
// Assuming `N = 3f + 1 + k`, where `0 <= k < 3`, and '/' denotes integer division,
// then `N - (N-1)/3 = 2N/3 + 1 = 2f + 1 + (2k+2)/3 = 2f + 1 + k = N - f`.
pub fn is_round_reached(&self, round: u64) -> bool {
let quorum_threshold = self.validators.len() - (self.validators.len() - 1) / 3;
self.validators.values().filter(|v| v.primary.current_round() >= round).count() >= quorum_threshold