mina_node_testing/service/
rpc_service.rs

1use mina_core::requests::RpcId;
2use node::{
3    p2p::connection::P2pConnectionResponse, rpc::RpcMessageProgressResponse,
4    rpc_effectful::RespondError, service::RpcService, State,
5};
6
7macro_rules! to_real {
8    ($name:ident, $response:ty $(,)?) => {
9        fn $name(&mut self, rpc_id: RpcId, response: $response) -> Result<(), RespondError> {
10            self.real.$name(rpc_id, response)
11        }
12    };
13}
14
15impl RpcService for super::NodeTestingService {
16    to_real!(respond_state_get, (&State, Option<&str>));
17    to_real!(respond_status_get, node::rpc::RpcStatusGetResponse);
18    to_real!(respond_heartbeat_get, node::rpc::RpcHeartbeatGetResponse);
19    to_real!(respond_sync_stats_get, node::rpc::RpcSyncStatsGetResponse);
20    to_real!(
21        respond_block_producer_stats_get,
22        node::rpc::RpcBlockProducerStatsGetResponse
23    );
24
25    to_real!(
26        respond_action_stats_get,
27        node::rpc::RpcActionStatsGetResponse,
28    );
29    to_real!(
30        respond_message_progress_stats_get,
31        RpcMessageProgressResponse
32    );
33    to_real!(respond_peers_get, node::rpc::RpcPeersGetResponse,);
34    to_real!(
35        respond_p2p_connection_outgoing,
36        node::rpc::RpcP2pConnectionOutgoingResponse,
37    );
38    to_real!(
39        respond_p2p_connection_incoming_answer,
40        P2pConnectionResponse,
41    );
42
43    to_real!(respond_p2p_connection_incoming, Result<(), String>,);
44    to_real!(
45        respond_scan_state_summary_get,
46        node::rpc::RpcScanStateSummaryGetResponse,
47    );
48    to_real!(respond_snark_pool_get, node::rpc::RpcSnarkPoolGetResponse,);
49    to_real!(
50        respond_snark_pool_job_get,
51        node::rpc::RpcSnarkPoolJobGetResponse,
52    );
53    to_real!(
54        respond_snark_pool_completed_jobs_get,
55        node::rpc::RpcSnarkPoolCompletedJobsResponse,
56    );
57    to_real!(
58        respond_snark_pool_pending_jobs_get,
59        node::rpc::RpcSnarkPoolPendingJobsGetResponse
60    );
61    to_real!(
62        respond_snarker_job_commit,
63        node::rpc::RpcSnarkerJobCommitResponse,
64    );
65    to_real!(
66        respond_snarker_job_spec,
67        node::rpc::RpcSnarkerJobSpecResponse,
68    );
69    to_real!(
70        respond_snarker_workers,
71        node::rpc::RpcSnarkerWorkersResponse,
72    );
73    to_real!(
74        respond_snarker_config_get,
75        node::rpc::RpcSnarkerConfigGetResponse,
76    );
77    to_real!(respond_health_check, node::rpc::RpcHealthCheckResponse,);
78    to_real!(
79        respond_readiness_check,
80        node::rpc::RpcReadinessCheckResponse,
81    );
82    to_real!(
83        respond_discovery_routing_table,
84        node::rpc::RpcDiscoveryRoutingTableResponse
85    );
86    to_real!(
87        respond_discovery_bootstrap_stats,
88        node::rpc::RpcDiscoveryBoostrapStatsResponse
89    );
90    to_real!(
91        respond_transaction_pool,
92        node::rpc::RpcTransactionPoolResponse
93    );
94    to_real!(
95        respond_ledger_slim_accounts,
96        node::rpc::RpcLedgerSlimAccountsResponse
97    );
98    to_real!(
99        respond_ledger_accounts,
100        node::rpc::RpcLedgerAccountsResponse
101    );
102    to_real!(
103        respond_transaction_inject,
104        node::rpc::RpcTransactionInjectResponse
105    );
106    to_real!(
107        respond_transition_frontier_commands,
108        node::rpc::RpcTransitionFrontierUserCommandsResponse,
109    );
110    to_real!(respond_best_chain, node::rpc::RpcBestChainResponse,);
111    to_real!(
112        respond_consensus_constants,
113        node::rpc::RpcConsensusConstantsGetResponse,
114    );
115    to_real!(
116        respond_transaction_status,
117        node::rpc::RpcTransactionStatusGetResponse,
118    );
119    to_real!(respond_block_get, node::rpc::RpcGetBlockResponse,);
120    to_real!(
121        respond_pooled_user_commands,
122        node::rpc::RpcPooledUserCommandsResponse,
123    );
124    to_real!(
125        respond_pooled_zkapp_commands,
126        node::rpc::RpcPooledZkappCommandsResponse,
127    );
128    to_real!(respond_genesis_block, node::rpc::RpcGenesisBlockResponse,);
129    to_real!(
130        respond_consensus_time_get,
131        node::rpc::RpcConsensusTimeGetResponse,
132    );
133    to_real!(
134        respond_ledger_status_get,
135        node::rpc::RpcLedgerStatusGetResponse,
136    );
137    to_real!(
138        respond_ledger_account_delegators_get,
139        node::rpc::RpcLedgerAccountDelegatorsGetResponse,
140    );
141}