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