diff --git a/Cargo.lock b/Cargo.lock index 5aad88bcf10e..2335e9dfab1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7351,7 +7351,6 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", - "reth-chain-state", "reth-chainspec", "reth-engine-primitives", "reth-payload-primitives", @@ -7386,7 +7385,6 @@ dependencies = [ "alloy-eips", "alloy-primitives", "reth-basic-payload-builder", - "reth-chain-state", "reth-chainspec", "reth-errors", "reth-evm", diff --git a/crates/e2e-test-utils/src/transaction.rs b/crates/e2e-test-utils/src/transaction.rs index b48bec74bd7e..c0a5155cb708 100644 --- a/crates/e2e-test-utils/src/transaction.rs +++ b/crates/e2e-test-utils/src/transaction.rs @@ -126,6 +126,7 @@ impl TransactionTestContext { } /// Validates the sidecar of a given tx envelope and returns the versioned hashes + #[track_caller] pub fn validate_sidecar(tx: TxEnvelope) -> Vec { let proof_setting = EnvKzgSettings::Default; diff --git a/crates/ethereum/engine-primitives/Cargo.toml b/crates/ethereum/engine-primitives/Cargo.toml index 3a5aa3247577..f68924a73474 100644 --- a/crates/ethereum/engine-primitives/Cargo.toml +++ b/crates/ethereum/engine-primitives/Cargo.toml @@ -18,7 +18,6 @@ reth-engine-primitives.workspace = true reth-payload-primitives.workspace = true reth-payload-validator.workspace = true reth-rpc-types-compat.workspace = true -reth-chain-state.workspace = true # alloy alloy-primitives.workspace = true diff --git a/crates/ethereum/engine-primitives/src/payload.rs b/crates/ethereum/engine-primitives/src/payload.rs index eabad4fb131b..0b39c25b2842 100644 --- a/crates/ethereum/engine-primitives/src/payload.rs +++ b/crates/ethereum/engine-primitives/src/payload.rs @@ -9,7 +9,6 @@ use alloy_rpc_types_engine::{ ExecutionPayloadV1, PayloadAttributes, PayloadId, }; use core::convert::Infallible; -use reth_chain_state::ExecutedBlockWithTrieUpdates; use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes}; use reth_primitives::{EthPrimitives, SealedBlock}; use reth_rpc_types_compat::engine::payload::{ @@ -27,8 +26,6 @@ pub struct EthBuiltPayload { pub(crate) id: PayloadId, /// The built block pub(crate) block: Arc, - /// Block execution data for the payload, if any. - pub(crate) executed_block: Option, /// The fees of the block pub(crate) fees: U256, /// The blobs, proofs, and commitments in the block. If the block is pre-cancun, this will be @@ -48,10 +45,9 @@ impl EthBuiltPayload { id: PayloadId, block: Arc, fees: U256, - executed_block: Option, requests: Option, ) -> Self { - Self { id, block, executed_block, fees, sidecars: Vec::new(), requests } + Self { id, block, fees, sidecars: Vec::new(), requests } } /// Returns the identifier of the payload. @@ -100,10 +96,6 @@ impl BuiltPayload for EthBuiltPayload { self.fees } - fn executed_block(&self) -> Option { - self.executed_block.clone() - } - fn requests(&self) -> Option { self.requests.clone() } @@ -120,10 +112,6 @@ impl BuiltPayload for &EthBuiltPayload { (**self).fees() } - fn executed_block(&self) -> Option { - self.executed_block.clone() - } - fn requests(&self) -> Option { self.requests.clone() } diff --git a/crates/ethereum/node/tests/e2e/blobs.rs b/crates/ethereum/node/tests/e2e/blobs.rs index 111810514504..5c582bcaba63 100644 --- a/crates/ethereum/node/tests/e2e/blobs.rs +++ b/crates/ethereum/node/tests/e2e/blobs.rs @@ -1,5 +1,4 @@ use crate::utils::eth_payload_attributes; -use alloy_consensus::constants::MAINNET_GENESIS_HASH; use alloy_genesis::Genesis; use alloy_rpc_types_engine::PayloadStatusEnum; use reth_chainspec::{ChainSpecBuilder, MAINNET}; @@ -27,6 +26,7 @@ async fn can_handle_blobs() -> eyre::Result<()> { .cancun_activated() .build(), ); + let genesis_hash = chain_spec.genesis_hash(); let node_config = NodeConfig::test() .with_chain(chain_spec) .with_unused_ports() @@ -69,15 +69,12 @@ async fn can_handle_blobs() -> eyre::Result<()> { let blob_block_hash = node.engine_api.submit_payload(blob_payload, blob_attr, PayloadStatusEnum::Valid).await?; - let (_, _) = tokio::join!( - // send fcu with blob hash - node.engine_api.update_forkchoice(MAINNET_GENESIS_HASH, blob_block_hash), - // send fcu with normal hash - node.engine_api.update_forkchoice(MAINNET_GENESIS_HASH, payload.block().hash()) - ); + node.engine_api.update_forkchoice(genesis_hash, blob_block_hash).await?; - // submit normal payload - node.engine_api.submit_payload(payload, attributes, PayloadStatusEnum::Valid).await?; + // submit normal payload (reorg) + let block_hash = + node.engine_api.submit_payload(payload, attributes, PayloadStatusEnum::Valid).await?; + node.engine_api.update_forkchoice(genesis_hash, block_hash).await?; tokio::time::sleep(std::time::Duration::from_secs(3)).await; diff --git a/crates/ethereum/payload/Cargo.toml b/crates/ethereum/payload/Cargo.toml index dd4a5f948cd0..baa9db306b20 100644 --- a/crates/ethereum/payload/Cargo.toml +++ b/crates/ethereum/payload/Cargo.toml @@ -26,7 +26,6 @@ reth-basic-payload-builder.workspace = true reth-evm.workspace = true reth-evm-ethereum.workspace = true reth-errors.workspace = true -reth-chain-state.workspace = true reth-chainspec.workspace = true # ethereum diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index ca3821765ea4..88dd72643af1 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -19,7 +19,6 @@ use reth_basic_payload_builder::{ commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder, PayloadConfig, }; -use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates}; use reth_chainspec::{ChainSpec, ChainSpecProvider}; use reth_errors::RethError; use reth_evm::{ @@ -31,8 +30,7 @@ use reth_payload_builder::{EthBuiltPayload, EthPayloadBuilderAttributes}; use reth_payload_builder_primitives::PayloadBuilderError; use reth_payload_primitives::PayloadBuilderAttributes; use reth_primitives::{ - Block, BlockBody, EthereumHardforks, InvalidTransactionError, Receipt, RecoveredBlock, - TransactionSigned, + Block, BlockBody, EthereumHardforks, InvalidTransactionError, Receipt, TransactionSigned, }; use reth_primitives_traits::{ proofs::{self}, @@ -192,7 +190,6 @@ where let base_fee = evm_env.block_env.basefee.to::(); let mut executed_txs = Vec::new(); - let mut executed_senders = Vec::new(); let mut best_txs = best_txs(BestTransactionsAttributes::new( base_fee, @@ -340,8 +337,7 @@ where tx.effective_tip_per_gas(base_fee).expect("fee is always valid; execution succeeded"); total_fees += U256::from(miner_fee) * U256::from(gas_used); - // append sender and transaction to the respective lists - executed_senders.push(tx.signer()); + // append transaction to the block body executed_txs.push(tx.into_tx()); } @@ -399,8 +395,8 @@ where // calculate the state root let hashed_state = db.database.db.hashed_post_state(execution_outcome.state()); - let (state_root, trie_output) = { - db.database.inner().state_root_with_updates(hashed_state.clone()).inspect_err(|err| { + let (state_root, _) = { + db.database.inner().state_root_with_updates(hashed_state).inspect_err(|err| { warn!(target: "payload_builder", parent_hash=%parent_header.hash(), %err, @@ -480,21 +476,7 @@ where let sealed_block = Arc::new(block.seal_slow()); debug!(target: "payload_builder", id=%attributes.id, sealed_block_header = ?sealed_block.sealed_header(), "sealed built block"); - // create the executed block data - let executed = ExecutedBlockWithTrieUpdates { - block: ExecutedBlock { - recovered_block: Arc::new(RecoveredBlock::new_sealed( - sealed_block.as_ref().clone(), - executed_senders, - )), - execution_output: Arc::new(execution_outcome), - hashed_state: Arc::new(hashed_state), - }, - trie: Arc::new(trie_output), - }; - - let mut payload = - EthBuiltPayload::new(attributes.id, sealed_block, total_fees, Some(executed), requests); + let mut payload = EthBuiltPayload::new(attributes.id, sealed_block, total_fees, requests); // extend the payload with the blob sidecars from the executed txs payload.extend_sidecars(blob_sidecars.into_iter().map(Arc::unwrap_or_clone)); diff --git a/crates/payload/builder/src/lib.rs b/crates/payload/builder/src/lib.rs index 2dbf8e86eef4..7cc8a10eb950 100644 --- a/crates/payload/builder/src/lib.rs +++ b/crates/payload/builder/src/lib.rs @@ -67,7 +67,7 @@ //! }, //! ..Default::default() //! }; -//! let payload = EthBuiltPayload::new(self.attributes.id, Arc::new(SealedBlock::seal_slow(block)), U256::ZERO, None, None); +//! let payload = EthBuiltPayload::new(self.attributes.id, Arc::new(SealedBlock::seal_slow(block)), U256::ZERO, None); //! Ok(payload) //! } //! diff --git a/crates/payload/builder/src/test_utils.rs b/crates/payload/builder/src/test_utils.rs index f38c8e0038c9..835d94265e0b 100644 --- a/crates/payload/builder/src/test_utils.rs +++ b/crates/payload/builder/src/test_utils.rs @@ -6,7 +6,7 @@ use crate::{ }; use alloy_primitives::U256; -use reth_chain_state::{CanonStateNotification, ExecutedBlockWithTrieUpdates}; +use reth_chain_state::CanonStateNotification; use reth_payload_builder_primitives::PayloadBuilderError; use reth_payload_primitives::{PayloadKind, PayloadTypes}; use reth_primitives::Block; @@ -90,7 +90,6 @@ impl PayloadJob for TestPayloadJob { self.attr.payload_id(), Arc::new(Block::default().seal_slow()), U256::ZERO, - Some(ExecutedBlockWithTrieUpdates::default()), Some(Default::default()), )) }