From 2fd30f9c842ee5b3c26d2b5da136e7d8fef20166 Mon Sep 17 00:00:00 2001 From: Pablo Dallegri Date: Thu, 12 Dec 2024 00:02:11 +0000 Subject: [PATCH] fix: borrow flags miscalculation on lower limb limits --- src/fns/unconstrained_helpers.nr | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/fns/unconstrained_helpers.nr b/src/fns/unconstrained_helpers.nr index 0afcfb40..28eee2f3 100644 --- a/src/fns/unconstrained_helpers.nr +++ b/src/fns/unconstrained_helpers.nr @@ -39,12 +39,11 @@ pub(crate) unconstrained fn __validate_gt_remainder( let mut b_u60: U60Repr = U60Repr::from(rhs); let underflow = b_u60.gte(a_u60); - b_u60 += U60Repr::one(); assert(underflow == false, "BigNum::validate_gt check fails"); let mut result_u60: U60Repr = U60Repr { limbs: [0; 2 * N] }; let mut carry_in: u64 = 0; - let mut borrow_in: u64 = 0; + let mut borrow_in: u64 = 1; let mut borrow_flags: [bool; N] = [false; N]; let mut carry_flags: [bool; N] = [false; N]; for i in 0..2 * N {