penumbra_sdk_dex/component/rpc/
stub.rs

1use super::*;
2
3/// A [`SimulationService`] that always returns an error.
4///
5/// This is useful for improving error messages if `pd` is not running with expensive RPCs
6/// enabled.
7pub struct SimulationsDisabled;
8
9#[tonic::async_trait]
10impl SimulationService for SimulationsDisabled {
11    async fn simulate_trade(
12        &self,
13        _: tonic::Request<SimulateTradeRequest>,
14    ) -> Result<tonic::Response<SimulateTradeResponse>, Status> {
15        Err(Status::unimplemented(
16            "SimulationService::simulate_trade() is not enabled on this node.\
17             Run pd with `--enable-expensive-rpc` to use this RPC.",
18        ))
19    }
20}