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