mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: remove PooledTransactionsElement alias (#13384)
This commit is contained in:
@ -23,7 +23,7 @@ use reth_node_builder::{
|
|||||||
BuilderContext, Node, NodeAdapter, NodeComponentsBuilder, PayloadBuilderConfig, PayloadTypes,
|
BuilderContext, Node, NodeAdapter, NodeComponentsBuilder, PayloadBuilderConfig, PayloadTypes,
|
||||||
};
|
};
|
||||||
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
||||||
use reth_primitives::{EthPrimitives, PooledTransactionsElement};
|
use reth_primitives::{EthPrimitives, PooledTransaction};
|
||||||
use reth_provider::{CanonStateSubscriptions, EthStorage};
|
use reth_provider::{CanonStateSubscriptions, EthStorage};
|
||||||
use reth_rpc::EthApi;
|
use reth_rpc::EthApi;
|
||||||
use reth_tracing::tracing::{debug, info};
|
use reth_tracing::tracing::{debug, info};
|
||||||
@ -312,10 +312,7 @@ impl<Node, Pool> NetworkBuilder<Node, Pool> for EthereumNetworkBuilder
|
|||||||
where
|
where
|
||||||
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>>,
|
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>>,
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<Consensus = TxTy<Node::Types>, Pooled = PooledTransaction>,
|
||||||
Consensus = TxTy<Node::Types>,
|
|
||||||
Pooled = PooledTransactionsElement,
|
|
||||||
>,
|
|
||||||
> + Unpin
|
> + Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,6 +50,6 @@ impl NetworkPrimitives for EthNetworkPrimitives {
|
|||||||
type BlockBody = reth_primitives::BlockBody;
|
type BlockBody = reth_primitives::BlockBody;
|
||||||
type Block = reth_primitives::Block;
|
type Block = reth_primitives::Block;
|
||||||
type BroadcastedTransaction = reth_primitives::TransactionSigned;
|
type BroadcastedTransaction = reth_primitives::TransactionSigned;
|
||||||
type PooledTransaction = reth_primitives::PooledTransactionsElement;
|
type PooledTransaction = reth_primitives::PooledTransaction;
|
||||||
type Receipt = reth_primitives::Receipt;
|
type Receipt = reth_primitives::Receipt;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use alloy_primitives::B256;
|
|||||||
use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
|
use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper};
|
||||||
use derive_more::{Constructor, Deref, IntoIterator};
|
use derive_more::{Constructor, Deref, IntoIterator};
|
||||||
use reth_codecs_derive::add_arbitrary_tests;
|
use reth_codecs_derive::add_arbitrary_tests;
|
||||||
use reth_primitives::PooledTransactionsElement;
|
use reth_primitives::PooledTransaction;
|
||||||
|
|
||||||
/// A list of transaction hashes that the peer would like transaction bodies for.
|
/// A list of transaction hashes that the peer would like transaction bodies for.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
|
#[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)]
|
||||||
@ -46,7 +46,7 @@ where
|
|||||||
Constructor,
|
Constructor,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct PooledTransactions<T = PooledTransactionsElement>(
|
pub struct PooledTransactions<T = PooledTransaction>(
|
||||||
/// The transaction bodies, each of which should correspond to a requested hash.
|
/// The transaction bodies, each of which should correspond to a requested hash.
|
||||||
pub Vec<T>,
|
pub Vec<T>,
|
||||||
);
|
);
|
||||||
@ -88,7 +88,7 @@ mod tests {
|
|||||||
use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256};
|
use alloy_primitives::{hex, PrimitiveSignature as Signature, TxKind, U256};
|
||||||
use alloy_rlp::{Decodable, Encodable};
|
use alloy_rlp::{Decodable, Encodable};
|
||||||
use reth_chainspec::MIN_TRANSACTION_GAS;
|
use reth_chainspec::MIN_TRANSACTION_GAS;
|
||||||
use reth_primitives::{PooledTransactionsElement, Transaction, TransactionSigned};
|
use reth_primitives::{PooledTransaction, Transaction, TransactionSigned};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -175,17 +175,17 @@ mod tests {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
let message: Vec<PooledTransactionsElement> = txs
|
let message: Vec<PooledTransaction> = txs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx| {
|
.map(|tx| {
|
||||||
PooledTransactionsElement::try_from(tx)
|
PooledTransaction::try_from(tx)
|
||||||
.expect("Failed to convert TransactionSigned to PooledTransactionsElement")
|
.expect("Failed to convert TransactionSigned to PooledTransaction")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let request = RequestPair {
|
let request = RequestPair {
|
||||||
request_id: 1111,
|
request_id: 1111,
|
||||||
message: PooledTransactions(message), /* Assuming PooledTransactions wraps a
|
message: PooledTransactions(message), /* Assuming PooledTransactions wraps a
|
||||||
* Vec<PooledTransactionsElement> */
|
* Vec<PooledTransaction> */
|
||||||
};
|
};
|
||||||
request.encode(&mut data);
|
request.encode(&mut data);
|
||||||
assert_eq!(data, expected);
|
assert_eq!(data, expected);
|
||||||
@ -241,11 +241,11 @@ mod tests {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
let message: Vec<PooledTransactionsElement> = txs
|
let message: Vec<PooledTransaction> = txs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx| {
|
.map(|tx| {
|
||||||
PooledTransactionsElement::try_from(tx)
|
PooledTransaction::try_from(tx)
|
||||||
.expect("Failed to convert TransactionSigned to PooledTransactionsElement")
|
.expect("Failed to convert TransactionSigned to PooledTransaction")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let expected = RequestPair { request_id: 1111, message: PooledTransactions(message) };
|
let expected = RequestPair { request_id: 1111, message: PooledTransactions(message) };
|
||||||
@ -373,11 +373,11 @@ mod tests {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
let message: Vec<PooledTransactionsElement> = txs
|
let message: Vec<PooledTransaction> = txs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx| {
|
.map(|tx| {
|
||||||
PooledTransactionsElement::try_from(tx)
|
PooledTransaction::try_from(tx)
|
||||||
.expect("Failed to convert TransactionSigned to PooledTransactionsElement")
|
.expect("Failed to convert TransactionSigned to PooledTransaction")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let expected_transactions =
|
let expected_transactions =
|
||||||
@ -510,11 +510,11 @@ mod tests {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
let message: Vec<PooledTransactionsElement> = txs
|
let message: Vec<PooledTransaction> = txs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx| {
|
.map(|tx| {
|
||||||
PooledTransactionsElement::try_from(tx)
|
PooledTransaction::try_from(tx)
|
||||||
.expect("Failed to convert TransactionSigned to PooledTransactionsElement")
|
.expect("Failed to convert TransactionSigned to PooledTransaction")
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
let transactions = RequestPair { request_id: 0, message: PooledTransactions(message) };
|
let transactions = RequestPair { request_id: 0, message: PooledTransactions(message) };
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use alloy_eips::eip2718::Decodable2718;
|
|||||||
use alloy_primitives::hex;
|
use alloy_primitives::hex;
|
||||||
use alloy_rlp::{Decodable, Encodable};
|
use alloy_rlp::{Decodable, Encodable};
|
||||||
use reth_eth_wire::{EthNetworkPrimitives, EthVersion, PooledTransactions, ProtocolMessage};
|
use reth_eth_wire::{EthNetworkPrimitives, EthVersion, PooledTransactions, ProtocolMessage};
|
||||||
use reth_primitives::PooledTransactionsElement;
|
use reth_primitives::PooledTransaction;
|
||||||
use std::{fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
use test_fuzz::test_fuzz;
|
use test_fuzz::test_fuzz;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ fn decode_blob_transaction_data() {
|
|||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/blob_transaction");
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/blob_transaction");
|
||||||
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
||||||
let hex_data = hex::decode(data.trim()).unwrap();
|
let hex_data = hex::decode(data.trim()).unwrap();
|
||||||
let _txs = PooledTransactionsElement::decode(&mut &hex_data[..]).unwrap();
|
let _txs = PooledTransaction::decode(&mut &hex_data[..]).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -71,5 +71,5 @@ fn decode_blob_rpc_transaction() {
|
|||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/rpc_blob_transaction");
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("testdata/rpc_blob_transaction");
|
||||||
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
let data = fs::read_to_string(network_data_path).expect("Unable to read file");
|
||||||
let hex_data = hex::decode(data.trim()).unwrap();
|
let hex_data = hex::decode(data.trim()).unwrap();
|
||||||
let _txs = PooledTransactionsElement::decode_2718(&mut hex_data.as_ref()).unwrap();
|
let _txs = PooledTransaction::decode_2718(&mut hex_data.as_ref()).unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ use reth_network_api::{
|
|||||||
NetworkEvent, NetworkEventListenerProvider, NetworkInfo, Peers,
|
NetworkEvent, NetworkEventListenerProvider, NetworkInfo, Peers,
|
||||||
};
|
};
|
||||||
use reth_network_peers::PeerId;
|
use reth_network_peers::PeerId;
|
||||||
use reth_primitives::{PooledTransactionsElement, TransactionSigned};
|
use reth_primitives::{PooledTransaction, TransactionSigned};
|
||||||
use reth_storage_api::{
|
use reth_storage_api::{
|
||||||
noop::NoopProvider, BlockReader, BlockReaderIdExt, HeaderProvider, StateProviderFactory,
|
noop::NoopProvider, BlockReader, BlockReaderIdExt, HeaderProvider, StateProviderFactory,
|
||||||
};
|
};
|
||||||
@ -229,10 +229,7 @@ where
|
|||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<Consensus = TransactionSigned, Pooled = PooledTransaction>,
|
||||||
Consensus = TransactionSigned,
|
|
||||||
Pooled = PooledTransactionsElement,
|
|
||||||
>,
|
|
||||||
> + Unpin
|
> + Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
@ -300,10 +297,7 @@ where
|
|||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<Consensus = TransactionSigned, Pooled = PooledTransaction>,
|
||||||
Consensus = TransactionSigned,
|
|
||||||
Pooled = PooledTransactionsElement,
|
|
||||||
>,
|
|
||||||
> + Unpin
|
> + Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
@ -537,10 +531,7 @@ where
|
|||||||
+ Unpin
|
+ Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<Consensus = TransactionSigned, Pooled = PooledTransaction>,
|
||||||
Consensus = TransactionSigned,
|
|
||||||
Pooled = PooledTransactionsElement,
|
|
||||||
>,
|
|
||||||
> + Unpin
|
> + Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -49,7 +49,7 @@ use reth_eth_wire_types::{EthNetworkPrimitives, NetworkPrimitives};
|
|||||||
use reth_network_api::PeerRequest;
|
use reth_network_api::PeerRequest;
|
||||||
use reth_network_p2p::error::{RequestError, RequestResult};
|
use reth_network_p2p::error::{RequestError, RequestResult};
|
||||||
use reth_network_peers::PeerId;
|
use reth_network_peers::PeerId;
|
||||||
use reth_primitives::PooledTransactionsElement;
|
use reth_primitives::PooledTransaction;
|
||||||
use reth_primitives_traits::SignedTransaction;
|
use reth_primitives_traits::SignedTransaction;
|
||||||
use schnellru::ByLength;
|
use schnellru::ByLength;
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
@ -1084,7 +1084,7 @@ impl TxFetchMetadata {
|
|||||||
|
|
||||||
/// Represents possible events from fetching transactions.
|
/// Represents possible events from fetching transactions.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum FetchEvent<T = PooledTransactionsElement> {
|
pub enum FetchEvent<T = PooledTransaction> {
|
||||||
/// Triggered when transactions are successfully fetched.
|
/// Triggered when transactions are successfully fetched.
|
||||||
TransactionsFetched {
|
TransactionsFetched {
|
||||||
/// The ID of the peer from which transactions were fetched.
|
/// The ID of the peer from which transactions were fetched.
|
||||||
@ -1108,7 +1108,7 @@ pub enum FetchEvent<T = PooledTransactionsElement> {
|
|||||||
|
|
||||||
/// An inflight request for [`PooledTransactions`] from a peer.
|
/// An inflight request for [`PooledTransactions`] from a peer.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GetPooledTxRequest<T = PooledTransactionsElement> {
|
pub struct GetPooledTxRequest<T = PooledTransaction> {
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
/// Transaction hashes that were requested, for cleanup purposes
|
/// Transaction hashes that were requested, for cleanup purposes
|
||||||
requested_hashes: RequestTxHashes,
|
requested_hashes: RequestTxHashes,
|
||||||
@ -1118,7 +1118,7 @@ pub struct GetPooledTxRequest<T = PooledTransactionsElement> {
|
|||||||
/// Upon reception of a response, a [`GetPooledTxRequest`] is deconstructed to form a
|
/// Upon reception of a response, a [`GetPooledTxRequest`] is deconstructed to form a
|
||||||
/// [`GetPooledTxResponse`].
|
/// [`GetPooledTxResponse`].
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GetPooledTxResponse<T = PooledTransactionsElement> {
|
pub struct GetPooledTxResponse<T = PooledTransaction> {
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
/// Transaction hashes that were requested, for cleanup purposes, since peer may only return a
|
/// Transaction hashes that were requested, for cleanup purposes, since peer may only return a
|
||||||
/// subset of requested hashes.
|
/// subset of requested hashes.
|
||||||
@ -1131,7 +1131,7 @@ pub struct GetPooledTxResponse<T = PooledTransactionsElement> {
|
|||||||
#[must_use = "futures do nothing unless polled"]
|
#[must_use = "futures do nothing unless polled"]
|
||||||
#[pin_project::pin_project]
|
#[pin_project::pin_project]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GetPooledTxRequestFut<T = PooledTransactionsElement> {
|
pub struct GetPooledTxRequestFut<T = PooledTransaction> {
|
||||||
#[pin]
|
#[pin]
|
||||||
inner: Option<GetPooledTxRequest<T>>,
|
inner: Option<GetPooledTxRequest<T>>,
|
||||||
}
|
}
|
||||||
@ -1517,10 +1517,10 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn verify_response_hashes() {
|
fn verify_response_hashes() {
|
||||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598daa");
|
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598daa");
|
||||||
let signed_tx_1: PooledTransactionsElement =
|
let signed_tx_1: PooledTransaction =
|
||||||
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
||||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
||||||
let signed_tx_2: PooledTransactionsElement =
|
let signed_tx_2: PooledTransaction =
|
||||||
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
||||||
|
|
||||||
// only tx 1 is requested
|
// only tx 1 is requested
|
||||||
|
|||||||
@ -42,7 +42,7 @@ pub trait ValidateTx68 {
|
|||||||
|
|
||||||
/// Returns the reasonable minimum encoded transaction length, if any. This property is not
|
/// Returns the reasonable minimum encoded transaction length, if any. This property is not
|
||||||
/// spec'ed out but can be inferred by looking at which
|
/// spec'ed out but can be inferred by looking at which
|
||||||
/// [`reth_primitives::PooledTransactionsElement`] will successfully pass decoding
|
/// [`reth_primitives::PooledTransaction`] will successfully pass decoding
|
||||||
/// for any given transaction type.
|
/// for any given transaction type.
|
||||||
fn min_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
|
fn min_encoded_tx_length(&self, ty: TxType) -> Option<usize>;
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use reth_node_core::{
|
|||||||
version::{CARGO_PKG_VERSION, CLIENT_CODE, NAME_CLIENT, VERGEN_GIT_SHA},
|
version::{CARGO_PKG_VERSION, CLIENT_CODE, NAME_CLIENT, VERGEN_GIT_SHA},
|
||||||
};
|
};
|
||||||
use reth_payload_builder::PayloadStore;
|
use reth_payload_builder::PayloadStore;
|
||||||
use reth_primitives::{EthPrimitives, PooledTransactionsElement};
|
use reth_primitives::{EthPrimitives, PooledTransaction};
|
||||||
use reth_provider::providers::ProviderNodeTypes;
|
use reth_provider::providers::ProviderNodeTypes;
|
||||||
use reth_rpc::{
|
use reth_rpc::{
|
||||||
eth::{EthApiTypes, FullEthApiServer},
|
eth::{EthApiTypes, FullEthApiServer},
|
||||||
@ -405,7 +405,7 @@ where
|
|||||||
impl<N, EthApi, EV> RpcAddOns<N, EthApi, EV>
|
impl<N, EthApi, EV> RpcAddOns<N, EthApi, EV>
|
||||||
where
|
where
|
||||||
N: FullNodeComponents<
|
N: FullNodeComponents<
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
EthApi: EthApiTypes
|
EthApi: EthApiTypes
|
||||||
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
|
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
|
||||||
@ -536,7 +536,7 @@ impl<N, EthApi, EV> NodeAddOns<N> for RpcAddOns<N, EthApi, EV>
|
|||||||
where
|
where
|
||||||
N: FullNodeComponents<
|
N: FullNodeComponents<
|
||||||
Types: ProviderNodeTypes<Primitives = EthPrimitives>,
|
Types: ProviderNodeTypes<Primitives = EthPrimitives>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
EthApi: EthApiTypes
|
EthApi: EthApiTypes
|
||||||
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
|
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
|
||||||
|
|||||||
@ -213,7 +213,7 @@ impl Decodable for TransactionSigned {
|
|||||||
/// This cannot be used for decoding EIP-4844 transactions in p2p `PooledTransactions`, since
|
/// This cannot be used for decoding EIP-4844 transactions in p2p `PooledTransactions`, since
|
||||||
/// the EIP-4844 variant of [`TransactionSigned`] does not include the blob sidecar.
|
/// the EIP-4844 variant of [`TransactionSigned`] does not include the blob sidecar.
|
||||||
///
|
///
|
||||||
/// For a method suitable for decoding pooled transactions, see \[`PooledTransactionsElement`\].
|
/// For a method suitable for decoding pooled transactions, see \[`PooledTransaction`\].
|
||||||
///
|
///
|
||||||
/// CAUTION: Due to a quirk in [`Header::decode`], this method will succeed even if a typed
|
/// CAUTION: Due to a quirk in [`Header::decode`], this method will succeed even if a typed
|
||||||
/// transaction is encoded in this format, and does not start with a RLP header:
|
/// transaction is encoded in this format, and does not start with a RLP header:
|
||||||
|
|||||||
@ -36,7 +36,7 @@ use reth_optimism_rpc::{
|
|||||||
OpEthApi, SequencerClient,
|
OpEthApi, SequencerClient,
|
||||||
};
|
};
|
||||||
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
||||||
use reth_primitives::{BlockBody, PooledTransactionsElement, TransactionSigned};
|
use reth_primitives::{BlockBody, PooledTransaction, TransactionSigned};
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
providers::ChainStorage, BlockBodyReader, BlockBodyWriter, CanonStateSubscriptions,
|
providers::ChainStorage, BlockBodyReader, BlockBodyWriter, CanonStateSubscriptions,
|
||||||
ChainSpecProvider, DBProvider, EthStorage, ProviderResult, ReadBodyInput, StorageLocation,
|
ChainSpecProvider, DBProvider, EthStorage, ProviderResult, ReadBodyInput, StorageLocation,
|
||||||
@ -252,7 +252,7 @@ where
|
|||||||
Storage = OpStorage,
|
Storage = OpStorage,
|
||||||
Engine = OpEngineTypes,
|
Engine = OpEngineTypes,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
||||||
{
|
{
|
||||||
@ -303,7 +303,7 @@ where
|
|||||||
Storage = OpStorage,
|
Storage = OpStorage,
|
||||||
Engine = OpEngineTypes,
|
Engine = OpEngineTypes,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
||||||
{
|
{
|
||||||
@ -666,10 +666,7 @@ impl<Node, Pool> NetworkBuilder<Node, Pool> for OpNetworkBuilder
|
|||||||
where
|
where
|
||||||
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives>>,
|
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives>>,
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<Consensus = TxTy<Node::Types>, Pooled = PooledTransaction>,
|
||||||
Consensus = TxTy<Node::Types>,
|
|
||||||
Pooled = PooledTransactionsElement,
|
|
||||||
>,
|
|
||||||
> + Unpin
|
> + Unpin
|
||||||
+ 'static,
|
+ 'static,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,15 +43,13 @@ pub use reth_primitives_traits::{
|
|||||||
};
|
};
|
||||||
pub use static_file::StaticFileSegment;
|
pub use static_file::StaticFileSegment;
|
||||||
|
|
||||||
|
pub use alloy_consensus::{transaction::PooledTransaction, ReceiptWithBloom};
|
||||||
pub use transaction::{
|
pub use transaction::{
|
||||||
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
|
util::secp256k1::{public_key_to_address, recover_signer_unchecked, sign_message},
|
||||||
InvalidTransactionError, PooledTransactionsElement, PooledTransactionsElementEcRecovered,
|
InvalidTransactionError, PooledTransactionsElementEcRecovered, RecoveredTx, Transaction,
|
||||||
RecoveredTx, Transaction, TransactionMeta, TransactionSigned, TransactionSignedEcRecovered,
|
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TxType,
|
||||||
TxType,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use alloy_consensus::ReceiptWithBloom;
|
|
||||||
|
|
||||||
// Re-exports
|
// Re-exports
|
||||||
pub use reth_ethereum_forks::*;
|
pub use reth_ethereum_forks::*;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
//! Transaction types.
|
//! Transaction types.
|
||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
pub use alloy_consensus::transaction::PooledTransaction;
|
||||||
use alloy_consensus::{
|
use alloy_consensus::{
|
||||||
transaction::{PooledTransaction, RlpEcdsaTx},
|
transaction::RlpEcdsaTx, SignableTransaction, Signed, Transaction as _, TxEip1559, TxEip2930,
|
||||||
SignableTransaction, Signed, Transaction as _, TxEip1559, TxEip2930, TxEip4844,
|
TxEip4844, TxEip4844Variant, TxEip4844WithSidecar, TxEip7702, TxLegacy, Typed2718,
|
||||||
TxEip4844Variant, TxEip4844WithSidecar, TxEip7702, TxLegacy, Typed2718, TypedTransaction,
|
TypedTransaction,
|
||||||
};
|
};
|
||||||
use alloy_eips::{
|
use alloy_eips::{
|
||||||
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
|
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
|
||||||
@ -27,7 +28,7 @@ use once_cell::sync::{Lazy as LazyLock, OnceCell as OnceLock};
|
|||||||
use op_alloy_consensus::DepositTransaction;
|
use op_alloy_consensus::DepositTransaction;
|
||||||
#[cfg(feature = "optimism")]
|
#[cfg(feature = "optimism")]
|
||||||
use op_alloy_consensus::TxDeposit;
|
use op_alloy_consensus::TxDeposit;
|
||||||
pub use pooled::{PooledTransactionsElement, PooledTransactionsElementEcRecovered};
|
pub use pooled::PooledTransactionsElementEcRecovered;
|
||||||
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
|
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
|
||||||
pub use reth_primitives_traits::{
|
pub use reth_primitives_traits::{
|
||||||
transaction::error::{
|
transaction::error::{
|
||||||
@ -853,25 +854,25 @@ impl TransactionSigned {
|
|||||||
&self.transaction
|
&self.transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tries to convert a [`TransactionSigned`] into a [`PooledTransactionsElement`].
|
/// Tries to convert a [`TransactionSigned`] into a [`PooledTransaction`].
|
||||||
///
|
///
|
||||||
/// This function used as a helper to convert from a decoded p2p broadcast message to
|
/// This function used as a helper to convert from a decoded p2p broadcast message to
|
||||||
/// [`PooledTransactionsElement`]. Since EIP4844 variants are disallowed to be broadcasted on
|
/// [`PooledTransaction`]. Since EIP4844 variants are disallowed to be broadcasted on
|
||||||
/// p2p, return an err if `tx` is [`Transaction::Eip4844`].
|
/// p2p, return an err if `tx` is [`Transaction::Eip4844`].
|
||||||
pub fn try_into_pooled(self) -> Result<PooledTransactionsElement, Self> {
|
pub fn try_into_pooled(self) -> Result<PooledTransaction, Self> {
|
||||||
let hash = self.hash();
|
let hash = self.hash();
|
||||||
match self {
|
match self {
|
||||||
Self { transaction: Transaction::Legacy(tx), signature, .. } => {
|
Self { transaction: Transaction::Legacy(tx), signature, .. } => {
|
||||||
Ok(PooledTransactionsElement::Legacy(Signed::new_unchecked(tx, signature, hash)))
|
Ok(PooledTransaction::Legacy(Signed::new_unchecked(tx, signature, hash)))
|
||||||
}
|
}
|
||||||
Self { transaction: Transaction::Eip2930(tx), signature, .. } => {
|
Self { transaction: Transaction::Eip2930(tx), signature, .. } => {
|
||||||
Ok(PooledTransactionsElement::Eip2930(Signed::new_unchecked(tx, signature, hash)))
|
Ok(PooledTransaction::Eip2930(Signed::new_unchecked(tx, signature, hash)))
|
||||||
}
|
}
|
||||||
Self { transaction: Transaction::Eip1559(tx), signature, .. } => {
|
Self { transaction: Transaction::Eip1559(tx), signature, .. } => {
|
||||||
Ok(PooledTransactionsElement::Eip1559(Signed::new_unchecked(tx, signature, hash)))
|
Ok(PooledTransaction::Eip1559(Signed::new_unchecked(tx, signature, hash)))
|
||||||
}
|
}
|
||||||
Self { transaction: Transaction::Eip7702(tx), signature, .. } => {
|
Self { transaction: Transaction::Eip7702(tx), signature, .. } => {
|
||||||
Ok(PooledTransactionsElement::Eip7702(Signed::new_unchecked(tx, signature, hash)))
|
Ok(PooledTransaction::Eip7702(Signed::new_unchecked(tx, signature, hash)))
|
||||||
}
|
}
|
||||||
// Not supported because missing blob sidecar
|
// Not supported because missing blob sidecar
|
||||||
tx @ Self { transaction: Transaction::Eip4844(_), .. } => Err(tx),
|
tx @ Self { transaction: Transaction::Eip4844(_), .. } => Err(tx),
|
||||||
@ -889,13 +890,13 @@ impl TransactionSigned {
|
|||||||
pub fn try_into_pooled_eip4844(
|
pub fn try_into_pooled_eip4844(
|
||||||
self,
|
self,
|
||||||
sidecar: BlobTransactionSidecar,
|
sidecar: BlobTransactionSidecar,
|
||||||
) -> Result<PooledTransactionsElement, Self> {
|
) -> Result<PooledTransaction, Self> {
|
||||||
let hash = self.hash();
|
let hash = self.hash();
|
||||||
Ok(match self {
|
Ok(match self {
|
||||||
// If the transaction is an EIP-4844 transaction...
|
// If the transaction is an EIP-4844 transaction...
|
||||||
Self { transaction: Transaction::Eip4844(tx), signature, .. } => {
|
Self { transaction: Transaction::Eip4844(tx), signature, .. } => {
|
||||||
// Construct a pooled eip488 tx with the provided sidecar.
|
// Construct a pooled eip488 tx with the provided sidecar.
|
||||||
PooledTransactionsElement::Eip4844(Signed::new_unchecked(
|
PooledTransaction::Eip4844(Signed::new_unchecked(
|
||||||
TxEip4844WithSidecar { tx, sidecar },
|
TxEip4844WithSidecar { tx, sidecar },
|
||||||
signature,
|
signature,
|
||||||
hash,
|
hash,
|
||||||
@ -1251,7 +1252,7 @@ impl Decodable for TransactionSigned {
|
|||||||
/// This cannot be used for decoding EIP-4844 transactions in p2p `PooledTransactions`, since
|
/// This cannot be used for decoding EIP-4844 transactions in p2p `PooledTransactions`, since
|
||||||
/// the EIP-4844 variant of [`TransactionSigned`] does not include the blob sidecar.
|
/// the EIP-4844 variant of [`TransactionSigned`] does not include the blob sidecar.
|
||||||
///
|
///
|
||||||
/// For a method suitable for decoding pooled transactions, see [`PooledTransactionsElement`].
|
/// For a method suitable for decoding pooled transactions, see [`PooledTransaction`].
|
||||||
///
|
///
|
||||||
/// CAUTION: Due to a quirk in [`Header::decode`], this method will succeed even if a typed
|
/// CAUTION: Due to a quirk in [`Header::decode`], this method will succeed even if a typed
|
||||||
/// transaction is encoded in this format, and does not start with a RLP header:
|
/// transaction is encoded in this format, and does not start with a RLP header:
|
||||||
|
|||||||
@ -2,14 +2,12 @@
|
|||||||
//! response to `GetPooledTransactions`.
|
//! response to `GetPooledTransactions`.
|
||||||
|
|
||||||
use crate::RecoveredTx;
|
use crate::RecoveredTx;
|
||||||
|
use alloy_consensus::transaction::PooledTransaction;
|
||||||
use alloy_eips::eip4844::BlobTransactionSidecar;
|
use alloy_eips::eip4844::BlobTransactionSidecar;
|
||||||
use reth_primitives_traits::transaction::error::TransactionConversionError;
|
use reth_primitives_traits::transaction::error::TransactionConversionError;
|
||||||
|
|
||||||
/// Tmp alias for the transaction type.
|
|
||||||
pub type PooledTransactionsElement = alloy_consensus::transaction::PooledTransaction;
|
|
||||||
|
|
||||||
/// A signed pooled transaction with recovered signer.
|
/// A signed pooled transaction with recovered signer.
|
||||||
pub type PooledTransactionsElementEcRecovered<T = PooledTransactionsElement> = RecoveredTx<T>;
|
pub type PooledTransactionsElementEcRecovered<T = PooledTransaction> = RecoveredTx<T>;
|
||||||
|
|
||||||
impl PooledTransactionsElementEcRecovered {
|
impl PooledTransactionsElementEcRecovered {
|
||||||
/// Transform back to [`RecoveredTx`]
|
/// Transform back to [`RecoveredTx`]
|
||||||
@ -39,7 +37,7 @@ impl TryFrom<RecoveredTx> for PooledTransactionsElementEcRecovered {
|
|||||||
type Error = TransactionConversionError;
|
type Error = TransactionConversionError;
|
||||||
|
|
||||||
fn try_from(tx: RecoveredTx) -> Result<Self, Self::Error> {
|
fn try_from(tx: RecoveredTx) -> Result<Self, Self::Error> {
|
||||||
match PooledTransactionsElement::try_from(tx.signed_transaction) {
|
match PooledTransaction::try_from(tx.signed_transaction) {
|
||||||
Ok(pooled_transaction) => {
|
Ok(pooled_transaction) => {
|
||||||
Ok(Self::from_signed_transaction(pooled_transaction, tx.signer))
|
Ok(Self::from_signed_transaction(pooled_transaction, tx.signer))
|
||||||
}
|
}
|
||||||
@ -78,7 +76,7 @@ mod tests {
|
|||||||
|
|
||||||
for hex_data in &input_too_short {
|
for hex_data in &input_too_short {
|
||||||
let input_rlp = &mut &hex_data[..];
|
let input_rlp = &mut &hex_data[..];
|
||||||
let res = PooledTransactionsElement::decode(input_rlp);
|
let res = PooledTransaction::decode(input_rlp);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
res.is_err(),
|
res.is_err(),
|
||||||
@ -88,7 +86,7 @@ mod tests {
|
|||||||
|
|
||||||
// this is a legacy tx so we can attempt the same test with decode_enveloped
|
// this is a legacy tx so we can attempt the same test with decode_enveloped
|
||||||
let input_rlp = &mut &hex_data[..];
|
let input_rlp = &mut &hex_data[..];
|
||||||
let res = PooledTransactionsElement::decode_2718(input_rlp);
|
let res = PooledTransaction::decode_2718(input_rlp);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
res.is_err(),
|
res.is_err(),
|
||||||
@ -104,7 +102,7 @@ mod tests {
|
|||||||
let data = hex!("02f903d382426882ba09832dc6c0848674742682ed9694714b6a4ea9b94a8a7d9fd362ed72630688c8898c80b90364492d24749189822d8512430d3f3ff7a2ede675ac08265c08e2c56ff6fdaa66dae1cdbe4a5d1d7809f3e99272d067364e597542ac0c369d69e22a6399c3e9bee5da4b07e3f3fdc34c32c3d88aa2268785f3e3f8086df0934b10ef92cfffc2e7f3d90f5e83302e31382e302d64657600000000000000000000000000000000000000000000569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd000000000000000000000000e1e210594771824dad216568b91c9cb4ceed361c00000000000000000000000000000000000000000000000000000000000546e00000000000000000000000000000000000000000000000000000000000e4e1c00000000000000000000000000000000000000000000000000000000065d6750c00000000000000000000000000000000000000000000000000000000000f288000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000f1628e56fa6d8c50e5b984a58c0df14de31c7b857ce7ba499945b99252976a93d06dcda6776fc42167fbe71cb59f978f5ef5b12577a90b132d14d9c6efa528076f0161d7bf03643cfc5490ec5084f4a041db7f06c50bd97efa08907ba79ddcac8b890f24d12d8db31abbaaf18985d54f400449ee0559a4452afe53de5853ce090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000c080a01428023fc54a27544abc421d5d017b9a7c5936ad501cbdecd0d9d12d04c1a033a0753104bbf1c87634d6ff3f0ffa0982710612306003eb022363b57994bdef445a"
|
let data = hex!("02f903d382426882ba09832dc6c0848674742682ed9694714b6a4ea9b94a8a7d9fd362ed72630688c8898c80b90364492d24749189822d8512430d3f3ff7a2ede675ac08265c08e2c56ff6fdaa66dae1cdbe4a5d1d7809f3e99272d067364e597542ac0c369d69e22a6399c3e9bee5da4b07e3f3fdc34c32c3d88aa2268785f3e3f8086df0934b10ef92cfffc2e7f3d90f5e83302e31382e302d64657600000000000000000000000000000000000000000000569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd000000000000000000000000e1e210594771824dad216568b91c9cb4ceed361c00000000000000000000000000000000000000000000000000000000000546e00000000000000000000000000000000000000000000000000000000000e4e1c00000000000000000000000000000000000000000000000000000000065d6750c00000000000000000000000000000000000000000000000000000000000f288000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000f1628e56fa6d8c50e5b984a58c0df14de31c7b857ce7ba499945b99252976a93d06dcda6776fc42167fbe71cb59f978f5ef5b12577a90b132d14d9c6efa528076f0161d7bf03643cfc5490ec5084f4a041db7f06c50bd97efa08907ba79ddcac8b890f24d12d8db31abbaaf18985d54f400449ee0559a4452afe53de5853ce090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000c080a01428023fc54a27544abc421d5d017b9a7c5936ad501cbdecd0d9d12d04c1a033a0753104bbf1c87634d6ff3f0ffa0982710612306003eb022363b57994bdef445a"
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = PooledTransactionsElement::decode_2718(&mut &data[..]).unwrap();
|
let res = PooledTransaction::decode_2718(&mut &data[..]).unwrap();
|
||||||
assert_eq!(res.to(), Some(address!("714b6a4ea9b94a8a7d9fd362ed72630688c8898c")));
|
assert_eq!(res.to(), Some(address!("714b6a4ea9b94a8a7d9fd362ed72630688c8898c")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +121,7 @@ mod tests {
|
|||||||
let data = &hex!("d30b02808083c5cdeb8783c5acfd9e407c565656")[..];
|
let data = &hex!("d30b02808083c5cdeb8783c5acfd9e407c565656")[..];
|
||||||
|
|
||||||
let input_rlp = &mut &data[..];
|
let input_rlp = &mut &data[..];
|
||||||
let res = PooledTransactionsElement::decode(input_rlp);
|
let res = PooledTransaction::decode(input_rlp);
|
||||||
assert_matches!(res, Ok(_tx));
|
assert_matches!(res, Ok(_tx));
|
||||||
assert!(input_rlp.is_empty());
|
assert!(input_rlp.is_empty());
|
||||||
|
|
||||||
@ -135,7 +133,7 @@ mod tests {
|
|||||||
assert!(input_rlp.is_empty());
|
assert!(input_rlp.is_empty());
|
||||||
|
|
||||||
// we can also decode_enveloped
|
// we can also decode_enveloped
|
||||||
let res = PooledTransactionsElement::decode_2718(&mut &data[..]);
|
let res = PooledTransaction::decode_2718(&mut &data[..]);
|
||||||
assert_matches!(res, Ok(_tx));
|
assert_matches!(res, Ok(_tx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
//! use reth_engine_primitives::PayloadValidator;
|
//! use reth_engine_primitives::PayloadValidator;
|
||||||
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
||||||
//! use reth_network_api::{NetworkInfo, Peers};
|
//! use reth_network_api::{NetworkInfo, Peers};
|
||||||
//! use reth_primitives::{Header, PooledTransactionsElement, TransactionSigned};
|
//! use reth_primitives::{Header, PooledTransaction, TransactionSigned};
|
||||||
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
|
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
|
||||||
//! use reth_rpc::EthApi;
|
//! use reth_rpc::EthApi;
|
||||||
//! use reth_rpc_builder::{
|
//! use reth_rpc_builder::{
|
||||||
@ -58,7 +58,7 @@
|
|||||||
//! Pool: TransactionPool<
|
//! Pool: TransactionPool<
|
||||||
//! Transaction: PoolTransaction<
|
//! Transaction: PoolTransaction<
|
||||||
//! Consensus = TransactionSigned,
|
//! Consensus = TransactionSigned,
|
||||||
//! Pooled = PooledTransactionsElement,
|
//! Pooled = PooledTransaction,
|
||||||
//! >,
|
//! >,
|
||||||
//! > + Unpin
|
//! > + Unpin
|
||||||
//! + 'static,
|
//! + 'static,
|
||||||
@ -102,7 +102,7 @@
|
|||||||
//! use reth_engine_primitives::{EngineTypes, PayloadValidator};
|
//! use reth_engine_primitives::{EngineTypes, PayloadValidator};
|
||||||
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
//! use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
||||||
//! use reth_network_api::{NetworkInfo, Peers};
|
//! use reth_network_api::{NetworkInfo, Peers};
|
||||||
//! use reth_primitives::{Header, PooledTransactionsElement, TransactionSigned};
|
//! use reth_primitives::{Header, PooledTransaction, TransactionSigned};
|
||||||
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
|
//! use reth_provider::{AccountReader, CanonStateSubscriptions, ChangeSetReader, FullRpcProvider};
|
||||||
//! use reth_rpc::EthApi;
|
//! use reth_rpc::EthApi;
|
||||||
//! use reth_rpc_api::EngineApiServer;
|
//! use reth_rpc_api::EngineApiServer;
|
||||||
@ -148,7 +148,7 @@
|
|||||||
//! Pool: TransactionPool<
|
//! Pool: TransactionPool<
|
||||||
//! Transaction: PoolTransaction<
|
//! Transaction: PoolTransaction<
|
||||||
//! Consensus = TransactionSigned,
|
//! Consensus = TransactionSigned,
|
||||||
//! Pooled = PooledTransactionsElement,
|
//! Pooled = PooledTransaction,
|
||||||
//! >,
|
//! >,
|
||||||
//! > + Unpin
|
//! > + Unpin
|
||||||
//! + 'static,
|
//! + 'static,
|
||||||
@ -230,7 +230,7 @@ use reth_consensus::FullConsensus;
|
|||||||
use reth_engine_primitives::{EngineTypes, PayloadValidator};
|
use reth_engine_primitives::{EngineTypes, PayloadValidator};
|
||||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvm};
|
||||||
use reth_network_api::{noop::NoopNetwork, NetworkInfo, Peers};
|
use reth_network_api::{noop::NoopNetwork, NetworkInfo, Peers};
|
||||||
use reth_primitives::{NodePrimitives, PooledTransactionsElement};
|
use reth_primitives::{NodePrimitives, PooledTransaction};
|
||||||
use reth_provider::{
|
use reth_provider::{
|
||||||
AccountReader, BlockReader, CanonStateSubscriptions, ChainSpecProvider, ChangeSetReader,
|
AccountReader, BlockReader, CanonStateSubscriptions, ChainSpecProvider, ChangeSetReader,
|
||||||
EvmEnvProvider, FullRpcProvider, ProviderBlock, ProviderHeader, ProviderReceipt,
|
EvmEnvProvider, FullRpcProvider, ProviderBlock, ProviderHeader, ProviderReceipt,
|
||||||
@ -323,7 +323,7 @@ where
|
|||||||
Receipt = <BlockExecutor::Primitives as NodePrimitives>::Receipt,
|
Receipt = <BlockExecutor::Primitives as NodePrimitives>::Receipt,
|
||||||
Header = <BlockExecutor::Primitives as NodePrimitives>::BlockHeader,
|
Header = <BlockExecutor::Primitives as NodePrimitives>::BlockHeader,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
BlockExecutor: BlockExecutorProvider,
|
BlockExecutor: BlockExecutorProvider,
|
||||||
{
|
{
|
||||||
@ -715,7 +715,7 @@ where
|
|||||||
Receipt = <Events::Primitives as NodePrimitives>::Receipt,
|
Receipt = <Events::Primitives as NodePrimitives>::Receipt,
|
||||||
Header = <Events::Primitives as NodePrimitives>::BlockHeader,
|
Header = <Events::Primitives as NodePrimitives>::BlockHeader,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
{
|
{
|
||||||
let Self {
|
let Self {
|
||||||
@ -841,7 +841,7 @@ where
|
|||||||
Block = <Events::Primitives as NodePrimitives>::Block,
|
Block = <Events::Primitives as NodePrimitives>::Block,
|
||||||
Header = <Events::Primitives as NodePrimitives>::BlockHeader,
|
Header = <Events::Primitives as NodePrimitives>::BlockHeader,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction = <EthApi::Pool as TransactionPool>::Transaction>,
|
Pool: TransactionPool<Transaction = <EthApi::Pool as TransactionPool>::Transaction>,
|
||||||
{
|
{
|
||||||
@ -1382,7 +1382,7 @@ where
|
|||||||
Receipt = <BlockExecutor::Primitives as NodePrimitives>::Receipt,
|
Receipt = <BlockExecutor::Primitives as NodePrimitives>::Receipt,
|
||||||
Header = <BlockExecutor::Primitives as NodePrimitives>::BlockHeader,
|
Header = <BlockExecutor::Primitives as NodePrimitives>::BlockHeader,
|
||||||
>,
|
>,
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
>,
|
>,
|
||||||
BlockExecutor: BlockExecutorProvider,
|
BlockExecutor: BlockExecutorProvider,
|
||||||
Consensus: reth_consensus::FullConsensus<BlockExecutor::Primitives> + Clone + 'static,
|
Consensus: reth_consensus::FullConsensus<BlockExecutor::Primitives> + Clone + 'static,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use alloy_rpc_types_mev::{EthCallBundle, EthCallBundleResponse, EthCallBundleTra
|
|||||||
use jsonrpsee::core::RpcResult;
|
use jsonrpsee::core::RpcResult;
|
||||||
use reth_chainspec::EthChainSpec;
|
use reth_chainspec::EthChainSpec;
|
||||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||||
use reth_primitives::PooledTransactionsElement;
|
use reth_primitives::PooledTransaction;
|
||||||
use reth_primitives_traits::SignedTransaction;
|
use reth_primitives_traits::SignedTransaction;
|
||||||
use reth_provider::{ChainSpecProvider, HeaderProvider};
|
use reth_provider::{ChainSpecProvider, HeaderProvider};
|
||||||
use reth_revm::database::StateProviderDatabase;
|
use reth_revm::database::StateProviderDatabase;
|
||||||
@ -47,8 +47,8 @@ where
|
|||||||
Eth: EthTransactions<
|
Eth: EthTransactions<
|
||||||
Pool: TransactionPool<
|
Pool: TransactionPool<
|
||||||
Transaction: PoolTransaction<
|
Transaction: PoolTransaction<
|
||||||
Consensus: From<PooledTransactionsElement>,
|
Consensus: From<PooledTransaction>,
|
||||||
Pooled = PooledTransactionsElement,
|
Pooled = PooledTransaction,
|
||||||
>,
|
>,
|
||||||
>,
|
>,
|
||||||
> + LoadPendingBlock
|
> + LoadPendingBlock
|
||||||
@ -188,7 +188,7 @@ where
|
|||||||
while let Some((tx, signer)) = transactions.next() {
|
while let Some((tx, signer)) = transactions.next() {
|
||||||
// Verify that the given blob data, commitments, and proofs are all valid for
|
// Verify that the given blob data, commitments, and proofs are all valid for
|
||||||
// this transaction.
|
// this transaction.
|
||||||
if let PooledTransactionsElement::Eip4844(ref tx) = tx {
|
if let PooledTransaction::Eip4844(ref tx) = tx {
|
||||||
tx.tx().validate_blob(EnvKzgSettings::Default.get()).map_err(|e| {
|
tx.tx().validate_blob(EnvKzgSettings::Default.get()).map_err(|e| {
|
||||||
Eth::Error::from_eth_err(EthApiError::InvalidParams(e.to_string()))
|
Eth::Error::from_eth_err(EthApiError::InvalidParams(e.to_string()))
|
||||||
})?;
|
})?;
|
||||||
@ -277,7 +277,7 @@ where
|
|||||||
impl<Eth> EthCallBundleApiServer for EthBundle<Eth>
|
impl<Eth> EthCallBundleApiServer for EthBundle<Eth>
|
||||||
where
|
where
|
||||||
Eth: EthTransactions<
|
Eth: EthTransactions<
|
||||||
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransactionsElement>>,
|
Pool: TransactionPool<Transaction: PoolTransaction<Pooled = PooledTransaction>>,
|
||||||
> + LoadPendingBlock
|
> + LoadPendingBlock
|
||||||
+ Call
|
+ Call
|
||||||
+ 'static,
|
+ 'static,
|
||||||
|
|||||||
@ -680,7 +680,7 @@ mod tests {
|
|||||||
use alloy_primitives::{hex, U256};
|
use alloy_primitives::{hex, U256};
|
||||||
use reth_chainspec::MAINNET;
|
use reth_chainspec::MAINNET;
|
||||||
use reth_fs_util as fs;
|
use reth_fs_util as fs;
|
||||||
use reth_primitives::PooledTransactionsElement;
|
use reth_primitives::PooledTransaction;
|
||||||
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider};
|
use reth_provider::test_utils::{ExtendedAccount, MockEthProvider};
|
||||||
use reth_tasks::TaskManager;
|
use reth_tasks::TaskManager;
|
||||||
|
|
||||||
@ -700,7 +700,7 @@ mod tests {
|
|||||||
let temp_dir = tempfile::tempdir().unwrap();
|
let temp_dir = tempfile::tempdir().unwrap();
|
||||||
let transactions_path = temp_dir.path().join(FILENAME).with_extension(EXTENSION);
|
let transactions_path = temp_dir.path().join(FILENAME).with_extension(EXTENSION);
|
||||||
let tx_bytes = hex!("02f87201830655c2808505ef61f08482565f94388c818ca8b9251b393131c08a736a67ccb192978801049e39c4b5b1f580c001a01764ace353514e8abdfb92446de356b260e3c1225b73fc4c8876a6258d12a129a04f02294aa61ca7676061cd99f29275491218b4754b46a0248e5e42bc5091f507");
|
let tx_bytes = hex!("02f87201830655c2808505ef61f08482565f94388c818ca8b9251b393131c08a736a67ccb192978801049e39c4b5b1f580c001a01764ace353514e8abdfb92446de356b260e3c1225b73fc4c8876a6258d12a129a04f02294aa61ca7676061cd99f29275491218b4754b46a0248e5e42bc5091f507");
|
||||||
let tx = PooledTransactionsElement::decode_2718(&mut &tx_bytes[..]).unwrap();
|
let tx = PooledTransaction::decode_2718(&mut &tx_bytes[..]).unwrap();
|
||||||
let provider = MockEthProvider::default();
|
let provider = MockEthProvider::default();
|
||||||
let transaction: EthPooledTransaction = tx.try_into_ecrecovered().unwrap().into();
|
let transaction: EthPooledTransaction = tx.try_into_ecrecovered().unwrap().into();
|
||||||
let tx_to_cmp = transaction.clone();
|
let tx_to_cmp = transaction.clone();
|
||||||
|
|||||||
@ -30,7 +30,7 @@ use rand::{
|
|||||||
};
|
};
|
||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
transaction::{SignedTransactionIntoRecoveredExt, TryFromRecoveredTransactionError},
|
transaction::{SignedTransactionIntoRecoveredExt, TryFromRecoveredTransactionError},
|
||||||
PooledTransactionsElement, PooledTransactionsElementEcRecovered, RecoveredTx, Transaction,
|
PooledTransaction, PooledTransactionsElementEcRecovered, RecoveredTx, Transaction,
|
||||||
TransactionSigned, TxType,
|
TransactionSigned, TxType,
|
||||||
};
|
};
|
||||||
use reth_primitives_traits::InMemorySize;
|
use reth_primitives_traits::InMemorySize;
|
||||||
@ -666,7 +666,7 @@ impl PoolTransaction for MockTransaction {
|
|||||||
|
|
||||||
type Consensus = TransactionSigned;
|
type Consensus = TransactionSigned;
|
||||||
|
|
||||||
type Pooled = PooledTransactionsElement;
|
type Pooled = PooledTransaction;
|
||||||
|
|
||||||
fn try_from_consensus(
|
fn try_from_consensus(
|
||||||
tx: RecoveredTx<Self::Consensus>,
|
tx: RecoveredTx<Self::Consensus>,
|
||||||
|
|||||||
@ -21,8 +21,8 @@ use reth_execution_types::ChangedAccount;
|
|||||||
use reth_primitives::{
|
use reth_primitives::{
|
||||||
kzg::KzgSettings,
|
kzg::KzgSettings,
|
||||||
transaction::{SignedTransactionIntoRecoveredExt, TryFromRecoveredTransactionError},
|
transaction::{SignedTransactionIntoRecoveredExt, TryFromRecoveredTransactionError},
|
||||||
PooledTransactionsElement, PooledTransactionsElementEcRecovered, RecoveredTx, SealedBlock,
|
PooledTransaction, PooledTransactionsElementEcRecovered, RecoveredTx, SealedBlock, Transaction,
|
||||||
Transaction, TransactionSigned,
|
TransactionSigned,
|
||||||
};
|
};
|
||||||
use reth_primitives_traits::SignedTransaction;
|
use reth_primitives_traits::SignedTransaction;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
@ -224,7 +224,7 @@ pub trait TransactionPool: Send + Sync + Clone {
|
|||||||
max: usize,
|
max: usize,
|
||||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||||
|
|
||||||
/// Returns converted [PooledTransactionsElement] for the given transaction hashes.
|
/// Returns converted [PooledTransaction] for the given transaction hashes.
|
||||||
///
|
///
|
||||||
/// This adheres to the expected behavior of
|
/// This adheres to the expected behavior of
|
||||||
/// [`GetPooledTransactions`](https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getpooledtransactions-0x09):
|
/// [`GetPooledTransactions`](https://github.com/ethereum/devp2p/blob/master/caps/eth.md#getpooledtransactions-0x09):
|
||||||
@ -1238,7 +1238,7 @@ impl From<PooledTransactionsElementEcRecovered> for EthPooledTransaction {
|
|||||||
let encoded_length = tx.encode_2718_len();
|
let encoded_length = tx.encode_2718_len();
|
||||||
let (tx, signer) = tx.to_components();
|
let (tx, signer) = tx.to_components();
|
||||||
match tx {
|
match tx {
|
||||||
PooledTransactionsElement::Eip4844(tx) => {
|
PooledTransaction::Eip4844(tx) => {
|
||||||
// include the blob sidecar
|
// include the blob sidecar
|
||||||
let (tx, sig, hash) = tx.into_parts();
|
let (tx, sig, hash) = tx.into_parts();
|
||||||
let (tx, blob) = tx.into_parts();
|
let (tx, blob) = tx.into_parts();
|
||||||
@ -1262,7 +1262,7 @@ impl PoolTransaction for EthPooledTransaction {
|
|||||||
|
|
||||||
type Consensus = TransactionSigned;
|
type Consensus = TransactionSigned;
|
||||||
|
|
||||||
type Pooled = PooledTransactionsElement;
|
type Pooled = PooledTransaction;
|
||||||
|
|
||||||
fn clone_into_consensus(&self) -> RecoveredTx<Self::Consensus> {
|
fn clone_into_consensus(&self) -> RecoveredTx<Self::Consensus> {
|
||||||
self.transaction().clone()
|
self.transaction().clone()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user