Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

[dependencies] bump rand 0.7 #11022

Merged
merged 26 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
22295dd
network-devp2p: bump rand `0.7`
niklasad1 Sep 4, 2019
6480287
updater: bump rand `0.7`
niklasad1 Sep 4, 2019
c303bf6
hash-fetch: bump rand `0.7`
niklasad1 Sep 4, 2019
1c6a6ff
ethcore-sync: bump rand `0.7`
niklasad1 Sep 4, 2019
28aeeb9
rpc: dont work yet
niklasad1 Sep 4, 2019
94c1e81
[private-tx] remove unused rand
niklasad1 Sep 5, 2019
1041cba
[ethcore-snapshot] bump rand 0.7
niklasad1 Sep 5, 2019
0138fec
[engine clique]: bump rand 0.7
niklasad1 Sep 5, 2019
2b2c733
[engine authority-round]: remove rand
niklasad1 Sep 5, 2019
2410ac5
[ethcore-blockchain]: bump rand 0.7
niklasad1 Sep 5, 2019
a56c0e7
[ethcore]: bump rand 0.7
niklasad1 Sep 5, 2019
c7185ac
[ethcore-light]: bump rand 0.7
niklasad1 Sep 5, 2019
d86a91a
[ethstore]: bump rand 0.7
niklasad1 Sep 5, 2019
f150b30
Merge remote-tracking branch 'origin/master' into na-bump-rand
niklasad1 Oct 7, 2019
4778465
Fix for rand usage in rpc
grbIzl Oct 7, 2019
9823e80
[rpc]: fix test build
niklasad1 Oct 7, 2019
dc1be46
[ethcore-sync]: fix test build
niklasad1 Oct 7, 2019
82825e5
[snapshot tests]: rand 0.7
niklasad1 Oct 7, 2019
c35a06e
[ethkey]: bump rand 0.7
niklasad1 Oct 8, 2019
19eaaae
Merge remote-tracking branch 'origin/master' into na-bump-rand
niklasad1 Oct 8, 2019
5d12347
[rpc]: resolve TODO incompatible `rand versions`
niklasad1 Oct 8, 2019
a29264a
[ethkey] use `rust-secp256k1` master branch
niklasad1 Oct 16, 2019
9afd977
Merge remote-tracking branch 'origin/master' into na-bump-rand
niklasad1 Oct 16, 2019
1797569
fix(bad merge): ethcoore-light remove itertools
niklasad1 Oct 17, 2019
01efcd9
[rpc tests]: revert rpc test changes in #11139
niklasad1 Oct 17, 2019
215f7e5
[ethkey/random]: resolve introduced `TODO`
niklasad1 Oct 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 70 additions & 35 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion accounts/ethkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lazy_static = "1.0"
log = "0.4"
parity-wordlist = "1.3"
quick-error = "1.2.2"
rand = "0.6"
rand = "0.7"
rustc-hex = "1.0"
serde = "1.0"
serde_derive = "1.0"
Expand Down
10 changes: 4 additions & 6 deletions accounts/ethkey/src/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ use super::{Generator, KeyPair, SECP256K1};
pub struct Random;

