Skip to content

Commit

Permalink
Update prost to v0.13 and tonic to v0.12 (#223)
Browse files Browse the repository at this point in the history
* Update prost to v0.13 and tonic to v0.12

* Re-generate protos

* Use patch for `tendermint-proto` and `ics23` until they are released

* Fix clippy warning

* Use released crates

* Add changelog entry
  • Loading branch information
romac authored Jul 18, 2024
1 parent 89239e3 commit 226962f
Show file tree
Hide file tree
Showing 38 changed files with 680 additions and 1,032 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update `prost` to v0.13 and `tonic` to v0.12 ([#223](https://github.com/cosmos/ibc-proto-rs/pull/223))
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ doctest = false
all-features = true

[dependencies]
prost = { version = "0.12.3", default-features = false, features = ["prost-derive"] }
prost = { version = "0.13", default-features = false, features = ["prost-derive"] }
bytes = { version = "1.2", default-features = false }
tonic = { version = "0.11", default-features = false, optional = true }
tonic = { version = "0.12", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
schemars = { version = "0.8", optional = true }
subtle-encoding = { version = "0.5", default-features = false }
base64 = { version = "0.22", default-features = false, features = ["alloc"] }
flex-error = { version = "0.4", default-features = false }
ics23 = { version = "0.11.0", default-features = false }
ics23 = { version = "0.12.0", default-features = false }
informalsystems-pbjson = { version = "0.7.0", optional = true, default-features = false }

## Optional: enabled by the `parity-scale-codec` feature
Expand All @@ -48,7 +48,7 @@ scale-info = { version = "2.1.2", default-features = false, features = [
borsh = { version = "1", default-features = false, features = ["derive"], optional = true }

[dependencies.tendermint-proto]
version = "0.37"
version = "0.38"
default-features = false

[dev-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion src/google.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ pub mod protobuf {
type Error = TimestampOutOfSystemRangeError;

fn try_from(mut timestamp: Timestamp) -> Result<std::time::SystemTime, Self::Error> {
let orig_timestamp = timestamp.clone();
let orig_timestamp = timestamp;

timestamp.normalize();

let system_time = if timestamp.seconds >= 0 {
Expand Down
69 changes: 19 additions & 50 deletions src/prost/cosmos.auth.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl ::prost::Name for ModuleCredential {
}
/// Params defines the parameters for the auth module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Params {
#[prost(uint64, tag = "1")]
pub max_memo_characters: u64,
Expand Down Expand Up @@ -124,7 +124,7 @@ impl ::prost::Name for MsgUpdateParams {
///
/// Since: cosmos-sdk 0.47
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MsgUpdateParamsResponse {}
impl ::prost::Name for MsgUpdateParamsResponse {
const NAME: &'static str = "MsgUpdateParamsResponse";
Expand Down Expand Up @@ -277,19 +277,17 @@ pub mod msg_server {
/// Msg defines the x/auth Msg service.
#[derive(Debug)]
pub struct MsgServer<T: Msg> {
inner: _Inner<T>,
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: Msg> MsgServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
Expand Down Expand Up @@ -352,7 +350,6 @@ pub mod msg_server {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/cosmos.auth.v1beta1.Msg/UpdateParams" => {
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -381,7 +378,6 @@ pub mod msg_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = UpdateParamsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand All @@ -403,8 +399,11 @@ pub mod msg_server {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
Expand All @@ -425,16 +424,6 @@ pub mod msg_server {
}
}
}
impl<T: Msg> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
const NAME: &'static str = "cosmos.auth.v1beta1.Msg";
}
Expand Down Expand Up @@ -524,7 +513,7 @@ impl ::prost::Name for QueryAccountResponse {
}
/// QueryParamsRequest is the request type for the Query/Params RPC method.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QueryParamsRequest {}
impl ::prost::Name for QueryParamsRequest {
const NAME: &'static str = "QueryParamsRequest";
Expand All @@ -538,7 +527,7 @@ impl ::prost::Name for QueryParamsRequest {
}
/// QueryParamsResponse is the response type for the Query/Params RPC method.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
/// params defines the parameters of the module.
#[prost(message, optional, tag = "1")]
Expand All @@ -558,7 +547,7 @@ impl ::prost::Name for QueryParamsResponse {
///
/// Since: cosmos-sdk 0.46
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QueryModuleAccountsRequest {}
impl ::prost::Name for QueryModuleAccountsRequest {
const NAME: &'static str = "QueryModuleAccountsRequest";
Expand Down Expand Up @@ -627,7 +616,7 @@ impl ::prost::Name for QueryModuleAccountByNameResponse {
///
/// Since: cosmos-sdk 0.46
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Bech32PrefixRequest {}
impl ::prost::Name for Bech32PrefixRequest {
const NAME: &'static str = "Bech32PrefixRequest";
Expand Down Expand Up @@ -738,7 +727,7 @@ impl ::prost::Name for AddressStringToBytesResponse {
///
/// Since: cosmos-sdk 0.46.2
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QueryAccountAddressByIdRequest {
/// Deprecated, use account_id instead
///
Expand Down Expand Up @@ -1306,19 +1295,17 @@ pub mod query_server {
/// Query defines the gRPC querier service.
#[derive(Debug)]
pub struct QueryServer<T: Query> {
inner: _Inner<T>,
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: Query> QueryServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
Expand Down Expand Up @@ -1381,7 +1368,6 @@ pub mod query_server {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/cosmos.auth.v1beta1.Query/Accounts" => {
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -1412,7 +1398,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AccountsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1458,7 +1443,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AccountSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1506,7 +1490,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AccountAddressByIDSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1550,7 +1533,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ParamsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1596,7 +1578,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = ModuleAccountsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1644,7 +1625,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
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)
Expand Down Expand Up @@ -1690,7 +1670,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = Bech32PrefixSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1736,7 +1715,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AddressBytesToStringSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1782,7 +1760,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AddressStringToBytesSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand Down Expand Up @@ -1828,7 +1805,6 @@ pub mod query_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = AccountInfoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand All @@ -1850,8 +1826,11 @@ pub mod query_server {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
Expand All @@ -1872,16 +1851,6 @@ pub mod query_server {
}
}
}
impl<T: Query> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Query> tonic::server::NamedService for QueryServer<T> {
const NAME: &'static str = "cosmos.auth.v1beta1.Query";
}
Expand Down
Loading

0 comments on commit 226962f

Please sign in to comment.