mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 00:33:06 +00:00
More cleaning
This commit is contained in:
parent
e531eda576
commit
64d386051b
@ -74,7 +74,7 @@ pub(crate) fn decompress_merkle_proofs<F: RichField>(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|p| p.siblings.iter())
|
.map(|p| p.siblings.iter())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
// 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 depth in 0..height - cap_height {
|
||||||
for (&i, p) in leaves_indices.iter().zip(siblings.iter_mut()) {
|
for (&i, p) in leaves_indices.iter().zip(siblings.iter_mut()) {
|
||||||
let index = (i + num_leaves) >> depth;
|
let index = (i + num_leaves) >> depth;
|
||||||
@ -93,14 +93,13 @@ pub(crate) fn decompress_merkle_proofs<F: RichField>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For every index, go up the tree by querying `seen` to get node values.
|
// 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 {
|
let mut decompressed_proof = MerkleProof {
|
||||||
siblings: Vec::new(),
|
siblings: Vec::new(),
|
||||||
};
|
};
|
||||||
let mut index = i + num_leaves;
|
let mut index = i + num_leaves;
|
||||||
for _ in 0..height - cap_height {
|
for _ in 0..height - cap_height {
|
||||||
let sibling_index = index ^ 1;
|
let sibling_index = index ^ 1;
|
||||||
// dbg!(index, sibling_index);
|
|
||||||
let h = seen[&sibling_index];
|
let h = seen[&sibling_index];
|
||||||
decompressed_proof.siblings.push(h);
|
decompressed_proof.siblings.push(h);
|
||||||
index >>= 1;
|
index >>= 1;
|
||||||
@ -125,7 +124,7 @@ mod tests {
|
|||||||
fn test_path_compression() {
|
fn test_path_compression() {
|
||||||
type F = CrandallField;
|
type F = CrandallField;
|
||||||
let h = 10;
|
let h = 10;
|
||||||
let cap_height = 0;
|
let cap_height = 3;
|
||||||
let vs = (0..1 << h).map(|_| vec![F::rand()]).collect::<Vec<_>>();
|
let vs = (0..1 << h).map(|_| vec![F::rand()]).collect::<Vec<_>>();
|
||||||
let mt = MerkleTree::new(vs.clone(), cap_height);
|
let mt = MerkleTree::new(vs.clone(), cap_height);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user