Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
supernovahs committed Oct 5, 2023
1 parent 727c595 commit 04a7242
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
5 changes: 3 additions & 2 deletions bin/reth/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,15 @@ impl RpcServerArgs {
let module_config = self.transport_rpc_module_config();
debug!(target: "reth::cli", http=?module_config.http(), ws=?module_config.ws(), "Using RPC module config");

let (mut modules, auth_module, registry) = RpcModuleBuilder::default()
let (mut modules, auth_module, mut registry) = RpcModuleBuilder::default()
.with_provider(components.provider())
.with_pool(components.pool())
.with_network(components.network())
.with_events(components.events())
.with_executor(components.task_executor())
.build_with_auth_server(module_config, engine_api);
let node_modules = &mut RethRpcComponents::<Reth> { registry, modules: &mut modules };
let node_modules =
&mut RethRpcComponents::<Reth> { registry: &mut registry, modules: &mut modules };
// apply configured customization
conf.extend_rpc_modules(self, components, node_modules)?;

Expand Down
10 changes: 8 additions & 2 deletions bin/reth/src/cli/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ pub trait RethNodeComponents {

/// Helper function to encapsulate [RethModuleRegistry] and [TransportRpcModules]
/// generic over [RethNodeComponents]
#[allow(clippy::type_complexity)]
pub struct RethRpcComponents<'a, Reth: RethNodeComponents> {
/// A Helper type the holds instances of the configured modules.
pub registry:
RethModuleRegistry<Reth::Provider, Reth::Pool, Reth::Network, Reth::Tasks, Reth::Events>,
pub registry: &'a mut RethModuleRegistry<
Reth::Provider,
Reth::Pool,
Reth::Network,
Reth::Tasks,
Reth::Events,
>,
/// Holds installed modules per transport type.
pub modules: &'a mut TransportRpcModules,
}
Expand Down
13 changes: 4 additions & 9 deletions bin/reth/src/cli/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ use crate::cli::{
use clap::Args;
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
#[doc(hidden)]
#[allow(unused)]
/// For doc purposes
use reth_rpc_builder::TransportRpcModules;
use reth_tasks::TaskSpawner;
use std::fmt;

Expand Down Expand Up @@ -52,23 +48,22 @@ pub trait RethNodeCommandConfig: fmt::Debug {

/// Allows for registering additional RPC modules for the transports.
///
/// This is expected to call the merge functions of [TransportRpcModules], for example
/// [TransportRpcModules::merge_configured]
/// This is expected to call the merge functions of [reth_rpc_builder::TransportRpcModules], for
/// example [reth_rpc_builder::TransportRpcModules::merge_configured]
#[allow(clippy::type_complexity)]
fn extend_rpc_modules<Conf, Reth>(
&mut self,
config: &Conf,
components: &Reth,
node_components: &mut RethRpcComponents<'_, Reth>,
rpc_components: &mut RethRpcComponents<'_, Reth>,
) -> eyre::Result<()>
where
Conf: RethRpcConfig,
Reth: RethNodeComponents,
{
let _ = config;
let _ = components;
let _ = node_components.registry;
let _ = node_components.modules;
let _ = rpc_components;
Ok(())
}

Expand Down

0 comments on commit 04a7242

Please sign in to comment.