Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 810790c

Browse files
authored
feat: allow external block recovery in reth-stateless (paradigmxyz#17755)
1 parent 6e691c0 commit 810790c

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

crates/stateless/src/validation.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::{
44
ExecutionWitness,
55
};
66
use alloc::{
7-
boxed::Box,
87
collections::BTreeMap,
98
fmt::Debug,
109
string::{String, ToString},
@@ -19,9 +18,7 @@ use reth_errors::ConsensusError;
1918
use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus};
2019
use reth_ethereum_primitives::{Block, EthPrimitives};
2120
use reth_evm::{execute::Executor, ConfigureEvm};
22-
use reth_primitives_traits::{
23-
block::error::BlockRecoveryError, Block as _, RecoveredBlock, SealedHeader,
24-
};
21+
use reth_primitives_traits::{RecoveredBlock, SealedHeader};
2522
use reth_trie_common::{HashedPostState, KeccakKeyHasher};
2623

2724
/// Errors that can occur during stateless validation.
@@ -89,9 +86,9 @@ pub enum StatelessValidationError {
8986
expected: B256,
9087
},
9188

92-
/// Error when recovering signers
93-
#[error("error recovering the signers in the block")]
94-
SignerRecovery(#[from] Box<BlockRecoveryError<Block>>),
89+
/// Custom error.
90+
#[error("{0}")]
91+
Custom(&'static str),
9592
}
9693

9794
/// Performs stateless validation of a block using the provided witness data.
@@ -130,7 +127,7 @@ pub enum StatelessValidationError {
130127
/// If all steps succeed the function returns `Some` containing the hash of the validated
131128
/// `current_block`.
132129
pub fn stateless_validation<ChainSpec, E>(
133-
current_block: Block,
130+
current_block: RecoveredBlock<Block>,
134131
witness: ExecutionWitness,
135132
chain_spec: Arc<ChainSpec>,
136133
evm_config: E,
@@ -154,7 +151,7 @@ where
154151
///
155152
/// See `stateless_validation` for detailed documentation of the validation process.
156153
pub fn stateless_validation_with_trie<T, ChainSpec, E>(
157-
current_block: Block,
154+
current_block: RecoveredBlock<Block>,
158155
witness: ExecutionWitness,
159156
chain_spec: Arc<ChainSpec>,
160157
evm_config: E,
@@ -164,10 +161,6 @@ where
164161
ChainSpec: Send + Sync + EthChainSpec<Header = Header> + EthereumHardforks + Debug,
165162
E: ConfigureEvm<Primitives = EthPrimitives> + Clone + 'static,
166163
{
167-
let current_block = current_block
168-
.try_into_recovered()
169-
.map_err(|err| StatelessValidationError::SignerRecovery(Box::new(err)))?;
170-
171164
let mut ancestor_headers: Vec<_> = witness
172165
.headers
173166
.iter()

testing/ef-tests/src/cases/blockchain_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn run_case(case: &BlockchainTest) -> Result<(), Error> {
323323
// Now validate using the stateless client if everything else passes
324324
for (block, execution_witness) in program_inputs {
325325
stateless_validation(
326-
block.into_block(),
326+
block,
327327
execution_witness,
328328
chain_spec.clone(),
329329
EthEvmConfig::new(chain_spec.clone()),

0 commit comments

Comments
 (0)