impl Generator for Random {
type Error = ::std::io::Error;
type Error = std::io::Error;

fn generate(&mut self) -> Result<KeyPair, Self::Error> {
let mut rng = OsRng::new()?;
match rng.generate() {
Ok(pair) => Ok(pair),
Err(void) => match void {}, // LLVM unreachable
}
Generator::generate(&mut OsRng).map_err(|void| {
match void {} // LLVM unreachable
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion accounts/ethstore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
log = "0.4"
libc = "0.2"
rand = "0.6"
rand = "0.7"
ethkey = { path = "../ethkey" }
serde = "1.0"
serde_json = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions accounts/ethstore/src/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub trait Random {
impl Random for [u8; 16] {
fn random() -> Self {
let mut result = [0u8; 16];
let mut rng = OsRng::new().unwrap();
let mut rng = OsRng;
rng.fill_bytes(&mut result);
result
}
Expand All @@ -32,14 +32,14 @@ impl Random for [u8; 16] {
impl Random for [u8; 32] {
fn random() -> Self {
let mut result = [0u8; 32];
let mut rng = OsRng::new().unwrap();
let mut rng = OsRng;
rng.fill_bytes(&mut result);
result
}
}

/// Generate a random string of given length.
pub fn random_string(length: usize) -> String {
let mut rng = OsRng::new().expect("Not able to operate without random source.");
let rng = OsRng;
rng.sample_iter(&Alphanumeric).take(length).collect()
}
2 changes: 1 addition & 1 deletion accounts/ethstore/tests/util/transient_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use ethstore::accounts_dir::{KeyDirectory, RootDiskDirectory};
use ethstore::{Error, SafeAccount};

pub fn random_dir() -> PathBuf {
let mut rng = OsRng::new().unwrap();
let mut rng = OsRng;
let mut dir = env::temp_dir();
dir.push(format!("{:x}-{:x}", rng.next_u64(), rng.next_u64()));
dir
Expand Down
3 changes: 2 additions & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ parking_lot = "0.9"
pod = { path = "pod", optional = true }
trie-db = "0.15.0"
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
rand = "0.6"
rand = "0.7"
rand_xorshift = "0.2"
rayon = "1.1"
registrar = { path = "../util/registrar" }
rlp = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion ethcore/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ itertools = "0.5"
kvdb = "0.1"
log = "0.4"
parity-bytes = "0.1"
rand = "0.7"
parking_lot = "0.9"
rand = "0.6"
rayon = "1.0"
rlp = "0.4.0"
rlp_compress = { path = "../../util/rlp-compress" }
Expand Down
1 change: 0 additions & 1 deletion ethcore/engines/authority-round/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ lru-cache = "0.1"
machine = { path = "../../machine" }
macros = { path = "../../../util/macros" }
parking_lot = "0.9"
rand = "0.6"
rlp = "0.4.0"
time-utils = { path = "../../../util/time-utils" }
unexpected = { path = "../../../util/unexpected" }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/engines/clique/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ log = "0.4"
lru-cache = "0.1"
machine = { path = "../../machine" }
macros = { path = "../../../util/macros" }
rand = "0.7"
parking_lot = "0.9"
rand = "0.6"
rlp = "0.4.0"
time-utils = { path = "../../../util/time-utils" }
unexpected = { path = "../../../util/unexpected" }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rlp = "0.4.0"
rlp_derive = { path = "../../util/rlp-derive" }
smallvec = "0.6"
futures = "0.1"
rand = "0.6"
rand = "0.7"
bincode = "1.1"
serde = "1.0"
serde_derive = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions ethcore/snapshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ keccak-hasher = { path = "../../util/keccak-hasher" }
kvdb = "0.1"
log = "0.4.8"
num_cpus = "1.10.1"
rand = "0.7"
rand_xorshift = "0.2"
parking_lot = "0.9"
rand = "0.6"
rand_xorshift = "0.1.1"
rlp = "0.4.2"
rlp_derive = { path = "../../util/rlp-derive" }
snappy = { package = "parity-snappy", version ="0.1.0" }
Expand Down
4 changes: 2 additions & 2 deletions ethcore/snapshot/snapshot-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ kvdb = "0.1"
kvdb-rocksdb = { version = "0.1.5" }
log = "0.4.8"
parking_lot = "0.9"
rand = "0.6"
rand_xorshift = "0.1.1"
rand = "0.7"
rand_xorshift = "0.2"
rlp = "0.4.2"
snappy = { package = "parity-snappy", version ="0.1.0" }
snapshot = { path = "../../snapshot", features = ["test-helpers"] }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/snapshot/src/consensus/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl PowRebuilder {
Ok(PowRebuilder {
chain,
db,
rng: OsRng::new().map_err(|e| format!("{}", e))?,
rng: OsRng,
disconnected: Vec::new(),
best_number: manifest.block_number,
best_hash: manifest.block_hash,
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl Importer {
{
trace_time!("import_old_block");
// verify the block, passing the chain for updating the epoch verifier.
let mut rng = OsRng::new().map_err(|e| format!("{}", e))?;
let mut rng = OsRng;
self.ancient_verifier.verify(&mut rng, &unverified.header, &chain)?;

// Commit results
Expand Down
4 changes: 2 additions & 2 deletions ethcore/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ macros = { path = "../../util/macros" }
network = { package = "ethcore-network", path = "../../util/network" }
parity-runtime = { path = "../../util/runtime" }
parity-util-mem = "0.2.0"
rand = "0.7"
parking_lot = "0.9"
rand = "0.6"
rlp = "0.4.0"
snapshot = { path = "../snapshot" }
trace-time = "0.1"
Expand All @@ -41,6 +41,6 @@ ethcore = { path = "..", features = ["test-helpers"] }
ethcore-io = { path = "../../util/io", features = ["mio"] }
kvdb-memorydb = "0.1.2"
machine = { path = "../machine" }
rand_xorshift = "0.1.1"
rand_xorshift = "0.2"
rustc-hex = "1.0"
spec = { path = "../spec" }
2 changes: 1 addition & 1 deletion ethcore/sync/src/light_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ impl<L: AsLightClient> LightSync<L> {
peers: RwLock::new(HashMap::new()),
pending_reqs: Mutex::new(HashMap::new()),
client: client,
rng: Mutex::new(OsRng::new()?),
rng: Mutex::new(OsRng),
senders: RwLock::new(Vec::new()),
state: Mutex::new(SyncStateWrapper::idle()),
is_idle: Mutex::new(true),
Expand Down
6 changes: 3 additions & 3 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ futures = "0.1.6"
log = "0.4"
multihash = "0.8"
order-stat = "0.1"
parking_lot = "0.9"
rand = "0.6"
rand_xorshift = "0.1.1"
rand = "0.7"
rand_xorshift = "0.2"
rustc-hex = "1.0"
semver = "0.9"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
parking_lot = "0.9"
tempdir = "0.3"
tiny-keccak = "1.4"
tokio-timer = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/authcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<T: TimeProvider> AuthCodes<T> {

/// Generates and returns a new code that can be used by `SignerUIs`
pub fn generate_new(&mut self) -> io::Result<String> {
let mut rng = OsRng::new()?;
let rng = OsRng;
let code = rng.sample_iter(&Alphanumeric).take(TOKEN_LENGTH).collect::<String>();
let readable_code = code.as_bytes()
.chunks(4)
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/helpers/secretstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fn into_document_key(key: Bytes) -> Result<Bytes, Error> {

fn initialization_vector() -> [u8; INIT_VEC_LEN] {
let mut result = [0u8; INIT_VEC_LEN];
let mut rng = OsRng::new().unwrap();
let mut rng = OsRng;
rng.fill_bytes(&mut result);
result
}
Expand Down
10 changes: 4 additions & 6 deletions rpc/src/v1/helpers/subscribers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use std::{ops, str};
use std::collections::HashMap;
use rand::RngCore;

use jsonrpc_pubsub::{typed::{Subscriber, Sink}, SubscriptionId};
use ethereum_types::H64;

Expand All @@ -44,11 +44,11 @@ impl Id {

#[cfg(not(test))]
mod random {
use rand;
use rand::rngs::OsRng;

pub type Rng = rand::rngs::OsRng;

pub fn new() -> Rng { Rng::new().expect("Valid random source is required.") }
pub fn new() -> Rng { OsRng }
}

#[cfg(test)]
Expand Down Expand Up @@ -79,9 +79,7 @@ impl<T> Default for Subscribers<T> {

impl<T> Subscribers<T> {
fn next_id(&mut self) -> Id {
let mut data = H64::default();
// TODO [grbIzl] rework with proper H64::random_using with rand 0.7
self.rand.fill_bytes(&mut data.as_bytes_mut());
let data = H64::random_using(&mut self.rand);
Id(data)
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/helpers/subscription_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ mod tests {
let mut el = Runtime::new().unwrap();
let mut poll_manager = poll_manager();
let (id, rx) = poll_manager.subscribe(Default::default(), "hello".into(), Params::None);
assert_eq!(id, SubscriptionId::String("0x4333966aca52ad0b".into()));
assert_eq!(id, SubscriptionId::String("0x43ca64edf03768e1".into()));

// then
poll_manager.tick().wait().unwrap();
Expand Down
Loading