Skip to content

Commit

Permalink
build(deps): update rand requirement from 0.7.2 to 0.8.0 (#488)
Browse files Browse the repository at this point in the history
* build(deps): update rand requirement from 0.7.2 to 0.8.0

Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@0.7.3...0.8.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Seed from u64

* uint: use rand 0.7 for quickcheck feature

* kvdb-rocksdb: fix compilation for benches

* parity-crypto: remove unused dep and fix a warning

* cargo fmt and another unused dep

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: David Palm <dvdplm@gmail.com>
  • Loading branch information
3 people committed Jan 4, 2021
1 parent a7003bc commit 2c8cd78
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ethbloom/Cargo.toml
Expand Up @@ -19,7 +19,7 @@ impl-codec = { version = "0.4.1", path = "../primitive-types/impls/codec", defau

[dev-dependencies]
criterion = "0.3.0"
rand = "0.7.2"
rand = "0.8.0"
hex-literal = "0.3.1"

[features]
Expand Down
3 changes: 2 additions & 1 deletion fixed-hash/Cargo.toml
Expand Up @@ -16,14 +16,15 @@ features = ["quickcheck", "api-dummy"]
[dependencies]
byteorder = { version = "1.3.2", optional = true, default-features = false }
quickcheck = { version = "0.9.0", optional = true }
rand = { version = "0.7.2", optional = true, default-features = false }
rand = { version = "0.8.0", optional = true, default-features = false }
rustc-hex = { version = "2.0.1", optional = true, default-features = false }
static_assertions = "1.0.0"
arbitrary = { version = "0.4", optional = true }

[dev-dependencies]
rand_xorshift = "0.2.0"
criterion = "0.3.0"
rand = { version = "0.8.0", default-features = false, features = ["std_rng"] }

[features]
default = ["std", "rand", "rustc-hex", "byteorder"]
Expand Down
19 changes: 2 additions & 17 deletions fixed-hash/src/tests.rs
Expand Up @@ -244,23 +244,8 @@ mod rand {

#[test]
fn random() {
let default_seed = <StdRng as SeedableRng>::Seed::default();
let mut rng = StdRng::from_seed(default_seed);
assert_eq!(H32::random_using(&mut rng), H32::from([0x76, 0xa0, 0x40, 0x53]));
}

#[test]
fn randomize() {
let default_seed = <StdRng as SeedableRng>::Seed::default();
let mut rng = StdRng::from_seed(default_seed);
assert_eq!(
{
let mut ret = H32::zero();
ret.randomize_using(&mut rng);
ret
},
H32::from([0x76, 0xa0, 0x40, 0x53])
)
let mut rng = StdRng::seed_from_u64(123);
assert_eq!(H32::random_using(&mut rng), H32::from([0xeb, 0x96, 0xaf, 0x1c]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion kvdb-rocksdb/Cargo.toml
Expand Up @@ -28,7 +28,7 @@ alloc_counter = "0.0.4"
criterion = "0.3"
ethereum-types = { path = "../ethereum-types" }
kvdb-shared-tests = { path = "../kvdb-shared-tests", version = "0.6" }
rand = "0.7.2"
rand = "0.8.0"
tempfile = "3.1.0"
keccak-hash = { path = "../keccak-hash" }
sysinfo = "0.15.3"
Expand Down
2 changes: 1 addition & 1 deletion kvdb-rocksdb/benches/bench_read_perf.rs
Expand Up @@ -50,7 +50,7 @@ fn open_db() -> Database {
/// an `ElasticArray128` so sometimes we save on allocations.
fn n_random_bytes(n: usize) -> Vec<u8> {
let mut rng = rand::thread_rng();
let variability: i64 = rng.gen_range(0, (n / 5) as i64);
let variability: i64 = rng.gen_range(0..(n / 5) as i64);
let plus_or_minus: i64 = if variability % 2 == 0 { 1 } else { -1 };
let range = Uniform::from(0..u8::max_value());
rng.sample_iter(&range).take((n as i64 + plus_or_minus * variability) as usize).collect()
Expand Down
1 change: 0 additions & 1 deletion parity-crypto/Cargo.toml
Expand Up @@ -22,7 +22,6 @@ ethereum-types = { version = "0.10.0", optional = true, path = "../ethereum-type
hmac = "0.10.1"
lazy_static = { version = "1.4.0", optional = true }
pbkdf2 = "0.6.0"
rand = "0.7.3"
ripemd160 = "0.9.1"
rustc-hex = { version = "2.1.0", default-features = false, optional = true }
scrypt = { version = "0.5.0" }
Expand Down
1 change: 0 additions & 1 deletion parity-crypto/src/publickey/secret_key.rs
Expand Up @@ -8,7 +8,6 @@

//! Secret key implementation.

use std::convert::TryFrom;
use std::fmt;
use std::ops::Deref;
use std::str::FromStr;
Expand Down
1 change: 0 additions & 1 deletion transaction-pool/Cargo.toml
Expand Up @@ -10,7 +10,6 @@ edition = "2018"
[dependencies]
log = "0.4.8"
smallvec = "1.6.0"
trace-time = { path = "../trace-time", version = "0.1" }

[dev-dependencies]
ethereum-types = { version = "0.10.0", path = "../ethereum-types" }
4 changes: 2 additions & 2 deletions uint/Cargo.toml
Expand Up @@ -13,15 +13,15 @@ edition = "2018"
byteorder = { version = "1.3.2", default-features = false }
crunchy = { version = "0.2.2", default-features = false }
qc = { package = "quickcheck", version = "0.9.0", optional = true }
rand = { version = "0.7.2", default-features = false, optional = true }
rand07 = { package = "rand", version = "0.7", default-features = false, optional = true }
hex = { version = "0.4", default-features = false }
static_assertions = "1.0.0"
arbitrary = { version = "0.4", optional = true }

[features]
default = ["std"]
std = ["byteorder/std", "crunchy/std", "hex/std"]
quickcheck = ["qc", "rand"]
quickcheck = ["qc", "rand07"]

[[example]]
name = "modular"
Expand Down
2 changes: 1 addition & 1 deletion uint/src/lib.rs
Expand Up @@ -27,7 +27,7 @@ pub use qc;

#[cfg(feature = "quickcheck")]
#[doc(hidden)]
pub use rand;
pub use rand07;

#[cfg(feature = "arbitrary")]
#[doc(hidden)]
Expand Down
4 changes: 2 additions & 2 deletions uint/src/uint.rs
Expand Up @@ -1742,8 +1742,8 @@ macro_rules! impl_quickcheck_arbitrary_for_uint {
fn arbitrary<G: $crate::qc::Gen>(g: &mut G) -> Self {
let mut res = [0u8; $n_bytes];

use $crate::rand::Rng;
let p: f64 = $crate::rand::rngs::OsRng.gen();
use $crate::rand07::Rng;
let p: f64 = $crate::rand07::rngs::OsRng.gen();
// make it more likely to generate smaller numbers that
// don't use up the full $n_bytes
let range =
Expand Down

0 comments on commit 2c8cd78

Please sign in to comment.