mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(engine): return error on StateRootTask multiproof and root calculation failures (#13356)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -7406,6 +7406,7 @@ dependencies = [
|
|||||||
"reth-errors",
|
"reth-errors",
|
||||||
"reth-ethereum-engine-primitives",
|
"reth-ethereum-engine-primitives",
|
||||||
"reth-evm",
|
"reth-evm",
|
||||||
|
"reth-execution-errors",
|
||||||
"reth-exex-types",
|
"reth-exex-types",
|
||||||
"reth-metrics",
|
"reth-metrics",
|
||||||
"reth-network-p2p",
|
"reth-network-p2p",
|
||||||
|
|||||||
@ -21,6 +21,7 @@ reth-consensus.workspace = true
|
|||||||
reth-engine-primitives.workspace = true
|
reth-engine-primitives.workspace = true
|
||||||
reth-errors.workspace = true
|
reth-errors.workspace = true
|
||||||
reth-evm.workspace = true
|
reth-evm.workspace = true
|
||||||
|
reth-execution-errors.workspace = true
|
||||||
reth-network-p2p.workspace = true
|
reth-network-p2p.workspace = true
|
||||||
reth-payload-builder-primitives.workspace = true
|
reth-payload-builder-primitives.workspace = true
|
||||||
reth-payload-builder.workspace = true
|
reth-payload-builder.workspace = true
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
use alloy_primitives::map::{HashMap, HashSet};
|
use alloy_primitives::map::{HashMap, HashSet};
|
||||||
use rayon::iter::{ParallelBridge, ParallelIterator};
|
use rayon::iter::{ParallelBridge, ParallelIterator};
|
||||||
use reth_evm::system_calls::OnStateHook;
|
use reth_evm::system_calls::OnStateHook;
|
||||||
|
use reth_execution_errors::StateProofError;
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory,
|
providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory,
|
||||||
StateCommitmentProvider,
|
StateCommitmentProvider,
|
||||||
@ -15,7 +16,7 @@ use reth_trie_db::DatabaseProof;
|
|||||||
use reth_trie_parallel::root::ParallelStateRootError;
|
use reth_trie_parallel::root::ParallelStateRootError;
|
||||||
use reth_trie_sparse::{
|
use reth_trie_sparse::{
|
||||||
blinded::{BlindedProvider, BlindedProviderFactory},
|
blinded::{BlindedProvider, BlindedProviderFactory},
|
||||||
errors::{SparseStateTrieResult, SparseTrieError, SparseTrieErrorKind},
|
errors::{SparseStateTrieError, SparseStateTrieResult, SparseTrieError, SparseTrieErrorKind},
|
||||||
SparseStateTrie,
|
SparseStateTrie,
|
||||||
};
|
};
|
||||||
use revm_primitives::{keccak256, EvmState, B256};
|
use revm_primitives::{keccak256, EvmState, B256};
|
||||||
@ -82,6 +83,8 @@ pub enum StateRootMessage<BPF: BlindedProviderFactory> {
|
|||||||
/// The index of this proof in the sequence of state updates
|
/// The index of this proof in the sequence of state updates
|
||||||
sequence_number: u64,
|
sequence_number: u64,
|
||||||
},
|
},
|
||||||
|
/// Error during proof calculation
|
||||||
|
ProofCalculationError(StateProofError),
|
||||||
/// State root calculation completed
|
/// State root calculation completed
|
||||||
RootCalculated {
|
RootCalculated {
|
||||||
/// The updated sparse trie
|
/// The updated sparse trie
|
||||||
@ -89,6 +92,8 @@ pub enum StateRootMessage<BPF: BlindedProviderFactory> {
|
|||||||
/// Time taken to calculate the root
|
/// Time taken to calculate the root
|
||||||
elapsed: Duration,
|
elapsed: Duration,
|
||||||
},
|
},
|
||||||
|
/// Error during state root calculation
|
||||||
|
RootCalculationError(SparseStateTrieError),
|
||||||
/// Signals state update stream end.
|
/// Signals state update stream end.
|
||||||
FinishedStateUpdates,
|
FinishedStateUpdates,
|
||||||
}
|
}
|
||||||
@ -344,7 +349,8 @@ where
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Err(e) => {
|
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 });
|
let _ = tx.send(StateRootMessage::RootCalculated { trie, elapsed });
|
||||||
}
|
}
|
||||||
Err(e) => {
|
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));
|
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(_) => {
|
Err(_) => {
|
||||||
// this means our internal message channel is closed, which shouldn't happen
|
// this means our internal message channel is closed, which shouldn't happen
|
||||||
|
|||||||
Reference in New Issue
Block a user