Skip to content

Commit

Permalink
fix q max overflow bits (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
luffykai authored Oct 30, 2024
1 parent 5ebc699 commit e02416f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions circuits/primitives/src/bigint/check_carry_mod_to_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ impl<AB: InteractionBuilder> SubAir<AB> for CheckCarryModToZeroSubAir {
is_valid,
);
}
let overflow_q = OverflowInt::<AB::Expr>::from_var_vec::<AB, AB::Var>(
quotient,
self.check_carry_to_zero.limb_bits,
);
let limb_bits = self.check_carry_to_zero.limb_bits;
let overflow_q = OverflowInt::<AB::Expr> {
limbs: quotient.iter().map(|&x| x.into()).collect(),
max_overflow_bits: limb_bits + 1, // q can be negative, so this is the constraint we have when range check.
limb_max_abs: 1 << limb_bits,
};
let p_limbs = self
.modulus_limbs
.iter()
Expand Down

0 comments on commit e02416f

Please sign in to comment.