eq_common/generated/
eqs.rs

1// This file is @generated by prost-build.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct GetKeccakInclusionRequest {
5    /// Data Availability (DA) block height
6    #[prost(uint64, tag = "1")]
7    pub height: u64,
8    /// 32 byte DA namespace
9    #[prost(bytes = "vec", tag = "2")]
10    pub namespace: ::prost::alloc::vec::Vec<u8>,
11    /// 32 byte DA blob commitment
12    #[prost(bytes = "vec", tag = "3")]
13    pub commitment: ::prost::alloc::vec::Vec<u8>,
14}
15#[allow(clippy::derive_partial_eq_without_eq)]
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct ProofWithPublicValues {
18    /// The actual proof data
19    #[prost(bytes = "vec", tag = "1")]
20    pub proof_data: ::prost::alloc::vec::Vec<u8>,
21    /// The public values used to generate the proof
22    #[prost(bytes = "vec", tag = "2")]
23    pub public_values: ::prost::alloc::vec::Vec<u8>,
24}
25#[allow(clippy::derive_partial_eq_without_eq)]
26#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct GetKeccakInclusionResponse {
28    #[prost(enumeration = "get_keccak_inclusion_response::Status", tag = "1")]
29    pub status: i32,
30    #[prost(oneof = "get_keccak_inclusion_response::ResponseValue", tags = "2, 3, 4, 5")]
31    pub response_value: ::core::option::Option<
32        get_keccak_inclusion_response::ResponseValue,
33    >,
34}
35/// Nested message and enum types in `GetKeccakInclusionResponse`.
36pub mod get_keccak_inclusion_response {
37    #[derive(
38        Clone,
39        Copy,
40        Debug,
41        PartialEq,
42        Eq,
43        Hash,
44        PartialOrd,
45        Ord,
46        ::prost::Enumeration
47    )]
48    #[repr(i32)]
49    pub enum Status {
50        /// Data Availability (DA) inclusion proof being collected
51        DaPending = 0,
52        /// DA inclusion proof collected
53        DaAvailable = 1,
54        /// Zero Knowledge Proof (ZKP) of DA inclusion requested, generating
55        ZkpPending = 2,
56        /// ZKP of DA inclusion proof finished
57        ZkpFinished = 3,
58        /// If this is returned, the service then attempts to retry
59        RetryableFailure = 4,
60        /// No way to complete request
61        PermanentFailure = 5,
62    }
63    impl Status {
64        /// String value of the enum field names used in the ProtoBuf definition.
65        ///
66        /// The values are not transformed in any way and thus are considered stable
67        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
68        pub fn as_str_name(&self) -> &'static str {
69            match self {
70                Status::DaPending => "DA_PENDING",
71                Status::DaAvailable => "DA_AVAILABLE",
72                Status::ZkpPending => "ZKP_PENDING",
73                Status::ZkpFinished => "ZKP_FINISHED",
74                Status::RetryableFailure => "RETRYABLE_FAILURE",
75                Status::PermanentFailure => "PERMANENT_FAILURE",
76            }
77        }
78        /// Creates an enum from field names used in the ProtoBuf definition.
79        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
80            match value {
81                "DA_PENDING" => Some(Self::DaPending),
82                "DA_AVAILABLE" => Some(Self::DaAvailable),
83                "ZKP_PENDING" => Some(Self::ZkpPending),
84                "ZKP_FINISHED" => Some(Self::ZkpFinished),
85                "RETRYABLE_FAILURE" => Some(Self::RetryableFailure),
86                "PERMANENT_FAILURE" => Some(Self::PermanentFailure),
87                _ => None,
88            }
89        }
90    }
91    #[allow(clippy::derive_partial_eq_without_eq)]
92    #[derive(Clone, PartialEq, ::prost::Oneof)]
93    pub enum ResponseValue {
94        /// When ZKP_PENDING, this is the proof request/job id on the prover network
95        #[prost(bytes, tag = "2")]
96        ProofId(::prost::alloc::vec::Vec<u8>),
97        /// When ZKP_FINISHED, this contains both proof data and public values
98        #[prost(message, tag = "3")]
99        Proof(super::ProofWithPublicValues),
100        /// Used when status is RETRYABLE_FAILURE or PERMANENT_FAILURE, this includes details why
101        #[prost(string, tag = "4")]
102        ErrorMessage(::prost::alloc::string::String),
103        /// Additional details on status of a request
104        #[prost(string, tag = "5")]
105        StatusMessage(::prost::alloc::string::String),
106    }
107}
108/// Generated client implementations.
109pub mod inclusion_client {
110    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
111    use tonic::codegen::*;
112    use tonic::codegen::http::Uri;
113    #[derive(Debug, Clone)]
114    pub struct InclusionClient<T> {
115        inner: tonic::client::Grpc<T>,
116    }
117    impl<T> InclusionClient<T>
118    where
119        T: tonic::client::GrpcService<tonic::body::BoxBody>,
120        T::Error: Into<StdError>,
121        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
122        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
123    {
124        pub fn new(inner: T) -> Self {
125            let inner = tonic::client::Grpc::new(inner);
126            Self { inner }
127        }
128        pub fn with_origin(inner: T, origin: Uri) -> Self {
129            let inner = tonic::client::Grpc::with_origin(inner, origin);
130            Self { inner }
131        }
132        pub fn with_interceptor<F>(
133            inner: T,
134            interceptor: F,
135        ) -> InclusionClient<InterceptedService<T, F>>
136        where
137            F: tonic::service::Interceptor,
138            T::ResponseBody: Default,
139            T: tonic::codegen::Service<
140                http::Request<tonic::body::BoxBody>,
141                Response = http::Response<
142                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
143                >,
144            >,
145            <T as tonic::codegen::Service<
146                http::Request<tonic::body::BoxBody>,
147            >>::Error: Into<StdError> + Send + Sync,
148        {
149            InclusionClient::new(InterceptedService::new(inner, interceptor))
150        }
151        /// Compress requests with the given encoding.
152        ///
153        /// This requires the server to support it otherwise it might respond with an
154        /// error.
155        #[must_use]
156        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
157            self.inner = self.inner.send_compressed(encoding);
158            self
159        }
160        /// Enable decompressing responses.
161        #[must_use]
162        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
163            self.inner = self.inner.accept_compressed(encoding);
164            self
165        }
166        /// Limits the maximum size of a decoded message.
167        ///
168        /// Default: `4MB`
169        #[must_use]
170        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
171            self.inner = self.inner.max_decoding_message_size(limit);
172            self
173        }
174        /// Limits the maximum size of an encoded message.
175        ///
176        /// Default: `usize::MAX`
177        #[must_use]
178        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
179            self.inner = self.inner.max_encoding_message_size(limit);
180            self
181        }
182        pub async fn get_keccak_inclusion(
183            &mut self,
184            request: impl tonic::IntoRequest<super::GetKeccakInclusionRequest>,
185        ) -> std::result::Result<
186            tonic::Response<super::GetKeccakInclusionResponse>,
187            tonic::Status,
188        > {
189            self.inner
190                .ready()
191                .await
192                .map_err(|e| {
193                    tonic::Status::new(
194                        tonic::Code::Unknown,
195                        format!("Service was not ready: {}", e.into()),
196                    )
197                })?;
198            let codec = tonic::codec::ProstCodec::default();
199            let path = http::uri::PathAndQuery::from_static(
200                "/eqs.Inclusion/GetKeccakInclusion",
201            );
202            let mut req = request.into_request();
203            req.extensions_mut()
204                .insert(GrpcMethod::new("eqs.Inclusion", "GetKeccakInclusion"));
205            self.inner.unary(req, path, codec).await
206        }
207    }
208}
209/// Generated server implementations.
210pub mod inclusion_server {
211    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
212    use tonic::codegen::*;
213    /// Generated trait containing gRPC methods that should be implemented for use with InclusionServer.
214    #[async_trait]
215    pub trait Inclusion: Send + Sync + 'static {
216        async fn get_keccak_inclusion(
217            &self,
218            request: tonic::Request<super::GetKeccakInclusionRequest>,
219        ) -> std::result::Result<
220            tonic::Response<super::GetKeccakInclusionResponse>,
221            tonic::Status,
222        >;
223    }
224    #[derive(Debug)]
225    pub struct InclusionServer<T: Inclusion> {
226        inner: _Inner<T>,
227        accept_compression_encodings: EnabledCompressionEncodings,
228        send_compression_encodings: EnabledCompressionEncodings,
229        max_decoding_message_size: Option<usize>,
230        max_encoding_message_size: Option<usize>,
231    }
232    struct _Inner<T>(Arc<T>);
233    impl<T: Inclusion> InclusionServer<T> {
234        pub fn new(inner: T) -> Self {
235            Self::from_arc(Arc::new(inner))
236        }
237        pub fn from_arc(inner: Arc<T>) -> Self {
238            let inner = _Inner(inner);
239            Self {
240                inner,
241                accept_compression_encodings: Default::default(),
242                send_compression_encodings: Default::default(),
243                max_decoding_message_size: None,
244                max_encoding_message_size: None,
245            }
246        }
247        pub fn with_interceptor<F>(
248            inner: T,
249            interceptor: F,
250        ) -> InterceptedService<Self, F>
251        where
252            F: tonic::service::Interceptor,
253        {
254            InterceptedService::new(Self::new(inner), interceptor)
255        }
256        /// Enable decompressing requests with the given encoding.
257        #[must_use]
258        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
259            self.accept_compression_encodings.enable(encoding);
260            self
261        }
262        /// Compress responses with the given encoding, if the client supports it.
263        #[must_use]
264        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
265            self.send_compression_encodings.enable(encoding);
266            self
267        }
268        /// Limits the maximum size of a decoded message.
269        ///
270        /// Default: `4MB`
271        #[must_use]
272        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
273            self.max_decoding_message_size = Some(limit);
274            self
275        }
276        /// Limits the maximum size of an encoded message.
277        ///
278        /// Default: `usize::MAX`
279        #[must_use]
280        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
281            self.max_encoding_message_size = Some(limit);
282            self
283        }
284    }
285    impl<T, B> tonic::codegen::Service<http::Request<B>> for InclusionServer<T>
286    where
287        T: Inclusion,
288        B: Body + Send + 'static,
289        B::Error: Into<StdError> + Send + 'static,
290    {
291        type Response = http::Response<tonic::body::BoxBody>;
292        type Error = std::convert::Infallible;
293        type Future = BoxFuture<Self::Response, Self::Error>;
294        fn poll_ready(
295            &mut self,
296            _cx: &mut Context<'_>,
297        ) -> Poll<std::result::Result<(), Self::Error>> {
298            Poll::Ready(Ok(()))
299        }
300        fn call(&mut self, req: http::Request<B>) -> Self::Future {
301            let inner = self.inner.clone();
302            match req.uri().path() {
303                "/eqs.Inclusion/GetKeccakInclusion" => {
304                    #[allow(non_camel_case_types)]
305                    struct GetKeccakInclusionSvc<T: Inclusion>(pub Arc<T>);
306                    impl<
307                        T: Inclusion,
308                    > tonic::server::UnaryService<super::GetKeccakInclusionRequest>
309                    for GetKeccakInclusionSvc<T> {
310                        type Response = super::GetKeccakInclusionResponse;
311                        type Future = BoxFuture<
312                            tonic::Response<Self::Response>,
313                            tonic::Status,
314                        >;
315                        fn call(
316                            &mut self,
317                            request: tonic::Request<super::GetKeccakInclusionRequest>,
318                        ) -> Self::Future {
319                            let inner = Arc::clone(&self.0);
320                            let fut = async move {
321                                <T as Inclusion>::get_keccak_inclusion(&inner, request)
322                                    .await
323                            };
324                            Box::pin(fut)
325                        }
326                    }
327                    let accept_compression_encodings = self.accept_compression_encodings;
328                    let send_compression_encodings = self.send_compression_encodings;
329                    let max_decoding_message_size = self.max_decoding_message_size;
330                    let max_encoding_message_size = self.max_encoding_message_size;
331                    let inner = self.inner.clone();
332                    let fut = async move {
333                        let inner = inner.0;
334                        let method = GetKeccakInclusionSvc(inner);
335                        let codec = tonic::codec::ProstCodec::default();
336                        let mut grpc = tonic::server::Grpc::new(codec)
337                            .apply_compression_config(
338                                accept_compression_encodings,
339                                send_compression_encodings,
340                            )
341                            .apply_max_message_size_config(
342                                max_decoding_message_size,
343                                max_encoding_message_size,
344                            );
345                        let res = grpc.unary(method, req).await;
346                        Ok(res)
347                    };
348                    Box::pin(fut)
349                }
350                _ => {
351                    Box::pin(async move {
352                        Ok(
353                            http::Response::builder()
354                                .status(200)
355                                .header("grpc-status", "12")
356                                .header("content-type", "application/grpc")
357                                .body(empty_body())
358                                .unwrap(),
359                        )
360                    })
361                }
362            }
363        }
364    }
365    impl<T: Inclusion> Clone for InclusionServer<T> {
366        fn clone(&self) -> Self {
367            let inner = self.inner.clone();
368            Self {
369                inner,
370                accept_compression_encodings: self.accept_compression_encodings,
371                send_compression_encodings: self.send_compression_encodings,
372                max_decoding_message_size: self.max_decoding_message_size,
373                max_encoding_message_size: self.max_encoding_message_size,
374            }
375        }
376    }
377    impl<T: Inclusion> Clone for _Inner<T> {
378        fn clone(&self) -> Self {
379            Self(Arc::clone(&self.0))
380        }
381    }
382    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
383        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
384            write!(f, "{:?}", self.0)
385        }
386    }
387    impl<T: Inclusion> tonic::server::NamedService for InclusionServer<T> {
388        const NAME: &'static str = "eqs.Inclusion";
389    }
390}