Skip to content

Commit

Permalink
move depth() function up
Browse files Browse the repository at this point in the history
  • Loading branch information
plafer committed Jan 17, 2024
1 parent deda8f1 commit 2685aa9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/merkle/smt/full/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ impl Smt {
// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

/// Returns the depth of the tree
pub const fn depth(&self) -> u8 {
SMT_DEPTH
}

/// Returns the root of the tree
pub fn root(&self) -> RpoDigest {
<Self as SparseMerkleTree<SMT_DEPTH>>::root(self)
Expand All @@ -97,11 +102,6 @@ impl Smt {
<Self as SparseMerkleTree<SMT_DEPTH>>::get_leaf(self, key)
}

/// Returns the depth of the tree
pub const fn depth(&self) -> u8 {
SMT_DEPTH
}

/// Returns an opening of the leaf associated with `key`. Conceptually, an opening is a Merkle
/// path to the leaf, as well as the leaf itself.
pub fn open(&self, key: &RpoDigest) -> (MerklePath, SmtLeaf) {
Expand Down
10 changes: 5 additions & 5 deletions src/merkle/smt/simple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ impl<const DEPTH: u8> SimpleSmt<DEPTH> {
// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

/// Returns the depth of the tree
pub const fn depth(&self) -> u8 {
DEPTH
}

/// Returns the root of the tree
pub fn root(&self) -> RpoDigest {
<Self as SparseMerkleTree<DEPTH>>::root(self)
Expand All @@ -121,11 +126,6 @@ impl<const DEPTH: u8> SimpleSmt<DEPTH> {
<Self as SparseMerkleTree<DEPTH>>::get_leaf(self, key)
}

/// Returns the depth of the tree
pub const fn depth(&self) -> u8 {
DEPTH
}

/// Returns an opening of the leaf associated with `key`. Conceptually, an opening is a Merkle
/// path to the leaf, as well as the leaf itself.
pub fn open(&self, key: &LeafIndex<DEPTH>) -> (MerklePath, Word) {
Expand Down

0 comments on commit 2685aa9

Please sign in to comment.