Skip to content

Commit

Permalink
Merge pull request #303 from dalek-cryptography/update-rand
Browse files Browse the repository at this point in the history
Update rand_core, curve25519-dalek, merlin versions.
  • Loading branch information
hdevalence authored Dec 27, 2019
2 parents 4a05305 + 194787b commit 468cc64
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ keywords = ["cryptography", "crypto", "ristretto", "zero-knowledge", "bulletproo
description = "A pure-Rust implementation of Bulletproofs using Ristretto"

[dependencies]
curve25519-dalek = { version = "^1.2.3", default-features = false, features = ["u64_backend", "nightly", "serde", "alloc"] }
curve25519-dalek = { version = "2", default-features = false, features = ["u64_backend", "nightly", "serde", "alloc"] }
subtle = { version = "2", default-features = false }
sha3 = { version = "0.8", default-features = false }
digest = { version = "0.8", default-features = false }
rand_core = { version = "0.4", default-features = false, features = ["alloc"] }
rand = { version = "0.6", default-features = false, optional = true }
rand_core = { version = "0.5", default-features = false, features = ["alloc"] }
rand = { version = "0.7", default-features = false, optional = true }
byteorder = { version = "1", default-features = false }
serde = { version = "1", default-features = false, features = ["alloc"] }
serde_derive = { version = "1", default-features = false }
failure = { version = "0.1", default-features = false, features = ["derive"] }
merlin = { version = "1.2", default-features = false }
merlin = { version = "2", default-features = false }
clear_on_drop = { version = "0.2", default-features = false, features = ["nightly"] }

[dev-dependencies]
hex = "0.3"
criterion = "0.2"
criterion = "0.3"
bincode = "1"
rand_chacha = "0.1"
rand_chacha = "0.2"

[features]
default = ["std", "avx2_backend"]
Expand Down
7 changes: 4 additions & 3 deletions benches/r1cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use bulletproofs::{BulletproofGens, PedersenGens};
use curve25519_dalek::ristretto::CompressedRistretto;
use curve25519_dalek::scalar::Scalar;
use merlin::Transcript;
use rand::{thread_rng, Rng};
use rand::seq::SliceRandom;
use rand::Rng;

// Shuffle gadget (documented in markdown file)

Expand Down Expand Up @@ -177,7 +178,7 @@ fn bench_kshuffle_prove(c: &mut Criterion) {
.map(|_| Scalar::from(rng.gen_range(min, max)))
.collect();
let mut output = input.clone();
rand::thread_rng().shuffle(&mut output);
output.shuffle(&mut rand::thread_rng());

// Make kshuffle proof
b.iter(|| {
Expand Down Expand Up @@ -219,7 +220,7 @@ fn bench_kshuffle_verify(c: &mut Criterion) {
.map(|_| Scalar::from(rng.gen_range(min, max)))
.collect();
let mut output = input.clone();
rand::thread_rng().shuffle(&mut output);
output.shuffle(&mut rand::thread_rng());

let mut prover_transcript = Transcript::new(b"ShuffleBenchmark");

Expand Down
7 changes: 4 additions & 3 deletions tests/r1cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use bulletproofs::{BulletproofGens, PedersenGens};
use curve25519_dalek::ristretto::CompressedRistretto;
use curve25519_dalek::scalar::Scalar;
use merlin::Transcript;
use rand::seq::SliceRandom;
use rand::thread_rng;

// Shuffle gadget (documented in markdown file)
Expand Down Expand Up @@ -157,7 +158,7 @@ fn kshuffle_helper(k: usize) {
.map(|_| Scalar::from(rng.gen_range(min, max)))
.collect();
let mut output = input.clone();
rand::thread_rng().shuffle(&mut output);
output.shuffle(&mut rand::thread_rng());

let mut prover_transcript = Transcript::new(b"ShuffleProofTest");
ShuffleProof::prove(&pc_gens, &bp_gens, &mut prover_transcript, &input, &output).unwrap()
Expand Down Expand Up @@ -401,10 +402,10 @@ pub fn range_proof<CS: ConstraintSystem>(

#[test]
fn range_proof_gadget() {
use rand::rngs::OsRng;
use rand::thread_rng;
use rand::Rng;

let mut rng = OsRng::new().unwrap();
let mut rng = thread_rng();
let m = 3; // number of values to test per `n`

for n in [2, 10, 32, 63].iter() {
Expand Down
4 changes: 2 additions & 2 deletions tests/range_proof.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate rand;
use rand::SeedableRng;
extern crate rand_core;
use rand_core::SeedableRng;

extern crate rand_chacha;
use rand_chacha::ChaChaRng;
Expand Down

0 comments on commit 468cc64

Please sign in to comment.