miden_crypto/merkle/mmr/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use alloc::string::String;

use thiserror::Error;

use crate::merkle::MerkleError;

#[derive(Debug, Error)]
pub enum MmrError {
    #[error("mmr does not contain position {0}")]
    PositionNotFound(usize),
    #[error("mmr peaks are invalid: {0}")]
    InvalidPeaks(String),
    #[error(
        "mmr peak does not match the computed merkle root of the provided authentication path"
    )]
    PeakPathMismatch,
    #[error("requested peak index is {peak_idx} but the number of peaks is {peaks_len}")]
    PeakOutOfBounds { peak_idx: usize, peaks_len: usize },
    #[error("invalid mmr update")]
    InvalidUpdate,
    #[error("mmr does not contain a peak with depth {0}")]
    UnknownPeak(u8),
    #[error("invalid merkle path")]
    InvalidMerklePath(#[source] MerkleError),
    #[error("merkle root computation failed")]
    MerkleRootComputationFailed(#[source] MerkleError),
}