From 52095972cc3fd00fd802ea832b1a19fe5e0e453e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 11 Dec 2025 15:18:28 -0300 Subject: [PATCH 1/3] chore(l1): bump fixtures version --- tooling/ef_tests/blockchain/.fixtures_url | 2 +- tooling/ef_tests/state/.fixtures_url | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tooling/ef_tests/blockchain/.fixtures_url b/tooling/ef_tests/blockchain/.fixtures_url index ea7c838993b..a6c0e88eb35 100644 --- a/tooling/ef_tests/blockchain/.fixtures_url +++ b/tooling/ef_tests/blockchain/.fixtures_url @@ -1 +1 @@ -https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz +https://github.com/ethereum/execution-spec-tests/releases/download/v5.4.0/fixtures_develop.tar.gz diff --git a/tooling/ef_tests/state/.fixtures_url b/tooling/ef_tests/state/.fixtures_url index ea7c838993b..a6c0e88eb35 100644 --- a/tooling/ef_tests/state/.fixtures_url +++ b/tooling/ef_tests/state/.fixtures_url @@ -1 +1 @@ -https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz +https://github.com/ethereum/execution-spec-tests/releases/download/v5.4.0/fixtures_develop.tar.gz From 3aef350eea3577301bf82c1fc95d1207c69d6692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 11 Dec 2025 15:53:43 -0300 Subject: [PATCH 2/3] ci: update daily hive report too --- .github/workflows/daily_hive_report.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily_hive_report.yaml b/.github/workflows/daily_hive_report.yaml index 2bc3c64c658..7d2027355c5 100644 --- a/.github/workflows/daily_hive_report.yaml +++ b/.github/workflows/daily_hive_report.yaml @@ -111,7 +111,7 @@ jobs: run: | FLAGS='--sim.parallelism 4 --sim.loglevel 1' if [[ "$SIMULATION" == "ethereum/eels/consume-engine" || "$SIMULATION" == "ethereum/eels/consume-rlp" ]]; then - FLAGS+=" --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz" + FLAGS+=" --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/v5.4.0/fixtures_develop.tar.gz" FLAGS+=" --sim.buildarg branch=forks/osaka" FLAGS+=" --client.checktimelimit=180s" fi From a51d5051df36c03a6f4f45ad45b134fcd089f113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 18 Dec 2025 15:27:06 -0300 Subject: [PATCH 3/3] Squash merge branch 'main' into l2/check-body-matches-header --- crates/blockchain/blockchain.rs | 14 +++++++---- .../prover/src/guest_program/src/execution.rs | 24 ++++++++++++++----- crates/l2/sequencer/block_producer.rs | 4 ++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/crates/blockchain/blockchain.rs b/crates/blockchain/blockchain.rs index a83b2b46c9b..8e5d3957f6f 100644 --- a/crates/blockchain/blockchain.rs +++ b/crates/blockchain/blockchain.rs @@ -172,7 +172,7 @@ impl Blockchain { let chain_config = self.storage.get_chain_config(); // Validate the block pre-execution - validate_block(block, &parent_header, &chain_config, ELASTICITY_MULTIPLIER)?; + validate_block_pre_execution(block, &parent_header, &chain_config, ELASTICITY_MULTIPLIER)?; let vm_db = StoreVmDatabase::new(self.storage.clone(), parent_header)?; let mut vm = self.new_evm(vm_db)?; @@ -215,7 +215,7 @@ impl Blockchain { let chain_config = self.storage.get_chain_config(); // Validate the block pre-execution - validate_block(block, parent_header, &chain_config, ELASTICITY_MULTIPLIER)?; + validate_block_pre_execution(block, parent_header, &chain_config, ELASTICITY_MULTIPLIER)?; let block_validated_instant = Instant::now(); let exec_merkle_start = Instant::now(); @@ -666,7 +666,7 @@ impl Blockchain { vm: &mut Evm, ) -> Result { // Validate the block pre-execution - validate_block(block, parent_header, chain_config, ELASTICITY_MULTIPLIER)?; + validate_block_pre_execution(block, parent_header, chain_config, ELASTICITY_MULTIPLIER)?; let execution_result = vm.execute_block(block)?; // Validate execution went alright validate_gas_used(&execution_result.receipts, &block.header)?; @@ -1764,9 +1764,13 @@ pub fn find_parent_header( /// Verifies that blob gas fields in the header are correct in reference to the block's body. /// If a block passes this check, execution will still fail with execute_block when a transaction runs out of gas /// -/// Note that this doesn't validate that the transactions or withdrawals root of the header matches the body +/// # WARNING +/// +/// This doesn't validate that the transactions or withdrawals root of the header matches the body /// contents, since we assume the caller already did it. And, in any case, that wouldn't invalidate the block header. -pub fn validate_block( +/// +/// To validate it, use [`ethrex_common::types::block::validate_block_body`] +pub fn validate_block_pre_execution( block: &Block, parent_header: &BlockHeader, chain_config: &ChainConfig, diff --git a/crates/l2/prover/src/guest_program/src/execution.rs b/crates/l2/prover/src/guest_program/src/execution.rs index 29d5c59b95b..01c42077515 100644 --- a/crates/l2/prover/src/guest_program/src/execution.rs +++ b/crates/l2/prover/src/guest_program/src/execution.rs @@ -4,12 +4,12 @@ use crate::report_cycles; use ethrex_blockchain::error::ChainError; use ethrex_blockchain::{ - validate_block, validate_gas_used, validate_receipts_root, validate_requests_hash, - validate_state_root, + validate_block_pre_execution, validate_gas_used, validate_receipts_root, + validate_requests_hash, validate_state_root, }; -use ethrex_common::types::AccountUpdate; use ethrex_common::types::block_execution_witness::ExecutionWitness; use ethrex_common::types::fee_config::FeeConfig; +use ethrex_common::types::{AccountUpdate, InvalidBlockBodyError, validate_block_body}; use ethrex_common::types::{ block_execution_witness::GuestProgramState, block_execution_witness::GuestProgramStateError, }; @@ -35,6 +35,8 @@ use ethrex_l2_common::{ #[derive(Debug, thiserror::Error)] pub enum StatelessExecutionError { + #[error("Block body and header don't match: {0}")] + BlockBodyValidationError(InvalidBlockBodyError), #[error("Block validation error: {0}")] BlockValidationError(ChainError), #[error("Gas validation error: {0}")] @@ -182,9 +184,15 @@ pub fn stateless_validation_l1( let mut non_privileged_count = 0; for block in blocks.iter() { + // Validate header and body match + report_cycles("validate_block_body", || { + validate_block_body(&block.header, &block.body) + .map_err(StatelessExecutionError::BlockBodyValidationError) + })?; + // Validate the block - report_cycles("validate_block", || { - validate_block( + report_cycles("validate_block_pre_execution", || { + validate_block_pre_execution( block, parent_block_header, &chain_config, @@ -402,8 +410,12 @@ fn execute_stateless( let mut non_privileged_count = 0; for (i, block) in blocks.iter().enumerate() { + // Validate header and body match + validate_block_body(&block.header, &block.body) + .map_err(StatelessExecutionError::BlockBodyValidationError)?; + // Validate the block - validate_block( + validate_block_pre_execution( block, parent_block_header, &chain_config, diff --git a/crates/l2/sequencer/block_producer.rs b/crates/l2/sequencer/block_producer.rs index 4fafc965d56..86ca125513a 100644 --- a/crates/l2/sequencer/block_producer.rs +++ b/crates/l2/sequencer/block_producer.rs @@ -10,7 +10,7 @@ use ethrex_blockchain::{ error::ChainError, fork_choice::apply_fork_choice, payload::{BuildPayloadArgs, create_payload}, - validate_block, + validate_block_pre_execution, }; use ethrex_common::H256; use ethrex_common::{Address, U256}; @@ -209,7 +209,7 @@ impl BlockProducer { // Blockchain stores block let block = payload_build_result.payload; let chain_config = self.store.get_chain_config(); - validate_block( + validate_block_pre_execution( &block, &head_header, &chain_config,