diff --git a/packages/utils/src/float.circom b/packages/utils/src/float.circom index e56c2a0..4e190c8 100644 --- a/packages/utils/src/float.circom +++ b/packages/utils/src/float.circom @@ -8,6 +8,9 @@ include "mux1.circom"; template MSB(n) { signal input in; signal output out; + + // Ensure the input is less than 2^254 within the finite field for BN254. + assert(in < (2 ** 254)); // Convert the number to its bit representation. var n2b[n]; diff --git a/packages/utils/src/safe-comparators.circom b/packages/utils/src/safe-comparators.circom index 5b63669..91ec62b 100644 --- a/packages/utils/src/safe-comparators.circom +++ b/packages/utils/src/safe-comparators.circom @@ -11,17 +11,9 @@ template SafeLessThan(n) { signal input in[2]; signal output out; - // Convert both inputs to their bit representations to ensure - // they fit within 'n' bits. - var n2b1[n]; - n2b1 = Num2Bits(n)(in[0]); - - var n2b2[n]; - n2b2 = Num2Bits(n)(in[1]); - // Additional conversion to handle arithmetic operation and capture the comparison result. - var n2b[n+1]; - n2b = Num2Bits(n + 1)(in[0] + (1<