diff --git a/.changelog/unreleased/breaking-changes/2776-cosmos-0-46-4-proto-files.md b/.changelog/unreleased/breaking-changes/2776-cosmos-0-46-4-proto-files.md new file mode 100644 index 00000000..c57a4c4b --- /dev/null +++ b/.changelog/unreleased/breaking-changes/2776-cosmos-0-46-4-proto-files.md @@ -0,0 +1,3 @@ +- Update protobufs for Cosmos SDK to v0.46.4 + - Adds the `module_account_by_name` method to the `Query` trait + - ([#2776](https://github.com/informalsystems/hermes/2776)) diff --git a/Cargo.toml b/Cargo.toml index bc1b5414..3f523e58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-proto" -version = "0.21.0" +version = "0.22.0" authors = ["Informal Systems "] edition = "2021" license = "Apache-2.0" diff --git a/src/COSMOS_SDK_COMMIT b/src/COSMOS_SDK_COMMIT index 3ebfaf5f..66ca8a20 100644 --- a/src/COSMOS_SDK_COMMIT +++ b/src/COSMOS_SDK_COMMIT @@ -1 +1 @@ -252c6736161e51342bb7dd6af984082a2b064742 +eb1e3ebf6fcfd56e1f1d8f4c0a6192740bd8a6c1 diff --git a/src/lib.rs b/src/lib.rs index 1ffaca28..62dfd6af 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,6 +71,11 @@ pub mod cosmos { include_proto!("cosmos.base.kv.v1beta1.rs"); } } + pub mod node { + pub mod v1beta1 { + include_proto!("cosmos.base.node.v1beta1.rs"); + } + } pub mod query { pub mod v1beta1 { include_proto!("cosmos.base.query.v1beta1.rs"); diff --git a/src/prost/cosmos.auth.v1beta1.rs b/src/prost/cosmos.auth.v1beta1.rs index ad0e9738..cb689d38 100644 --- a/src/prost/cosmos.auth.v1beta1.rs +++ b/src/prost/cosmos.auth.v1beta1.rs @@ -64,19 +64,6 @@ pub struct QueryAccountRequest { #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, } -/// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. -/// -/// Since: cosmos-sdk 0.46 -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryModuleAccountsRequest { -} -/// QueryParamsResponse is the response type for the Query/Params RPC method. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag="1")] - pub params: ::core::option::Option, -} /// QueryAccountResponse is the response type for the Query/Account RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAccountResponse { @@ -88,6 +75,19 @@ pub struct QueryAccountResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsRequest { } +/// QueryParamsResponse is the response type for the Query/Params RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryParamsResponse { + /// params defines the parameters of the module. + #[prost(message, optional, tag="1")] + pub params: ::core::option::Option, +} +/// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. +/// +/// Since: cosmos-sdk 0.46 +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryModuleAccountsRequest { +} /// QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. /// /// Since: cosmos-sdk 0.46 @@ -96,6 +96,18 @@ pub struct QueryModuleAccountsResponse { #[prost(message, repeated, tag="1")] pub accounts: ::prost::alloc::vec::Vec, } +/// QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryModuleAccountByNameRequest { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, +} +/// QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryModuleAccountByNameResponse { + #[prost(message, optional, tag="1")] + pub account: ::core::option::Option, +} /// Bech32PrefixRequest is the request type for Bech32Prefix rpc method. /// /// Since: cosmos-sdk 0.46 @@ -143,12 +155,19 @@ pub struct AddressStringToBytesResponse { pub address_bytes: ::prost::alloc::vec::Vec, } /// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method +/// +/// Since: cosmos-sdk 0.46.2 #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAccountAddressByIdRequest { + /// id is the account number of the address to be queried. This field + /// should have been an uint64 (like all account numbers), and will be + /// updated to uint64 in a future version of the auth query. #[prost(int64, tag="1")] pub id: i64, } /// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method +/// +/// Since: cosmos-sdk 0.46.2 #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAccountAddressByIdResponse { #[prost(string, tag="1")] @@ -267,7 +286,9 @@ pub mod query_client { ); self.inner.unary(request.into_request(), path, codec).await } - /// AccountAddressByID returns account address based on account id + /// AccountAddressByID returns account address based on account number. + /// + /// Since: cosmos-sdk 0.46.2 pub async fn account_address_by_id( &mut self, request: impl tonic::IntoRequest, @@ -332,6 +353,29 @@ pub mod query_client { ); self.inner.unary(request.into_request(), path, codec).await } + /// ModuleAccountByName returns the module account info by module name + pub async fn module_account_by_name( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cosmos.auth.v1beta1.Query/ModuleAccountByName", + ); + self.inner.unary(request.into_request(), path, codec).await + } /// Bech32Prefix queries bech32Prefix /// /// Since: cosmos-sdk 0.46 @@ -426,7 +470,9 @@ pub mod query_server { &self, request: tonic::Request, ) -> Result, tonic::Status>; - /// AccountAddressByID returns account address based on account id + /// AccountAddressByID returns account address based on account number. + /// + /// Since: cosmos-sdk 0.46.2 async fn account_address_by_id( &self, request: tonic::Request, @@ -446,6 +492,14 @@ pub mod query_server { &self, request: tonic::Request, ) -> Result, tonic::Status>; + /// ModuleAccountByName returns the module account info by module name + async fn module_account_by_name( + &self, + request: tonic::Request, + ) -> Result< + tonic::Response, + tonic::Status, + >; /// Bech32Prefix queries bech32Prefix /// /// Since: cosmos-sdk 0.46 @@ -722,6 +776,48 @@ pub mod query_server { }; Box::pin(fut) } + "/cosmos.auth.v1beta1.Query/ModuleAccountByName" => { + #[allow(non_camel_case_types)] + struct ModuleAccountByNameSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for ModuleAccountByNameSvc { + type Response = super::QueryModuleAccountByNameResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::QueryModuleAccountByNameRequest, + >, + ) -> Self::Future { + let inner = self.0.clone(); + let fut = async move { + (*inner).module_account_by_name(request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ModuleAccountByNameSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } "/cosmos.auth.v1beta1.Query/Bech32Prefix" => { #[allow(non_camel_case_types)] struct Bech32PrefixSvc(pub Arc); diff --git a/src/prost/cosmos.base.node.v1beta1.rs b/src/prost/cosmos.base.node.v1beta1.rs new file mode 100644 index 00000000..b81af6d2 --- /dev/null +++ b/src/prost/cosmos.base.node.v1beta1.rs @@ -0,0 +1,252 @@ +/// ConfigRequest defines the request structure for the Config gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigRequest { +} +/// ConfigResponse defines the response structure for the Config gRPC query. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigResponse { + #[prost(string, tag="1")] + pub minimum_gas_price: ::prost::alloc::string::String, +} +/// Generated client implementations. +#[cfg(feature = "client")] +pub mod service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Service defines the gRPC querier service for node related queries. + #[derive(Debug, Clone)] + pub struct ServiceClient { + inner: tonic::client::Grpc, + } + impl ServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: std::convert::TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Config queries for the operator configuration. + pub async fn config( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cosmos.base.node.v1beta1.Service/Config", + ); + self.inner.unary(request.into_request(), path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "server")] +pub mod service_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + ///Generated trait containing gRPC methods that should be implemented for use with ServiceServer. + #[async_trait] + pub trait Service: Send + Sync + 'static { + /// Config queries for the operator configuration. + async fn config( + &self, + request: tonic::Request, + ) -> Result, tonic::Status>; + } + /// Service defines the gRPC querier service for node related queries. + #[derive(Debug)] + pub struct ServiceServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + } + struct _Inner(Arc); + impl ServiceServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + } + impl tonic::codegen::Service> for ServiceServer + where + T: Service, + B: Body + Send + 'static, + B::Error: Into + Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + let inner = self.inner.clone(); + match req.uri().path() { + "/cosmos.base.node.v1beta1.Service/Config" => { + #[allow(non_camel_case_types)] + struct ConfigSvc(pub Arc); + impl tonic::server::UnaryService + for ConfigSvc { + type Response = super::ConfigResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = self.0.clone(); + let fut = async move { (*inner).config(request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = ConfigSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } + } + } + } + impl Clone for ServiceServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(self.0.clone()) + } + } + impl std::fmt::Debug for _Inner { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } + } + impl tonic::server::NamedService for ServiceServer { + const NAME: &'static str = "cosmos.base.node.v1beta1.Service"; + } +} diff --git a/src/prost/cosmos.tx.signing.v1beta1.rs b/src/prost/cosmos.tx.signing.v1beta1.rs index 755575f1..1cb5a45e 100644 --- a/src/prost/cosmos.tx.signing.v1beta1.rs +++ b/src/prost/cosmos.tx.signing.v1beta1.rs @@ -98,7 +98,7 @@ pub enum SignMode { LegacyAminoJson = 127, /// SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos /// SDK. Ref: - /// + /// /// Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, /// but is not implemented on the SDK by default. To enable EIP-191, you need /// to pass a custom `TxConfig` that has an implementation of diff --git a/src/prost/google.protobuf.rs b/src/prost/google.protobuf.rs index 7d545f7e..b4abf827 100644 --- a/src/prost/google.protobuf.rs +++ b/src/prost/google.protobuf.rs @@ -1041,7 +1041,7 @@ pub mod generated_code_info { /// foo = any.unpack(Foo.class); /// } /// -/// Example 3: Pack and unpack a message in Python. +/// Example 3: Pack and unpack a message in Python. /// /// foo = Foo(...) /// any = Any() @@ -1051,16 +1051,13 @@ pub mod generated_code_info { /// any.Unpack(foo) /// ... /// -/// Example 4: Pack and unpack a message in Go +/// Example 4: Pack and unpack a message in Go /// /// foo := &pb.Foo{...} -/// any, err := anypb.New(foo) -/// if err != nil { -/// ... -/// } +/// any, err := ptypes.MarshalAny(foo) /// ... /// foo := &pb.Foo{} -/// if err := any.UnmarshalTo(foo); err != nil { +/// if err := ptypes.UnmarshalAny(any, foo); err != nil { /// ... /// } /// @@ -1072,7 +1069,7 @@ pub mod generated_code_info { /// /// /// JSON -/// +/// ==== /// The JSON representation of an `Any` value uses the regular /// representation of the deserialized, embedded message, with an /// additional field `@type` which contains the type URL. Example: