Instead of macro_use, use use.

This commit is contained in:
Andreas Fackler 2018-10-29 15:36:56 +01:00 committed by Andreas Fackler
parent d9bac58bc8
commit df36258715
38 changed files with 78 additions and 55 deletions

View File

@ -58,7 +58,7 @@ _**Note:** Additional examples are currently in progress._
### Build
Requires Rust 1.29 or higher and `cargo`: [installation instructions.](https://www.rust-lang.org/en-US/install.html) The library is tested against the `stable` release channel.
Requires Rust 1.30 or higher and `cargo`: [installation instructions.](https://www.rust-lang.org/en-US/install.html) The library is tested against the `stable` release channel.
```
$ cargo build [--release]

View File

@ -2,12 +2,10 @@
//! running the distributed consensus state machine.
extern crate bincode;
extern crate crossbeam;
#[macro_use]
extern crate crossbeam_channel;
extern crate docopt;
extern crate env_logger;
extern crate hbbft;
#[macro_use]
extern crate log;
extern crate serde;
extern crate threshold_crypto as crypto;

View File

@ -1,12 +1,14 @@
//! Comms task structure. A comms task communicates with a remote node through a
//! socket. Local communication with coordinating threads is made via
//! `crossbeam_channel::unbounded()`.
use std::io;
use std::net::TcpStream;
use bincode;
use crossbeam;
use crossbeam_channel::{Receiver, Sender};
use log::{debug, info};
use serde::{de::DeserializeOwned, Serialize};
use std::io;
use std::net::TcpStream;
use hbbft::SourcedMessage;

View File

@ -1,7 +1,6 @@
//! The local message delivery system.
use crossbeam::{Scope, ScopedJoinHandle};
use crossbeam_channel;
use crossbeam_channel::{bounded, unbounded, Receiver, Sender};
use crossbeam_channel::{self, bounded, select_loop, unbounded, Receiver, Sender};
use hbbft::{SourcedMessage, Target, TargetedMessage};
/// The queue functionality for messages sent between algorithm instances.

View File

@ -44,6 +44,7 @@ use std::{io, iter, process, thread, time};
use crossbeam;
use crypto::poly::Poly;
use crypto::{SecretKey, SecretKeySet};
use log::{debug, error};
use hbbft::broadcast::{Broadcast, Message};
use hbbft::{DistAlgorithm, NetworkInfo, SourcedMessage};

View File

@ -5,10 +5,8 @@ extern crate env_logger;
extern crate hbbft;
extern crate itertools;
extern crate rand;
#[macro_use]
extern crate rand_derive;
extern crate serde;
#[macro_use(Deserialize, Serialize)]
extern crate serde_derive;
extern crate signifix;
@ -20,8 +18,10 @@ use colored::*;
use docopt::Docopt;
use itertools::Itertools;
use rand::{Isaac64Rng, Rng};
use rand_derive::Rand;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_derive::{Deserialize, Serialize};
use signifix::{metric, TryFrom};
use hbbft::dynamic_honey_badger::DynamicHoneyBadger;

View File

@ -4,6 +4,7 @@ use std::result;
use std::sync::Arc;
use bincode;
use log::debug;
use super::bool_multimap::BoolMultimap;
use super::bool_set::BoolSet;

View File

@ -1,3 +1,6 @@
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
/// The empty set of boolean values.
pub const NONE: BoolSet = BoolSet(0b00);

View File

@ -69,7 +69,10 @@ pub mod bool_set;
mod sbv_broadcast;
use bincode;
use failure::Fail;
use rand;
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use self::bool_set::BoolSet;
use threshold_sign;

View File

@ -9,9 +9,11 @@
//! It will only output once, but can continue handling messages and will keep track of the set
//! `bin_values` of values for which _2 f + 1_ `BVal`s were received.
use rand;
use std::sync::Arc;
use rand;
use serde_derive::{Deserialize, Serialize};
use super::bool_multimap::BoolMultimap;
use super::bool_set::{self, BoolSet};
use super::{Error, Result};

View File

@ -3,6 +3,7 @@ use std::sync::Arc;
use byteorder::{BigEndian, ByteOrder};
use hex_fmt::{HexFmt, HexList};
use log::{debug, error, info};
use reed_solomon_erasure as rse;
use reed_solomon_erasure::ReedSolomon;

View File

@ -1,3 +1,4 @@
use failure::Fail;
use reed_solomon_erasure as rse;
/// A broadcast error.

View File

@ -1,5 +1,6 @@
use std::mem;
use serde_derive::{Deserialize, Serialize};
use tiny_keccak::sha3_256;
pub type Digest = [u8; 32];

View File

@ -2,6 +2,7 @@ use std::fmt::{self, Debug};
use hex_fmt::HexFmt;
use rand;
use serde_derive::{Deserialize, Serialize};
use super::merkle::{Digest, MerkleTree, Proof};

View File

@ -1,4 +1,5 @@
use crypto::PublicKey;
use serde_derive::{Deserialize, Serialize};
/// A node change action: adding or removing a node.
#[derive(Clone, Eq, PartialEq, Serialize, Deserialize, Hash, Debug)]

View File

@ -4,6 +4,8 @@ use std::sync::Arc;
use bincode;
use crypto::Signature;
use derivative::Derivative;
use log::{debug, info};
use rand::{self, Rand};
use serde::{de::DeserializeOwned, Serialize};

View File

@ -64,6 +64,7 @@ mod votes;
use crypto::{PublicKey, PublicKeySet, Signature};
use rand::Rand;
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use self::votes::{SignedVote, VoteCounter};

View File

@ -4,6 +4,7 @@ use std::sync::Arc;
use bincode;
use crypto::Signature;
use serde::Serialize;
use serde_derive::{Deserialize, Serialize};
use super::{Change, ErrorKind, Result};
use fault_log::{FaultKind, FaultLog};

View File

@ -8,8 +8,10 @@ use std::sync::Arc;
use bincode;
use crypto::Ciphertext;
use log::{debug, error, warn};
use rand::Rand;
use serde::{de::DeserializeOwned, Serialize};
use serde_derive::Serialize;
use super::{Batch, ErrorKind, MessageContent, Result, Step};
use fault_log::{Fault, FaultKind, FaultLog};

View File

@ -3,6 +3,7 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use bincode;
use derivative::Derivative;
use rand::{Rand, Rng};
use serde::{de::DeserializeOwned, Serialize};

View File

@ -1,4 +1,6 @@
use rand::Rand;
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use subset;
use threshold_decryption;

View File

@ -117,20 +117,15 @@
extern crate bincode;
extern crate byteorder;
#[macro_use(Derivative)]
extern crate derivative;
#[macro_use]
extern crate failure;
extern crate hex_fmt;
extern crate init_with;
#[macro_use]
extern crate log;
extern crate rand;
#[macro_use]
extern crate rand_derive;
extern crate reed_solomon_erasure;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate tiny_keccak;

View File

@ -26,6 +26,7 @@ use std::fmt::{self, Display};
use std::marker::PhantomData;
use std::{cmp, iter};
use derivative::Derivative;
use failure::{Backtrace, Context, Fail};
use rand::{Rand, Rng};
use serde::{de::DeserializeOwned, Serialize};

View File

@ -29,7 +29,11 @@ use std::fmt::{self, Display};
use std::result;
use std::sync::Arc;
use failure::Fail;
use hex_fmt::HexFmt;
use log::{debug, error};
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use binary_agreement;
use broadcast::{self, Broadcast};

View File

@ -175,11 +175,13 @@ use crypto::{
error::Error as CryptoError,
poly::{BivarCommitment, BivarPoly, Poly},
serde_impl::field_vec::FieldWrap,
Ciphertext, PublicKey, PublicKeySet, SecretKey, SecretKeyShare,
Ciphertext, Fr, G1Affine, PublicKey, PublicKeySet, SecretKey, SecretKeyShare,
};
use crypto::{Fr, G1Affine};
use failure::Fail;
use log::error;
use pairing::{CurveAffine, Field};
use rand;
use serde_derive::{Deserialize, Serialize};
use {NetworkInfo, NodeIdT};

View File

@ -14,6 +14,10 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use crypto::{self, Ciphertext, DecryptionShare};
use failure::Fail;
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use fault_log::{Fault, FaultKind, FaultLog};
use {DistAlgorithm, NetworkInfo, NodeIdT, Target};

View File

@ -17,6 +17,11 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use crypto::{self, hash_g2, Signature, SignatureShare, G2};
use failure::Fail;
use log::{debug, error};
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use fault_log::{Fault, FaultKind};
use {DistAlgorithm, NetworkInfo, NodeIdT, Target};

View File

@ -16,13 +16,10 @@
extern crate env_logger;
extern crate hbbft;
#[macro_use]
extern crate log;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;
@ -30,6 +27,7 @@ mod network;
use std::iter::once;
use std::sync::Arc;
use log::info;
use rand::Rng;
use hbbft::binary_agreement::BinaryAgreement;

View File

@ -1,15 +1,12 @@
#![deny(unused_must_use)]
//! Integration test of the reliable broadcast protocol.
extern crate hbbft;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate hbbft;
extern crate log;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;
@ -18,6 +15,7 @@ use std::collections::BTreeMap;
use std::iter::once;
use std::sync::Arc;
use log::info;
use rand::Rng;
use hbbft::broadcast::{Broadcast, Message};

View File

@ -1,16 +1,13 @@
#![deny(unused_must_use)]
//! Network tests for Dynamic Honey Badger.
extern crate env_logger;
extern crate hbbft;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;
@ -19,6 +16,7 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use itertools::Itertools;
use log::info;
use rand::{Isaac64Rng, Rng};
use hbbft::dynamic_honey_badger::{Batch, Change, ChangeState, DynamicHoneyBadger, Input};

View File

@ -2,15 +2,12 @@
//! Network tests for Honey Badger.
extern crate bincode;
extern crate env_logger;
extern crate hbbft;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate rand;
#[macro_use]
extern crate rand_derive;
#[macro_use]
extern crate serde_derive;
extern crate threshold_crypto as crypto;
@ -20,6 +17,7 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use itertools::Itertools;
use log::info;
use rand::Rng;
use hbbft::honey_badger::{self, Batch, HoneyBadger, MessageContent};

View File

@ -15,7 +15,6 @@
pub mod adversary;
pub mod err;
pub mod proptest;
#[macro_use]
pub mod util;
use std::io::Write;
@ -29,6 +28,8 @@ use hbbft::dynamic_honey_badger::Batch;
use hbbft::util::SubRng;
use hbbft::{self, Contribution, DistAlgorithm, NetworkInfo, NodeIdT, Step};
use try_some;
pub use self::adversary::Adversary;
pub use self::err::CrankError;

View File

@ -1,8 +1,7 @@
extern crate failure;
extern crate hbbft;
#[macro_use]
extern crate proptest;
extern crate integer_sqrt;
extern crate proptest;
extern crate rand;
extern crate threshold_crypto;
@ -15,7 +14,7 @@ use hbbft::DistAlgorithm;
use net::adversary::ReorderingAdversary;
use net::proptest::{gen_seed, NetworkDimension, TestRng, TestRngSeed};
use net::NetBuilder;
use proptest::prelude::ProptestConfig;
use proptest::{prelude::ProptestConfig, prop_compose, proptest, proptest_helper};
use rand::{Rng, SeedableRng};
/// Choose a node's contribution for an epoch.

View File

@ -1,8 +1,7 @@
extern crate failure;
extern crate hbbft;
#[macro_use]
extern crate proptest;
extern crate integer_sqrt;
extern crate proptest;
extern crate rand;
extern crate rand_core;
extern crate threshold_crypto;
@ -10,8 +9,8 @@ extern crate threshold_crypto;
pub mod net;
use proptest::arbitrary::any;
use proptest::prelude::RngCore;
use proptest::strategy::{Strategy, ValueTree};
use proptest::{prelude::RngCore, proptest, proptest_helper};
use rand::{Rng as Rng4, SeedableRng as SeedableRng4};
use net::proptest::{max_sum, NetworkDimension, NetworkDimensionTree};

View File

@ -4,7 +4,10 @@ use std::mem;
use std::sync::Arc;
use crypto::SecretKeyShare;
use log::{debug, warn};
use rand::{self, Rng};
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use hbbft::dynamic_honey_badger::Batch;
use hbbft::{Contribution, DistAlgorithm, Fault, NetworkInfo, Step, Target, TargetedMessage};

View File

@ -4,13 +4,10 @@
extern crate env_logger;
extern crate hbbft;
extern crate itertools;
#[macro_use]
extern crate log;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;
@ -19,6 +16,7 @@ use std::collections::BTreeMap;
use std::sync::Arc;
use itertools::Itertools;
use log::info;
use rand::{Isaac64Rng, Rng};
use hbbft::dynamic_honey_badger::DynamicHoneyBadger;

View File

@ -3,13 +3,10 @@
extern crate env_logger;
extern crate hbbft;
#[macro_use]
extern crate log;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;

View File

@ -3,20 +3,20 @@
extern crate env_logger;
extern crate hbbft;
#[macro_use]
extern crate log;
extern crate rand;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate rand_derive;
extern crate serde_derive;
extern crate threshold_crypto as crypto;
mod network;
use std::iter::once;
use log::info;
use rand::Rng;
use rand_derive::Rand;
use serde_derive::{Deserialize, Serialize};
use crypto::Signature;
use hbbft::threshold_sign::ThresholdSign;