chore: deprecate recoveredtx alias (#13887)

This commit is contained in:
Matthias Seitz
2025-01-20 19:07:14 +01:00
committed by GitHub
parent 1e71002056
commit 64214fd186
22 changed files with 130 additions and 125 deletions

View File

@ -4,7 +4,7 @@
use alloy_primitives::B256;
use alloy_rpc_types_eth::TransactionInfo;
use reth_primitives::{RecoveredTx, TransactionSigned};
use reth_primitives::{Recovered, TransactionSigned};
use reth_primitives_traits::SignedTransaction;
use reth_rpc_types_compat::TransactionCompat;
@ -12,13 +12,13 @@ use reth_rpc_types_compat::TransactionCompat;
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum TransactionSource<T = TransactionSigned> {
/// Transaction exists in the pool (Pending)
Pool(RecoveredTx<T>),
Pool(Recovered<T>),
/// Transaction already included in a block
///
/// This can be a historical block or a pending block (received from the CL)
Block {
/// Transaction fetched via provider
transaction: RecoveredTx<T>,
transaction: Recovered<T>,
/// Index of the transaction in the block
index: u64,
/// Hash of the block.
@ -34,7 +34,7 @@ pub enum TransactionSource<T = TransactionSigned> {
impl<T: SignedTransaction> TransactionSource<T> {
/// Consumes the type and returns the wrapped transaction.
pub fn into_recovered(self) -> RecoveredTx<T> {
pub fn into_recovered(self) -> Recovered<T> {
self.into()
}
@ -60,7 +60,7 @@ impl<T: SignedTransaction> TransactionSource<T> {
}
/// Returns the transaction and block related info, if not pending
pub fn split(self) -> (RecoveredTx<T>, TransactionInfo) {
pub fn split(self) -> (Recovered<T>, TransactionInfo) {
match self {
Self::Pool(tx) => {
let hash = tx.trie_hash();
@ -83,7 +83,7 @@ impl<T: SignedTransaction> TransactionSource<T> {
}
}
impl<T> From<TransactionSource<T>> for RecoveredTx<T> {
impl<T> From<TransactionSource<T>> for Recovered<T> {
fn from(value: TransactionSource<T>) -> Self {
match value {
TransactionSource::Pool(tx) => tx,

View File

@ -1,7 +1,7 @@
//! Commonly used code snippets
use super::{EthApiError, EthResult};
use reth_primitives::{transaction::SignedTransactionIntoRecoveredExt, RecoveredTx};
use reth_primitives::{transaction::SignedTransactionIntoRecoveredExt, Recovered};
use reth_primitives_traits::SignedTransaction;
use std::future::Future;
@ -11,7 +11,7 @@ use std::future::Future;
/// malformed.
///
/// See [`alloy_eips::eip2718::Decodable2718::decode_2718`]
pub fn recover_raw_transaction<T: SignedTransaction>(mut data: &[u8]) -> EthResult<RecoveredTx<T>> {
pub fn recover_raw_transaction<T: SignedTransaction>(mut data: &[u8]) -> EthResult<Recovered<T>> {
if data.is_empty() {
return Err(EthApiError::EmptyRawTransactionData)
}

View File

@ -4,7 +4,7 @@ use core::error;
use std::fmt;
use alloy_rpc_types_eth::{request::TransactionRequest, TransactionInfo};
use reth_primitives::{RecoveredTx, TransactionSigned};
use reth_primitives::{Recovered, TransactionSigned};
use serde::{Deserialize, Serialize};
/// Builds RPC transaction w.r.t. network.
@ -26,7 +26,7 @@ pub trait TransactionCompat<T = TransactionSigned>:
/// Wrapper for `fill()` with default `TransactionInfo`
/// Create a new rpc transaction result for a _pending_ signed transaction, setting block
/// environment related fields to `None`.
fn fill_pending(&self, tx: RecoveredTx<T>) -> Result<Self::Transaction, Self::Error> {
fn fill_pending(&self, tx: Recovered<T>) -> Result<Self::Transaction, Self::Error> {
self.fill(tx, TransactionInfo::default())
}
@ -37,7 +37,7 @@ pub trait TransactionCompat<T = TransactionSigned>:
/// transaction was mined.
fn fill(
&self,
tx: RecoveredTx<T>,
tx: Recovered<T>,
tx_inf: TransactionInfo,
) -> Result<Self::Transaction, Self::Error>;
@ -51,9 +51,9 @@ pub trait TransactionCompat<T = TransactionSigned>:
fn otterscan_api_truncate_input(tx: &mut Self::Transaction);
}
/// Convert [`RecoveredTx`] to [`TransactionRequest`]
/// Convert [`Recovered`] to [`TransactionRequest`]
pub fn transaction_to_call_request<T: alloy_consensus::Transaction>(
tx: RecoveredTx<T>,
tx: Recovered<T>,
) -> TransactionRequest {
let from = tx.signer();
TransactionRequest::from_transaction_with_sender(tx.into_tx(), from)

View File

@ -5,7 +5,7 @@ use alloy_network::{Ethereum, Network};
use alloy_primitives::PrimitiveSignature as Signature;
use alloy_rpc_types::TransactionRequest;
use alloy_rpc_types_eth::{Transaction, TransactionInfo};
use reth_primitives::{RecoveredTx, TransactionSigned};
use reth_primitives::{Recovered, TransactionSigned};
use reth_primitives_traits::SignedTransaction;
use reth_rpc_eth_api::EthApiTypes;
use reth_rpc_eth_types::EthApiError;
@ -40,7 +40,7 @@ where
fn fill(
&self,
tx: RecoveredTx<TransactionSigned>,
tx: Recovered<TransactionSigned>,
tx_info: TransactionInfo,
) -> Result<Self::Transaction, Self::Error> {
let from = tx.signer();