massa_grpc/
handler.rs

1// Copyright (c) 2023 MASSA LABS <info@massa.net>
2
3use massa_proto_rs::massa::api::v1 as grpc_api;
4
5use crate::private::{
6    add_staking_secret_keys, add_to_bootstrap_blacklist, add_to_bootstrap_whitelist,
7    add_to_peers_whitelist, allow_everyone_to_bootstrap, ban_nodes_by_ids, ban_nodes_by_ips,
8    get_bootstrap_blacklist, get_bootstrap_whitelist, get_mip_status, get_node_status,
9    get_peers_whitelist, remove_from_bootstrap_blacklist, remove_from_bootstrap_whitelist,
10    remove_from_peers_whitelist, remove_staking_addresses, shutdown_gracefully, sign_messages,
11    unban_nodes_by_ids, unban_nodes_by_ips,
12};
13use crate::public::{
14    execute_read_only_call, get_blocks, get_datastore_entries, get_endorsements,
15    get_next_block_best_parents, get_operations, get_sc_execution_events, get_selector_draws,
16    get_stakers, get_status, get_transactions_throughput, query_state, search_blocks,
17    search_endorsements, search_operations,
18};
19
20#[cfg(feature = "execution-trace")]
21use crate::public::{get_operation_abi_call_stacks, get_slot_abi_call_stacks, get_slot_transfers};
22use crate::stream::new_blocks::{new_blocks_server, NewBlocksServerStreamType};
23use crate::stream::new_endorsements::{new_endorsements_server, NewEndorsementsServerStreamType};
24use crate::stream::new_filled_blocks::{new_filled_blocks_server, NewFilledBlocksServerStreamType};
25use crate::stream::new_operations::{new_operations_server, NewOperationsServerStreamType};
26use crate::stream::new_slot_execution_outputs::{
27    new_slot_execution_outputs_server, NewSlotExecutionOutputsServerStreamType,
28};
29#[cfg(feature = "execution-trace")]
30use crate::stream::new_slot_transfers::new_slot_transfers;
31#[cfg(feature = "execution-info")]
32use crate::stream::new_transfers_info::new_transfer_info_server;
33use crate::stream::new_transfers_info::NewTransferInfoServerStreamType;
34
35use crate::server::{MassaPrivateGrpc, MassaPublicGrpc};
36use crate::stream::tx_throughput::{
37    transactions_throughput_server, TransactionsThroughputServerStreamType,
38};
39use crate::stream::{
40    new_blocks::{new_blocks, NewBlocksStreamType},
41    new_endorsements::{new_endorsements, NewEndorsementsStreamType},
42    new_filled_blocks::{new_filled_blocks, NewFilledBlocksStreamType},
43    new_operations::{new_operations, NewOperationsStreamType},
44    new_slot_abi_call_stacks::{new_slot_abi_call_stacks, NewSlotABICallStacksStreamType},
45    new_slot_execution_outputs::{new_slot_execution_outputs, NewSlotExecutionOutputsStreamType},
46    new_slot_transfers::NewSlotTransfersStreamType,
47    send_blocks::SendBlocksStreamType,
48    send_endorsements::{send_endorsements, SendEndorsementsStreamType},
49    send_operations::{send_operations, SendOperationsStreamType},
50    tx_throughput::{transactions_throughput, TransactionsThroughputStreamType},
51};
52
53#[tonic::async_trait]
54impl grpc_api::public_service_server::PublicService for MassaPublicGrpc {
55    /// Execute read only call
56    async fn execute_read_only_call(
57        &self,
58        request: tonic::Request<grpc_api::ExecuteReadOnlyCallRequest>,
59    ) -> std::result::Result<tonic::Response<grpc_api::ExecuteReadOnlyCallResponse>, tonic::Status>
60    {
61        Ok(tonic::Response::new(
62            execute_read_only_call(self, request).await?,
63        ))
64    }
65
66    #[cfg(feature = "execution-trace")]
67    async fn get_operation_abi_call_stacks(
68        &self,
69        request: tonic::Request<grpc_api::GetOperationAbiCallStacksRequest>,
70    ) -> std::result::Result<
71        tonic::Response<grpc_api::GetOperationAbiCallStacksResponse>,
72        tonic::Status,
73    > {
74        Ok(tonic::Response::new(get_operation_abi_call_stacks(
75            self, request,
76        )?))
77    }
78
79    #[cfg(not(feature = "execution-trace"))]
80    async fn get_operation_abi_call_stacks(
81        &self,
82        _request: tonic::Request<grpc_api::GetOperationAbiCallStacksRequest>,
83    ) -> std::result::Result<
84        tonic::Response<grpc_api::GetOperationAbiCallStacksResponse>,
85        tonic::Status,
86    > {
87        Err(tonic::Status::unimplemented("feature not enabled"))
88    }
89
90    #[cfg(feature = "execution-trace")]
91    async fn get_slot_abi_call_stacks(
92        &self,
93        request: tonic::Request<grpc_api::GetSlotAbiCallStacksRequest>,
94    ) -> std::result::Result<tonic::Response<grpc_api::GetSlotAbiCallStacksResponse>, tonic::Status>
95    {
96        Ok(tonic::Response::new(get_slot_abi_call_stacks(
97            self, request,
98        )?))
99    }
100
101    #[cfg(not(feature = "execution-trace"))]
102    async fn get_slot_abi_call_stacks(
103        &self,
104        _request: tonic::Request<grpc_api::GetSlotAbiCallStacksRequest>,
105    ) -> std::result::Result<tonic::Response<grpc_api::GetSlotAbiCallStacksResponse>, tonic::Status>
106    {
107        Err(tonic::Status::unimplemented("feature not enabled"))
108    }
109
110    #[cfg(feature = "execution-trace")]
111    async fn get_slot_transfers(
112        &self,
113        request: tonic::Request<grpc_api::GetSlotTransfersRequest>,
114    ) -> std::result::Result<tonic::Response<grpc_api::GetSlotTransfersResponse>, tonic::Status>
115    {
116        Ok(tonic::Response::new(get_slot_transfers(self, request)?))
117    }
118
119    #[cfg(not(feature = "execution-trace"))]
120    async fn get_slot_transfers(
121        &self,
122        _request: tonic::Request<grpc_api::GetSlotTransfersRequest>,
123    ) -> std::result::Result<tonic::Response<grpc_api::GetSlotTransfersResponse>, tonic::Status>
124    {
125        Err(tonic::Status::unimplemented("feature not enabled"))
126    }
127
128    /// handler for get blocks
129    async fn get_blocks(
130        &self,
131        request: tonic::Request<grpc_api::GetBlocksRequest>,
132    ) -> Result<tonic::Response<grpc_api::GetBlocksResponse>, tonic::Status> {
133        Ok(tonic::Response::new(get_blocks(self, request)?))
134    }
135
136    /// handler for get multiple datastore entries
137    async fn get_datastore_entries(
138        &self,
139        request: tonic::Request<grpc_api::GetDatastoreEntriesRequest>,
140    ) -> Result<tonic::Response<grpc_api::GetDatastoreEntriesResponse>, tonic::Status> {
141        Ok(tonic::Response::new(get_datastore_entries(self, request)?))
142    }
143
144    /// handler for get endorsements
145    async fn get_endorsements(
146        &self,
147        request: tonic::Request<grpc_api::GetEndorsementsRequest>,
148    ) -> Result<tonic::Response<grpc_api::GetEndorsementsResponse>, tonic::Status> {
149        Ok(tonic::Response::new(get_endorsements(self, request)?))
150    }
151
152    /// handler for get largest stakers
153    async fn get_stakers(
154        &self,
155        request: tonic::Request<grpc_api::GetStakersRequest>,
156    ) -> Result<tonic::Response<grpc_api::GetStakersResponse>, tonic::Status> {
157        Ok(tonic::Response::new(get_stakers(self, request)?))
158    }
159
160    /// handler for get satatus
161    async fn get_status(
162        &self,
163        request: tonic::Request<grpc_api::GetStatusRequest>,
164    ) -> Result<tonic::Response<grpc_api::GetStatusResponse>, tonic::Status> {
165        Ok(tonic::Response::new(get_status(self, request)?))
166    }
167
168    /// handler for get next block best parents
169    async fn get_next_block_best_parents(
170        &self,
171        request: tonic::Request<grpc_api::GetNextBlockBestParentsRequest>,
172    ) -> Result<tonic::Response<grpc_api::GetNextBlockBestParentsResponse>, tonic::Status> {
173        Ok(tonic::Response::new(get_next_block_best_parents(
174            self, request,
175        )?))
176    }
177
178    /// handler for get operations
179    async fn get_operations(
180        &self,
181        request: tonic::Request<grpc_api::GetOperationsRequest>,
182    ) -> Result<tonic::Response<grpc_api::GetOperationsResponse>, tonic::Status> {
183        Ok(tonic::Response::new(get_operations(self, request)?))
184    }
185
186    /// handler for get smart contract execution events
187    async fn get_sc_execution_events(
188        &self,
189        request: tonic::Request<grpc_api::GetScExecutionEventsRequest>,
190    ) -> Result<tonic::Response<grpc_api::GetScExecutionEventsResponse>, tonic::Status> {
191        Ok(tonic::Response::new(get_sc_execution_events(
192            self, request,
193        )?))
194    }
195
196    /// handler for get selector draws
197    async fn get_selector_draws(
198        &self,
199        request: tonic::Request<grpc_api::GetSelectorDrawsRequest>,
200    ) -> Result<tonic::Response<grpc_api::GetSelectorDrawsResponse>, tonic::Status> {
201        Ok(tonic::Response::new(get_selector_draws(self, request)?))
202    }
203
204    /// handler for get transactions throughput
205    async fn get_transactions_throughput(
206        &self,
207        request: tonic::Request<grpc_api::GetTransactionsThroughputRequest>,
208    ) -> Result<tonic::Response<grpc_api::GetTransactionsThroughputResponse>, tonic::Status> {
209        Ok(tonic::Response::new(get_transactions_throughput(
210            self, request,
211        )?))
212    }
213
214    /// handler for get version
215    async fn query_state(
216        &self,
217        request: tonic::Request<grpc_api::QueryStateRequest>,
218    ) -> Result<tonic::Response<grpc_api::QueryStateResponse>, tonic::Status> {
219        Ok(tonic::Response::new(query_state(self, request)?))
220    }
221
222    /// handler for search blocks
223    async fn search_blocks(
224        &self,
225        request: tonic::Request<grpc_api::SearchBlocksRequest>,
226    ) -> Result<tonic::Response<grpc_api::SearchBlocksResponse>, tonic::Status> {
227        Ok(tonic::Response::new(search_blocks(self, request)?))
228    }
229
230    /// handler for search endorsemets
231    async fn search_endorsements(
232        &self,
233        request: tonic::Request<grpc_api::SearchEndorsementsRequest>,
234    ) -> Result<tonic::Response<grpc_api::SearchEndorsementsResponse>, tonic::Status> {
235        Ok(tonic::Response::new(search_endorsements(self, request)?))
236    }
237
238    /// handler for search operations
239    async fn search_operations(
240        &self,
241        request: tonic::Request<grpc_api::SearchOperationsRequest>,
242    ) -> Result<tonic::Response<grpc_api::SearchOperationsResponse>, tonic::Status> {
243        Ok(tonic::Response::new(search_operations(self, request)?))
244    }
245
246    // ███████╗████████╗██████╗ ███████╗ █████╗ ███╗   ███╗
247    // ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██╔══██╗████╗ ████║
248    // ███████╗   ██║   ██████╔╝█████╗  ███████║██╔████╔██║
249    // ╚════██║   ██║   ██╔══██╗██╔══╝  ██╔══██║██║╚██╔╝██║
250    // ███████║   ██║   ██║  ██║███████╗██║  ██║██║ ╚═╝ ██║
251
252    type NewBlocksStream = NewBlocksStreamType;
253
254    /// handler for subscribe new blocks
255    async fn new_blocks(
256        &self,
257        request: tonic::Request<tonic::Streaming<grpc_api::NewBlocksRequest>>,
258    ) -> Result<tonic::Response<Self::NewBlocksStream>, tonic::Status> {
259        Ok(tonic::Response::new(new_blocks(self, request).await?))
260    }
261
262    type NewBlocksServerStream = NewBlocksServerStreamType;
263    /// handler for subscribe new blocks unidirectional
264    async fn new_blocks_server(
265        &self,
266        request: tonic::Request<grpc_api::NewBlocksServerRequest>,
267    ) -> Result<tonic::Response<Self::NewBlocksServerStream>, tonic::Status> {
268        Ok(tonic::Response::new(
269            new_blocks_server(self, request).await?,
270        ))
271    }
272
273    type NewEndorsementsStream = NewEndorsementsStreamType;
274
275    /// handler for subscribe new endorsements stream
276    async fn new_endorsements(
277        &self,
278        request: tonic::Request<tonic::Streaming<grpc_api::NewEndorsementsRequest>>,
279    ) -> Result<tonic::Response<Self::NewEndorsementsStream>, tonic::Status> {
280        Ok(tonic::Response::new(new_endorsements(self, request).await?))
281    }
282
283    type NewEndorsementsServerStream = NewEndorsementsServerStreamType;
284
285    /// handler for subscribe new endorsements  unidirectional stream
286    async fn new_endorsements_server(
287        &self,
288        request: tonic::Request<grpc_api::NewEndorsementsServerRequest>,
289    ) -> Result<tonic::Response<Self::NewEndorsementsServerStream>, tonic::Status> {
290        Ok(tonic::Response::new(
291            new_endorsements_server(self, request).await?,
292        ))
293    }
294
295    type NewFilledBlocksStream = NewFilledBlocksStreamType;
296
297    /// handler for subscribe new blocks with operations content
298    async fn new_filled_blocks(
299        &self,
300        request: tonic::Request<tonic::Streaming<grpc_api::NewFilledBlocksRequest>>,
301    ) -> Result<tonic::Response<Self::NewFilledBlocksStream>, tonic::Status> {
302        Ok(tonic::Response::new(
303            new_filled_blocks(self, request).await?,
304        ))
305    }
306
307    type NewFilledBlocksServerStream = NewFilledBlocksServerStreamType;
308
309    async fn new_filled_blocks_server(
310        &self,
311        request: tonic::Request<grpc_api::NewFilledBlocksServerRequest>,
312    ) -> Result<tonic::Response<Self::NewFilledBlocksServerStream>, tonic::Status> {
313        Ok(tonic::Response::new(
314            new_filled_blocks_server(self, request).await?,
315        ))
316    }
317
318    type NewOperationsStream = NewOperationsStreamType;
319
320    /// handler for subscribe new operations stream
321    async fn new_operations(
322        &self,
323        request: tonic::Request<tonic::Streaming<grpc_api::NewOperationsRequest>>,
324    ) -> Result<tonic::Response<Self::NewOperationsStream>, tonic::Status> {
325        Ok(tonic::Response::new(new_operations(self, request).await?))
326    }
327
328    type NewOperationsServerStream = NewOperationsServerStreamType;
329
330    /// handler for subscribe new operations stream
331    async fn new_operations_server(
332        &self,
333        request: tonic::Request<grpc_api::NewOperationsServerRequest>,
334    ) -> Result<tonic::Response<Self::NewOperationsServerStream>, tonic::Status> {
335        Ok(tonic::Response::new(
336            new_operations_server(self, request).await?,
337        ))
338    }
339
340    type NewSlotExecutionOutputsStream = NewSlotExecutionOutputsStreamType;
341
342    /// handler for subscribe new slot execution output stream
343    async fn new_slot_execution_outputs(
344        &self,
345        request: tonic::Request<tonic::Streaming<grpc_api::NewSlotExecutionOutputsRequest>>,
346    ) -> Result<tonic::Response<Self::NewSlotExecutionOutputsStream>, tonic::Status> {
347        Ok(tonic::Response::new(
348            new_slot_execution_outputs(self, request).await?,
349        ))
350    }
351
352    type NewSlotExecutionOutputsServerStream = NewSlotExecutionOutputsServerStreamType;
353
354    async fn new_slot_execution_outputs_server(
355        &self,
356        request: tonic::Request<grpc_api::NewSlotExecutionOutputsServerRequest>,
357    ) -> Result<tonic::Response<Self::NewSlotExecutionOutputsServerStream>, tonic::Status> {
358        Ok(tonic::Response::new(
359            new_slot_execution_outputs_server(self, request).await?,
360        ))
361    }
362
363    type NewSlotTransfersStream = NewSlotTransfersStreamType;
364
365    #[cfg(feature = "execution-trace")]
366    /// handler for subscribe new slot transfers stream
367    async fn new_slot_transfers(
368        &self,
369        request: tonic::Request<tonic::Streaming<grpc_api::NewSlotTransfersRequest>>,
370    ) -> Result<tonic::Response<Self::NewSlotTransfersStream>, tonic::Status> {
371        Ok(tonic::Response::new(
372            new_slot_transfers(self, request).await?,
373        ))
374    }
375
376    #[cfg(not(feature = "execution-trace"))]
377    /// handler for subscribe new slot transfers stream
378    async fn new_slot_transfers(
379        &self,
380        _request: tonic::Request<tonic::Streaming<grpc_api::NewSlotTransfersRequest>>,
381    ) -> Result<tonic::Response<Self::NewSlotTransfersStream>, tonic::Status> {
382        Err(tonic::Status::unimplemented("feature not enabled"))
383    }
384
385    type NewTransfersInfoServerStream = NewTransferInfoServerStreamType;
386
387    #[cfg(not(feature = "execution-info"))]
388    async fn new_transfers_info_server(
389        &self,
390        _request: tonic::Request<grpc_api::NewTransfersInfoServerRequest>,
391    ) -> std::result::Result<tonic::Response<Self::NewTransfersInfoServerStream>, tonic::Status>
392    {
393        Err(tonic::Status::unimplemented("feature not enabled"))
394    }
395
396    #[cfg(feature = "execution-info")]
397    async fn new_transfers_info_server(
398        &self,
399        request: tonic::Request<grpc_api::NewTransfersInfoServerRequest>,
400    ) -> std::result::Result<tonic::Response<Self::NewTransfersInfoServerStream>, tonic::Status>
401    {
402        Ok(tonic::Response::new(
403            new_transfer_info_server(self, request).await?,
404        ))
405    }
406
407    type NewSlotABICallStacksStream = NewSlotABICallStacksStreamType;
408
409    /// handler for subscribe new slot abi call stacks stream
410    async fn new_slot_abi_call_stacks(
411        &self,
412        request: tonic::Request<tonic::Streaming<grpc_api::NewSlotAbiCallStacksRequest>>,
413    ) -> Result<tonic::Response<Self::NewSlotABICallStacksStream>, tonic::Status> {
414        if cfg!(feature = "execution-trace") {
415            Ok(tonic::Response::new(
416                new_slot_abi_call_stacks(self, request).await?,
417            ))
418        } else {
419            Err(tonic::Status::unimplemented("feature not enabled"))
420        }
421    }
422
423    type SendBlocksStream = SendBlocksStreamType;
424
425    /// handler for send_blocks_stream
426    async fn send_blocks(
427        &self,
428        _request: tonic::Request<tonic::Streaming<grpc_api::SendBlocksRequest>>,
429    ) -> Result<tonic::Response<Self::SendBlocksStream>, tonic::Status> {
430        Err(tonic::Status::unavailable("not available"))
431        // Ok(tonic::Response::new(send_blocks(self, request).await?))
432    }
433
434    type SendEndorsementsStream = SendEndorsementsStreamType;
435
436    /// handler for send_endorsements
437    async fn send_endorsements(
438        &self,
439        request: tonic::Request<tonic::Streaming<grpc_api::SendEndorsementsRequest>>,
440    ) -> Result<tonic::Response<Self::SendEndorsementsStream>, tonic::Status> {
441        Ok(tonic::Response::new(
442            send_endorsements(self, request).await?,
443        ))
444    }
445
446    type SendOperationsStream = SendOperationsStreamType;
447
448    /// handler for send_operations
449    async fn send_operations(
450        &self,
451        request: tonic::Request<tonic::Streaming<grpc_api::SendOperationsRequest>>,
452    ) -> Result<tonic::Response<Self::SendOperationsStream>, tonic::Status> {
453        Ok(tonic::Response::new(send_operations(self, request).await?))
454    }
455
456    type TransactionsThroughputStream = TransactionsThroughputStreamType;
457
458    /// handler for transactions throughput
459    async fn transactions_throughput(
460        &self,
461        request: tonic::Request<tonic::Streaming<grpc_api::TransactionsThroughputRequest>>,
462    ) -> Result<tonic::Response<Self::TransactionsThroughputStream>, tonic::Status> {
463        Ok(tonic::Response::new(
464            transactions_throughput(self, request).await?,
465        ))
466    }
467
468    type TransactionsThroughputServerStream = TransactionsThroughputServerStreamType;
469
470    async fn transactions_throughput_server(
471        &self,
472        request: tonic::Request<grpc_api::TransactionsThroughputServerRequest>,
473    ) -> Result<tonic::Response<Self::TransactionsThroughputServerStream>, tonic::Status> {
474        Ok(tonic::Response::new(
475            transactions_throughput_server(self, request).await?,
476        ))
477    }
478}
479
480#[tonic::async_trait]
481impl grpc_api::private_service_server::PrivateService for MassaPrivateGrpc {
482    /// Add IP addresses to node bootstrap blacklist
483    async fn add_to_bootstrap_blacklist(
484        &self,
485        request: tonic::Request<grpc_api::AddToBootstrapBlacklistRequest>,
486    ) -> Result<tonic::Response<grpc_api::AddToBootstrapBlacklistResponse>, tonic::Status> {
487        Ok(tonic::Response::new(add_to_bootstrap_blacklist(
488            self, request,
489        )?))
490    }
491    /// Add IP addresses to node bootstrap whitelist
492    async fn add_to_bootstrap_whitelist(
493        &self,
494        request: tonic::Request<grpc_api::AddToBootstrapWhitelistRequest>,
495    ) -> Result<tonic::Response<grpc_api::AddToBootstrapWhitelistResponse>, tonic::Status> {
496        Ok(tonic::Response::new(add_to_bootstrap_whitelist(
497            self, request,
498        )?))
499    }
500    /// Add IP addresses to node peers whitelist. No confirmation to expect.
501    /// Note: If the ip was unknown it adds it to the known peers, otherwise it updates the peer type
502    async fn add_to_peers_whitelist(
503        &self,
504        request: tonic::Request<grpc_api::AddToPeersWhitelistRequest>,
505    ) -> Result<tonic::Response<grpc_api::AddToPeersWhitelistResponse>, tonic::Status> {
506        Ok(tonic::Response::new(add_to_peers_whitelist(self, request)?))
507    }
508    /// Add staking secret keys to wallet
509    async fn add_staking_secret_keys(
510        &self,
511        request: tonic::Request<grpc_api::AddStakingSecretKeysRequest>,
512    ) -> Result<tonic::Response<grpc_api::AddStakingSecretKeysResponse>, tonic::Status> {
513        Ok(tonic::Response::new(add_staking_secret_keys(
514            self, request,
515        )?))
516    }
517    /// Ban multiple nodes by their individual ids
518    async fn ban_nodes_by_ids(
519        &self,
520        request: tonic::Request<grpc_api::BanNodesByIdsRequest>,
521    ) -> Result<tonic::Response<grpc_api::BanNodesByIdsResponse>, tonic::Status> {
522        Ok(tonic::Response::new(ban_nodes_by_ids(self, request)?))
523    }
524
525    /// Ban multiple nodes by their individual IP addresses
526    async fn ban_nodes_by_ips(
527        &self,
528        request: tonic::Request<grpc_api::BanNodesByIpsRequest>,
529    ) -> Result<tonic::Response<grpc_api::BanNodesByIpsResponse>, tonic::Status> {
530        Ok(tonic::Response::new(ban_nodes_by_ips(self, request)?))
531    }
532
533    /// Get node bootstrap blacklist IP addresses
534    async fn get_bootstrap_blacklist(
535        &self,
536        request: tonic::Request<grpc_api::GetBootstrapBlacklistRequest>,
537    ) -> Result<tonic::Response<grpc_api::GetBootstrapBlacklistResponse>, tonic::Status> {
538        Ok(tonic::Response::new(get_bootstrap_blacklist(
539            self, request,
540        )?))
541    }
542    /// Get node bootstrap whitelist IP addresses
543    async fn get_bootstrap_whitelist(
544        &self,
545        request: tonic::Request<grpc_api::GetBootstrapWhitelistRequest>,
546    ) -> Result<tonic::Response<grpc_api::GetBootstrapWhitelistResponse>, tonic::Status> {
547        Ok(tonic::Response::new(get_bootstrap_whitelist(
548            self, request,
549        )?))
550    }
551    /// handler for get mip status (versioning)
552    async fn get_mip_status(
553        &self,
554        request: tonic::Request<grpc_api::GetMipStatusRequest>,
555    ) -> Result<tonic::Response<grpc_api::GetMipStatusResponse>, tonic::Status> {
556        Ok(tonic::Response::new(get_mip_status(self, request)?))
557    }
558    /// Allow everyone to bootstrap from the node by removing bootstrap whitelist configuration file
559    async fn allow_everyone_to_bootstrap(
560        &self,
561        request: tonic::Request<grpc_api::AllowEveryoneToBootstrapRequest>,
562    ) -> Result<tonic::Response<grpc_api::AllowEveryoneToBootstrapResponse>, tonic::Status> {
563        Ok(tonic::Response::new(allow_everyone_to_bootstrap(
564            self, request,
565        )?))
566    }
567    /// Get node status
568    async fn get_node_status(
569        &self,
570        request: tonic::Request<grpc_api::GetNodeStatusRequest>,
571    ) -> Result<tonic::Response<grpc_api::GetNodeStatusResponse>, tonic::Status> {
572        Ok(tonic::Response::new(get_node_status(self, request)?))
573    }
574    /// Get node peers whitelist IP addresses
575    async fn get_peers_whitelist(
576        &self,
577        request: tonic::Request<grpc_api::GetPeersWhitelistRequest>,
578    ) -> Result<tonic::Response<grpc_api::GetPeersWhitelistResponse>, tonic::Status> {
579        Ok(tonic::Response::new(get_peers_whitelist(self, request)?))
580    }
581    /// Remove from bootstrap blacklist given IP addresses
582    async fn remove_from_bootstrap_blacklist(
583        &self,
584        request: tonic::Request<grpc_api::RemoveFromBootstrapBlacklistRequest>,
585    ) -> Result<tonic::Response<grpc_api::RemoveFromBootstrapBlacklistResponse>, tonic::Status>
586    {
587        Ok(tonic::Response::new(remove_from_bootstrap_blacklist(
588            self, request,
589        )?))
590    }
591    /// Remove from bootstrap whitelist given IP addresses
592    async fn remove_from_bootstrap_whitelist(
593        &self,
594        request: tonic::Request<grpc_api::RemoveFromBootstrapWhitelistRequest>,
595    ) -> Result<tonic::Response<grpc_api::RemoveFromBootstrapWhitelistResponse>, tonic::Status>
596    {
597        Ok(tonic::Response::new(remove_from_bootstrap_whitelist(
598            self, request,
599        )?))
600    }
601    /// Remove from peers whitelist given IP addresses
602    async fn remove_from_peers_whitelist(
603        &self,
604        request: tonic::Request<grpc_api::RemoveFromPeersWhitelistRequest>,
605    ) -> Result<tonic::Response<grpc_api::RemoveFromPeersWhitelistResponse>, tonic::Status> {
606        Ok(tonic::Response::new(remove_from_peers_whitelist(
607            self, request,
608        )?))
609    }
610    /// Remove addresses from staking
611    async fn remove_staking_addresses(
612        &self,
613        request: tonic::Request<grpc_api::RemoveStakingAddressesRequest>,
614    ) -> Result<tonic::Response<grpc_api::RemoveStakingAddressesResponse>, tonic::Status> {
615        Ok(tonic::Response::new(remove_staking_addresses(
616            self, request,
617        )?))
618    }
619    /// Sign messages with node's key
620    async fn sign_messages(
621        &self,
622        request: tonic::Request<grpc_api::SignMessagesRequest>,
623    ) -> Result<tonic::Response<grpc_api::SignMessagesResponse>, tonic::Status> {
624        Ok(tonic::Response::new(sign_messages(self, request)?))
625    }
626    /// Shutdown the node gracefully
627    async fn shutdown_gracefully(
628        &self,
629        request: tonic::Request<grpc_api::ShutdownGracefullyRequest>,
630    ) -> Result<tonic::Response<grpc_api::ShutdownGracefullyResponse>, tonic::Status> {
631        Ok(tonic::Response::new(shutdown_gracefully(self, request)?))
632    }
633
634    /// Unban multiple nodes by their individual ids
635    async fn unban_nodes_by_ids(
636        &self,
637        request: tonic::Request<grpc_api::UnbanNodesByIdsRequest>,
638    ) -> Result<tonic::Response<grpc_api::UnbanNodesByIdsResponse>, tonic::Status> {
639        Ok(tonic::Response::new(unban_nodes_by_ids(self, request)?))
640    }
641
642    /// Unban multiple nodes by their individual IP addresses
643    async fn unban_nodes_by_ips(
644        &self,
645        request: tonic::Request<grpc_api::UnbanNodesByIpsRequest>,
646    ) -> Result<tonic::Response<grpc_api::UnbanNodesByIpsResponse>, tonic::Status> {
647        Ok(tonic::Response::new(unban_nodes_by_ips(self, request)?))
648    }
649}