From 64d386051bf6e2c84c292c045e6a02b72e4b622c Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Thu, 7 Oct 2021 22:41:30 +0200 Subject: [PATCH] More cleaning --- src/hash/path_compression.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hash/path_compression.rs b/src/hash/path_compression.rs index 060101f6..bad35a64 100644 --- a/src/hash/path_compression.rs +++ b/src/hash/path_compression.rs @@ -74,7 +74,7 @@ pub(crate) fn decompress_merkle_proofs( .iter() .map(|p| p.siblings.iter()) .collect::>(); - // Fill the `seen` map from the bottom of the tree to the top. + // Fill the `seen` map from the bottom of the tree to the cap. for depth in 0..height - cap_height { for (&i, p) in leaves_indices.iter().zip(siblings.iter_mut()) { let index = (i + num_leaves) >> depth; @@ -93,14 +93,13 @@ pub(crate) fn decompress_merkle_proofs( } } // For every index, go up the tree by querying `seen` to get node values. - for (&i, p) in leaves_indices.iter().zip(compressed_proofs) { + for &i in leaves_indices { let mut decompressed_proof = MerkleProof { siblings: Vec::new(), }; let mut index = i + num_leaves; for _ in 0..height - cap_height { let sibling_index = index ^ 1; - // dbg!(index, sibling_index); let h = seen[&sibling_index]; decompressed_proof.siblings.push(h); index >>= 1; @@ -125,7 +124,7 @@ mod tests { fn test_path_compression() { type F = CrandallField; let h = 10; - let cap_height = 0; + let cap_height = 3; let vs = (0..1 << h).map(|_| vec![F::rand()]).collect::>(); let mt = MerkleTree::new(vs.clone(), cap_height);