diff --git a/miden-crypto/src/merkle/sparse_path.rs b/miden-crypto/src/merkle/sparse_path.rs index 0e277b7..3eca5f0 100644 --- a/miden-crypto/src/merkle/sparse_path.rs +++ b/miden-crypto/src/merkle/sparse_path.rs @@ -125,6 +125,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 // ================================================================================================