diff --git a/Cargo.lock b/Cargo.lock index 5550c83d24fa..a7b713259c02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7406,6 +7406,7 @@ dependencies = [ "reth-errors", "reth-ethereum-engine-primitives", "reth-evm", + "reth-execution-errors", "reth-exex-types", "reth-metrics", "reth-network-p2p", diff --git a/crates/engine/tree/Cargo.toml b/crates/engine/tree/Cargo.toml index f428c8771cba..73f0a5268a28 100644 --- a/crates/engine/tree/Cargo.toml +++ b/crates/engine/tree/Cargo.toml @@ -21,6 +21,7 @@ reth-consensus.workspace = true reth-engine-primitives.workspace = true reth-errors.workspace = true reth-evm.workspace = true +reth-execution-errors.workspace = true reth-network-p2p.workspace = true reth-payload-builder-primitives.workspace = true reth-payload-builder.workspace = true diff --git a/crates/engine/tree/src/tree/root.rs b/crates/engine/tree/src/tree/root.rs index 7254cc882a7e..723d70ac588c 100644 --- a/crates/engine/tree/src/tree/root.rs +++ b/crates/engine/tree/src/tree/root.rs @@ -3,6 +3,7 @@ use alloy_primitives::map::{HashMap, HashSet}; use rayon::iter::{ParallelBridge, ParallelIterator}; use reth_evm::system_calls::OnStateHook; +use reth_execution_errors::StateProofError; use reth_provider::{ providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory, StateCommitmentProvider, @@ -15,7 +16,7 @@ use reth_trie_db::DatabaseProof; use reth_trie_parallel::root::ParallelStateRootError; use reth_trie_sparse::{ blinded::{BlindedProvider, BlindedProviderFactory}, - errors::{SparseStateTrieResult, SparseTrieError, SparseTrieErrorKind}, + errors::{SparseStateTrieError, SparseStateTrieResult, SparseTrieError, SparseTrieErrorKind}, SparseStateTrie, }; use revm_primitives::{keccak256, EvmState, B256}; @@ -82,6 +83,8 @@ pub enum StateRootMessage { /// The index of this proof in the sequence of state updates sequence_number: u64, }, + /// Error during proof calculation + ProofCalculationError(StateProofError), /// State root calculation completed RootCalculated { /// The updated sparse trie @@ -89,6 +92,8 @@ pub enum StateRootMessage { /// Time taken to calculate the root elapsed: Duration, }, + /// Error during state root calculation + RootCalculationError(SparseStateTrieError), /// Signals state update stream end. FinishedStateUpdates, } @@ -344,7 +349,8 @@ where }); } Err(e) => { - error!(target: "engine::root", error = ?e, "Could not calculate multiproof"); + let _ = + state_root_message_sender.send(StateRootMessage::ProofCalculationError(e)); } } }); @@ -403,7 +409,7 @@ where let _ = tx.send(StateRootMessage::RootCalculated { trie, elapsed }); } Err(e) => { - error!(target: "engine::root", error = ?e, "Could not calculate state root"); + let _ = tx.send(StateRootMessage::RootCalculationError(e)); } } }); @@ -524,6 +530,16 @@ where return Ok((root, trie_updates)); } } + StateRootMessage::ProofCalculationError(e) => { + return Err(ParallelStateRootError::Other(format!( + "could not calculate multiproof: {e:?}" + ))) + } + StateRootMessage::RootCalculationError(e) => { + return Err(ParallelStateRootError::Other(format!( + "could not calculate state root: {e:?}" + ))) + } }, Err(_) => { // this means our internal message channel is closed, which shouldn't happen