From b42477a0bfab979805e2c4fc75e8ad89a0e488a3 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Sat, 28 Sep 2019 10:48:43 +0300 Subject: [PATCH] update from rand_os to fix warnings --- Cargo.lock | 13 ------------- librustzcash/Cargo.toml | 1 - librustzcash/src/rustzcash.rs | 3 +-- librustzcash/src/tests/key_agreement.rs | 3 +-- zcash_primitives/Cargo.toml | 1 - zcash_primitives/benches/pedersen_hash.rs | 4 +--- zcash_primitives/src/merkle_tree.rs | 4 ++-- zcash_primitives/src/note_encryption.rs | 6 +++--- zcash_primitives/src/prover.rs | 2 +- zcash_primitives/src/transaction/builder.rs | 2 +- zcash_primitives/src/transaction/tests.rs | 2 +- zcash_proofs/Cargo.toml | 3 +-- zcash_proofs/src/sapling/prover.rs | 2 +- 13 files changed, 13 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4ade109d..4dd785143 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -368,7 +368,6 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "pairing 0.14.2", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "zcash_primitives 0.0.0", "zcash_proofs 0.0.0", ] @@ -513,15 +512,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_os" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_xorshift" version = "0.2.0" @@ -640,7 +630,6 @@ dependencies = [ "pairing 0.14.2", "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -656,7 +645,6 @@ dependencies = [ "ff 0.4.0", "pairing 0.14.2", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "zcash_primitives 0.0.0", ] @@ -717,7 +705,6 @@ dependencies = [ "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a788ae3edb696cfcba1c19bfd388cc4b8c21f8a408432b199c072825084da58a" "checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" diff --git a/librustzcash/Cargo.toml b/librustzcash/Cargo.toml index 8290191ef..b96fa101b 100644 --- a/librustzcash/Cargo.toml +++ b/librustzcash/Cargo.toml @@ -24,6 +24,5 @@ pairing = { path = "../pairing" } lazy_static = "1" byteorder = "1" rand_core = "0.5" -rand_os = "0.2" zcash_primitives = { path = "../zcash_primitives" } zcash_proofs = { path = "../zcash_proofs" } diff --git a/librustzcash/src/rustzcash.rs b/librustzcash/src/rustzcash.rs index e3a85e4aa..a3da30fec 100644 --- a/librustzcash/src/rustzcash.rs +++ b/librustzcash/src/rustzcash.rs @@ -24,8 +24,7 @@ use blake2s_simd::Params as Blake2sParams; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use std::io::BufReader; use libc::{c_char, c_uchar, size_t}; diff --git a/librustzcash/src/tests/key_agreement.rs b/librustzcash/src/tests/key_agreement.rs index 1250cc724..c4f56a139 100644 --- a/librustzcash/src/tests/key_agreement.rs +++ b/librustzcash/src/tests/key_agreement.rs @@ -1,7 +1,6 @@ use ff::{PrimeField, PrimeFieldRepr}; use pairing::bls12_381::Bls12; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use zcash_primitives::jubjub::{edwards, JubjubBls12}; use zcash_primitives::primitives::{Diversifier, ViewingKey}; diff --git a/zcash_primitives/Cargo.toml b/zcash_primitives/Cargo.toml index 22e4acabc..18838eac3 100644 --- a/zcash_primitives/Cargo.toml +++ b/zcash_primitives/Cargo.toml @@ -20,7 +20,6 @@ log = "0.4" pairing = { path = "../pairing" } rand = "0.7" rand_core = "0.5" -rand_os = "0.2" sha2 = "0.8" [dev-dependencies] diff --git a/zcash_primitives/benches/pedersen_hash.rs b/zcash_primitives/benches/pedersen_hash.rs index b647740b1..3ea652ab7 100644 --- a/zcash_primitives/benches/pedersen_hash.rs +++ b/zcash_primitives/benches/pedersen_hash.rs @@ -2,13 +2,11 @@ extern crate pairing; extern crate rand_core; -extern crate rand_os; extern crate test; extern crate zcash_primitives; use pairing::bls12_381::Bls12; -use rand_core::RngCore; -use rand_os::OsRng; +use rand_core::{OsRng, RngCore}; use zcash_primitives::jubjub::JubjubBls12; use zcash_primitives::pedersen_hash::{pedersen_hash, Personalization}; diff --git a/zcash_primitives/src/merkle_tree.rs b/zcash_primitives/src/merkle_tree.rs index 2721ab6fb..baa44e247 100644 --- a/zcash_primitives/src/merkle_tree.rs +++ b/zcash_primitives/src/merkle_tree.rs @@ -202,12 +202,12 @@ impl CommitmentTree { /// ``` /// extern crate ff; /// extern crate pairing; -/// extern crate rand_os; +/// extern crate rand_core; /// extern crate zcash_primitives; /// /// use ff::{Field, PrimeField}; /// use pairing::bls12_381::Fr; -/// use rand_os::OsRng; +/// use rand_core::OsRng; /// use zcash_primitives::{ /// merkle_tree::{CommitmentTree, IncrementalWitness}, /// sapling::Node, diff --git a/zcash_primitives/src/note_encryption.rs b/zcash_primitives/src/note_encryption.rs index e728c5e66..747bd8d8c 100644 --- a/zcash_primitives/src/note_encryption.rs +++ b/zcash_primitives/src/note_encryption.rs @@ -214,12 +214,12 @@ fn prf_ock( /// ``` /// extern crate ff; /// extern crate pairing; -/// extern crate rand_os; +/// extern crate rand_core; /// extern crate zcash_primitives; /// /// use ff::Field; /// use pairing::bls12_381::Bls12; -/// use rand_os::OsRng; +/// use rand_core::OsRng; /// use zcash_primitives::{ /// jubjub::fs::Fs, /// keys::OutgoingViewingKey, @@ -556,8 +556,8 @@ mod tests { use crypto_api_chachapoly::ChachaPolyIetf; use ff::{Field, PrimeField, PrimeFieldRepr}; use pairing::bls12_381::{Bls12, Fr, FrRepr}; + use rand_core::OsRng; use rand_core::{CryptoRng, RngCore}; - use rand_os::OsRng; use std::str::FromStr; use super::{ diff --git a/zcash_primitives/src/prover.rs b/zcash_primitives/src/prover.rs index 7c6673766..d07181690 100644 --- a/zcash_primitives/src/prover.rs +++ b/zcash_primitives/src/prover.rs @@ -74,7 +74,7 @@ pub trait TxProver { pub(crate) mod mock { use ff::Field; use pairing::bls12_381::{Bls12, Fr}; - use rand_os::OsRng; + use rand_core::OsRng; use crate::{ jubjub::{edwards, fs::Fs, FixedGenerators, Unknown}, diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index b100d9c08..645a6cbb9 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -534,7 +534,7 @@ impl Builder { #[cfg(test)] mod tests { use ff::{Field, PrimeField}; - use rand::rngs::OsRng; + use rand_core::OsRng; use crate::jubjub::fs::Fs; diff --git a/zcash_primitives/src/transaction/tests.rs b/zcash_primitives/src/transaction/tests.rs index d772944fa..99c7a953e 100644 --- a/zcash_primitives/src/transaction/tests.rs +++ b/zcash_primitives/src/transaction/tests.rs @@ -1,6 +1,6 @@ use ff::Field; use pairing::bls12_381::Bls12; -use rand_os::OsRng; +use rand_core::OsRng; use crate::jubjub::{fs::Fs, FixedGenerators}; diff --git a/zcash_proofs/Cargo.toml b/zcash_proofs/Cargo.toml index 766db6306..95e6ff2a0 100644 --- a/zcash_proofs/Cargo.toml +++ b/zcash_proofs/Cargo.toml @@ -13,11 +13,10 @@ byteorder = "1" directories = { version = "1", optional = true } ff = { path = "../ff" } pairing = { path = "../pairing" } -rand_os = "0.2" zcash_primitives = { path = "../zcash_primitives" } +rand_core = "0.5" [dev-dependencies] -rand_core = "0.5" rand_xorshift = "0.2" [features] diff --git a/zcash_proofs/src/sapling/prover.rs b/zcash_proofs/src/sapling/prover.rs index 9b0f8717c..70b529a84 100644 --- a/zcash_proofs/src/sapling/prover.rs +++ b/zcash_proofs/src/sapling/prover.rs @@ -4,7 +4,7 @@ use bellman::{ }; use ff::Field; use pairing::bls12_381::{Bls12, Fr}; -use rand_os::OsRng; +use rand_core::OsRng; use zcash_primitives::{ jubjub::{edwards, fs::Fs, FixedGenerators, JubjubBls12, Unknown}, primitives::{Diversifier, Note, PaymentAddress, ProofGenerationKey, ValueCommitment},