Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove executed_block from EthBuiltPayload #14017

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/e2e-test-utils/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B256> {
let proof_setting = EnvKzgSettings::Default;

Expand Down
1 change: 0 additions & 1 deletion crates/ethereum/engine-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 1 addition & 13 deletions crates/ethereum/engine-primitives/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -27,8 +26,6 @@ pub struct EthBuiltPayload {
pub(crate) id: PayloadId,
/// The built block
pub(crate) block: Arc<SealedBlock>,
/// Block execution data for the payload, if any.
pub(crate) executed_block: Option<ExecutedBlockWithTrieUpdates>,
/// 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
Expand All @@ -48,10 +45,9 @@ impl EthBuiltPayload {
id: PayloadId,
block: Arc<SealedBlock>,
fees: U256,
executed_block: Option<ExecutedBlockWithTrieUpdates>,
requests: Option<Requests>,
) -> 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.
Expand Down Expand Up @@ -100,10 +96,6 @@ impl BuiltPayload for EthBuiltPayload {
self.fees
}

fn executed_block(&self) -> Option<ExecutedBlockWithTrieUpdates> {
self.executed_block.clone()
}

fn requests(&self) -> Option<Requests> {
self.requests.clone()
}
Expand All @@ -120,10 +112,6 @@ impl BuiltPayload for &EthBuiltPayload {
(**self).fees()
}

fn executed_block(&self) -> Option<ExecutedBlockWithTrieUpdates> {
self.executed_block.clone()
}

fn requests(&self) -> Option<Requests> {
self.requests.clone()
}
Expand Down
15 changes: 6 additions & 9 deletions crates/ethereum/node/tests/e2e/blobs.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion crates/ethereum/payload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 5 additions & 23 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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},
Expand Down Expand Up @@ -192,7 +190,6 @@ where
let base_fee = evm_env.block_env.basefee.to::<u64>();

let mut executed_txs = Vec::new();
let mut executed_senders = Vec::new();

let mut best_txs = best_txs(BestTransactionsAttributes::new(
base_fee,
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion crates/payload/builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
//! }
//!
Expand Down
3 changes: 1 addition & 2 deletions crates/payload/builder/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
))
}
Expand Down
Loading