Skip to content

Commit

Permalink
add assert checks for the length fo leaf hashes and leaf enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Sep 18, 2023
1 parent c7ca109 commit d43d33e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plonky2x/src/frontend/merkle/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
.collect_vec()
}

// leaf_hashes and leaves_enabled should be of size NB_LEAVES.
pub fn get_root_from_hashed_leaves<const NB_LEAVES: usize>(
&mut self,
leaf_hashes: Vec<Bytes32Variable>,
leaves_enabled: Vec<BoolVariable>,
) -> Bytes32Variable {
assert!(NB_LEAVES.is_power_of_two());
assert!(leaf_hashes.len() == NB_LEAVES);
assert!(leaves_enabled.len() == NB_LEAVES);

// Hash each of the validators to get their corresponding leaf hash.
let mut current_nodes = leaf_hashes.clone();
Expand Down

0 comments on commit d43d33e

Please sign in to comment.