Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyKing-1 committed Jan 6, 2025
1 parent 0de4d22 commit 02edf1a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions extensions/native/compiler/src/constraints/halo2/baby_bear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,16 @@ impl BabyBearChip {
);
// the inner product above must equal `a`
ctx.constrain_equal(&a, &acc);
let r =
self.gate()
.inner_product(ctx, limbs, self.cached_limbs_r[..num_limbs].to_vec());
// we fetch the cells to lookup by getting the indices where `limbs` were assigned in `inner_product`. Because `limb_bases[0]` is 1, the progression of indices is 0,1,4,...,4+3*i
self.add_cell_to_lookup(ctx, ctx.get(row_offset));
for i in 0..num_limbs - 1 {
self.add_cell_to_lookup(ctx, ctx.get(row_offset + 1 + 3 * i as isize));
}
(
ctx.get(row_offset + 1 + 3 * (num_limbs - 2) as isize),
r,
self.extra_bits + lookup_bits,
)
let last_limb = ctx.get(row_offset + 1 + 3 * (num_limbs - 2) as isize);
let r =
self.gate()
.inner_product(ctx, limbs, self.cached_limbs_r[..num_limbs].to_vec());
(last_limb, r, self.extra_bits + lookup_bits)
};

// additional constraints for the last limb if rem_bits != 0
Expand Down

0 comments on commit 02edf1a

Please sign in to comment.