mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move sparse errors to reth-execution-errors (#13101)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
//! Errors when computing the state root.
|
||||
|
||||
use alloc::string::ToString;
|
||||
use alloy_primitives::B256;
|
||||
use alloc::{boxed::Box, string::ToString};
|
||||
use alloy_primitives::{Bytes, B256};
|
||||
use nybbles::Nibbles;
|
||||
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
|
||||
use thiserror::Error;
|
||||
@ -62,6 +62,61 @@ impl From<StateProofError> for ProviderError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Result type with [`SparseStateTrieError`] as error.
|
||||
pub type SparseStateTrieResult<Ok> = Result<Ok, SparseStateTrieError>;
|
||||
|
||||
/// Error encountered in `SparseStateTrie`.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum SparseStateTrieError {
|
||||
/// Encountered invalid root node.
|
||||
#[error("invalid root node at {path:?}: {node:?}")]
|
||||
InvalidRootNode {
|
||||
/// Path to first proof node.
|
||||
path: Nibbles,
|
||||
/// Encoded first proof node.
|
||||
node: Bytes,
|
||||
},
|
||||
/// Sparse trie error.
|
||||
#[error(transparent)]
|
||||
Sparse(#[from] SparseTrieError),
|
||||
/// RLP error.
|
||||
#[error(transparent)]
|
||||
Rlp(#[from] alloy_rlp::Error),
|
||||
}
|
||||
|
||||
/// Result type with [`SparseTrieError`] as error.
|
||||
pub type SparseTrieResult<Ok> = Result<Ok, SparseTrieError>;
|
||||
|
||||
/// Error encountered in `SparseTrie`.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum SparseTrieError {
|
||||
/// Sparse trie is still blind. Thrown on attempt to update it.
|
||||
#[error("sparse trie is blind")]
|
||||
Blind,
|
||||
/// Encountered blinded node on update.
|
||||
#[error("attempted to update blind node at {path:?}: {hash}")]
|
||||
BlindedNode {
|
||||
/// Blind node path.
|
||||
path: Nibbles,
|
||||
/// Node hash
|
||||
hash: B256,
|
||||
},
|
||||
/// Encountered unexpected node at path when revealing.
|
||||
#[error("encountered an invalid node at path {path:?} when revealing: {node:?}")]
|
||||
Reveal {
|
||||
/// Path to the node.
|
||||
path: Nibbles,
|
||||
/// Node that was at the path when revealing.
|
||||
node: Box<dyn core::fmt::Debug>,
|
||||
},
|
||||
/// RLP error.
|
||||
#[error(transparent)]
|
||||
Rlp(#[from] alloy_rlp::Error),
|
||||
/// Other.
|
||||
#[error(transparent)]
|
||||
Other(#[from] Box<dyn core::error::Error>),
|
||||
}
|
||||
|
||||
/// Trie witness errors.
|
||||
#[derive(Error, PartialEq, Eq, Clone, Debug)]
|
||||
pub enum TrieWitnessError {
|
||||
|
||||
Reference in New Issue
Block a user