mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-31 03:53:09 +00:00
fixes
This commit is contained in:
parent
8e2f33bd42
commit
0c4a1bc5af
@ -111,7 +111,7 @@ impl<F: Extendable<D>, const D: usize> Gate<F, D> for ExponentiationGate<F, D> {
|
||||
}
|
||||
|
||||
fn degree(&self) -> usize {
|
||||
2
|
||||
4
|
||||
}
|
||||
|
||||
fn num_constraints(&self) -> usize {
|
||||
@ -129,8 +129,6 @@ impl<F: Extendable<D>, const D: usize> SimpleGenerator<F> for ExponentiationGene
|
||||
fn dependencies(&self) -> Vec<Target> {
|
||||
let local_target = |input| Target::wire(self.gate_index, input);
|
||||
|
||||
let local_targets = |inputs: Range<usize>| 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."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user