refactor: move FullRpcProvider trait to storage-api crate (#16056)

This commit is contained in:
Femi Bankole
2025-05-03 20:11:16 +01:00
committed by GitHub
parent 98132bdd10
commit 3089ad9d64
4 changed files with 41 additions and 32 deletions

View File

@@ -2,11 +2,9 @@
use crate::{
AccountReader, BlockReaderIdExt, ChainSpecProvider, ChangeSetReader, DatabaseProviderFactory,
HeaderProvider, StageCheckpointReader, StateProviderFactory, StaticFileProviderFactory,
TransactionsProvider,
StageCheckpointReader, StateProviderFactory, StaticFileProviderFactory,
};
use reth_chain_state::{CanonStateSubscriptions, ForkChoiceSubscriptions};
use reth_chainspec::EthereumHardforks;
use reth_node_types::{BlockTy, HeaderTy, NodeTypesWithDB, ReceiptTy, TxTy};
use reth_storage_api::NodePrimitivesProvider;
use std::fmt::Debug;
@@ -57,31 +55,3 @@ impl<T, N: NodeTypesWithDB> FullProvider<N> for T where
+ 'static
{
}
/// Helper trait to unify all provider traits required to support `eth` RPC server behaviour, for
/// simplicity.
pub trait FullRpcProvider:
StateProviderFactory
+ ChainSpecProvider<ChainSpec: EthereumHardforks>
+ BlockReaderIdExt
+ HeaderProvider
+ TransactionsProvider
+ StageCheckpointReader
+ Clone
+ Unpin
+ 'static
{
}
impl<T> FullRpcProvider for T where
T: StateProviderFactory
+ ChainSpecProvider<ChainSpec: EthereumHardforks>
+ BlockReaderIdExt
+ HeaderProvider
+ TransactionsProvider
+ StageCheckpointReader
+ Clone
+ Unpin
+ 'static
{
}

View File

@@ -9,4 +9,4 @@ mod static_file_provider;
pub use static_file_provider::StaticFileProviderFactory;
mod full;
pub use full::{FullProvider, FullRpcProvider};
pub use full::FullProvider;

View File

@@ -0,0 +1,36 @@
//! Helper trait for full rpc provider
use reth_chainspec::{ChainSpecProvider, EthereumHardforks};
use crate::{
BlockReaderIdExt, HeaderProvider, StageCheckpointReader, StateProviderFactory,
TransactionsProvider,
};
/// Helper trait to unify all provider traits required to support `eth` RPC server behaviour, for
/// simplicity.
pub trait FullRpcProvider:
StateProviderFactory
+ ChainSpecProvider<ChainSpec: EthereumHardforks>
+ BlockReaderIdExt
+ HeaderProvider
+ TransactionsProvider
+ StageCheckpointReader
+ Clone
+ Unpin
+ 'static
{
}
impl<T> FullRpcProvider for T where
T: StateProviderFactory
+ ChainSpecProvider<ChainSpec: EthereumHardforks>
+ BlockReaderIdExt
+ HeaderProvider
+ TransactionsProvider
+ StageCheckpointReader
+ Clone
+ Unpin
+ 'static
{
}

View File

@@ -102,3 +102,6 @@ pub use state_writer::*;
mod header_sync_gap;
pub use header_sync_gap::HeaderSyncGapProvider;
mod full;
pub use full::*;