miden_processor/host/advice/
errors.rs1use alloc::vec::Vec;
2
3use miden_utils_diagnostics::{Diagnostic, miette};
4
5use crate::{Felt, Word, crypto::MerkleError};
6
7#[derive(Debug, thiserror::Error, Diagnostic)]
8pub enum AdviceError {
9 #[error("value for key {} already present in the advice map", key.to_hex())]
10 #[diagnostic(help(
11 "previous values at key were '{prev_values:?}'. Operation would have replaced them with '{new_values:?}'",
12 ))]
13 MapKeyAlreadyPresent {
14 key: Word,
15 prev_values: Vec<Felt>,
16 new_values: Vec<Felt>,
17 },
18 #[error("value for key {} not present in the advice map", .key.to_hex())]
19 MapKeyNotFound { key: Word },
20 #[error("advice stack read failed")]
21 StackReadFailed,
22 #[error(
23 "provided merkle tree {depth} is out of bounds and cannot be represented as an unsigned 8-bit integer"
24 )]
25 InvalidMerkleTreeDepth { depth: Felt },
26 #[error("provided node index {index} is out of bounds for a merkle tree node at depth {depth}")]
27 InvalidMerkleTreeNodeIndex { depth: Felt, index: Felt },
28 #[error("failed to lookup value in Merkle store")]
29 MerkleStoreLookupFailed(#[source] MerkleError),
30 #[error("Merkle store backend merge failed")]
32 MerkleStoreMergeFailed(#[source] MerkleError),
33 #[error("Merkle store backend update failed")]
34 MerkleStoreUpdateFailed(#[source] MerkleError),
35}