chore: make unit type default (#4141)

This commit is contained in:
Matthias Seitz
2023-08-10 14:15:35 +02:00
committed by GitHub
parent 072c84083c
commit 628495ae8f
3 changed files with 7 additions and 13 deletions

View File

@ -41,7 +41,7 @@ pub trait RethNodeCommandExt: fmt::Debug + clap::Args {
&mut self, &mut self,
_config: &Conf, _config: &Conf,
_registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>, _registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
_modules: &mut TransportRpcModules<()>, _modules: &mut TransportRpcModules,
) -> eyre::Result<()> ) -> eyre::Result<()>
where where
Conf: RethRpcConfig, Conf: RethRpcConfig,

View File

@ -344,7 +344,7 @@ where
module_config: TransportRpcModuleConfig, module_config: TransportRpcModuleConfig,
engine: EngineApi, engine: EngineApi,
) -> ( ) -> (
TransportRpcModules<()>, TransportRpcModules,
AuthRpcModule, AuthRpcModule,
RethModuleRegistry<Provider, Pool, Network, Tasks, Events>, RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
) )
@ -1232,10 +1232,7 @@ impl RpcServerConfig {
} }
/// Convenience function to do [RpcServerConfig::build] and [RpcServer::start] in one step /// Convenience function to do [RpcServerConfig::build] and [RpcServer::start] in one step
pub async fn start( pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
self.build().await?.start(modules).await self.build().await?.start(modules).await
} }
@ -1456,7 +1453,7 @@ impl TransportRpcModuleConfig {
/// Holds installed modules per transport type. /// Holds installed modules per transport type.
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct TransportRpcModules<Context> { pub struct TransportRpcModules<Context = ()> {
/// The original config /// The original config
config: TransportRpcModuleConfig, config: TransportRpcModuleConfig,
/// rpcs module for http /// rpcs module for http
@ -1469,7 +1466,7 @@ pub struct TransportRpcModules<Context> {
// === impl TransportRpcModules === // === impl TransportRpcModules ===
impl TransportRpcModules<()> { impl TransportRpcModules {
/// Returns the [TransportRpcModuleConfig] used to configure this instance. /// Returns the [TransportRpcModuleConfig] used to configure this instance.
pub fn module_config(&self) -> &TransportRpcModuleConfig { pub fn module_config(&self) -> &TransportRpcModuleConfig {
&self.config &self.config
@ -1694,10 +1691,7 @@ impl RpcServer {
/// This returns an [RpcServerHandle] that's connected to the server task(s) until the server is /// This returns an [RpcServerHandle] that's connected to the server task(s) until the server is
/// stopped or the [RpcServerHandle] is dropped. /// 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")] #[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( pub async fn start(self, modules: TransportRpcModules) -> Result<RpcServerHandle, RpcError> {
self,
modules: TransportRpcModules<()>,
) -> Result<RpcServerHandle, RpcError> {
trace!(target: "rpc", "staring RPC server"); trace!(target: "rpc", "staring RPC server");
let Self { ws_http, ipc: ipc_server } = self; let Self { ws_http, ipc: ipc_server } = self;
let TransportRpcModules { config, http, ws, ipc } = modules; let TransportRpcModules { config, http, ws, ipc } = modules;

View File

@ -55,7 +55,7 @@ impl RethNodeCommandExt for RethCliTxpoolExt {
&mut self, &mut self,
_config: &Conf, _config: &Conf,
registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>, registry: &mut RethModuleRegistry<Provider, Pool, Network, Tasks, Events>,
modules: &mut TransportRpcModules<()>, modules: &mut TransportRpcModules,
) -> eyre::Result<()> ) -> eyre::Result<()>
where where
Conf: RethRpcConfig, Conf: RethRpcConfig,