Version 0.2.0, using threshold_crypto 0.4.0

This commit is contained in:
Andreas Fackler 2020-03-20 11:45:00 +01:00
parent d52be00d0e
commit 7674a983f4
No known key found for this signature in database
GPG Key ID: E71D328943129E1C
8 changed files with 21 additions and 18 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "hbbft"
version = "0.1.1"
version = "0.2.0"
authors = [
"Vladimir Komendantskiy <komendantsky@gmail.com>",
"Andreas Fackler <AndreasFackler@gmx.de>",
@ -29,11 +29,12 @@ 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" }
# TODO: Version 0.4.0
threshold_crypto = { rev = "d4a500ce75002fca761c88adc7f4f9b28fded987", git = "https://github.com/poanetwork/threshold_crypto" }
tiny-keccak = { version = "2.0.1", features = ["sha3"]}
[dev-dependencies]
@ -44,7 +45,8 @@ 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"
# TODO: Update once there is a release that uses rand 0.7.
proptest = { rev = "2f5062a", git = "https://github.com/AltSysrq/proptest" }
[[example]]
name = "consensus-node"

View File

@ -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| {

View File

@ -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 {

View File

@ -1,6 +1,6 @@
[package]
name = "hbbft_testing"
version = "0.1.0"
version = "0.2.0"
authors = [
"Vladimir Komendantskiy <komendantsky@gmail.com>",
"Andreas Fackler <AndreasFackler@gmx.de>",
@ -25,10 +25,12 @@ 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" }
# TODO: Update once there is a release that uses rand 0.7.
proptest = { rev = "2f5062a", git = "https://github.com/AltSysrq/proptest" }
rand = "0.7.3"
rand_xorshift = "0.2.0"
# TODO: Version 0.4.0
threshold_crypto = { rev = "d4a500ce75002fca761c88adc7f4f9b28fded987", git = "https://github.com/poanetwork/threshold_crypto" }
[features]
use-insecure-test-only-mock-crypto = ["hbbft/use-insecure-test-only-mock-crypto"]

View File

@ -150,8 +150,6 @@
//! const NUM_NODES: u64 = 7;
//! const PROPOSER_ID: u64 = 3;
//!
//! let mut rng = OsRng::new().expect("Could not initialize OS random number generator.");
//!
//! let validators = Arc::new(ValidatorSet::from(0..NUM_NODES));
//!
//! // Create initial nodes by instantiating a `Broadcast` for each.
@ -163,7 +161,7 @@
//!
//! // First we generate a random payload.
//! let mut payload: Vec<_> = vec![0; 128];
//! rng.fill_bytes(&mut payload[..]);
//! OsRng.fill_bytes(&mut payload[..]);
//!
//! // Define a function for handling one step of a `Broadcast` instance. This function appends
//! // new messages onto the message queue and checks whether each node outputs at most once

View File

@ -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();

View File

@ -139,7 +139,7 @@ pub mod threshold_sign;
pub mod transaction_queue;
pub mod util;
pub use crate::crypto::pairing;
pub use crate::crypto::{group, pairing};
pub use crate::fault_log::{Fault, FaultLog};
pub use crate::messaging::{SourcedMessage, Target, TargetedMessage};
pub use crate::network_info::{NetworkInfo, ValidatorSet};

View File

@ -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 crypto::ff::Field;
use crypto::group::CurveAffine;
/// A cryptographic key that allows decrypting messages that were encrypted to the key's owner.
pub trait SecretKey {