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, 50")]
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::Message)]
159 pub struct LiquidityTournamentReward {
160 #[prost(uint64, tag = "1")]
162 pub epoch: u64,
163 #[prost(message, optional, tag = "2")]
165 pub tx_hash: ::core::option::Option<
166 super::super::super::super::txhash::v1::TransactionId,
167 >,
168 }
169 impl ::prost::Name for LiquidityTournamentReward {
170 const NAME: &'static str = "LiquidityTournamentReward";
171 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
172 fn full_name() -> ::prost::alloc::string::String {
173 "penumbra.core.component.sct.v1.CommitmentSource.LiquidityTournamentReward"
174 .into()
175 }
176 fn type_url() -> ::prost::alloc::string::String {
177 "/penumbra.core.component.sct.v1.CommitmentSource.LiquidityTournamentReward"
178 .into()
179 }
180 }
181 #[derive(Clone, PartialEq, ::prost::Oneof)]
182 pub enum Source {
183 #[prost(message, tag = "1")]
184 Transaction(Transaction),
185 #[prost(message, tag = "2")]
186 Ics20Transfer(Ics20Transfer),
187 #[prost(message, tag = "20")]
188 FundingStreamReward(FundingStreamReward),
189 #[prost(message, tag = "30")]
190 CommunityPoolOutput(CommunityPoolOutput),
191 #[prost(message, tag = "40")]
192 Genesis(Genesis),
193 #[prost(message, tag = "50")]
194 Lqt(LiquidityTournamentReward),
195 }
196}
197impl ::prost::Name for CommitmentSource {
198 const NAME: &'static str = "CommitmentSource";
199 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
200 fn full_name() -> ::prost::alloc::string::String {
201 "penumbra.core.component.sct.v1.CommitmentSource".into()
202 }
203 fn type_url() -> ::prost::alloc::string::String {
204 "/penumbra.core.component.sct.v1.CommitmentSource".into()
205 }
206}
207#[derive(Clone, PartialEq, ::prost::Message)]
208pub struct Nullifier {
209 #[prost(bytes = "vec", tag = "1")]
210 pub inner: ::prost::alloc::vec::Vec<u8>,
211}
212impl ::prost::Name for Nullifier {
213 const NAME: &'static str = "Nullifier";
214 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
215 fn full_name() -> ::prost::alloc::string::String {
216 "penumbra.core.component.sct.v1.Nullifier".into()
217 }
218 fn type_url() -> ::prost::alloc::string::String {
219 "/penumbra.core.component.sct.v1.Nullifier".into()
220 }
221}
222#[derive(Clone, PartialEq, ::prost::Message)]
224pub struct NullificationInfo {
225 #[prost(bytes = "vec", tag = "1")]
226 pub id: ::prost::alloc::vec::Vec<u8>,
227 #[prost(uint64, tag = "2")]
228 pub spend_height: u64,
229}
230impl ::prost::Name for NullificationInfo {
231 const NAME: &'static str = "NullificationInfo";
232 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
233 fn full_name() -> ::prost::alloc::string::String {
234 "penumbra.core.component.sct.v1.NullificationInfo".into()
235 }
236 fn type_url() -> ::prost::alloc::string::String {
237 "/penumbra.core.component.sct.v1.NullificationInfo".into()
238 }
239}
240#[derive(Clone, PartialEq, ::prost::Message)]
242pub struct EventCommitment {
243 #[prost(message, optional, tag = "1")]
244 pub commitment: ::core::option::Option<
245 super::super::super::super::crypto::tct::v1::StateCommitment,
246 >,
247 #[prost(uint64, tag = "2")]
248 pub position: u64,
249 #[prost(message, optional, tag = "3")]
250 pub source: ::core::option::Option<CommitmentSource>,
251}
252impl ::prost::Name for EventCommitment {
253 const NAME: &'static str = "EventCommitment";
254 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
255 fn full_name() -> ::prost::alloc::string::String {
256 "penumbra.core.component.sct.v1.EventCommitment".into()
257 }
258 fn type_url() -> ::prost::alloc::string::String {
259 "/penumbra.core.component.sct.v1.EventCommitment".into()
260 }
261}
262#[derive(Clone, PartialEq, ::prost::Message)]
264pub struct EventAnchor {
265 #[prost(message, optional, tag = "1")]
266 pub anchor: ::core::option::Option<
267 super::super::super::super::crypto::tct::v1::MerkleRoot,
268 >,
269 #[prost(uint64, tag = "2")]
270 pub height: u64,
271 #[prost(message, optional, tag = "3")]
272 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
273}
274impl ::prost::Name for EventAnchor {
275 const NAME: &'static str = "EventAnchor";
276 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
277 fn full_name() -> ::prost::alloc::string::String {
278 "penumbra.core.component.sct.v1.EventAnchor".into()
279 }
280 fn type_url() -> ::prost::alloc::string::String {
281 "/penumbra.core.component.sct.v1.EventAnchor".into()
282 }
283}
284#[derive(Clone, PartialEq, ::prost::Message)]
286pub struct EventEpochRoot {
287 #[prost(message, optional, tag = "1")]
288 pub root: ::core::option::Option<
289 super::super::super::super::crypto::tct::v1::MerkleRoot,
290 >,
291 #[prost(uint64, tag = "2")]
292 pub index: u64,
293 #[prost(message, optional, tag = "3")]
294 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
295}
296impl ::prost::Name for EventEpochRoot {
297 const NAME: &'static str = "EventEpochRoot";
298 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
299 fn full_name() -> ::prost::alloc::string::String {
300 "penumbra.core.component.sct.v1.EventEpochRoot".into()
301 }
302 fn type_url() -> ::prost::alloc::string::String {
303 "/penumbra.core.component.sct.v1.EventEpochRoot".into()
304 }
305}
306#[derive(Clone, PartialEq, ::prost::Message)]
308pub struct EventBlockRoot {
309 #[prost(message, optional, tag = "1")]
310 pub root: ::core::option::Option<
311 super::super::super::super::crypto::tct::v1::MerkleRoot,
312 >,
313 #[prost(uint64, tag = "2")]
314 pub height: u64,
315 #[prost(message, optional, tag = "3")]
316 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
317}
318impl ::prost::Name for EventBlockRoot {
319 const NAME: &'static str = "EventBlockRoot";
320 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
321 fn full_name() -> ::prost::alloc::string::String {
322 "penumbra.core.component.sct.v1.EventBlockRoot".into()
323 }
324 fn type_url() -> ::prost::alloc::string::String {
325 "/penumbra.core.component.sct.v1.EventBlockRoot".into()
326 }
327}
328#[derive(Clone, Copy, PartialEq, ::prost::Message)]
329pub struct EpochByHeightRequest {
330 #[prost(uint64, tag = "1")]
331 pub height: u64,
332}
333impl ::prost::Name for EpochByHeightRequest {
334 const NAME: &'static str = "EpochByHeightRequest";
335 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
336 fn full_name() -> ::prost::alloc::string::String {
337 "penumbra.core.component.sct.v1.EpochByHeightRequest".into()
338 }
339 fn type_url() -> ::prost::alloc::string::String {
340 "/penumbra.core.component.sct.v1.EpochByHeightRequest".into()
341 }
342}
343#[derive(Clone, Copy, PartialEq, ::prost::Message)]
344pub struct EpochByHeightResponse {
345 #[prost(message, optional, tag = "1")]
346 pub epoch: ::core::option::Option<Epoch>,
347}
348impl ::prost::Name for EpochByHeightResponse {
349 const NAME: &'static str = "EpochByHeightResponse";
350 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
351 fn full_name() -> ::prost::alloc::string::String {
352 "penumbra.core.component.sct.v1.EpochByHeightResponse".into()
353 }
354 fn type_url() -> ::prost::alloc::string::String {
355 "/penumbra.core.component.sct.v1.EpochByHeightResponse".into()
356 }
357}
358#[derive(Clone, Copy, PartialEq, ::prost::Message)]
359pub struct AnchorByHeightRequest {
360 #[prost(uint64, tag = "1")]
361 pub height: u64,
362}
363impl ::prost::Name for AnchorByHeightRequest {
364 const NAME: &'static str = "AnchorByHeightRequest";
365 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
366 fn full_name() -> ::prost::alloc::string::String {
367 "penumbra.core.component.sct.v1.AnchorByHeightRequest".into()
368 }
369 fn type_url() -> ::prost::alloc::string::String {
370 "/penumbra.core.component.sct.v1.AnchorByHeightRequest".into()
371 }
372}
373#[derive(Clone, PartialEq, ::prost::Message)]
374pub struct AnchorByHeightResponse {
375 #[prost(message, optional, tag = "1")]
376 pub anchor: ::core::option::Option<
377 super::super::super::super::crypto::tct::v1::MerkleRoot,
378 >,
379}
380impl ::prost::Name for AnchorByHeightResponse {
381 const NAME: &'static str = "AnchorByHeightResponse";
382 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
383 fn full_name() -> ::prost::alloc::string::String {
384 "penumbra.core.component.sct.v1.AnchorByHeightResponse".into()
385 }
386 fn type_url() -> ::prost::alloc::string::String {
387 "/penumbra.core.component.sct.v1.AnchorByHeightResponse".into()
388 }
389}
390#[derive(Clone, Copy, PartialEq, ::prost::Message)]
391pub struct TimestampByHeightRequest {
392 #[prost(uint64, tag = "1")]
393 pub height: u64,
394}
395impl ::prost::Name for TimestampByHeightRequest {
396 const NAME: &'static str = "TimestampByHeightRequest";
397 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
398 fn full_name() -> ::prost::alloc::string::String {
399 "penumbra.core.component.sct.v1.TimestampByHeightRequest".into()
400 }
401 fn type_url() -> ::prost::alloc::string::String {
402 "/penumbra.core.component.sct.v1.TimestampByHeightRequest".into()
403 }
404}
405#[derive(Clone, Copy, PartialEq, ::prost::Message)]
406pub struct TimestampByHeightResponse {
407 #[prost(message, optional, tag = "1")]
408 pub timestamp: ::core::option::Option<::pbjson_types::Timestamp>,
409}
410impl ::prost::Name for TimestampByHeightResponse {
411 const NAME: &'static str = "TimestampByHeightResponse";
412 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
413 fn full_name() -> ::prost::alloc::string::String {
414 "penumbra.core.component.sct.v1.TimestampByHeightResponse".into()
415 }
416 fn type_url() -> ::prost::alloc::string::String {
417 "/penumbra.core.component.sct.v1.TimestampByHeightResponse".into()
418 }
419}
420#[derive(Clone, Copy, PartialEq, ::prost::Message)]
421pub struct SctFrontierRequest {
422 #[prost(bool, tag = "1")]
424 pub with_proof: bool,
425}
426impl ::prost::Name for SctFrontierRequest {
427 const NAME: &'static str = "SctFrontierRequest";
428 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
429 fn full_name() -> ::prost::alloc::string::String {
430 "penumbra.core.component.sct.v1.SctFrontierRequest".into()
431 }
432 fn type_url() -> ::prost::alloc::string::String {
433 "/penumbra.core.component.sct.v1.SctFrontierRequest".into()
434 }
435}
436#[derive(Clone, PartialEq, ::prost::Message)]
437pub struct SctFrontierResponse {
438 #[prost(uint64, tag = "1")]
440 pub height: u64,
441 #[prost(message, optional, tag = "2")]
443 pub anchor: ::core::option::Option<
444 super::super::super::super::crypto::tct::v1::MerkleRoot,
445 >,
446 #[prost(bytes = "vec", tag = "3")]
449 pub compact_frontier: ::prost::alloc::vec::Vec<u8>,
450 #[prost(message, optional, tag = "4")]
452 pub proof: ::core::option::Option<
453 ::ibc_proto::ibc::core::commitment::v1::MerkleProof,
454 >,
455}
456impl ::prost::Name for SctFrontierResponse {
457 const NAME: &'static str = "SctFrontierResponse";
458 const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
459 fn full_name() -> ::prost::alloc::string::String {
460 "penumbra.core.component.sct.v1.SctFrontierResponse".into()
461 }
462 fn type_url() -> ::prost::alloc::string::String {
463 "/penumbra.core.component.sct.v1.SctFrontierResponse".into()
464 }
465}
466#[cfg(feature = "rpc")]
468pub mod query_service_client {
469 #![allow(
470 unused_variables,
471 dead_code,
472 missing_docs,
473 clippy::wildcard_imports,
474 clippy::let_unit_value,
475 )]
476 use tonic::codegen::*;
477 use tonic::codegen::http::Uri;
478 #[derive(Debug, Clone)]
480 pub struct QueryServiceClient<T> {
481 inner: tonic::client::Grpc<T>,
482 }
483 impl QueryServiceClient<tonic::transport::Channel> {
484 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
486 where
487 D: TryInto<tonic::transport::Endpoint>,
488 D::Error: Into<StdError>,
489 {
490 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
491 Ok(Self::new(conn))
492 }
493 }
494 impl<T> QueryServiceClient<T>
495 where
496 T: tonic::client::GrpcService<tonic::body::BoxBody>,
497 T::Error: Into<StdError>,
498 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
499 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
500 {
501 pub fn new(inner: T) -> Self {
502 let inner = tonic::client::Grpc::new(inner);
503 Self { inner }
504 }
505 pub fn with_origin(inner: T, origin: Uri) -> Self {
506 let inner = tonic::client::Grpc::with_origin(inner, origin);
507 Self { inner }
508 }
509 pub fn with_interceptor<F>(
510 inner: T,
511 interceptor: F,
512 ) -> QueryServiceClient<InterceptedService<T, F>>
513 where
514 F: tonic::service::Interceptor,
515 T::ResponseBody: Default,
516 T: tonic::codegen::Service<
517 http::Request<tonic::body::BoxBody>,
518 Response = http::Response<
519 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
520 >,
521 >,
522 <T as tonic::codegen::Service<
523 http::Request<tonic::body::BoxBody>,
524 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
525 {
526 QueryServiceClient::new(InterceptedService::new(inner, interceptor))
527 }
528 #[must_use]
533 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
534 self.inner = self.inner.send_compressed(encoding);
535 self
536 }
537 #[must_use]
539 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
540 self.inner = self.inner.accept_compressed(encoding);
541 self
542 }
543 #[must_use]
547 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
548 self.inner = self.inner.max_decoding_message_size(limit);
549 self
550 }
551 #[must_use]
555 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
556 self.inner = self.inner.max_encoding_message_size(limit);
557 self
558 }
559 pub async fn anchor_by_height(
560 &mut self,
561 request: impl tonic::IntoRequest<super::AnchorByHeightRequest>,
562 ) -> std::result::Result<
563 tonic::Response<super::AnchorByHeightResponse>,
564 tonic::Status,
565 > {
566 self.inner
567 .ready()
568 .await
569 .map_err(|e| {
570 tonic::Status::unknown(
571 format!("Service was not ready: {}", e.into()),
572 )
573 })?;
574 let codec = tonic::codec::ProstCodec::default();
575 let path = http::uri::PathAndQuery::from_static(
576 "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight",
577 );
578 let mut req = request.into_request();
579 req.extensions_mut()
580 .insert(
581 GrpcMethod::new(
582 "penumbra.core.component.sct.v1.QueryService",
583 "AnchorByHeight",
584 ),
585 );
586 self.inner.unary(req, path, codec).await
587 }
588 pub async fn epoch_by_height(
589 &mut self,
590 request: impl tonic::IntoRequest<super::EpochByHeightRequest>,
591 ) -> std::result::Result<
592 tonic::Response<super::EpochByHeightResponse>,
593 tonic::Status,
594 > {
595 self.inner
596 .ready()
597 .await
598 .map_err(|e| {
599 tonic::Status::unknown(
600 format!("Service was not ready: {}", e.into()),
601 )
602 })?;
603 let codec = tonic::codec::ProstCodec::default();
604 let path = http::uri::PathAndQuery::from_static(
605 "/penumbra.core.component.sct.v1.QueryService/EpochByHeight",
606 );
607 let mut req = request.into_request();
608 req.extensions_mut()
609 .insert(
610 GrpcMethod::new(
611 "penumbra.core.component.sct.v1.QueryService",
612 "EpochByHeight",
613 ),
614 );
615 self.inner.unary(req, path, codec).await
616 }
617 pub async fn timestamp_by_height(
618 &mut self,
619 request: impl tonic::IntoRequest<super::TimestampByHeightRequest>,
620 ) -> std::result::Result<
621 tonic::Response<super::TimestampByHeightResponse>,
622 tonic::Status,
623 > {
624 self.inner
625 .ready()
626 .await
627 .map_err(|e| {
628 tonic::Status::unknown(
629 format!("Service was not ready: {}", e.into()),
630 )
631 })?;
632 let codec = tonic::codec::ProstCodec::default();
633 let path = http::uri::PathAndQuery::from_static(
634 "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight",
635 );
636 let mut req = request.into_request();
637 req.extensions_mut()
638 .insert(
639 GrpcMethod::new(
640 "penumbra.core.component.sct.v1.QueryService",
641 "TimestampByHeight",
642 ),
643 );
644 self.inner.unary(req, path, codec).await
645 }
646 pub async fn sct_frontier(
647 &mut self,
648 request: impl tonic::IntoRequest<super::SctFrontierRequest>,
649 ) -> std::result::Result<
650 tonic::Response<super::SctFrontierResponse>,
651 tonic::Status,
652 > {
653 self.inner
654 .ready()
655 .await
656 .map_err(|e| {
657 tonic::Status::unknown(
658 format!("Service was not ready: {}", e.into()),
659 )
660 })?;
661 let codec = tonic::codec::ProstCodec::default();
662 let path = http::uri::PathAndQuery::from_static(
663 "/penumbra.core.component.sct.v1.QueryService/SctFrontier",
664 );
665 let mut req = request.into_request();
666 req.extensions_mut()
667 .insert(
668 GrpcMethod::new(
669 "penumbra.core.component.sct.v1.QueryService",
670 "SctFrontier",
671 ),
672 );
673 self.inner.unary(req, path, codec).await
674 }
675 }
676}
677#[cfg(feature = "rpc")]
679pub mod query_service_server {
680 #![allow(
681 unused_variables,
682 dead_code,
683 missing_docs,
684 clippy::wildcard_imports,
685 clippy::let_unit_value,
686 )]
687 use tonic::codegen::*;
688 #[async_trait]
690 pub trait QueryService: std::marker::Send + std::marker::Sync + 'static {
691 async fn anchor_by_height(
692 &self,
693 request: tonic::Request<super::AnchorByHeightRequest>,
694 ) -> std::result::Result<
695 tonic::Response<super::AnchorByHeightResponse>,
696 tonic::Status,
697 >;
698 async fn epoch_by_height(
699 &self,
700 request: tonic::Request<super::EpochByHeightRequest>,
701 ) -> std::result::Result<
702 tonic::Response<super::EpochByHeightResponse>,
703 tonic::Status,
704 >;
705 async fn timestamp_by_height(
706 &self,
707 request: tonic::Request<super::TimestampByHeightRequest>,
708 ) -> std::result::Result<
709 tonic::Response<super::TimestampByHeightResponse>,
710 tonic::Status,
711 >;
712 async fn sct_frontier(
713 &self,
714 request: tonic::Request<super::SctFrontierRequest>,
715 ) -> std::result::Result<
716 tonic::Response<super::SctFrontierResponse>,
717 tonic::Status,
718 >;
719 }
720 #[derive(Debug)]
722 pub struct QueryServiceServer<T> {
723 inner: Arc<T>,
724 accept_compression_encodings: EnabledCompressionEncodings,
725 send_compression_encodings: EnabledCompressionEncodings,
726 max_decoding_message_size: Option<usize>,
727 max_encoding_message_size: Option<usize>,
728 }
729 impl<T> QueryServiceServer<T> {
730 pub fn new(inner: T) -> Self {
731 Self::from_arc(Arc::new(inner))
732 }
733 pub fn from_arc(inner: Arc<T>) -> Self {
734 Self {
735 inner,
736 accept_compression_encodings: Default::default(),
737 send_compression_encodings: Default::default(),
738 max_decoding_message_size: None,
739 max_encoding_message_size: None,
740 }
741 }
742 pub fn with_interceptor<F>(
743 inner: T,
744 interceptor: F,
745 ) -> InterceptedService<Self, F>
746 where
747 F: tonic::service::Interceptor,
748 {
749 InterceptedService::new(Self::new(inner), interceptor)
750 }
751 #[must_use]
753 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
754 self.accept_compression_encodings.enable(encoding);
755 self
756 }
757 #[must_use]
759 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
760 self.send_compression_encodings.enable(encoding);
761 self
762 }
763 #[must_use]
767 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
768 self.max_decoding_message_size = Some(limit);
769 self
770 }
771 #[must_use]
775 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
776 self.max_encoding_message_size = Some(limit);
777 self
778 }
779 }
780 impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServiceServer<T>
781 where
782 T: QueryService,
783 B: Body + std::marker::Send + 'static,
784 B::Error: Into<StdError> + std::marker::Send + 'static,
785 {
786 type Response = http::Response<tonic::body::BoxBody>;
787 type Error = std::convert::Infallible;
788 type Future = BoxFuture<Self::Response, Self::Error>;
789 fn poll_ready(
790 &mut self,
791 _cx: &mut Context<'_>,
792 ) -> Poll<std::result::Result<(), Self::Error>> {
793 Poll::Ready(Ok(()))
794 }
795 fn call(&mut self, req: http::Request<B>) -> Self::Future {
796 match req.uri().path() {
797 "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight" => {
798 #[allow(non_camel_case_types)]
799 struct AnchorByHeightSvc<T: QueryService>(pub Arc<T>);
800 impl<
801 T: QueryService,
802 > tonic::server::UnaryService<super::AnchorByHeightRequest>
803 for AnchorByHeightSvc<T> {
804 type Response = super::AnchorByHeightResponse;
805 type Future = BoxFuture<
806 tonic::Response<Self::Response>,
807 tonic::Status,
808 >;
809 fn call(
810 &mut self,
811 request: tonic::Request<super::AnchorByHeightRequest>,
812 ) -> Self::Future {
813 let inner = Arc::clone(&self.0);
814 let fut = async move {
815 <T as QueryService>::anchor_by_height(&inner, request).await
816 };
817 Box::pin(fut)
818 }
819 }
820 let accept_compression_encodings = self.accept_compression_encodings;
821 let send_compression_encodings = self.send_compression_encodings;
822 let max_decoding_message_size = self.max_decoding_message_size;
823 let max_encoding_message_size = self.max_encoding_message_size;
824 let inner = self.inner.clone();
825 let fut = async move {
826 let method = AnchorByHeightSvc(inner);
827 let codec = tonic::codec::ProstCodec::default();
828 let mut grpc = tonic::server::Grpc::new(codec)
829 .apply_compression_config(
830 accept_compression_encodings,
831 send_compression_encodings,
832 )
833 .apply_max_message_size_config(
834 max_decoding_message_size,
835 max_encoding_message_size,
836 );
837 let res = grpc.unary(method, req).await;
838 Ok(res)
839 };
840 Box::pin(fut)
841 }
842 "/penumbra.core.component.sct.v1.QueryService/EpochByHeight" => {
843 #[allow(non_camel_case_types)]
844 struct EpochByHeightSvc<T: QueryService>(pub Arc<T>);
845 impl<
846 T: QueryService,
847 > tonic::server::UnaryService<super::EpochByHeightRequest>
848 for EpochByHeightSvc<T> {
849 type Response = super::EpochByHeightResponse;
850 type Future = BoxFuture<
851 tonic::Response<Self::Response>,
852 tonic::Status,
853 >;
854 fn call(
855 &mut self,
856 request: tonic::Request<super::EpochByHeightRequest>,
857 ) -> Self::Future {
858 let inner = Arc::clone(&self.0);
859 let fut = async move {
860 <T as QueryService>::epoch_by_height(&inner, request).await
861 };
862 Box::pin(fut)
863 }
864 }
865 let accept_compression_encodings = self.accept_compression_encodings;
866 let send_compression_encodings = self.send_compression_encodings;
867 let max_decoding_message_size = self.max_decoding_message_size;
868 let max_encoding_message_size = self.max_encoding_message_size;
869 let inner = self.inner.clone();
870 let fut = async move {
871 let method = EpochByHeightSvc(inner);
872 let codec = tonic::codec::ProstCodec::default();
873 let mut grpc = tonic::server::Grpc::new(codec)
874 .apply_compression_config(
875 accept_compression_encodings,
876 send_compression_encodings,
877 )
878 .apply_max_message_size_config(
879 max_decoding_message_size,
880 max_encoding_message_size,
881 );
882 let res = grpc.unary(method, req).await;
883 Ok(res)
884 };
885 Box::pin(fut)
886 }
887 "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight" => {
888 #[allow(non_camel_case_types)]
889 struct TimestampByHeightSvc<T: QueryService>(pub Arc<T>);
890 impl<
891 T: QueryService,
892 > tonic::server::UnaryService<super::TimestampByHeightRequest>
893 for TimestampByHeightSvc<T> {
894 type Response = super::TimestampByHeightResponse;
895 type Future = BoxFuture<
896 tonic::Response<Self::Response>,
897 tonic::Status,
898 >;
899 fn call(
900 &mut self,
901 request: tonic::Request<super::TimestampByHeightRequest>,
902 ) -> Self::Future {
903 let inner = Arc::clone(&self.0);
904 let fut = async move {
905 <T as QueryService>::timestamp_by_height(&inner, request)
906 .await
907 };
908 Box::pin(fut)
909 }
910 }
911 let accept_compression_encodings = self.accept_compression_encodings;
912 let send_compression_encodings = self.send_compression_encodings;
913 let max_decoding_message_size = self.max_decoding_message_size;
914 let max_encoding_message_size = self.max_encoding_message_size;
915 let inner = self.inner.clone();
916 let fut = async move {
917 let method = TimestampByHeightSvc(inner);
918 let codec = tonic::codec::ProstCodec::default();
919 let mut grpc = tonic::server::Grpc::new(codec)
920 .apply_compression_config(
921 accept_compression_encodings,
922 send_compression_encodings,
923 )
924 .apply_max_message_size_config(
925 max_decoding_message_size,
926 max_encoding_message_size,
927 );
928 let res = grpc.unary(method, req).await;
929 Ok(res)
930 };
931 Box::pin(fut)
932 }
933 "/penumbra.core.component.sct.v1.QueryService/SctFrontier" => {
934 #[allow(non_camel_case_types)]
935 struct SctFrontierSvc<T: QueryService>(pub Arc<T>);
936 impl<
937 T: QueryService,
938 > tonic::server::UnaryService<super::SctFrontierRequest>
939 for SctFrontierSvc<T> {
940 type Response = super::SctFrontierResponse;
941 type Future = BoxFuture<
942 tonic::Response<Self::Response>,
943 tonic::Status,
944 >;
945 fn call(
946 &mut self,
947 request: tonic::Request<super::SctFrontierRequest>,
948 ) -> Self::Future {
949 let inner = Arc::clone(&self.0);
950 let fut = async move {
951 <T as QueryService>::sct_frontier(&inner, request).await
952 };
953 Box::pin(fut)
954 }
955 }
956 let accept_compression_encodings = self.accept_compression_encodings;
957 let send_compression_encodings = self.send_compression_encodings;
958 let max_decoding_message_size = self.max_decoding_message_size;
959 let max_encoding_message_size = self.max_encoding_message_size;
960 let inner = self.inner.clone();
961 let fut = async move {
962 let method = SctFrontierSvc(inner);
963 let codec = tonic::codec::ProstCodec::default();
964 let mut grpc = tonic::server::Grpc::new(codec)
965 .apply_compression_config(
966 accept_compression_encodings,
967 send_compression_encodings,
968 )
969 .apply_max_message_size_config(
970 max_decoding_message_size,
971 max_encoding_message_size,
972 );
973 let res = grpc.unary(method, req).await;
974 Ok(res)
975 };
976 Box::pin(fut)
977 }
978 _ => {
979 Box::pin(async move {
980 let mut response = http::Response::new(empty_body());
981 let headers = response.headers_mut();
982 headers
983 .insert(
984 tonic::Status::GRPC_STATUS,
985 (tonic::Code::Unimplemented as i32).into(),
986 );
987 headers
988 .insert(
989 http::header::CONTENT_TYPE,
990 tonic::metadata::GRPC_CONTENT_TYPE,
991 );
992 Ok(response)
993 })
994 }
995 }
996 }
997 }
998 impl<T> Clone for QueryServiceServer<T> {
999 fn clone(&self) -> Self {
1000 let inner = self.inner.clone();
1001 Self {
1002 inner,
1003 accept_compression_encodings: self.accept_compression_encodings,
1004 send_compression_encodings: self.send_compression_encodings,
1005 max_decoding_message_size: self.max_decoding_message_size,
1006 max_encoding_message_size: self.max_encoding_message_size,
1007 }
1008 }
1009 }
1010 pub const SERVICE_NAME: &str = "penumbra.core.component.sct.v1.QueryService";
1012 impl<T> tonic::server::NamedService for QueryServiceServer<T> {
1013 const NAME: &'static str = SERVICE_NAME;
1014 }
1015}