Skip to main content

reth_trie_parallel/
error.rs

1use reth_execution_errors::{SparseTrieError, StateProofError};
2use reth_provider::ProviderError;
3use thiserror::Error;
4
5/// Error returned by the state-root task and the parallel proof workers.
6#[derive(Error, Debug)]
7pub enum StateRootTaskError {
8    /// Provider error.
9    #[error(transparent)]
10    Provider(#[from] ProviderError),
11    /// Sparse trie error.
12    #[error(transparent)]
13    SparseTrie(#[from] SparseTrieError),
14    /// Sparse trie task stalled.
15    #[error("sparse trie task stalled")]
16    Stalled,
17    /// The consumer dropped its cancel guard without waiting for the result.
18    #[error("state root task canceled: consumer dropped the handle")]
19    Canceled,
20    /// Other unspecified error.
21    #[error("{_0}")]
22    Other(#[source] Box<dyn std::error::Error + Send + Sync>),
23}
24
25impl From<StateProofError> for StateRootTaskError {
26    fn from(error: StateProofError) -> Self {
27        Self::Provider(error.into())
28    }
29}