feat: add Transaction AT to TransactionsProvider (#12794)

This commit is contained in:
Arsenii Kulikov
2024-11-23 03:04:42 +04:00
committed by GitHub
parent 36db1c2407
commit 5db3ad1a67
33 changed files with 389 additions and 271 deletions

View File

@ -23,10 +23,10 @@ use reth_chainspec::{ChainInfo, EthereumHardforks};
use reth_db::table::Value;
use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB};
use reth_node_types::{FullNodePrimitives, NodeTypes, NodeTypesWithDB, TxTy};
use reth_primitives::{
Account, Block, BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash,
TransactionMeta, TransactionSigned,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
@ -76,7 +76,9 @@ where
Self: NodeTypes<
ChainSpec: EthereumHardforks,
Storage: ChainStorage<Self::Primitives>,
Primitives: FullNodePrimitives<SignedTx: Value>,
Primitives: FullNodePrimitives<
SignedTx: Value + From<TransactionSigned> + Into<TransactionSigned>,
>,
>,
{
}
@ -85,7 +87,9 @@ impl<T> NodeTypesForProvider for T where
T: NodeTypes<
ChainSpec: EthereumHardforks,
Storage: ChainStorage<T::Primitives>,
Primitives: FullNodePrimitives<SignedTx: Value>,
Primitives: FullNodePrimitives<
SignedTx: Value + From<TransactionSigned> + Into<TransactionSigned>,
>,
>
{
}
@ -417,29 +421,31 @@ impl<N: ProviderNodeTypes> BlockReader for BlockchainProvider<N> {
}
impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N> {
type Transaction = TxTy<N>;
fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>> {
self.database.transaction_id(tx_hash)
}
fn transaction_by_id(&self, id: TxNumber) -> ProviderResult<Option<TransactionSigned>> {
fn transaction_by_id(&self, id: TxNumber) -> ProviderResult<Option<Self::Transaction>> {
self.database.transaction_by_id(id)
}
fn transaction_by_id_unhashed(
&self,
id: TxNumber,
) -> ProviderResult<Option<TransactionSignedNoHash>> {
) -> ProviderResult<Option<Self::Transaction>> {
self.database.transaction_by_id_unhashed(id)
}
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<TransactionSigned>> {
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<Self::Transaction>> {
self.database.transaction_by_hash(hash)
}
fn transaction_by_hash_with_meta(
&self,
tx_hash: TxHash,
) -> ProviderResult<Option<(TransactionSigned, TransactionMeta)>> {
) -> ProviderResult<Option<(Self::Transaction, TransactionMeta)>> {
self.database.transaction_by_hash_with_meta(tx_hash)
}
@ -450,21 +456,21 @@ impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N> {
fn transactions_by_block(
&self,
id: BlockHashOrNumber,
) -> ProviderResult<Option<Vec<TransactionSigned>>> {
) -> ProviderResult<Option<Vec<Self::Transaction>>> {
self.database.transactions_by_block(id)
}
fn transactions_by_block_range(
&self,
range: impl RangeBounds<BlockNumber>,
) -> ProviderResult<Vec<Vec<TransactionSigned>>> {
) -> ProviderResult<Vec<Vec<Self::Transaction>>> {
self.database.transactions_by_block_range(range)
}
fn transactions_by_tx_range(
&self,
range: impl RangeBounds<TxNumber>,
) -> ProviderResult<Vec<TransactionSignedNoHash>> {
) -> ProviderResult<Vec<Self::Transaction>> {
self.database.transactions_by_tx_range(range)
}