penumbra_sdk_proto/gen/
penumbra.core.component.sct.v1.rs

1// This file is @generated by prost-build.
2/// Configuration data for the SCT component.
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct SctParameters {
5    /// The default duration of each epoch, in number of blocks.
6    #[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/// Sct-specific genesis content.
20#[derive(Clone, Copy, PartialEq, ::prost::Message)]
21pub struct GenesisContent {
22    /// The SctParameters present at genesis.
23    #[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/// An epoch is a sequentially numbered collection of contiguous blocks.
37#[derive(Clone, Copy, PartialEq, ::prost::Message)]
38pub struct Epoch {
39    /// The unique index of the epoch.
40    #[prost(uint64, tag = "1")]
41    pub index: u64,
42    /// The starting height for the epoch.
43    #[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/// Metadata describing the source of a commitment in the state commitment tree.
57///
58/// This message allows clients to track provenance of state commitments, and to
59/// decide whether or not to download block data.
60#[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}
65/// Nested message and enum types in `CommitmentSource`.
66pub mod commitment_source {
67    /// The state commitment was included in the genesis state.
68    #[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    /// The commitment was created by a transaction.
81    ///
82    /// When included in a `CompactBlock` via a `StatePayload`, the transaction source is "dehydrated"
83    /// by stripping the `id` field and putting empty bytes in its place.  When clients perform extended
84    /// transaction fetch, they should match up transaction hashes to "rehydrate" the source info.
85    #[derive(Clone, PartialEq, ::prost::Message)]
86    pub struct Transaction {
87        /// The transaction ID, if specified.
88        ///
89        /// This field may be omitted to save space, and should not be required to be present.
90        /// If the bytes are missing, the message should be interpreted as "Transaction (Unknown)".
91        #[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    /// The commitment was created through a validator's funding stream.
105    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
106    pub struct FundingStreamReward {
107        /// The epoch index the rewards were issued in.
108        #[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    /// The commitment was created through a `CommunityPoolOutput` in a governance-initated transaction.
122    #[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    /// The commitment was created by an inbound ICS20 transfer.
135    #[derive(Clone, PartialEq, ::prost::Message)]
136    pub struct Ics20Transfer {
137        /// The sequence number of the packet that triggered the transfer
138        #[prost(uint64, tag = "1")]
139        pub packet_seq: u64,
140        /// The channel id the transfer happened on
141        #[prost(string, tag = "2")]
142        pub channel_id: ::prost::alloc::string::String,
143        /// The sender address on the counterparty chain
144        #[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/// Records information about what transaction spent a nullifier.
197#[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/// Event recording a new commitment added to the SCT.
215#[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/// Event recording an SCT anchor (global root).
237#[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/// Event recording an SCT epoch root.
259#[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/// Event recording an SCT block root.
281#[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#[derive(Clone, Copy, PartialEq, ::prost::Message)]
395pub struct SctFrontierRequest {
396    /// Whether to include a proof of inclusion for the returned anchor
397    #[prost(bool, tag = "1")]
398    pub with_proof: bool,
399}
400impl ::prost::Name for SctFrontierRequest {
401    const NAME: &'static str = "SctFrontierRequest";
402    const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
403    fn full_name() -> ::prost::alloc::string::String {
404        "penumbra.core.component.sct.v1.SctFrontierRequest".into()
405    }
406    fn type_url() -> ::prost::alloc::string::String {
407        "/penumbra.core.component.sct.v1.SctFrontierRequest".into()
408    }
409}
410#[derive(Clone, PartialEq, ::prost::Message)]
411pub struct SctFrontierResponse {
412    /// The height of the frontier we are returning.
413    #[prost(uint64, tag = "1")]
414    pub height: u64,
415    /// The SCT anchor at the given height.
416    #[prost(message, optional, tag = "2")]
417    pub anchor: ::core::option::Option<
418        super::super::super::super::crypto::tct::v1::MerkleRoot,
419    >,
420    /// A blob of bytes that corresponds to the compact frontier
421    /// at the given height.
422    #[prost(bytes = "vec", tag = "3")]
423    pub compact_frontier: ::prost::alloc::vec::Vec<u8>,
424    /// A proof of existence or non-existence, if requested.
425    #[prost(message, optional, tag = "4")]
426    pub proof: ::core::option::Option<
427        ::ibc_proto::ibc::core::commitment::v1::MerkleProof,
428    >,
429}
430impl ::prost::Name for SctFrontierResponse {
431    const NAME: &'static str = "SctFrontierResponse";
432    const PACKAGE: &'static str = "penumbra.core.component.sct.v1";
433    fn full_name() -> ::prost::alloc::string::String {
434        "penumbra.core.component.sct.v1.SctFrontierResponse".into()
435    }
436    fn type_url() -> ::prost::alloc::string::String {
437        "/penumbra.core.component.sct.v1.SctFrontierResponse".into()
438    }
439}
440/// Generated client implementations.
441#[cfg(feature = "rpc")]
442pub mod query_service_client {
443    #![allow(
444        unused_variables,
445        dead_code,
446        missing_docs,
447        clippy::wildcard_imports,
448        clippy::let_unit_value,
449    )]
450    use tonic::codegen::*;
451    use tonic::codegen::http::Uri;
452    /// Query operations for the SCT component.
453    #[derive(Debug, Clone)]
454    pub struct QueryServiceClient<T> {
455        inner: tonic::client::Grpc<T>,
456    }
457    impl QueryServiceClient<tonic::transport::Channel> {
458        /// Attempt to create a new client by connecting to a given endpoint.
459        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
460        where
461            D: TryInto<tonic::transport::Endpoint>,
462            D::Error: Into<StdError>,
463        {
464            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
465            Ok(Self::new(conn))
466        }
467    }
468    impl<T> QueryServiceClient<T>
469    where
470        T: tonic::client::GrpcService<tonic::body::BoxBody>,
471        T::Error: Into<StdError>,
472        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
473        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
474    {
475        pub fn new(inner: T) -> Self {
476            let inner = tonic::client::Grpc::new(inner);
477            Self { inner }
478        }
479        pub fn with_origin(inner: T, origin: Uri) -> Self {
480            let inner = tonic::client::Grpc::with_origin(inner, origin);
481            Self { inner }
482        }
483        pub fn with_interceptor<F>(
484            inner: T,
485            interceptor: F,
486        ) -> QueryServiceClient<InterceptedService<T, F>>
487        where
488            F: tonic::service::Interceptor,
489            T::ResponseBody: Default,
490            T: tonic::codegen::Service<
491                http::Request<tonic::body::BoxBody>,
492                Response = http::Response<
493                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
494                >,
495            >,
496            <T as tonic::codegen::Service<
497                http::Request<tonic::body::BoxBody>,
498            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
499        {
500            QueryServiceClient::new(InterceptedService::new(inner, interceptor))
501        }
502        /// Compress requests with the given encoding.
503        ///
504        /// This requires the server to support it otherwise it might respond with an
505        /// error.
506        #[must_use]
507        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
508            self.inner = self.inner.send_compressed(encoding);
509            self
510        }
511        /// Enable decompressing responses.
512        #[must_use]
513        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
514            self.inner = self.inner.accept_compressed(encoding);
515            self
516        }
517        /// Limits the maximum size of a decoded message.
518        ///
519        /// Default: `4MB`
520        #[must_use]
521        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
522            self.inner = self.inner.max_decoding_message_size(limit);
523            self
524        }
525        /// Limits the maximum size of an encoded message.
526        ///
527        /// Default: `usize::MAX`
528        #[must_use]
529        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
530            self.inner = self.inner.max_encoding_message_size(limit);
531            self
532        }
533        pub async fn anchor_by_height(
534            &mut self,
535            request: impl tonic::IntoRequest<super::AnchorByHeightRequest>,
536        ) -> std::result::Result<
537            tonic::Response<super::AnchorByHeightResponse>,
538            tonic::Status,
539        > {
540            self.inner
541                .ready()
542                .await
543                .map_err(|e| {
544                    tonic::Status::unknown(
545                        format!("Service was not ready: {}", e.into()),
546                    )
547                })?;
548            let codec = tonic::codec::ProstCodec::default();
549            let path = http::uri::PathAndQuery::from_static(
550                "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight",
551            );
552            let mut req = request.into_request();
553            req.extensions_mut()
554                .insert(
555                    GrpcMethod::new(
556                        "penumbra.core.component.sct.v1.QueryService",
557                        "AnchorByHeight",
558                    ),
559                );
560            self.inner.unary(req, path, codec).await
561        }
562        pub async fn epoch_by_height(
563            &mut self,
564            request: impl tonic::IntoRequest<super::EpochByHeightRequest>,
565        ) -> std::result::Result<
566            tonic::Response<super::EpochByHeightResponse>,
567            tonic::Status,
568        > {
569            self.inner
570                .ready()
571                .await
572                .map_err(|e| {
573                    tonic::Status::unknown(
574                        format!("Service was not ready: {}", e.into()),
575                    )
576                })?;
577            let codec = tonic::codec::ProstCodec::default();
578            let path = http::uri::PathAndQuery::from_static(
579                "/penumbra.core.component.sct.v1.QueryService/EpochByHeight",
580            );
581            let mut req = request.into_request();
582            req.extensions_mut()
583                .insert(
584                    GrpcMethod::new(
585                        "penumbra.core.component.sct.v1.QueryService",
586                        "EpochByHeight",
587                    ),
588                );
589            self.inner.unary(req, path, codec).await
590        }
591        pub async fn timestamp_by_height(
592            &mut self,
593            request: impl tonic::IntoRequest<super::TimestampByHeightRequest>,
594        ) -> std::result::Result<
595            tonic::Response<super::TimestampByHeightResponse>,
596            tonic::Status,
597        > {
598            self.inner
599                .ready()
600                .await
601                .map_err(|e| {
602                    tonic::Status::unknown(
603                        format!("Service was not ready: {}", e.into()),
604                    )
605                })?;
606            let codec = tonic::codec::ProstCodec::default();
607            let path = http::uri::PathAndQuery::from_static(
608                "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight",
609            );
610            let mut req = request.into_request();
611            req.extensions_mut()
612                .insert(
613                    GrpcMethod::new(
614                        "penumbra.core.component.sct.v1.QueryService",
615                        "TimestampByHeight",
616                    ),
617                );
618            self.inner.unary(req, path, codec).await
619        }
620        pub async fn sct_frontier(
621            &mut self,
622            request: impl tonic::IntoRequest<super::SctFrontierRequest>,
623        ) -> std::result::Result<
624            tonic::Response<super::SctFrontierResponse>,
625            tonic::Status,
626        > {
627            self.inner
628                .ready()
629                .await
630                .map_err(|e| {
631                    tonic::Status::unknown(
632                        format!("Service was not ready: {}", e.into()),
633                    )
634                })?;
635            let codec = tonic::codec::ProstCodec::default();
636            let path = http::uri::PathAndQuery::from_static(
637                "/penumbra.core.component.sct.v1.QueryService/SctFrontier",
638            );
639            let mut req = request.into_request();
640            req.extensions_mut()
641                .insert(
642                    GrpcMethod::new(
643                        "penumbra.core.component.sct.v1.QueryService",
644                        "SctFrontier",
645                    ),
646                );
647            self.inner.unary(req, path, codec).await
648        }
649    }
650}
651/// Generated server implementations.
652#[cfg(feature = "rpc")]
653pub mod query_service_server {
654    #![allow(
655        unused_variables,
656        dead_code,
657        missing_docs,
658        clippy::wildcard_imports,
659        clippy::let_unit_value,
660    )]
661    use tonic::codegen::*;
662    /// Generated trait containing gRPC methods that should be implemented for use with QueryServiceServer.
663    #[async_trait]
664    pub trait QueryService: std::marker::Send + std::marker::Sync + 'static {
665        async fn anchor_by_height(
666            &self,
667            request: tonic::Request<super::AnchorByHeightRequest>,
668        ) -> std::result::Result<
669            tonic::Response<super::AnchorByHeightResponse>,
670            tonic::Status,
671        >;
672        async fn epoch_by_height(
673            &self,
674            request: tonic::Request<super::EpochByHeightRequest>,
675        ) -> std::result::Result<
676            tonic::Response<super::EpochByHeightResponse>,
677            tonic::Status,
678        >;
679        async fn timestamp_by_height(
680            &self,
681            request: tonic::Request<super::TimestampByHeightRequest>,
682        ) -> std::result::Result<
683            tonic::Response<super::TimestampByHeightResponse>,
684            tonic::Status,
685        >;
686        async fn sct_frontier(
687            &self,
688            request: tonic::Request<super::SctFrontierRequest>,
689        ) -> std::result::Result<
690            tonic::Response<super::SctFrontierResponse>,
691            tonic::Status,
692        >;
693    }
694    /// Query operations for the SCT component.
695    #[derive(Debug)]
696    pub struct QueryServiceServer<T> {
697        inner: Arc<T>,
698        accept_compression_encodings: EnabledCompressionEncodings,
699        send_compression_encodings: EnabledCompressionEncodings,
700        max_decoding_message_size: Option<usize>,
701        max_encoding_message_size: Option<usize>,
702    }
703    impl<T> QueryServiceServer<T> {
704        pub fn new(inner: T) -> Self {
705            Self::from_arc(Arc::new(inner))
706        }
707        pub fn from_arc(inner: Arc<T>) -> Self {
708            Self {
709                inner,
710                accept_compression_encodings: Default::default(),
711                send_compression_encodings: Default::default(),
712                max_decoding_message_size: None,
713                max_encoding_message_size: None,
714            }
715        }
716        pub fn with_interceptor<F>(
717            inner: T,
718            interceptor: F,
719        ) -> InterceptedService<Self, F>
720        where
721            F: tonic::service::Interceptor,
722        {
723            InterceptedService::new(Self::new(inner), interceptor)
724        }
725        /// Enable decompressing requests with the given encoding.
726        #[must_use]
727        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
728            self.accept_compression_encodings.enable(encoding);
729            self
730        }
731        /// Compress responses with the given encoding, if the client supports it.
732        #[must_use]
733        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
734            self.send_compression_encodings.enable(encoding);
735            self
736        }
737        /// Limits the maximum size of a decoded message.
738        ///
739        /// Default: `4MB`
740        #[must_use]
741        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
742            self.max_decoding_message_size = Some(limit);
743            self
744        }
745        /// Limits the maximum size of an encoded message.
746        ///
747        /// Default: `usize::MAX`
748        #[must_use]
749        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
750            self.max_encoding_message_size = Some(limit);
751            self
752        }
753    }
754    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServiceServer<T>
755    where
756        T: QueryService,
757        B: Body + std::marker::Send + 'static,
758        B::Error: Into<StdError> + std::marker::Send + 'static,
759    {
760        type Response = http::Response<tonic::body::BoxBody>;
761        type Error = std::convert::Infallible;
762        type Future = BoxFuture<Self::Response, Self::Error>;
763        fn poll_ready(
764            &mut self,
765            _cx: &mut Context<'_>,
766        ) -> Poll<std::result::Result<(), Self::Error>> {
767            Poll::Ready(Ok(()))
768        }
769        fn call(&mut self, req: http::Request<B>) -> Self::Future {
770            match req.uri().path() {
771                "/penumbra.core.component.sct.v1.QueryService/AnchorByHeight" => {
772                    #[allow(non_camel_case_types)]
773                    struct AnchorByHeightSvc<T: QueryService>(pub Arc<T>);
774                    impl<
775                        T: QueryService,
776                    > tonic::server::UnaryService<super::AnchorByHeightRequest>
777                    for AnchorByHeightSvc<T> {
778                        type Response = super::AnchorByHeightResponse;
779                        type Future = BoxFuture<
780                            tonic::Response<Self::Response>,
781                            tonic::Status,
782                        >;
783                        fn call(
784                            &mut self,
785                            request: tonic::Request<super::AnchorByHeightRequest>,
786                        ) -> Self::Future {
787                            let inner = Arc::clone(&self.0);
788                            let fut = async move {
789                                <T as QueryService>::anchor_by_height(&inner, request).await
790                            };
791                            Box::pin(fut)
792                        }
793                    }
794                    let accept_compression_encodings = self.accept_compression_encodings;
795                    let send_compression_encodings = self.send_compression_encodings;
796                    let max_decoding_message_size = self.max_decoding_message_size;
797                    let max_encoding_message_size = self.max_encoding_message_size;
798                    let inner = self.inner.clone();
799                    let fut = async move {
800                        let method = AnchorByHeightSvc(inner);
801                        let codec = tonic::codec::ProstCodec::default();
802                        let mut grpc = tonic::server::Grpc::new(codec)
803                            .apply_compression_config(
804                                accept_compression_encodings,
805                                send_compression_encodings,
806                            )
807                            .apply_max_message_size_config(
808                                max_decoding_message_size,
809                                max_encoding_message_size,
810                            );
811                        let res = grpc.unary(method, req).await;
812                        Ok(res)
813                    };
814                    Box::pin(fut)
815                }
816                "/penumbra.core.component.sct.v1.QueryService/EpochByHeight" => {
817                    #[allow(non_camel_case_types)]
818                    struct EpochByHeightSvc<T: QueryService>(pub Arc<T>);
819                    impl<
820                        T: QueryService,
821                    > tonic::server::UnaryService<super::EpochByHeightRequest>
822                    for EpochByHeightSvc<T> {
823                        type Response = super::EpochByHeightResponse;
824                        type Future = BoxFuture<
825                            tonic::Response<Self::Response>,
826                            tonic::Status,
827                        >;
828                        fn call(
829                            &mut self,
830                            request: tonic::Request<super::EpochByHeightRequest>,
831                        ) -> Self::Future {
832                            let inner = Arc::clone(&self.0);
833                            let fut = async move {
834                                <T as QueryService>::epoch_by_height(&inner, request).await
835                            };
836                            Box::pin(fut)
837                        }
838                    }
839                    let accept_compression_encodings = self.accept_compression_encodings;
840                    let send_compression_encodings = self.send_compression_encodings;
841                    let max_decoding_message_size = self.max_decoding_message_size;
842                    let max_encoding_message_size = self.max_encoding_message_size;
843                    let inner = self.inner.clone();
844                    let fut = async move {
845                        let method = EpochByHeightSvc(inner);
846                        let codec = tonic::codec::ProstCodec::default();
847                        let mut grpc = tonic::server::Grpc::new(codec)
848                            .apply_compression_config(
849                                accept_compression_encodings,
850                                send_compression_encodings,
851                            )
852                            .apply_max_message_size_config(
853                                max_decoding_message_size,
854                                max_encoding_message_size,
855                            );
856                        let res = grpc.unary(method, req).await;
857                        Ok(res)
858                    };
859                    Box::pin(fut)
860                }
861                "/penumbra.core.component.sct.v1.QueryService/TimestampByHeight" => {
862                    #[allow(non_camel_case_types)]
863                    struct TimestampByHeightSvc<T: QueryService>(pub Arc<T>);
864                    impl<
865                        T: QueryService,
866                    > tonic::server::UnaryService<super::TimestampByHeightRequest>
867                    for TimestampByHeightSvc<T> {
868                        type Response = super::TimestampByHeightResponse;
869                        type Future = BoxFuture<
870                            tonic::Response<Self::Response>,
871                            tonic::Status,
872                        >;
873                        fn call(
874                            &mut self,
875                            request: tonic::Request<super::TimestampByHeightRequest>,
876                        ) -> Self::Future {
877                            let inner = Arc::clone(&self.0);
878                            let fut = async move {
879                                <T as QueryService>::timestamp_by_height(&inner, request)
880                                    .await
881                            };
882                            Box::pin(fut)
883                        }
884                    }
885                    let accept_compression_encodings = self.accept_compression_encodings;
886                    let send_compression_encodings = self.send_compression_encodings;
887                    let max_decoding_message_size = self.max_decoding_message_size;
888                    let max_encoding_message_size = self.max_encoding_message_size;
889                    let inner = self.inner.clone();
890                    let fut = async move {
891                        let method = TimestampByHeightSvc(inner);
892                        let codec = tonic::codec::ProstCodec::default();
893                        let mut grpc = tonic::server::Grpc::new(codec)
894                            .apply_compression_config(
895                                accept_compression_encodings,
896                                send_compression_encodings,
897                            )
898                            .apply_max_message_size_config(
899                                max_decoding_message_size,
900                                max_encoding_message_size,
901                            );
902                        let res = grpc.unary(method, req).await;
903                        Ok(res)
904                    };
905                    Box::pin(fut)
906                }
907                "/penumbra.core.component.sct.v1.QueryService/SctFrontier" => {
908                    #[allow(non_camel_case_types)]
909                    struct SctFrontierSvc<T: QueryService>(pub Arc<T>);
910                    impl<
911                        T: QueryService,
912                    > tonic::server::UnaryService<super::SctFrontierRequest>
913                    for SctFrontierSvc<T> {
914                        type Response = super::SctFrontierResponse;
915                        type Future = BoxFuture<
916                            tonic::Response<Self::Response>,
917                            tonic::Status,
918                        >;
919                        fn call(
920                            &mut self,
921                            request: tonic::Request<super::SctFrontierRequest>,
922                        ) -> Self::Future {
923                            let inner = Arc::clone(&self.0);
924                            let fut = async move {
925                                <T as QueryService>::sct_frontier(&inner, request).await
926                            };
927                            Box::pin(fut)
928                        }
929                    }
930                    let accept_compression_encodings = self.accept_compression_encodings;
931                    let send_compression_encodings = self.send_compression_encodings;
932                    let max_decoding_message_size = self.max_decoding_message_size;
933                    let max_encoding_message_size = self.max_encoding_message_size;
934                    let inner = self.inner.clone();
935                    let fut = async move {
936                        let method = SctFrontierSvc(inner);
937                        let codec = tonic::codec::ProstCodec::default();
938                        let mut grpc = tonic::server::Grpc::new(codec)
939                            .apply_compression_config(
940                                accept_compression_encodings,
941                                send_compression_encodings,
942                            )
943                            .apply_max_message_size_config(
944                                max_decoding_message_size,
945                                max_encoding_message_size,
946                            );
947                        let res = grpc.unary(method, req).await;
948                        Ok(res)
949                    };
950                    Box::pin(fut)
951                }
952                _ => {
953                    Box::pin(async move {
954                        let mut response = http::Response::new(empty_body());
955                        let headers = response.headers_mut();
956                        headers
957                            .insert(
958                                tonic::Status::GRPC_STATUS,
959                                (tonic::Code::Unimplemented as i32).into(),
960                            );
961                        headers
962                            .insert(
963                                http::header::CONTENT_TYPE,
964                                tonic::metadata::GRPC_CONTENT_TYPE,
965                            );
966                        Ok(response)
967                    })
968                }
969            }
970        }
971    }
972    impl<T> Clone for QueryServiceServer<T> {
973        fn clone(&self) -> Self {
974            let inner = self.inner.clone();
975            Self {
976                inner,
977                accept_compression_encodings: self.accept_compression_encodings,
978                send_compression_encodings: self.send_compression_encodings,
979                max_decoding_message_size: self.max_decoding_message_size,
980                max_encoding_message_size: self.max_encoding_message_size,
981            }
982        }
983    }
984    /// Generated gRPC service name
985    pub const SERVICE_NAME: &str = "penumbra.core.component.sct.v1.QueryService";
986    impl<T> tonic::server::NamedService for QueryServiceServer<T> {
987        const NAME: &'static str = SERVICE_NAME;
988    }
989}