diff --git a/.changelog/zesty-hens-wave.md b/.changelog/zesty-hens-wave.md new file mode 100644 index 00000000000..a432ee1e3f9 --- /dev/null +++ b/.changelog/zesty-hens-wave.md @@ -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. diff --git a/Cargo.lock b/Cargo.lock index 6e88ac28312..79e19b6c449 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6317,43 +6317,6 @@ version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" -[[package]] -name = "op-alloy-consensus" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadcb964b0aa645d12e952d470c7585d23286d8bcf1ac41589410b6724216b68" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-network", - "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types-eth", - "alloy-serde", - "derive_more", - "serde", - "thiserror 2.0.18", -] - -[[package]] -name = "op-alloy-rpc-types-engine" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0ac5c5ddcbffadcd097d278c717d34849bcc629f6e4f8514eb000ec862def8" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types-engine", - "alloy-serde", - "derive_more", - "op-alloy-consensus", - "serde", - "sha2", - "thiserror 2.0.18", -] - [[package]] name = "opaque-debug" version = "0.3.1" @@ -7634,8 +7597,6 @@ dependencies = [ "eyre", "futures", "humantime", - "op-alloy-consensus", - "op-alloy-rpc-types-engine", "reqwest 0.13.2", "reth-chainspec", "reth-cli", diff --git a/Cargo.toml b/Cargo.toml index c84c425fa74..90c8e34194d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } @@ -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" } diff --git a/bin/reth-bench/Cargo.toml b/bin/reth-bench/Cargo.toml index 7d2f76ade03..6e283fe1955 100644 --- a/bin/reth-bench/Cargo.toml +++ b/bin/reth-bench/Cargo.toml @@ -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 diff --git a/bin/reth-bench/src/bench/context.rs b/bin/reth-bench/src/bench/context.rs index 4f68a5f742d..4ec0e557251 100644 --- a/bin/reth-bench/src/bench/context.rs +++ b/bin/reth-bench/src/bench/context.rs @@ -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; @@ -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. @@ -70,12 +67,6 @@ impl BenchContext { .http(rpc_url.parse()?); let block_provider = RootProvider::::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 @@ -175,7 +166,6 @@ impl BenchContext { block_provider, benchmark_mode, next_block, - is_optimism, use_reth_namespace, rlp_blocks, wait_for_persistence, diff --git a/bin/reth-bench/src/bench/generate_big_block.rs b/bin/reth-bench/src/bench/generate_big_block.rs index 17f28e86e98..8ac77137311 100644 --- a/bin/reth-bench/src/bench/generate_big_block.rs +++ b/bin/reth-bench/src/bench/generate_big_block.rs @@ -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}; @@ -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::() + .try_map_transactions(|tx| -> eyre::Result { + tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type")) })? .into_consensus(); diff --git a/bin/reth-bench/src/bench/new_payload_fcu.rs b/bin/reth-bench/src/bench/new_payload_fcu.rs index d219a128f81..ddabaab293e 100644 --- a/bin/reth-bench/src/bench/new_payload_fcu.rs +++ b/bin/reth-bench/src/bench/new_payload_fcu.rs @@ -92,7 +92,6 @@ impl Command { block_provider, auth_provider, next_block, - is_optimism, use_reth_namespace, rlp_blocks, wait_for_persistence, @@ -201,7 +200,6 @@ impl Command { let (version, params) = block_to_new_payload( block, - is_optimism, rlp, use_reth_namespace, wait_for_persistence, diff --git a/bin/reth-bench/src/bench/new_payload_only.rs b/bin/reth-bench/src/bench/new_payload_only.rs index 3d55a20bb26..b024b9e7185 100644 --- a/bin/reth-bench/src/bench/new_payload_only.rs +++ b/bin/reth-bench/src/bench/new_payload_only.rs @@ -49,7 +49,6 @@ impl Command { block_provider, auth_provider, mut next_block, - is_optimism, use_reth_namespace, rlp_blocks, wait_for_persistence, @@ -126,7 +125,6 @@ impl Command { let (version, params) = block_to_new_payload( block, - is_optimism, rlp, use_reth_namespace, wait_for_persistence, diff --git a/bin/reth-bench/src/bench/send_invalid_payload/mod.rs b/bin/reth-bench/src/bench/send_invalid_payload/mod.rs index 0a38c246b23..40c02b92a83 100644 --- a/bin/reth-bench/src/bench/send_invalid_payload/mod.rs +++ b/bin/reth-bench/src/bench/send_invalid_payload/mod.rs @@ -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; @@ -222,7 +222,9 @@ impl Command { let block = serde_json::from_str::(&block_json)? .into_inner() .map_header(|header| header.map(|h| h.into_header_with_defaults())) - .try_map_transactions(|tx| tx.try_into_either::())? + .try_map_transactions(|tx| -> eyre::Result { + tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type")) + })? .into_consensus(); let config = self.build_invalidation_config(); diff --git a/bin/reth-bench/src/bench/send_payload.rs b/bin/reth-bench/src/bench/send_payload.rs index 67279e54199..0b9269278dc 100644 --- a/bin/reth-bench/src/bench/send_payload.rs +++ b/bin/reth-bench/src/bench/send_payload.rs @@ -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; @@ -64,9 +64,8 @@ impl Command { let block = serde_json::from_str::(&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::() + .try_map_transactions(|tx| -> eyre::Result { + tx.try_into().map_err(|_| eyre::eyre!("unsupported tx type")) })? .into_consensus(); diff --git a/bin/reth-bench/src/valid_payload.rs b/bin/reth-bench/src/valid_payload.rs index 038c4e25746..8cb94dfc438 100644 --- a/bin/reth-bench/src/valid_payload.rs +++ b/bin/reth-bench/src/valid_payload.rs @@ -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; @@ -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, reth_new_payload: bool, wait_for_persistence: WaitForPersistence, @@ -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::() + .try_map_transactions(|tx| -> eyre::Result { + 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(( @@ -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, target_version: Option, ) -> 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, @@ -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 diff --git a/scripts/patch-alloy.sh b/scripts/patch-alloy.sh index be6017581b3..abe22b12811 100755 --- a/scripts/patch-alloy.sh +++ b/scripts/patch-alloy.sh @@ -2,18 +2,17 @@ # Patches alloy dependencies in Cargo.toml for testing breaking changes. # # Usage: -# ./scripts/patch-alloy.sh [--alloy ] [--evm ] [--op ] +# ./scripts/patch-alloy.sh [--alloy ] [--evm ] # # Examples: # ./scripts/patch-alloy.sh --alloy main # ./scripts/patch-alloy.sh --alloy feat/new-api --evm main -# ./scripts/patch-alloy.sh --alloy main --evm main --op main +# ./scripts/patch-alloy.sh --alloy main --evm main set -euo pipefail ALLOY_BRANCH="" ALLOY_EVM_BRANCH="" -OP_ALLOY_BRANCH="" while [[ $# -gt 0 ]]; do case $1 in @@ -25,17 +24,12 @@ while [[ $# -gt 0 ]]; do ALLOY_EVM_BRANCH="$2" shift 2 ;; - --op) - OP_ALLOY_BRANCH="$2" - shift 2 - ;; -h|--help) - echo "Usage: $0 [--alloy ] [--evm ] [--op ]" + echo "Usage: $0 [--alloy ] [--evm ]" echo "" echo "Options:" echo " --alloy Patch alloy-rs/alloy crates" echo " --evm Patch alloy-rs/evm crates (alloy-evm, alloy-op-evm)" - echo " --op Patch alloy-rs/op-alloy crates" exit 0 ;; *) @@ -45,8 +39,8 @@ while [[ $# -gt 0 ]]; do esac done -if [[ -z "$ALLOY_BRANCH" && -z "$ALLOY_EVM_BRANCH" && -z "$OP_ALLOY_BRANCH" ]]; then - echo "Error: At least one of --alloy, --evm, or --op must be specified" +if [[ -z "$ALLOY_BRANCH" && -z "$ALLOY_EVM_BRANCH" ]]; then + echo "Error: At least one of --alloy or --evm must be specified" exit 1 fi @@ -97,17 +91,6 @@ alloy-op-evm = { git = "https://github.com/alloy-rs/evm", branch = "$ALLOY_EVM_B EOF fi -if [[ -n "$OP_ALLOY_BRANCH" ]]; then - echo "Patching alloy-rs/op-alloy with branch: $OP_ALLOY_BRANCH" - cat >> "$CARGO_TOML" << EOF -op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", branch = "$OP_ALLOY_BRANCH" } -op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", branch = "$OP_ALLOY_BRANCH" } -op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", branch = "$OP_ALLOY_BRANCH" } -op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", branch = "$OP_ALLOY_BRANCH" } -op-alloy-rpc-jsonrpsee = { git = "https://github.com/alloy-rs/op-alloy", branch = "$OP_ALLOY_BRANCH" } -EOF -fi - echo "Done. Patches appended to $CARGO_TOML" echo "" echo "Run 'cargo check --workspace --all-features' to verify compilation."