rpc: remove special module handling for eth_callBundle (#10486)

This commit is contained in:
Thomas Coratger
2024-08-24 00:36:32 -07:00
committed by GitHub
parent 22f928a2b1
commit dbdb1117a8
4 changed files with 17 additions and 38 deletions

View File

@ -230,7 +230,7 @@ RPC:
--http.api <HTTP_API>
Rpc Modules to be configured for the HTTP server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, eth-call-bundle]
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots]
--http.corsdomain <HTTP_CORSDOMAIN>
Http Corsdomain to allow request from
@ -254,7 +254,7 @@ RPC:
--ws.api <WS_API>
Rpc Modules to be configured for the WS server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, eth-call-bundle]
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots]
--ipcdisable
Disable the IPC-RPC server

View File

@ -366,17 +366,12 @@ mod tests {
#[test]
fn test_rpc_server_eth_call_bundle_args() {
let args = CommandParser::<RpcServerArgs>::parse_from([
"reth",
"--http.api",
"eth,admin,debug,eth-call-bundle",
])
.args;
let args =
CommandParser::<RpcServerArgs>::parse_from(["reth", "--http.api", "eth,admin,debug"])
.args;
let apis = args.http_api.unwrap();
let expected =
RpcModuleSelection::try_from_selection(["eth", "admin", "debug", "eth-call-bundle"])
.unwrap();
let expected = RpcModuleSelection::try_from_selection(["eth", "admin", "debug"]).unwrap();
assert_eq!(apis, expected);
}

View File

@ -1068,6 +1068,15 @@ where
let mut module = eth_api.clone().into_rpc();
module.merge(eth_filter.clone().into_rpc()).expect("No conflicts");
module.merge(eth_pubsub.clone().into_rpc()).expect("No conflicts");
module
.merge(
EthBundle::new(
eth_api.clone(),
self.blocking_pool_guard.clone(),
)
.into_rpc(),
)
.expect("No conflicts");
module.into()
}
@ -1099,11 +1108,6 @@ where
.into_rpc()
.into()
}
RethRpcModule::EthCallBundle => {
EthBundle::new(eth_api.clone(), self.blocking_pool_guard.clone())
.into_rpc()
.into()
}
})
.clone()
})
@ -1819,27 +1823,13 @@ impl RpcServerHandle {
mod tests {
use super::*;
#[test]
fn parse_eth_call_bundle() {
let selection = "eth-call-bundle".parse::<RethRpcModule>().unwrap();
assert_eq!(selection, RethRpcModule::EthCallBundle);
let selection = "eth_callBundle".parse::<RethRpcModule>().unwrap();
assert_eq!(selection, RethRpcModule::EthCallBundle);
}
#[test]
fn parse_eth_call_bundle_selection() {
let selection = "eth,admin,debug,eth-call-bundle".parse::<RpcModuleSelection>().unwrap();
let selection = "eth,admin,debug".parse::<RpcModuleSelection>().unwrap();
assert_eq!(
selection,
RpcModuleSelection::Selection(
[
RethRpcModule::Eth,
RethRpcModule::Admin,
RethRpcModule::Debug,
RethRpcModule::EthCallBundle,
]
.into()
[RethRpcModule::Eth, RethRpcModule::Admin, RethRpcModule::Debug,].into()
)
);
}

View File

@ -255,11 +255,6 @@ pub enum RethRpcModule {
Reth,
/// `ots_` module
Ots,
/// For single non-standard `eth_` namespace call `eth_callBundle`
///
/// This is separate from [`RethRpcModule::Eth`] because it is a non standardized call that
/// should be opt-in.
EthCallBundle,
}
// === impl RethRpcModule ===
@ -308,7 +303,6 @@ impl FromStr for RethRpcModule {
"rpc" => Self::Rpc,
"reth" => Self::Reth,
"ots" => Self::Ots,
"eth-call-bundle" | "eth_callBundle" => Self::EthCallBundle,
_ => return Err(ParseError::VariantNotFound),
})
}