From 318c3ce9de90eb1ac90a0acd70b21821d0fa2040 Mon Sep 17 00:00:00 2001 From: Kevin Jue Date: Tue, 19 Dec 2023 10:51:43 -0800 Subject: [PATCH] fix for V-SCT-VUL-022 --- fri/fri.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fri/fri.go b/fri/fri.go index c1ce7a9..fe1f6eb 100644 --- a/fri/fri.go +++ b/fri/fri.go @@ -128,13 +128,15 @@ func (f *Chip) verifyMerkleProofToCapWithCapIndex( } const NUM_LEAF_LOOKUPS = 4 + // Each lookup gadget will connect to 4 merkleCap entries + const STRIDE_LENGTH = 4 var leafLookups [NUM_LEAF_LOOKUPS]poseidon.BN254HashOut // First create the "leaf" lookup2 circuits - // The will use the least significant bits of the capIndexBits array + // This will use the least significant bits of the capIndexBits array for i := 0; i < NUM_LEAF_LOOKUPS; i++ { leafLookups[i] = f.api.Lookup2( capIndexBits[0], capIndexBits[1], - merkleCap[i*NUM_LEAF_LOOKUPS], merkleCap[i*NUM_LEAF_LOOKUPS+1], merkleCap[i*NUM_LEAF_LOOKUPS+2], merkleCap[i*NUM_LEAF_LOOKUPS+3], + merkleCap[i*STRIDE_LENGTH], merkleCap[i*STRIDE_LENGTH+1], merkleCap[i*STRIDE_LENGTH+2], merkleCap[i*STRIDE_LENGTH+3], ) }