From af6d51e6bdb175885f5dd4aac5c256d6dde29f08 Mon Sep 17 00:00:00 2001 From: Oleg Andreev Date: Thu, 12 Dec 2019 21:44:23 +0100 Subject: [PATCH] fix benchmarks --- Cargo.toml | 2 +- benches/r1cs.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 438b163b..5a655aae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ clear_on_drop = { version = "0.2", default-features = false, features = ["nightl [dev-dependencies] hex = "0.3" -criterion = "0.2" +criterion = "0.3" bincode = "1" rand_chacha = "0.2" diff --git a/benches/r1cs.rs b/benches/r1cs.rs index c4dade19..67dc2d8a 100644 --- a/benches/r1cs.rs +++ b/benches/r1cs.rs @@ -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::{Rng}; +use rand::seq::SliceRandom; // Shuffle gadget (documented in markdown file) @@ -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(|| { @@ -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");