miden_crypto/merkle/mmr/
error.rs1use alloc::string::String;
2
3use thiserror::Error;
4
5use crate::merkle::MerkleError;
6
7#[derive(Debug, Error)]
8pub enum MmrError {
9 #[error("mmr does not contain position {0}")]
10 PositionNotFound(usize),
11 #[error("mmr peaks are invalid: {0}")]
12 InvalidPeaks(String),
13 #[error("mmr forest is out of bounds: requested {0} > current {1}")]
14 ForestOutOfBounds(usize, usize),
15 #[error("mmr peak does not match the computed merkle root of the provided authentication path")]
16 PeakPathMismatch,
17 #[error("requested peak index is {peak_idx} but the number of peaks is {peaks_len}")]
18 PeakOutOfBounds { peak_idx: usize, peaks_len: usize },
19 #[error("invalid mmr update")]
20 InvalidUpdate,
21 #[error("mmr does not contain a peak with depth {0}")]
22 UnknownPeak(u8),
23 #[error("invalid merkle path")]
24 InvalidMerklePath(#[source] MerkleError),
25 #[error("merkle root computation failed")]
26 MerkleRootComputationFailed(#[source] MerkleError),
27}