diff --git a/Cargo.lock b/Cargo.lock index b3eca8f54..655d0c136 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2931,6 +2931,7 @@ dependencies = [ name = "example-txpool-tracing" version = "0.0.0" dependencies = [ + "alloy-rpc-types-trace", "clap", "futures-util", "reth", @@ -8382,6 +8383,7 @@ dependencies = [ "alloy-rlp", "alloy-rpc-types-eth", "alloy-rpc-types-mev", + "alloy-rpc-types-trace", "alloy-rpc-types-txpool", "async-trait", "derive_more", @@ -8442,6 +8444,7 @@ dependencies = [ "alloy-rpc-types-anvil", "alloy-rpc-types-eth", "alloy-rpc-types-mev", + "alloy-rpc-types-trace", "alloy-rpc-types-txpool", "jsonrpsee", "reth-engine-primitives", @@ -8458,6 +8461,7 @@ version = "1.0.7" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", + "alloy-rpc-types-trace", "futures", "jsonrpsee", "jsonrpsee-http-client", @@ -8477,6 +8481,7 @@ dependencies = [ "alloy-network", "alloy-primitives", "alloy-rpc-types-eth", + "alloy-rpc-types-trace", "clap", "http", "jsonrpsee", @@ -8676,7 +8681,6 @@ dependencies = [ "alloy-rpc-types-beacon", "alloy-rpc-types-debug", "alloy-rpc-types-engine", - "alloy-rpc-types-trace", "alloy-serde", "arbitrary", "jsonrpsee-types", diff --git a/crates/rpc/rpc-api/Cargo.toml b/crates/rpc/rpc-api/Cargo.toml index 6d726ef9a..4c07fbb19 100644 --- a/crates/rpc/rpc-api/Cargo.toml +++ b/crates/rpc/rpc-api/Cargo.toml @@ -24,6 +24,7 @@ alloy-eips.workspace = true alloy-json-rpc.workspace = true alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types-trace.workspace = true alloy-rpc-types-anvil.workspace = true alloy-rpc-types-mev.workspace = true alloy-rpc-types-txpool.workspace = true diff --git a/crates/rpc/rpc-api/src/debug.rs b/crates/rpc/rpc-api/src/debug.rs index d242c0dab..5d1e944e0 100644 --- a/crates/rpc/rpc-api/src/debug.rs +++ b/crates/rpc/rpc-api/src/debug.rs @@ -1,15 +1,11 @@ use alloy_primitives::{Address, Bytes, B256}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::geth::{ + BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult, +}; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{BlockId, BlockNumberOrTag}; -use reth_rpc_types::{ - debug::ExecutionWitness, - trace::geth::{ - BlockTraceResult, GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, - TraceResult, - }, - Block, Bundle, StateContext, -}; +use reth_rpc_types::{debug::ExecutionWitness, Block, Bundle, StateContext}; /// Debug rpc interface. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "debug"))] diff --git a/crates/rpc/rpc-api/src/otterscan.rs b/crates/rpc/rpc-api/src/otterscan.rs index 3fc4cd2b3..388f71c89 100644 --- a/crates/rpc/rpc-api/src/otterscan.rs +++ b/crates/rpc/rpc-api/src/otterscan.rs @@ -1,14 +1,12 @@ use alloy_json_rpc::RpcObject; use alloy_primitives::{Address, Bytes, TxHash, B256}; +use alloy_rpc_types_trace::otterscan::{ + BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry, + TransactionsWithReceipts, +}; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::BlockId; -use reth_rpc_types::{ - trace::otterscan::{ - BlockDetails, ContractCreator, InternalOperation, OtsBlockTransactions, TraceEntry, - TransactionsWithReceipts, - }, - Header, -}; +use reth_rpc_types::Header; /// Otterscan rpc interface. #[cfg_attr(not(feature = "client"), rpc(server, namespace = "ots"))] diff --git a/crates/rpc/rpc-api/src/trace.rs b/crates/rpc/rpc-api/src/trace.rs index 45238200b..b615a33b8 100644 --- a/crates/rpc/rpc-api/src/trace.rs +++ b/crates/rpc/rpc-api/src/trace.rs @@ -1,16 +1,13 @@ use alloy_primitives::{Bytes, B256}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::{ + filter::TraceFilter, + opcode::{BlockOpcodeGas, TransactionOpcodeGas}, + parity::*, +}; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::BlockId; -use reth_rpc_types::{ - state::StateOverride, - trace::{ - filter::TraceFilter, - opcode::{BlockOpcodeGas, TransactionOpcodeGas}, - parity::*, - }, - BlockOverrides, Index, -}; +use reth_rpc_types::{state::StateOverride, BlockOverrides, Index}; use std::collections::HashSet; /// Ethereum trace API diff --git a/crates/rpc/rpc-builder/Cargo.toml b/crates/rpc/rpc-builder/Cargo.toml index 0789e0e16..10000ca2b 100644 --- a/crates/rpc/rpc-builder/Cargo.toml +++ b/crates/rpc/rpc-builder/Cargo.toml @@ -70,6 +70,7 @@ reth-rpc-types-compat.workspace = true alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types-trace.workspace = true tokio = { workspace = true, features = ["rt", "rt-multi-thread"] } serde_json.workspace = true diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index 3c722eaaf..e3bab2df1 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -4,6 +4,7 @@ use crate::utils::{launch_http, launch_http_ws, launch_ws}; use alloy_primitives::{hex_literal::hex, Address, Bytes, TxHash, B256, B64, U256, U64}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::filter::TraceFilter; use jsonrpsee::{ core::{ client::{ClientT, SubscriptionClientT}, @@ -22,8 +23,8 @@ use reth_rpc_api::{ }; use reth_rpc_server_types::RethRpcModule; use reth_rpc_types::{ - trace::filter::TraceFilter, Block, FeeHistory, Filter, Index, Log, - PendingTransactionFilterKind, SyncStatus, Transaction, TransactionReceipt, + Block, FeeHistory, Filter, Index, Log, PendingTransactionFilterKind, SyncStatus, Transaction, + TransactionReceipt, }; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; diff --git a/crates/rpc/rpc-testing-util/Cargo.toml b/crates/rpc/rpc-testing-util/Cargo.toml index 3c041bb49..68ab05cc0 100644 --- a/crates/rpc/rpc-testing-util/Cargo.toml +++ b/crates/rpc/rpc-testing-util/Cargo.toml @@ -20,6 +20,7 @@ reth-rpc-api = { workspace = true, features = ["client"] } # ethereum alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types-trace.workspace = true # async futures.workspace = true @@ -35,3 +36,4 @@ similar-asserts.workspace = true tokio = { workspace = true, features = ["rt-multi-thread", "macros", "rt"] } reth-rpc-eth-api.workspace = true jsonrpsee-http-client.workspace = true +alloy-rpc-types-trace.workspace = true \ No newline at end of file diff --git a/crates/rpc/rpc-testing-util/src/debug.rs b/crates/rpc/rpc-testing-util/src/debug.rs index b52ac3e26..01b055265 100644 --- a/crates/rpc/rpc-testing-util/src/debug.rs +++ b/crates/rpc/rpc-testing-util/src/debug.rs @@ -8,17 +8,15 @@ use std::{ use alloy_primitives::{TxHash, B256}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::{ + common::TraceResult, + geth::{GethDebugTracerType, GethDebugTracingOptions, GethTrace}, +}; use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::{BlockId, Receipt}; use reth_rpc_api::{clients::DebugApiClient, EthApiClient}; -use reth_rpc_types::{ - trace::{ - common::TraceResult, - geth::{GethDebugTracerType, GethDebugTracingOptions, GethTrace}, - }, - Block, Transaction, -}; +use reth_rpc_types::{Block, Transaction}; const NOOP_TRACER: &str = include_str!("../assets/noop-tracer.js"); const JS_TRACER_TEMPLATE: &str = include_str!("../assets/tracer-template.js"); @@ -378,9 +376,9 @@ mod tests { debug::{DebugApiExt, JsTracerBuilder, NoopJsTracer}, utils::parse_env_url, }; + use alloy_rpc_types_trace::geth::{CallConfig, GethDebugTracingOptions}; use futures::StreamExt; use jsonrpsee::http_client::HttpClientBuilder; - use reth_rpc_types::trace::geth::{CallConfig, GethDebugTracingOptions}; // random tx const TX_1: &str = "0x5525c63a805df2b83c113ebcc8c7672a3b290673c4e81335b410cd9ebc64e085"; diff --git a/crates/rpc/rpc-testing-util/src/trace.rs b/crates/rpc/rpc-testing-util/src/trace.rs index d75779c84..c9721d402 100644 --- a/crates/rpc/rpc-testing-util/src/trace.rs +++ b/crates/rpc/rpc-testing-util/src/trace.rs @@ -2,18 +2,16 @@ use alloy_primitives::{Bytes, TxHash, B256}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::{ + filter::TraceFilter, + parity::{LocalizedTransactionTrace, TraceResults, TraceType}, + tracerequest::TraceCallRequest, +}; use futures::{Stream, StreamExt}; use jsonrpsee::core::client::Error as RpcError; use reth_primitives::BlockId; use reth_rpc_api::clients::TraceApiClient; -use reth_rpc_types::{ - trace::{ - filter::TraceFilter, - parity::{LocalizedTransactionTrace, TraceResults, TraceType}, - tracerequest::TraceCallRequest, - }, - Index, -}; +use reth_rpc_types::Index; use std::{ collections::HashSet, pin::Pin, @@ -517,9 +515,9 @@ where #[cfg(test)] mod tests { use super::*; + use alloy_rpc_types_trace::filter::TraceFilterMode; use jsonrpsee::http_client::HttpClientBuilder; use reth_primitives::BlockNumberOrTag; - use reth_rpc_types::trace::filter::TraceFilterMode; const fn assert_is_stream(_: &St) {} diff --git a/crates/rpc/rpc-testing-util/tests/it/trace.rs b/crates/rpc/rpc-testing-util/tests/it/trace.rs index 184fc0f3e..2c4b74606 100644 --- a/crates/rpc/rpc-testing-util/tests/it/trace.rs +++ b/crates/rpc/rpc-testing-util/tests/it/trace.rs @@ -1,15 +1,15 @@ //! Integration tests for the trace API. +use alloy_rpc_types_trace::{ + filter::TraceFilter, parity::TraceType, tracerequest::TraceCallRequest, +}; use futures::StreamExt; use jsonrpsee::http_client::HttpClientBuilder; use jsonrpsee_http_client::HttpClient; use reth_primitives::Receipt; use reth_rpc_api_testing_util::{debug::DebugApiExt, trace::TraceApiExt, utils::parse_env_url}; use reth_rpc_eth_api::EthApiClient; -use reth_rpc_types::{ - trace::{filter::TraceFilter, parity::TraceType, tracerequest::TraceCallRequest}, - Block, Transaction, -}; +use reth_rpc_types::{Block, Transaction}; use std::{collections::HashSet, time::Instant}; /// This is intended to be run locally against a running node. diff --git a/crates/rpc/rpc-types/Cargo.toml b/crates/rpc/rpc-types/Cargo.toml index 481f3bf72..8b94738cd 100644 --- a/crates/rpc/rpc-types/Cargo.toml +++ b/crates/rpc/rpc-types/Cargo.toml @@ -18,7 +18,6 @@ alloy-primitives = { workspace = true, features = ["rand", "rlp", "serde"] } alloy-rpc-types.workspace = true alloy-rpc-types-admin.workspace = true alloy-rpc-types-beacon = { workspace = true, optional = true } -alloy-rpc-types-trace.workspace = true alloy-rpc-types-debug.workspace = true alloy-serde.workspace = true alloy-rpc-types-engine = { workspace = true, features = ["std", "serde", "jsonrpsee-types"], optional = true } diff --git a/crates/rpc/rpc-types/src/lib.rs b/crates/rpc/rpc-types/src/lib.rs index 885d50e9d..a9860d57c 100644 --- a/crates/rpc/rpc-types/src/lib.rs +++ b/crates/rpc/rpc-types/src/lib.rs @@ -25,11 +25,6 @@ pub use alloy_rpc_types::*; // Ethereum specific serde types coming from alloy. pub use alloy_serde::*; -pub mod trace { - //! RPC types for trace endpoints and inspectors. - pub use alloy_rpc_types_trace::*; -} - // re-export admin pub use alloy_rpc_types_admin as admin; diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index 9b69448e3..c1cd68f58 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -43,6 +43,7 @@ alloy-network.workspace = true alloy-primitives.workspace = true alloy-rlp.workspace = true alloy-rpc-types-eth.workspace = true +alloy-rpc-types-trace.workspace = true alloy-rpc-types-mev.workspace = true alloy-rpc-types-txpool.workspace = true revm = { workspace = true, features = [ diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index e3f0f47b3..aa021aaf1 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -1,6 +1,10 @@ use alloy_primitives::{Address, Bytes, B256, U256}; use alloy_rlp::{Decodable, Encodable}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::geth::{ + BlockTraceResult, FourByteFrame, GethDebugBuiltInTracerType, GethDebugTracerType, + GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, NoopFrame, TraceResult, +}; use async_trait::async_trait; use jsonrpsee::core::RpcResult; use reth_chainspec::{ChainSpec, EthereumHardforks}; @@ -22,13 +26,8 @@ use reth_rpc_eth_api::{ use reth_rpc_eth_types::{EthApiError, StateCacheDb}; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; use reth_rpc_types::{ - debug::ExecutionWitness, - state::EvmOverrides, - trace::geth::{ - BlockTraceResult, FourByteFrame, GethDebugBuiltInTracerType, GethDebugTracerType, - GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, NoopFrame, TraceResult, - }, - Block as RpcBlock, BlockError, Bundle, StateContext, + debug::ExecutionWitness, state::EvmOverrides, Block as RpcBlock, BlockError, Bundle, + StateContext, }; use reth_tasks::pool::BlockingTaskGuard; use reth_trie::{HashedPostState, HashedStorage}; diff --git a/crates/rpc/rpc/src/otterscan.rs b/crates/rpc/rpc/src/otterscan.rs index d88ec7a85..1dd98acde 100644 --- a/crates/rpc/rpc/src/otterscan.rs +++ b/crates/rpc/rpc/src/otterscan.rs @@ -1,5 +1,12 @@ use alloy_network::{ReceiptResponse, TransactionResponse}; use alloy_primitives::{Address, Bytes, TxHash, B256, U256}; +use alloy_rpc_types_trace::{ + otterscan::{ + BlockDetails, ContractCreator, InternalOperation, OperationType, OtsBlockTransactions, + OtsReceipt, OtsTransactionReceipt, TraceEntry, TransactionsWithReceipts, + }, + parity::{Action, CreateAction, CreateOutput, TraceOutput}, +}; use async_trait::async_trait; use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned}; use reth_primitives::{BlockId, BlockNumberOrTag}; @@ -10,16 +17,7 @@ use reth_rpc_eth_api::{ }; use reth_rpc_eth_types::{utils::binary_search, EthApiError}; use reth_rpc_server_types::result::internal_rpc_err; -use reth_rpc_types::{ - trace::{ - otterscan::{ - BlockDetails, ContractCreator, InternalOperation, OperationType, OtsBlockTransactions, - OtsReceipt, OtsTransactionReceipt, TraceEntry, TransactionsWithReceipts, - }, - parity::{Action, CreateAction, CreateOutput, TraceOutput}, - }, - BlockTransactions, Header, TransactionReceipt, -}; +use reth_rpc_types::{BlockTransactions, Header, TransactionReceipt}; use revm_inspectors::{ tracing::{types::CallTraceNode, TracingInspectorConfig}, transfer::{TransferInspector, TransferKind}, diff --git a/crates/rpc/rpc/src/trace.rs b/crates/rpc/rpc/src/trace.rs index ee543ecc9..15ee45b37 100644 --- a/crates/rpc/rpc/src/trace.rs +++ b/crates/rpc/rpc/src/trace.rs @@ -2,6 +2,12 @@ use std::{collections::HashSet, sync::Arc}; use alloy_primitives::{Bytes, B256, U256}; use alloy_rpc_types_eth::transaction::TransactionRequest; +use alloy_rpc_types_trace::{ + filter::TraceFilter, + opcode::{BlockOpcodeGas, TransactionOpcodeGas}, + parity::*, + tracerequest::TraceCallRequest, +}; use async_trait::async_trait; use jsonrpsee::core::RpcResult; use reth_chainspec::{ChainSpec, EthereumHardforks}; @@ -20,12 +26,6 @@ use reth_rpc_eth_api::{ use reth_rpc_eth_types::{error::EthApiError, utils::recover_raw_transaction}; use reth_rpc_types::{ state::{EvmOverrides, StateOverride}, - trace::{ - filter::TraceFilter, - opcode::{BlockOpcodeGas, TransactionOpcodeGas}, - parity::*, - tracerequest::TraceCallRequest, - }, BlockOverrides, Index, }; use reth_tasks::pool::BlockingTaskGuard; diff --git a/examples/txpool-tracing/Cargo.toml b/examples/txpool-tracing/Cargo.toml index 0a3dd2b9b..219292ee0 100644 --- a/examples/txpool-tracing/Cargo.toml +++ b/examples/txpool-tracing/Cargo.toml @@ -8,5 +8,6 @@ license.workspace = true [dependencies] reth.workspace = true reth-node-ethereum.workspace = true +alloy-rpc-types-trace.workspace = true clap = { workspace = true, features = ["derive"] } futures-util.workspace = true diff --git a/examples/txpool-tracing/src/main.rs b/examples/txpool-tracing/src/main.rs index 6dc7d132f..c9d27089d 100644 --- a/examples/txpool-tracing/src/main.rs +++ b/examples/txpool-tracing/src/main.rs @@ -10,6 +10,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] +use alloy_rpc_types_trace::{parity::TraceType, tracerequest::TraceCallRequest}; use clap::Parser; use futures_util::StreamExt; use reth::{ @@ -17,10 +18,7 @@ use reth::{ builder::NodeHandle, cli::Cli, primitives::{Address, IntoRecoveredTransaction}, - rpc::{ - compat::transaction::transaction_to_call_request, - types::trace::{parity::TraceType, tracerequest::TraceCallRequest}, - }, + rpc::compat::transaction::transaction_to_call_request, transaction_pool::TransactionPool, }; use reth_node_ethereum::node::EthereumNode;