Skip to content

Commit

Permalink
Merge branch 'dev-dumi' of github.com:okx/plonky2 into dev-dumi
Browse files Browse the repository at this point in the history
  • Loading branch information
dloghin committed Mar 27, 2024
2 parents 1850c11 + 2caeb47 commit 704c8ed
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plonky2/src/hash/merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,19 @@ impl<F: RichField, H: Hasher<F>> MerkleTree<F, H> {
v
}

pub fn get_leaves_1D(&self) -> Vec<F> {
self.leaves.clone()
}

pub fn get_leaves_2D(&self) -> Vec<Vec<F>> {
let v2d : Vec<Vec<F>> = self.leaves.chunks_exact(self.leaf_size).map(
|leaf| {
leaf.to_vec()
}
).collect();
v2d
}

pub fn get_leaves_count(&self) -> usize {
self.leaves.len() / self.leaf_size
}
Expand Down

0 comments on commit 704c8ed

Please sign in to comment.