mirror of https://github.com/poanetwork/hbbft.git
Updated to "threshold_crypto" version eliminating the deprecated "failure" crate
Further crate updates to accommodate the newer version of "rand"
This commit is contained in:
parent
d52be00d0e
commit
40c43ea693
|
@ -29,11 +29,11 @@ failure = "0.1.6"
|
|||
hex_fmt = "0.3"
|
||||
init_with = "1.1.0"
|
||||
log = "0.4.8"
|
||||
rand = "0.6.5"
|
||||
rand = "0.7.3"
|
||||
rand_derive = "0.5.0"
|
||||
reed-solomon-erasure = "4.0.1"
|
||||
serde = { version = "1.0.102", features = ["derive", "rc"] }
|
||||
threshold_crypto = { rev = "624eeee", git = "https://github.com/poanetwork/threshold_crypto" }
|
||||
threshold_crypto = { rev = "a7fbfa4", git = "https://github.com/poanetwork/threshold_crypto" }
|
||||
tiny-keccak = { version = "2.0.1", features = ["sha3"]}
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -44,7 +44,7 @@ docopt = "1.1.0"
|
|||
hbbft_testing = { path = "hbbft_testing", features = ["use-insecure-test-only-mock-crypto"] }
|
||||
itertools = "0.9.0"
|
||||
number_prefix = "0.3.0"
|
||||
proptest = "0.9.4"
|
||||
proptest = "0.10.1"
|
||||
|
||||
[[example]]
|
||||
name = "consensus-node"
|
||||
|
|
|
@ -89,7 +89,7 @@ impl<T: Clone + Debug + AsRef<[u8]> + PartialEq + Send + Sync + From<Vec<u8>> +
|
|||
let tx_from_algo = messaging.tx_from_algo();
|
||||
let stop_tx = messaging.stop_tx();
|
||||
|
||||
let mut rng = rand::rngs::OsRng::new().unwrap();
|
||||
let mut rng = rand::rngs::OsRng;
|
||||
|
||||
// All spawned threads will have exited by the end of the scope.
|
||||
crossbeam::scope(|scope| {
|
||||
|
|
|
@ -399,7 +399,7 @@ fn parse_args() -> Result<Args, docopt::Error> {
|
|||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
let mut rng = OsRng::new().expect("Could not initialize OS random number generator.");
|
||||
let mut rng = OsRng;
|
||||
|
||||
let args = parse_args().unwrap_or_else(|e| e.exit());
|
||||
if args.flag_n <= 3 * args.flag_f {
|
||||
|
|
|
@ -25,10 +25,10 @@ travis-ci = { repository = "poanetwork/hbbft" }
|
|||
failure = "0.1.6"
|
||||
hbbft = { path = ".." }
|
||||
integer-sqrt = "0.1.2"
|
||||
proptest = "0.9.4"
|
||||
rand = "0.6.5"
|
||||
rand_xorshift = "0.1.1"
|
||||
threshold_crypto = { rev = "624eeee", git = "https://github.com/poanetwork/threshold_crypto" }
|
||||
proptest = "0.10.1"
|
||||
rand = "0.7.3"
|
||||
rand_xorshift = "0.2.0"
|
||||
threshold_crypto = { rev = "a7fbfa4", git = "https://github.com/poanetwork/threshold_crypto" }
|
||||
|
||||
[features]
|
||||
use-insecure-test-only-mock-crypto = ["hbbft/use-insecure-test-only-mock-crypto"]
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
//! const NUM_NODES: u64 = 7;
|
||||
//! const PROPOSER_ID: u64 = 3;
|
||||
//!
|
||||
//! let mut rng = OsRng::new().expect("Could not initialize OS random number generator.");
|
||||
//! let mut rng = OsRng;
|
||||
//!
|
||||
//! let validators = Arc::new(ValidatorSet::from(0..NUM_NODES));
|
||||
//!
|
||||
|
|
|
@ -209,7 +209,7 @@ mod tests {
|
|||
/// the vote by node `i` for making `j` the only validator. Each node signed this for nodes
|
||||
/// `0`, `1`, ... in order.
|
||||
fn setup(node_num: usize, era: u64) -> (Vec<VoteCounter<usize>>, Vec<Vec<SignedVote<usize>>>) {
|
||||
let mut rng = rngs::OsRng::new().expect("could not initialize OsRng");
|
||||
let mut rng = rngs::OsRng;
|
||||
|
||||
// Generate keys for signing and encrypting messages.
|
||||
let sec_keys: BTreeMap<_, SecretKey> = (0..node_num).map(|id| (id, rng.gen())).collect();
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
//! use hbbft::sync_key_gen::{to_pub_keys, AckOutcome, PartOutcome, PubKeyMap, SyncKeyGen};
|
||||
//!
|
||||
//! // Use the OS random number generator for any randomness:
|
||||
//! let mut rng = rand::rngs::OsRng::new().expect("Could not open OS random number generator.");
|
||||
//! let mut rng = rand::rngs::OsRng;
|
||||
//!
|
||||
//! // Two out of four shares will suffice to sign or encrypt something.
|
||||
//! let (threshold, node_num) = (1, 4);
|
||||
|
@ -189,8 +189,9 @@ use crate::crypto::{
|
|||
serde_impl::FieldWrap,
|
||||
Fr, G1Affine, PublicKeySet, SecretKeyShare,
|
||||
};
|
||||
use crate::pairing::{CurveAffine, Field};
|
||||
use crate::NodeIdT;
|
||||
use threshold_crypto::ff::Field;
|
||||
use threshold_crypto::group::CurveAffine;
|
||||
|
||||
/// A cryptographic key that allows decrypting messages that were encrypted to the key's owner.
|
||||
pub trait SecretKey {
|
||||
|
|
Loading…
Reference in New Issue