feat: relax provider bounds (#12857)

This commit is contained in:
Arsenii Kulikov
2024-11-26 20:26:36 +04:00
committed by GitHub
parent d51b347c81
commit 2ce741709f
37 changed files with 365 additions and 236 deletions

View File

@ -244,7 +244,7 @@ where
/// Configures the types of the node.
pub fn with_types<T>(self) -> NodeBuilderWithTypes<RethFullAdapter<DB, T>>
where
T: NodeTypesWithEngine<ChainSpec = ChainSpec> + NodeTypesForProvider,
T: NodeTypesWithEngine<ChainSpec = ChainSpec> + NodeTypesForTree,
{
self.with_types_and_provider()
}
@ -268,7 +268,7 @@ where
node: N,
) -> NodeBuilderWithComponents<RethFullAdapter<DB, N>, N::ComponentsBuilder, N::AddOns>
where
N: Node<RethFullAdapter<DB, N>, ChainSpec = ChainSpec> + NodeTypesForProvider,
N: Node<RethFullAdapter<DB, N>, ChainSpec = ChainSpec> + NodeTypesForTree,
{
self.with_types().with_components(node.components_builder()).with_add_ons(node.add_ons())
}
@ -305,7 +305,7 @@ where
/// Configures the types of the node.
pub fn with_types<T>(self) -> WithLaunchContext<NodeBuilderWithTypes<RethFullAdapter<DB, T>>>
where
T: NodeTypesWithEngine<ChainSpec = ChainSpec> + NodeTypesForProvider,
T: NodeTypesWithEngine<ChainSpec = ChainSpec> + NodeTypesForTree,
{
WithLaunchContext { builder: self.builder.with_types(), task_executor: self.task_executor }
}
@ -336,7 +336,7 @@ where
NodeBuilderWithComponents<RethFullAdapter<DB, N>, N::ComponentsBuilder, N::AddOns>,
>
where
N: Node<RethFullAdapter<DB, N>, ChainSpec = ChainSpec> + NodeTypesForProvider,
N: Node<RethFullAdapter<DB, N>, ChainSpec = ChainSpec> + NodeTypesForTree,
{
self.with_types().with_components(node.components_builder()).with_add_ons(node.add_ons())
}

View File

@ -382,7 +382,10 @@ where
pub async fn create_provider_factory<N>(&self) -> eyre::Result<ProviderFactory<N>>
where
N: ProviderNodeTypes<DB = DB, ChainSpec = ChainSpec>,
N::Primitives: FullNodePrimitives<BlockBody = reth_primitives::BlockBody>,
N::Primitives: FullNodePrimitives<
Block = reth_primitives::Block,
BlockBody = reth_primitives::BlockBody,
>,
{
let factory = ProviderFactory::new(
self.right().clone(),
@ -449,7 +452,10 @@ where
) -> eyre::Result<LaunchContextWith<Attached<WithConfigs<ChainSpec>, ProviderFactory<N>>>>
where
N: ProviderNodeTypes<DB = DB, ChainSpec = ChainSpec>,
N::Primitives: FullNodePrimitives<BlockBody = reth_primitives::BlockBody>,
N::Primitives: FullNodePrimitives<
Block = reth_primitives::Block,
BlockBody = reth_primitives::BlockBody,
>,
{
let factory = self.create_provider_factory().await?;
let ctx = LaunchContextWith {

View File

@ -41,7 +41,8 @@ where
N: ProviderNodeTypes,
Client: EthBlockClient + 'static,
Executor: BlockExecutorProvider,
N::Primitives: FullNodePrimitives<BlockBody = reth_primitives::BlockBody>,
N::Primitives:
FullNodePrimitives<Block = reth_primitives::Block, BlockBody = reth_primitives::BlockBody>,
{
// building network downloaders using the fetch client
let header_downloader = ReverseHeadersDownloaderBuilder::new(config.headers)
@ -89,7 +90,8 @@ where
H: HeaderDownloader<Header = alloy_consensus::Header> + 'static,
B: BodyDownloader<Body = BodyTy<N>> + 'static,
Executor: BlockExecutorProvider,
N::Primitives: FullNodePrimitives<BlockBody = reth_primitives::BlockBody>,
N::Primitives:
FullNodePrimitives<Block = reth_primitives::Block, BlockBody = reth_primitives::BlockBody>,
{
let mut builder = Pipeline::<N>::builder();