diff --git a/src/merkle/simple_smt/mod.rs b/src/merkle/simple_smt/mod.rs index 8b32d440..e3669b19 100644 --- a/src/merkle/simple_smt/mod.rs +++ b/src/merkle/simple_smt/mod.rs @@ -138,7 +138,7 @@ impl SimpleSmt { } else if index.depth() > self.depth() { Err(MerkleError::DepthTooBig(index.depth() as u64)) } else if index.depth() == self.depth() { - let leaf = self.get_leaf_at(&LeafIndex::::try_from(index)?); + let leaf = self.get_leaf(&LeafIndex::::try_from(index)?); Ok(leaf.into()) } else { @@ -318,7 +318,7 @@ impl SparseMerkleTree for SimpleSmt { self.leaves.insert(key.value(), value) } - fn get_leaf_at(&self, key: &LeafIndex) -> Word { + fn get_leaf(&self, key: &LeafIndex) -> Word { // the lookup in empty_hashes could fail only if empty_hashes were not built correctly // by the constructor as we check the depth of the lookup above. let leaf_pos = key.value(); diff --git a/src/merkle/simple_smt/tests.rs b/src/merkle/simple_smt/tests.rs index 10191a54..2c9169fd 100644 --- a/src/merkle/simple_smt/tests.rs +++ b/src/merkle/simple_smt/tests.rs @@ -385,7 +385,7 @@ fn test_simplesmt_set_subtree() { }; assert_eq!(tree.root(), k); - assert_eq!(tree.get_leaf_at(&LeafIndex::::new(4).unwrap()), c); + assert_eq!(tree.get_leaf(&LeafIndex::::new(4).unwrap()), c); assert_eq!(tree.get_branch_node(&NodeIndex::new_unchecked(2, 2)).hash(), g); } diff --git a/src/merkle/smt.rs b/src/merkle/smt.rs index e5cd7958..c0e13a28 100644 --- a/src/merkle/smt.rs +++ b/src/merkle/smt.rs @@ -69,7 +69,7 @@ pub trait SparseMerkleTree { return value; } - let leaf = self.get_leaf_at(&key); + let leaf = self.get_leaf(&key); let node_index = { let leaf_index: LeafIndex = key.into(); leaf_index.into() @@ -123,7 +123,7 @@ pub trait SparseMerkleTree { fn insert_leaf_node(&mut self, key: Self::Key, value: Self::Value) -> Option; /// Returns the leaf at the specified index. - fn get_leaf_at(&self, key: &Self::Key) -> Self::Leaf; + fn get_leaf(&self, key: &Self::Key) -> Self::Leaf; /// Returns the hash of a leaf fn hash_leaf(leaf: &Self::Leaf) -> RpoDigest; diff --git a/src/merkle/store/tests.rs b/src/merkle/store/tests.rs index e7ae41e1..ff4d6b56 100644 --- a/src/merkle/store/tests.rs +++ b/src/merkle/store/tests.rs @@ -925,7 +925,7 @@ fn test_recorder() { let node = merkle_store.get_node(smtree.root(), index_2).unwrap(); assert_eq!( node, - smtree.get_leaf_at(&LeafIndex::::try_from(index_2).unwrap()).into() + smtree.get_leaf(&LeafIndex::::try_from(index_2).unwrap()).into() ); // assert that is doesnt contain nodes that were not recorded