Skip to content

Commit

Permalink
remove IntoRecoveredTransaction (paradigmxyz#11221)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg authored Sep 25, 2024
1 parent 4ef9635 commit 76a6e0d
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 37 deletions.
1 change: 0 additions & 1 deletion crates/consensus/auto-seal/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_engine_primitives::EngineTypes;
use reth_evm::execute::BlockExecutorProvider;
use reth_primitives::IntoRecoveredTransaction;
use reth_provider::{CanonChainTracker, StateProviderFactory};
use reth_stages_api::PipelineEvent;
use reth_tokio_util::EventStream;
Expand Down
3 changes: 1 addition & 2 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ use reth_primitives::{
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
proofs::{self, calculate_requests_root},
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, EthereumHardforks, Header, IntoRecoveredTransaction, Receipt,
EMPTY_OMMER_ROOT_HASH,
Block, BlockBody, EthereumHardforks, Header, Receipt, EMPTY_OMMER_ROOT_HASH,
};
use reth_provider::{ChainSpecProvider, StateProviderFactory};
use reth_revm::database::StateProviderDatabase;
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/payload/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use reth_primitives::{
constants::BEACON_NONCE,
proofs,
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, Header, IntoRecoveredTransaction, Receipt, TxType, EMPTY_OMMER_ROOT_HASH,
Block, BlockBody, Header, Receipt, TxType, EMPTY_OMMER_ROOT_HASH,
};
use reth_provider::StateProviderFactory;
use reth_revm::database::StateProviderDatabase;
Expand Down
6 changes: 3 additions & 3 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ pub use transaction::BlobTransactionValidationError;

pub use transaction::{
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
IntoRecoveredTransaction, InvalidTransactionError, Signature, Transaction, TransactionMeta,
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxHashOrNumber,
TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
InvalidTransactionError, Signature, Transaction, TransactionMeta, TransactionSigned,
TransactionSignedEcRecovered, TransactionSignedNoHash, TxHashOrNumber, TxType,
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};

Expand Down
9 changes: 0 additions & 9 deletions crates/primitives/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,15 +1634,6 @@ impl Decodable for TransactionSignedEcRecovered {
}
}

/// Ensures the transaction can be sent over the
/// network
pub trait IntoRecoveredTransaction {
/// Converts to this type into a [`TransactionSignedEcRecovered`].
///
/// Note: this takes `&self` since indented usage is via `Arc<Self>`.
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered;
}

