From e62a501631305f98c74ca485a072787e47b4f0f8 Mon Sep 17 00:00:00 2001 From: Martin Minkov Date: Tue, 16 Jul 2024 10:18:58 -0700 Subject: [PATCH] refactor(bitwise.ts): replace Field.sizeInBits with hardcoded value 240 in validateBitLength calls The hardcoded value of 240 is now used instead of Field.sizeInBits when calling the validateBitLength function in the not and and functions. This change was made to avoid relying on the Field.sizeInBits property and instead use a fixed value for the maximum bit length validation. Using a hardcoded value provides more explicit control over the allowed bit length and reduces the dependency on the Field class. --- src/lib/provable/gadgets/bitwise.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/provable/gadgets/bitwise.ts b/src/lib/provable/gadgets/bitwise.ts index 5d8b8641d9..c463a9f95a 100644 --- a/src/lib/provable/gadgets/bitwise.ts +++ b/src/lib/provable/gadgets/bitwise.ts @@ -19,7 +19,7 @@ export { }; function not(a: Field, length: number, checked: boolean = false) { - validateBitLength(length, Field.sizeInBits, 'not'); + validateBitLength(length, 240, 'not'); // obtain pad length until the length is a multiple of 16 for n-bit length lookup table let padLength = Math.ceil(length / 16) * 16; @@ -140,7 +140,7 @@ function buildXor(a: Field, b: Field, out: Field, padLength: number) { } function and(a: Field, b: Field, length: number) { - validateBitLength(length, Field.sizeInBits, 'and'); + validateBitLength(length, 240, 'and'); // obtain pad length until the length is a multiple of 16 for n-bit length lookup table let padLength = Math.ceil(length / 16) * 16;