From e02416f13ef938f1408dae30774539a9f2f57049 Mon Sep 17 00:00:00 2001 From: luffykai Date: Tue, 29 Oct 2024 23:16:56 -0700 Subject: [PATCH] fix q max overflow bits (#722) --- .../primitives/src/bigint/check_carry_mod_to_zero.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/circuits/primitives/src/bigint/check_carry_mod_to_zero.rs b/circuits/primitives/src/bigint/check_carry_mod_to_zero.rs index 41fe50a92b..a8cf2e0036 100644 --- a/circuits/primitives/src/bigint/check_carry_mod_to_zero.rs +++ b/circuits/primitives/src/bigint/check_carry_mod_to_zero.rs @@ -77,10 +77,12 @@ impl SubAir for CheckCarryModToZeroSubAir { is_valid, ); } - let overflow_q = OverflowInt::::from_var_vec::( - quotient, - self.check_carry_to_zero.limb_bits, - ); + let limb_bits = self.check_carry_to_zero.limb_bits; + let overflow_q = OverflowInt:: { + 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()