Skip to content

Commit 286cec8

Browse files
committed
fix: merkle tree not returning actual leaves but second layer
1 parent 559833d commit 286cec8

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

aggregation_mode/src/backend/merkle_tree.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ pub fn combine_hashes(hash_a: &[u8; 32], hash_b: &[u8; 32]) -> [u8; 32] {
1010

1111
/// Returns (merkle_root, leaves)
1212
pub fn compute_proofs_merkle_root(proofs: &[AlignedProof]) -> ([u8; 32], Vec<[u8; 32]>) {
13-
let leaves: Vec<[u8; 32]> = proofs
14-
.chunks(2)
15-
.map(|chunk| match chunk {
16-
[a, b] => combine_hashes(&a.hash(), &b.hash()),
17-
[a] => combine_hashes(&a.hash(), &a.hash()),
18-
_ => panic!("Unexpected chunk leaves"),
19-
})
20-
.collect();
13+
let leaves: Vec<[u8; 32]> = proofs.iter().map(|proof| proof.hash()).collect();
2114

2215
let mut root = leaves.clone();
2316

0 commit comments

Comments
 (0)