From a38e2ff7283a56650c4e4107892c3156d8b8df19 Mon Sep 17 00:00:00 2001 From: str4d Date: Wed, 8 Dec 2021 01:00:18 +0000 Subject: [PATCH] Ensure lo and hi incomplete ranges line up The previous code assumed that `pallas::Scalar::NUM_BITS` was odd, which is true, but might not remain so after a future generalisation refactor. --- src/circuit/gadget/ecc/chip/mul.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/circuit/gadget/ecc/chip/mul.rs b/src/circuit/gadget/ecc/chip/mul.rs index eebb1a02..edb66fca 100644 --- a/src/circuit/gadget/ecc/chip/mul.rs +++ b/src/circuit/gadget/ecc/chip/mul.rs @@ -43,8 +43,8 @@ const INCOMPLETE_HI_LEN: usize = INCOMPLETE_LEN / 2; // Bits k_{254} to k_{4} inclusive are used in incomplete addition. // The `lo` half is k_{129} to k_{4} inclusive (length 126 bits). -const INCOMPLETE_LO_RANGE: Range = (INCOMPLETE_LEN / 2)..INCOMPLETE_LEN; -const INCOMPLETE_LO_LEN: usize = (INCOMPLETE_LEN / 2) + 1; +const INCOMPLETE_LO_RANGE: Range = INCOMPLETE_HI_LEN..INCOMPLETE_LEN; +const INCOMPLETE_LO_LEN: usize = INCOMPLETE_LEN - INCOMPLETE_HI_LEN; // Bits k_{3} to k_{1} inclusive are used in complete addition. // Bit k_{0} is handled separately.