diff --git a/src/gates/exponentiation.rs b/src/gates/exponentiation.rs index 144954f3..c3f0e91c 100644 --- a/src/gates/exponentiation.rs +++ b/src/gates/exponentiation.rs @@ -111,7 +111,7 @@ impl, const D: usize> Gate for ExponentiationGate { } fn degree(&self) -> usize { - 2 + 4 } fn num_constraints(&self) -> usize { @@ -129,8 +129,6 @@ impl, const D: usize> SimpleGenerator for ExponentiationGene fn dependencies(&self) -> Vec { let local_target = |input| Target::wire(self.gate_index, input); - let local_targets = |inputs: Range| inputs.map(local_target); - let mut deps = Vec::new(); deps.push(local_target(self.gate.wires_base())); deps.push(local_target(self.gate.wires_power())); @@ -258,15 +256,26 @@ mod tests { num_power_bits, _phantom: PhantomData, }; - let vars = EvaluationVars { + + let good_vars = EvaluationVars { local_constants: &[], local_wires: &get_wires(base, power as u64), public_inputs_hash: &Hash::rand(), }; - assert!( - gate.eval_unfiltered(vars).iter().all(|x| x.is_zero()), + gate.eval_unfiltered(good_vars).iter().all(|x| x.is_zero()), "Gate constraints are not satisfied." ); + + let not_base = F::rand(); + let bad_base_vars = EvaluationVars { + local_constants: &[], + local_wires: &get_wires(not_base, power as u64), + public_inputs_hash: &Hash::rand(), + }; + assert!( + !gate.eval_unfiltered(bad_base_vars).iter().all(|x| x.is_zero()), + "Gate constraints are satisfied but should not be." + ); } }