SubtreeLeaf::from_smt_leaf() was only used in tests

This commit is contained in:
Qyriad 2024-11-04 13:56:41 -07:00
parent fcd2647e95
commit 4fa0a51b19

View file

@ -627,16 +627,6 @@ pub struct SubtreeLeaf {
pub hash: RpoDigest, 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()`]. /// Helper struct to organize the return value of [`SparseMerkleTree::sorted_pairs_to_leaves()`].
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct PairComputations<K, L> { pub(crate) struct PairComputations<K, L> {
@ -777,6 +767,13 @@ mod test {
Felt, Word, ONE, Felt, Word, ONE,
}; };
fn smtleaf_to_subtree_leaf(leaf: &SmtLeaf) -> SubtreeLeaf {
SubtreeLeaf {
col: leaf.index().index.value(),
hash: leaf.hash(),
}
}
#[test] #[test]
fn test_sorted_pairs_to_leaves() { fn test_sorted_pairs_to_leaves() {
let entries: Vec<(RpoDigest, Word)> = vec![ let entries: Vec<(RpoDigest, Word)> = vec![
@ -825,7 +822,7 @@ mod test {
// Subtree 2. // Subtree 2.
vec![next_leaf()], 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(); .to_vec();
assert_eq!(control_leaves_iter.next(), None); assert_eq!(control_leaves_iter.next(), None);
control_subtree_leaves control_subtree_leaves