Skip to content

Commit

Permalink
band-aid quick fix for 0xPolygonZero#1641
Browse files Browse the repository at this point in the history
  • Loading branch information
bkomuves committed Dec 6, 2024
1 parent 2916b99 commit be9ea35
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plonky2/src/gates/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,14 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F, D> for Loo
let get_wire = |wire: usize| -> F { witness.get_target(Target::wire(self.row, wire)) };

let input_val = get_wire(LookupGate::wire_ith_looking_inp(self.slot_nb));
let (input, output) = self.lut[input_val.to_canonical_u64() as usize];
if input_val == F::from_canonical_u16(input) {
let idx_candidate: usize = input_val.to_canonical_u64() as usize;
let ((input, output), ok) = if idx_candidate < self.lut.len() {
(self.lut[idx_candidate], true)
}
else {
((0,0), false)
};
if ok && (input_val == F::from_canonical_u16(input)) {
let output_val = F::from_canonical_u16(output);

let out_wire = Target::wire(self.row, LookupGate::wire_ith_looking_out(self.slot_nb));
Expand Down

0 comments on commit be9ea35

Please sign in to comment.