From cba274b64b05a6a7b293f98b2637cb6f9487e51a Mon Sep 17 00:00:00 2001 From: M Alghazwi Date: Sun, 3 Nov 2024 11:43:07 +0100 Subject: [PATCH] fix ctr --- codex-plonky2-circuits/src/circuits/sample_cells.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codex-plonky2-circuits/src/circuits/sample_cells.rs b/codex-plonky2-circuits/src/circuits/sample_cells.rs index de28a5b..9231a41 100644 --- a/codex-plonky2-circuits/src/circuits/sample_cells.rs +++ b/codex-plonky2-circuits/src/circuits/sample_cells.rs @@ -311,7 +311,7 @@ impl< perm_inputs.extend_from_slice(&data_i); let data_i_hash = builder.hash_n_to_hash_no_pad::(perm_inputs); // counter constant - let ctr_target = builder.constant(F::from_canonical_u64(i as u64)); + let ctr_target = builder.constant(F::from_canonical_u64((i+1) as u64)); let mut ctr = builder.add_virtual_hash(); for i in 0..ctr.elements.len() { if(i==0){ @@ -438,7 +438,7 @@ impl< // do the sample N times for i in 0..N_SAMPLES { - let cell_index_bits = calculate_cell_index_bits(entropy,slot_root,i); + let cell_index_bits = calculate_cell_index_bits(entropy,slot_root,i+1); let cell_index = bits_le_padded_to_usize(&cell_index_bits); // assign cell data let leaf = &slot.cell_data[cell_index];