diff --git a/miden-crypto/src/merkle/sparse_path.rs b/miden-crypto/src/merkle/sparse_path.rs index dc52b33..eb9fd31 100644 --- a/miden-crypto/src/merkle/sparse_path.rs +++ b/miden-crypto/src/merkle/sparse_path.rs @@ -137,6 +137,30 @@ impl SparseMerklePath { } } +// CONVERSIONS +// ================================================================================================ + +impl From for MerklePath { + fn from(sparse_path: SparseMerklePath) -> Self { + sparse_path.into_path() + } +} + +/// # Panics +/// +/// This conversion fails and panics if the path length is greater than [`SMT_MAX_DEPTH`]. +impl From for SparseMerklePath { + fn from(path: MerklePath) -> Self { + SparseMerklePath::from_path(path).unwrap() + } +} + +impl From for Vec { + fn from(path: SparseMerklePath) -> Self { + path.into_path().into() + } +} + // ITERATORS // ================================================================================================