Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-msrv
run: cargo install cargo-msrv
run: cargo install --locked cargo-msrv
- name: Cache rustup toolchains
run: rustup update
- name: Check MSRV for each workspace member
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.19.4 (unreleased)

- Backport `LargeSmtForest` with its `InMemory` backend ([#834](https://github.com/0xMiden/crypto/pull/834)).

## 0.19.3 (2026-01-21)

- Fix: don't disable WAL during subtree construction in `LargeSmt`'s RocksDB backend ([#792](https://github.com/0xMiden/crypto/pull/792)).
Expand Down
19 changes: 18 additions & 1 deletion miden-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#[macro_use]
extern crate alloc;

#[cfg(feature = "std")]
extern crate std;

Expand Down Expand Up @@ -38,6 +37,8 @@ pub type Map<K, V> = hashbrown::HashMap<K, V>;

#[cfg(feature = "hashmaps")]
pub use hashbrown::hash_map::Entry as MapEntry;
#[cfg(feature = "hashmaps")]
pub use hashbrown::hash_map::IntoIter as MapIntoIter;

/// An alias for a key-value map.
///
Expand All @@ -48,6 +49,22 @@ pub type Map<K, V> = alloc::collections::BTreeMap<K, V>;

#[cfg(not(feature = "hashmaps"))]
pub use alloc::collections::btree_map::Entry as MapEntry;
#[cfg(not(feature = "hashmaps"))]
pub use alloc::collections::btree_map::IntoIter as MapIntoIter;

/// An alias for a simple set.
///
/// By default, this is an alias for the [`alloc::collections::BTreeSet`]. However, when the
/// `hashmaps` feature is enabled, this becomes an alias for hashbrown's HashSet.
#[cfg(feature = "hashmaps")]
pub type Set<V> = hashbrown::HashSet<V>;

/// An alias for a simple set.
///
/// By default, this is an alias for the [`alloc::collections::BTreeSet`]. However, when the
/// `hashmaps` feature is enabled, this becomes an alias for hashbrown's HashSet.
#[cfg(not(feature = "hashmaps"))]
pub type Set<V> = alloc::collections::BTreeSet<V>;

// CONSTANTS
// ================================================================================================
Expand Down
4 changes: 4 additions & 0 deletions miden-crypto/src/merkle/smt/full/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ impl SmtLeaf {
self.clone().into_elements()
}

pub fn to_entries(&self) -> impl Iterator<Item = (&Word, &Word)> {
self.entries().iter().map(|(k, v)| (k, v))
}

/// Converts a leaf to a list of field elements
pub fn into_elements(self) -> Vec<Felt> {
self.into_entries().into_iter().flat_map(kv_to_elements).collect()
Expand Down
5 changes: 5 additions & 0 deletions miden-crypto/src/merkle/smt/full/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ impl Smt {
<Self as SparseMerkleTree<SMT_DEPTH>>::get_leaf(self, key)
}

/// Returns the leaf corresponding to the provided `index`.
pub fn get_leaf_by_index(&self, index: LeafIndex<SMT_DEPTH>) -> Option<SmtLeaf> {
self.leaves.get(&index.position()).cloned()
}

/// Returns the value associated with `key`
pub fn get_value(&self, key: &Word) -> Word {
<Self as SparseMerkleTree<SMT_DEPTH>>::get_value(self, key)
Expand Down
Loading