Skip to content

Commit

Permalink
Restore generated protos to their specified version (#147)
Browse files Browse the repository at this point in the history
* Fix script to checkout the proper commit and re-generate protos

* Add changelog entry
  • Loading branch information
romac authored Sep 27, 2023
1 parent c04bcf6 commit d31d165
Show file tree
Hide file tree
Showing 29 changed files with 1,158 additions and 1,979 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- Since ibc-proto v0.34.0, the script in charge of generating the Rust proto definitions
has been mistakenly checking out their latest version instead of the one
specified in the corresponding `src/*_COMMIT` file. This has now been fixed
and the protos have therefore been downgraded to their proper versions:
* IBC-Go: v7.3.0,
* Cosmos SDK: v0.47.5
* Interchain Security: v3.1.0
([\#147](https://github.com/cosmos/ibc-proto-rs/pull/147))
14 changes: 3 additions & 11 deletions scripts/sync-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ COSMOS_ICS_DIR=$(mktemp -d /tmp/interchain-security-XXXXXXXX)

pushd "$COSMOS_ICS_DIR"
git clone "$COSMOS_ICS_GIT" .

# We have to name the commit as a branch because
# proto-compiler uses the branch name as the commit
# output. Otherwise it will just output HEAD
git switch -c "$COSMOS_ICS_COMMIT"
git checkout -b "$COSMOS_ICS_COMMIT" "$COSMOS_ICS_COMMIT"

cd proto
buf mod update
Expand All @@ -126,11 +122,7 @@ COSMOS_SDK_DIR=$(mktemp -d /tmp/cosmos-sdk-XXXXXXXX)

pushd "$COSMOS_SDK_DIR"
git clone "$COSMOS_SDK_GIT" .

# We have to name the commit as a branch because
# proto-compiler uses the branch name as the commit
# output. Otherwise it will just output HEAD
git switch -c "$COSMOS_SDK_COMMIT"
git checkout -b "$COSMOS_SDK_COMMIT" "$COSMOS_SDK_COMMIT"

cd proto
buf mod update
Expand All @@ -156,7 +148,7 @@ IBC_GO_DIR=$(mktemp -d /tmp/ibc-go-XXXXXXXX)

pushd "$IBC_GO_DIR"
git clone "$IBC_GO_GIT" .
git switch -c "$IBC_GO_COMMIT"
git checkout -b "$IBC_GO_COMMIT" "$IBC_GO_COMMIT"

cd proto
buf export -v -o ../proto-include
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ pub mod cosmos {
include_proto!("cosmos.base.tendermint.v1beta1.rs");
}
}
pub mod kv {
pub mod v1beta1 {
include_proto!("cosmos.base.kv.v1beta1.rs");
}
}
pub mod snapshots {
pub mod v1beta1 {
include_proto!("cosmos.base.snapshots.v1beta1.rs");
}
}
}
pub mod crypto {
pub mod multisig {
Expand Down
2 changes: 1 addition & 1 deletion src/prost/cosmos.app.v1alpha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct PackageReference {
///
/// When a new version of a module is released and items are added to existing
/// .proto files, these definitions should contain comments of the form
/// "Since: Revision N" where N is an integer revision.
/// "Since Revision N" where N is an integer revision.
///
/// When the module runtime starts up, it will check the pinned proto
/// image and panic if there are runtime protobuf definitions that are not
Expand Down
4 changes: 2 additions & 2 deletions src/prost/cosmos.bank.module.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Module {
/// blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving
/// funds. If left empty it defaults to the list of account names supplied in the auth module configuration as
/// blocked_module_accounts configures exceptional module accounts which should be blocked from receiving funds.
/// If left empty it defaults to the list of account names supplied in the auth module configuration as
/// module_account_permissions
#[prost(string, repeated, tag = "1")]
pub blocked_module_accounts_override: ::prost::alloc::vec::Vec<
Expand Down
213 changes: 0 additions & 213 deletions src/prost/cosmos.bank.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ pub struct MsgUpdateParamsResponse {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSetSendEnabled {
/// authority is the address that controls the module.
#[prost(string, tag = "1")]
pub authority: ::prost::alloc::string::String,
/// send_enabled is the list of entries to add or update.
Expand All @@ -205,25 +204,6 @@ pub struct MsgSetSendEnabled {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSetSendEnabledResponse {}
/// MsgBurn defines a message for burning coins.
///
/// Since: cosmos-sdk 0.51
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgBurn {
#[prost(string, tag = "1")]
pub from_address: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
}
/// MsgBurnResponse defines the Msg/Burn response type.
///
/// Since: cosmos-sdk 0.51
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgBurnResponse {}
/// Generated client implementations.
#[cfg(feature = "client")]
pub mod msg_client {
Expand Down Expand Up @@ -363,34 +343,6 @@ pub mod msg_client {
.insert(GrpcMethod::new("cosmos.bank.v1beta1.Msg", "MultiSend"));
self.inner.unary(req, path, codec).await
}
/// Burn defines a method for burning coins by an account.
///
/// Since: cosmos-sdk 0.51
pub async fn burn(
&mut self,
request: impl tonic::IntoRequest<super::MsgBurn>,
) -> std::result::Result<
tonic::Response<super::MsgBurnResponse>,
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.bank.v1beta1.Msg/Burn",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("cosmos.bank.v1beta1.Msg", "Burn"));
self.inner.unary(req, path, codec).await
}
/// UpdateParams defines a governance operation for updating the x/bank module parameters.
/// The authority is defined in the keeper.
///
Expand Down Expand Up @@ -474,13 +426,6 @@ pub mod msg_server {
tonic::Response<super::MsgMultiSendResponse>,
tonic::Status,
>;
/// Burn defines a method for burning coins by an account.
///
/// Since: cosmos-sdk 0.51
async fn burn(
&self,
request: tonic::Request<super::MsgBurn>,
) -> std::result::Result<tonic::Response<super::MsgBurnResponse>, tonic::Status>;
/// UpdateParams defines a governance operation for updating the x/bank module parameters.
/// The authority is defined in the keeper.
///
Expand Down Expand Up @@ -670,48 +615,6 @@ pub mod msg_server {
};
Box::pin(fut)
}
"/cosmos.bank.v1beta1.Msg/Burn" => {
#[allow(non_camel_case_types)]
struct BurnSvc<T: Msg>(pub Arc<T>);
impl<T: Msg> tonic::server::UnaryService<super::MsgBurn>
for BurnSvc<T> {
type Response = super::MsgBurnResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgBurn>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { (*inner).burn(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
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 = BurnSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.bank.v1beta1.Msg/UpdateParams" => {
#[allow(non_camel_case_types)]
struct UpdateParamsSvc<T: Msg>(pub Arc<T>);
Expand Down Expand Up @@ -875,11 +778,6 @@ pub struct QueryAllBalancesRequest {
pub pagination: ::core::option::Option<
super::super::base::query::v1beta1::PageRequest,
>,
/// resolve_denom is the flag to resolve the denom into a human-readable form from the metadata.
///
/// Since: cosmos-sdk 0.50
#[prost(bool, tag = "3")]
pub resolve_denom: bool,
}
/// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
/// method.
Expand Down Expand Up @@ -1016,7 +914,6 @@ pub struct QueryParamsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
/// params provides the parameters of the bank module.
#[prost(message, optional, tag = "1")]
pub params: ::core::option::Option<Params>,
}
Expand Down Expand Up @@ -1065,26 +962,6 @@ pub struct QueryDenomMetadataResponse {
#[prost(message, optional, tag = "1")]
pub metadata: ::core::option::Option<Metadata>,
}
/// QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method.
/// Identical with QueryDenomMetadataRequest but receives denom as query string.
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDenomMetadataByQueryStringRequest {
/// denom is the coin denom to query the metadata for.
#[prost(string, tag = "1")]
pub denom: ::prost::alloc::string::String,
}
/// QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC
/// method. Identical with QueryDenomMetadataResponse but receives denom as query string in request.
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDenomMetadataByQueryStringResponse {
/// metadata describes and provides all the client information for the requested token.
#[prost(message, optional, tag = "1")]
pub metadata: ::core::option::Option<Metadata>,
}
/// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query,
/// which queries for a paginated set of all account holders of a particular
/// denomination.
Expand Down Expand Up @@ -1488,39 +1365,6 @@ pub mod query_client {
.insert(GrpcMethod::new("cosmos.bank.v1beta1.Query", "DenomMetadata"));
self.inner.unary(req, path, codec).await
}
/// DenomsMetadata queries the client metadata of a given coin denomination.
pub async fn denom_metadata_by_query_string(
&mut self,
request: impl tonic::IntoRequest<
super::QueryDenomMetadataByQueryStringRequest,
>,
) -> std::result::Result<
tonic::Response<super::QueryDenomMetadataByQueryStringResponse>,
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.bank.v1beta1.Query/DenomMetadataByQueryString",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"cosmos.bank.v1beta1.Query",
"DenomMetadataByQueryString",
),
);
self.inner.unary(req, path, codec).await
}
/// DenomsMetadata queries the client metadata for all registered coin
/// denominations.
pub async fn denoms_metadata(
Expand Down Expand Up @@ -1707,14 +1551,6 @@ pub mod query_server {
tonic::Response<super::QueryDenomMetadataResponse>,
tonic::Status,
>;
/// DenomsMetadata queries the client metadata of a given coin denomination.
async fn denom_metadata_by_query_string(
&self,
request: tonic::Request<super::QueryDenomMetadataByQueryStringRequest>,
) -> std::result::Result<
tonic::Response<super::QueryDenomMetadataByQueryStringResponse>,
tonic::Status,
>;
/// DenomsMetadata queries the client metadata for all registered coin
/// denominations.
async fn denoms_metadata(
Expand Down Expand Up @@ -2196,55 +2032,6 @@ pub mod query_server {
};
Box::pin(fut)
}
"/cosmos.bank.v1beta1.Query/DenomMetadataByQueryString" => {
#[allow(non_camel_case_types)]
struct DenomMetadataByQueryStringSvc<T: Query>(pub Arc<T>);
impl<
T: Query,
> tonic::server::UnaryService<
super::QueryDenomMetadataByQueryStringRequest,
> for DenomMetadataByQueryStringSvc<T> {
type Response = super::QueryDenomMetadataByQueryStringResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::QueryDenomMetadataByQueryStringRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
(*inner).denom_metadata_by_query_string(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
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 = DenomMetadataByQueryStringSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/cosmos.bank.v1beta1.Query/DenomsMetadata" => {
#[allow(non_camel_case_types)]
struct DenomsMetadataSvc<T: Query>(pub Arc<T>);
Expand Down
23 changes: 0 additions & 23 deletions src/prost/cosmos.base.abci.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,3 @@ pub struct SearchTxsResult {
#[prost(message, repeated, tag = "6")]
pub txs: ::prost::alloc::vec::Vec<TxResponse>,
}
/// SearchBlocksResult defines a structure for querying blocks pageable
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchBlocksResult {
/// Count of all blocks
#[prost(int64, tag = "1")]
pub total_count: i64,
/// Count of blocks in current page
#[prost(int64, tag = "2")]
pub count: i64,
/// Index of current page, start from 1
#[prost(int64, tag = "3")]
pub page_number: i64,
/// Count of total pages
#[prost(int64, tag = "4")]
pub page_total: i64,
/// Max count blocks per page
#[prost(int64, tag = "5")]
pub limit: i64,
/// List of blocks in current page
#[prost(message, repeated, tag = "6")]
pub blocks: ::prost::alloc::vec::Vec<::tendermint_proto::types::Block>,
}
Loading

0 comments on commit d31d165

Please sign in to comment.