Skip to content

Commit

Permalink
feat: remove transaction_to_call_request helper fn (#14089)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
hoank101 and mattsse authored Jan 31, 2025
1 parent 5322877 commit 54a5fcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
8 changes: 0 additions & 8 deletions crates/rpc/rpc-types-compat/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,3 @@ pub trait TransactionCompat<T = TransactionSigned>:
// <https://github.com/alloy-rs/alloy/issues/1315>.
fn otterscan_api_truncate_input(tx: &mut Self::Transaction);
}

/// Convert [`Recovered`] to [`TransactionRequest`]
pub fn transaction_to_call_request<T: alloy_consensus::Transaction>(
tx: Recovered<T>,
) -> TransactionRequest {
let from = tx.signer();
TransactionRequest::from_transaction_with_sender(tx.into_tx(), from)
}
7 changes: 4 additions & 3 deletions examples/custom-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use alloy_eips::BlockNumberOrTag;
use alloy_primitives::Address;
use alloy_rpc_types_eth::state::EvmOverrides;
use alloy_rpc_types_eth::{state::EvmOverrides, TransactionRequest};
use clap::Parser;
use futures_util::StreamExt;
use reth::{
Expand All @@ -25,7 +25,7 @@ use reth::{
primitives::{Env, EnvWithHandlerCfg},
Database, Evm, EvmContext, Inspector,
},
rpc::{api::eth::helpers::Call, compat::transaction::transaction_to_call_request},
rpc::api::eth::helpers::Call,
transaction_pool::TransactionPool,
};
use reth_evm::EvmEnv;
Expand Down Expand Up @@ -57,7 +57,8 @@ fn main() {
if let Some(recipient) = tx.to() {
if args.is_match(&recipient) {
// convert the pool transaction
let call_request = transaction_to_call_request(tx.to_consensus());
let call_request =
TransactionRequest::from_recovered_transaction(tx.to_consensus());

let result = eth_api
.spawn_with_call_at(
Expand Down
5 changes: 3 additions & 2 deletions examples/txpool-tracing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use clap::Parser;
use futures_util::StreamExt;
use reth::{
builder::NodeHandle, chainspec::EthereumChainSpecParser, cli::Cli,
rpc::compat::transaction::transaction_to_call_request, transaction_pool::TransactionPool,
rpc::types::TransactionRequest, transaction_pool::TransactionPool,
};
use reth_node_ethereum::node::EthereumNode;

Expand Down Expand Up @@ -44,7 +44,8 @@ fn main() {
if let Some(recipient) = tx.to() {
if args.is_match(&recipient) {
// trace the transaction with `trace_call`
let callrequest = transaction_to_call_request(tx.to_consensus());
let callrequest =
TransactionRequest::from_recovered_transaction(tx.to_consensus());
let tracerequest = TraceCallRequest::new(callrequest)
.with_trace_type(TraceType::Trace);
if let Ok(trace_result) = traceapi.trace_call(tracerequest).await {
Expand Down

0 comments on commit 54a5fcc

Please sign in to comment.