miden_crypto/merkle/mmr/
error.rs

1use 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 peak does not match the computed merkle root of the provided authentication path")]
14    PeakPathMismatch,
15    #[error("requested peak index is {peak_idx} but the number of peaks is {peaks_len}")]
16    PeakOutOfBounds { peak_idx: usize, peaks_len: usize },
17    #[error("invalid mmr update")]
18    InvalidUpdate,
19    #[error("mmr does not contain a peak with depth {0}")]
20    UnknownPeak(u8),
21    #[error("invalid merkle path")]
22    InvalidMerklePath(#[source] MerkleError),
23    #[error("merkle root computation failed")]
24    MerkleRootComputationFailed(#[source] MerkleError),
25}