Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: remove special module handling for eth_callBundle #10486

Merged
merged 3 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,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
Expand All @@ -244,7 +244,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
Expand Down
13 changes: 4 additions & 9 deletions crates/node/core/src/args/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
32 changes: 11 additions & 21 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,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()
}
Expand Down Expand Up @@ -1097,11 +1106,6 @@ where
.into_rpc()
.into()
}
RethRpcModule::EthCallBundle => {
EthBundle::new(eth_api.clone(), self.blocking_pool_guard.clone())
.into_rpc()
.into()
}
})
.clone()
})
Expand Down Expand Up @@ -1817,27 +1821,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()
)
);
}
Expand Down
6 changes: 0 additions & 6 deletions crates/rpc/rpc-server-types/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===
Expand Down Expand Up @@ -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),
})
}
Expand Down
Loading