Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
fix compilation warnings, disable sonics in default features
Browse files Browse the repository at this point in the history
  • Loading branch information
shamatar committed Mar 5, 2019
1 parent 2a453c3 commit f12986a
Show file tree
Hide file tree
Showing 5 changed files with 448 additions and 401 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ git = "https://github.com/gtank/blake2-rfc"
rev = "7a5b5fc99ae483a0043db7547fb79a6fa44b88a9"

[features]
#default = ["multicore"]
default = ["multicore", "gm17", "sonic"]
default = ["multicore"]
#default = ["multicore", "gm17", "sonic"]
#default = ["singlecore"]
multicore = ["futures-cpupool", "num_cpus", "crossbeam"]
sonic = ["tiny-keccak"]
Expand Down
8 changes: 4 additions & 4 deletions src/multiexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ pub fn multiexp<Q, D, G, S>(

/// Perform multi-exponentiation. The caller is responsible for ensuring that
/// the number of bases is the same as the number of exponents.
#[allow(dead_code)]
pub fn dense_multiexp<G: CurveAffine>(
pool: &Worker,
bases: & [G],
Expand Down Expand Up @@ -220,7 +221,6 @@ fn dense_multiexp_inner<G: CurveAffine>(
let this_region = Mutex::new(<G as CurveAffine>::Projective::zero());
let arc = Arc::new(this_region);
pool.scope(bases.len(), |scope, chunk| {
let mut this_acc = <G as CurveAffine>::Projective::zero();
for (base, exp) in bases.chunks(chunk).zip(exponents.chunks(chunk)) {
let this_region_rwlock = arc.clone();
// let handle =
Expand Down Expand Up @@ -265,7 +265,7 @@ fn dense_multiexp_inner<G: CurveAffine>(

let mut guard = match this_region_rwlock.lock() {
Ok(guard) => guard,
Err(poisoned) => {
Err(_) => {
panic!("poisoned!");
// poisoned.into_inner()
}
Expand Down Expand Up @@ -387,7 +387,7 @@ fn test_dense_multiexp() {
const SAMPLES: usize = 1 << 16;
let rng = &mut XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);

let mut v = (0..SAMPLES).map(|_| <Bn256 as ScalarEngine>::Fr::rand(rng).into_repr()).collect::<Vec<_>>();
let v = (0..SAMPLES).map(|_| <Bn256 as ScalarEngine>::Fr::rand(rng).into_repr()).collect::<Vec<_>>();
let g = (0..SAMPLES).map(|_| <Bn256 as Engine>::G1::rand(rng).into_affine()).collect::<Vec<_>>();

println!("Done generating test points and scalars");
Expand All @@ -397,7 +397,7 @@ fn test_dense_multiexp() {
let start = std::time::Instant::now();

let dense = dense_multiexp(
&pool, &g, &mut v.clone()).unwrap();
&pool, &g, &v.clone()).unwrap();

let duration_ns = start.elapsed().as_nanos() as f64;
println!("{} ns for dense for {} samples", duration_ns, SAMPLES);
Expand Down
2 changes: 2 additions & 0 deletions src/sonic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ pub mod unhelped;

mod transcript;

#[cfg(test)]
mod tests;


Loading

0 comments on commit f12986a

Please sign in to comment.