Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rand_core, curve25519-dalek, merlin versions. #303

Merged
merged 3 commits into from Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
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
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
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
@@ -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