From 15f731370686f5456425c2e319225bf3b4d447c0 Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Fri, 26 Apr 2019 16:54:12 +0200 Subject: [PATCH] Extract test framework into hbbft_testing crate. (#404) * Extract test framework into hbbft_testing crate. Also update Rust and some dependencies. * Rename DHB tests. They are only called `net_dynamic_hb` because we used to have two test frameworks and two DHB test modules. --- .travis.yml | 2 +- Cargo.toml | 9 +-- ci.sh | 7 ++ examples/simulation.rs | 3 +- hbbft_testing/Cargo.toml | 31 ++++++++ {tests/net => hbbft_testing/src}/adversary.rs | 4 +- {tests/net => hbbft_testing/src}/err.rs | 0 tests/net/mod.rs => hbbft_testing/src/lib.rs | 10 +-- {tests/net => hbbft_testing/src}/proptest.rs | 0 {tests/net => hbbft_testing/src}/util.rs | 0 .../src/util_tests.rs | 6 +- .../dynamic_honey_badger.rs | 4 +- tests/binary_agreement.rs | 75 +++++++++---------- tests/binary_agreement_mitm.rs | 13 ++-- tests/broadcast.rs | 16 ++-- ..._dynamic_hb.rs => dynamic_honey_badger.rs} | 24 +++--- tests/honey_badger.rs | 18 ++--- tests/net_util.proptest-regressions | 7 -- tests/queueing_honey_badger.rs | 18 ++--- tests/subset.rs | 13 ++-- tests/threshold_sign.rs | 16 ++-- 21 files changed, 141 insertions(+), 135 deletions(-) create mode 100644 hbbft_testing/Cargo.toml rename {tests/net => hbbft_testing/src}/adversary.rs (99%) rename {tests/net => hbbft_testing/src}/err.rs (100%) rename tests/net/mod.rs => hbbft_testing/src/lib.rs (99%) rename {tests/net => hbbft_testing/src}/proptest.rs (100%) rename {tests/net => hbbft_testing/src}/util.rs (100%) rename tests/net_util.rs => hbbft_testing/src/util_tests.rs (98%) rename tests/{net_dynamic_hb.rs => dynamic_honey_badger.rs} (97%) delete mode 100644 tests/net_util.proptest-regressions diff --git a/.travis.yml b/.travis.yml index 7909718..d473ad0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: rust rust: - - 1.33.0 + - 1.34.0 cache: cargo: true timeout: 1200 diff --git a/Cargo.toml b/Cargo.toml index 42e8e03..a209661 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,14 +38,13 @@ tiny-keccak = "1.4" [dev-dependencies] colored = "1.7" -crossbeam = "0.6" +crossbeam = "0.7.1" crossbeam-channel = "0.3" docopt = "1.0" +hbbft_testing = { path = "hbbft_testing" } itertools = "0.8.0" -rand_xorshift = "0.1.1" -signifix = "0.9" -proptest = "0.8.7" -integer-sqrt = "0.1.2" +signifix = "0.10.0" +proptest = "0.9.2" [[example]] name = "consensus-node" diff --git a/ci.sh b/ci.sh index 12fc541..48c8ea4 100755 --- a/ci.sh +++ b/ci.sh @@ -18,3 +18,10 @@ cargo test --features=use-insecure-test-only-mock-crypto --release cargo doc cargo deadlinks --dir target/doc/hbbft/ cargo audit + +cd hbbft_testing +cargo clippy --all-targets -- --deny clippy::all +cargo fmt -- --check +cargo test --release +cargo audit +cd .. diff --git a/examples/simulation.rs b/examples/simulation.rs index 4afbb32..78eefcb 100644 --- a/examples/simulation.rs +++ b/examples/simulation.rs @@ -1,4 +1,5 @@ use std::collections::{BTreeMap, VecDeque}; +use std::convert::TryFrom; use std::time::{Duration, Instant}; use std::{cmp, u64}; @@ -8,7 +9,7 @@ use itertools::Itertools; use rand::{distributions::Standard, rngs::OsRng, seq::SliceRandom, Rng}; use rand_derive::Rand; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use signifix::{metric, TryFrom}; +use signifix::metric; use hbbft::dynamic_honey_badger::DynamicHoneyBadger; use hbbft::queueing_honey_badger::{Batch, QueueingHoneyBadger}; diff --git a/hbbft_testing/Cargo.toml b/hbbft_testing/Cargo.toml new file mode 100644 index 0000000..0697fcb --- /dev/null +++ b/hbbft_testing/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "hbbft_testing" +version = "0.1.0" +authors = [ + "Vladimir Komendantskiy ", + "Andreas Fackler ", + "Peter van Nostrand ", + "Andrew Gross ", + "Nick Sanders ", + "Marc Brinkmann ", + "David Forstenlechner ", +] +categories = ["algorithms", "asynchronous", "cryptography", "network-programming"] +keywords = ["consensus", "asynchronous", "threshold"] +license = "MIT/Apache-2.0" +readme = "README.md" +repository = "https://github.com/poanetwork/hbbft" +description = "Utilities for simulating and testing hbbft-based networks." +edition = "2018" + +[badges] +travis-ci = { repository = "poanetwork/hbbft" } + +[dependencies] +failure = "0.1.5" +hbbft = { path = ".." } +integer-sqrt = "0.1.2" +proptest = "0.9.2" +rand = "0.6.5" +rand_xorshift = "0.1.1" +threshold_crypto = "0.3.1" diff --git a/tests/net/adversary.rs b/hbbft_testing/src/adversary.rs similarity index 99% rename from tests/net/adversary.rs rename to hbbft_testing/src/adversary.rs index b2ca4d8..fedcdac 100644 --- a/tests/net/adversary.rs +++ b/hbbft_testing/src/adversary.rs @@ -40,8 +40,8 @@ use rand::Rng; use hbbft::{ConsensusProtocol, CpStep}; -use crate::net::util::randomly; -use crate::net::{CrankError, NetMessage, NetworkMessage, Node, VirtualNet}; +use crate::util::randomly; +use crate::{CrankError, NetMessage, NetworkMessage, Node, VirtualNet}; /// Immutable network handle. /// diff --git a/tests/net/err.rs b/hbbft_testing/src/err.rs similarity index 100% rename from tests/net/err.rs rename to hbbft_testing/src/err.rs diff --git a/tests/net/mod.rs b/hbbft_testing/src/lib.rs similarity index 99% rename from tests/net/mod.rs rename to hbbft_testing/src/lib.rs index 8a00a14..6fe4cc2 100644 --- a/tests/net/mod.rs +++ b/hbbft_testing/src/lib.rs @@ -19,6 +19,9 @@ pub mod err; pub mod proptest; pub mod util; +#[cfg(test)] +mod util_tests; + use std::collections::{BTreeMap, BTreeSet, VecDeque}; use std::io::Write; use std::{cmp, env, fmt, fs, io, ops, process, time}; @@ -29,8 +32,6 @@ use hbbft::dynamic_honey_badger::Batch; use hbbft::sender_queue::SenderQueueableOutput; use hbbft::{self, ConsensusProtocol, Contribution, CpStep, Fault, NetworkInfo, NodeIdT, Step}; -use crate::try_some; - pub use self::adversary::Adversary; pub use self::err::CrankError; @@ -534,7 +535,7 @@ where // If the trace setting is not overriden, we use the setting from the environment. let trace = self.trace.unwrap_or_else(|| { - match env::var("HBBFT_TEST_TRACE").as_ref().map(|s| s.as_str()) { + match env::var("HBBFT_TEST_TRACE").as_ref().map(String::as_str) { Ok("true") | Ok("1") => true, _ => false, } @@ -1070,8 +1071,7 @@ where } for node in self.correct_nodes().filter(|n| n.id() != full_node.id()) { let id = node.id(); - let actual_epochs: BTreeSet<_> = - node.outputs.iter().map(|batch| batch.epoch()).collect(); + let actual_epochs: BTreeSet<_> = node.outputs.iter().map(Batch::epoch).collect(); let expected_epochs: BTreeSet<_> = expected[id].iter().map(|batch| batch.epoch()).collect(); assert_eq!( diff --git a/tests/net/proptest.rs b/hbbft_testing/src/proptest.rs similarity index 100% rename from tests/net/proptest.rs rename to hbbft_testing/src/proptest.rs diff --git a/tests/net/util.rs b/hbbft_testing/src/util.rs similarity index 100% rename from tests/net/util.rs rename to hbbft_testing/src/util.rs diff --git a/tests/net_util.rs b/hbbft_testing/src/util_tests.rs similarity index 98% rename from tests/net_util.rs rename to hbbft_testing/src/util_tests.rs index 807e1b1..e4d408b 100644 --- a/tests/net_util.rs +++ b/hbbft_testing/src/util_tests.rs @@ -1,12 +1,10 @@ -pub mod net; - use proptest::arbitrary::any; +use proptest::proptest; use proptest::strategy::{Strategy, ValueTree}; -use proptest::{proptest, proptest_helper}; use rand::SeedableRng; use rand_xorshift::XorShiftRng; -use crate::net::proptest::{max_sum, NetworkDimension, NetworkDimensionTree}; +use crate::proptest::{max_sum, NetworkDimension, NetworkDimensionTree}; proptest! { /// Ensures all generated network dimensions are actually sane. diff --git a/src/dynamic_honey_badger/dynamic_honey_badger.rs b/src/dynamic_honey_badger/dynamic_honey_badger.rs index e900e15..2f5659e 100644 --- a/src/dynamic_honey_badger/dynamic_honey_badger.rs +++ b/src/dynamic_honey_badger/dynamic_honey_badger.rs @@ -294,7 +294,9 @@ where let kgs = match self.key_gen_state { Some(ref mut kgs) => kgs, None => { - return Ok(Fault::new(sender_id.clone(), FaultKind::UnexpectedKeyGenMessage).into()); + return Ok( + Fault::new(sender_id.clone(), FaultKind::UnexpectedKeyGenMessage).into(), + ); } }; diff --git a/tests/binary_agreement.rs b/tests/binary_agreement.rs index 0192930..3262ae1 100644 --- a/tests/binary_agreement.rs +++ b/tests/binary_agreement.rs @@ -13,22 +13,18 @@ //! - Validity: If any correct node outputs `b`, then at least one correct node received `b` as //! input. -pub mod net; - use std::iter::once; use std::sync::Arc; use std::time; -use proptest::arbitrary::any; -use proptest::{prelude::ProptestConfig, prop_compose, proptest, proptest_helper}; -use rand::{Rng, SeedableRng}; - use hbbft::binary_agreement::BinaryAgreement; use hbbft::ConsensusProtocol; - -use crate::net::adversary::{Adversary, ReorderingAdversary}; -use crate::net::proptest::{gen_seed, NetworkDimension, TestRng, TestRngSeed}; -use crate::net::{NetBuilder, NewNodeInfo, VirtualNet}; +use hbbft_testing::adversary::{Adversary, ReorderingAdversary}; +use hbbft_testing::proptest::{gen_seed, NetworkDimension, TestRng, TestRngSeed}; +use hbbft_testing::{NetBuilder, NewNodeInfo, VirtualNet}; +use proptest::arbitrary::any; +use proptest::{prelude::ProptestConfig, prop_compose, proptest}; +use rand::{Rng, SeedableRng}; /// Test configuration for Binary Agreement tests. #[derive(Debug)] @@ -72,36 +68,35 @@ proptest! { type NodeId = u16; -impl VirtualNet, A> -where +fn test_binary_agreement( + net: &mut VirtualNet, A>, + input: Option, + mut rng: R, +) where + R: Rng + 'static, A: Adversary>, { - fn test_binary_agreement(&mut self, input: Option, mut rng: R) - where - R: Rng + 'static, - { - let ids: Vec = self.nodes().map(|n| *n.id()).collect(); - for id in ids { - let _ = self.send_input(id, input.unwrap_or_else(|| rng.gen::()), &mut rng); - } - - // Handle messages in random order until all nodes have output the proposed value. - while !self.nodes().all(|node| node.algorithm().terminated()) { - let _ = self.crank_expect(&mut rng); - } - // Verify that all instances output the same value. - let mut expected = input; - for node in self.nodes() { - if let Some(b) = expected { - assert!(once(&b).eq(node.outputs())); - } else { - assert_eq!(1, node.outputs().len()); - expected = Some(node.outputs()[0]); - } - } - // TODO: As soon as observers are added to the test framework, compare the expected output - // against the output of observers. + let ids: Vec = net.nodes().map(|n| *n.id()).collect(); + for id in ids { + let _ = net.send_input(id, input.unwrap_or_else(|| rng.gen::()), &mut rng); } + + // Handle messages in random order until all nodes have output the proposed value. + while !net.nodes().all(|node| node.algorithm().terminated()) { + let _ = net.crank_expect(&mut rng); + } + // Verify that all instances output the same value. + let mut expected = input; + for node in net.nodes() { + if let Some(b) = expected { + assert!(once(&b).eq(node.outputs())); + } else { + assert_eq!(1, node.outputs().len()); + expected = Some(node.outputs()[0]); + } + } + // TODO: As soon as observers are added to the test framework, compare the expected output + // against the output of observers. } /// Tests Binary Agreement on a given configuration. @@ -127,7 +122,11 @@ fn binary_agreement(cfg: TestConfig) { }) .build(&mut rng) .expect("Could not construct test network."); - net.test_binary_agreement(cfg.input, TestRng::from_seed(rng.gen::())); + test_binary_agreement( + &mut net, + cfg.input, + TestRng::from_seed(rng.gen::()), + ); println!( "Test success: {} good nodes and {} faulty nodes, input: {:?}", num_good_nodes, num_faulty_nodes, cfg.input diff --git a/tests/binary_agreement_mitm.rs b/tests/binary_agreement_mitm.rs index 046c641..974d114 100644 --- a/tests/binary_agreement_mitm.rs +++ b/tests/binary_agreement_mitm.rs @@ -1,22 +1,19 @@ #![deny(unused_must_use)] //! Tests the BinaryAgreement protocol with a MTIM adversary. -pub mod net; - use std::iter; use std::sync::{Arc, Mutex}; use hbbft::binary_agreement::{BinaryAgreement, MessageContent, SbvMessage}; use hbbft::threshold_sign::ThresholdSign; use hbbft::{ConsensusProtocol, CpStep, NetworkInfo}; -use proptest::{proptest, proptest_helper}; +use hbbft_testing::adversary::{NetMutHandle, QueuePosition}; +use hbbft_testing::err::CrankError; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{Adversary, NetBuilder, NetMessage}; +use proptest::proptest; use rand::{Rng, SeedableRng}; -use crate::net::adversary::{NetMutHandle, QueuePosition}; -use crate::net::err::CrankError; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{Adversary, NetBuilder, NetMessage}; - type NodeId = usize; type SessionId = u8; type Algo = BinaryAgreement; diff --git a/tests/broadcast.rs b/tests/broadcast.rs index 4b47c84..0d29ce4 100644 --- a/tests/broadcast.rs +++ b/tests/broadcast.rs @@ -1,21 +1,17 @@ -pub mod net; - use std::collections::BTreeMap; use std::iter::once; use std::sync::{Arc, Mutex}; -use log::info; -use proptest::{prelude::ProptestConfig, proptest, proptest_helper}; -use rand::{Rng, SeedableRng}; - use hbbft::{broadcast::Broadcast, util, ConsensusProtocol, CpStep, NetworkInfo}; - -use crate::net::adversary::{ +use hbbft_testing::adversary::{ sort_ascending, swap_random, Adversary, NetMutHandle, NodeOrderAdversary, RandomAdversary, ReorderingAdversary, }; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{CrankError, NetBuilder, NetMessage, NewNodeInfo, VirtualNet}; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{CrankError, NetBuilder, NetMessage, NewNodeInfo, VirtualNet}; +use log::info; +use proptest::{prelude::ProptestConfig, proptest}; +use rand::{Rng, SeedableRng}; type NodeId = u16; type NetworkInfoMap = BTreeMap>>; diff --git a/tests/net_dynamic_hb.rs b/tests/dynamic_honey_badger.rs similarity index 97% rename from tests/net_dynamic_hb.rs rename to tests/dynamic_honey_badger.rs index 4652a20..4d70dec 100644 --- a/tests/net_dynamic_hb.rs +++ b/tests/dynamic_honey_badger.rs @@ -1,18 +1,16 @@ -pub mod net; - use std::collections::{BTreeMap, BTreeSet}; use std::time; -use hbbft::dynamic_honey_badger::{Change, ChangeState, DynamicHoneyBadger, Input, JoinPlan}; +use hbbft::dynamic_honey_badger::{ + Batch, Change, ChangeState, DynamicHoneyBadger, Input, JoinPlan, +}; use hbbft::sender_queue::{SenderQueue, Step}; -use hbbft::Epoched; -use proptest::{prelude::ProptestConfig, prop_compose, proptest, proptest_helper}; +use hbbft::{util, Epoched}; +use hbbft_testing::adversary::{Adversary, ReorderingAdversary}; +use hbbft_testing::proptest::{gen_seed, NetworkDimension, TestRng, TestRngSeed}; +use hbbft_testing::{NetBuilder, NewNodeInfo, Node, VirtualNet}; +use proptest::{prelude::ProptestConfig, prop_compose, proptest}; use rand::{seq::SliceRandom, SeedableRng}; - -use crate::net::adversary::{Adversary, ReorderingAdversary}; -use crate::net::proptest::{gen_seed, NetworkDimension, TestRng, TestRngSeed}; -use crate::net::{NetBuilder, NewNodeInfo, Node, VirtualNet}; -use hbbft::util; use threshold_crypto::PublicKey; type DHB = SenderQueue, usize>>; @@ -218,7 +216,7 @@ fn do_drop_and_re_add(cfg: TestConfig) { ); } } - for change in step.output.iter().map(|output| output.change()) { + for change in step.output.iter().map(Batch::change) { match change { ChangeState::Complete(Change::NodeChange(ref pub_keys)) if *pub_keys == new_pub_keys => @@ -389,7 +387,7 @@ fn do_drop_and_re_add(cfg: TestConfig) { } // Check if we are done. - if expected_outputs.values().all(|s| s.is_empty()) + if expected_outputs.values().all(BTreeSet::is_empty) && awaiting_apply_old_subset.is_empty() && awaiting_apply_new_subset.is_empty() { @@ -443,7 +441,7 @@ where // TODO: When an observer node is added to the network, it should also be added to peer_ids. let peer_ids: Vec<_> = net .nodes() - .map(|node| node.id()) + .map(Node::id) .filter(|id| *id != node.id()) .cloned() .collect(); diff --git a/tests/honey_badger.rs b/tests/honey_badger.rs index be7e48f..aedbb97 100644 --- a/tests/honey_badger.rs +++ b/tests/honey_badger.rs @@ -1,27 +1,23 @@ #![deny(unused_must_use)] //! Network tests for Honey Badger. -pub mod net; - use std::collections::BTreeMap; use std::sync::{Arc, Mutex}; -use itertools::Itertools; -use log::info; -use proptest::{prelude::ProptestConfig, proptest, proptest_helper}; -use rand::{seq::SliceRandom, Rng, SeedableRng}; - use hbbft::honey_badger::{Batch, EncryptionSchedule, HoneyBadger, MessageContent}; use hbbft::sender_queue::{self, SenderQueue, Step}; use hbbft::transaction_queue::TransactionQueue; use hbbft::{threshold_decrypt, util, CpStep, NetworkInfo, Target}; - -use crate::net::adversary::{ +use hbbft_testing::adversary::{ sort_by_random_node, Adversary, NetMutHandle, NodeOrderAdversary, RandomAdversary, ReorderingAdversary, }; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{CrankError, NetBuilder, NetMessage, NewNodeInfo, Node, VirtualNet}; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{CrankError, NetBuilder, NetMessage, NewNodeInfo, Node, VirtualNet}; +use itertools::Itertools; +use log::info; +use proptest::{prelude::ProptestConfig, proptest}; +use rand::{seq::SliceRandom, Rng, SeedableRng}; type NodeId = u16; type NetworkInfoMap = BTreeMap>>; diff --git a/tests/net_util.proptest-regressions b/tests/net_util.proptest-regressions deleted file mode 100644 index ac844e5..0000000 --- a/tests/net_util.proptest-regressions +++ /dev/null @@ -1,7 +0,0 @@ -# Seeds for failure cases proptest has generated in the past. It is -# automatically read and these particular cases re-run before any -# novel cases are generated. -# -# It is recommended to check this file in to source control so that -# everyone who runs the test benefits from these saved cases. -xs 2984819682 1621205622 3953858650 3756562836 # shrinks to seed = [724246048, 1190443809, 4113437293, 1855000933], ops = [Simplify, Complicate] diff --git a/tests/queueing_honey_badger.rs b/tests/queueing_honey_badger.rs index adf88a0..332a0dc 100644 --- a/tests/queueing_honey_badger.rs +++ b/tests/queueing_honey_badger.rs @@ -1,23 +1,19 @@ #![deny(unused_must_use)] //! Network tests for Queueing Honey Badger. -pub mod net; - use std::collections::BTreeSet; use std::sync::Arc; -use log::info; -use proptest::{prelude::ProptestConfig, proptest, proptest_helper}; -use rand::{Rng, SeedableRng}; - use hbbft::dynamic_honey_badger::{DynamicHoneyBadger, JoinPlan}; use hbbft::queueing_honey_badger::{Change, ChangeState, Input, QueueingHoneyBadger}; use hbbft::sender_queue::{Message, SenderQueue, Step}; use hbbft::{util, NetworkInfo}; - -use crate::net::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{NetBuilder, NewNodeInfo, Node, VirtualNet}; +use hbbft_testing::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{NetBuilder, NewNodeInfo, Node, VirtualNet}; +use log::info; +use proptest::{prelude::ProptestConfig, proptest}; +use rand::{Rng, SeedableRng}; type NodeId = u16; type QHB = SenderQueue>>; @@ -205,7 +201,7 @@ where // TODO: When an observer node is added to the network, it should also be added to peer_ids. let peer_ids: Vec<_> = net .nodes() - .map(|node| node.id()) + .map(Node::id) .filter(|id| *id != node.id()) .cloned() .collect(); diff --git a/tests/subset.rs b/tests/subset.rs index 5f6613b..fe05960 100644 --- a/tests/subset.rs +++ b/tests/subset.rs @@ -1,19 +1,16 @@ #![deny(unused_must_use)] -pub mod net; use std::collections::{BTreeMap, BTreeSet}; use std::iter::once; use std::sync::Arc; -use proptest::{prelude::ProptestConfig, proptest, proptest_helper}; -use rand::SeedableRng; - use hbbft::subset::{Subset, SubsetOutput}; use hbbft::ConsensusProtocol; - -use crate::net::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{NetBuilder, NewNodeInfo, VirtualNet}; +use hbbft_testing::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{NetBuilder, NewNodeInfo, VirtualNet}; +use proptest::{prelude::ProptestConfig, proptest}; +use rand::SeedableRng; type NodeId = u16; type ProposedValue = Vec; diff --git a/tests/threshold_sign.rs b/tests/threshold_sign.rs index a80ff0f..ec43d05 100644 --- a/tests/threshold_sign.rs +++ b/tests/threshold_sign.rs @@ -1,19 +1,15 @@ #![deny(unused_must_use)] //! Non-deterministic tests for the ThresholdSign protocol -pub mod net; - use std::sync::Arc; -use log::info; -use proptest::{prelude::ProptestConfig, proptest, proptest_helper}; -use rand::{Rng, SeedableRng}; - use hbbft::{crypto::Signature, threshold_sign::ThresholdSign, util, ConsensusProtocol}; - -use crate::net::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; -use crate::net::proptest::{gen_seed, TestRng, TestRngSeed}; -use crate::net::{NetBuilder, NewNodeInfo, VirtualNet}; +use hbbft_testing::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary}; +use hbbft_testing::proptest::{gen_seed, TestRng, TestRngSeed}; +use hbbft_testing::{NetBuilder, NewNodeInfo, VirtualNet}; +use log::info; +use proptest::{prelude::ProptestConfig, proptest}; +use rand::{Rng, SeedableRng}; type NodeId = u16;