Skip to content

Commit

Permalink
[kimchi] fix test after witness change
Browse files Browse the repository at this point in the history
  • Loading branch information
mimoo committed Oct 22, 2021
1 parent ef8bfdb commit 4933c02
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 169 deletions.
13 changes: 11 additions & 2 deletions circuits/plonk-15-wires/src/nolookup/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,16 @@ impl<F: FftField + SquareRootField> ConstraintSystem<F> {
pub fn verify(&self, witness: &[Vec<F>; COLUMNS]) -> Result<(), GateError> {
let left_wire = vec![F::one(), F::zero(), F::zero(), F::zero(), F::zero()];

// pad the witness
let pad = vec![F::zero(); self.domain.d1.size as usize - witness[0].len()];
let witness: [Vec<F>; COLUMNS] = array_init(|i| {
let mut w = witness[i].to_vec();
w.extend_from_slice(&pad);
w
});

// check each rows' wiring
for (row, gate) in self.gates.iter().enumerate() {
// check if wires are connected
for col in 0..COLUMNS {
let wire = gate.wires[col];
if witness[col][row] != witness[wire.col][wire.row] {
Expand All @@ -542,7 +550,8 @@ impl<F: FftField + SquareRootField> ConstraintSystem<F> {
}
}

gate.verify(witness, &self)
// check the gate's satisfiability
gate.verify(&witness, &self)
.map_err(|err| GateError::Custom { row, err })?;
}

Expand Down
Loading

0 comments on commit 4933c02

Please sign in to comment.