chore: make blockchain tree error results more specific (#7237)

This commit is contained in:
Dan Cline
2024-03-20 13:13:57 -04:00
committed by GitHub
parent b2ab33e3ce
commit 672bdcc57f
19 changed files with 89 additions and 79 deletions

View File

@ -1,29 +0,0 @@
use thiserror::Error;
/// State root error.
#[derive(Error, Debug, PartialEq, Eq, Clone)]
pub enum StateRootError {
/// Internal database error.
#[error(transparent)]
DB(#[from] reth_db::DatabaseError),
/// Storage root error.
#[error(transparent)]
StorageRootError(#[from] StorageRootError),
}
impl From<StateRootError> for reth_db::DatabaseError {
fn from(err: StateRootError) -> Self {
match err {
StateRootError::DB(err) => err,
StateRootError::StorageRootError(StorageRootError::DB(err)) => err,
}
}
}
/// Storage root error.
#[derive(Error, PartialEq, Eq, Clone, Debug)]
pub enum StorageRootError {
/// Internal database error.
#[error(transparent)]
DB(#[from] reth_db::DatabaseError),
}

View File

@ -26,9 +26,6 @@ pub mod hashed_cursor;
/// The trie walker for iterating over the trie nodes.
pub mod walker;
mod errors;
pub use errors::*;
/// The iterators for traversing existing intermediate hashes and updated trie leaves.
pub mod node_iter;

View File

@ -4,10 +4,10 @@ use crate::{
prefix_set::PrefixSetMut,
trie_cursor::{DatabaseAccountTrieCursor, DatabaseStorageTrieCursor},
walker::TrieWalker,
StateRootError, StorageRootError,
};
use alloy_rlp::{BufMut, Encodable};
use reth_db::{tables, transaction::DbTx};
use reth_interfaces::trie::{StateRootError, StorageRootError};
use reth_primitives::{
constants::EMPTY_ROOT_HASH,
keccak256,

View File

@ -2,7 +2,7 @@ use crate::{
hashed_cursor::HashedPostStateCursorFactory,
prefix_set::{PrefixSetMut, TriePrefixSets},
updates::TrieUpdates,
StateRoot, StateRootError,
StateRoot,
};
use reth_db::{
cursor::DbCursorRO,
@ -11,6 +11,7 @@ use reth_db::{
transaction::DbTx,
DatabaseError,
};
use reth_interfaces::trie::StateRootError;
use reth_primitives::{
keccak256, revm::compat::into_reth_acc, trie::Nibbles, Account, Address, BlockNumber, B256,
U256,

View File

@ -7,10 +7,10 @@ use crate::{
trie_cursor::TrieCursorFactory,
updates::{TrieKey, TrieOp, TrieUpdates},
walker::TrieWalker,
StateRootError, StorageRootError,
};
use alloy_rlp::{BufMut, Encodable};
use reth_db::transaction::DbTx;
use reth_interfaces::trie::{StateRootError, StorageRootError};
use reth_primitives::{
constants::EMPTY_ROOT_HASH,
keccak256,