diff --git a/src/groth/mod.rs b/src/groth/mod.rs index 18d9506..bfdfd5e 100644 --- a/src/groth/mod.rs +++ b/src/groth/mod.rs @@ -307,7 +307,7 @@ pub fn prepare_verifying_key( } } -pub fn verify, F: FnOnce(&mut ConstraintSystem) -> C>( +pub fn verify, F: FnOnce(&mut ConstraintSystem) -> C>( e: &E, circuit: F, proof: &Proof, diff --git a/src/groth/tests/mod.rs b/src/groth/tests/mod.rs index e486c5f..908de83 100644 --- a/src/groth/tests/mod.rs +++ b/src/groth/tests/mod.rs @@ -6,12 +6,12 @@ struct RootCircuit { } impl Circuit for RootCircuit { - type WitnessMap = RootWitness; + type InputMap = RootInput; fn synthesize>(self, e: &E, cs: &mut CS) - -> Self::WitnessMap + -> Self::InputMap { let root_var = cs.alloc(self.root); @@ -31,19 +31,19 @@ impl Circuit for RootCircuit { cur = new; } - RootWitness { + RootInput { num: cur_val, num_var: cur } } } -struct RootWitness { +struct RootInput { num: E::Fr, num_var: Variable } -impl Witness for RootWitness { +impl Input for RootInput { fn synthesize>( self, e: &E, @@ -96,7 +96,7 @@ fn test_snark_system( // verify proof assert!(verify(e, |cs| { - RootWitness { + RootInput { num: E::Fr::from_str(e, "1267650600228229401496703205376").unwrap(), num_var: cs.alloc(E::Fr::one(e)) } @@ -104,7 +104,7 @@ fn test_snark_system( // verify invalid proof assert!(!verify(e, |cs| { - RootWitness { + RootInput { num: E::Fr::from_str(e, "1267650600228229401496703205375").unwrap(), num_var: cs.alloc(E::Fr::one(e)) } @@ -181,7 +181,7 @@ fn test_snark_system( // verify fake proof assert!(verify(e, |cs| { - RootWitness { + RootInput { num: E::Fr::from_str(e, "100").unwrap(), num_var: cs.alloc(E::Fr::one(e)) } @@ -189,7 +189,7 @@ fn test_snark_system( // verify fake proof with wrong input assert!(!verify(e, |cs| { - RootWitness { + RootInput { num: E::Fr::from_str(e, "101").unwrap(), num_var: cs.alloc(E::Fr::one(e)) } diff --git a/src/lib.rs b/src/lib.rs index d72b212..691e1bf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,14 +118,14 @@ impl<'a, E: Engine> LinearCombination<'a, E> { } pub trait Circuit { - type WitnessMap: Witness; + type InputMap: Input; /// Synthesize the circuit into a rank-1 quadratic constraint system #[must_use] - fn synthesize>(self, engine: &E, cs: &mut CS) -> Self::WitnessMap; + fn synthesize>(self, engine: &E, cs: &mut CS) -> Self::InputMap; } -pub trait Witness { +pub trait Input { /// Synthesize the circuit, except with additional access to public input /// variables fn synthesize>(self, engine: &E, cs: &mut CS);