From a19019f633a90ac365d56abbca61b79d6d18699b Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 20:48:01 +0100 Subject: [PATCH 01/55] add `ClientInput` struct --- Cargo.lock | 2 ++ crates/stateless/Cargo.toml | 7 ++++++- crates/stateless/src/lib.rs | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c14278c801c..8805d26c65f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10037,6 +10037,8 @@ dependencies = [ "reth-revm", "reth-trie-common", "reth-trie-sparse", + "serde", + "serde_with", "thiserror 2.0.12", ] diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index d452521aa15..700a1d74cd4 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -22,7 +22,10 @@ alloy-rpc-types-debug.workspace = true # reth reth-ethereum-consensus.workspace = true reth-primitives-traits.workspace = true -reth-ethereum-primitives.workspace = true +reth-ethereum-primitives = { workspace = true, features = [ + "serde", + "serde-bincode-compat", +] } reth-errors.workspace = true reth-evm.workspace = true reth-evm-ethereum.workspace = true @@ -35,3 +38,5 @@ reth-consensus.workspace = true # misc thiserror.workspace = true itertools.workspace = true +serde.workspace = true +serde_with.workspace = true \ No newline at end of file diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index cc99afe4169..59d7b1fb8a8 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -42,3 +42,17 @@ pub(crate) mod witness_db; #[doc(inline)] pub use alloy_rpc_types_debug::ExecutionWitness; + +use reth_ethereum_primitives::Block; +use reth_primitives_traits::RecoveredBlock; + +#[serde_with::serde_as] +#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +pub struct ClientInput { + #[serde_as( + as = "reth_primitives_traits::serde_bincode_compat::RecoveredBlock" + )] + pub block: RecoveredBlock, + + pub witness: ExecutionWitness, +} \ No newline at end of file From decb0234a1f0d27da12dae0145ef3fc2555126ba Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 21:09:37 +0100 Subject: [PATCH 02/55] RecoveredBlock -> Block --- crates/stateless/src/validation.rs | 19 +++++++++++++------ testing/ef-tests/src/cases/blockchain_test.rs | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index 4a07acba60a..3a66711efc5 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -5,17 +5,17 @@ use alloc::{ sync::Arc, vec::Vec, }; -use alloy_consensus::{Block, BlockHeader, Header}; +use alloy_consensus::{BlockHeader, Header}; use alloy_primitives::{keccak256, map::B256Map, B256}; use alloy_rlp::Decodable; use reth_chainspec::ChainSpec; use reth_consensus::{Consensus, HeaderValidator}; use reth_errors::ConsensusError; use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus}; -use reth_ethereum_primitives::TransactionSigned; +use reth_ethereum_primitives::Block as EthereumBlock; use reth_evm::{execute::Executor, ConfigureEvm}; use reth_evm_ethereum::execute::EthExecutorProvider; -use reth_primitives_traits::RecoveredBlock; +use reth_primitives_traits::{block::error::BlockRecoveryError, Block, RecoveredBlock}; use reth_revm::state::Bytecode; use reth_trie_common::{HashedPostState, KeccakKeyHasher}; use reth_trie_sparse::{blinded::DefaultBlindedProviderFactory, SparseStateTrie}; @@ -84,6 +84,10 @@ pub enum StatelessValidationError { /// The expected pre-state root from the previous block expected: B256, }, + + /// Error when recovering signers + #[error("error recovering the signers in the block")] + SignerRecovery(#[from] BlockRecoveryError), } /// Performs stateless validation of a block using the provided witness data. @@ -122,10 +126,13 @@ pub enum StatelessValidationError { /// If all steps succeed the function returns `Some` containing the hash of the validated /// `current_block`. pub fn stateless_validation( - current_block: RecoveredBlock>, + current_block: EthereumBlock, witness: ExecutionWitness, chain_spec: Arc, ) -> Result { + let current_block = + current_block.try_into_recovered().map_err(StatelessValidationError::from)?; + let mut ancestor_headers: Vec
= witness .headers .iter() @@ -209,7 +216,7 @@ pub fn stateless_validation( /// transition function. fn validate_block_consensus( chain_spec: Arc, - block: &RecoveredBlock>, + block: &RecoveredBlock, ) -> Result<(), StatelessValidationError> { let consensus = EthBeaconConsensus::new(chain_spec); @@ -295,7 +302,7 @@ pub fn verify_execution_witness( /// If both checks pass, it returns a [`BTreeMap`] mapping the block number of each /// ancestor header to its corresponding block hash. fn compute_ancestor_hashes( - current_block: &RecoveredBlock>, + current_block: &RecoveredBlock, ancestor_headers: &[Header], ) -> Result, StatelessValidationError> { let mut ancestor_hashes = BTreeMap::new(); diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 5e32ee873e6..10032e5db8b 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -319,7 +319,7 @@ fn run_case(case: &BlockchainTest) -> Result<(), Error> { // Now validate using the stateless client if everything else passes for (block, execution_witness) in program_inputs { - stateless_validation(block, execution_witness, chain_spec.clone()) + stateless_validation(block.into_block(), execution_witness, chain_spec.clone()) .expect("stateless validation failed"); } From 4e825279aaa9092304a9ca7829b784a330a34174 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 21:14:09 +0100 Subject: [PATCH 03/55] cargo fmt --- crates/stateless/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 59d7b1fb8a8..5b006b4d2b3 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -46,13 +46,16 @@ pub use alloy_rpc_types_debug::ExecutionWitness; use reth_ethereum_primitives::Block; use reth_primitives_traits::RecoveredBlock; +/// ClientInput is a convenience structure for serializing the input needed +/// for the stateless validation function. #[serde_with::serde_as] #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct ClientInput { + /// The block being executed in the stateless validation function #[serde_as( as = "reth_primitives_traits::serde_bincode_compat::RecoveredBlock" )] pub block: RecoveredBlock, - + /// ExecutionWitness for the stateless validation function pub witness: ExecutionWitness, -} \ No newline at end of file +} From e86c06689d68fabe26f0a40e9804da9fa2e7dca3 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 21:18:33 +0100 Subject: [PATCH 04/55] clippy --- crates/stateless/src/validation.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index 3a66711efc5..794e2be0c3c 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -1,5 +1,6 @@ use crate::{witness_db::WitnessDatabase, ExecutionWitness}; use alloc::{ + boxed::Box, collections::BTreeMap, string::{String, ToString}, sync::Arc, @@ -87,7 +88,7 @@ pub enum StatelessValidationError { /// Error when recovering signers #[error("error recovering the signers in the block")] - SignerRecovery(#[from] BlockRecoveryError), + SignerRecovery(#[from] Box>), } /// Performs stateless validation of a block using the provided witness data. @@ -130,8 +131,9 @@ pub fn stateless_validation( witness: ExecutionWitness, chain_spec: Arc, ) -> Result { - let current_block = - current_block.try_into_recovered().map_err(StatelessValidationError::from)?; + let current_block = current_block + .try_into_recovered() + .map_err(|err| StatelessValidationError::SignerRecovery(Box::new(err)))?; let mut ancestor_headers: Vec
= witness .headers From d2e0768be2cd779ef6bb45df0ebba44fc0ad72bd Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 21:22:08 +0100 Subject: [PATCH 05/55] toml format --- crates/stateless/Cargo.toml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index 700a1d74cd4..2eb2d8e2c73 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -22,10 +22,7 @@ alloy-rpc-types-debug.workspace = true # reth reth-ethereum-consensus.workspace = true reth-primitives-traits.workspace = true -reth-ethereum-primitives = { workspace = true, features = [ - "serde", - "serde-bincode-compat", -] } +reth-ethereum-primitives = { workspace = true, features = ["serde", "serde-bincode-compat"] } reth-errors.workspace = true reth-evm.workspace = true reth-evm-ethereum.workspace = true @@ -39,4 +36,4 @@ reth-consensus.workspace = true thiserror.workspace = true itertools.workspace = true serde.workspace = true -serde_with.workspace = true \ No newline at end of file +serde_with.workspace = true From 337ff5e8fb921b1b65861385faa75cf2866a4b88 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 23:42:54 +0100 Subject: [PATCH 06/55] downgrade to 1.85 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e6ebfd267ad..721909a5a66 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace.package] version = "1.4.1" edition = "2021" -rust-version = "1.86" +rust-version = "1.85" license = "MIT OR Apache-2.0" homepage = "https://paradigmxyz.github.io/reth" repository = "https://github.com/paradigmxyz/reth" From 75bfb3a5920b4c2a4e4f4b9ce9e40b5c2541f073 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 23:43:24 +0100 Subject: [PATCH 07/55] expose certain functions and properties in ef-tests --- testing/ef-tests/src/cases/blockchain_test.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 5e32ee873e6..c4503b57005 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -49,7 +49,7 @@ impl Suite for BlockchainTests { /// An Ethereum blockchain test. #[derive(Debug, PartialEq, Eq)] pub struct BlockchainTestCase { - tests: BTreeMap, + pub tests: BTreeMap, skip: bool, } @@ -96,7 +96,7 @@ impl BlockchainTestCase { let expectation = Self::expected_failure(case); match run_case(case) { // All blocks executed successfully. - Ok(()) => { + Ok(_) => { // Check if the test case specifies that it should have failed if let Some((block, msg)) = expectation { Err(Error::Assertion(format!( @@ -183,7 +183,9 @@ impl Case for BlockchainTestCase { /// Returns: /// - `Ok(())` if all blocks execute successfully and the final state is correct. /// - `Err(Error)` if any block fails to execute correctly, or if the post-state validation fails. -fn run_case(case: &BlockchainTest) -> Result<(), Error> { +pub fn run_case( + case: &BlockchainTest, +) -> Result, ExecutionWitness)>, Error> { // Create a new test database and initialize a provider for the test case. let chain_spec: Arc = Arc::new(case.network.into()); let factory = create_test_provider_factory_with_chain_spec(chain_spec.clone()); @@ -318,12 +320,12 @@ fn run_case(case: &BlockchainTest) -> Result<(), Error> { } // Now validate using the stateless client if everything else passes - for (block, execution_witness) in program_inputs { - stateless_validation(block, execution_witness, chain_spec.clone()) + for (block, execution_witness) in &program_inputs { + stateless_validation(block.clone(), execution_witness.clone(), chain_spec.clone()) .expect("stateless validation failed"); } - Ok(()) + Ok(program_inputs) } fn decode_blocks( From 568a441d2a130599b628fb4b956cc93263204320 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 17 May 2025 23:54:54 +0100 Subject: [PATCH 08/55] add track_cycles macro --- crates/stateless/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 5b006b4d2b3..dd87653b2c5 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -59,3 +59,21 @@ pub struct ClientInput { /// ExecutionWitness for the stateless validation function pub witness: ExecutionWitness, } + +/// Tracks the amount of cycles a region of code takes up +/// in a zkvm environment and is no-op otherwise. +#[macro_export] +macro_rules! track_cycles { + ($name:expr, $body:expr) => {{ + #[cfg(target_os = "zkvm")] + { + tracing::info!("cycle-tracker-report-start: {}", $name); + let result = $body; + tracing::info!("cycle-tracker-report-end: {}", $name); + result + } + + #[cfg(not(target_os = "zkvm"))] + $body + }}; +} \ No newline at end of file From d224ccd1d1170222af0d250f9d164cce0f0b2ee3 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sun, 18 May 2025 20:27:33 +0100 Subject: [PATCH 09/55] add back fork_spec --- crates/stateless/src/fork_spec.rs | 95 +++++++++++++++++++++++++++++++ crates/stateless/src/lib.rs | 10 +++- testing/ef-tests/src/models.rs | 41 +++++++++++++ 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 crates/stateless/src/fork_spec.rs diff --git a/crates/stateless/src/fork_spec.rs b/crates/stateless/src/fork_spec.rs new file mode 100644 index 00000000000..8f0786edb74 --- /dev/null +++ b/crates/stateless/src/fork_spec.rs @@ -0,0 +1,95 @@ +// This is here so we don't pull in the EF-tests. +// We need to think more about how we will parse in the chain-spec +use reth_chainspec::{ChainSpec, ChainSpecBuilder}; +use serde::{Deserialize, Serialize}; + +/// Fork specification. +#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Ord, Clone, Copy, Serialize, Deserialize)] +pub enum ForkSpec { + /// Frontier + Frontier, + /// Frontier to Homestead + FrontierToHomesteadAt5, + /// Homestead + Homestead, + /// Homestead to Tangerine + HomesteadToDaoAt5, + /// Homestead to Tangerine + HomesteadToEIP150At5, + /// Tangerine + EIP150, + /// Spurious Dragon + EIP158, // EIP-161: State trie clearing + /// Spurious Dragon to Byzantium + EIP158ToByzantiumAt5, + /// Byzantium + Byzantium, + /// Byzantium to Constantinople + ByzantiumToConstantinopleAt5, // SKIPPED + /// Byzantium to Constantinople + ByzantiumToConstantinopleFixAt5, + /// Constantinople + Constantinople, // SKIPPED + /// Constantinople fix + ConstantinopleFix, + /// Istanbul + Istanbul, + /// Berlin + Berlin, + /// Berlin to London + BerlinToLondonAt5, + /// London + London, + /// Paris aka The Merge + Merge, + /// Shanghai + Shanghai, + /// Merge EOF test + #[serde(alias = "Merge+3540+3670")] + MergeEOF, + /// After Merge Init Code test + #[serde(alias = "Merge+3860")] + MergeMeterInitCode, + /// After Merge plus new PUSH0 opcode + #[serde(alias = "Merge+3855")] + MergePush0, + /// Cancun + Cancun, + /// Prague + Prague, +} + +impl From for ChainSpec { + fn from(fork_spec: ForkSpec) -> Self { + let spec_builder = ChainSpecBuilder::mainnet(); + + match fork_spec { + ForkSpec::Frontier => spec_builder.frontier_activated(), + ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { + spec_builder.homestead_activated() + } + ForkSpec::EIP150 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => { + spec_builder.tangerine_whistle_activated() + } + ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), + ForkSpec::Byzantium | + ForkSpec::EIP158ToByzantiumAt5 | + ForkSpec::ConstantinopleFix | + ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), + ForkSpec::Istanbul => spec_builder.istanbul_activated(), + ForkSpec::Berlin => spec_builder.berlin_activated(), + ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), + ForkSpec::Merge | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | + ForkSpec::MergePush0 => spec_builder.paris_activated(), + ForkSpec::Shanghai => spec_builder.shanghai_activated(), + ForkSpec::Cancun => spec_builder.cancun_activated(), + ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { + panic!("Overridden with PETERSBURG") + } + ForkSpec::Prague => spec_builder.prague_activated(), + } + .build() + } +} diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index dd87653b2c5..83a613652dc 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -40,6 +40,14 @@ pub(crate) mod root; pub mod validation; pub(crate) mod witness_db; +/// ForkSpec module +/// This is needed because ChainSpec is not serializable (neither is genesis) +/// +/// When we parse execution spec tests, we get back a ForkSpec, that we then pass into +/// the guest program and convert it into a ChainSpec. If someone is using Hoodi/Mainnet +/// etc, then this may not be needed, as you can just do ChainSpec::mainnet() in the guest program +pub mod fork_spec; + #[doc(inline)] pub use alloy_rpc_types_debug::ExecutionWitness; @@ -76,4 +84,4 @@ macro_rules! track_cycles { #[cfg(not(target_os = "zkvm"))] $body }}; -} \ No newline at end of file +} diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 6cad5331e59..53d99da7dfb 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -347,6 +347,47 @@ impl From for ChainSpec { } } +impl From for reth_stateless::fork_spec::ForkSpec { + fn from(value: ForkSpec) -> Self { + match value { + ForkSpec::Frontier => reth_stateless::fork_spec::ForkSpec::Frontier, + ForkSpec::FrontierToHomesteadAt5 => { + reth_stateless::fork_spec::ForkSpec::FrontierToHomesteadAt5 + } + ForkSpec::Homestead => reth_stateless::fork_spec::ForkSpec::Homestead, + ForkSpec::HomesteadToDaoAt5 => reth_stateless::fork_spec::ForkSpec::HomesteadToDaoAt5, + ForkSpec::HomesteadToEIP150At5 => { + reth_stateless::fork_spec::ForkSpec::HomesteadToEIP150At5 + } + ForkSpec::EIP150 => reth_stateless::fork_spec::ForkSpec::EIP150, + ForkSpec::EIP158 => reth_stateless::fork_spec::ForkSpec::EIP158, + ForkSpec::EIP158ToByzantiumAt5 => { + reth_stateless::fork_spec::ForkSpec::EIP158ToByzantiumAt5 + } + ForkSpec::Byzantium => reth_stateless::fork_spec::ForkSpec::Byzantium, + ForkSpec::ByzantiumToConstantinopleAt5 => { + reth_stateless::fork_spec::ForkSpec::ByzantiumToConstantinopleAt5 + } + ForkSpec::ByzantiumToConstantinopleFixAt5 => { + reth_stateless::fork_spec::ForkSpec::ByzantiumToConstantinopleFixAt5 + } + ForkSpec::Constantinople => reth_stateless::fork_spec::ForkSpec::Constantinople, + ForkSpec::ConstantinopleFix => reth_stateless::fork_spec::ForkSpec::ConstantinopleFix, + ForkSpec::Istanbul => reth_stateless::fork_spec::ForkSpec::Istanbul, + ForkSpec::Berlin => reth_stateless::fork_spec::ForkSpec::Berlin, + ForkSpec::BerlinToLondonAt5 => reth_stateless::fork_spec::ForkSpec::BerlinToLondonAt5, + ForkSpec::London => reth_stateless::fork_spec::ForkSpec::London, + ForkSpec::Merge => reth_stateless::fork_spec::ForkSpec::Merge, + ForkSpec::Shanghai => reth_stateless::fork_spec::ForkSpec::Shanghai, + ForkSpec::MergeEOF => reth_stateless::fork_spec::ForkSpec::MergeEOF, + ForkSpec::MergeMeterInitCode => reth_stateless::fork_spec::ForkSpec::MergeMeterInitCode, + ForkSpec::MergePush0 => reth_stateless::fork_spec::ForkSpec::MergePush0, + ForkSpec::Cancun => reth_stateless::fork_spec::ForkSpec::Cancun, + ForkSpec::Prague => reth_stateless::fork_spec::ForkSpec::Prague, + } + } +} + /// Possible seal engines. #[derive(Debug, PartialEq, Eq, Default, Deserialize)] pub enum SealEngine { From e213cb07768cf9b970d0c212c15b36e19344bf86 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sun, 18 May 2025 20:33:43 +0100 Subject: [PATCH 10/55] more comments --- crates/stateless/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 83a613652dc..5872cfcf605 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -43,6 +43,11 @@ pub(crate) mod witness_db; /// ForkSpec module /// This is needed because ChainSpec is not serializable (neither is genesis) /// +/// Note: There is an exact copy of ForkSpec in `ef-tests` but since ef-tests is not no_std +/// we cannot pull that in since we need ForkSpec in the guest program. +/// +/// We convert the ef-tests version of ForkSpec in the host into the one located in here. +/// /// When we parse execution spec tests, we get back a ForkSpec, that we then pass into /// the guest program and convert it into a ChainSpec. If someone is using Hoodi/Mainnet /// etc, then this may not be needed, as you can just do ChainSpec::mainnet() in the guest program From 3c4bf14cacf405af53fc8316e97df22dcccc7250 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 19 May 2025 12:11:54 +0100 Subject: [PATCH 11/55] fix Co-authored-by: Roman Krasiuk --- crates/stateless/src/validation.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index 794e2be0c3c..b51cc1cc3f0 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -13,10 +13,10 @@ use reth_chainspec::ChainSpec; use reth_consensus::{Consensus, HeaderValidator}; use reth_errors::ConsensusError; use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus}; -use reth_ethereum_primitives::Block as EthereumBlock; +use reth_ethereum_primitives::Block; use reth_evm::{execute::Executor, ConfigureEvm}; use reth_evm_ethereum::execute::EthExecutorProvider; -use reth_primitives_traits::{block::error::BlockRecoveryError, Block, RecoveredBlock}; +use reth_primitives_traits::{block::error::BlockRecoveryError, Block as _, RecoveredBlock}; use reth_revm::state::Bytecode; use reth_trie_common::{HashedPostState, KeccakKeyHasher}; use reth_trie_sparse::{blinded::DefaultBlindedProviderFactory, SparseStateTrie}; @@ -88,7 +88,7 @@ pub enum StatelessValidationError { /// Error when recovering signers #[error("error recovering the signers in the block")] - SignerRecovery(#[from] Box>), + SignerRecovery(#[from] Box>), } /// Performs stateless validation of a block using the provided witness data. @@ -127,7 +127,7 @@ pub enum StatelessValidationError { /// If all steps succeed the function returns `Some` containing the hash of the validated /// `current_block`. pub fn stateless_validation( - current_block: EthereumBlock, + current_block: Block, witness: ExecutionWitness, chain_spec: Arc, ) -> Result { @@ -218,7 +218,7 @@ pub fn stateless_validation( /// transition function. fn validate_block_consensus( chain_spec: Arc, - block: &RecoveredBlock, + block: &RecoveredBlock, ) -> Result<(), StatelessValidationError> { let consensus = EthBeaconConsensus::new(chain_spec); @@ -304,7 +304,7 @@ pub fn verify_execution_witness( /// If both checks pass, it returns a [`BTreeMap`] mapping the block number of each /// ancestor header to its corresponding block hash. fn compute_ancestor_hashes( - current_block: &RecoveredBlock, + current_block: &RecoveredBlock, ancestor_headers: &[Header], ) -> Result, StatelessValidationError> { let mut ancestor_hashes = BTreeMap::new(); From 81299a6e25e8acf6612c7dfa85f6a06720fed3a4 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 19 May 2025 20:46:19 +0100 Subject: [PATCH 12/55] fix missing post-state check --- testing/ef-tests/src/cases/blockchain_test.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index e88718992cc..fbfc895c07f 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -314,10 +314,16 @@ pub fn run_case( // - Either an issue with the test setup // - Possibly an error in the test case where the post-state root in the last block does not // match the post-state values. - let expected_post_state = case.post_state.as_ref().ok_or(Error::MissingPostState)?; - for (&address, account) in expected_post_state { - account.assert_db(address, provider.tx_ref())?; - } + match case.post_state.as_ref() { + Some(expected_post_state) => { + for (&address, account) in expected_post_state { + account.assert_db(address, provider.tx_ref())?; + } + } + None => { + // Do nothing + } + }; // Now validate using the stateless client if everything else passes for (block, execution_witness) in &program_inputs { From d026ceedf0fcc1b68e1a4133e605235b380ea34e Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 19 May 2025 20:51:53 +0100 Subject: [PATCH 13/55] fix --- testing/ef-tests/src/cases/blockchain_test.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index fbfc895c07f..9ecc877c769 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -327,8 +327,12 @@ pub fn run_case( // Now validate using the stateless client if everything else passes for (block, execution_witness) in &program_inputs { - stateless_validation(block.into_block(), execution_witness, chain_spec.clone()) - .expect("stateless validation failed"); + stateless_validation( + block.clone().into_block(), + execution_witness.clone(), + chain_spec.clone(), + ) + .expect("stateless validation failed"); } Ok(program_inputs) From 8455748b9dcf7ffdbae4480c009777882fc1cd59 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Tue, 20 May 2025 13:47:01 +0100 Subject: [PATCH 14/55] add verify-witness track_cycles --- crates/stateless/src/validation.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index b51cc1cc3f0..ffeebfec346 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -1,4 +1,4 @@ -use crate::{witness_db::WitnessDatabase, ExecutionWitness}; +use crate::{track_cycles, witness_db::WitnessDatabase, ExecutionWitness}; use alloc::{ boxed::Box, collections::BTreeMap, @@ -166,7 +166,8 @@ pub fn stateless_validation( }; // First verify that the pre-state reads are correct - let (mut sparse_trie, bytecode) = verify_execution_witness(&witness, pre_state_root)?; + let (mut sparse_trie, bytecode) = + track_cycles!("verify-witness", verify_execution_witness(&witness, pre_state_root)?); // Create an in-memory database that will use the reads to validate the block let db = WitnessDatabase::new(&sparse_trie, bytecode, ancestor_hashes); From f1540ee8235e9c7a2c710929972ecf5f18e63e12 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Tue, 20 May 2025 13:50:04 +0100 Subject: [PATCH 15/55] add track_cycles annotations --- crates/stateless/src/validation.rs | 63 ++++++++++++++++++------------ 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index ffeebfec346..22bb5db6044 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -131,19 +131,25 @@ pub fn stateless_validation( witness: ExecutionWitness, chain_spec: Arc, ) -> Result { - let current_block = current_block - .try_into_recovered() - .map_err(|err| StatelessValidationError::SignerRecovery(Box::new(err)))?; - - let mut ancestor_headers: Vec
= witness - .headers - .iter() - .map(|serialized_header| { - let bytes = serialized_header.as_ref(); - Header::decode(&mut &bytes[..]) - .map_err(|_| StatelessValidationError::HeaderDeserializationFailed) - }) - .collect::>()?; + let current_block = track_cycles!( + "recover-signers", + current_block + .try_into_recovered() + .map_err(|err| StatelessValidationError::SignerRecovery(Box::new(err)))? + ); + + let mut ancestor_headers: Vec
= track_cycles!( + "decode-headers", + witness + .headers + .iter() + .map(|serialized_header| { + let bytes = serialized_header.as_ref(); + Header::decode(&mut &bytes[..]) + .map_err(|_| StatelessValidationError::HeaderDeserializationFailed) + }) + .collect::>()? + ); // Sort the headers by their block number to ensure that they are in // ascending order. ancestor_headers.sort_by_key(|header| header.number()); @@ -175,24 +181,31 @@ pub fn stateless_validation( // Execute the block let basic_block_executor = EthExecutorProvider::ethereum(chain_spec.clone()); let executor = basic_block_executor.batch_executor(db); - let output = executor - .execute(¤t_block) - .map_err(|e| StatelessValidationError::StatelessExecutionFailed(e.to_string()))?; + + let output = track_cycles!( + "block-execution", + executor + .execute(¤t_block) + .map_err(|e| StatelessValidationError::StatelessExecutionFailed(e.to_string()))? + ); // Post validation checks validate_block_post_execution(¤t_block, &chain_spec, &output.receipts, &output.requests) .map_err(StatelessValidationError::ConsensusValidationFailed)?; // Compute and check the post state root - let hashed_state = HashedPostState::from_bundle_state::(&output.state.state); - let state_root = crate::root::calculate_state_root(&mut sparse_trie, hashed_state) - .map_err(|_e| StatelessValidationError::StatelessStateRootCalculationFailed)?; - if state_root != current_block.state_root { - return Err(StatelessValidationError::PostStateRootMismatch { - got: state_root, - expected: current_block.state_root, - }); - } + track_cycles!("post-state-compute", { + let hashed_state = + HashedPostState::from_bundle_state::(&output.state.state); + let state_root = crate::root::calculate_state_root(&mut sparse_trie, hashed_state) + .map_err(|_e| StatelessValidationError::StatelessStateRootCalculationFailed)?; + if state_root != current_block.state_root { + return Err(StatelessValidationError::PostStateRootMismatch { + got: state_root, + expected: current_block.state_root, + }); + } + }); // Return block hash Ok(current_block.hash_slow()) From 235e49e107ed82b2f5cf8ac280f56cfcf4976348 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Tue, 20 May 2025 13:58:50 +0100 Subject: [PATCH 16/55] cargo lock --- Cargo.lock | 193 +++++++++++++++++++---------------------------------- 1 file changed, 70 insertions(+), 123 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec044b4ea1e..707c395156b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,9 +97,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-chains" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5848366a4f08dca1caca0a6151294a4799fe2e59ba25df100491d92e0b921b1c" +checksum = "7734aecfc58a597dde036e4c5cace2ae43e2f8bf3d406b022a1ef34da178dd49" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -137,9 +137,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.0.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec7fdaa4f0e4e1ca7e9271ca7887fdd467ca3b9e101582dc6c2bbd1645eae1c" +checksum = "c47aad4cec26c92e8de55404e19324cfc5228f2e7ca2a9aae5fcf19b6b830817" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", @@ -310,9 +310,9 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.2.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40cc82a2283e3ce6317bc1f0134ea50d20e8c1965393045ee952fb28a65ddbd" +checksum = "c7d3b2243e2adfaea41da41982f91ecab8083fa51b240d0427955d709f65b1b4" dependencies = [ "alloy-chains", "alloy-eip2124", @@ -376,9 +376,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5630ce8552579d1393383b27fe4bfe7c700fb7480189a82fc054da24521947aa" +checksum = "9f98e721eb32b8e6a4bc6b3a86cc0fea418657b3665e5534d049a5cb1499cb9b" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "alloy-op-hardforks" -version = "0.2.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a79617217008626a24fb52b02d532bf4554ac9b184a2d22bd6c5df628c151601" +checksum = "04a45f2af91a348e5d22dbb3589d821d2e83d2e65b54c14c3f9e8e9c6903fc09" dependencies = [ "alloy-hardforks", "auto_impl", @@ -512,9 +512,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.12" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" +checksum = "3d6c1d995bff8d011f7cd6c81820d51825e6e06d6db73914c1630ecf544d83d6" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -523,9 +523,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.12" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" +checksum = "a40e1ef334153322fd878d07e86af7a529bcb86b2439525920a88eba87bcf943" dependencies = [ "proc-macro2", "quote", @@ -599,9 +599,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.0.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c583654aab419fe9e553ba86ab503e1cda0b855509ac95210c4ca6df84724255" +checksum = "c3363303ce692d443631ab61dc033056a32041f76971d6491969b06945cf8b5e" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -1585,7 +1585,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "cexpr", "clang-sys", "itertools 0.13.0", @@ -1636,9 +1636,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" dependencies = [ "arbitrary", "serde", @@ -1715,7 +1715,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c340fe0f0b267787095cbe35240c6786ff19da63ec7b69367ba338eace8169b" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "boa_interner", "boa_macros", "boa_string", @@ -1731,7 +1731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f620c3f06f51e65c0504ddf04978be1b814ac6586f0b45f6019801ab5efd37f9" dependencies = [ "arrayvec", - "bitflags 2.9.1", + "bitflags 2.9.0", "boa_ast", "boa_gc", "boa_interner", @@ -1816,7 +1816,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cc142dac798cdc6e2dbccfddeb50f36d2523bb977a976e19bdb3ae19b740804" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "boa_ast", "boa_interner", "boa_macros", @@ -2137,9 +2137,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.38" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", "clap_derive", @@ -2147,9 +2147,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.38" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" dependencies = [ "anstream", "anstyle", @@ -2373,9 +2373,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.14.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e22e0ed40b96a48d3db274f72fd365bd78f67af39b6bbd47e8a15e1c6207ff" +checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" dependencies = [ "cfg-if", "cpufeatures", @@ -2539,7 +2539,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "crossterm_winapi", "mio", "parking_lot", @@ -3168,9 +3168,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.12" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", "windows-sys 0.59.0", @@ -3900,16 +3900,15 @@ checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" [[package]] name = "generator" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" +checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" dependencies = [ - "cc", "cfg-if", "libc", "log", "rustversion", - "windows 0.61.1", + "windows 0.58.0", ] [[package]] @@ -3984,7 +3983,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "libc", "libgit2-sys", "log", @@ -4410,7 +4409,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.61.1", + "windows-core 0.61.0", ] [[package]] @@ -4749,7 +4748,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "inotify-sys", "libc", ] @@ -5256,7 +5255,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "libc", "redox_syscall", ] @@ -5563,9 +5562,9 @@ dependencies = [ [[package]] name = "mev-share-sse" -version = "0.5.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd9e517b6c1d1143b35b716ec1107a493b2ce1143a35cbb9788e81f69c6f574c" +checksum = "dc7c05afc89c2a8a12f9fb5bb2e315ac1fa6371e9a33a1a0b669722069173d9f" dependencies = [ "alloy-rpc-types-mev", "async-sse", @@ -5742,7 +5741,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "filetime", "fsevent-sys", "inotify", @@ -6490,7 +6489,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc5b72d8145275d844d4b5f6d4e1eef00c8cd889edb6035c21675d1bb1f45c9f" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "chrono", "flate2", "hex", @@ -6504,7 +6503,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "239df02d8349b06fc07398a3a1697b06418223b1c7725085e801e7c0fc6a12ec" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "chrono", "hex", ] @@ -6517,7 +6516,7 @@ checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.9.1", + "bitflags 2.9.0", "lazy_static", "num-traits", "rand 0.8.5", @@ -6556,7 +6555,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "memchr", "unicase", ] @@ -6794,7 +6793,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "cassowary", "compact_str", "crossterm", @@ -6815,7 +6814,7 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", ] [[package]] @@ -6850,7 +6849,7 @@ version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", ] [[package]] @@ -6984,9 +6983,9 @@ dependencies = [ [[package]] name = "resolv-conf" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" +checksum = "fc7c8f7f733062b66dc1c63f9db168ac0b97a9210e247fa90fdc9ad08f51b302" [[package]] name = "reth" @@ -8418,7 +8417,7 @@ dependencies = [ name = "reth-libmdbx" version = "1.4.3" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "byteorder", "codspeed-criterion-compat", "dashmap 6.1.0", @@ -10185,7 +10184,7 @@ dependencies = [ "aquamarine", "assert_matches", "auto_impl", - "bitflags 2.9.1", + "bitflags 2.9.0", "codspeed-criterion-compat", "futures-util", "metrics", @@ -10576,7 +10575,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ac26c71bf0fe5a9cd9fe6adaa13487afedbf8c2ee6e228132eae074cb3c2b58" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "revm-bytecode", "revm-primitives", "serde", @@ -10802,7 +10801,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys 0.4.15", @@ -10815,7 +10814,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys 0.9.4", @@ -11019,7 +11018,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "core-foundation", "core-foundation-sys", "libc", @@ -11614,11 +11613,11 @@ dependencies = [ [[package]] name = "tar-no-std" -version = "0.3.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15574aa79d3c04a12f3cb53ff976d5571e53b9d8e0bdbe4021df0a06473dd1c9" +checksum = "3b86f35512dae48782f49a15538f9af3e7ef3ea8226ee073c88f081958583924" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", "log", "memchr", "num-traits", @@ -12057,7 +12056,7 @@ checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" dependencies = [ "async-compression", "base64 0.22.1", - "bitflags 2.9.1", + "bitflags 2.9.0", "bytes", "futures-core", "futures-util", @@ -12815,28 +12814,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows" -version = "0.61.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" -dependencies = [ - "windows-collections", - "windows-core 0.61.1", - "windows-future", - "windows-link", - "windows-numerics", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.1", -] - [[package]] name = "windows-core" version = "0.57.0" @@ -12864,26 +12841,15 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.1" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ec44dc15085cea82cf9c78f85a9114c463a369786585ad2882d1ff0b0acf40" +checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ "windows-implement 0.60.0", "windows-interface 0.59.1", "windows-link", - "windows-result 0.3.3", - "windows-strings 0.4.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.1", - "windows-link", - "windows-threading", + "windows-result 0.3.2", + "windows-strings 0.4.0", ] [[package]] @@ -12958,23 +12924,13 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.1", - "windows-link", -] - [[package]] name = "windows-registry" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ - "windows-result 0.3.3", + "windows-result 0.3.2", "windows-strings 0.3.1", "windows-targets 0.53.0", ] @@ -12999,9 +12955,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ "windows-link", ] @@ -13027,9 +12983,9 @@ dependencies = [ [[package]] name = "windows-strings" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a" +checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" dependencies = [ "windows-link", ] @@ -13132,15 +13088,6 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -13346,7 +13293,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.0", ] [[package]] From 089bdf6ba57501092bff61f9d990ccf24ac0f6cc Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 21 May 2025 00:05:13 +0100 Subject: [PATCH 17/55] update cargo.lock --- Cargo.lock | 257 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 154 insertions(+), 103 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 707c395156b..c0559e72aae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,9 +97,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-chains" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7734aecfc58a597dde036e4c5cace2ae43e2f8bf3d406b022a1ef34da178dd49" +checksum = "5848366a4f08dca1caca0a6151294a4799fe2e59ba25df100491d92e0b921b1c" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -137,9 +137,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.0.0" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47aad4cec26c92e8de55404e19324cfc5228f2e7ca2a9aae5fcf19b6b830817" +checksum = "621e9f7d76ed95d21825286b180fcb89895d34244e41c89714da6d70398a16bc" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", @@ -173,15 +173,14 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f90b63261b7744642f6075ed17db6de118eecbe9516ea6c6ffd444b80180b75" +checksum = "18cc14d832bc3331ca22a1c7819de1ede99f58f61a7d123952af7dde8de124a6" dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-type-parser", "alloy-sol-types", - "const-hex", "derive_more", "itoa", "serde", @@ -310,9 +309,9 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d3b2243e2adfaea41da41982f91ecab8083fa51b240d0427955d709f65b1b4" +checksum = "b40cc82a2283e3ce6317bc1f0134ea50d20e8c1965393045ee952fb28a65ddbd" dependencies = [ "alloy-chains", "alloy-eip2124", @@ -324,9 +323,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0068ae277f5ee3153a95eaea8ff10e188ed8ccde9b7f9926305415a2c0ab2442" +checksum = "3ccaa79753d7bf15f06399ea76922afbfaf8d18bebed9e8fc452984b4a90dcc9" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -376,9 +375,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.0" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f98e721eb32b8e6a4bc6b3a86cc0fea418657b3665e5534d049a5cb1499cb9b" +checksum = "583c6fb35478d017304f4e9188daaebe5f206d44c77dbba749158427a50fdafc" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", @@ -406,9 +405,9 @@ dependencies = [ [[package]] name = "alloy-op-hardforks" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04a45f2af91a348e5d22dbb3589d821d2e83d2e65b54c14c3f9e8e9c6903fc09" +checksum = "a79617217008626a24fb52b02d532bf4554ac9b184a2d22bd6c5df628c151601" dependencies = [ "alloy-hardforks", "auto_impl", @@ -417,9 +416,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a12fe11d0b8118e551c29e1a67ccb6d01cc07ef08086df30f07487146de6fa1" +checksum = "18c35fc4b03ace65001676358ffbbaefe2a2b27ee50fe777c345082c7c888be8" dependencies = [ "alloy-rlp", "arbitrary", @@ -512,9 +511,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6c1d995bff8d011f7cd6c81820d51825e6e06d6db73914c1630ecf544d83d6" +checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -523,9 +522,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40e1ef334153322fd878d07e86af7a529bcb86b2439525920a88eba87bcf943" +checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" dependencies = [ "proc-macro2", "quote", @@ -599,9 +598,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.0.0" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3363303ce692d443631ab61dc033056a32041f76971d6491969b06945cf8b5e" +checksum = "380a951cddc3a46d4b8755f2c5ebde9ae0da373736b64222833c5f3a0773a1cc" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -777,9 +776,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3ef8e0d622453d969ba3cded54cf6800efdc85cb929fe22c5bdf8335666757" +checksum = "8612e0658964d616344f199ab251a49d48113992d81b92dab93ed855faa66383" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -791,9 +790,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e84bd0693c69a8fbe3ec0008465e029c6293494df7cb07580bf4a33eff52e1" +checksum = "7a384edac7283bc4c010a355fb648082860c04b826bb7a814c45263c8f304c74" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -809,9 +808,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3de663412dadf9b64f4f92f507f78deebcc92339d12cf15f88ded65d41c7935" +checksum = "0dd588c2d516da7deb421b8c166dc60b7ae31bca5beea29ab6621fcfa53d6ca5" dependencies = [ "const-hex", "dunce", @@ -825,9 +824,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251273c5aa1abb590852f795c938730fa641832fc8fa77b5478ed1bf11b6097e" +checksum = "e86ddeb70792c7ceaad23e57d52250107ebbb86733e52f4a25d8dc1abc931837" dependencies = [ "serde", "winnow", @@ -835,14 +834,13 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5460a975434ae594fe2b91586253c1beb404353b78f0a55bf124abcd79557b15" +checksum = "584cb97bfc5746cb9dcc4def77da11694b5d6d7339be91b7480a6a68dc129387" dependencies = [ "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", - "const-hex", "serde", ] @@ -1585,7 +1583,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cexpr", "clang-sys", "itertools 0.13.0", @@ -1636,9 +1634,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" dependencies = [ "arbitrary", "serde", @@ -1715,7 +1713,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c340fe0f0b267787095cbe35240c6786ff19da63ec7b69367ba338eace8169b" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "boa_interner", "boa_macros", "boa_string", @@ -1731,7 +1729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f620c3f06f51e65c0504ddf04978be1b814ac6586f0b45f6019801ab5efd37f9" dependencies = [ "arrayvec", - "bitflags 2.9.0", + "bitflags 2.9.1", "boa_ast", "boa_gc", "boa_interner", @@ -1816,7 +1814,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cc142dac798cdc6e2dbccfddeb50f36d2523bb977a976e19bdb3ae19b740804" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "boa_ast", "boa_interner", "boa_macros", @@ -2137,9 +2135,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" dependencies = [ "clap_builder", "clap_derive", @@ -2147,9 +2145,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" dependencies = [ "anstream", "anstyle", @@ -2373,9 +2371,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.14.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" +checksum = "83e22e0ed40b96a48d3db274f72fd365bd78f67af39b6bbd47e8a15e1c6207ff" dependencies = [ "cfg-if", "cpufeatures", @@ -2539,7 +2537,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "crossterm_winapi", "mio", "parking_lot", @@ -3168,9 +3166,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", "windows-sys 0.59.0", @@ -3900,15 +3898,16 @@ checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" [[package]] name = "generator" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd" +checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" dependencies = [ + "cc", "cfg-if", "libc", "log", "rustversion", - "windows 0.58.0", + "windows 0.61.1", ] [[package]] @@ -3983,7 +3982,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "libc", "libgit2-sys", "log", @@ -4379,9 +4378,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710" dependencies = [ "bytes", "futures-channel", @@ -4409,7 +4408,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.61.0", + "windows-core 0.61.2", ] [[package]] @@ -4519,7 +4518,7 @@ dependencies = [ "displaydoc", "icu_collections 2.0.0", "icu_normalizer_data 2.0.0", - "icu_properties 2.0.0", + "icu_properties 2.0.1", "icu_provider 2.0.0", "smallvec", "zerovec 0.11.2", @@ -4554,14 +4553,14 @@ dependencies = [ [[package]] name = "icu_properties" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections 2.0.0", "icu_locale_core", - "icu_properties_data 2.0.0", + "icu_properties_data 2.0.1", "icu_provider 2.0.0", "potential_utf", "zerotrie", @@ -4576,9 +4575,9 @@ checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" [[package]] name = "icu_properties_data" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" @@ -4649,7 +4648,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer 2.0.0", - "icu_properties 2.0.0", + "icu_properties 2.0.1", ] [[package]] @@ -4748,7 +4747,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "inotify-sys", "libc", ] @@ -5255,7 +5254,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "libc", "redox_syscall", ] @@ -5562,9 +5561,9 @@ dependencies = [ [[package]] name = "mev-share-sse" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc7c05afc89c2a8a12f9fb5bb2e315ac1fa6371e9a33a1a0b669722069173d9f" +checksum = "dd9e517b6c1d1143b35b716ec1107a493b2ce1143a35cbb9788e81f69c6f574c" dependencies = [ "alloy-rpc-types-mev", "async-sse", @@ -5741,7 +5740,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "filetime", "fsevent-sys", "inotify", @@ -6117,9 +6116,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" dependencies = [ "arbitrary", "arrayvec", @@ -6135,9 +6134,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6489,7 +6488,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc5b72d8145275d844d4b5f6d4e1eef00c8cd889edb6035c21675d1bb1f45c9f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "chrono", "flate2", "hex", @@ -6503,7 +6502,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "239df02d8349b06fc07398a3a1697b06418223b1c7725085e801e7c0fc6a12ec" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "chrono", "hex", ] @@ -6516,7 +6515,7 @@ checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.9.0", + "bitflags 2.9.1", "lazy_static", "num-traits", "rand 0.8.5", @@ -6555,7 +6554,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "memchr", "unicase", ] @@ -6793,7 +6792,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cassowary", "compact_str", "crossterm", @@ -6814,7 +6813,7 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] @@ -6849,7 +6848,7 @@ version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] @@ -6983,9 +6982,9 @@ dependencies = [ [[package]] name = "resolv-conf" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7c8f7f733062b66dc1c63f9db168ac0b97a9210e247fa90fdc9ad08f51b302" +checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" [[package]] name = "reth" @@ -8417,7 +8416,7 @@ dependencies = [ name = "reth-libmdbx" version = "1.4.3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "byteorder", "codspeed-criterion-compat", "dashmap 6.1.0", @@ -10184,7 +10183,7 @@ dependencies = [ "aquamarine", "assert_matches", "auto_impl", - "bitflags 2.9.0", + "bitflags 2.9.1", "codspeed-criterion-compat", "futures-util", "metrics", @@ -10575,7 +10574,7 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ac26c71bf0fe5a9cd9fe6adaa13487afedbf8c2ee6e228132eae074cb3c2b58" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "revm-bytecode", "revm-primitives", "serde", @@ -10801,7 +10800,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.4.15", @@ -10814,7 +10813,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", @@ -11018,7 +11017,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "core-foundation", "core-foundation-sys", "libc", @@ -11545,9 +11544,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0f0d4760f4c2a0823063b2c70e97aa2ad185f57be195172ccc0e23c4b787c4" +checksum = "1b5d879005cc1b5ba4e18665be9e9501d9da3a9b95f625497c4cb7ee082b532e" dependencies = [ "paste", "proc-macro2", @@ -11613,11 +11612,11 @@ dependencies = [ [[package]] name = "tar-no-std" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b86f35512dae48782f49a15538f9af3e7ef3ea8226ee073c88f081958583924" +checksum = "15574aa79d3c04a12f3cb53ff976d5571e53b9d8e0bdbe4021df0a06473dd1c9" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "log", "memchr", "num-traits", @@ -12056,7 +12055,7 @@ checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" dependencies = [ "async-compression", "base64 0.22.1", - "bitflags 2.9.0", + "bitflags 2.9.1", "bytes", "futures-core", "futures-util", @@ -12814,6 +12813,28 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.61.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + [[package]] name = "windows-core" version = "0.57.0" @@ -12841,15 +12862,26 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement 0.60.0", "windows-interface 0.59.1", "windows-link", - "windows-result 0.3.2", - "windows-strings 0.4.0", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link", + "windows-threading", ] [[package]] @@ -12924,13 +12956,23 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link", +] + [[package]] name = "windows-registry" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ - "windows-result 0.3.2", + "windows-result 0.3.4", "windows-strings 0.3.1", "windows-targets 0.53.0", ] @@ -12955,9 +12997,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ "windows-link", ] @@ -12983,9 +13025,9 @@ dependencies = [ [[package]] name = "windows-strings" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ "windows-link", ] @@ -13088,6 +13130,15 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -13293,7 +13344,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] From e0e205d8faeb2ea4fb47bda51fb3ba9fd85b7a25 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 21 May 2025 00:09:38 +0100 Subject: [PATCH 18/55] add tracing --- Cargo.lock | 1 + crates/stateless/Cargo.toml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c0559e72aae..5049c2d9fee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10041,6 +10041,7 @@ dependencies = [ "serde", "serde_with", "thiserror 2.0.12", + "tracing", ] [[package]] diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index 2eb2d8e2c73..529e677256f 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -22,7 +22,10 @@ alloy-rpc-types-debug.workspace = true # reth reth-ethereum-consensus.workspace = true reth-primitives-traits.workspace = true -reth-ethereum-primitives = { workspace = true, features = ["serde", "serde-bincode-compat"] } +reth-ethereum-primitives = { workspace = true, features = [ + "serde", + "serde-bincode-compat", +] } reth-errors.workspace = true reth-evm.workspace = true reth-evm-ethereum.workspace = true @@ -31,6 +34,7 @@ reth-trie-common.workspace = true reth-trie-sparse.workspace = true reth-chainspec.workspace = true reth-consensus.workspace = true +tracing.workspace = true # misc thiserror.workspace = true From 2da36a83250abbe9ebad72a6146b236a8f8b3bb6 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 21 May 2025 00:36:29 +0100 Subject: [PATCH 19/55] switch recoverBlock -> block in ClientInput --- crates/stateless/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 5872cfcf605..c193fd8ad32 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -57,7 +57,6 @@ pub mod fork_spec; pub use alloy_rpc_types_debug::ExecutionWitness; use reth_ethereum_primitives::Block; -use reth_primitives_traits::RecoveredBlock; /// ClientInput is a convenience structure for serializing the input needed /// for the stateless validation function. @@ -66,9 +65,9 @@ use reth_primitives_traits::RecoveredBlock; pub struct ClientInput { /// The block being executed in the stateless validation function #[serde_as( - as = "reth_primitives_traits::serde_bincode_compat::RecoveredBlock" + as = "reth_primitives_traits::serde_bincode_compat::Block" )] - pub block: RecoveredBlock, + pub block: Block, /// ExecutionWitness for the stateless validation function pub witness: ExecutionWitness, } From d441be8d595e0266002339781760d9e52ffab763 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 21 May 2025 16:46:23 +0100 Subject: [PATCH 20/55] update cargo.lock --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa8082dbcbc..ee4257fe618 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,9 +277,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2c9c878bd85ce90f9209ef2a4990f713525a340a4029c1d14a9cd4d3ede0e" +checksum = "b8c5b34c78c42525917b236e4135b1951ca183ede4004b594db0effee8bed169" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46178c9ffdd7cda28519fd758ee7183e669c1c838eab758bfb54748da117a7fe" +checksum = "e4fda8b1920a38a5adc607d6ff7be1e8991e16ffcf97bb12765644b87331c598" dependencies = [ "alloy-consensus", "alloy-eips 1.0.5", From ed524d03da040f43240b43b98e5cafe9e5c7a5aa Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Fri, 23 May 2025 22:18:52 +0100 Subject: [PATCH 21/55] cargo.lock --- Cargo.lock | 161 ++++++++++++++++++++++++++--------------------------- 1 file changed, 78 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 920c282ba8a..ed1250fea16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9835a7b6216cb8118323581e58a18b1a5014fce55ce718635aaea7fa07bd700" +checksum = "6b2123d190c823301be54e14a12ef10c00823d90047a140aa41650c26668d5b1" dependencies = [ "alloy-eips", "alloy-primitives", @@ -137,9 +137,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "621e9f7d76ed95d21825286b180fcb89895d34244e41c89714da6d70398a16bc" +checksum = "c89b71e608e06b3d55169595c8ff39bd2177389508b0e91da8400b48d88d3afd" dependencies = [ "alloy-consensus", "alloy-eips", @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e810f27a4162190b50cdf4dabedee3ad9028772bd7e370fdfc0f63b8bc116d3" +checksum = "210f50a648d28ee4266ff42523186efab61dd54d2ab2f8853fe38ad45d254756" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fc566136b705991072f8f79762525e14f0ca39c38d45b034944770cb6c6b67" +checksum = "f7d2126e39e1557f0e661e0a5a36748a0bf280490ca2c0a1d149a55d2c2c8675" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -257,15 +257,9 @@ dependencies = [ [[package]] name = "alloy-evm" -<<<<<<< HEAD -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c5b34c78c42525917b236e4135b1951ca183ede4004b594db0effee8bed169" -======= version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "394b09cf3a32773eedf11828987f9c72dfa74545040be0422e3f5f09a2a3fab9" ->>>>>>> main dependencies = [ "alloy-consensus", "alloy-eips", @@ -282,9 +276,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765c0124a3174f136171df8498e4700266774c9de1008a0b987766cf215d08f6" +checksum = "1cf47e07c0dbcb8f1fa2c903d9eb32b14fec3dc04e60e7fee29fc0d3799fba34" dependencies = [ "alloy-eips", "alloy-primitives", @@ -321,9 +315,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1590f44abdfe98686827a4e083b711ad17f843bf6ed8a50b78d3242f12a00ada" +checksum = "83498cbeb8353b78985ad6c127fc7376767c5d341e05e3f641076d61f3a78471" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -335,9 +329,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049a9022caa0c0a2dcd2bc2ea23fa098508f4a81d5dda774d753570a41e6acdb" +checksum = "2c443287af072731c28fb6c09b62fb882257a4d20fc151bc110357a56fb19559" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -361,9 +355,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c6fb35478d017304f4e9188daaebe5f206d44c77dbba749158427a50fdafc" +checksum = "ad99d5b76aed5ed7bd752a9ef5c5e4acf74e8956df80080a492dc83e96d7067e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -374,15 +368,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -<<<<<<< HEAD -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4fda8b1920a38a5adc607d6ff7be1e8991e16ffcf97bb12765644b87331c598" -======= version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f32538cc243ec5d4603da9845cc2f5254c6a3a78e82475beb1a2a1de6c0d36c" ->>>>>>> main dependencies = [ "alloy-consensus", "alloy-eips", @@ -439,9 +427,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959aedfc417737e2a59961c95e92c59726386748d85ef516a0d0687b440d3184" +checksum = "39721fb4c0526ec2c98ad47f5010ea6930ba121e56f46a0ff2746ed761e92a40" dependencies = [ "alloy-chains", "alloy-consensus", @@ -482,9 +470,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf694cd1494284e73e23b62568bb5df6777f99eaec6c0a4705ac5a5c61707208" +checksum = "bbeb2dd970e7d70d2d408bc6fba391ad66406d766312399a42d6f93a9586f818" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -525,9 +513,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20436220214938c4fe223244f00fbd618dda80572b8ffe7839d382a6c54f1c" +checksum = "0e59b7ec68078fcae32736052a5f56ffe1a01da267c10692757a9ae70698bb99" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -553,9 +541,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2981f41486264b2e254bc51b2691bbef9ed87d0545d11f31cb26af3109cc4" +checksum = "933d9ad7e50156f1cd5574227e6f15c6d237d50006b1754e3f3564d6e8293ed5" dependencies = [ "alloy-primitives", "alloy-rpc-types-engine", @@ -566,9 +554,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-admin" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e609eda3bdbe9665512e3f402e3f7e03420e8074e831ffd3c88a417993981cac" +checksum = "92c754d5050e6760ecb9b62f1aa906d7629a3120f7883350b00c59db14f73bc4" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -578,9 +566,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7400bf7830ebc33c3533d1385eeed5418cfcddd99da0c4514e84ce480e636d8f" +checksum = "6895febd23a9fd75a58d2fb8fa27e6ed84f4aaada309c6905e156af37afbb6e6" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -590,9 +578,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380a951cddc3a46d4b8755f2c5ebde9ae0da373736b64222833c5f3a0773a1cc" +checksum = "7233023bbb100b0527e5eb7ad9fe87b74a1dfed75bb202302c318f1cc68094ab" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -601,9 +589,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-beacon" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9cc5cdacd6c4222cc2c4714a202d1987817955112e3b95ddd2843618456ce3" +checksum = "3bb6c671a09cbe1749b6eed26e4a9b12a110a50d0681837933ec2ecb06d142a2" dependencies = [ "alloy-eips", "alloy-primitives", @@ -619,9 +607,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda0a3a9f419747a9680fad8ad312b45fc751eee47168dfe9e58d3f10138734c" +checksum = "e393e02f83d17384a7595d5288d1217cab0863ad5f10b0824325d814e7bf21c5" dependencies = [ "alloy-primitives", "serde", @@ -629,9 +617,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53bc248ac9ba1e521096166020ddda953ba9420fc5a6466ad0811264fe88b677" +checksum = "8298431d08611686fb021210b12fb229657490e3bd0658acdd709a19886b6cdf" dependencies = [ "alloy-consensus", "alloy-eips", @@ -650,9 +638,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d2c0dad584b1556528ca651f4ae17bef82734b499ccfcee69f117fea66c3293" +checksum = "e5c2b3bd2a36df4417a349a5405b5130af948a72bf2f305fc0084cac5fbe5cc1" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -671,9 +659,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-mev" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d77f550d7720081d036a2c7ebf3c88c8d23a8b4b86a2788d1648698d32ce091" +checksum = "bae10768bf9c13e5d881a7d9d0e2cf467f1ce815f50ebee0ab9e8bbbe0b9a5a1" dependencies = [ "alloy-consensus", "alloy-eips", @@ -686,9 +674,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8994ae1b1bc3fbbc47f44725e6a266230106e7eac9a8656aead8a8febeb2b38" +checksum = "2d4c2404b7ee0bd81900d63c61adef877992f430d7c932d4f3ce2a79e3f3f822" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -700,9 +688,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3de99435d76b872b5f92bb9c68e508098d76d98fcc8e00c70ff8af14b301313" +checksum = "ff9f501c596cc75a973f0f9dd3dce796d18a9454426807f30c6d28f3141540f6" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -712,9 +700,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c34ffc38f543bfdceed8c1fa5253fa5131455bb3654976be4cc3a4ae6d61f4" +checksum = "ec9f6973e552b33c9e0733165ef3f6cea3cc70617d5768260e98a29aab5e974e" dependencies = [ "alloy-primitives", "arbitrary", @@ -724,9 +712,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59245704a5dbd20b93913f4a20aa41b45c4c134f82e119bb54de4b627e003955" +checksum = "873c4e578c20af87b62b66d6f6c1cd81ab192f52515d4e63ddfecba1ac69216b" dependencies = [ "alloy-primitives", "async-trait", @@ -739,9 +727,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae78644ab0945e95efa2dc0cfac8f53aa1226fe85c294a0d8ad82c5cc9f09a2" +checksum = "52bbc5479f66f49f06c91b69c4ffd33b4df3b6f286c55c2dc94fb7ac8571053a" dependencies = [ "alloy-consensus", "alloy-network", @@ -827,9 +815,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56afd0561a291e84de9d5616fa3def4c4925a09117ea3b08d4d5d207c4f7083" +checksum = "db88a480955a3a1a6dbcd51076b03f522c64fb4ecb74545c4d38b0ca58d9fbe6" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -850,9 +838,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90770711e649bb3df0a8a666ae7b80d1d77eff5462eaf6bb4d3eaf134f6e636e" +checksum = "1ba0d8eace41128b4dbf87adff5d63347b8004977aa7f9c62b63308539dd2a29" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -865,9 +853,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983693379572a06e2bc1050116d975395604b357e1f2ac4420dd385d9ee18c11" +checksum = "6c8d9fcdeeaeb9bfa08bc70031c9518f0d9d31766c0fa71500737b4a4a215249" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -885,9 +873,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90569cc2e13f5cdf53f42d5b3347cf4a89fccbcf9978cf08b165b4a1c6447672" +checksum = "c7d39c87d5b9f3dd8e8efdc95bd3aaeef947e7938dbf45cffda9bd5689cd9517" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -983,12 +971,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys 0.59.0", ] @@ -4340,11 +4328,10 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.5" +version = "0.27.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +checksum = "03a01595e11bdcec50946522c32dde3fc6914743000a68b93000965f2f02406d" dependencies = [ - "futures-util", "http", "hyper", "hyper-util", @@ -4355,7 +4342,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots 0.26.11", + "webpki-roots 1.0.0", ] [[package]] @@ -5914,6 +5901,12 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "oorandom" version = "11.1.5" @@ -10820,9 +10813,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a46eb779843b2c4f21fac5773e25d6d5b7c8f0922876c91541790d2ca27eef" +checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" dependencies = [ "alloy-rlp", "arbitrary", @@ -11009,9 +11002,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "rusty-fork" @@ -12606,11 +12599,13 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ "getrandom 0.3.3", + "js-sys", + "wasm-bindgen", ] [[package]] From 927c90cac147a95631b7fcbe50f5e5d6a3470b7a Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 20 Jun 2025 09:43:51 -0300 Subject: [PATCH 22/55] stateless: use snake case for cycle region names Signed-off-by: Ignacio Hagopian --- crates/stateless/src/validation.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index da8491c2777..40612c8bc29 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -135,14 +135,14 @@ where E: ConfigureEvm + Clone + 'static, { let current_block = track_cycles!( - "recover-signers", + "recover_signers", current_block .try_into_recovered() .map_err(|err| StatelessValidationError::SignerRecovery(Box::new(err)))? ); let mut ancestor_headers: Vec
= track_cycles!( - "decode-headers", + "decode_headers", witness .headers .iter() @@ -176,7 +176,7 @@ where // First verify that the pre-state reads are correct let (mut trie, bytecode) = - track_cycles!("verify-witness", StatelessTrie::new(&witness, pre_state_root)?); + track_cycles!("verify_witness", StatelessTrie::new(&witness, pre_state_root)?); // Create an in-memory database that will use the reads to validate the block let db = WitnessDatabase::new(&trie, bytecode, ancestor_hashes); @@ -184,7 +184,7 @@ where // Execute the block let executor = evm_config.executor(db); let output = track_cycles!( - "block-execution", + "block_execution", executor .execute(¤t_block) .map_err(|e| StatelessValidationError::StatelessExecutionFailed(e.to_string()))? @@ -195,7 +195,7 @@ where .map_err(StatelessValidationError::ConsensusValidationFailed)?; // Compute and check the post state root - track_cycles!("post-state-compute", { + track_cycles!("post_state_compute", { let hashed_state = HashedPostState::from_bundle_state::(&output.state.state); let state_root = trie.calculate_state_root(hashed_state)?; From 44292e201d88dfe374cc3f0748e44e20386feae5 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Wed, 25 Jun 2025 10:57:26 -0300 Subject: [PATCH 23/55] add missing import Signed-off-by: Ignacio Hagopian --- crates/stateless/src/validation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index 40612c8bc29..5f58af93b92 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -1,4 +1,4 @@ -use crate::{trie::StatelessTrie, witness_db::WitnessDatabase, ExecutionWitness}; +use crate::{track_cycles, trie::StatelessTrie, witness_db::WitnessDatabase, ExecutionWitness}; use alloc::{ boxed::Box, collections::BTreeMap, From ac39dcc787f9b3c8c0e55acc0b85fbb41e3e6ca2 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 25 Jun 2025 16:57:47 +0100 Subject: [PATCH 24/55] update Cargo.lock --- Cargo.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 81e9f2c5b0c..a2fe84c978c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10222,6 +10222,7 @@ dependencies = [ "serde", "serde_with", "thiserror 2.0.12", + "tracing", ] [[package]] @@ -13882,4 +13883,4 @@ checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", -] \ No newline at end of file +] From 11c277622ead0ecb1958eaea06ad6ea79c9ee223 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 25 Jun 2025 17:14:40 +0100 Subject: [PATCH 25/55] fix --- testing/ef-tests/src/cases/blockchain_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 36fd8d15688..4dc167e2285 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -122,7 +122,7 @@ impl BlockchainTestCase { ))), // No failure expected at all - bubble up original error. - None => err, + None => Err(err.unwrap_err()), }, // Non‑processing error – forward as‑is. @@ -449,4 +449,4 @@ pub fn should_skip(path: &Path) -> bool { fn path_contains(path_str: &str, rhs: &[&str]) -> bool { let rhs = rhs.join(std::path::MAIN_SEPARATOR_STR); path_str.contains(&rhs) -} +} \ No newline at end of file From 07711838501678c8cf0e8d53502e3abe0afec9c3 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 28 Jul 2025 15:44:00 -0300 Subject: [PATCH 26/55] implement stateless chainspec Signed-off-by: Ignacio Hagopian --- crates/stateless/Cargo.toml | 3 + crates/stateless/src/chain_spec.rs | 122 +++++++++++++++++++++++++++++ crates/stateless/src/fork_spec.rs | 33 +++++--- crates/stateless/src/lib.rs | 1 + 4 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 crates/stateless/src/chain_spec.rs diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index ffce7fbd1ba..738c6e5460f 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -18,6 +18,8 @@ alloy-rlp.workspace = true alloy-trie.workspace = true alloy-consensus.workspace = true alloy-rpc-types-debug.workspace = true +alloy-eips.workspace = true +alloy-genesis.workspace = true # reth reth-ethereum-consensus.workspace = true @@ -30,6 +32,7 @@ reth-trie-common.workspace = true reth-trie-sparse.workspace = true reth-chainspec.workspace = true reth-consensus.workspace = true +reth-network-peers.workspace = true tracing.workspace = true # misc diff --git a/crates/stateless/src/chain_spec.rs b/crates/stateless/src/chain_spec.rs new file mode 100644 index 00000000000..457d6fa856e --- /dev/null +++ b/crates/stateless/src/chain_spec.rs @@ -0,0 +1,122 @@ +use core::fmt::Display; + +use alloc::{boxed::Box, vec::Vec}; +use alloy_consensus::Header; +use alloy_eips::BlobScheduleBlobParams; +use alloy_genesis::Genesis; +use alloy_primitives::{Address, B256, U256}; +use reth_chainspec::{ + BaseFeeParams, Chain, ChainHardforks, DepositContract, EthChainSpec, EthereumHardfork, + EthereumHardforks, ForkCondition, ForkFilter, ForkId, Hardfork, Hardforks, Head, +}; +use reth_evm::eth::spec::EthExecutorSpec; + +#[derive(Debug, Clone)] +pub struct ChainSpec { + pub chain: Chain, + pub hardforks: ChainHardforks, + pub deposit_contract_address: Option
, + pub blob_params: BlobScheduleBlobParams, +} + +impl EthereumHardforks for ChainSpec { + fn ethereum_fork_activation(&self, fork: EthereumHardfork) -> ForkCondition { + self.hardforks.get(fork).unwrap_or_default() + } +} + +impl EthExecutorSpec for ChainSpec { + fn deposit_contract_address(&self) -> Option
{ + self.deposit_contract_address + } +} + +impl Hardforks for ChainSpec { + fn fork(&self, fork: H) -> ForkCondition { + self.hardforks.fork(fork) + } + + fn forks_iter(&self) -> impl Iterator { + self.hardforks.forks_iter() + } + + fn fork_id(&self, _head: &Head) -> ForkId { + unimplemented!(); + } + + fn latest_fork_id(&self) -> ForkId { + unimplemented!() + } + + fn fork_filter(&self, _head: Head) -> ForkFilter { + unimplemented!(); + } +} + +impl EthChainSpec for ChainSpec { + type Header = Header; + + fn chain(&self) -> Chain { + self.chain + } + + fn base_fee_params_at_block(&self, _: u64) -> BaseFeeParams { + unimplemented!() + } + + fn base_fee_params_at_timestamp(&self, _: u64) -> BaseFeeParams { + unimplemented!() + } + + fn blob_params_at_timestamp(&self, timestamp: u64) -> Option { + if let Some(blob_param) = self.blob_params.active_scheduled_params_at_timestamp(timestamp) { + Some(*blob_param) + } else if self.is_osaka_active_at_timestamp(timestamp) { + Some(self.blob_params.osaka) + } else if self.is_prague_active_at_timestamp(timestamp) { + Some(self.blob_params.prague) + } else if self.is_cancun_active_at_timestamp(timestamp) { + Some(self.blob_params.cancun) + } else { + None + } + } + + fn deposit_contract(&self) -> Option<&DepositContract> { + unimplemented!() + } + + fn genesis_hash(&self) -> B256 { + unimplemented!() + } + + fn prune_delete_limit(&self) -> usize { + unimplemented!() + } + + fn display_hardforks(&self) -> Box { + unimplemented!() + } + + fn genesis_header(&self) -> &Self::Header { + unimplemented!() + } + + fn genesis(&self) -> &Genesis { + unimplemented!() + } + + fn bootnodes(&self) -> Option> { + unimplemented!() + } + + fn final_paris_total_difficulty(&self) -> Option { + if let ForkCondition::TTD { total_difficulty, .. } = + self.ethereum_fork_activation(EthereumHardfork::Paris) + { + Some(total_difficulty) + } else { + None + } + } +} diff --git a/crates/stateless/src/fork_spec.rs b/crates/stateless/src/fork_spec.rs index 8f0786edb74..ed005c7e874 100644 --- a/crates/stateless/src/fork_spec.rs +++ b/crates/stateless/src/fork_spec.rs @@ -1,8 +1,11 @@ +use alloy_eips::{eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams}; // This is here so we don't pull in the EF-tests. // We need to think more about how we will parse in the chain-spec -use reth_chainspec::{ChainSpec, ChainSpecBuilder}; +use reth_chainspec::{Chain, ChainSpecBuilder}; use serde::{Deserialize, Serialize}; +use crate::chain_spec::ChainSpec; + /// Fork specification. #[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Ord, Clone, Copy, Serialize, Deserialize)] pub enum ForkSpec { @@ -61,9 +64,9 @@ pub enum ForkSpec { impl From for ChainSpec { fn from(fork_spec: ForkSpec) -> Self { - let spec_builder = ChainSpecBuilder::mainnet(); + let spec_builder = ChainSpecBuilder::default(); - match fork_spec { + let hardforks = match fork_spec { ForkSpec::Frontier => spec_builder.frontier_activated(), ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { spec_builder.homestead_activated() @@ -72,17 +75,17 @@ impl From for ChainSpec { spec_builder.tangerine_whistle_activated() } ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), - ForkSpec::Byzantium | - ForkSpec::EIP158ToByzantiumAt5 | - ForkSpec::ConstantinopleFix | - ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), + ForkSpec::Byzantium + | ForkSpec::EIP158ToByzantiumAt5 + | ForkSpec::ConstantinopleFix + | ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), ForkSpec::Istanbul => spec_builder.istanbul_activated(), ForkSpec::Berlin => spec_builder.berlin_activated(), ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), - ForkSpec::Merge | - ForkSpec::MergeEOF | - ForkSpec::MergeMeterInitCode | - ForkSpec::MergePush0 => spec_builder.paris_activated(), + ForkSpec::Merge + | ForkSpec::MergeEOF + | ForkSpec::MergeMeterInitCode + | ForkSpec::MergePush0 => spec_builder.paris_activated(), ForkSpec::Shanghai => spec_builder.shanghai_activated(), ForkSpec::Cancun => spec_builder.cancun_activated(), ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { @@ -91,5 +94,13 @@ impl From for ChainSpec { ForkSpec::Prague => spec_builder.prague_activated(), } .build() + .hardforks; + + Self { + chain: Chain::mainnet(), + hardforks, + deposit_contract_address: Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), + blob_params: BlobScheduleBlobParams::default(), + } } } diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 71389ffe7e6..47da72c7cb7 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -47,6 +47,7 @@ pub use validation::stateless_validation_with_trie; pub mod validation; pub(crate) mod witness_db; +pub mod chain_spec; /// ForkSpec module /// This is needed because ChainSpec is not serializable (neither is genesis) /// From 641a10f65b4c2fa0d0898bbb1b47e1ea22117f0f Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Wed, 30 Jul 2025 14:21:06 -0300 Subject: [PATCH 27/55] missing empty genesis Signed-off-by: Ignacio Hagopian --- crates/stateless/src/fork_spec.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/stateless/src/fork_spec.rs b/crates/stateless/src/fork_spec.rs index ed005c7e874..52ee2c877b5 100644 --- a/crates/stateless/src/fork_spec.rs +++ b/crates/stateless/src/fork_spec.rs @@ -1,4 +1,5 @@ use alloy_eips::{eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams}; +use alloy_genesis::Genesis; // This is here so we don't pull in the EF-tests. // We need to think more about how we will parse in the chain-spec use reth_chainspec::{Chain, ChainSpecBuilder}; @@ -64,7 +65,7 @@ pub enum ForkSpec { impl From for ChainSpec { fn from(fork_spec: ForkSpec) -> Self { - let spec_builder = ChainSpecBuilder::default(); + let spec_builder = ChainSpecBuilder::default().genesis(Genesis::default()); let hardforks = match fork_spec { ForkSpec::Frontier => spec_builder.frontier_activated(), From 3e468e477c9d4c9f628ce7adddffcce6c7c3e090 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Wed, 30 Jul 2025 14:38:51 -0300 Subject: [PATCH 28/55] fix Signed-off-by: Ignacio Hagopian --- crates/stateless/src/fork_spec.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/stateless/src/fork_spec.rs b/crates/stateless/src/fork_spec.rs index 52ee2c877b5..107a4fb71c6 100644 --- a/crates/stateless/src/fork_spec.rs +++ b/crates/stateless/src/fork_spec.rs @@ -65,7 +65,9 @@ pub enum ForkSpec { impl From for ChainSpec { fn from(fork_spec: ForkSpec) -> Self { - let spec_builder = ChainSpecBuilder::default().genesis(Genesis::default()); + // We initialize with empty genesis since we only use hardforks from the constructed ChainSpec. + let spec_builder = + ChainSpecBuilder::default().genesis(Genesis::default()).chain(Chain::mainnet()); let hardforks = match fork_spec { ForkSpec::Frontier => spec_builder.frontier_activated(), From acc318efe4fa2e7a3e78f87bc186188f3960753f Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 16:19:20 -0300 Subject: [PATCH 29/55] first step change Signed-off-by: Ignacio Hagopian --- crates/stateless/src/fork_spec.rs | 109 ------------------------------ crates/stateless/src/lib.rs | 12 ---- testing/ef-tests/src/models.rs | 100 ++++++++++++++------------- 3 files changed, 53 insertions(+), 168 deletions(-) delete mode 100644 crates/stateless/src/fork_spec.rs diff --git a/crates/stateless/src/fork_spec.rs b/crates/stateless/src/fork_spec.rs deleted file mode 100644 index 107a4fb71c6..00000000000 --- a/crates/stateless/src/fork_spec.rs +++ /dev/null @@ -1,109 +0,0 @@ -use alloy_eips::{eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams}; -use alloy_genesis::Genesis; -// This is here so we don't pull in the EF-tests. -// We need to think more about how we will parse in the chain-spec -use reth_chainspec::{Chain, ChainSpecBuilder}; -use serde::{Deserialize, Serialize}; - -use crate::chain_spec::ChainSpec; - -/// Fork specification. -#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Ord, Clone, Copy, Serialize, Deserialize)] -pub enum ForkSpec { - /// Frontier - Frontier, - /// Frontier to Homestead - FrontierToHomesteadAt5, - /// Homestead - Homestead, - /// Homestead to Tangerine - HomesteadToDaoAt5, - /// Homestead to Tangerine - HomesteadToEIP150At5, - /// Tangerine - EIP150, - /// Spurious Dragon - EIP158, // EIP-161: State trie clearing - /// Spurious Dragon to Byzantium - EIP158ToByzantiumAt5, - /// Byzantium - Byzantium, - /// Byzantium to Constantinople - ByzantiumToConstantinopleAt5, // SKIPPED - /// Byzantium to Constantinople - ByzantiumToConstantinopleFixAt5, - /// Constantinople - Constantinople, // SKIPPED - /// Constantinople fix - ConstantinopleFix, - /// Istanbul - Istanbul, - /// Berlin - Berlin, - /// Berlin to London - BerlinToLondonAt5, - /// London - London, - /// Paris aka The Merge - Merge, - /// Shanghai - Shanghai, - /// Merge EOF test - #[serde(alias = "Merge+3540+3670")] - MergeEOF, - /// After Merge Init Code test - #[serde(alias = "Merge+3860")] - MergeMeterInitCode, - /// After Merge plus new PUSH0 opcode - #[serde(alias = "Merge+3855")] - MergePush0, - /// Cancun - Cancun, - /// Prague - Prague, -} - -impl From for ChainSpec { - fn from(fork_spec: ForkSpec) -> Self { - // We initialize with empty genesis since we only use hardforks from the constructed ChainSpec. - let spec_builder = - ChainSpecBuilder::default().genesis(Genesis::default()).chain(Chain::mainnet()); - - let hardforks = match fork_spec { - ForkSpec::Frontier => spec_builder.frontier_activated(), - ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { - spec_builder.homestead_activated() - } - ForkSpec::EIP150 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => { - spec_builder.tangerine_whistle_activated() - } - ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), - ForkSpec::Byzantium - | ForkSpec::EIP158ToByzantiumAt5 - | ForkSpec::ConstantinopleFix - | ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), - ForkSpec::Istanbul => spec_builder.istanbul_activated(), - ForkSpec::Berlin => spec_builder.berlin_activated(), - ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), - ForkSpec::Merge - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 => spec_builder.paris_activated(), - ForkSpec::Shanghai => spec_builder.shanghai_activated(), - ForkSpec::Cancun => spec_builder.cancun_activated(), - ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { - panic!("Overridden with PETERSBURG") - } - ForkSpec::Prague => spec_builder.prague_activated(), - } - .build() - .hardforks; - - Self { - chain: Chain::mainnet(), - hardforks, - deposit_contract_address: Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), - blob_params: BlobScheduleBlobParams::default(), - } - } -} diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 47da72c7cb7..041c82f1666 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -48,18 +48,6 @@ pub mod validation; pub(crate) mod witness_db; pub mod chain_spec; -/// ForkSpec module -/// This is needed because ChainSpec is not serializable (neither is genesis) -/// -/// Note: There is an exact copy of ForkSpec in `ef-tests` but since ef-tests is not no_std -/// we cannot pull that in since we need ForkSpec in the guest program. -/// -/// We convert the ef-tests version of ForkSpec in the host into the one located in here. -/// -/// When we parse execution spec tests, we get back a ForkSpec, that we then pass into -/// the guest program and convert it into a ChainSpec. If someone is using Hoodi/Mainnet -/// etc, then this may not be needed, as you can just do ChainSpec::mainnet() in the guest program -pub mod fork_spec; #[doc(inline)] pub use alloy_rpc_types_debug::ExecutionWitness; diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 53d99da7dfb..76e9d69fdcd 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -2,10 +2,12 @@ use crate::{assert::assert_equal, Error}; use alloy_consensus::Header as RethHeader; -use alloy_eips::eip4895::Withdrawals; -use alloy_genesis::GenesisAccount; +use alloy_eips::{ + eip4895::Withdrawals, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams, +}; +use alloy_genesis::{Genesis, GenesisAccount}; use alloy_primitives::{keccak256, Address, Bloom, Bytes, B256, B64, U256}; -use reth_chainspec::{ChainSpec, ChainSpecBuilder}; +use reth_chainspec::{Chain, ChainSpec, ChainSpecBuilder}; use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx}; use reth_primitives_traits::SealedHeader; use serde::Deserialize; @@ -243,12 +245,12 @@ impl Account { } else { return Err(Error::Assertion(format!( "Slot {slot:?} is missing from the database. Expected {value:?}" - ))) + ))); } } else { return Err(Error::Assertion(format!( "Slot {slot:?} is missing from the database. Expected {value:?}" - ))) + ))); } } @@ -325,17 +327,17 @@ impl From for ChainSpec { spec_builder.tangerine_whistle_activated() } ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), - ForkSpec::Byzantium | - ForkSpec::EIP158ToByzantiumAt5 | - ForkSpec::ConstantinopleFix | - ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), + ForkSpec::Byzantium + | ForkSpec::EIP158ToByzantiumAt5 + | ForkSpec::ConstantinopleFix + | ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), ForkSpec::Istanbul => spec_builder.istanbul_activated(), ForkSpec::Berlin => spec_builder.berlin_activated(), ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), - ForkSpec::Merge | - ForkSpec::MergeEOF | - ForkSpec::MergeMeterInitCode | - ForkSpec::MergePush0 => spec_builder.paris_activated(), + ForkSpec::Merge + | ForkSpec::MergeEOF + | ForkSpec::MergeMeterInitCode + | ForkSpec::MergePush0 => spec_builder.paris_activated(), ForkSpec::Shanghai => spec_builder.shanghai_activated(), ForkSpec::Cancun => spec_builder.cancun_activated(), ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { @@ -347,43 +349,47 @@ impl From for ChainSpec { } } -impl From for reth_stateless::fork_spec::ForkSpec { - fn from(value: ForkSpec) -> Self { - match value { - ForkSpec::Frontier => reth_stateless::fork_spec::ForkSpec::Frontier, - ForkSpec::FrontierToHomesteadAt5 => { - reth_stateless::fork_spec::ForkSpec::FrontierToHomesteadAt5 - } - ForkSpec::Homestead => reth_stateless::fork_spec::ForkSpec::Homestead, - ForkSpec::HomesteadToDaoAt5 => reth_stateless::fork_spec::ForkSpec::HomesteadToDaoAt5, - ForkSpec::HomesteadToEIP150At5 => { - reth_stateless::fork_spec::ForkSpec::HomesteadToEIP150At5 - } - ForkSpec::EIP150 => reth_stateless::fork_spec::ForkSpec::EIP150, - ForkSpec::EIP158 => reth_stateless::fork_spec::ForkSpec::EIP158, - ForkSpec::EIP158ToByzantiumAt5 => { - reth_stateless::fork_spec::ForkSpec::EIP158ToByzantiumAt5 +impl From for reth_stateless::chain_spec::ChainSpec { + fn from(fork_spec: ForkSpec) -> Self { + // We initialize with empty genesis since we only use hardforks from the constructed ChainSpec. + let spec_builder = + ChainSpecBuilder::default().genesis(Genesis::default()).chain(Chain::mainnet()); + + let hardforks = match fork_spec { + ForkSpec::Frontier => spec_builder.frontier_activated(), + ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { + spec_builder.homestead_activated() } - ForkSpec::Byzantium => reth_stateless::fork_spec::ForkSpec::Byzantium, - ForkSpec::ByzantiumToConstantinopleAt5 => { - reth_stateless::fork_spec::ForkSpec::ByzantiumToConstantinopleAt5 + ForkSpec::EIP150 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => { + spec_builder.tangerine_whistle_activated() } - ForkSpec::ByzantiumToConstantinopleFixAt5 => { - reth_stateless::fork_spec::ForkSpec::ByzantiumToConstantinopleFixAt5 + ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), + ForkSpec::Byzantium + | ForkSpec::EIP158ToByzantiumAt5 + | ForkSpec::ConstantinopleFix + | ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), + ForkSpec::Istanbul => spec_builder.istanbul_activated(), + ForkSpec::Berlin => spec_builder.berlin_activated(), + ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), + ForkSpec::Merge + | ForkSpec::MergeEOF + | ForkSpec::MergeMeterInitCode + | ForkSpec::MergePush0 => spec_builder.paris_activated(), + ForkSpec::Shanghai => spec_builder.shanghai_activated(), + ForkSpec::Cancun => spec_builder.cancun_activated(), + ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { + panic!("Overridden with PETERSBURG") } - ForkSpec::Constantinople => reth_stateless::fork_spec::ForkSpec::Constantinople, - ForkSpec::ConstantinopleFix => reth_stateless::fork_spec::ForkSpec::ConstantinopleFix, - ForkSpec::Istanbul => reth_stateless::fork_spec::ForkSpec::Istanbul, - ForkSpec::Berlin => reth_stateless::fork_spec::ForkSpec::Berlin, - ForkSpec::BerlinToLondonAt5 => reth_stateless::fork_spec::ForkSpec::BerlinToLondonAt5, - ForkSpec::London => reth_stateless::fork_spec::ForkSpec::London, - ForkSpec::Merge => reth_stateless::fork_spec::ForkSpec::Merge, - ForkSpec::Shanghai => reth_stateless::fork_spec::ForkSpec::Shanghai, - ForkSpec::MergeEOF => reth_stateless::fork_spec::ForkSpec::MergeEOF, - ForkSpec::MergeMeterInitCode => reth_stateless::fork_spec::ForkSpec::MergeMeterInitCode, - ForkSpec::MergePush0 => reth_stateless::fork_spec::ForkSpec::MergePush0, - ForkSpec::Cancun => reth_stateless::fork_spec::ForkSpec::Cancun, - ForkSpec::Prague => reth_stateless::fork_spec::ForkSpec::Prague, + ForkSpec::Prague => spec_builder.prague_activated(), + } + .build() + .hardforks; + + Self { + chain: Chain::mainnet(), + hardforks, + deposit_contract_address: Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), + blob_params: BlobScheduleBlobParams::default(), } } } From 8cee4ee6fa64d1cd6492cf6a0eeb392cca3b02d2 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 16:27:44 -0300 Subject: [PATCH 30/55] fill chainconfig for tests Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/models.rs | 70 ++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 76e9d69fdcd..656be290b25 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -5,9 +5,11 @@ use alloy_consensus::Header as RethHeader; use alloy_eips::{ eip4895::Withdrawals, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams, }; -use alloy_genesis::{Genesis, GenesisAccount}; +use alloy_genesis::{ChainConfig, Genesis, GenesisAccount}; use alloy_primitives::{keccak256, Address, Bloom, Bytes, B256, B64, U256}; -use reth_chainspec::{Chain, ChainSpec, ChainSpecBuilder}; +use reth_chainspec::{ + Chain, ChainHardforks, ChainSpec, ChainSpecBuilder, EthereumHardfork, ForkCondition, +}; use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx}; use reth_primitives_traits::SealedHeader; use serde::Deserialize; @@ -318,7 +320,7 @@ impl From for ChainSpec { fn from(fork_spec: ForkSpec) -> Self { let spec_builder = ChainSpecBuilder::mainnet(); - match fork_spec { + let mut chain_spec = match fork_spec { ForkSpec::Frontier => spec_builder.frontier_activated(), ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { spec_builder.homestead_activated() @@ -345,8 +347,68 @@ impl From for ChainSpec { } ForkSpec::Prague => spec_builder.prague_activated(), } - .build() + .build(); + + fill_genesis_config( + &mut chain_spec.genesis.config, + &chain_spec.hardforks, + Chain::mainnet().id(), + ); + + chain_spec + } +} + +fn fill_genesis_config(cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain_id: u64) { + cfg.chain_id = chain_id; + // Helpers to extract activation values from ForkCondition + let get_block = |hf: EthereumHardfork| -> Option { + match hardforks.fork(hf) { + ForkCondition::Block(b) => Some(b), + ForkCondition::TTD { activation_block_number, .. } => Some(activation_block_number), + _ => None, + } + }; + let get_time = |hf: EthereumHardfork| -> Option { + match hardforks.fork(hf) { + ForkCondition::Timestamp(t) => Some(t), + _ => None, + } + }; + + // Legacy block-based forks + cfg.homestead_block = get_block(EthereumHardfork::Homestead); + cfg.dao_fork_block = get_block(EthereumHardfork::Dao); + cfg.dao_fork_support = cfg.dao_fork_block.is_some(); + cfg.eip150_block = get_block(EthereumHardfork::Tangerine); + // Spurious Dragon covers both eip155 and eip158 + let spurious = get_block(EthereumHardfork::SpuriousDragon); + cfg.eip155_block = spurious; + cfg.eip158_block = spurious; + cfg.byzantium_block = get_block(EthereumHardfork::Byzantium); + cfg.constantinople_block = get_block(EthereumHardfork::Constantinople); + cfg.petersburg_block = get_block(EthereumHardfork::Petersburg); + cfg.istanbul_block = get_block(EthereumHardfork::Istanbul); + cfg.muir_glacier_block = get_block(EthereumHardfork::MuirGlacier); + cfg.berlin_block = get_block(EthereumHardfork::Berlin); + cfg.london_block = get_block(EthereumHardfork::London); + cfg.arrow_glacier_block = get_block(EthereumHardfork::ArrowGlacier); + cfg.gray_glacier_block = get_block(EthereumHardfork::GrayGlacier); + + // Merge (Paris) via TTD + if let ForkCondition::TTD { total_difficulty, fork_block, .. } = + hardforks.fork(EthereumHardfork::Paris) + { + cfg.terminal_total_difficulty = Some(total_difficulty); + cfg.terminal_total_difficulty_passed = true; + cfg.merge_netsplit_block = fork_block; } + + // Timestamp-based forks + cfg.shanghai_time = get_time(EthereumHardfork::Shanghai); + cfg.cancun_time = get_time(EthereumHardfork::Cancun); + cfg.prague_time = get_time(EthereumHardfork::Prague); + cfg.osaka_time = get_time(EthereumHardfork::Osaka); } impl From for reth_stateless::chain_spec::ChainSpec { From ca2e722fba73a34aecedbd493f416cd05f8e0dbe Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 17:01:20 -0300 Subject: [PATCH 31/55] add chain config Signed-off-by: Ignacio Hagopian --- crates/stateless/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 041c82f1666..f572d514292 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -38,6 +38,7 @@ extern crate alloc; /// Sparse trie implementation for stateless validation pub mod trie; +use alloy_genesis::ChainConfig; #[doc(inline)] pub use trie::StatelessTrie; #[doc(inline)] @@ -66,6 +67,8 @@ pub struct StatelessInput { pub block: Block, /// `ExecutionWitness` for the stateless validation function pub witness: ExecutionWitness, + /// Chain configuration + pub chain_config: ChainConfig, } /// Tracks the amount of cycles a region of code takes up From 39c7e546d45a1064162a83e45e080c3d5a1f6e45 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 17:45:13 -0300 Subject: [PATCH 32/55] export genesis Signed-off-by: Ignacio Hagopian --- crates/stateless/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index f572d514292..08502a54704 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -44,6 +44,8 @@ pub use trie::StatelessTrie; #[doc(inline)] pub use validation::stateless_validation_with_trie; +pub use alloy_genesis::Genesis; + /// Implementation of stateless validation pub mod validation; pub(crate) mod witness_db; From 4c51e81b7f74acbc278c57eb4aa66ecac07ac5f7 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 17:53:55 -0300 Subject: [PATCH 33/55] update Signed-off-by: Ignacio Hagopian --- crates/stateless/Cargo.toml | 2 +- crates/stateless/src/lib.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index 738c6e5460f..15cc8e2e046 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -19,7 +19,7 @@ alloy-trie.workspace = true alloy-consensus.workspace = true alloy-rpc-types-debug.workspace = true alloy-eips.workspace = true -alloy-genesis.workspace = true +alloy-genesis = { workspace = true, features = ["serde-bincode-compat"] } # reth reth-ethereum-consensus.workspace = true diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index 08502a54704..e5bd22a4d30 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -69,7 +69,8 @@ pub struct StatelessInput { pub block: Block, /// `ExecutionWitness` for the stateless validation function pub witness: ExecutionWitness, - /// Chain configuration + /// Chain configuration for the stateless validation function + #[serde_as(as = "alloy_genesis::serde_bincode_compat::ChainConfig<'_>")] pub chain_config: ChainConfig, } From 65a6585d715b93ca07804bd44e89f81dd049abf2 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 18:12:00 -0300 Subject: [PATCH 34/55] more changes Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/models.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 656be290b25..346afda357d 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -380,11 +380,12 @@ fn fill_genesis_config(cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain_ cfg.homestead_block = get_block(EthereumHardfork::Homestead); cfg.dao_fork_block = get_block(EthereumHardfork::Dao); cfg.dao_fork_support = cfg.dao_fork_block.is_some(); + // TODO: why there isn't a consolidated Tangerine Whistle fork? cfg.eip150_block = get_block(EthereumHardfork::Tangerine); - // Spurious Dragon covers both eip155 and eip158 - let spurious = get_block(EthereumHardfork::SpuriousDragon); - cfg.eip155_block = spurious; - cfg.eip158_block = spurious; + cfg.eip158_block = get_block(EthereumHardfork::Tangerine); + // TODO: why there isn't a Spurious Dragon fork? + // More EIPs than EIP-155 were activated there, see: https://ethereum.org/en/history/#spurious-dragon + cfg.eip155_block = get_block(EthereumHardfork::SpuriousDragon); cfg.byzantium_block = get_block(EthereumHardfork::Byzantium); cfg.constantinople_block = get_block(EthereumHardfork::Constantinople); cfg.petersburg_block = get_block(EthereumHardfork::Petersburg); From 8d348c8c5f2bf136e71d92fde7da3373842b7eb6 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 18:36:13 -0300 Subject: [PATCH 35/55] more work Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 61 ++++++++++++++++++++++++++++++++-- testing/ef-tests/src/models.rs | 61 +--------------------------------- 2 files changed, 59 insertions(+), 63 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 2800640b708..5e4d7f63942 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -17,7 +17,7 @@ use alloy_consensus::{ use alloy_eips::{ eip1559::INITIAL_BASE_FEE, eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams, }; -use alloy_genesis::Genesis; +use alloy_genesis::{ChainConfig, Genesis}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; use alloy_trie::root::state_root_ref_unhashed; use core::fmt::Debug; @@ -87,9 +87,10 @@ pub fn make_genesis_header(genesis: &Genesis, hardforks: &ChainHardforks) -> Hea /// The Ethereum mainnet spec pub static MAINNET: LazyLock> = LazyLock::new(|| { - let genesis = serde_json::from_str(include_str!("../res/genesis/mainnet.json")) + let mut genesis: Genesis = serde_json::from_str(include_str!("../res/genesis/mainnet.json")) .expect("Can't deserialize Mainnet genesis json"); let hardforks = EthereumHardfork::mainnet().into(); +fill_genesis_config(&mut genesis.config, &hardforks, Some(Chain::mainnet())); let mut spec = ChainSpec { chain: Chain::mainnet(), genesis_header: SealedHeader::new( @@ -965,7 +966,8 @@ impl ChainSpecBuilder { } }) }; - let genesis = self.genesis.expect("The genesis is required"); + let mut genesis = self.genesis.expect("The genesis is required"); + fill_genesis_config(&mut genesis.config, &self.hardforks, self.chain); ChainSpec { chain: self.chain.expect("The chain is required"), genesis_header: SealedHeader::new_unhashed(make_genesis_header( @@ -981,6 +983,59 @@ impl ChainSpecBuilder { } } +fn fill_genesis_config(cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain: Option) { + cfg.chain_id = chain.map(|c| c.id()).unwrap_or_default(); + // Helpers to extract activation values from ForkCondition + let get_block = |hf: EthereumHardfork| -> Option { + match hardforks.fork(hf) { + ForkCondition::Block(b) => Some(b), + ForkCondition::TTD { activation_block_number, .. } => Some(activation_block_number), + _ => None, + } + }; + let get_time = |hf: EthereumHardfork| -> Option { + match hardforks.fork(hf) { + ForkCondition::Timestamp(t) => Some(t), + _ => None, + } + }; + + // Legacy block-based forks + cfg.homestead_block = get_block(EthereumHardfork::Homestead); + cfg.dao_fork_block = get_block(EthereumHardfork::Dao); + cfg.dao_fork_support = cfg.dao_fork_block.is_some(); + // TODO: why there isn't a consolidated Tangerine Whistle fork? + cfg.eip150_block = get_block(EthereumHardfork::Tangerine); + cfg.eip158_block = get_block(EthereumHardfork::Tangerine); + // TODO: why there isn't a Spurious Dragon fork? + // More EIPs than EIP-155 were activated there, see: https://ethereum.org/en/history/#spurious-dragon + cfg.eip155_block = get_block(EthereumHardfork::SpuriousDragon); + cfg.byzantium_block = get_block(EthereumHardfork::Byzantium); + cfg.constantinople_block = get_block(EthereumHardfork::Constantinople); + cfg.petersburg_block = get_block(EthereumHardfork::Petersburg); + cfg.istanbul_block = get_block(EthereumHardfork::Istanbul); + cfg.muir_glacier_block = get_block(EthereumHardfork::MuirGlacier); + cfg.berlin_block = get_block(EthereumHardfork::Berlin); + cfg.london_block = get_block(EthereumHardfork::London); + cfg.arrow_glacier_block = get_block(EthereumHardfork::ArrowGlacier); + cfg.gray_glacier_block = get_block(EthereumHardfork::GrayGlacier); + + // Merge (Paris) via TTD + if let ForkCondition::TTD { total_difficulty, fork_block, .. } = + hardforks.fork(EthereumHardfork::Paris) + { + cfg.terminal_total_difficulty = Some(total_difficulty); + cfg.terminal_total_difficulty_passed = true; + cfg.merge_netsplit_block = fork_block; + } + + // Timestamp-based forks + cfg.shanghai_time = get_time(EthereumHardfork::Shanghai); + cfg.cancun_time = get_time(EthereumHardfork::Cancun); + cfg.prague_time = get_time(EthereumHardfork::Prague); + cfg.osaka_time = get_time(EthereumHardfork::Osaka); +} + impl From<&Arc> for ChainSpecBuilder { fn from(value: &Arc) -> Self { Self { diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 346afda357d..56d413901ee 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -320,7 +320,7 @@ impl From for ChainSpec { fn from(fork_spec: ForkSpec) -> Self { let spec_builder = ChainSpecBuilder::mainnet(); - let mut chain_spec = match fork_spec { + let chain_spec = match fork_spec { ForkSpec::Frontier => spec_builder.frontier_activated(), ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { spec_builder.homestead_activated() @@ -349,69 +349,10 @@ impl From for ChainSpec { } .build(); - fill_genesis_config( - &mut chain_spec.genesis.config, - &chain_spec.hardforks, - Chain::mainnet().id(), - ); - chain_spec } } -fn fill_genesis_config(cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain_id: u64) { - cfg.chain_id = chain_id; - // Helpers to extract activation values from ForkCondition - let get_block = |hf: EthereumHardfork| -> Option { - match hardforks.fork(hf) { - ForkCondition::Block(b) => Some(b), - ForkCondition::TTD { activation_block_number, .. } => Some(activation_block_number), - _ => None, - } - }; - let get_time = |hf: EthereumHardfork| -> Option { - match hardforks.fork(hf) { - ForkCondition::Timestamp(t) => Some(t), - _ => None, - } - }; - - // Legacy block-based forks - cfg.homestead_block = get_block(EthereumHardfork::Homestead); - cfg.dao_fork_block = get_block(EthereumHardfork::Dao); - cfg.dao_fork_support = cfg.dao_fork_block.is_some(); - // TODO: why there isn't a consolidated Tangerine Whistle fork? - cfg.eip150_block = get_block(EthereumHardfork::Tangerine); - cfg.eip158_block = get_block(EthereumHardfork::Tangerine); - // TODO: why there isn't a Spurious Dragon fork? - // More EIPs than EIP-155 were activated there, see: https://ethereum.org/en/history/#spurious-dragon - cfg.eip155_block = get_block(EthereumHardfork::SpuriousDragon); - cfg.byzantium_block = get_block(EthereumHardfork::Byzantium); - cfg.constantinople_block = get_block(EthereumHardfork::Constantinople); - cfg.petersburg_block = get_block(EthereumHardfork::Petersburg); - cfg.istanbul_block = get_block(EthereumHardfork::Istanbul); - cfg.muir_glacier_block = get_block(EthereumHardfork::MuirGlacier); - cfg.berlin_block = get_block(EthereumHardfork::Berlin); - cfg.london_block = get_block(EthereumHardfork::London); - cfg.arrow_glacier_block = get_block(EthereumHardfork::ArrowGlacier); - cfg.gray_glacier_block = get_block(EthereumHardfork::GrayGlacier); - - // Merge (Paris) via TTD - if let ForkCondition::TTD { total_difficulty, fork_block, .. } = - hardforks.fork(EthereumHardfork::Paris) - { - cfg.terminal_total_difficulty = Some(total_difficulty); - cfg.terminal_total_difficulty_passed = true; - cfg.merge_netsplit_block = fork_block; - } - - // Timestamp-based forks - cfg.shanghai_time = get_time(EthereumHardfork::Shanghai); - cfg.cancun_time = get_time(EthereumHardfork::Cancun); - cfg.prague_time = get_time(EthereumHardfork::Prague); - cfg.osaka_time = get_time(EthereumHardfork::Osaka); -} - impl From for reth_stateless::chain_spec::ChainSpec { fn from(fork_spec: ForkSpec) -> Self { // We initialize with empty genesis since we only use hardforks from the constructed ChainSpec. From b4bde84f11e2592fd8215f69a6ebc555f42057c7 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 8 Aug 2025 19:23:23 -0300 Subject: [PATCH 36/55] more changes Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 5e4d7f63942..5bfef2111b7 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -15,7 +15,8 @@ use alloy_consensus::{ Header, }; use alloy_eips::{ - eip1559::INITIAL_BASE_FEE, eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams, + eip1559::INITIAL_BASE_FEE, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, +eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams, }; use alloy_genesis::{ChainConfig, Genesis}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; @@ -90,7 +91,12 @@ pub static MAINNET: LazyLock> = LazyLock::new(|| { let mut genesis: Genesis = serde_json::from_str(include_str!("../res/genesis/mainnet.json")) .expect("Can't deserialize Mainnet genesis json"); let hardforks = EthereumHardfork::mainnet().into(); -fill_genesis_config(&mut genesis.config, &hardforks, Some(Chain::mainnet())); +fill_genesis_config( +&mut genesis.config, +&hardforks, +Some(Chain::mainnet()), + Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), +); let mut spec = ChainSpec { chain: Chain::mainnet(), genesis_header: SealedHeader::new( @@ -967,7 +973,7 @@ impl ChainSpecBuilder { }) }; let mut genesis = self.genesis.expect("The genesis is required"); - fill_genesis_config(&mut genesis.config, &self.hardforks, self.chain); + fill_genesis_config(&mut genesis.config, &self.hardforks, self.chain, None); ChainSpec { chain: self.chain.expect("The chain is required"), genesis_header: SealedHeader::new_unhashed(make_genesis_header( @@ -983,8 +989,14 @@ impl ChainSpecBuilder { } } -fn fill_genesis_config(cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain: Option) { +fn fill_genesis_config( + cfg: &mut ChainConfig, + hardforks: &ChainHardforks, + chain: Option, + deposit_contract: Option
, +) { cfg.chain_id = chain.map(|c| c.id()).unwrap_or_default(); + cfg.deposit_contract_address = deposit_contract; // Helpers to extract activation values from ForkCondition let get_block = |hf: EthereumHardfork| -> Option { match hardforks.fork(hf) { From 6eda062b5f178ff919da1ec5d282690a83bc31fd Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Aug 2025 09:32:29 -0300 Subject: [PATCH 37/55] remove stateless chainspec Signed-off-by: Ignacio Hagopian --- crates/stateless/src/chain_spec.rs | 122 ----------------------------- crates/stateless/src/lib.rs | 2 - testing/ef-tests/src/models.rs | 55 +------------ 3 files changed, 3 insertions(+), 176 deletions(-) delete mode 100644 crates/stateless/src/chain_spec.rs diff --git a/crates/stateless/src/chain_spec.rs b/crates/stateless/src/chain_spec.rs deleted file mode 100644 index 457d6fa856e..00000000000 --- a/crates/stateless/src/chain_spec.rs +++ /dev/null @@ -1,122 +0,0 @@ -use core::fmt::Display; - -use alloc::{boxed::Box, vec::Vec}; -use alloy_consensus::Header; -use alloy_eips::BlobScheduleBlobParams; -use alloy_genesis::Genesis; -use alloy_primitives::{Address, B256, U256}; -use reth_chainspec::{ - BaseFeeParams, Chain, ChainHardforks, DepositContract, EthChainSpec, EthereumHardfork, - EthereumHardforks, ForkCondition, ForkFilter, ForkId, Hardfork, Hardforks, Head, -}; -use reth_evm::eth::spec::EthExecutorSpec; - -#[derive(Debug, Clone)] -pub struct ChainSpec { - pub chain: Chain, - pub hardforks: ChainHardforks, - pub deposit_contract_address: Option
, - pub blob_params: BlobScheduleBlobParams, -} - -impl EthereumHardforks for ChainSpec { - fn ethereum_fork_activation(&self, fork: EthereumHardfork) -> ForkCondition { - self.hardforks.get(fork).unwrap_or_default() - } -} - -impl EthExecutorSpec for ChainSpec { - fn deposit_contract_address(&self) -> Option
{ - self.deposit_contract_address - } -} - -impl Hardforks for ChainSpec { - fn fork(&self, fork: H) -> ForkCondition { - self.hardforks.fork(fork) - } - - fn forks_iter(&self) -> impl Iterator { - self.hardforks.forks_iter() - } - - fn fork_id(&self, _head: &Head) -> ForkId { - unimplemented!(); - } - - fn latest_fork_id(&self) -> ForkId { - unimplemented!() - } - - fn fork_filter(&self, _head: Head) -> ForkFilter { - unimplemented!(); - } -} - -impl EthChainSpec for ChainSpec { - type Header = Header; - - fn chain(&self) -> Chain { - self.chain - } - - fn base_fee_params_at_block(&self, _: u64) -> BaseFeeParams { - unimplemented!() - } - - fn base_fee_params_at_timestamp(&self, _: u64) -> BaseFeeParams { - unimplemented!() - } - - fn blob_params_at_timestamp(&self, timestamp: u64) -> Option { - if let Some(blob_param) = self.blob_params.active_scheduled_params_at_timestamp(timestamp) { - Some(*blob_param) - } else if self.is_osaka_active_at_timestamp(timestamp) { - Some(self.blob_params.osaka) - } else if self.is_prague_active_at_timestamp(timestamp) { - Some(self.blob_params.prague) - } else if self.is_cancun_active_at_timestamp(timestamp) { - Some(self.blob_params.cancun) - } else { - None - } - } - - fn deposit_contract(&self) -> Option<&DepositContract> { - unimplemented!() - } - - fn genesis_hash(&self) -> B256 { - unimplemented!() - } - - fn prune_delete_limit(&self) -> usize { - unimplemented!() - } - - fn display_hardforks(&self) -> Box { - unimplemented!() - } - - fn genesis_header(&self) -> &Self::Header { - unimplemented!() - } - - fn genesis(&self) -> &Genesis { - unimplemented!() - } - - fn bootnodes(&self) -> Option> { - unimplemented!() - } - - fn final_paris_total_difficulty(&self) -> Option { - if let ForkCondition::TTD { total_difficulty, .. } = - self.ethereum_fork_activation(EthereumHardfork::Paris) - { - Some(total_difficulty) - } else { - None - } - } -} diff --git a/crates/stateless/src/lib.rs b/crates/stateless/src/lib.rs index e5bd22a4d30..4d68ff01364 100644 --- a/crates/stateless/src/lib.rs +++ b/crates/stateless/src/lib.rs @@ -50,8 +50,6 @@ pub use alloy_genesis::Genesis; pub mod validation; pub(crate) mod witness_db; -pub mod chain_spec; - #[doc(inline)] pub use alloy_rpc_types_debug::ExecutionWitness; diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 56d413901ee..19a67e94eca 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -2,14 +2,10 @@ use crate::{assert::assert_equal, Error}; use alloy_consensus::Header as RethHeader; -use alloy_eips::{ - eip4895::Withdrawals, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, BlobScheduleBlobParams, -}; -use alloy_genesis::{ChainConfig, Genesis, GenesisAccount}; +use alloy_eips::eip4895::Withdrawals; +use alloy_genesis::GenesisAccount; use alloy_primitives::{keccak256, Address, Bloom, Bytes, B256, B64, U256}; -use reth_chainspec::{ - Chain, ChainHardforks, ChainSpec, ChainSpecBuilder, EthereumHardfork, ForkCondition, -}; +use reth_chainspec::{ChainSpec, ChainSpecBuilder}; use reth_db_api::{cursor::DbDupCursorRO, tables, transaction::DbTx}; use reth_primitives_traits::SealedHeader; use serde::Deserialize; @@ -353,51 +349,6 @@ impl From for ChainSpec { } } -impl From for reth_stateless::chain_spec::ChainSpec { - fn from(fork_spec: ForkSpec) -> Self { - // We initialize with empty genesis since we only use hardforks from the constructed ChainSpec. - let spec_builder = - ChainSpecBuilder::default().genesis(Genesis::default()).chain(Chain::mainnet()); - - let hardforks = match fork_spec { - ForkSpec::Frontier => spec_builder.frontier_activated(), - ForkSpec::Homestead | ForkSpec::FrontierToHomesteadAt5 => { - spec_builder.homestead_activated() - } - ForkSpec::EIP150 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => { - spec_builder.tangerine_whistle_activated() - } - ForkSpec::EIP158 => spec_builder.spurious_dragon_activated(), - ForkSpec::Byzantium - | ForkSpec::EIP158ToByzantiumAt5 - | ForkSpec::ConstantinopleFix - | ForkSpec::ByzantiumToConstantinopleFixAt5 => spec_builder.byzantium_activated(), - ForkSpec::Istanbul => spec_builder.istanbul_activated(), - ForkSpec::Berlin => spec_builder.berlin_activated(), - ForkSpec::London | ForkSpec::BerlinToLondonAt5 => spec_builder.london_activated(), - ForkSpec::Merge - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 => spec_builder.paris_activated(), - ForkSpec::Shanghai => spec_builder.shanghai_activated(), - ForkSpec::Cancun => spec_builder.cancun_activated(), - ForkSpec::ByzantiumToConstantinopleAt5 | ForkSpec::Constantinople => { - panic!("Overridden with PETERSBURG") - } - ForkSpec::Prague => spec_builder.prague_activated(), - } - .build() - .hardforks; - - Self { - chain: Chain::mainnet(), - hardforks, - deposit_contract_address: Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), - blob_params: BlobScheduleBlobParams::default(), - } - } -} - /// Possible seal engines. #[derive(Debug, PartialEq, Eq, Default, Deserialize)] pub enum SealEngine { From cb47abfdbc2f2f92dd1f0db6058b58740e6e4607 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Aug 2025 09:47:39 -0300 Subject: [PATCH 38/55] improvements Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 46 ++++++++++++++++++++-------------- crates/stateless/Cargo.toml | 1 - testing/ef-tests/src/models.rs | 1 + 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 5bfef2111b7..1a855442a00 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -16,7 +16,7 @@ use alloy_consensus::{ }; use alloy_eips::{ eip1559::INITIAL_BASE_FEE, eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS, -eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams, + eip7685::EMPTY_REQUESTS_HASH, eip7892::BlobScheduleBlobParams, }; use alloy_genesis::{ChainConfig, Genesis}; use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256}; @@ -91,12 +91,12 @@ pub static MAINNET: LazyLock> = LazyLock::new(|| { let mut genesis: Genesis = serde_json::from_str(include_str!("../res/genesis/mainnet.json")) .expect("Can't deserialize Mainnet genesis json"); let hardforks = EthereumHardfork::mainnet().into(); -fill_genesis_config( -&mut genesis.config, -&hardforks, -Some(Chain::mainnet()), + fill_chainconfig( + &mut genesis.config, + &hardforks, + Some(Chain::mainnet()), Some(MAINNET_DEPOSIT_CONTRACT_ADDRESS), -); + ); let mut spec = ChainSpec { chain: Chain::mainnet(), genesis_header: SealedHeader::new( @@ -391,7 +391,7 @@ impl ChainSpec { // given timestamp. for (fork, params) in bf_params.iter().rev() { if self.hardforks.is_fork_active_at_timestamp(fork.clone(), timestamp) { - return *params + return *params; } } @@ -410,7 +410,7 @@ impl ChainSpec { // given timestamp. for (fork, params) in bf_params.iter().rev() { if self.hardforks.is_fork_active_at_block(fork.clone(), block_number) { - return *params + return *params; } } @@ -484,8 +484,8 @@ impl ChainSpec { // We filter out TTD-based forks w/o a pre-known block since those do not show up in the // fork filter. Some(match condition { - ForkCondition::Block(block) | - ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), + ForkCondition::Block(block) + | ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), ForkCondition::Timestamp(time) => ForkFilterKey::Time(time), _ => return None, }) @@ -512,8 +512,8 @@ impl ChainSpec { for (_, cond) in self.hardforks.forks_iter() { // handle block based forks and the sepolia merge netsplit block edge case (TTD // ForkCondition with Some(block)) - if let ForkCondition::Block(block) | - ForkCondition::TTD { fork_block: Some(block), .. } = cond + if let ForkCondition::Block(block) + | ForkCondition::TTD { fork_block: Some(block), .. } = cond { if head.number >= block { // skip duplicated hardforks: hardforks enabled at genesis block @@ -524,7 +524,7 @@ impl ChainSpec { } else { // we can return here because this block fork is not active, so we set the // `next` value - return ForkId { hash: forkhash, next: block } + return ForkId { hash: forkhash, next: block }; } } } @@ -546,7 +546,7 @@ impl ChainSpec { // can safely return here because we have already handled all block forks and // have handled all active timestamp forks, and set the next value to the // timestamp that is known but not active yet - return ForkId { hash: forkhash, next: timestamp } + return ForkId { hash: forkhash, next: timestamp }; } } @@ -791,6 +791,7 @@ pub struct ChainSpecBuilder { chain: Option, genesis: Option, hardforks: ChainHardforks, + fill_genesis_config: bool, } impl ChainSpecBuilder { @@ -800,6 +801,7 @@ impl ChainSpecBuilder { chain: Some(MAINNET.chain), genesis: Some(MAINNET.genesis.clone()), hardforks: MAINNET.hardforks.clone(), + fill_genesis_config: true, } } } @@ -956,6 +958,12 @@ impl ChainSpecBuilder { self } + /// Enable overriding genesis chain configuration from defined hardforks. + pub const fn fill_genesis_config(mut self, enable: bool) -> Self { + self.fill_genesis_config = enable; + self + } + /// Build the resulting [`ChainSpec`]. /// /// # Panics @@ -973,7 +981,9 @@ impl ChainSpecBuilder { }) }; let mut genesis = self.genesis.expect("The genesis is required"); - fill_genesis_config(&mut genesis.config, &self.hardforks, self.chain, None); + if self.fill_genesis_config { + fill_chainconfig(&mut genesis.config, &self.hardforks, self.chain, None); + } ChainSpec { chain: self.chain.expect("The chain is required"), genesis_header: SealedHeader::new_unhashed(make_genesis_header( @@ -989,7 +999,7 @@ impl ChainSpecBuilder { } } -fn fill_genesis_config( +fn fill_chainconfig( cfg: &mut ChainConfig, hardforks: &ChainHardforks, chain: Option, @@ -1016,11 +1026,8 @@ fn fill_genesis_config( cfg.homestead_block = get_block(EthereumHardfork::Homestead); cfg.dao_fork_block = get_block(EthereumHardfork::Dao); cfg.dao_fork_support = cfg.dao_fork_block.is_some(); - // TODO: why there isn't a consolidated Tangerine Whistle fork? cfg.eip150_block = get_block(EthereumHardfork::Tangerine); cfg.eip158_block = get_block(EthereumHardfork::Tangerine); - // TODO: why there isn't a Spurious Dragon fork? - // More EIPs than EIP-155 were activated there, see: https://ethereum.org/en/history/#spurious-dragon cfg.eip155_block = get_block(EthereumHardfork::SpuriousDragon); cfg.byzantium_block = get_block(EthereumHardfork::Byzantium); cfg.constantinople_block = get_block(EthereumHardfork::Constantinople); @@ -1054,6 +1061,7 @@ impl From<&Arc> for ChainSpecBuilder { chain: Some(value.chain), genesis: Some(value.genesis.clone()), hardforks: value.hardforks.clone(), + fill_genesis_config: false, } } } diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index 15cc8e2e046..2e431c5fd5c 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -18,7 +18,6 @@ alloy-rlp.workspace = true alloy-trie.workspace = true alloy-consensus.workspace = true alloy-rpc-types-debug.workspace = true -alloy-eips.workspace = true alloy-genesis = { workspace = true, features = ["serde-bincode-compat"] } # reth diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 19a67e94eca..81e867b99dd 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -343,6 +343,7 @@ impl From for ChainSpec { } ForkSpec::Prague => spec_builder.prague_activated(), } + .fill_genesis_config(true) .build(); chain_spec From e5eac83c9a623a9b18557dbf875ff4595ea98fd1 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Aug 2025 10:03:32 -0300 Subject: [PATCH 39/55] add glacier forks Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 1a855442a00..661905cedd6 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -902,9 +902,16 @@ impl ChainSpecBuilder { self } + /// Enable Muir Glacier at genesis. + pub fn muirglacier_activated(mut self) -> Self { + self = self.istanbul_activated(); + self.hardforks.insert(EthereumHardfork::MuirGlacier, ForkCondition::Block(0)); + self + } + /// Enable Berlin at genesis. pub fn berlin_activated(mut self) -> Self { - self = self.istanbul_activated(); + self = self.muirglacier_activated(); self.hardforks.insert(EthereumHardfork::Berlin, ForkCondition::Block(0)); self } @@ -916,9 +923,23 @@ impl ChainSpecBuilder { self } + /// Enable Arrow Glacier at genesis. + pub fn arrowglacier_activated(mut self) -> Self { + self = self.london_activated(); + self.hardforks.insert(EthereumHardfork::ArrowGlacier, ForkCondition::Block(0)); + self + } + + /// Enable Gray Glacier at genesis. + pub fn grayglacier_activated(mut self) -> Self { + self = self.arrowglacier_activated(); + self.hardforks.insert(EthereumHardfork::GrayGlacier, ForkCondition::Block(0)); + self + } + /// Enable Paris at genesis. pub fn paris_activated(mut self) -> Self { - self = self.london_activated(); + self = self.grayglacier_activated(); self.hardforks.insert( EthereumHardfork::Paris, ForkCondition::TTD { From 8444a3ea99d960e2f6e054e8ec1d71c0f198534c Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Aug 2025 10:05:56 -0300 Subject: [PATCH 40/55] add missing dao fork Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 661905cedd6..4217cce4784 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -853,9 +853,16 @@ impl ChainSpecBuilder { self } + /// Enable Dao at genesis. + pub fn dao_activated(mut self) -> Self { + self = self.frontier_activated(); + self.hardforks.insert(EthereumHardfork::Dao, ForkCondition::Block(0)); + self + } + /// Enable Homestead at genesis. pub fn homestead_activated(mut self) -> Self { - self = self.frontier_activated(); + self = self.dao_activated(); self.hardforks.insert(EthereumHardfork::Homestead, ForkCondition::Block(0)); self } From f17c70c23056cadd7f42ee7c4502f72078d2a118 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Aug 2025 10:32:24 -0300 Subject: [PATCH 41/55] not required activation since we build from mainnet Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/models.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 81e867b99dd..19a67e94eca 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -343,7 +343,6 @@ impl From for ChainSpec { } ForkSpec::Prague => spec_builder.prague_activated(), } - .fill_genesis_config(true) .build(); chain_spec From 0898f5486fc3b8f7d786727b31484f5552af2aff Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 10:57:11 -0300 Subject: [PATCH 42/55] refactor and support partial witness Signed-off-by: Ignacio Hagopian --- Cargo.lock | 2 +- crates/evm/evm/src/execute.rs | 17 +++ crates/stateless/Cargo.toml | 2 - testing/ef-tests/src/cases/blockchain_test.rs | 142 +++++++++--------- testing/ef-tests/src/result.rs | 8 +- 5 files changed, 97 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9924d102805..3fb44b86400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10312,6 +10312,7 @@ name = "reth-stateless" version = "1.6.0" dependencies = [ "alloy-consensus", + "alloy-genesis", "alloy-primitives", "alloy-rlp", "alloy-rpc-types-debug", @@ -10330,7 +10331,6 @@ dependencies = [ "serde", "serde_with", "thiserror 2.0.12", - "tracing", ] [[package]] diff --git a/crates/evm/evm/src/execute.rs b/crates/evm/evm/src/execute.rs index 882bf1ba6f4..a233a485320 100644 --- a/crates/evm/evm/src/execute.rs +++ b/crates/evm/evm/src/execute.rs @@ -108,6 +108,23 @@ pub trait Executor: Sized { Ok(BlockExecutionOutput { state: state.take_bundle(), result }) } + /// Executes the EVM with the given input and accepts a state closure that is always invoked with + /// the EVM state after execution, even after failure. + fn execute_with_state_closure_always( + mut self, + block: &RecoveredBlock<::Block>, + mut f: F, + ) -> Result::Receipt>, Self::Error> + where + F: FnMut(&State), + { + let result = self.execute_one(block); + let mut state = self.into_state(); + f(&state); + + Ok(BlockExecutionOutput { state: state.take_bundle(), result: result? }) + } + /// Executes the EVM with the given input and accepts a state hook closure that is invoked with /// the EVM state after execution. fn execute_with_state_hook( diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index 2e431c5fd5c..d826e2f375a 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -31,8 +31,6 @@ reth-trie-common.workspace = true reth-trie-sparse.workspace = true reth-chainspec.workspace = true reth-consensus.workspace = true -reth-network-peers.workspace = true -tracing.workspace = true # misc thiserror.workspace = true diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 4dc167e2285..e625706246a 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -49,6 +49,7 @@ impl Suite for BlockchainTests { /// An Ethereum blockchain test. #[derive(Debug, PartialEq, Eq)] pub struct BlockchainTestCase { + /// The individual tests within this test case. pub tests: BTreeMap, skip: bool, } @@ -58,12 +59,12 @@ impl BlockchainTestCase { const fn excluded_fork(network: ForkSpec) -> bool { matches!( network, - ForkSpec::ByzantiumToConstantinopleAt5 | - ForkSpec::Constantinople | - ForkSpec::ConstantinopleFix | - ForkSpec::MergeEOF | - ForkSpec::MergeMeterInitCode | - ForkSpec::MergePush0 + ForkSpec::ByzantiumToConstantinopleAt5 + | ForkSpec::Constantinople + | ForkSpec::ConstantinopleFix + | ForkSpec::MergeEOF + | ForkSpec::MergeMeterInitCode + | ForkSpec::MergePush0 ) } @@ -92,38 +93,43 @@ impl BlockchainTestCase { /// Execute a single `BlockchainTest`, validating the outcome against the /// expectations encoded in the JSON file. - fn run_single_case(name: &str, case: &BlockchainTest) -> Result<(), Error> { + pub fn run_single_case( + name: &str, + case: &BlockchainTest, + ) -> Result, ExecutionWitness)>, Error> { let expectation = Self::expected_failure(case); match run_case(case) { // All blocks executed successfully. - Ok(_) => { + Ok(program_inputs) => { // Check if the test case specifies that it should have failed if let Some((block, msg)) = expectation { Err(Error::Assertion(format!( "Test case: {name}\nExpected failure at block {block} - {msg}, but all blocks succeeded", ))) } else { - Ok(()) + Ok(program_inputs) } } // A block processing failure occurred. - err @ Err(Error::BlockProcessingFailed { block_number, .. }) => match expectation { - // It happened on exactly the block we were told to fail on - Some((expected, _)) if block_number == expected => Ok(()), - - // Uncle side‑chain edge case, we accept as long as it failed. - // But we don't check the exact block number. - _ if Self::is_uncle_sidechain_case(name) => Ok(()), - - // Expected failure, but block number does not match - Some((expected, _)) => Err(Error::Assertion(format!( - "Test case: {name}\nExpected failure at block {expected}\nGot failure at block {block_number}", - ))), - - // No failure expected at all - bubble up original error. - None => Err(err.unwrap_err()), - }, + Err(Error::BlockProcessingFailed { block_number, partial_program_inputs, err }) => { + match expectation { + // It happened on exactly the block we were told to fail on + Some((expected, _)) if block_number == expected => Ok(partial_program_inputs), + + // Uncle side‑chain edge case, we accept as long as it failed. + // But we don't check the exact block number. + _ if Self::is_uncle_sidechain_case(name) => Ok(partial_program_inputs), + + // Expected failure, but block number does not match + Some((expected, _)) => Err(Error::Assertion(format!( + "Test case: {name}\nExpected failure at block {expected}\nGot failure at block {block_number}", + ))), + + // No failure expected at all - bubble up original error. + None => Err(Error::BlockProcessingFailed { block_number, partial_program_inputs, err }), + } + } // Non‑processing error – forward as‑is. // @@ -157,7 +163,7 @@ impl Case for BlockchainTestCase { fn run(&self) -> Result<(), Error> { // If the test is marked for skipping, return a Skipped error immediately. if self.skip { - return Err(Error::Skipped) + return Err(Error::Skipped); } // Iterate through test cases, filtering by the network type to exclude specific forks. @@ -165,14 +171,13 @@ impl Case for BlockchainTestCase { .iter() .filter(|(_, case)| !Self::excluded_fork(case.network)) .par_bridge() - .try_for_each(|(name, case)| Self::run_single_case(name, case))?; + .try_for_each(|(name, case)| Self::run_single_case(name, case).map(|_| ()))?; Ok(()) } } -/// Executes a single `BlockchainTest`, returning an error if the blockchain state -/// does not match the expected outcome after all blocks are executed. +/// Executes a single `BlockchainTest` returning an error as soon as any block has a consensus validation failure. /// /// A `BlockchainTest` represents a self-contained scenario: /// - It initializes a fresh blockchain state. @@ -181,9 +186,10 @@ impl Case for BlockchainTestCase { /// outcome. /// /// Returns: -/// - `Ok(())` if all blocks execute successfully and the final state is correct. -/// - `Err(Error)` if any block fails to execute correctly, or if the post-state validation fails. -pub fn run_case( +/// - `Ok(_)` if all blocks execute successfully, returning recovered blocks and full block execution witness. +/// - `Err(Error)` if any block fails to execute correctly, returning a partial block execution witness if the +/// error is of variant `BlockProcessingFailed`. +fn run_case( case: &BlockchainTest, ) -> Result, ExecutionWitness)>, Error> { // Create a new test database and initialize a provider for the test case. @@ -199,24 +205,40 @@ pub fn run_case( .try_recover() .unwrap(); + let mut program_inputs = Vec::new(); + provider .insert_block(genesis_block.clone(), StorageLocation::Database) - .map_err(|err| Error::block_failed(0, err))?; + .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; let genesis_state = case.pre.clone().into_genesis_state(); insert_genesis_state(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, err))?; + .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; insert_genesis_hashes(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, err))?; + .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; insert_genesis_history(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, err))?; + .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; // Decode blocks - let blocks = decode_blocks(&case.blocks)?; + let mut blocks = Vec::with_capacity(case.blocks.len()); + for (block_index, block) in case.blocks.iter().enumerate() { + // The blocks do not include the genesis block which is why we have the plus one. + // We also cannot use block.number because for invalid blocks, this may be incorrect. + let block_number = (block_index + 1) as u64; + + let decoded = SealedBlock::::decode(&mut block.rlp.as_ref()) + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + + let recovered_block = decoded + .clone() + .try_recover() + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + + blocks.push(recovered_block); + } let executor_provider = EthEvmConfig::ethereum(chain_spec.clone()); let mut parent = genesis_block; - let mut program_inputs = Vec::new(); for (block_index, block) in blocks.iter().enumerate() { // Note: same as the comment on `decode_blocks` as to why we cannot use block.number @@ -225,11 +247,11 @@ pub fn run_case( // Insert the block into the database provider .insert_block(block.clone(), StorageLocation::Database) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; // Consensus checks before block execution pre_execution_checks(chain_spec.clone(), &parent, block) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; let mut witness_record = ExecutionWitnessRecord::default(); @@ -239,14 +261,14 @@ pub fn run_case( let executor = executor_provider.batch_executor(state_db); let output = executor - .execute_with_state_closure(&(*block).clone(), |statedb: &State<_>| { + .execute_with_state_closure_always(&(*block).clone(), |statedb: &State<_>| { witness_record.record_executed_state(statedb); }) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; // Consensus checks after block execution validate_block_post_execution(block, &chain_spec, &output.receipts, &output.requests) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; // Generate the stateless witness // TODO: Most of this code is copy-pasted from debug_executionWitness @@ -280,12 +302,13 @@ pub fn run_case( HashedPostState::from_bundle_state::(output.state.state()); let (computed_state_root, _) = StateRoot::overlay_root_with_updates(provider.tx_ref(), hashed_state.clone()) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; if computed_state_root != block.state_root { return Err(Error::block_failed( block_number, + program_inputs.clone(), Error::Assertion("state root mismatch".to_string()), - )) + )); } // Commit the post state/state diff to the database @@ -295,14 +318,14 @@ pub fn run_case( OriginalValuesKnown::Yes, StorageLocation::Database, ) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; provider .write_hashed_state(&hashed_state.into_sorted()) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; provider .update_history_indices(block.number..=block.number) - .map_err(|err| Error::block_failed(block_number, err))?; + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; // Since there were no errors, update the parent block parent = block.clone() @@ -342,27 +365,6 @@ pub fn run_case( Ok(program_inputs) } -fn decode_blocks( - test_case_blocks: &[crate::models::Block], -) -> Result>, Error> { - let mut blocks = Vec::with_capacity(test_case_blocks.len()); - for (block_index, block) in test_case_blocks.iter().enumerate() { - // The blocks do not include the genesis block which is why we have the plus one. - // We also cannot use block.number because for invalid blocks, this may be incorrect. - let block_number = (block_index + 1) as u64; - - let decoded = SealedBlock::::decode(&mut block.rlp.as_ref()) - .map_err(|err| Error::block_failed(block_number, err))?; - - let recovered_block = - decoded.clone().try_recover().map_err(|err| Error::block_failed(block_number, err))?; - - blocks.push(recovered_block); - } - - Ok(blocks) -} - fn pre_execution_checks( chain_spec: Arc, parent: &RecoveredBlock, @@ -449,4 +451,4 @@ pub fn should_skip(path: &Path) -> bool { fn path_contains(path_str: &str, rhs: &[&str]) -> bool { let rhs = rhs.join(std::path::MAIN_SEPARATOR_STR); path_str.contains(&rhs) -} \ No newline at end of file +} diff --git a/testing/ef-tests/src/result.rs b/testing/ef-tests/src/result.rs index f53a4fab256..861f82ec00f 100644 --- a/testing/ef-tests/src/result.rs +++ b/testing/ef-tests/src/result.rs @@ -2,7 +2,10 @@ use crate::Case; use reth_db::DatabaseError; +use reth_ethereum_primitives::Block; +use reth_primitives_traits::RecoveredBlock; use reth_provider::ProviderError; +use reth_stateless::ExecutionWitness; use std::path::{Path, PathBuf}; use thiserror::Error; @@ -27,6 +30,8 @@ pub enum Error { BlockProcessingFailed { /// The block number for the block that failed block_number: u64, + /// The partial program inputs up to and including the block that failed + partial_program_inputs: Vec<(RecoveredBlock, ExecutionWitness)>, /// The specific error #[source] err: Box, @@ -70,9 +75,10 @@ impl Error { /// Create a new [`Error::BlockProcessingFailed`] error. pub fn block_failed( block_number: u64, + partial_program_inputs: Vec<(RecoveredBlock, ExecutionWitness)>, err: impl std::error::Error + Send + Sync + 'static, ) -> Self { - Self::BlockProcessingFailed { block_number, err: Box::new(err) } + Self::BlockProcessingFailed { block_number, partial_program_inputs, err: Box::new(err) } } } From d0b39b2d2a6f4f6c005932027373f1c61a0afa08 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 12:31:48 -0300 Subject: [PATCH 43/55] fix Signed-off-by: Ignacio Hagopian --- Cargo.lock | 1 + crates/stateless/Cargo.toml | 1 + testing/ef-tests/src/cases/blockchain_test.rs | 28 ++++++++++--------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fb44b86400..244e0a488ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10331,6 +10331,7 @@ dependencies = [ "serde", "serde_with", "thiserror 2.0.12", + "tracing", ] [[package]] diff --git a/crates/stateless/Cargo.toml b/crates/stateless/Cargo.toml index d826e2f375a..4dc16ecd8ef 100644 --- a/crates/stateless/Cargo.toml +++ b/crates/stateless/Cargo.toml @@ -37,3 +37,4 @@ thiserror.workspace = true itertools.workspace = true serde.workspace = true serde_with.workspace = true +tracing.workspace = true diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index e625706246a..58143eaf240 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -205,19 +205,17 @@ fn run_case( .try_recover() .unwrap(); - let mut program_inputs = Vec::new(); - provider .insert_block(genesis_block.clone(), StorageLocation::Database) - .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(0, Default::default(), err))?; let genesis_state = case.pre.clone().into_genesis_state(); insert_genesis_state(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(0, Default::default(), err))?; insert_genesis_hashes(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(0, Default::default(), err))?; insert_genesis_history(&provider, genesis_state.iter()) - .map_err(|err| Error::block_failed(0, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(0, Default::default(), err))?; // Decode blocks let mut blocks = Vec::with_capacity(case.blocks.len()); @@ -227,16 +225,17 @@ fn run_case( let block_number = (block_index + 1) as u64; let decoded = SealedBlock::::decode(&mut block.rlp.as_ref()) - .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; let recovered_block = decoded .clone() .try_recover() - .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; blocks.push(recovered_block); } + let mut program_inputs = Vec::new(); let executor_provider = EthEvmConfig::ethereum(chain_spec.clone()); let mut parent = genesis_block; @@ -245,13 +244,16 @@ fn run_case( let block_number = (block_index + 1) as u64; // Insert the block into the database - provider - .insert_block(block.clone(), StorageLocation::Database) - .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + provider.insert_block(block.clone(), StorageLocation::Database).map_err(|err| { + program_inputs.push((block.clone(), Default::default())); + Error::block_failed(block_number, program_inputs.clone(), err) + })?; // Consensus checks before block execution - pre_execution_checks(chain_spec.clone(), &parent, block) - .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + pre_execution_checks(chain_spec.clone(), &parent, block).map_err(|err| { + program_inputs.push((block.clone(), Default::default())); + Error::block_failed(block_number, program_inputs.clone(), err) + })?; let mut witness_record = ExecutionWitnessRecord::default(); From ce02bb3980cdf94edce0ffdd5377bb2bb6261913 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 12:53:08 -0300 Subject: [PATCH 44/55] more fixes Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 58143eaf240..55bf7c080e6 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -4,6 +4,7 @@ use crate::{ models::{BlockchainTest, ForkSpec}, Case, Error, Suite, }; +use alloy_primitives::Bytes; use alloy_rlp::{Decodable, Encodable}; use rayon::iter::{ParallelBridge, ParallelIterator}; use reth_chainspec::ChainSpec; @@ -235,9 +236,9 @@ fn run_case( blocks.push(recovered_block); } - let mut program_inputs = Vec::new(); let executor_provider = EthEvmConfig::ethereum(chain_spec.clone()); let mut parent = genesis_block; + let mut program_inputs = Vec::new(); for (block_index, block) in blocks.iter().enumerate() { // Note: same as the comment on `decode_blocks` as to why we cannot use block.number @@ -251,7 +252,12 @@ fn run_case( // Consensus checks before block execution pre_execution_checks(chain_spec.clone(), &parent, block).map_err(|err| { - program_inputs.push((block.clone(), Default::default())); + let mut serialized_header = Vec::new(); + parent.encode(&mut serialized_header); + program_inputs.push(( + block.clone(), + ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() }, + )); Error::block_failed(block_number, program_inputs.clone(), err) })?; From bda864437226f30dce6390c4b77418e430ea8a41 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 13:06:24 -0300 Subject: [PATCH 45/55] fix Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 55bf7c080e6..e27c8aa2ce4 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -253,7 +253,7 @@ fn run_case( // Consensus checks before block execution pre_execution_checks(chain_spec.clone(), &parent, block).map_err(|err| { let mut serialized_header = Vec::new(); - parent.encode(&mut serialized_header); + parent.header().encode(&mut serialized_header); program_inputs.push(( block.clone(), ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() }, From e203403b6eda754db6350c095fe822efb799c714 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 13:30:30 -0300 Subject: [PATCH 46/55] consensus failure fix Signed-off-by: Ignacio Hagopian --- crates/stateless/src/validation.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/stateless/src/validation.rs b/crates/stateless/src/validation.rs index c60afc491d5..3f784640c89 100644 --- a/crates/stateless/src/validation.rs +++ b/crates/stateless/src/validation.rs @@ -21,7 +21,9 @@ use reth_errors::ConsensusError; use reth_ethereum_consensus::{validate_block_post_execution, EthBeaconConsensus}; use reth_ethereum_primitives::{Block, EthPrimitives}; use reth_evm::{execute::Executor, ConfigureEvm}; -use reth_primitives_traits::{block::error::BlockRecoveryError, Block as _, RecoveredBlock}; +use reth_primitives_traits::{ + block::error::BlockRecoveryError, Block as _, RecoveredBlock, SealedHeader, +}; use reth_trie_common::{HashedPostState, KeccakKeyHasher}; /// Errors that can occur during stateless validation. @@ -188,7 +190,11 @@ where ancestor_headers.sort_by_key(|header| header.number()); // Validate block against pre-execution consensus rules - validate_block_consensus(chain_spec.clone(), ¤t_block)?; + let parent = match ancestor_headers.last() { + Some(prev_header) => SealedHeader::new_unhashed(prev_header.clone()), + None => return Err(StatelessValidationError::MissingAncestorHeader), + }; + validate_block_consensus(chain_spec.clone(), ¤t_block, &parent)?; // Check that the ancestor headers form a contiguous chain and are not just random headers. let ancestor_hashes = compute_ancestor_hashes(¤t_block, &ancestor_headers)?; @@ -205,9 +211,7 @@ where }; // First verify that the pre-state reads are correct - let (mut trie, bytecode) = - track_cycles!("verify_witness", T::new(&witness, pre_state_root)?); - + let (mut trie, bytecode) = track_cycles!("verify_witness", T::new(&witness, pre_state_root)?); // Create an in-memory database that will use the reads to validate the block let db = WitnessDatabase::new(&trie, bytecode, ancestor_hashes); @@ -264,6 +268,7 @@ where fn validate_block_consensus( chain_spec: Arc, block: &RecoveredBlock, + parent: &SealedHeader
, ) -> Result<(), StatelessValidationError> where ChainSpec: Send + Sync + EthChainSpec
+ EthereumHardforks + Debug, @@ -271,6 +276,7 @@ where let consensus = EthBeaconConsensus::new(chain_spec); consensus.validate_header(block.sealed_header())?; + consensus.validate_header_against_parent(block.sealed_header(), parent)?; consensus.validate_block_pre_execution(block)?; From dd3adc369e65218dbc5d207032edbfabe872a1d8 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 16:33:21 -0300 Subject: [PATCH 47/55] improvements Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index e27c8aa2ce4..4e2d83b3f92 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -4,7 +4,6 @@ use crate::{ models::{BlockchainTest, ForkSpec}, Case, Error, Suite, }; -use alloy_primitives::Bytes; use alloy_rlp::{Decodable, Encodable}; use rayon::iter::{ParallelBridge, ParallelIterator}; use reth_chainspec::ChainSpec; @@ -219,22 +218,7 @@ fn run_case( .map_err(|err| Error::block_failed(0, Default::default(), err))?; // Decode blocks - let mut blocks = Vec::with_capacity(case.blocks.len()); - for (block_index, block) in case.blocks.iter().enumerate() { - // The blocks do not include the genesis block which is why we have the plus one. - // We also cannot use block.number because for invalid blocks, this may be incorrect. - let block_number = (block_index + 1) as u64; - - let decoded = SealedBlock::::decode(&mut block.rlp.as_ref()) - .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; - - let recovered_block = decoded - .clone() - .try_recover() - .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; - - blocks.push(recovered_block); - } + let blocks = decode_blocks(&case.blocks)?; let executor_provider = EthEvmConfig::ethereum(chain_spec.clone()); let mut parent = genesis_block; @@ -373,6 +357,28 @@ fn run_case( Ok(program_inputs) } +fn decode_blocks( + test_case_blocks: &[crate::models::Block], +) -> Result>, Error> { + let mut blocks = Vec::with_capacity(test_case_blocks.len()); + for (block_index, block) in test_case_blocks.iter().enumerate() { + // The blocks do not include the genesis block which is why we have the plus one. + // We also cannot use block.number because for invalid blocks, this may be incorrect. + let block_number = (block_index + 1) as u64; + + let decoded = SealedBlock::::decode(&mut block.rlp.as_ref()) + .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; + + let recovered_block = decoded + .clone() + .try_recover() + .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; + + blocks.push(recovered_block); + } + Ok(blocks) +} + fn pre_execution_checks( chain_spec: Arc, parent: &RecoveredBlock, From 304d73a9eba2efe49bb9905f2ec69b636b4df58a Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 22 Aug 2025 17:03:08 -0300 Subject: [PATCH 48/55] improvement Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 4e2d83b3f92..66164e6af47 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -4,6 +4,7 @@ use crate::{ models::{BlockchainTest, ForkSpec}, Case, Error, Suite, }; +use alloy_primitives::Bytes; use alloy_rlp::{Decodable, Encodable}; use rayon::iter::{ParallelBridge, ParallelIterator}; use reth_chainspec::ChainSpec; @@ -23,7 +24,7 @@ use reth_revm::{database::StateProviderDatabase, witness::ExecutionWitnessRecord use reth_stateless::{validation::stateless_validation, ExecutionWitness}; use reth_trie::{HashedPostState, KeccakKeyHasher, StateRoot}; use reth_trie_db::DatabaseStateRoot; -use std::{collections::BTreeMap, fs, path::Path, sync::Arc}; +use std::{collections::BTreeMap, fs, iter, path::Path, sync::Arc}; /// A handler for the blockchain test suite. #[derive(Debug)] @@ -229,21 +230,21 @@ fn run_case( let block_number = (block_index + 1) as u64; // Insert the block into the database - provider.insert_block(block.clone(), StorageLocation::Database).map_err(|err| { - program_inputs.push((block.clone(), Default::default())); - Error::block_failed(block_number, program_inputs.clone(), err) - })?; + provider + .insert_block(block.clone(), StorageLocation::Database) + .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; + + // Add the parent to the program inputs, since it must be used for the pre-execution checks right after. + let mut serialized_header = Vec::new(); + parent.header().encode(&mut serialized_header); + program_inputs.push(( + block.clone(), + ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() }, + )); // Consensus checks before block execution - pre_execution_checks(chain_spec.clone(), &parent, block).map_err(|err| { - let mut serialized_header = Vec::new(); - parent.header().encode(&mut serialized_header); - program_inputs.push(( - block.clone(), - ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() }, - )); - Error::block_failed(block_number, program_inputs.clone(), err) - })?; + pre_execution_checks(chain_spec.clone(), &parent, block) + .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; let mut witness_record = ExecutionWitnessRecord::default(); @@ -267,17 +268,16 @@ fn run_case( let ExecutionWitnessRecord { hashed_state, codes, keys, lowest_block_number } = witness_record; let state = state_provider.witness(Default::default(), hashed_state)?; - let mut exec_witness = ExecutionWitness { state, codes, keys, headers: Default::default() }; + // Update the already existing execution witness with the new state + let execution_witness = &mut program_inputs.last_mut().unwrap().1; let smallest = lowest_block_number.unwrap_or_else(|| { // Return only the parent header, if there were no calls to the // BLOCKHASH opcode. block_number.saturating_sub(1) }); - - let range = smallest..block_number; - - exec_witness.headers = provider + let range = smallest..block_number - 1; // The parent was already added before pre-execution checks. + let headers: Vec = provider .headers_range(range)? .into_iter() .map(|header| { @@ -285,9 +285,12 @@ fn run_case( header.encode(&mut serialized_header); serialized_header.into() }) - .collect(); - - program_inputs.push((block.clone(), exec_witness)); + .chain(iter::once(execution_witness.headers.first().unwrap().clone())) + .collect::>(); + execution_witness.state = state; + execution_witness.codes = codes; + execution_witness.keys = keys; + execution_witness.headers = headers; // Compute and check the post state root let hashed_state = From 0f3b7fdbdc4c4d9c88607e8f72d651afa2ac3bd4 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 25 Aug 2025 17:08:33 -0300 Subject: [PATCH 49/55] feedback review Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 66164e6af47..c989d949fec 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -234,17 +234,11 @@ fn run_case( .insert_block(block.clone(), StorageLocation::Database) .map_err(|err| Error::block_failed(block_number, Default::default(), err))?; - // Add the parent to the program inputs, since it must be used for the pre-execution checks right after. - let mut serialized_header = Vec::new(); - parent.header().encode(&mut serialized_header); - program_inputs.push(( - block.clone(), - ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() }, - )); - // Consensus checks before block execution - pre_execution_checks(chain_spec.clone(), &parent, block) - .map_err(|err| Error::block_failed(block_number, program_inputs.clone(), err))?; + pre_execution_checks(chain_spec.clone(), &parent, block).map_err(|err| { + program_inputs.push((block.clone(), execution_witness_with_parent(&parent))); + Error::block_failed(block_number, program_inputs.clone(), err) + })?; let mut witness_record = ExecutionWitnessRecord::default(); @@ -268,16 +262,17 @@ fn run_case( let ExecutionWitnessRecord { hashed_state, codes, keys, lowest_block_number } = witness_record; let state = state_provider.witness(Default::default(), hashed_state)?; + let mut exec_witness = ExecutionWitness { state, codes, keys, headers: Default::default() }; - // Update the already existing execution witness with the new state - let execution_witness = &mut program_inputs.last_mut().unwrap().1; let smallest = lowest_block_number.unwrap_or_else(|| { // Return only the parent header, if there were no calls to the // BLOCKHASH opcode. block_number.saturating_sub(1) }); - let range = smallest..block_number - 1; // The parent was already added before pre-execution checks. - let headers: Vec = provider + + let range = smallest..block_number; + + exec_witness.headers = provider .headers_range(range)? .into_iter() .map(|header| { @@ -285,12 +280,9 @@ fn run_case( header.encode(&mut serialized_header); serialized_header.into() }) - .chain(iter::once(execution_witness.headers.first().unwrap().clone())) - .collect::>(); - execution_witness.state = state; - execution_witness.codes = codes; - execution_witness.keys = keys; - execution_witness.headers = headers; + .collect(); + + program_inputs.push((block.clone(), exec_witness)); // Compute and check the post state root let hashed_state = @@ -469,3 +461,9 @@ fn path_contains(path_str: &str, rhs: &[&str]) -> bool { let rhs = rhs.join(std::path::MAIN_SEPARATOR_STR); path_str.contains(&rhs) } + +fn execution_witness_with_parent(parent: &RecoveredBlock) -> ExecutionWitness { + let mut serialized_header = Vec::new(); + parent.header().encode(&mut serialized_header); + ExecutionWitness { headers: vec![serialized_header.into()], ..Default::default() } +} From 63469e9409dd774bb15d1018bfda9ae23b2e8894 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Wed, 10 Sep 2025 14:36:22 -0300 Subject: [PATCH 50/55] fixes --- Cargo.lock | 2 +- testing/ef-tests/src/cases/blockchain_test.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85037137ae8..2293572eba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10377,7 +10377,7 @@ dependencies = [ "reth-trie-sparse", "serde", "serde_with", - "thiserror 2.0.12", + "thiserror 2.0.16", "tracing", ] diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 9de5fa4fa8a..e9bc650ce63 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -347,8 +347,8 @@ fn run_case( // Now validate using the stateless client if everything else passes for (block, execution_witness) in &program_inputs { stateless_validation( - block, - execution_witness, + block.clone(), + execution_witness.clone(), chain_spec.clone(), EthEvmConfig::new(chain_spec.clone()), ) From 18237adc408d8b9e862411a730b80ca20e095968 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 19 Sep 2025 19:33:09 -0300 Subject: [PATCH 51/55] fmt to reduce diff noise Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 8 +++---- crates/evm/evm/src/execute.rs | 4 ++-- testing/ef-tests/src/cases/blockchain_test.rs | 22 ++++++++++--------- testing/ef-tests/src/models.rs | 8 +++---- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index 0d463b8aae5..71f57a72e26 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -462,8 +462,8 @@ impl ChainSpec { // We filter out TTD-based forks w/o a pre-known block since those do not show up in // the fork filter. Some(match condition { - ForkCondition::Block(block) - | ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), + ForkCondition::Block(block) | + ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), ForkCondition::Timestamp(time) => ForkFilterKey::Time(time), _ => return None, }) @@ -490,8 +490,8 @@ impl ChainSpec { for (_, cond) in self.hardforks.forks_iter() { // handle block based forks and the sepolia merge netsplit block edge case (TTD // ForkCondition with Some(block)) - if let ForkCondition::Block(block) - | ForkCondition::TTD { fork_block: Some(block), .. } = cond + if let ForkCondition::Block(block) | + ForkCondition::TTD { fork_block: Some(block), .. } = cond { if head.number >= block { // skip duplicated hardforks: hardforks enabled at genesis block diff --git a/crates/evm/evm/src/execute.rs b/crates/evm/evm/src/execute.rs index df198056397..27a12485c0c 100644 --- a/crates/evm/evm/src/execute.rs +++ b/crates/evm/evm/src/execute.rs @@ -107,8 +107,8 @@ pub trait Executor: Sized { Ok(BlockExecutionOutput { state: state.take_bundle(), result }) } - /// Executes the EVM with the given input and accepts a state closure that is always invoked with - /// the EVM state after execution, even after failure. + /// Executes the EVM with the given input and accepts a state closure that is always invoked + /// with the EVM state after execution, even after failure. fn execute_with_state_closure_always( mut self, block: &RecoveredBlock<::Block>, diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index e9bc650ce63..d4cc963c966 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -65,12 +65,12 @@ impl BlockchainTestCase { const fn excluded_fork(network: ForkSpec) -> bool { matches!( network, - ForkSpec::ByzantiumToConstantinopleAt5 - | ForkSpec::Constantinople - | ForkSpec::ConstantinopleFix - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 + ForkSpec::ByzantiumToConstantinopleAt5 | + ForkSpec::Constantinople | + ForkSpec::ConstantinopleFix | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | + ForkSpec::MergePush0 ) } @@ -183,7 +183,8 @@ impl Case for BlockchainTestCase { } } -/// Executes a single `BlockchainTest` returning an error as soon as any block has a consensus validation failure. +/// Executes a single `BlockchainTest` returning an error as soon as any block has a consensus +/// validation failure. /// /// A `BlockchainTest` represents a self-contained scenario: /// - It initializes a fresh blockchain state. @@ -192,9 +193,10 @@ impl Case for BlockchainTestCase { /// outcome. /// /// Returns: -/// - `Ok(_)` if all blocks execute successfully, returning recovered blocks and full block execution witness. -/// - `Err(Error)` if any block fails to execute correctly, returning a partial block execution witness if the -/// error is of variant `BlockProcessingFailed`. +/// - `Ok(_)` if all blocks execute successfully, returning recovered blocks and full block +/// execution witness. +/// - `Err(Error)` if any block fails to execute correctly, returning a partial block execution +/// witness if the error is of variant `BlockProcessingFailed`. fn run_case( case: &BlockchainTest, ) -> Result, ExecutionWitness)>, Error> { diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 0d10e2bfd80..8604e2a7ab5 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -355,10 +355,10 @@ impl From for ChainSpec { .berlin_activated() .with_fork(EthereumHardfork::London, ForkCondition::Block(5)), ForkSpec::London => spec_builder.london_activated(), - ForkSpec::Merge - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 => spec_builder.paris_activated(), + ForkSpec::Merge | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | + ForkSpec::MergePush0 => spec_builder.paris_activated(), ForkSpec::ParisToShanghaiAtTime15k => spec_builder .paris_activated() .with_fork(EthereumHardfork::Shanghai, ForkCondition::Timestamp(15_000)), From 72ec056f6906fa73f7b6251b373ed49dccd2715d Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 30 Sep 2025 09:00:28 -0300 Subject: [PATCH 52/55] fix merge nit Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 5f3d16e6a57..2ad8a116a5f 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -57,7 +57,6 @@ impl Suite for BlockchainTests { pub struct BlockchainTestCase { /// The individual tests within this test case. pub tests: BTreeMap, - skip: bool, /// Whether to skip this test case. pub skip: bool, } From 54f77a1c602d7193d2fe5cc61f7e513c7b6ca2a6 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 30 Sep 2025 09:34:16 -0300 Subject: [PATCH 53/55] nightly fmt Signed-off-by: Ignacio Hagopian --- crates/chainspec/src/spec.rs | 8 ++++---- testing/ef-tests/src/cases/blockchain_test.rs | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index af3ae6e506d..8598e32698d 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -474,8 +474,8 @@ impl ChainSpec { // We filter out TTD-based forks w/o a pre-known block since those do not show up in // the fork filter. Some(match condition { - ForkCondition::Block(block) - | ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), + ForkCondition::Block(block) | + ForkCondition::TTD { fork_block: Some(block), .. } => ForkFilterKey::Block(block), ForkCondition::Timestamp(time) => ForkFilterKey::Time(time), _ => return None, }) @@ -502,8 +502,8 @@ impl ChainSpec { for (_, cond) in self.hardforks.forks_iter() { // handle block based forks and the sepolia merge netsplit block edge case (TTD // ForkCondition with Some(block)) - if let ForkCondition::Block(block) - | ForkCondition::TTD { fork_block: Some(block), .. } = cond + if let ForkCondition::Block(block) | + ForkCondition::TTD { fork_block: Some(block), .. } = cond { if head.number >= block { // skip duplicated hardforks: hardforks enabled at genesis block diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 2ad8a116a5f..743c63b9122 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -66,12 +66,12 @@ impl BlockchainTestCase { const fn excluded_fork(network: ForkSpec) -> bool { matches!( network, - ForkSpec::ByzantiumToConstantinopleAt5 - | ForkSpec::Constantinople - | ForkSpec::ConstantinopleFix - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 + ForkSpec::ByzantiumToConstantinopleAt5 | + ForkSpec::Constantinople | + ForkSpec::ConstantinopleFix | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | + ForkSpec::MergePush0 ) } From cca0d6063574de934421d71aa9f2e16eeca14828 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 30 Sep 2025 09:36:59 -0300 Subject: [PATCH 54/55] remove nit differences Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index 743c63b9122..d1fd28485f6 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -4,7 +4,6 @@ use crate::{ models::{BlockchainTest, ForkSpec}, Case, Error, Suite, }; -use alloy_primitives::Bytes; use alloy_rlp::{Decodable, Encodable}; use rayon::iter::{ParallelBridge, ParallelIterator}; use reth_chainspec::ChainSpec; @@ -55,7 +54,7 @@ impl Suite for BlockchainTests { /// An Ethereum blockchain test. #[derive(Debug, PartialEq, Eq)] pub struct BlockchainTestCase { - /// The individual tests within this test case. + /// The tests within this test case. pub tests: BTreeMap, /// Whether to skip this test case. pub skip: bool, @@ -66,12 +65,12 @@ impl BlockchainTestCase { const fn excluded_fork(network: ForkSpec) -> bool { matches!( network, - ForkSpec::ByzantiumToConstantinopleAt5 | - ForkSpec::Constantinople | - ForkSpec::ConstantinopleFix | - ForkSpec::MergeEOF | - ForkSpec::MergeMeterInitCode | - ForkSpec::MergePush0 + ForkSpec::ByzantiumToConstantinopleAt5 + | ForkSpec::Constantinople + | ForkSpec::ConstantinopleFix + | ForkSpec::MergeEOF + | ForkSpec::MergeMeterInitCode + | ForkSpec::MergePush0 ) } @@ -389,6 +388,7 @@ fn decode_blocks( blocks.push(recovered_block); } + Ok(blocks) } From bb7a98e4f9a173d19e2e218126e9bfe344201b8d Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 30 Sep 2025 09:38:17 -0300 Subject: [PATCH 55/55] fmt Signed-off-by: Ignacio Hagopian --- testing/ef-tests/src/cases/blockchain_test.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testing/ef-tests/src/cases/blockchain_test.rs b/testing/ef-tests/src/cases/blockchain_test.rs index d1fd28485f6..0526efaa6ef 100644 --- a/testing/ef-tests/src/cases/blockchain_test.rs +++ b/testing/ef-tests/src/cases/blockchain_test.rs @@ -65,12 +65,12 @@ impl BlockchainTestCase { const fn excluded_fork(network: ForkSpec) -> bool { matches!( network, - ForkSpec::ByzantiumToConstantinopleAt5 - | ForkSpec::Constantinople - | ForkSpec::ConstantinopleFix - | ForkSpec::MergeEOF - | ForkSpec::MergeMeterInitCode - | ForkSpec::MergePush0 + ForkSpec::ByzantiumToConstantinopleAt5 | + ForkSpec::Constantinople | + ForkSpec::ConstantinopleFix | + ForkSpec::MergeEOF | + ForkSpec::MergeMeterInitCode | + ForkSpec::MergePush0 ) }