juno_rust_proto/prost/cosmos-sdk/
cosmos.upgrade.v1beta1.rs

1/// Plan specifies information about a planned upgrade and when it should occur.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Plan {
5    /// Sets the name for the upgrade. This name will be used by the upgraded
6    /// version of the software to apply any special "on-upgrade" commands during
7    /// the first BeginBlock method after the upgrade is applied. It is also used
8    /// to detect whether a software version can handle a given upgrade. If no
9    /// upgrade handler with this name has been set in the software, it will be
10    /// assumed that the software is out-of-date when the upgrade Time or Height is
11    /// reached and the software will exit.
12    #[prost(string, tag = "1")]
13    pub name: ::prost::alloc::string::String,
14    /// Deprecated: Time based upgrades have been deprecated. Time based upgrade logic
15    /// has been removed from the SDK.
16    /// If this field is not empty, an error will be thrown.
17    #[deprecated]
18    #[prost(message, optional, tag = "2")]
19    pub time: ::core::option::Option<::prost_types::Timestamp>,
20    /// The height at which the upgrade must be performed.
21    /// Only used if Time is not set.
22    #[prost(int64, tag = "3")]
23    pub height: i64,
24    /// Any application specific upgrade info to be included on-chain
25    /// such as a git commit that validators could automatically upgrade to
26    #[prost(string, tag = "4")]
27    pub info: ::prost::alloc::string::String,
28    /// Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been
29    /// moved to the IBC module in the sub module 02-client.
30    /// If this field is not empty, an error will be thrown.
31    #[deprecated]
32    #[prost(message, optional, tag = "5")]
33    pub upgraded_client_state: ::core::option::Option<::prost_types::Any>,
34}
35/// SoftwareUpgradeProposal is a gov Content type for initiating a software
36/// upgrade.
37#[allow(clippy::derive_partial_eq_without_eq)]
38#[derive(Clone, PartialEq, ::prost::Message)]
39pub struct SoftwareUpgradeProposal {
40    #[prost(string, tag = "1")]
41    pub title: ::prost::alloc::string::String,
42    #[prost(string, tag = "2")]
43    pub description: ::prost::alloc::string::String,
44    #[prost(message, optional, tag = "3")]
45    pub plan: ::core::option::Option<Plan>,
46}
47/// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software
48/// upgrade.
49#[allow(clippy::derive_partial_eq_without_eq)]
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct CancelSoftwareUpgradeProposal {
52    #[prost(string, tag = "1")]
53    pub title: ::prost::alloc::string::String,
54    #[prost(string, tag = "2")]
55    pub description: ::prost::alloc::string::String,
56}
57/// ModuleVersion specifies a module and its consensus version.
58///
59/// Since: cosmos-sdk 0.43
60#[allow(clippy::derive_partial_eq_without_eq)]
61#[derive(Clone, PartialEq, ::prost::Message)]
62pub struct ModuleVersion {
63    /// name of the app module
64    #[prost(string, tag = "1")]
65    pub name: ::prost::alloc::string::String,
66    /// consensus version of the app module
67    #[prost(uint64, tag = "2")]
68    pub version: u64,
69}
70/// QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC
71/// method.
72#[allow(clippy::derive_partial_eq_without_eq)]
73#[derive(Clone, PartialEq, ::prost::Message)]
74pub struct QueryCurrentPlanRequest {}
75/// QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC
76/// method.
77#[allow(clippy::derive_partial_eq_without_eq)]
78#[derive(Clone, PartialEq, ::prost::Message)]
79pub struct QueryCurrentPlanResponse {
80    /// plan is the current upgrade plan.
81    #[prost(message, optional, tag = "1")]
82    pub plan: ::core::option::Option<Plan>,
83}
84/// QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC
85/// method.
86#[allow(clippy::derive_partial_eq_without_eq)]
87#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct QueryAppliedPlanRequest {
89    /// name is the name of the applied plan to query for.
90    #[prost(string, tag = "1")]
91    pub name: ::prost::alloc::string::String,
92}
93/// QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC
94/// method.
95#[allow(clippy::derive_partial_eq_without_eq)]
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct QueryAppliedPlanResponse {
98    /// height is the block height at which the plan was applied.
99    #[prost(int64, tag = "1")]
100    pub height: i64,
101}
102/// QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState
103/// RPC method.
104#[allow(clippy::derive_partial_eq_without_eq)]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct QueryUpgradedConsensusStateRequest {
107    /// last height of the current chain must be sent in request
108    /// as this is the height under which next consensus state is stored
109    #[prost(int64, tag = "1")]
110    pub last_height: i64,
111}
112/// QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState
113/// RPC method.
114#[allow(clippy::derive_partial_eq_without_eq)]
115#[derive(Clone, PartialEq, ::prost::Message)]
116pub struct QueryUpgradedConsensusStateResponse {
117    /// Since: cosmos-sdk 0.43
118    #[prost(bytes = "vec", tag = "2")]
119    pub upgraded_consensus_state: ::prost::alloc::vec::Vec<u8>,
120}
121/// QueryModuleVersionsRequest is the request type for the Query/ModuleVersions
122/// RPC method.
123///
124/// Since: cosmos-sdk 0.43
125#[allow(clippy::derive_partial_eq_without_eq)]
126#[derive(Clone, PartialEq, ::prost::Message)]
127pub struct QueryModuleVersionsRequest {
128    /// module_name is a field to query a specific module
129    /// consensus version from state. Leaving this empty will
130    /// fetch the full list of module versions from state
131    #[prost(string, tag = "1")]
132    pub module_name: ::prost::alloc::string::String,
133}
134/// QueryModuleVersionsResponse is the response type for the Query/ModuleVersions
135/// RPC method.
136///
137/// Since: cosmos-sdk 0.43
138#[allow(clippy::derive_partial_eq_without_eq)]
139#[derive(Clone, PartialEq, ::prost::Message)]
140pub struct QueryModuleVersionsResponse {
141    /// module_versions is a list of module names with their consensus versions.
142    #[prost(message, repeated, tag = "1")]
143    pub module_versions: ::prost::alloc::vec::Vec<ModuleVersion>,
144}
145/// Generated client implementations.
146#[cfg(feature = "grpc")]
147#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
148pub mod query_client {
149    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
150    use tonic::codegen::http::Uri;
151    use tonic::codegen::*;
152    /// Query defines the gRPC upgrade querier service.
153    #[derive(Debug, Clone)]
154    pub struct QueryClient<T> {
155        inner: tonic::client::Grpc<T>,
156    }
157    #[cfg(feature = "grpc-transport")]
158    #[cfg_attr(docsrs, doc(cfg(feature = "grpc-transport")))]
159    impl QueryClient<tonic::transport::Channel> {
160        /// Attempt to create a new client by connecting to a given endpoint.
161        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
162        where
163            D: std::convert::TryInto<tonic::transport::Endpoint>,
164            D::Error: Into<StdError>,
165        {
166            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
167            Ok(Self::new(conn))
168        }
169    }
170    impl<T> QueryClient<T>
171    where
172        T: tonic::client::GrpcService<tonic::body::BoxBody>,
173        T::Error: Into<StdError>,
174        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
175        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
176    {
177        pub fn new(inner: T) -> Self {
178            let inner = tonic::client::Grpc::new(inner);
179            Self { inner }
180        }
181        pub fn with_origin(inner: T, origin: Uri) -> Self {
182            let inner = tonic::client::Grpc::with_origin(inner, origin);
183            Self { inner }
184        }
185        pub fn with_interceptor<F>(
186            inner: T,
187            interceptor: F,
188        ) -> QueryClient<InterceptedService<T, F>>
189        where
190            F: tonic::service::Interceptor,
191            T::ResponseBody: Default,
192            T: tonic::codegen::Service<
193                http::Request<tonic::body::BoxBody>,
194                Response = http::Response<
195                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
196                >,
197            >,
198            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
199                Into<StdError> + Send + Sync,
200        {
201            QueryClient::new(InterceptedService::new(inner, interceptor))
202        }
203        /// Compress requests with the given encoding.
204        ///
205        /// This requires the server to support it otherwise it might respond with an
206        /// error.
207        #[must_use]
208        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
209            self.inner = self.inner.send_compressed(encoding);
210            self
211        }
212        /// Enable decompressing responses.
213        #[must_use]
214        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
215            self.inner = self.inner.accept_compressed(encoding);
216            self
217        }
218        /// CurrentPlan queries the current upgrade plan.
219        pub async fn current_plan(
220            &mut self,
221            request: impl tonic::IntoRequest<super::QueryCurrentPlanRequest>,
222        ) -> Result<tonic::Response<super::QueryCurrentPlanResponse>, tonic::Status> {
223            self.inner.ready().await.map_err(|e| {
224                tonic::Status::new(
225                    tonic::Code::Unknown,
226                    format!("Service was not ready: {}", e.into()),
227                )
228            })?;
229            let codec = tonic::codec::ProstCodec::default();
230            let path =
231                http::uri::PathAndQuery::from_static("/cosmos.upgrade.v1beta1.Query/CurrentPlan");
232            self.inner.unary(request.into_request(), path, codec).await
233        }
234        /// AppliedPlan queries a previously applied upgrade plan by its name.
235        pub async fn applied_plan(
236            &mut self,
237            request: impl tonic::IntoRequest<super::QueryAppliedPlanRequest>,
238        ) -> Result<tonic::Response<super::QueryAppliedPlanResponse>, tonic::Status> {
239            self.inner.ready().await.map_err(|e| {
240                tonic::Status::new(
241                    tonic::Code::Unknown,
242                    format!("Service was not ready: {}", e.into()),
243                )
244            })?;
245            let codec = tonic::codec::ProstCodec::default();
246            let path =
247                http::uri::PathAndQuery::from_static("/cosmos.upgrade.v1beta1.Query/AppliedPlan");
248            self.inner.unary(request.into_request(), path, codec).await
249        }
250        /// UpgradedConsensusState queries the consensus state that will serve
251        /// as a trusted kernel for the next version of this chain. It will only be
252        /// stored at the last height of this chain.
253        /// UpgradedConsensusState RPC not supported with legacy querier
254        /// This rpc is deprecated now that IBC has its own replacement
255        /// (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54)
256        pub async fn upgraded_consensus_state(
257            &mut self,
258            request: impl tonic::IntoRequest<super::QueryUpgradedConsensusStateRequest>,
259        ) -> Result<tonic::Response<super::QueryUpgradedConsensusStateResponse>, tonic::Status>
260        {
261            self.inner.ready().await.map_err(|e| {
262                tonic::Status::new(
263                    tonic::Code::Unknown,
264                    format!("Service was not ready: {}", e.into()),
265                )
266            })?;
267            let codec = tonic::codec::ProstCodec::default();
268            let path = http::uri::PathAndQuery::from_static(
269                "/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState",
270            );
271            self.inner.unary(request.into_request(), path, codec).await
272        }
273        /// ModuleVersions queries the list of module versions from state.
274        ///
275        /// Since: cosmos-sdk 0.43
276        pub async fn module_versions(
277            &mut self,
278            request: impl tonic::IntoRequest<super::QueryModuleVersionsRequest>,
279        ) -> Result<tonic::Response<super::QueryModuleVersionsResponse>, tonic::Status> {
280            self.inner.ready().await.map_err(|e| {
281                tonic::Status::new(
282                    tonic::Code::Unknown,
283                    format!("Service was not ready: {}", e.into()),
284                )
285            })?;
286            let codec = tonic::codec::ProstCodec::default();
287            let path = http::uri::PathAndQuery::from_static(
288                "/cosmos.upgrade.v1beta1.Query/ModuleVersions",
289            );
290            self.inner.unary(request.into_request(), path, codec).await
291        }
292    }
293}
294/// Generated server implementations.
295#[cfg(feature = "grpc")]
296#[cfg_attr(docsrs, doc(cfg(feature = "grpc")))]
297pub mod query_server {
298    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
299    use tonic::codegen::*;
300    /// Generated trait containing gRPC methods that should be implemented for use with QueryServer.
301    #[async_trait]
302    pub trait Query: Send + Sync + 'static {
303        /// CurrentPlan queries the current upgrade plan.
304        async fn current_plan(
305            &self,
306            request: tonic::Request<super::QueryCurrentPlanRequest>,
307        ) -> Result<tonic::Response<super::QueryCurrentPlanResponse>, tonic::Status>;
308        /// AppliedPlan queries a previously applied upgrade plan by its name.
309        async fn applied_plan(
310            &self,
311            request: tonic::Request<super::QueryAppliedPlanRequest>,
312        ) -> Result<tonic::Response<super::QueryAppliedPlanResponse>, tonic::Status>;
313        /// UpgradedConsensusState queries the consensus state that will serve
314        /// as a trusted kernel for the next version of this chain. It will only be
315        /// stored at the last height of this chain.
316        /// UpgradedConsensusState RPC not supported with legacy querier
317        /// This rpc is deprecated now that IBC has its own replacement
318        /// (https://github.com/cosmos/ibc-go/blob/2c880a22e9f9cc75f62b527ca94aa75ce1106001/proto/ibc/core/client/v1/query.proto#L54)
319        async fn upgraded_consensus_state(
320            &self,
321            request: tonic::Request<super::QueryUpgradedConsensusStateRequest>,
322        ) -> Result<tonic::Response<super::QueryUpgradedConsensusStateResponse>, tonic::Status>;
323        /// ModuleVersions queries the list of module versions from state.
324        ///
325        /// Since: cosmos-sdk 0.43
326        async fn module_versions(
327            &self,
328            request: tonic::Request<super::QueryModuleVersionsRequest>,
329        ) -> Result<tonic::Response<super::QueryModuleVersionsResponse>, tonic::Status>;
330    }
331    /// Query defines the gRPC upgrade querier service.
332    #[derive(Debug)]
333    pub struct QueryServer<T: Query> {
334        inner: _Inner<T>,
335        accept_compression_encodings: EnabledCompressionEncodings,
336        send_compression_encodings: EnabledCompressionEncodings,
337    }
338    struct _Inner<T>(Arc<T>);
339    impl<T: Query> QueryServer<T> {
340        pub fn new(inner: T) -> Self {
341            Self::from_arc(Arc::new(inner))
342        }
343        pub fn from_arc(inner: Arc<T>) -> Self {
344            let inner = _Inner(inner);
345            Self {
346                inner,
347                accept_compression_encodings: Default::default(),
348                send_compression_encodings: Default::default(),
349            }
350        }
351        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
352        where
353            F: tonic::service::Interceptor,
354        {
355            InterceptedService::new(Self::new(inner), interceptor)
356        }
357        /// Enable decompressing requests with the given encoding.
358        #[must_use]
359        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
360            self.accept_compression_encodings.enable(encoding);
361            self
362        }
363        /// Compress responses with the given encoding, if the client supports it.
364        #[must_use]
365        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
366            self.send_compression_encodings.enable(encoding);
367            self
368        }
369    }
370    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
371    where
372        T: Query,
373        B: Body + Send + 'static,
374        B::Error: Into<StdError> + Send + 'static,
375    {
376        type Response = http::Response<tonic::body::BoxBody>;
377        type Error = std::convert::Infallible;
378        type Future = BoxFuture<Self::Response, Self::Error>;
379        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
380            Poll::Ready(Ok(()))
381        }
382        fn call(&mut self, req: http::Request<B>) -> Self::Future {
383            let inner = self.inner.clone();
384            match req.uri().path() {
385                "/cosmos.upgrade.v1beta1.Query/CurrentPlan" => {
386                    #[allow(non_camel_case_types)]
387                    struct CurrentPlanSvc<T: Query>(pub Arc<T>);
388                    impl<T: Query> tonic::server::UnaryService<super::QueryCurrentPlanRequest> for CurrentPlanSvc<T> {
389                        type Response = super::QueryCurrentPlanResponse;
390                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
391                        fn call(
392                            &mut self,
393                            request: tonic::Request<super::QueryCurrentPlanRequest>,
394                        ) -> Self::Future {
395                            let inner = self.0.clone();
396                            let fut = async move { (*inner).current_plan(request).await };
397                            Box::pin(fut)
398                        }
399                    }
400                    let accept_compression_encodings = self.accept_compression_encodings;
401                    let send_compression_encodings = self.send_compression_encodings;
402                    let inner = self.inner.clone();
403                    let fut = async move {
404                        let inner = inner.0;
405                        let method = CurrentPlanSvc(inner);
406                        let codec = tonic::codec::ProstCodec::default();
407                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
408                            accept_compression_encodings,
409                            send_compression_encodings,
410                        );
411                        let res = grpc.unary(method, req).await;
412                        Ok(res)
413                    };
414                    Box::pin(fut)
415                }
416                "/cosmos.upgrade.v1beta1.Query/AppliedPlan" => {
417                    #[allow(non_camel_case_types)]
418                    struct AppliedPlanSvc<T: Query>(pub Arc<T>);
419                    impl<T: Query> tonic::server::UnaryService<super::QueryAppliedPlanRequest> for AppliedPlanSvc<T> {
420                        type Response = super::QueryAppliedPlanResponse;
421                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
422                        fn call(
423                            &mut self,
424                            request: tonic::Request<super::QueryAppliedPlanRequest>,
425                        ) -> Self::Future {
426                            let inner = self.0.clone();
427                            let fut = async move { (*inner).applied_plan(request).await };
428                            Box::pin(fut)
429                        }
430                    }
431                    let accept_compression_encodings = self.accept_compression_encodings;
432                    let send_compression_encodings = self.send_compression_encodings;
433                    let inner = self.inner.clone();
434                    let fut = async move {
435                        let inner = inner.0;
436                        let method = AppliedPlanSvc(inner);
437                        let codec = tonic::codec::ProstCodec::default();
438                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
439                            accept_compression_encodings,
440                            send_compression_encodings,
441                        );
442                        let res = grpc.unary(method, req).await;
443                        Ok(res)
444                    };
445                    Box::pin(fut)
446                }
447                "/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState" => {
448                    #[allow(non_camel_case_types)]
449                    struct UpgradedConsensusStateSvc<T: Query>(pub Arc<T>);
450                    impl<T: Query>
451                        tonic::server::UnaryService<super::QueryUpgradedConsensusStateRequest>
452                        for UpgradedConsensusStateSvc<T>
453                    {
454                        type Response = super::QueryUpgradedConsensusStateResponse;
455                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
456                        fn call(
457                            &mut self,
458                            request: tonic::Request<super::QueryUpgradedConsensusStateRequest>,
459                        ) -> Self::Future {
460                            let inner = self.0.clone();
461                            let fut =
462                                async move { (*inner).upgraded_consensus_state(request).await };
463                            Box::pin(fut)
464                        }
465                    }
466                    let accept_compression_encodings = self.accept_compression_encodings;
467                    let send_compression_encodings = self.send_compression_encodings;
468                    let inner = self.inner.clone();
469                    let fut = async move {
470                        let inner = inner.0;
471                        let method = UpgradedConsensusStateSvc(inner);
472                        let codec = tonic::codec::ProstCodec::default();
473                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
474                            accept_compression_encodings,
475                            send_compression_encodings,
476                        );
477                        let res = grpc.unary(method, req).await;
478                        Ok(res)
479                    };
480                    Box::pin(fut)
481                }
482                "/cosmos.upgrade.v1beta1.Query/ModuleVersions" => {
483                    #[allow(non_camel_case_types)]
484                    struct ModuleVersionsSvc<T: Query>(pub Arc<T>);
485                    impl<T: Query> tonic::server::UnaryService<super::QueryModuleVersionsRequest>
486                        for ModuleVersionsSvc<T>
487                    {
488                        type Response = super::QueryModuleVersionsResponse;
489                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
490                        fn call(
491                            &mut self,
492                            request: tonic::Request<super::QueryModuleVersionsRequest>,
493                        ) -> Self::Future {
494                            let inner = self.0.clone();
495                            let fut = async move { (*inner).module_versions(request).await };
496                            Box::pin(fut)
497                        }
498                    }
499                    let accept_compression_encodings = self.accept_compression_encodings;
500                    let send_compression_encodings = self.send_compression_encodings;
501                    let inner = self.inner.clone();
502                    let fut = async move {
503                        let inner = inner.0;
504                        let method = ModuleVersionsSvc(inner);
505                        let codec = tonic::codec::ProstCodec::default();
506                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
507                            accept_compression_encodings,
508                            send_compression_encodings,
509                        );
510                        let res = grpc.unary(method, req).await;
511                        Ok(res)
512                    };
513                    Box::pin(fut)
514                }
515                _ => Box::pin(async move {
516                    Ok(http::Response::builder()
517                        .status(200)
518                        .header("grpc-status", "12")
519                        .header("content-type", "application/grpc")
520                        .body(empty_body())
521                        .unwrap())
522                }),
523            }
524        }
525    }
526    impl<T: Query> Clone for QueryServer<T> {
527        fn clone(&self) -> Self {
528            let inner = self.inner.clone();
529            Self {
530                inner,
531                accept_compression_encodings: self.accept_compression_encodings,
532                send_compression_encodings: self.send_compression_encodings,
533            }
534        }
535    }
536    impl<T: Query> Clone for _Inner<T> {
537        fn clone(&self) -> Self {
538            Self(self.0.clone())
539        }
540    }
541    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
542        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
543            write!(f, "{:?}", self.0)
544        }
545    }
546    impl<T: Query> tonic::server::NamedService for QueryServer<T> {
547        const NAME: &'static str = "cosmos.upgrade.v1beta1.Query";
548    }
549}