Skip to content

Commit

Permalink
SubtreeLeaf::from_smt_leaf() was only used in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Qyriad committed Nov 4, 2024
1 parent 07da19e commit 0249e63
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/merkle/smt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,16 +628,6 @@ pub struct SubtreeLeaf {
pub hash: RpoDigest,
}

impl SubtreeLeaf {
#[cfg_attr(not(test), allow(dead_code))]
fn from_smt_leaf(leaf: &crate::merkle::SmtLeaf) -> Self {
Self {
col: leaf.index().index.value(),
hash: leaf.hash(),
}
}
}

/// Helper struct to organize the return value of [`SparseMerkleTree::sorted_pairs_to_leaves()`].
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct PairComputations<K, L> {
Expand Down Expand Up @@ -705,6 +695,13 @@ mod test {
Felt, Word, ONE,
};

fn smtleaf_to_subtree_leaf(leaf: &SmtLeaf) -> SubtreeLeaf {
SubtreeLeaf {
col: leaf.index().index.value(),
hash: leaf.hash(),
}
}

#[test]
fn test_sorted_pairs_to_leaves() {
let entries: Vec<(RpoDigest, Word)> = vec![
Expand Down Expand Up @@ -753,7 +750,7 @@ mod test {
// Subtree 2.
vec![next_leaf()],
]
.map(|subtree| subtree.into_iter().map(SubtreeLeaf::from_smt_leaf).collect())
.map(|subtree| subtree.into_iter().map(smtleaf_to_subtree_leaf).collect())
.to_vec();
assert_eq!(control_leaves_iter.next(), None);
control_subtree_leaves
Expand Down

0 comments on commit 0249e63

Please sign in to comment.