Skip to content
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
5 changes: 5 additions & 0 deletions .changelog/zesty-hens-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
reth-bench: minor
---

Removed temporary OP-stack transaction and payload handling from `reth-bench`, making the replay and standalone payload tooling Ethereum-only again. This drops the new abstraction from PR #23262 and keeps the existing CLI behavior while unsupported OP-style blocks now fail during conversion.
39 changes: 0 additions & 39 deletions Cargo.lock

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

9 changes: 0 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,6 @@ alloy-transport-http = { version = "1.8.2", features = ["reqwest-rustls-tls"], d
alloy-transport-ipc = { version = "1.8.2", default-features = false }
alloy-transport-ws = { version = "1.8.2", default-features = false }

# op
op-alloy-rpc-types = { version = "0.24.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.24.0", default-features = false }
op-alloy-consensus = { version = "0.24.0", default-features = false }

# misc
either = { version = "1.15.0", default-features = false }
arrayvec = { version = "0.7.6", default-features = false }
Expand Down Expand Up @@ -735,10 +730,6 @@ ipnet = "2.11"
# alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }

# op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
# op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
# op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
#
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "1207e33" }
#
# jsonrpsee = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" }
Expand Down
2 changes: 0 additions & 2 deletions bin/reth-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ alloy-transport-http.workspace = true
alloy-transport-ipc.workspace = true
alloy-transport-ws.workspace = true
alloy-transport.workspace = true
op-alloy-consensus = { workspace = true, features = ["alloy-compat"] }
op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] }

