@@ -55,9 +55,11 @@ fn gpu_merkle_root(columns: &[Vec<u64>], blowup: usize, weights: &[u64]) -> [u8;
5555 }
5656 }
5757
58- // Per-row leaves (rows_per_leaf = 1): this parity test compares the generic
59- // keccak-leaves + Merkle primitives against a per-row CPU reference.
60- let gpu_leaves = math_cuda:: merkle:: keccak_leaves_base ( & flat, n_lde, num_cols, n_lde, 1 )
58+ // Row-pair leaves (rows_per_leaf = 2, matching `ROWS_PER_LEAF`): the CPU
59+ // reference is `commit_rows_bit_reversed`, which hashes bit-reversed row
60+ // pairs into each leaf, so the generic GPU keccak-leaves + Merkle path must
61+ // use the same row-pair layout to produce a matching root.
62+ let gpu_leaves = math_cuda:: merkle:: keccak_leaves_base ( & flat, n_lde, num_cols, n_lde, 2 )
6163 . expect ( "GPU keccak leaves" ) ;
6264 let nodes =
6365 math_cuda:: merkle:: build_merkle_tree_on_device ( & gpu_leaves) . expect ( "GPU Merkle tree" ) ;
@@ -191,8 +193,10 @@ fn gpu_ext3_merkle_root(columns: &[Vec<Fp3>], blowup: usize, weights: &[u64]) ->
191193 }
192194 }
193195
196+ // Row-pair leaves (rows_per_leaf = 2, matching `ROWS_PER_LEAF`) to match the
197+ // row-pair `commit_rows_bit_reversed` CPU reference below.
194198 let gpu_leaves =
195- math_cuda:: merkle:: keccak_leaves_ext3 ( & flat_for_keccak, lde_size, num_cols, lde_size, 1 )
199+ math_cuda:: merkle:: keccak_leaves_ext3 ( & flat_for_keccak, lde_size, num_cols, lde_size, 2 )
196200 . expect ( "GPU ext3 keccak leaves" ) ;
197201 let nodes =
198202 math_cuda:: merkle:: build_merkle_tree_on_device ( & gpu_leaves) . expect ( "GPU Merkle tree" ) ;
0 commit comments