Browse Source

Fix some warnings and TODO's.

master
Sean Bowe 7 years ago
parent
commit
b15f5f6f43
  1. 12
      src/lib.rs
  2. 27
      src/multiexp.rs

12
src/lib.rs

@ -57,7 +57,7 @@ impl<E: Engine> LinearCombination<E> {
} }
pub fn eval( pub fn eval(
self, &self,
mut input_density: Option<&mut DensityTracker>, mut input_density: Option<&mut DensityTracker>,
mut aux_density: Option<&mut DensityTracker>, mut aux_density: Option<&mut DensityTracker>,
input_assignment: &[E::Fr], input_assignment: &[E::Fr],
@ -66,7 +66,7 @@ impl<E: Engine> LinearCombination<E> {
{ {
let mut acc = E::Fr::zero(); let mut acc = E::Fr::zero();
for (index, coeff) in self.0.into_iter() { for &(index, coeff) in self.0.iter() {
let mut tmp; let mut tmp;
match index { match index {
@ -262,11 +262,9 @@ impl<E: Engine> TestConstraintSystem<E> {
pub fn is_satisfied(&self) -> bool pub fn is_satisfied(&self) -> bool
{ {
for &(ref a, ref b, ref c) in &self.constraints { for &(ref a, ref b, ref c) in &self.constraints {
// TODO: make eval not take self by value let mut a = a.eval(None, None, &self.inputs, &self.aux);
let b = b.eval(None, None, &self.inputs, &self.aux);
let mut a = a.clone().eval(None, None, &self.inputs, &self.aux); let c = c.eval(None, None, &self.inputs, &self.aux);
let b = b.clone().eval(None, None, &self.inputs, &self.aux);
let c = c.clone().eval(None, None, &self.inputs, &self.aux);
a.mul_assign(&b); a.mul_assign(&b);

27
src/multiexp.rs

@ -3,7 +3,7 @@ use std::sync::Arc;
use std::io; use std::io;
use bit_vec::{self, BitVec}; use bit_vec::{self, BitVec};
use std::iter; use std::iter;
use futures::{BoxFuture, Future}; use futures::{Future};
use futures_cpupool::CpuPool; use futures_cpupool::CpuPool;
use super::Error; use super::Error;
@ -138,7 +138,7 @@ fn multiexp_inner<Q, D, G, S>(
mut skip: u32, mut skip: u32,
c: u32, c: u32,
handle_trivial: bool handle_trivial: bool
) -> BoxFuture<<G as CurveAffine>::Projective, Error> ) -> Box<Future<Item=<G as CurveAffine>::Projective, Error=Error>>
where for<'a> &'a Q: QueryDensity, where for<'a> &'a Q: QueryDensity,
D: Send + Sync + 'static + Clone + AsRef<Q>, D: Send + Sync + 'static + Clone + AsRef<Q>,
G: CurveAffine, G: CurveAffine,
@ -206,21 +206,22 @@ fn multiexp_inner<Q, D, G, S>(
if skip >= <G::Engine as Engine>::Fr::NUM_BITS { if skip >= <G::Engine as Engine>::Fr::NUM_BITS {
// There isn't another region. // There isn't another region.
this.boxed() Box::new(this)
} else { } else {
// There's another region more significant. Calculate and join it with // There's another region more significant. Calculate and join it with
// this region recursively. // this region recursively.
this.join(multiexp_inner(pool, bases, density_map, exponents, skip, c, false)) Box::new(
.map(move |(this, mut higher)| { this.join(multiexp_inner(pool, bases, density_map, exponents, skip, c, false))
for _ in 0..c { .map(move |(this, mut higher)| {
higher.double(); for _ in 0..c {
} higher.double();
}
higher.add_assign(&this); higher.add_assign(&this);
higher higher
}) })
.boxed() )
} }
} }
@ -233,7 +234,7 @@ pub fn multiexp<Q, D, G, S>(
exponents: Arc<Vec<<<G::Engine as Engine>::Fr as PrimeField>::Repr>>, exponents: Arc<Vec<<<G::Engine as Engine>::Fr as PrimeField>::Repr>>,
// TODO // TODO
// c: u32 // c: u32
) -> BoxFuture<<G as CurveAffine>::Projective, Error> ) -> Box<Future<Item=<G as CurveAffine>::Projective, Error=Error>>
where for<'a> &'a Q: QueryDensity, where for<'a> &'a Q: QueryDensity,
D: Send + Sync + 'static + Clone + AsRef<Q>, D: Send + Sync + 'static + Clone + AsRef<Q>,
G: CurveAffine, G: CurveAffine,

Loading…
Cancel
Save