Skip to content

Commit

Permalink
remove get_inner_node from public API
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Jan 12, 2024
1 parent 4f9aa81 commit 5c61261
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/merkle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod simple_smt;
pub use simple_smt::SimpleSmt;

pub(crate) mod sparse_merkle_tree;
pub use sparse_merkle_tree::{InnerNode, LeafIndex, SMT_MAX_DEPTH, SMT_MIN_DEPTH};
pub use sparse_merkle_tree::{LeafIndex, SMT_MAX_DEPTH, SMT_MIN_DEPTH};

mod smt;
pub use smt::{Smt, SmtKey, SmtLeaf, SMT_DEPTH};
Expand Down
12 changes: 3 additions & 9 deletions src/merkle/simple_smt/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::EMPTY_WORD;

use super::{
sparse_merkle_tree::{SparseMerkleTree, SMT_MAX_DEPTH},
BTreeMap, BTreeSet, EmptySubtreeRoots, InnerNode, InnerNodeInfo, LeafIndex, MerkleError,
MerklePath, MerkleTreeDelta, NodeIndex, RpoDigest, StoreNode, TryApplyDiff, Word,
SMT_MIN_DEPTH,
sparse_merkle_tree::{InnerNode, SparseMerkleTree, SMT_MAX_DEPTH},
BTreeMap, BTreeSet, EmptySubtreeRoots, InnerNodeInfo, LeafIndex, MerkleError, MerklePath,
MerkleTreeDelta, NodeIndex, RpoDigest, StoreNode, TryApplyDiff, Word, SMT_MIN_DEPTH,
};

#[cfg(test)]
Expand Down Expand Up @@ -118,11 +117,6 @@ impl<const DEPTH: u8> SimpleSmt<DEPTH> {
<Self as SparseMerkleTree<DEPTH>>::get_leaf(self, key)
}

/// Retrieves an inner node at the given index
pub fn get_inner_node(&self, index: NodeIndex) -> InnerNode {
<Self as SparseMerkleTree<DEPTH>>::get_inner_node(self, index)
}

/// Returns a Merkle path from the leaf node specified by the key to the root.
///
/// The node itself is not included in the path.
Expand Down
5 changes: 4 additions & 1 deletion src/merkle/simple_smt/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use super::{
};
use crate::{
hash::rpo::Rpo256,
merkle::{digests_to_words, int_to_leaf, int_to_node, EmptySubtreeRoots, LeafIndex},
merkle::{
digests_to_words, int_to_leaf, int_to_node, sparse_merkle_tree::SparseMerkleTree,
EmptySubtreeRoots, LeafIndex,
},
utils::collections::Vec,
Word,
};
Expand Down
11 changes: 3 additions & 8 deletions src/merkle/smt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use crate::hash::rpo::Rpo256;
use crate::utils::{collections::Vec, vec};
use crate::{Felt, EMPTY_WORD};

use super::sparse_merkle_tree::SparseMerkleTree;
use super::sparse_merkle_tree::{InnerNode, SparseMerkleTree};
use super::{
BTreeMap, BTreeSet, EmptySubtreeRoots, InnerNode, LeafIndex, MerkleError, MerklePath,
NodeIndex, RpoDigest, Word,
BTreeMap, BTreeSet, EmptySubtreeRoots, LeafIndex, MerkleError, MerklePath, NodeIndex,
RpoDigest, Word,
};

#[cfg(test)]
Expand Down Expand Up @@ -95,11 +95,6 @@ impl Smt {
<Self as SparseMerkleTree<SMT_DEPTH>>::get_leaf(self, key)
}

/// Retrieves an inner node at the given index
pub fn get_inner_node(&self, index: NodeIndex) -> InnerNode {
<Self as SparseMerkleTree<SMT_DEPTH>>::get_inner_node(self, index)
}

/// Returns a Merkle path from the leaf node specified by the key to the root.
///
/// The node itself is not included in the path.
Expand Down
2 changes: 1 addition & 1 deletion src/merkle/sparse_merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub(crate) trait SparseMerkleTree<const DEPTH: u8> {

#[derive(Debug, Default, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct InnerNode {
pub(crate) struct InnerNode {
pub left: RpoDigest,
pub right: RpoDigest,
}
Expand Down

0 comments on commit 5c61261

Please sign in to comment.