Skip to content

Commit

Permalink
collect f+1 leader votes (MystenLabs/narwhal#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
asonnino authored Sep 13, 2022
1 parent daf89be commit 32e2b7b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
7 changes: 5 additions & 2 deletions narwhal/config/tests/config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ use crypto::PublicKey;
use insta::assert_json_snapshot;
use multiaddr::Multiaddr;
use rand::{rngs::StdRng, seq::SliceRandom, SeedableRng};
use std::collections::{BTreeMap, HashMap};
use std::{fs::File, io::Write};
use std::{
collections::{BTreeMap, HashMap},
fs::File,
io::Write,
};
use tempfile::tempdir;
use test_utils::CommitteeFixture;

Expand Down
3 changes: 1 addition & 2 deletions narwhal/consensus/src/tests/dag_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use dag::node_dag::NodeDagError;
use fastcrypto::Hash;
use indexmap::IndexMap;
use prometheus::Registry;
use std::collections::BTreeSet;
use std::sync::Arc;
use std::{collections::BTreeSet, sync::Arc};
use test_utils::{make_optimal_certificates, CommitteeFixture};
use types::Certificate;

Expand Down
3 changes: 1 addition & 2 deletions narwhal/consensus/src/tusk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ mod tests {
use prometheus::Registry;
use rand::Rng;
use std::collections::BTreeSet;
use test_utils::make_consensus_store;
use test_utils::CommitteeFixture;
use test_utils::{make_consensus_store, CommitteeFixture};
use types::Certificate;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions narwhal/primary/src/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Proposer {
}
}

let mut enough_votes = votes_for_leader >= self.committee.quorum_threshold();
let mut enough_votes = votes_for_leader >= self.committee.validity_threshold();
if enough_votes {
if let Some(leader) = self.last_leader.as_ref() {
debug!(
Expand All @@ -181,7 +181,7 @@ impl Proposer {
);
}
}
enough_votes |= no_votes >= self.committee.validity_threshold();
enough_votes |= no_votes >= self.committee.quorum_threshold();
enough_votes
}

Expand Down
3 changes: 1 addition & 2 deletions narwhal/worker/src/tests/batch_maker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
use super::*;
use prometheus::Registry;
use test_utils::transaction;
use test_utils::CommitteeFixture;
use test_utils::{transaction, CommitteeFixture};

#[tokio::test]
async fn make_batch() {
Expand Down

0 comments on commit 32e2b7b

Please sign in to comment.