1#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct SctParameters {
5 #[prost(uint64, tag = "1")]
7 pub epoch_duration: u64,
8}
9impl ::prost::Name for SctParameters {
10 const NAME: &'static str = "SctParameters";
11 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
12 fn full_name() -> ::prost::alloc::string::String {
13 "penumbra.core.component.sct.v1.SctParameters".into()
14 }
15 fn type_url() -> ::prost::alloc::string::String {
16 "/penumbra.core.component.sct.v1.SctParameters".into()
17 }
18}
19#[derive(Clone, Copy, PartialEq, ::prost::Message)]
21pub struct GenesisContent {
22 #[prost(message, optional, tag = "1")]
24 pub sct_params: ::core::option::Option<SctParameters>,
25}
26impl ::prost::Name for GenesisContent {
27 const NAME: &'static str = "GenesisContent";
28 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
29 fn full_name() -> ::prost::alloc::string::String {
30 "penumbra.core.component.sct.v1.GenesisContent".into()
31 }
32 fn type_url() -> ::prost::alloc::string::String {
33 "/penumbra.core.component.sct.v1.GenesisContent".into()
34 }
35}
36#[derive(Clone, Copy, PartialEq, ::prost::Message)]
38pub struct Epoch {
39 #[prost(uint64, tag = "1")]
41 pub index: u64,
42 #[prost(uint64, tag = "2")]
44 pub start_height: u64,
45}
46impl ::prost::Name for Epoch {
47 const NAME: &'static str = "Epoch";
48 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
49 fn full_name() -> ::prost::alloc::string::String {
50 "penumbra.core.component.sct.v1.Epoch".into()
51 }
52 fn type_url() -> ::prost::alloc::string::String {
53 "/penumbra.core.component.sct.v1.Epoch".into()
54 }
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct CommitmentSource {
62 #[prost(oneof = "commitment_source::Source", tags = "1, 2, 20, 30, 40")]
63 pub source: ::core::option::Option<commitment_source::Source>,
64}
65pub mod commitment_source {
67 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
69 pub struct Genesis {}
70 impl ::prost::Name for Genesis {
71 const NAME: &'static str = "Genesis";
72 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
73 fn full_name() -> ::prost::alloc::string::String {
74 "penumbra.core.component.sct.v1.CommitmentSource.Genesis".into()
75 }
76 fn type_url() -> ::prost::alloc::string::String {
77 "/penumbra.core.component.sct.v1.CommitmentSource.Genesis".into()
78 }
79 }
80 #[derive(Clone, PartialEq, ::prost::Message)]
86 pub struct Transaction {
87 #[prost(bytes = "vec", tag = "1")]
92 pub id: ::prost::alloc::vec::Vec<u8>,
93 }
94 impl ::prost::Name for Transaction {
95 const NAME: &'static str = "Transaction";
96 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
97 fn full_name() -> ::prost::alloc::string::String {
98 "penumbra.core.component.sct.v1.CommitmentSource.Transaction".into()
99 }
100 fn type_url() -> ::prost::alloc::string::String {
101 "/penumbra.core.component.sct.v1.CommitmentSource.Transaction".into()
102 }
103 }
104 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
106 pub struct FundingStreamReward {
107 #[prost(uint64, tag = "1")]
109 pub epoch_index: u64,
110 }
111 impl ::prost::Name for FundingStreamReward {
112 const NAME: &'static str = "FundingStreamReward";
113 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
114 fn full_name() -> ::prost::alloc::string::String {
115 "penumbra.core.component.sct.v1.CommitmentSource.FundingStreamReward".into()
116 }
117 fn type_url() -> ::prost::alloc::string::String {
118 "/penumbra.core.component.sct.v1.CommitmentSource.FundingStreamReward".into()
119 }
120 }
121 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
123 pub struct CommunityPoolOutput {}
124 impl ::prost::Name for CommunityPoolOutput {
125 const NAME: &'static str = "CommunityPoolOutput";
126 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
127 fn full_name() -> ::prost::alloc::string::String {
128 "penumbra.core.component.sct.v1.CommitmentSource.CommunityPoolOutput".into()
129 }
130 fn type_url() -> ::prost::alloc::string::String {
131 "/penumbra.core.component.sct.v1.CommitmentSource.CommunityPoolOutput".into()
132 }
133 }
134 #[derive(Clone, PartialEq, ::prost::Message)]
136 pub struct Ics20Transfer {
137 #[prost(uint64, tag = "1")]
139 pub packet_seq: u64,
140 #[prost(string, tag = "2")]
142 pub channel_id: ::prost::alloc::string::String,
143 #[prost(string, tag = "3")]
145 pub sender: ::prost::alloc::string::String,
146 }
147 impl ::prost::Name for Ics20Transfer {
148 const NAME: &'static str = "Ics20Transfer";
149 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
150 fn full_name() -> ::prost::alloc::string::String {
151 "penumbra.core.component.sct.v1.CommitmentSource.Ics20Transfer".into()
152 }
153 fn type_url() -> ::prost::alloc::string::String {
154 "/penumbra.core.component.sct.v1.CommitmentSource.Ics20Transfer".into()
155 }
156 }
157 #[derive(Clone, PartialEq, ::prost::Oneof)]
158 pub enum Source {
159 #[prost(message, tag = "1")]
160 Transaction(Transaction),
161 #[prost(message, tag = "2")]
162 Ics20Transfer(Ics20Transfer),
163 #[prost(message, tag = "20")]
164 FundingStreamReward(FundingStreamReward),
165 #[prost(message, tag = "30")]
166 CommunityPoolOutput(CommunityPoolOutput),
167 #[prost(message, tag = "40")]
168 Genesis(Genesis),
169 }
170}
171impl ::prost::Name for CommitmentSource {
172 const NAME: &'static str = "CommitmentSource";
173 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
174 fn full_name() -> ::prost::alloc::string::String {
175 "penumbra.core.component.sct.v1.CommitmentSource".into()
176 }
177 fn type_url() -> ::prost::alloc::string::String {
178 "/penumbra.core.component.sct.v1.CommitmentSource".into()
179 }
180}
181#[derive(Clone, PartialEq, ::prost::Message)]
182pub struct Nullifier {
183 #[prost(bytes = "vec", tag = "1")]
184 pub inner: ::prost::alloc::vec::Vec<u8>,
185}
186impl ::prost::Name for Nullifier {
187 const NAME: &'static str = "Nullifier";
188 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
189 fn full_name() -> ::prost::alloc::string::String {
190 "penumbra.core.component.sct.v1.Nullifier".into()
191 }
192 fn type_url() -> ::prost::alloc::string::String {
193 "/penumbra.core.component.sct.v1.Nullifier".into()
194 }
195}
196#[derive(Clone, PartialEq, ::prost::Message)]
198pub struct NullificationInfo {
199 #[prost(bytes = "vec", tag = "1")]
200 pub id: ::prost::alloc::vec::Vec<u8>,
201 #[prost(uint64, tag = "2")]
202 pub spend_height: u64,
203}
204impl ::prost::Name for NullificationInfo {
205 const NAME: &'static str = "NullificationInfo";
206 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
207 fn full_name() -> ::prost::alloc::string::String {
208 "penumbra.core.component.sct.v1.NullificationInfo".into()
209 }
210 fn type_url() -> ::prost::alloc::string::String {
211 "/penumbra.core.component.sct.v1.NullificationInfo".into()
212 }
213}
214#[derive(Clone, PartialEq, ::prost::Message)]
216pub struct EventCommitment {
217 #[prost(message, optional, tag = "1")]
218 pub commitment: ::core::option::Option<
219 super::super::super::super::crypto::tct::v1::StateCommitment,
220 >,
221 #[prost(uint64, tag = "2")]
222 pub position: u64,
223 #[prost(message, optional, tag = "3")]
224 pub source: ::core::option::Option<CommitmentSource>,
225}
226impl ::prost::Name for EventCommitment {
227 const NAME: &'static str = "EventCommitment";
228 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
229 fn full_name() -> ::prost::alloc::string::String {
230 "penumbra.core.component.sct.v1.EventCommitment".into()
231 }
232 fn type_url() -> ::prost::alloc::string::String {
233 "/penumbra.core.component.sct.v1.EventCommitment".into()
234 }
235}
236#[derive(Clone, PartialEq, ::prost::Message)]
238pub struct EventAnchor {
239 #[prost(message, optional, tag = "1")]
240 pub anchor: ::core::option::Option<
241 super::super::super::super::crypto::tct::v1::MerkleRoot,
242 >,
243 #[prost(uint64, tag = "2")]
244 pub height: u64,
245 #[prost(message, optional, tag = "3")]
246 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
247}
248impl ::prost::Name for EventAnchor {
249 const NAME: &'static str = "EventAnchor";
250 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
251 fn full_name() -> ::prost::alloc::string::String {
252 "penumbra.core.component.sct.v1.EventAnchor".into()
253 }
254 fn type_url() -> ::prost::alloc::string::String {
255 "/penumbra.core.component.sct.v1.EventAnchor".into()
256 }
257}
258#[derive(Clone, PartialEq, ::prost::Message)]
260pub struct EventEpochRoot {
261 #[prost(message, optional, tag = "1")]
262 pub root: ::core::option::Option<
263 super::super::super::super::crypto::tct::v1::MerkleRoot,
264 >,
265 #[prost(uint64, tag = "2")]
266 pub index: u64,
267 #[prost(message, optional, tag = "3")]
268 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
269}
270impl ::prost::Name for EventEpochRoot {
271 const NAME: &'static str = "EventEpochRoot";
272 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
273 fn full_name() -> ::prost::alloc::string::String {
274 "penumbra.core.component.sct.v1.EventEpochRoot".into()
275 }
276 fn type_url() -> ::prost::alloc::string::String {
277 "/penumbra.core.component.sct.v1.EventEpochRoot".into()
278 }
279}
280#[derive(Clone, PartialEq, ::prost::Message)]
282pub struct EventBlockRoot {
283 #[prost(message, optional, tag = "1")]
284 pub root: ::core::option::Option<
285 super::super::super::super::crypto::tct::v1::MerkleRoot,
286 >,
287 #[prost(uint64, tag = "2")]
288 pub height: u64,
289 #[prost(message, optional, tag = "3")]
290 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
291}
292impl ::prost::Name for EventBlockRoot {
293 const NAME: &'static str = "EventBlockRoot";
294 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
295 fn full_name() -> ::prost::alloc::string::String {
296 "penumbra.core.component.sct.v1.EventBlockRoot".into()
297 }
298 fn type_url() -> ::prost::alloc::string::String {
299 "/penumbra.core.component.sct.v1.EventBlockRoot".into()
300 }
301}
302#[derive(Clone, Copy, PartialEq, ::prost::Message)]
303pub struct EpochByHeightRequest {
304 #[prost(uint64, tag = "1")]
305 pub height: u64,
306}
307impl ::prost::Name for EpochByHeightRequest {
308 const NAME: &'static str = "EpochByHeightRequest";
309 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
310 fn full_name() -> ::prost::alloc::string::String {
311 "penumbra.core.component.sct.v1.EpochByHeightRequest".into()
312 }
313 fn type_url() -> ::prost::alloc::string::String {
314 "/penumbra.core.component.sct.v1.EpochByHeightRequest".into()
315 }
316}
317#[derive(Clone, Copy, PartialEq, ::prost::Message)]
318pub struct EpochByHeightResponse {
319 #[prost(message, optional, tag = "1")]
320 pub epoch: ::core::option::Option<Epoch>,
321}
322impl ::prost::Name for EpochByHeightResponse {
323 const NAME: &'static str = "EpochByHeightResponse";
324 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
325 fn full_name() -> ::prost::alloc::string::String {
326 "penumbra.core.component.sct.v1.EpochByHeightResponse".into()
327 }
328 fn type_url() -> ::prost::alloc::string::String {
329 "/penumbra.core.component.sct.v1.EpochByHeightResponse".into()
330 }
331}
332#[derive(Clone, Copy, PartialEq, ::prost::Message)]
333pub struct AnchorByHeightRequest {
334 #[prost(uint64, tag = "1")]
335 pub height: u64,
336}
337impl ::prost::Name for AnchorByHeightRequest {
338 const NAME: &'static str = "AnchorByHeightRequest";
339 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
340 fn full_name() -> ::prost::alloc::string::String {
341 "penumbra.core.component.sct.v1.AnchorByHeightRequest".into()
342 }
343 fn type_url() -> ::prost::alloc::string::String {
344 "/penumbra.core.component.sct.v1.AnchorByHeightRequest".into()
345 }
346}
347#[derive(Clone, PartialEq, ::prost::Message)]
348pub struct AnchorByHeightResponse {
349 #[prost(message, optional, tag = "1")]
350 pub anchor: ::core::option::Option<
351 super::super::super::super::crypto::tct::v1::MerkleRoot,
352 >,
353}
354impl ::prost::Name for AnchorByHeightResponse {
355 const NAME: &'static str = "AnchorByHeightResponse";
356 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
357 fn full_name() -> ::prost::alloc::string::String {
358 "penumbra.core.component.sct.v1.AnchorByHeightResponse".into()
359 }
360 fn type_url() -> ::prost::alloc::string::String {
361 "/penumbra.core.component.sct.v1.AnchorByHeightResponse".into()
362 }
363}
364#[derive(Clone, Copy, PartialEq, ::prost::Message)]
365pub struct TimestampByHeightRequest {
366 #[prost(uint64, tag = "1")]
367 pub height: u64,
368}
369impl ::prost::Name for TimestampByHeightRequest {
370 const NAME: &'static str = "TimestampByHeightRequest";
371 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
372 fn full_name() -> ::prost::alloc::string::String {
373 "penumbra.core.component.sct.v1.TimestampByHeightRequest".into()
374 }
375 fn type_url() -> ::prost::alloc::string::String {
376 "/penumbra.core.component.sct.v1.TimestampByHeightRequest".into()
377 }
378}
379#[derive(Clone, Copy, PartialEq, ::prost::Message)]
380pub struct TimestampByHeightResponse {
381 #[prost(message, optional, tag = "1")]
382 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
383}
384impl ::prost::Name for TimestampByHeightResponse {
385 const NAME: &'static str = "TimestampByHeightResponse";
386 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
387 fn full_name() -> ::prost::alloc::string::String {
388 "penumbra.core.component.sct.v1.TimestampByHeightResponse".into()
389 }
390 fn type_url() -> ::prost::alloc::string::String {
391 "/penumbra.core.component.sct.v1.TimestampByHeightResponse".into()
392 }
393}
394#[cfg(feature = "rpc")]
396pub mod query_service_client {
397 #![allow(
398 unused_variables,
399 dead_code,
400 missing_docs,
401 clippy::wildcard_imports,
402 clippy::let_unit_value,
403 )]
404 use tonic::codegen::*;
405 use tonic::codegen::http::Uri;
406 #[derive(Debug, Clone)]
408 pub struct QueryServiceClient<T> {
409 inner: tonic::client::Grpc<T>,
410 }
411 impl QueryServiceClient<tonic::transport::Channel> {
412 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
414 where
415 D: TryInto<tonic::transport::Endpoint>,
416 D::Error: Into<StdError>,
417 {
418 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
419 Ok(Self::new(conn))
420 }
421 }
422 impl<T> QueryServiceClient<T>
423 where
424 T: tonic::client::GrpcService<tonic::body::BoxBody>,
425 T::Error: Into<StdError>,
426 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
427 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
428 {
429 pub fn new(inner: T) -> Self {
430 let inner = tonic::client::Grpc::new(inner);
431 Self { inner }
432 }
433 pub fn with_origin(inner: T, origin: Uri) -> Self {
434 let inner = tonic::client::Grpc::with_origin(inner, origin);
435 Self { inner }
436 }
437 pub fn with_interceptor<F>(
438 inner: T,
439 interceptor: F,
440 ) -> QueryServiceClient<InterceptedService<T, F>>
441 where
442 F: tonic::service::Interceptor,
443 T::ResponseBody: Default,
444 T: tonic::codegen::Service<
445 http::Request<tonic::body::BoxBody>,
446 Response = http::Response<
447 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
448 >,
449 >,
450 <T as tonic::codegen::Service<
451 http::Request<tonic::body::BoxBody>,
452 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
453 {
454 QueryServiceClient::new(InterceptedService::new(inner, interceptor))
455 }
456 #[must_use]
461 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
462 self.inner = self.inner.send_compressed(encoding);
463 self
464 }
465 #[must_use]
467 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
468 self.inner = self.inner.accept_compressed(encoding);
469 self
470 }
471 #[must_use]
475 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
476 self.inner = self.inner.max_decoding_message_size(limit);
477 self
478 }
479 #[must_use]
483 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
484 self.inner = self.inner.max_encoding_message_size(limit);
485 self
486 }
487 pub async fn anchor_by_height(
488 &mut self,
489 request: impl tonic::IntoRequest<super::AnchorByHeightRequest>,
490 ) -> std::result::Result<
491 tonic::Response<super::AnchorByHeightResponse>,
492 tonic::Status,
493 > {
494 self.inner
495 .ready()
496 .await
497 .map_err(|e| {
498 tonic::Status::unknown(
499 format!("Service was not ready: {}", e.into()),
500 )
501 })?;
502 let codec = tonic::codec::ProstCodec::default();
503 let path = http::uri::PathAndQuery::from_static(
504 "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight",
505 );
506 let mut req = request.into_request();
507 req.extensions_mut()
508 .insert(
509 GrpcMethod::new(
510 "penumbra.core.component.sct.v1.QueryService",
511 "AnchorByHeight",
512 ),
513 );
514 self.inner.unary(req, path, codec).await
515 }
516 pub async fn epoch_by_height(
517 &mut self,
518 request: impl tonic::IntoRequest<super::EpochByHeightRequest>,
519 ) -> std::result::Result<
520 tonic::Response<super::EpochByHeightResponse>,
521 tonic::Status,
522 > {
523 self.inner
524 .ready()
525 .await
526 .map_err(|e| {
527 tonic::Status::unknown(
528 format!("Service was not ready: {}", e.into()),
529 )
530 })?;
531 let codec = tonic::codec::ProstCodec::default();
532 let path = http::uri::PathAndQuery::from_static(
533 "/penumbra.core.component.sct.v1.QueryService/EpochByHeight",
534 );
535 let mut req = request.into_request();
536 req.extensions_mut()
537 .insert(
538 GrpcMethod::new(
539 "penumbra.core.component.sct.v1.QueryService",
540 "EpochByHeight",
541 ),
542 );
543 self.inner.unary(req, path, codec).await
544 }
545 pub async fn timestamp_by_height(
546 &mut self,
547 request: impl tonic::IntoRequest<super::TimestampByHeightRequest>,
548 ) -> std::result::Result<
549 tonic::Response<super::TimestampByHeightResponse>,
550 tonic::Status,
551 > {
552 self.inner
553 .ready()
554 .await
555 .map_err(|e| {
556 tonic::Status::unknown(
557 format!("Service was not ready: {}", e.into()),
558 )
559 })?;
560 let codec = tonic::codec::ProstCodec::default();
561 let path = http::uri::PathAndQuery::from_static(
562 "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight",
563 );
564 let mut req = request.into_request();
565 req.extensions_mut()
566 .insert(
567 GrpcMethod::new(
568 "penumbra.core.component.sct.v1.QueryService",
569 "TimestampByHeight",
570 ),
571 );
572 self.inner.unary(req, path, codec).await
573 }
574 }
575}
576#[cfg(feature = "rpc")]
578pub mod query_service_server {
579 #![allow(
580 unused_variables,
581 dead_code,
582 missing_docs,
583 clippy::wildcard_imports,
584 clippy::let_unit_value,
585 )]
586 use tonic::codegen::*;
587 #[async_trait]
589 pub trait QueryService: std::marker::Send + std::marker::Sync + 'static {
590 async fn anchor_by_height(
591 &self,
592 request: tonic::Request<super::AnchorByHeightRequest>,
593 ) -> std::result::Result<
594 tonic::Response<super::AnchorByHeightResponse>,
595 tonic::Status,
596 >;
597 async fn epoch_by_height(
598 &self,
599 request: tonic::Request<super::EpochByHeightRequest>,
600 ) -> std::result::Result<
601 tonic::Response<super::EpochByHeightResponse>,
602 tonic::Status,
603 >;
604 async fn timestamp_by_height(
605 &self,
606 request: tonic::Request<super::TimestampByHeightRequest>,
607 ) -> std::result::Result<
608 tonic::Response<super::TimestampByHeightResponse>,
609 tonic::Status,
610 >;
611 }
612 #[derive(Debug)]
614 pub struct QueryServiceServer<T> {
615 inner: Arc<T>,
616 accept_compression_encodings: EnabledCompressionEncodings,
617 send_compression_encodings: EnabledCompressionEncodings,
618 max_decoding_message_size: Option<usize>,
619 max_encoding_message_size: Option<usize>,
620 }
621 impl<T> QueryServiceServer<T> {
622 pub fn new(inner: T) -> Self {
623 Self::from_arc(Arc::new(inner))
624 }
625 pub fn from_arc(inner: Arc<T>) -> Self {
626 Self {
627 inner,
628 accept_compression_encodings: Default::default(),
629 send_compression_encodings: Default::default(),
630 max_decoding_message_size: None,
631 max_encoding_message_size: None,
632 }
633 }
634 pub fn with_interceptor<F>(
635 inner: T,
636 interceptor: F,
637 ) -> InterceptedService<Self, F>
638 where
639 F: tonic::service::Interceptor,
640 {
641 InterceptedService::new(Self::new(inner), interceptor)
642 }
643 #[must_use]
645 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
646 self.accept_compression_encodings.enable(encoding);
647 self
648 }
649 #[must_use]
651 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
652 self.send_compression_encodings.enable(encoding);
653 self
654 }
655 #[must_use]
659 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
660 self.max_decoding_message_size = Some(limit);
661 self
662 }
663 #[must_use]
667 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
668 self.max_encoding_message_size = Some(limit);
669 self
670 }
671 }
672 impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServiceServer<T>
673 where
674 T: QueryService,
675 B: Body + std::marker::Send + 'static,
676 B::Error: Into<StdError> + std::marker::Send + 'static,
677 {
678 type Response = http::Response<tonic::body::BoxBody>;
679 type Error = std::convert::Infallible;
680 type Future = BoxFuture<Self::Response, Self::Error>;
681 fn poll_ready(
682 &mut self,
683 _cx: &mut Context<'_>,
684 ) -> Poll<std::result::Result<(), Self::Error>> {
685 Poll::Ready(Ok(()))
686 }
687 fn call(&mut self, req: http::Request<B>) -> Self::Future {
688 match req.uri().path() {
689 "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight" => {
690 #[allow(non_camel_case_types)]
691 struct AnchorByHeightSvc<T: QueryService>(pub Arc<T>);
692 impl<
693 T: QueryService,
694 > tonic::server::UnaryService<super::AnchorByHeightRequest>
695 for AnchorByHeightSvc<T> {
696 type Response = super::AnchorByHeightResponse;
697 type Future = BoxFuture<
698 tonic::Response<Self::Response>,
699 tonic::Status,
700 >;
701 fn call(
702 &mut self,
703 request: tonic::Request<super::AnchorByHeightRequest>,
704 ) -> Self::Future {
705 let inner = Arc::clone(&self.0);
706 let fut = async move {
707 <T as QueryService>::anchor_by_height(&inner, request).await
708 };
709 Box::pin(fut)
710 }
711 }
712 let accept_compression_encodings = self.accept_compression_encodings;
713 let send_compression_encodings = self.send_compression_encodings;
714 let max_decoding_message_size = self.max_decoding_message_size;
715 let max_encoding_message_size = self.max_encoding_message_size;
716 let inner = self.inner.clone();
717 let fut = async move {
718 let method = AnchorByHeightSvc(inner);
719 let codec = tonic::codec::ProstCodec::default();
720 let mut grpc = tonic::server::Grpc::new(codec)
721 .apply_compression_config(
722 accept_compression_encodings,
723 send_compression_encodings,
724 )
725 .apply_max_message_size_config(
726 max_decoding_message_size,
727 max_encoding_message_size,
728 );
729 let res = grpc.unary(method, req).await;
730 Ok(res)
731 };
732 Box::pin(fut)
733 }
734 "/penumbra.core.component.sct.v1.QueryService/EpochByHeight" => {
735 #[allow(non_camel_case_types)]
736 struct EpochByHeightSvc<T: QueryService>(pub Arc<T>);
737 impl<
738 T: QueryService,
739 > tonic::server::UnaryService<super::EpochByHeightRequest>
740 for EpochByHeightSvc<T> {
741 type Response = super::EpochByHeightResponse;
742 type Future = BoxFuture<
743 tonic::Response<Self::Response>,
744 tonic::Status,
745 >;
746 fn call(
747 &mut self,
748 request: tonic::Request<super::EpochByHeightRequest>,
749 ) -> Self::Future {
750 let inner = Arc::clone(&self.0);
751 let fut = async move {
752 <T as QueryService>::epoch_by_height(&inner, request).await
753 };
754 Box::pin(fut)
755 }
756 }
757 let accept_compression_encodings = self.accept_compression_encodings;
758 let send_compression_encodings = self.send_compression_encodings;
759 let max_decoding_message_size = self.max_decoding_message_size;
760 let max_encoding_message_size = self.max_encoding_message_size;
761 let inner = self.inner.clone();
762 let fut = async move {
763 let method = EpochByHeightSvc(inner);
764 let codec = tonic::codec::ProstCodec::default();
765 let mut grpc = tonic::server::Grpc::new(codec)
766 .apply_compression_config(
767 accept_compression_encodings,
768 send_compression_encodings,
769 )
770 .apply_max_message_size_config(
771 max_decoding_message_size,
772 max_encoding_message_size,
773 );
774 let res = grpc.unary(method, req).await;
775 Ok(res)
776 };
777 Box::pin(fut)
778 }
779 "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight" => {
780 #[allow(non_camel_case_types)]
781 struct TimestampByHeightSvc<T: QueryService>(pub Arc<T>);
782 impl<
783 T: QueryService,
784 > tonic::server::UnaryService<super::TimestampByHeightRequest>
785 for TimestampByHeightSvc<T> {
786 type Response = super::TimestampByHeightResponse;
787 type Future = BoxFuture<
788 tonic::Response<Self::Response>,
789 tonic::Status,
790 >;
791 fn call(
792 &mut self,
793 request: tonic::Request<super::TimestampByHeightRequest>,
794 ) -> Self::Future {
795 let inner = Arc::clone(&self.0);
796 let fut = async move {
797 <T as QueryService>::timestamp_by_height(&inner, request)
798 .await
799 };
800 Box::pin(fut)
801 }
802 }
803 let accept_compression_encodings = self.accept_compression_encodings;
804 let send_compression_encodings = self.send_compression_encodings;
805 let max_decoding_message_size = self.max_decoding_message_size;
806 let max_encoding_message_size = self.max_encoding_message_size;
807 let inner = self.inner.clone();
808 let fut = async move {
809 let method = TimestampByHeightSvc(inner);
810 let codec = tonic::codec::ProstCodec::default();
811 let mut grpc = tonic::server::Grpc::new(codec)
812 .apply_compression_config(
813 accept_compression_encodings,
814 send_compression_encodings,
815 )
816 .apply_max_message_size_config(
817 max_decoding_message_size,
818 max_encoding_message_size,
819 );
820 let res = grpc.unary(method, req).await;
821 Ok(res)
822 };
823 Box::pin(fut)
824 }
825 _ => {
826 Box::pin(async move {
827 let mut response = http::Response::new(empty_body());
828 let headers = response.headers_mut();
829 headers
830 .insert(
831 tonic::Status::GRPC_STATUS,
832 (tonic::Code::Unimplemented as i32).into(),
833 );
834 headers
835 .insert(
836 http::header::CONTENT_TYPE,
837 tonic::metadata::GRPC_CONTENT_TYPE,
838 );
839 Ok(response)
840 })
841 }
842 }
843 }
844 }
845 impl<T> Clone for QueryServiceServer<T> {
846 fn clone(&self) -> Self {
847 let inner = self.inner.clone();
848 Self {
849 inner,
850 accept_compression_encodings: self.accept_compression_encodings,
851 send_compression_encodings: self.send_compression_encodings,
852 max_decoding_message_size: self.max_decoding_message_size,
853 max_encoding_message_size: self.max_encoding_message_size,
854 }
855 }
856 }
857 pub const SERVICE_NAME: &str = "penumbra.core.component.sct.v1.QueryService";
859 impl<T> tonic::server::NamedService for QueryServiceServer<T> {
860 const NAME: &'static str = SERVICE_NAME;
861 }
862}