diff --git a/Cargo.toml b/Cargo.toml index 567e068c20191c6e93b0a9eca9db0dd4e947c9c6..b3d17d27bb326276dcd97b682734f5fc2753c7ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,13 @@ edition = "2018" algebra = { git = "https://github.com/scipr-lab/zexe/", features = [ "parallel" ] } ff-fft = { git = "https://github.com/scipr-lab/zexe/" } bench-utils = { git = "https://github.com/scipr-lab/zexe/" } -rand = { version = "0.7" } +rand_core = { version = "0.5" } rayon = { version = "1" } derivative = { version = "1" } +[dev-dependencies] +rand = { version = "0.7" } + [profile.release] opt-level = 3 lto = "thin" diff --git a/src/lib.rs b/src/lib.rs index bfaee420dffe698d7d2b64256f37b9896a67f7c6..bc10db25f7c13039b283d71079fa6e27cc9cfb3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,7 @@ extern crate bench_utils; use algebra::Field; pub use ff_fft::DensePolynomial as Polynomial; -use rand::Rng; +use rand_core::RngCore; use std::borrow::Cow; /// Defines `SinglePolynomialCommitment` schemes that allow one to commit to @@ -67,7 +67,7 @@ pub trait PCRandomness: Clone { /// Samples randomness for commitments; /// `num_queries` specifies the number of queries that the commitment will be opened at. - fn rand<R: Rng>(num_queries: usize, rng: &mut R) -> Self; + fn rand<R: RngCore>(num_queries: usize, rng: &mut R) -> Self; } /// A polynomial along with information about its degree bound (if any), and the diff --git a/src/multi_pc/mod.rs b/src/multi_pc/mod.rs index 5233c9c49f72bcf8bf55abd9cf57019174756ada..78704729f9a018aad82a9c39f29b41bc0fbc18d9 100644 --- a/src/multi_pc/mod.rs +++ b/src/multi_pc/mod.rs @@ -1,5 +1,5 @@ use algebra::Field; -use rand::RngCore; +use rand_core::RngCore; use std::collections::{BTreeMap, BTreeSet}; use crate::*; diff --git a/src/multi_pc/mpc_from_spc.rs b/src/multi_pc/mpc_from_spc.rs index f30bbf43f83924aa652df063cf622b02f65e81d8..c730bf1fbc035b57a12d62bb4e9c0b85e52882e4 100644 --- a/src/multi_pc/mpc_from_spc.rs +++ b/src/multi_pc/mpc_from_spc.rs @@ -7,7 +7,7 @@ use std::hash::Hash; use std::marker::PhantomData; use algebra::PrimeField; -use rand::RngCore; +use rand_core::RngCore; /// Generic construction of a `MultiPolynomialCommitment` scheme from a /// `SinglePolynomialCommitment` scheme whenever the commitment and randomness of the @@ -525,7 +525,7 @@ where // Basically, we define a "dummy rng" that does nothing // (corresponding to the case that `rng = None`). pub(super) mod optional_rng { - use rand::RngCore; + use rand_core::RngCore; pub(super) struct OptionalRng<R>(pub(super) Option<R>); impl<R: RngCore> RngCore for OptionalRng<R> { @@ -545,7 +545,7 @@ pub(super) mod optional_rng { } #[inline] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { + fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> { Ok(self.fill_bytes(dest)) } } diff --git a/src/single_pc/kzg10.rs b/src/single_pc/kzg10.rs index 21a67d5683f7be7192559ed33059500a87f5c969..da0e0549fdb4b112e6415d6bffbbfbde6d93fdf9 100644 --- a/src/single_pc/kzg10.rs +++ b/src/single_pc/kzg10.rs @@ -15,7 +15,7 @@ use algebra::{ AffineCurve, Field, Group, PairingCurve, PairingEngine, PrimeField, ProjectiveCurve, UniformRand, }; -use rand::RngCore; +use rand_core::RngCore; use rayon::prelude::*; use std::marker::PhantomData; use std::ops::AddAssign; diff --git a/src/single_pc/mod.rs b/src/single_pc/mod.rs index 3444720ab911a218af1e8914df38c6d047a763ac..de5d328e84a35cdefc0633acc4d68086161f88e5 100644 --- a/src/single_pc/mod.rs +++ b/src/single_pc/mod.rs @@ -1,6 +1,6 @@ use crate::*; use algebra::Field; -use rand::RngCore; +use rand_core::RngCore; /// Describes the interface for a polynomial commitment scheme that allows /// a sender to commit to a single polynomial and later provide a succinct proof