From 402a9d5bd4b069d9c0541281eb89ba3be5ea0841 Mon Sep 17 00:00:00 2001
From: Jeff Burdges <burdges@gnunet.org>
Date: Sun, 27 Oct 2019 17:56:24 +0100
Subject: [PATCH] Reduce depemndency to rand_core

---
 Cargo.toml                   | 5 ++++-
 src/lib.rs                   | 4 ++--
 src/multi_pc/mod.rs          | 2 +-
 src/multi_pc/mpc_from_spc.rs | 6 +++---
 src/single_pc/kzg10.rs       | 2 +-
 src/single_pc/mod.rs         | 2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 567e068..b3d17d2 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 bfaee42..bc10db2 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 5233c9c..7870472 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 f30bbf4..c730bf1 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 21a67d5..da0e054 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 3444720..de5d328 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
-- 
GitLab