penumbra_sdk_proto/gen/
penumbra.tools.summoning.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ParticipateRequest {
4    #[prost(oneof = "participate_request::Msg", tags = "1, 2")]
5    pub msg: ::core::option::Option<participate_request::Msg>,
6}
7/// Nested message and enum types in `ParticipateRequest`.
8pub mod participate_request {
9    /// Sent at the beginning of the connection to identify the participant.
10    #[derive(Clone, PartialEq, ::prost::Message)]
11    pub struct Identify {
12        #[prost(message, optional, tag = "1")]
13        pub address: ::core::option::Option<
14            super::super::super::super::core::keys::v1::Address,
15        >,
16    }
17    impl ::prost::Name for Identify {
18        const NAME: &'static str = "Identify";
19        const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
20        fn full_name() -> ::prost::alloc::string::String {
21            "penumbra.tools.summoning.v1.ParticipateRequest.Identify".into()
22        }
23        fn type_url() -> ::prost::alloc::string::String {
24            "/penumbra.tools.summoning.v1.ParticipateRequest.Identify".into()
25        }
26    }
27    /// Sent by the participant after getting a `ContributeNow` message.
28    #[derive(Clone, PartialEq, ::prost::Message)]
29    pub struct Contribution {
30        #[prost(message, optional, tag = "1")]
31        pub updated: ::core::option::Option<super::CeremonyCrs>,
32        #[prost(message, optional, tag = "2")]
33        pub update_proofs: ::core::option::Option<super::CeremonyLinkingProof>,
34        #[prost(message, optional, tag = "3")]
35        pub parent_hashes: ::core::option::Option<super::CeremonyParentHashes>,
36    }
37    impl ::prost::Name for Contribution {
38        const NAME: &'static str = "Contribution";
39        const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
40        fn full_name() -> ::prost::alloc::string::String {
41            "penumbra.tools.summoning.v1.ParticipateRequest.Contribution".into()
42        }
43        fn type_url() -> ::prost::alloc::string::String {
44            "/penumbra.tools.summoning.v1.ParticipateRequest.Contribution".into()
45        }
46    }
47    #[derive(Clone, PartialEq, ::prost::Oneof)]
48    pub enum Msg {
49        #[prost(message, tag = "1")]
50        Identify(Identify),
51        #[prost(message, tag = "2")]
52        Contribution(Contribution),
53    }
54}
55impl ::prost::Name for ParticipateRequest {
56    const NAME: &'static str = "ParticipateRequest";
57    const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
58    fn full_name() -> ::prost::alloc::string::String {
59        "penumbra.tools.summoning.v1.ParticipateRequest".into()
60    }
61    fn type_url() -> ::prost::alloc::string::String {
62        "/penumbra.tools.summoning.v1.ParticipateRequest".into()
63    }
64}
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct CeremonyCrs {
67    #[prost(bytes = "vec", tag = "100")]
68    pub spend: ::prost::alloc::vec::Vec<u8>,
69    #[prost(bytes = "vec", tag = "101")]
70    pub output: ::prost::alloc::vec::Vec<u8>,
71    #[prost(bytes = "vec", tag = "102")]
72    pub delegator_vote: ::prost::alloc::vec::Vec<u8>,
73    #[prost(bytes = "vec", tag = "103")]
74    pub undelegate_claim: ::prost::alloc::vec::Vec<u8>,
75    #[prost(bytes = "vec", tag = "104")]
76    pub swap: ::prost::alloc::vec::Vec<u8>,
77    #[prost(bytes = "vec", tag = "105")]
78    pub swap_claim: ::prost::alloc::vec::Vec<u8>,
79    #[prost(bytes = "vec", tag = "106")]
80    pub nullifer_derivation_crs: ::prost::alloc::vec::Vec<u8>,
81}
82impl ::prost::Name for CeremonyCrs {
83    const NAME: &'static str = "CeremonyCrs";
84    const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
85    fn full_name() -> ::prost::alloc::string::String {
86        "penumbra.tools.summoning.v1.CeremonyCrs".into()
87    }
88    fn type_url() -> ::prost::alloc::string::String {
89        "/penumbra.tools.summoning.v1.CeremonyCrs".into()
90    }
91}
92#[derive(Clone, PartialEq, ::prost::Message)]
93pub struct CeremonyLinkingProof {
94    #[prost(bytes = "vec", tag = "100")]
95    pub spend: ::prost::alloc::vec::Vec<u8>,
96    #[prost(bytes = "vec", tag = "101")]
97    pub output: ::prost::alloc::vec::Vec<u8>,
98    #[prost(bytes = "vec", tag = "102")]
99    pub delegator_vote: ::prost::alloc::vec::Vec<u8>,
100    #[prost(bytes = "vec", tag = "103")]
101    pub undelegate_claim: ::prost::alloc::vec::Vec<u8>,
102    #[prost(bytes = "vec", tag = "104")]
103    pub swap: ::prost::alloc::vec::Vec<u8>,
104    #[prost(bytes = "vec", tag = "105")]
105    pub swap_claim: ::prost::alloc::vec::Vec<u8>,
106    #[prost(bytes = "vec", tag = "106")]
107    pub nullifer_derivation_crs: ::prost::alloc::vec::Vec<u8>,
108}
109impl ::prost::Name for CeremonyLinkingProof {
110    const NAME: &'static str = "CeremonyLinkingProof";
111    const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
112    fn full_name() -> ::prost::alloc::string::String {
113        "penumbra.tools.summoning.v1.CeremonyLinkingProof".into()
114    }
115    fn type_url() -> ::prost::alloc::string::String {
116        "/penumbra.tools.summoning.v1.CeremonyLinkingProof".into()
117    }
118}
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct CeremonyParentHashes {
121    #[prost(bytes = "vec", tag = "100")]
122    pub spend: ::prost::alloc::vec::Vec<u8>,
123    #[prost(bytes = "vec", tag = "101")]
124    pub output: ::prost::alloc::vec::Vec<u8>,
125    #[prost(bytes = "vec", tag = "102")]
126    pub delegator_vote: ::prost::alloc::vec::Vec<u8>,
127    #[prost(bytes = "vec", tag = "103")]
128    pub undelegate_claim: ::prost::alloc::vec::Vec<u8>,
129    #[prost(bytes = "vec", tag = "104")]
130    pub swap: ::prost::alloc::vec::Vec<u8>,
131    #[prost(bytes = "vec", tag = "105")]
132    pub swap_claim: ::prost::alloc::vec::Vec<u8>,
133    #[prost(bytes = "vec", tag = "106")]
134    pub nullifer_derivation_crs: ::prost::alloc::vec::Vec<u8>,
135}
136impl ::prost::Name for CeremonyParentHashes {
137    const NAME: &'static str = "CeremonyParentHashes";
138    const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
139    fn full_name() -> ::prost::alloc::string::String {
140        "penumbra.tools.summoning.v1.CeremonyParentHashes".into()
141    }
142    fn type_url() -> ::prost::alloc::string::String {
143        "/penumbra.tools.summoning.v1.CeremonyParentHashes".into()
144    }
145}
146#[derive(Clone, PartialEq, ::prost::Message)]
147pub struct ParticipateResponse {
148    #[prost(oneof = "participate_response::Msg", tags = "1, 2, 3")]
149    pub msg: ::core::option::Option<participate_response::Msg>,
150}
151/// Nested message and enum types in `ParticipateResponse`.
152pub mod participate_response {
153    /// Streamed to the participant to inform them of their position in the queue.
154    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
155    pub struct Position {
156        /// The position of the participant in the queue.
157        #[prost(uint32, tag = "1")]
158        pub position: u32,
159        /// The total number of participants in the queue.
160        #[prost(uint32, tag = "2")]
161        pub connected_participants: u32,
162        /// The bid for the most recently executed contribution slot.
163        #[prost(message, optional, tag = "3")]
164        pub last_slot_bid: ::core::option::Option<
165            super::super::super::super::core::num::v1::Amount,
166        >,
167        /// The participant's current bid.
168        #[prost(message, optional, tag = "4")]
169        pub your_bid: ::core::option::Option<
170            super::super::super::super::core::num::v1::Amount,
171        >,
172    }
173    impl ::prost::Name for Position {
174        const NAME: &'static str = "Position";
175        const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
176        fn full_name() -> ::prost::alloc::string::String {
177            "penumbra.tools.summoning.v1.ParticipateResponse.Position".into()
178        }
179        fn type_url() -> ::prost::alloc::string::String {
180            "/penumbra.tools.summoning.v1.ParticipateResponse.Position".into()
181        }
182    }
183    /// Sent to the participant to inform them that they should contribute now.
184    #[derive(Clone, PartialEq, ::prost::Message)]
185    pub struct ContributeNow {
186        /// The most recent CRS, which the participant should update.
187        #[prost(message, optional, tag = "1")]
188        pub parent: ::core::option::Option<super::CeremonyCrs>,
189    }
190    impl ::prost::Name for ContributeNow {
191        const NAME: &'static str = "ContributeNow";
192        const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
193        fn full_name() -> ::prost::alloc::string::String {
194            "penumbra.tools.summoning.v1.ParticipateResponse.ContributeNow".into()
195        }
196        fn type_url() -> ::prost::alloc::string::String {
197            "/penumbra.tools.summoning.v1.ParticipateResponse.ContributeNow".into()
198        }
199    }
200    /// Sent to the participant to confim their contribution was accepted.
201    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
202    pub struct Confirm {
203        #[prost(uint64, tag = "1")]
204        pub slot: u64,
205    }
206    impl ::prost::Name for Confirm {
207        const NAME: &'static str = "Confirm";
208        const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
209        fn full_name() -> ::prost::alloc::string::String {
210            "penumbra.tools.summoning.v1.ParticipateResponse.Confirm".into()
211        }
212        fn type_url() -> ::prost::alloc::string::String {
213            "/penumbra.tools.summoning.v1.ParticipateResponse.Confirm".into()
214        }
215    }
216    #[derive(Clone, PartialEq, ::prost::Oneof)]
217    pub enum Msg {
218        #[prost(message, tag = "1")]
219        Position(Position),
220        #[prost(message, tag = "2")]
221        ContributeNow(ContributeNow),
222        #[prost(message, tag = "3")]
223        Confirm(Confirm),
224    }
225}
226impl ::prost::Name for ParticipateResponse {
227    const NAME: &'static str = "ParticipateResponse";
228    const PACKAGE: &'static str = "penumbra.tools.summoning.v1";
229    fn full_name() -> ::prost::alloc::string::String {
230        "penumbra.tools.summoning.v1.ParticipateResponse".into()
231    }
232    fn type_url() -> ::prost::alloc::string::String {
233        "/penumbra.tools.summoning.v1.ParticipateResponse".into()
234    }
235}
236/// Generated client implementations.
237#[cfg(feature = "rpc")]
238pub mod ceremony_coordinator_service_client {
239    #![allow(
240        unused_variables,
241        dead_code,
242        missing_docs,
243        clippy::wildcard_imports,
244        clippy::let_unit_value,
245    )]
246    use tonic::codegen::*;
247    use tonic::codegen::http::Uri;
248    /// Runs a Phase 2 MPC ceremony with dynamic slot allocation.
249    #[derive(Debug, Clone)]
250    pub struct CeremonyCoordinatorServiceClient<T> {
251        inner: tonic::client::Grpc<T>,
252    }
253    impl CeremonyCoordinatorServiceClient<tonic::transport::Channel> {
254        /// Attempt to create a new client by connecting to a given endpoint.
255        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
256        where
257            D: TryInto<tonic::transport::Endpoint>,
258            D::Error: Into<StdError>,
259        {
260            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
261            Ok(Self::new(conn))
262        }
263    }
264    impl<T> CeremonyCoordinatorServiceClient<T>
265    where
266        T: tonic::client::GrpcService<tonic::body::BoxBody>,
267        T::Error: Into<StdError>,
268        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
269        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
270    {
271        pub fn new(inner: T) -> Self {
272            let inner = tonic::client::Grpc::new(inner);
273            Self { inner }
274        }
275        pub fn with_origin(inner: T, origin: Uri) -> Self {
276            let inner = tonic::client::Grpc::with_origin(inner, origin);
277            Self { inner }
278        }
279        pub fn with_interceptor<F>(
280            inner: T,
281            interceptor: F,
282        ) -> CeremonyCoordinatorServiceClient<InterceptedService<T, F>>
283        where
284            F: tonic::service::Interceptor,
285            T::ResponseBody: Default,
286            T: tonic::codegen::Service<
287                http::Request<tonic::body::BoxBody>,
288                Response = http::Response<
289                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
290                >,
291            >,
292            <T as tonic::codegen::Service<
293                http::Request<tonic::body::BoxBody>,
294            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
295        {
296            CeremonyCoordinatorServiceClient::new(
297                InterceptedService::new(inner, interceptor),
298            )
299        }
300        /// Compress requests with the given encoding.
301        ///
302        /// This requires the server to support it otherwise it might respond with an
303        /// error.
304        #[must_use]
305        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
306            self.inner = self.inner.send_compressed(encoding);
307            self
308        }
309        /// Enable decompressing responses.
310        #[must_use]
311        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
312            self.inner = self.inner.accept_compressed(encoding);
313            self
314        }
315        /// Limits the maximum size of a decoded message.
316        ///
317        /// Default: `4MB`
318        #[must_use]
319        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
320            self.inner = self.inner.max_decoding_message_size(limit);
321            self
322        }
323        /// Limits the maximum size of an encoded message.
324        ///
325        /// Default: `usize::MAX`
326        #[must_use]
327        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
328            self.inner = self.inner.max_encoding_message_size(limit);
329            self
330        }
331        /// The protocol used to participate in the ceremony.
332        ///
333        /// The message flow is
334        ///
335        /// ```text,
336        /// Client                     Server
337        /// Identify     ===========>
338        ///              <=========== Position (repeated)
339        ///              <=========== ContributeNow
340        /// Contribution ===========>
341        ///              <=========== Confirm
342        /// ```
343        pub async fn participate(
344            &mut self,
345            request: impl tonic::IntoStreamingRequest<
346                Message = super::ParticipateRequest,
347            >,
348        ) -> std::result::Result<
349            tonic::Response<tonic::codec::Streaming<super::ParticipateResponse>>,
350            tonic::Status,
351        > {
352            self.inner
353                .ready()
354                .await
355                .map_err(|e| {
356                    tonic::Status::unknown(
357                        format!("Service was not ready: {}", e.into()),
358                    )
359                })?;
360            let codec = tonic::codec::ProstCodec::default();
361            let path = http::uri::PathAndQuery::from_static(
362                "/penumbra.tools.summoning.v1.CeremonyCoordinatorService/Participate",
363            );
364            let mut req = request.into_streaming_request();
365            req.extensions_mut()
366                .insert(
367                    GrpcMethod::new(
368                        "penumbra.tools.summoning.v1.CeremonyCoordinatorService",
369                        "Participate",
370                    ),
371                );
372            self.inner.streaming(req, path, codec).await
373        }
374    }
375}
376/// Generated server implementations.
377#[cfg(feature = "rpc")]
378pub mod ceremony_coordinator_service_server {
379    #![allow(
380        unused_variables,
381        dead_code,
382        missing_docs,
383        clippy::wildcard_imports,
384        clippy::let_unit_value,
385    )]
386    use tonic::codegen::*;
387    /// Generated trait containing gRPC methods that should be implemented for use with CeremonyCoordinatorServiceServer.
388    #[async_trait]
389    pub trait CeremonyCoordinatorService: std::marker::Send + std::marker::Sync + 'static {
390        /// Server streaming response type for the Participate method.
391        type ParticipateStream: tonic::codegen::tokio_stream::Stream<
392                Item = std::result::Result<super::ParticipateResponse, tonic::Status>,
393            >
394            + std::marker::Send
395            + 'static;
396        /// The protocol used to participate in the ceremony.
397        ///
398        /// The message flow is
399        ///
400        /// ```text,
401        /// Client                     Server
402        /// Identify     ===========>
403        ///              <=========== Position (repeated)
404        ///              <=========== ContributeNow
405        /// Contribution ===========>
406        ///              <=========== Confirm
407        /// ```
408        async fn participate(
409            &self,
410            request: tonic::Request<tonic::Streaming<super::ParticipateRequest>>,
411        ) -> std::result::Result<
412            tonic::Response<Self::ParticipateStream>,
413            tonic::Status,
414        >;
415    }
416    /// Runs a Phase 2 MPC ceremony with dynamic slot allocation.
417    #[derive(Debug)]
418    pub struct CeremonyCoordinatorServiceServer<T> {
419        inner: Arc<T>,
420        accept_compression_encodings: EnabledCompressionEncodings,
421        send_compression_encodings: EnabledCompressionEncodings,
422        max_decoding_message_size: Option<usize>,
423        max_encoding_message_size: Option<usize>,
424    }
425    impl<T> CeremonyCoordinatorServiceServer<T> {
426        pub fn new(inner: T) -> Self {
427            Self::from_arc(Arc::new(inner))
428        }
429        pub fn from_arc(inner: Arc<T>) -> Self {
430            Self {
431                inner,
432                accept_compression_encodings: Default::default(),
433                send_compression_encodings: Default::default(),
434                max_decoding_message_size: None,
435                max_encoding_message_size: None,
436            }
437        }
438        pub fn with_interceptor<F>(
439            inner: T,
440            interceptor: F,
441        ) -> InterceptedService<Self, F>
442        where
443            F: tonic::service::Interceptor,
444        {
445            InterceptedService::new(Self::new(inner), interceptor)
446        }
447        /// Enable decompressing requests with the given encoding.
448        #[must_use]
449        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
450            self.accept_compression_encodings.enable(encoding);
451            self
452        }
453        /// Compress responses with the given encoding, if the client supports it.
454        #[must_use]
455        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
456            self.send_compression_encodings.enable(encoding);
457            self
458        }
459        /// Limits the maximum size of a decoded message.
460        ///
461        /// Default: `4MB`
462        #[must_use]
463        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
464            self.max_decoding_message_size = Some(limit);
465            self
466        }
467        /// Limits the maximum size of an encoded message.
468        ///
469        /// Default: `usize::MAX`
470        #[must_use]
471        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
472            self.max_encoding_message_size = Some(limit);
473            self
474        }
475    }
476    impl<T, B> tonic::codegen::Service<http::Request<B>>
477    for CeremonyCoordinatorServiceServer<T>
478    where
479        T: CeremonyCoordinatorService,
480        B: Body + std::marker::Send + 'static,
481        B::Error: Into<StdError> + std::marker::Send + 'static,
482    {
483        type Response = http::Response<tonic::body::BoxBody>;
484        type Error = std::convert::Infallible;
485        type Future = BoxFuture<Self::Response, Self::Error>;
486        fn poll_ready(
487            &mut self,
488            _cx: &mut Context<'_>,
489        ) -> Poll<std::result::Result<(), Self::Error>> {
490            Poll::Ready(Ok(()))
491        }
492        fn call(&mut self, req: http::Request<B>) -> Self::Future {
493            match req.uri().path() {
494                "/penumbra.tools.summoning.v1.CeremonyCoordinatorService/Participate" => {
495                    #[allow(non_camel_case_types)]
496                    struct ParticipateSvc<T: CeremonyCoordinatorService>(pub Arc<T>);
497                    impl<
498                        T: CeremonyCoordinatorService,
499                    > tonic::server::StreamingService<super::ParticipateRequest>
500                    for ParticipateSvc<T> {
501                        type Response = super::ParticipateResponse;
502                        type ResponseStream = T::ParticipateStream;
503                        type Future = BoxFuture<
504                            tonic::Response<Self::ResponseStream>,
505                            tonic::Status,
506                        >;
507                        fn call(
508                            &mut self,
509                            request: tonic::Request<
510                                tonic::Streaming<super::ParticipateRequest>,
511                            >,
512                        ) -> Self::Future {
513                            let inner = Arc::clone(&self.0);
514                            let fut = async move {
515                                <T as CeremonyCoordinatorService>::participate(
516                                        &inner,
517                                        request,
518                                    )
519                                    .await
520                            };
521                            Box::pin(fut)
522                        }
523                    }
524                    let accept_compression_encodings = self.accept_compression_encodings;
525                    let send_compression_encodings = self.send_compression_encodings;
526                    let max_decoding_message_size = self.max_decoding_message_size;
527                    let max_encoding_message_size = self.max_encoding_message_size;
528                    let inner = self.inner.clone();
529                    let fut = async move {
530                        let method = ParticipateSvc(inner);
531                        let codec = tonic::codec::ProstCodec::default();
532                        let mut grpc = tonic::server::Grpc::new(codec)
533                            .apply_compression_config(
534                                accept_compression_encodings,
535                                send_compression_encodings,
536                            )
537                            .apply_max_message_size_config(
538                                max_decoding_message_size,
539                                max_encoding_message_size,
540                            );
541                        let res = grpc.streaming(method, req).await;
542                        Ok(res)
543                    };
544                    Box::pin(fut)
545                }
546                _ => {
547                    Box::pin(async move {
548                        let mut response = http::Response::new(empty_body());
549                        let headers = response.headers_mut();
550                        headers
551                            .insert(
552                                tonic::Status::GRPC_STATUS,
553                                (tonic::Code::Unimplemented as i32).into(),
554                            );
555                        headers
556                            .insert(
557                                http::header::CONTENT_TYPE,
558                                tonic::metadata::GRPC_CONTENT_TYPE,
559                            );
560                        Ok(response)
561                    })
562                }
563            }
564        }
565    }
566    impl<T> Clone for CeremonyCoordinatorServiceServer<T> {
567        fn clone(&self) -> Self {
568            let inner = self.inner.clone();
569            Self {
570                inner,
571                accept_compression_encodings: self.accept_compression_encodings,
572                send_compression_encodings: self.send_compression_encodings,
573                max_decoding_message_size: self.max_decoding_message_size,
574                max_encoding_message_size: self.max_encoding_message_size,
575            }
576        }
577    }
578    /// Generated gRPC service name
579    pub const SERVICE_NAME: &str = "penumbra.tools.summoning.v1.CeremonyCoordinatorService";
580    impl<T> tonic::server::NamedService for CeremonyCoordinatorServiceServer<T> {
581        const NAME: &'static str = SERVICE_NAME;
582    }
583}