1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct GetKeccakInclusionRequest {
5 #[prost(uint64, tag = "1")]
7 pub height: u64,
8 #[prost(bytes = "vec", tag = "2")]
10 pub namespace: ::prost::alloc::vec::Vec<u8>,
11 #[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 GetKeccakInclusionResponse {
18 #[prost(enumeration = "get_keccak_inclusion_response::Status", tag = "1")]
19 pub status: i32,
20 #[prost(oneof = "get_keccak_inclusion_response::ResponseValue", tags = "2, 3, 4, 5")]
21 pub response_value: ::core::option::Option<
22 get_keccak_inclusion_response::ResponseValue,
23 >,
24}
25pub mod get_keccak_inclusion_response {
27 #[derive(
28 Clone,
29 Copy,
30 Debug,
31 PartialEq,
32 Eq,
33 Hash,
34 PartialOrd,
35 Ord,
36 ::prost::Enumeration
37 )]
38 #[repr(i32)]
39 pub enum Status {
40 DaPending = 0,
42 DaAvailable = 1,
44 ZkpPending = 2,
46 ZkpFinished = 3,
48 RetryableFailure = 4,
50 PermanentFailure = 5,
52 }
53 impl Status {
54 pub fn as_str_name(&self) -> &'static str {
59 match self {
60 Status::DaPending => "DA_PENDING",
61 Status::DaAvailable => "DA_AVAILABLE",
62 Status::ZkpPending => "ZKP_PENDING",
63 Status::ZkpFinished => "ZKP_FINISHED",
64 Status::RetryableFailure => "RETRYABLE_FAILURE",
65 Status::PermanentFailure => "PERMANENT_FAILURE",
66 }
67 }
68 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
70 match value {
71 "DA_PENDING" => Some(Self::DaPending),
72 "DA_AVAILABLE" => Some(Self::DaAvailable),
73 "ZKP_PENDING" => Some(Self::ZkpPending),
74 "ZKP_FINISHED" => Some(Self::ZkpFinished),
75 "RETRYABLE_FAILURE" => Some(Self::RetryableFailure),
76 "PERMANENT_FAILURE" => Some(Self::PermanentFailure),
77 _ => None,
78 }
79 }
80 }
81 #[allow(clippy::derive_partial_eq_without_eq)]
82 #[derive(Clone, PartialEq, ::prost::Oneof)]
83 pub enum ResponseValue {
84 #[prost(bytes, tag = "2")]
86 ProofId(::prost::alloc::vec::Vec<u8>),
87 #[prost(bytes, tag = "3")]
89 Proof(::prost::alloc::vec::Vec<u8>),
90 #[prost(string, tag = "4")]
92 ErrorMessage(::prost::alloc::string::String),
93 #[prost(string, tag = "5")]
95 StatusMessage(::prost::alloc::string::String),
96 }
97}
98pub mod inclusion_client {
100 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
101 use tonic::codegen::*;
102 use tonic::codegen::http::Uri;
103 #[derive(Debug, Clone)]
104 pub struct InclusionClient<T> {
105 inner: tonic::client::Grpc<T>,
106 }
107 impl<T> InclusionClient<T>
108 where
109 T: tonic::client::GrpcService<tonic::body::BoxBody>,
110 T::Error: Into<StdError>,
111 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
112 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
113 {
114 pub fn new(inner: T) -> Self {
115 let inner = tonic::client::Grpc::new(inner);
116 Self { inner }
117 }
118 pub fn with_origin(inner: T, origin: Uri) -> Self {
119 let inner = tonic::client::Grpc::with_origin(inner, origin);
120 Self { inner }
121 }
122 pub fn with_interceptor<F>(
123 inner: T,
124 interceptor: F,
125 ) -> InclusionClient<InterceptedService<T, F>>
126 where
127 F: tonic::service::Interceptor,
128 T::ResponseBody: Default,
129 T: tonic::codegen::Service<
130 http::Request<tonic::body::BoxBody>,
131 Response = http::Response<
132 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
133 >,
134 >,
135 <T as tonic::codegen::Service<
136 http::Request<tonic::body::BoxBody>,
137 >>::Error: Into<StdError> + Send + Sync,
138 {
139 InclusionClient::new(InterceptedService::new(inner, interceptor))
140 }
141 #[must_use]
146 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
147 self.inner = self.inner.send_compressed(encoding);
148 self
149 }
150 #[must_use]
152 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
153 self.inner = self.inner.accept_compressed(encoding);
154 self
155 }
156 #[must_use]
160 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
161 self.inner = self.inner.max_decoding_message_size(limit);
162 self
163 }
164 #[must_use]
168 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
169 self.inner = self.inner.max_encoding_message_size(limit);
170 self
171 }
172 pub async fn get_keccak_inclusion(
173 &mut self,
174 request: impl tonic::IntoRequest<super::GetKeccakInclusionRequest>,
175 ) -> std::result::Result<
176 tonic::Response<super::GetKeccakInclusionResponse>,
177 tonic::Status,
178 > {
179 self.inner
180 .ready()
181 .await
182 .map_err(|e| {
183 tonic::Status::new(
184 tonic::Code::Unknown,
185 format!("Service was not ready: {}", e.into()),
186 )
187 })?;
188 let codec = tonic::codec::ProstCodec::default();
189 let path = http::uri::PathAndQuery::from_static(
190 "/eqs.Inclusion/GetKeccakInclusion",
191 );
192 let mut req = request.into_request();
193 req.extensions_mut()
194 .insert(GrpcMethod::new("eqs.Inclusion", "GetKeccakInclusion"));
195 self.inner.unary(req, path, codec).await
196 }
197 }
198}
199pub mod inclusion_server {
201 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
202 use tonic::codegen::*;
203 #[async_trait]
205 pub trait Inclusion: Send + Sync + 'static {
206 async fn get_keccak_inclusion(
207 &self,
208 request: tonic::Request<super::GetKeccakInclusionRequest>,
209 ) -> std::result::Result<
210 tonic::Response<super::GetKeccakInclusionResponse>,
211 tonic::Status,
212 >;
213 }
214 #[derive(Debug)]
215 pub struct InclusionServer<T: Inclusion> {
216 inner: _Inner<T>,
217 accept_compression_encodings: EnabledCompressionEncodings,
218 send_compression_encodings: EnabledCompressionEncodings,
219 max_decoding_message_size: Option<usize>,
220 max_encoding_message_size: Option<usize>,
221 }
222 struct _Inner<T>(Arc<T>);
223 impl<T: Inclusion> InclusionServer<T> {
224 pub fn new(inner: T) -> Self {
225 Self::from_arc(Arc::new(inner))
226 }
227 pub fn from_arc(inner: Arc<T>) -> Self {
228 let inner = _Inner(inner);
229 Self {
230 inner,
231 accept_compression_encodings: Default::default(),
232 send_compression_encodings: Default::default(),
233 max_decoding_message_size: None,
234 max_encoding_message_size: None,
235 }
236 }
237 pub fn with_interceptor<F>(
238 inner: T,
239 interceptor: F,
240 ) -> InterceptedService<Self, F>
241 where
242 F: tonic::service::Interceptor,
243 {
244 InterceptedService::new(Self::new(inner), interceptor)
245 }
246 #[must_use]
248 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
249 self.accept_compression_encodings.enable(encoding);
250 self
251 }
252 #[must_use]
254 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
255 self.send_compression_encodings.enable(encoding);
256 self
257 }
258 #[must_use]
262 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
263 self.max_decoding_message_size = Some(limit);
264 self
265 }
266 #[must_use]
270 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
271 self.max_encoding_message_size = Some(limit);
272 self
273 }
274 }
275 impl<T, B> tonic::codegen::Service<http::Request<B>> for InclusionServer<T>
276 where
277 T: Inclusion,
278 B: Body + Send + 'static,
279 B::Error: Into<StdError> + Send + 'static,
280 {
281 type Response = http::Response<tonic::body::BoxBody>;
282 type Error = std::convert::Infallible;
283 type Future = BoxFuture<Self::Response, Self::Error>;
284 fn poll_ready(
285 &mut self,
286 _cx: &mut Context<'_>,
287 ) -> Poll<std::result::Result<(), Self::Error>> {
288 Poll::Ready(Ok(()))
289 }
290 fn call(&mut self, req: http::Request<B>) -> Self::Future {
291 let inner = self.inner.clone();
292 match req.uri().path() {
293 "/eqs.Inclusion/GetKeccakInclusion" => {
294 #[allow(non_camel_case_types)]
295 struct GetKeccakInclusionSvc<T: Inclusion>(pub Arc<T>);
296 impl<
297 T: Inclusion,
298 > tonic::server::UnaryService<super::GetKeccakInclusionRequest>
299 for GetKeccakInclusionSvc<T> {
300 type Response = super::GetKeccakInclusionResponse;
301 type Future = BoxFuture<
302 tonic::Response<Self::Response>,
303 tonic::Status,
304 >;
305 fn call(
306 &mut self,
307 request: tonic::Request<super::GetKeccakInclusionRequest>,
308 ) -> Self::Future {
309 let inner = Arc::clone(&self.0);
310 let fut = async move {
311 <T as Inclusion>::get_keccak_inclusion(&inner, request)
312 .await
313 };
314 Box::pin(fut)
315 }
316 }
317 let accept_compression_encodings = self.accept_compression_encodings;
318 let send_compression_encodings = self.send_compression_encodings;
319 let max_decoding_message_size = self.max_decoding_message_size;
320 let max_encoding_message_size = self.max_encoding_message_size;
321 let inner = self.inner.clone();
322 let fut = async move {
323 let inner = inner.0;
324 let method = GetKeccakInclusionSvc(inner);
325 let codec = tonic::codec::ProstCodec::default();
326 let mut grpc = tonic::server::Grpc::new(codec)
327 .apply_compression_config(
328 accept_compression_encodings,
329 send_compression_encodings,
330 )
331 .apply_max_message_size_config(
332 max_decoding_message_size,
333 max_encoding_message_size,
334 );
335 let res = grpc.unary(method, req).await;
336 Ok(res)
337 };
338 Box::pin(fut)
339 }
340 _ => {
341 Box::pin(async move {
342 Ok(
343 http::Response::builder()
344 .status(200)
345 .header("grpc-status", "12")
346 .header("content-type", "application/grpc")
347 .body(empty_body())
348 .unwrap(),
349 )
350 })
351 }
352 }
353 }
354 }
355 impl<T: Inclusion> Clone for InclusionServer<T> {
356 fn clone(&self) -> Self {
357 let inner = self.inner.clone();
358 Self {
359 inner,
360 accept_compression_encodings: self.accept_compression_encodings,
361 send_compression_encodings: self.send_compression_encodings,
362 max_decoding_message_size: self.max_decoding_message_size,
363 max_encoding_message_size: self.max_encoding_message_size,
364 }
365 }
366 }
367 impl<T: Inclusion> Clone for _Inner<T> {
368 fn clone(&self) -> Self {
369 Self(Arc::clone(&self.0))
370 }
371 }
372 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
373 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
374 write!(f, "{:?}", self.0)
375 }
376 }
377 impl<T: Inclusion> tonic::server::NamedService for InclusionServer<T> {
378 const NAME: &'static str = "eqs.Inclusion";
379 }
380}