miden_crypto/merkle/
error.rs1use thiserror::Error;
2
3use super::{NodeIndex, Word};
4
5#[derive(Debug, Error)]
6pub enum MerkleError {
7 #[error("expected merkle root {expected_root} found {actual_root}")]
8 ConflictingRoots { expected_root: Word, actual_root: Word },
9 #[error("provided merkle tree depth {0} is too small")]
10 DepthTooSmall(u8),
11 #[error("provided merkle tree depth {0} is too big")]
12 DepthTooBig(u64),
13 #[error("multiple values provided for merkle tree index {0}")]
14 DuplicateValuesForIndex(u64),
15 #[error("node index value {value} is not valid for depth {depth}")]
16 InvalidNodeIndex { depth: u8, value: u64 },
17 #[error("provided node index depth {provided} does not match expected depth {expected}")]
18 InvalidNodeIndexDepth { expected: u8, provided: u8 },
19 #[error("merkle subtree depth {subtree_depth} exceeds merkle tree depth {tree_depth}")]
20 SubtreeDepthExceedsDepth { subtree_depth: u8, tree_depth: u8 },
21 #[error("number of entries in the merkle tree exceeds the maximum of {0}")]
22 TooManyEntries(usize),
23 #[error("node index `{0}` not found in the tree")]
24 NodeIndexNotFoundInTree(NodeIndex),
25 #[error("node {0:?} with index `{1}` not found in the store")]
26 NodeIndexNotFoundInStore(Word, NodeIndex),
27 #[error("number of provided merkle tree leaves {0} is not a power of two")]
28 NumLeavesNotPowerOfTwo(usize),
29 #[error("root {0:?} is not in the store")]
30 RootNotInStore(Word),
31 #[error(
32 "partial smt does not track the merkle path for key {0} so updating it would produce a different root compared to the same update in the full tree"
33 )]
34 UntrackedKey(Word),
35}