Skip to content

Commit

Permalink
better check on some errors (#476)
Browse files Browse the repository at this point in the history
## πŸ“ Summary

We had some obfuscating ERROR traces.

## πŸ’‘ Motivation and Context

I don't like to be woken up in the middle of the night for a false
alarm.

## βœ… I have completed the following steps:

* [X] Run `make lint`
* [X] Run `make test`
* [ ] Added tests (if applicable)
  • Loading branch information
ZanCorDX authored Mar 7, 2025
1 parent 1da205f commit 43d7a9d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
11 changes: 11 additions & 0 deletions crates/eth-sparse-mpt/src/reth_sparse_trie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ pub enum SparseTrieError {
FailedToFetchData,
}

impl SparseTrieError {
/// When reth's block tip changes we generate an error which is not really critical.
/// We have this func so we can avoid logging it.
/// This could be unstable due to reth changes, DON'T use as a real error check.
pub fn is_db_consistency_error(&self) -> bool {
matches!(
self,
SparseTrieError::FailedToUpdateSharedCache(AddNodeError::InconsistentProofs)
)
}
}
#[derive(Debug)]
pub struct ChangedAccountData {
pub address: Address,
Expand Down
12 changes: 9 additions & 3 deletions crates/rbuilder/src/roothash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ impl RootHashError {
pub fn is_consistent_db_view_err(&self) -> bool {
let provider_error = match self {
RootHashError::AsyncStateRoot(ParallelStateRootError::Provider(p)) => p,
RootHashError::SparseStateRoot(SparseTrieError::FetchNode(
FetchNodeError::Provider(p),
)) => p,
RootHashError::SparseStateRoot(sparse_state_root_err) => {
if let SparseTrieError::FetchNode(FetchNodeError::Provider(p)) =
sparse_state_root_err
{
p
} else {
return sparse_state_root_err.is_db_consistency_error();
}
}
_ => return false,
};

Expand Down
4 changes: 3 additions & 1 deletion crates/rbuilder/src/roothash/prefetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ pub fn run_trie_prefetcher<P>(
return;
}
Err(err) => {
error!(?err, "Error while prefetching trie nodes");
if !err.is_db_consistency_error() {
error!(?err, "Error while prefetching trie nodes");
}
}
}
trace!(
Expand Down

0 comments on commit 43d7a9d

Please sign in to comment.