From 2685aa94e2706486761337fd4d95395d85c506b3 Mon Sep 17 00:00:00 2001 From: Philippe Laferriere Date: Wed, 17 Jan 2024 09:23:55 -0500 Subject: [PATCH] move `depth()` function up --- src/merkle/smt/full/mod.rs | 10 +++++----- src/merkle/smt/simple/mod.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/merkle/smt/full/mod.rs b/src/merkle/smt/full/mod.rs index c63800bf..c0cdaa69 100644 --- a/src/merkle/smt/full/mod.rs +++ b/src/merkle/smt/full/mod.rs @@ -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 { >::root(self) @@ -97,11 +102,6 @@ impl Smt { >::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) { diff --git a/src/merkle/smt/simple/mod.rs b/src/merkle/smt/simple/mod.rs index fc9b1096..1c5f821e 100644 --- a/src/merkle/smt/simple/mod.rs +++ b/src/merkle/smt/simple/mod.rs @@ -111,6 +111,11 @@ impl SimpleSmt { // 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 { >::root(self) @@ -121,11 +126,6 @@ impl SimpleSmt { >::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) -> (MerklePath, Word) {