diff --git a/CHANGELOG.md b/CHANGELOG.md index b0d7ffe17..eb2fbbc38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.16.1 (TBD) + +- Added `{Smt,PartialSmt}::inner_node_indices` to make inner nodes accessible ([#494](https://github.com/0xMiden/crypto/pull/494)). + ## 0.16.0 (2025-08-15) - [BREAKING] Incremented MSRV to 1.88. diff --git a/miden-crypto/src/merkle/smt/full/mod.rs b/miden-crypto/src/merkle/smt/full/mod.rs index c38441edb..802ef58d5 100644 --- a/miden-crypto/src/merkle/smt/full/mod.rs +++ b/miden-crypto/src/merkle/smt/full/mod.rs @@ -254,6 +254,11 @@ impl Smt { }) } + /// Returns an iterator over the [`InnerNode`] and the respective [`NodeIndex`] of the [`Smt`]. + pub fn inner_node_indices(&self) -> impl Iterator + '_ { + self.inner_nodes.iter().map(|(idx, inner)| (*idx, inner.clone())) + } + // STATE MUTATORS // -------------------------------------------------------------------------------------------- diff --git a/miden-crypto/src/merkle/smt/partial.rs b/miden-crypto/src/merkle/smt/partial.rs index 92af80daa..8ae58019f 100644 --- a/miden-crypto/src/merkle/smt/partial.rs +++ b/miden-crypto/src/merkle/smt/partial.rs @@ -246,6 +246,12 @@ impl PartialSmt { self.0.inner_nodes() } + /// Returns an iterator over the [`InnerNode`] and the respective [`NodeIndex`] of the + /// [`PartialSmt`]. + pub fn inner_node_indicies(&self) -> impl Iterator + '_ { + self.0.inner_node_indices() + } + /// Returns an iterator over the tracked, non-empty leaves of the [`PartialSmt`] in arbitrary /// order. pub fn leaves(&self) -> impl Iterator, &SmtLeaf)> {