/// Generic wrapper with encoded Bytes, such as transaction data.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WithEncoded<T>(Bytes, pub T);
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use reth_primitives::{
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
ResultAndState, SpecId,
},
Block, BlockBody, Header, IntoRecoveredTransaction, Receipt, Requests, SealedBlockWithSenders,
SealedHeader, TransactionSignedEcRecovered, EMPTY_OMMER_ROOT_HASH,
Block, BlockBody, Header, Receipt, Requests, SealedBlockWithSenders, SealedHeader,
TransactionSignedEcRecovered, EMPTY_OMMER_ROOT_HASH,
};
use reth_provider::{
BlockReader, BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, ProviderError,
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use async_trait::async_trait;
use jsonrpsee::{core::RpcResult, server::IdProvider};
use reth_chainspec::ChainInfo;
use reth_node_api::EthApiTypes;
use reth_primitives::{IntoRecoveredTransaction, TransactionSignedEcRecovered};
use reth_primitives::TransactionSignedEcRecovered;
use reth_provider::{BlockIdReader, BlockReader, EvmEnvProvider, ProviderError};
use reth_rpc_eth_api::{EthFilterApiServer, FullEthApiTypes, RpcTransaction, TransactionCompat};
use reth_rpc_eth_types::{
Expand Down
1 change: 0 additions & 1 deletion crates/rpc/rpc/src/eth/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use jsonrpsee::{
server::SubscriptionMessage, types::ErrorObject, PendingSubscriptionSink, SubscriptionSink,
};
use reth_network_api::NetworkInfo;
use reth_primitives::IntoRecoveredTransaction;
use reth_provider::{BlockReader, CanonStateSubscriptions, EvmEnvProvider};
use reth_rpc_eth_api::{pubsub::EthPubSubApiServer, FullEthApiTypes, RpcTransaction};
use reth_rpc_eth_types::logs_utils;
Expand Down
4 changes: 2 additions & 2 deletions crates/transaction-pool/src/maintain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use reth_chainspec::{ChainSpec, ChainSpecProvider};
use reth_execution_types::ChangedAccount;
use reth_fs_util::FsPathError;
use reth_primitives::{
alloy_primitives::Sealable, BlockNumberOrTag, IntoRecoveredTransaction,
PooledTransactionsElementEcRecovered, SealedHeader, TransactionSigned,
alloy_primitives::Sealable, BlockNumberOrTag, PooledTransactionsElementEcRecovered,
SealedHeader, TransactionSigned,
};
use reth_storage_api::{errors::provider::ProviderError, BlockReaderIdExt, StateProviderFactory};
use reth_tasks::TaskSpawner;
Expand Down
3 changes: 1 addition & 2 deletions crates/transaction-pool/src/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ use reth_eth_wire_types::HandleMempoolData;
use reth_execution_types::ChangedAccount;

use reth_primitives::{
BlobTransaction, BlobTransactionSidecar, IntoRecoveredTransaction, PooledTransactionsElement,
TransactionSigned,
BlobTransaction, BlobTransactionSidecar, PooledTransactionsElement, TransactionSigned,
};
use std::{
collections::{HashMap, HashSet},
Expand Down
13 changes: 7 additions & 6 deletions crates/transaction-pool/src/validate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::{
use alloy_primitives::{Address, TxHash, B256, U256};
use futures_util::future::Either;
use reth_primitives::{
BlobTransactionSidecar, IntoRecoveredTransaction, PooledTransactionsElementEcRecovered,
SealedBlock, TransactionSignedEcRecovered,
BlobTransactionSidecar, PooledTransactionsElementEcRecovered, SealedBlock,
TransactionSignedEcRecovered,
};
use std::{fmt, future::Future, time::Instant};

Expand Down Expand Up @@ -380,10 +380,11 @@ impl<T: PoolTransaction> ValidPoolTransaction<T> {
}
}

impl<T: PoolTransaction<Consensus = TransactionSignedEcRecovered>> IntoRecoveredTransaction
for ValidPoolTransaction<T>
{
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
impl<T: PoolTransaction<Consensus = TransactionSignedEcRecovered>> ValidPoolTransaction<T> {
/// Converts to this type into a [`TransactionSignedEcRecovered`].
///
/// Note: this takes `&self` since indented usage is via `Arc<Self>`.
pub fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
self.transaction.clone().into_consensus()
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use reth::{
args::utils::DefaultChainSpecParser,
builder::NodeHandle,
cli::Cli,
primitives::{Address, BlockNumberOrTag, IntoRecoveredTransaction},
primitives::{Address, BlockNumberOrTag},
revm::{
inspector_handle_register,
interpreter::{Interpreter, OpCode},
Expand Down
8 changes: 2 additions & 6 deletions examples/txpool-tracing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ use alloy_rpc_types_trace::{parity::TraceType, tracerequest::TraceCallRequest};
use clap::Parser;
use futures_util::StreamExt;
use reth::{
args::utils::DefaultChainSpecParser,
builder::NodeHandle,
cli::Cli,
primitives::{Address, IntoRecoveredTransaction},
rpc::compat::transaction::transaction_to_call_request,
transaction_pool::TransactionPool,
args::utils::DefaultChainSpecParser, builder::NodeHandle, cli::Cli, primitives::Address,
rpc::compat::transaction::transaction_to_call_request, transaction_pool::TransactionPool,
};
use reth_node_ethereum::node::EthereumNode;

Expand Down

0 comments on commit 76a6e0d

Please sign in to comment.