# reqwest
reqwest.workspace = true
Expand Down
10 changes: 0 additions & 10 deletions bin/reth-bench/src/bench/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use crate::{authenticated_transport::AuthenticatedTransportConnect, bench_mode::BenchMode};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::address;
use alloy_provider::{network::AnyNetwork, Provider, RootProvider};
use alloy_rpc_client::ClientBuilder;
use alloy_rpc_types_engine::JwtSecret;
Expand All @@ -27,8 +26,6 @@ pub(crate) struct BenchContext {
pub(crate) benchmark_mode: BenchMode,
/// The next block to fetch.
pub(crate) next_block: u64,
/// Whether the chain is an OP rollup.
pub(crate) is_optimism: bool,
/// Whether to use `reth_newPayload` endpoint instead of `engine_newPayload*`.
pub(crate) use_reth_namespace: bool,
/// Whether to fetch and replay RLP-encoded blocks.
Expand Down Expand Up @@ -70,12 +67,6 @@ impl BenchContext {
.http(rpc_url.parse()?);
let block_provider = RootProvider::<AnyNetwork>::new(client);

// Check if this is an OP chain by checking code at a predeploy address.
let is_optimism = !block_provider
.get_code_at(address!("0x420000000000000000000000000000000000000F"))
.await?
.is_empty();

// construct the authenticated provider
let auth_jwt = bench_args
.auth_jwtsecret
Expand Down Expand Up @@ -175,7 +166,6 @@ impl BenchContext {
block_provider,
benchmark_mode,
next_block,
is_optimism,
use_reth_namespace,
rlp_blocks,
wait_for_persistence,
Expand Down
6 changes: 3 additions & 3 deletions bin/reth-bench/src/bench/generate_big_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! and saves the result to disk as a [`BigBlockPayload`] JSON file containing the merged
//! [`ExecutionData`] and environment switches at each block boundary.

use alloy_consensus::TxReceipt;
use alloy_consensus::{TxEnvelope, TxReceipt};
use alloy_eips::{eip1559::BaseFeeParams, eip7840::BlobParams, Typed2718};
use alloy_primitives::{Bloom, Bytes, B256};
use alloy_provider::{network::AnyNetwork, Provider, RootProvider};
Expand Down Expand Up @@ -365,8 +365,8 @@ impl Command {
let block = rpc_block
.into_inner()
.map_header(|header| header.map(|h| h.into_header_with_defaults()))
.try_map_transactions(|tx| {
tx.try_into_either::<op_alloy_consensus::OpTxEnvelope>()
.try_map_transactions(|tx| -> eyre::Result<TxEnvelope> {
tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type"))
})?
.into_consensus();

Expand Down
2 changes: 0 additions & 2 deletions bin/reth-bench/src/bench/new_payload_fcu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl Command {
block_provider,
auth_provider,
next_block,
is_optimism,
use_reth_namespace,
rlp_blocks,
wait_for_persistence,
Expand Down Expand Up @@ -201,7 +200,6 @@ impl Command {

let (version, params) = block_to_new_payload(
block,
is_optimism,
rlp,
use_reth_namespace,
wait_for_persistence,
Expand Down
2 changes: 0 additions & 2 deletions bin/reth-bench/src/bench/new_payload_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ impl Command {
block_provider,
auth_provider,
mut next_block,
is_optimism,
use_reth_namespace,
rlp_blocks,
wait_for_persistence,
Expand Down Expand Up @@ -126,7 +125,6 @@ impl Command {

let (version, params) = block_to_new_payload(
block,
is_optimism,
rlp,
use_reth_namespace,
wait_for_persistence,
Expand Down
6 changes: 4 additions & 2 deletions bin/reth-bench/src/bench/send_invalid_payload/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ mod invalidation;
use invalidation::InvalidationConfig;

use super::helpers::{load_jwt_secret, read_input};
use alloy_consensus::TxEnvelope;
use alloy_primitives::{Address, B256};
use alloy_provider::network::AnyRpcBlock;
use alloy_rpc_types_engine::ExecutionPayload;
use clap::Parser;
use eyre::{OptionExt, Result};
use op_alloy_consensus::OpTxEnvelope;
use reth_cli_runner::CliContext;
use std::io::Write;

Expand Down Expand Up @@ -222,7 +222,9 @@ impl Command {
let block = serde_json::from_str::<AnyRpcBlock>(&block_json)?
.into_inner()
.map_header(|header| header.map(|h| h.into_header_with_defaults()))
.try_map_transactions(|tx| tx.try_into_either::<OpTxEnvelope>())?
.try_map_transactions(|tx| -> eyre::Result<TxEnvelope> {
tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type"))
})?
.into_consensus();

let config = self.build_invalidation_config();
Expand Down
7 changes: 3 additions & 4 deletions bin/reth-bench/src/bench/send_payload.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::helpers::{load_jwt_secret, read_input};
use alloy_consensus::TxEnvelope;
use alloy_provider::network::AnyRpcBlock;
use alloy_rpc_types_engine::ExecutionPayload;
use clap::Parser;
use eyre::{OptionExt, Result};
use op_alloy_consensus::OpTxEnvelope;
use reth_cli_runner::CliContext;
use std::io::Write;

Expand Down Expand Up @@ -64,9 +64,8 @@ impl Command {
let block = serde_json::from_str::<AnyRpcBlock>(&block_json)?
.into_inner()
.map_header(|header| header.map(|h| h.into_header_with_defaults()))
.try_map_transactions(|tx| {
// try to convert unknowns into op type so that we can also support optimism
tx.try_into_either::<OpTxEnvelope>()
.try_map_transactions(|tx| -> eyre::Result<TxEnvelope> {
tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type"))
})?
.into_consensus();

Expand Down
63 changes: 20 additions & 43 deletions bin/reth-bench/src/valid_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
//! response. This is useful for benchmarking, as it allows us to wait for a payload to be valid
//! before sending additional calls.

use alloy_eips::eip7685::Requests;
use alloy_primitives::{Bytes, B256};
use alloy_consensus::TxEnvelope;
use alloy_primitives::Bytes;
use alloy_provider::{ext::EngineApi, network::AnyRpcBlock, Network, Provider};
use alloy_rpc_types_engine::{
ExecutionData, ExecutionPayload, ExecutionPayloadInputV2, ExecutionPayloadSidecar,
ForkchoiceState, ForkchoiceUpdated, PayloadAttributes, PayloadStatus,
};
use alloy_transport::TransportResult;
use op_alloy_rpc_types_engine::OpExecutionPayloadV4;
use reth_node_api::EngineApiMessageVersion;
use reth_node_core::args::WaitForPersistence;
use reth_rpc_api::RethNewPayloadInput;
Expand Down Expand Up @@ -173,7 +172,6 @@ where
/// `reth_newPayload` on a per-block basis.
pub(crate) fn block_to_new_payload(
block: AnyRpcBlock,
is_optimism: bool,
rlp: Option<Bytes>,
reth_new_payload: bool,
wait_for_persistence: WaitForPersistence,
Expand All @@ -192,19 +190,16 @@ pub(crate) fn block_to_new_payload(
))?,
));
}

let block = block
.into_inner()
.map_header(|header| header.map(|h| h.into_header_with_defaults()))
.try_map_transactions(|tx| {
// try to convert unknowns into op type so that we can also support optimism
tx.try_into_either::<op_alloy_consensus::OpTxEnvelope>()
.try_map_transactions(|tx| -> eyre::Result<TxEnvelope> {
tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type"))
})?
.into_consensus();

// Convert to execution payload
let (payload, sidecar) = ExecutionPayload::from_block_slow(&block);
let (version, params, execution_data) =
payload_to_new_payload(payload, sidecar, is_optimism, block.withdrawals_root, None)?;
let (version, params, execution_data) = payload_to_new_payload(payload, sidecar, None)?;

if reth_new_payload {
Ok((
Expand All @@ -227,46 +222,28 @@ pub(crate) fn block_to_new_payload(
pub(crate) fn payload_to_new_payload(
payload: ExecutionPayload,
sidecar: ExecutionPayloadSidecar,
is_optimism: bool,
withdrawals_root: Option<B256>,
target_version: Option<EngineApiMessageVersion>,
) -> eyre::Result<(EngineApiMessageVersion, serde_json::Value, ExecutionData)> {
let execution_data = ExecutionData { payload: payload.clone(), sidecar: sidecar.clone() };

let (version, params) = match payload {
ExecutionPayload::V3(payload) => {
let cancun = sidecar.cancun().unwrap();
let cancun = sidecar
.cancun()
.ok_or_else(|| eyre::eyre!("missing cancun sidecar for V3 payload"))?;

if let Some(prague) = sidecar.prague() {
// Use target version if provided (for Osaka), otherwise default to V4
let version = target_version.unwrap_or(EngineApiMessageVersion::V4);

if is_optimism {
let withdrawals_root = withdrawals_root.ok_or_else(|| {
eyre::eyre!("Missing withdrawals root for Optimism payload")
})?;
(
version,
serde_json::to_value((
OpExecutionPayloadV4 { payload_inner: payload, withdrawals_root },
cancun.versioned_hashes.clone(),
cancun.parent_beacon_block_root,
Requests::default(),
))?,
)
} else {
// Preserve the original RequestsOrHash payload for engine_newPayloadV4.
let requests = prague.requests.clone();
(
version,
serde_json::to_value((
payload,
cancun.versioned_hashes.clone(),
cancun.parent_beacon_block_root,
requests,
))?,
)
}
let requests = prague.requests.clone();
(
version,
serde_json::to_value((
payload,
cancun.versioned_hashes.clone(),
cancun.parent_beacon_block_root,
requests,
))?,
)
} else {
(
EngineApiMessageVersion::V3,
Expand Down Expand Up @@ -294,7 +271,7 @@ pub(crate) fn payload_to_new_payload(
Ok((version, params, execution_data))
}

/// Calls the correct `engine_newPayload` method depending on the given [`ExecutionPayload`] and its
/// Calls the correct `engine_newPayload` method depending on the given execution payload and its
/// versioned variant. Returns the [`EngineApiMessageVersion`] depending on the payload's version.
///
/// # Panics
Expand Down
Loading
Loading