From 93112581d19be027c1e0cdc6f25db026c8def2f2 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Fri, 5 Jul 2024 02:35:42 -0400 Subject: [PATCH] app(rpc): expose simtrade service by default (#4697) --- crates/bin/pd/src/cli.rs | 5 +---- crates/core/app/src/rpc.rs | 18 ++++++------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/crates/bin/pd/src/cli.rs b/crates/bin/pd/src/cli.rs index 6cb28db31f..9ca4226eed 100644 --- a/crates/bin/pd/src/cli.rs +++ b/crates/bin/pd/src/cli.rs @@ -86,10 +86,7 @@ pub enum RootCommand { alias = "tendermint-addr", )] cometbft_addr: Url, - /// Enable expensive RPCs, such as the trade simulation service. - /// The trade simulation service allows clients to simulate trades without submitting them. - /// This is useful for approximating the cost of a trade before submitting it. - /// But, it is a potential DoS vector, so it is disabled by default. + /// Enable expensive RPCs, currently a no-op. #[clap(short, long, display_order = 500)] enable_expensive_rpc: bool, }, diff --git a/crates/core/app/src/rpc.rs b/crates/core/app/src/rpc.rs index 3935c08c9f..90c1b26f1f 100644 --- a/crates/core/app/src/rpc.rs +++ b/crates/core/app/src/rpc.rs @@ -23,7 +23,7 @@ use { }, penumbra_auction::component::rpc::Server as AuctionServer, penumbra_compact_block::component::rpc::Server as CompactBlockServer, - penumbra_dex::component::rpc::{stub::SimulationsDisabled, Server as DexServer}, + penumbra_dex::component::rpc::Server as DexServer, penumbra_fee::component::rpc::Server as FeeServer, penumbra_governance::component::rpc::Server as GovernanceServer, penumbra_proto::{ @@ -57,10 +57,10 @@ use { pub fn router( storage: &cnidarium::Storage, tm_proxy: impl TendermintProxyService, - enable_expensive_rpc: bool, + _enable_expensive_rpc: bool, ) -> anyhow::Result { let ibc = penumbra_ibc::component::rpc::IbcQuery::::new(storage.clone()); - let mut grpc_server = tonic::transport::server::Server::builder() + let grpc_server = tonic::transport::server::Server::builder() .trace_fn(|req| match remote_addr(req) { Some(remote_addr) => { tracing::error_span!("grpc", ?remote_addr) @@ -120,19 +120,13 @@ pub fn router( .add_service(we(ChannelQueryServer::new(ibc.clone()))) .add_service(we(ConnectionQueryServer::new(ibc.clone()))) .add_service(we(TendermintProxyServiceServer::new(tm_proxy))) + .add_service(we(SimulationServiceServer::new(DexServer::new( + storage.clone(), + )))) .add_service(we(tonic_reflection::server::Builder::configure() .register_encoded_file_descriptor_set(penumbra_proto::FILE_DESCRIPTOR_SET) .build() .with_context(|| "could not configure grpc reflection service")?)); - if enable_expensive_rpc { - grpc_server = grpc_server.add_service(we(SimulationServiceServer::new(DexServer::new( - storage.clone(), - )))); - } else { - grpc_server = - grpc_server.add_service(we(SimulationServiceServer::new(SimulationsDisabled))); - } - Ok(grpc_server) }