From fdc933a214b6a30fd07d247dde1cd33ebe3feb06 Mon Sep 17 00:00:00 2001 From: clararod9 Date: Thu, 2 Nov 2023 15:57:22 +0100 Subject: [PATCH] fixing safety bug: template modulo allowed multiple (and unexpected) solutions, correcting LessThan check --- perlin/perlin.circom | 2 ++ 1 file changed, 2 insertions(+) diff --git a/perlin/perlin.circom b/perlin/perlin.circom index fa0b224..375d92d 100644 --- a/perlin/perlin.circom +++ b/perlin/perlin.circom @@ -89,6 +89,8 @@ template Modulo(divisor_bits, SQRT_P) { rp.max_abs_value <== SQRT_P; // check that 0 <= remainder < divisor + component checkBitsRemainder = Num2Bits(divisor_bits); + checkBitsRemainder.in <== remainder; component remainderUpper = LessThan(divisor_bits); remainderUpper.in[0] <== remainder; remainderUpper.in[1] <== divisor;