Skip to content

Commit

Permalink
chore: make unit type default (paradigmxyz#4141)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Aug 10, 2023
1 parent 072c840 commit 628495a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/reth/src/cli/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub trait RethNodeCommandExt: fmt::Debug + clap::Args {
&mut self,
_config: &Conf,
_registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
_modules: &mut TransportRpcModules<()>,
_modules: &mut TransportRpcModules,
) -> eyre::Result<()>
where
Conf: RethRpcConfig,
Expand Down
16 changes: 5 additions & 11 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ where
module_config: TransportRpcModuleConfig,
engine: EngineApi,
) -> (
TransportRpcModules<()>,
TransportRpcModules,
AuthRpcModule,
RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
)
Expand Down Expand Up @@ -1232,10 +1232,7 @@ impl RpcServerConfig {
}

/// Convenience function to do [RpcServerConfig::build] and [RpcServer::start] in one step
pub async fn start(
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
self.build().await?.start(modules).await
}

Expand Down Expand Up @@ -1456,7 +1453,7 @@ impl TransportRpcModuleConfig {

/// Holds installed modules per transport type.
#[derive(Debug, Default)]
pub struct TransportRpcModules<Context> {
pub struct TransportRpcModules<Context = ()> {
/// The original config
config: TransportRpcModuleConfig,
/// rpcs module for http
Expand All @@ -1469,7 +1466,7 @@ pub struct TransportRpcModules<Context> {

// === impl TransportRpcModules ===

impl TransportRpcModules<()> {
impl TransportRpcModules {
/// Returns the [TransportRpcModuleConfig] used to configure this instance.
pub fn module_config(&self) -> &TransportRpcModuleConfig {
&self.config
Expand Down Expand Up @@ -1694,10 +1691,7 @@ impl RpcServer {
/// This returns an [RpcServerHandle] that's connected to the server task(s) until the server is
/// stopped or the [RpcServerHandle] is dropped.
#[instrument(name = "start", skip_all, fields(http = ?self.http_local_addr(), ws = ?self.ws_local_addr(), ipc = ?self.ipc_endpoint().map(|ipc|ipc.path())), target = "rpc", level = "TRACE")]
pub async fn start(
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
trace!(target: "rpc", "staring RPC server");
let Self { ws_http, ipc: ipc_server } = self;
let TransportRpcModules { config, http, ws, ipc } = modules;
Expand Down
2 changes: 1 addition & 1 deletion examples/additional-rpc-namespace-in-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl RethNodeCommandExt for RethCliTxpoolExt {
&mut self,
_config: &Conf,
registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
modules: &mut TransportRpcModules<()>,
modules: &mut TransportRpcModules,
) -> eyre::Result<()>
where
Conf: RethRpcConfig,
Expand Down

0 comments on commit 628495a

Please sign in to comment.