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