Skip to content

Commit

Permalink
chore: rename compute_leaves api
Browse files Browse the repository at this point in the history
  • Loading branch information
enricobottazzi committed Nov 9, 2023
1 parent 0c5153b commit 4e180b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions zk_prover/src/merkle_sum_tree/mst.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::merkle_sum_tree::utils::{
build_merkle_tree_from_leaves, compute_leaves, parse_csv_to_entries,
build_leaves_from_entries, build_merkle_tree_from_leaves, parse_csv_to_entries,
};
use crate::merkle_sum_tree::{Entry, Node, Tree};
use num_bigint::BigUint;
Expand Down Expand Up @@ -103,7 +103,7 @@ impl<const N_ASSETS: usize, const N_BYTES: usize> MerkleSumTree<N_ASSETS, N_BYTE

let mut nodes = vec![];

let leaves = compute_leaves(&entries);
let leaves = build_leaves_from_entries(&entries);

let root = build_merkle_tree_from_leaves(&leaves, depth, &mut nodes)?;

Expand Down
4 changes: 3 additions & 1 deletion zk_prover/src/merkle_sum_tree/utils/build_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ where
Ok(root)
}

pub fn compute_leaves<const N_ASSETS: usize>(entries: &[Entry<N_ASSETS>]) -> Vec<Node<N_ASSETS>>
pub fn build_leaves_from_entries<const N_ASSETS: usize>(
entries: &[Entry<N_ASSETS>],
) -> Vec<Node<N_ASSETS>>
where
[usize; N_ASSETS + 1]: Sized,
{
Expand Down
2 changes: 1 addition & 1 deletion zk_prover/src/merkle_sum_tree/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod generate_leaf_hash;
mod hash;
mod operation_helpers;

pub use build_tree::{build_merkle_tree_from_leaves, compute_leaves};
pub use build_tree::{build_leaves_from_entries, build_merkle_tree_from_leaves};
pub use csv_parser::parse_csv_to_entries;
pub use generate_leaf_hash::generate_leaf_hash;
pub use hash::{poseidon_entry, poseidon_node};
Expand Down

0 comments on commit 4e180b2

Please sign in to comment.