feat: make RPC cache generic over primitives (#13146)

This commit is contained in:
Arsenii Kulikov
2024-12-05 17:14:51 +04:00
committed by GitHub
parent 804dc99ef4
commit b4124dd1b0
31 changed files with 354 additions and 274 deletions

View File

@ -40,6 +40,9 @@ impl BlockSource {
}
}
/// A helper type alias to access [`BlockReader::Block`].
pub type ProviderBlock<P> = <P as BlockReader>::Block;
/// Api trait for fetching `Block` related data.
///
/// If not requested otherwise, implementers of this trait should prioritize fetching blocks from

View File

@ -1,14 +1,18 @@
use crate::BlockIdReader;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{TxHash, TxNumber};
use reth_primitives_traits::Receipt;
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeBounds;
/// A helper type alias to access [`ReceiptProvider::Receipt`].
pub type ProviderReceipt<P> = <P as ReceiptProvider>::Receipt;
/// Client trait for fetching receipt data.
#[auto_impl::auto_impl(&, Arc)]
pub trait ReceiptProvider: Send + Sync {
/// The receipt type.
type Receipt: Send + Sync;
type Receipt: Receipt;
/// Get receipt by transaction number
///

View File

@ -1,4 +1,4 @@
use crate::{BlockNumReader, BlockReader, ReceiptProvider};
use crate::{BlockNumReader, BlockReader};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockNumber, TxHash, TxNumber};
use reth_primitives::TransactionMeta;
@ -84,9 +84,6 @@ pub trait TransactionsProvider: BlockNumReader + Send + Sync {
/// A helper type alias to access [`TransactionsProvider::Transaction`].
pub type ProviderTx<P> = <P as TransactionsProvider>::Transaction;
/// A helper type alias to access [`ReceiptProvider::Receipt`].
pub type ProviderReceipt<P> = <P as ReceiptProvider>::Receipt;
/// Client trait for fetching additional transactions related data.
#[auto_impl::auto_impl(&, Arc)]
pub trait TransactionsProviderExt: BlockReader + Send + Sync {