spl_concurrent_merkle_tree/
error.rs

1use thiserror::Error;
2
3/// Concurrent merkle tree operation errors
4#[derive(Error, Debug, PartialEq, Eq)]
5pub enum ConcurrentMerkleTreeError {
6    /// Received an index larger than the rightmost index
7    #[error("Received an index larger than the rightmost index, or greater than (1 << max_depth)")]
8    LeafIndexOutOfBounds,
9
10    /// Invalid root recomputed from proof
11    #[error("Invalid root recomputed from proof")]
12    InvalidProof,
13
14    /// Node to append cannot be empty
15    #[error("Cannot append an empty node")]
16    CannotAppendEmptyNode,
17
18    /// The tree is at capacity
19    #[error("Tree is full, cannot append")]
20    TreeFull,
21
22    /// This tree has already been initialized
23    #[error("Tree already initialized")]
24    TreeAlreadyInitialized,
25
26    /// This tree has not yet been initialized
27    #[error("Tree needs to be initialized before using")]
28    TreeNotInitialized,
29
30    /// Root passed as argument cannot be found in stored changelog buffer
31    #[error("Root not found in changelog buffer")]
32    RootNotFound,
33
34    /// The tree's current leaf value does not match the supplied proof's leaf
35    /// value
36    #[error("This tree's current leaf value does not match the supplied proof's leaf value")]
37    LeafContentsModified,
38
39    /// Tree has at least 1 non-EMPTY leaf
40    #[error("Tree is not empty")]
41    TreeNonEmpty,
42}