-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
126 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//! Errors for sparse trie. | ||
|
||
use alloy_primitives::{Bytes, B256}; | ||
use reth_trie::Nibbles; | ||
use thiserror::Error; | ||
|
||
/// Result type with [`SparseStateTrieError`] as error. | ||
pub type SparseStateTrieResult<Ok> = Result<Ok, SparseStateTrieError>; | ||
|
||
/// Error encountered in [`crate::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 [`crate::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, | ||
}, | ||
/// RLP error. | ||
#[error(transparent)] | ||
Rlp(#[from] alloy_rlp::Error), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ pub use state::*; | |
|
||
mod trie; | ||
pub use trie::*; | ||
|
||
mod errors; | ||
pub use errors::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters