From f349533ce051b3c1a919db9bc89cc3fc5b80d872 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Thu, 15 Aug 2024 12:28:48 +0200 Subject: [PATCH] Use tendermint proto from `tendermint_proto` instead of `tendermint_proto::v0_34` --- .../cosmos-sdk/cosmos.base.abci.v1beta1.rs | 6 +++--- .../cosmos.base.tendermint.v1beta1.rs | 20 +++++++++---------- .../prost/cosmos-sdk/cosmos.consensus.v1.rs | 10 +++++----- .../cosmos-sdk/cosmos.staking.v1beta1.rs | 4 ++-- .../cosmos-sdk/cosmos.store.streaming.abci.rs | 6 +++--- .../prost/cosmos-sdk/cosmos.store.v1beta1.rs | 6 +++--- .../src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs | 4 ++-- proto-build/buf.sdk.gen.yaml | 2 +- proto-build/src/main.rs | 5 ----- 9 files changed, 29 insertions(+), 34 deletions(-) diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs index 141c0e2c..a88950e2 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.abci.v1beta1.rs @@ -50,7 +50,7 @@ pub struct TxResponse { /// /// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 #[prost(message, repeated, tag = "13")] - pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>, + pub events: ::prost::alloc::vec::Vec<::tendermint_proto::abci::Event>, } impl ::prost::Name for TxResponse { const NAME: &'static str = "TxResponse"; @@ -148,7 +148,7 @@ pub struct Result { /// Events contains a slice of Event objects that were emitted during message /// or handler execution. #[prost(message, repeated, tag = "3")] - pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>, + pub events: ::prost::alloc::vec::Vec<::tendermint_proto::abci::Event>, /// msg_responses contains the Msg handler responses type packed in Anys. /// /// Since: cosmos-sdk 0.46 @@ -269,7 +269,7 @@ pub struct SearchBlocksResult { pub limit: i64, /// List of blocks in current page #[prost(message, repeated, tag = "6")] - pub blocks: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::types::Block>, + pub blocks: ::prost::alloc::vec::Vec<::tendermint_proto::types::Block>, } impl ::prost::Name for SearchBlocksResult { const NAME: &'static str = "SearchBlocksResult"; diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs index 2ab3b87d..0a0e046d 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.tendermint.v1beta1.rs @@ -7,11 +7,11 @@ pub struct Block { #[prost(message, optional, tag = "1")] pub header: ::core::option::Option
, #[prost(message, optional, tag = "2")] - pub data: ::core::option::Option<::tendermint_proto::v0_34::types::Data>, + pub data: ::core::option::Option<::tendermint_proto::types::Data>, #[prost(message, optional, tag = "3")] - pub evidence: ::core::option::Option<::tendermint_proto::v0_34::types::EvidenceList>, + pub evidence: ::core::option::Option<::tendermint_proto::types::EvidenceList>, #[prost(message, optional, tag = "4")] - pub last_commit: ::core::option::Option<::tendermint_proto::v0_34::types::Commit>, + pub last_commit: ::core::option::Option<::tendermint_proto::types::Commit>, } impl ::prost::Name for Block { const NAME: &'static str = "Block"; @@ -26,7 +26,7 @@ impl ::prost::Name for Block { pub struct Header { /// basic block info #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option<::tendermint_proto::v0_34::version::Consensus>, + pub version: ::core::option::Option<::tendermint_proto::version::Consensus>, #[prost(string, tag = "2")] pub chain_id: ::prost::alloc::string::String, #[prost(int64, tag = "3")] @@ -35,7 +35,7 @@ pub struct Header { pub time: ::core::option::Option<::tendermint_proto::google::protobuf::Timestamp>, /// prev block info #[prost(message, optional, tag = "5")] - pub last_block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>, + pub last_block_id: ::core::option::Option<::tendermint_proto::types::BlockId>, /// hashes of block data /// /// commit from validators from the last block @@ -190,10 +190,10 @@ impl ::prost::Name for GetBlockByHeightRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetBlockByHeightResponse { #[prost(message, optional, tag = "1")] - pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>, + pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>, /// Deprecated: please use `sdk_block` instead #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>, + pub block: ::core::option::Option<::tendermint_proto::types::Block>, /// Since: cosmos-sdk 0.47 #[prost(message, optional, tag = "3")] pub sdk_block: ::core::option::Option, @@ -221,10 +221,10 @@ impl ::prost::Name for GetLatestBlockRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetLatestBlockResponse { #[prost(message, optional, tag = "1")] - pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>, + pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>, /// Deprecated: please use `sdk_block` instead #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>, + pub block: ::core::option::Option<::tendermint_proto::types::Block>, /// Since: cosmos-sdk 0.47 #[prost(message, optional, tag = "3")] pub sdk_block: ::core::option::Option, @@ -277,7 +277,7 @@ impl ::prost::Name for GetNodeInfoRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetNodeInfoResponse { #[prost(message, optional, tag = "1")] - pub default_node_info: ::core::option::Option<::tendermint_proto::v0_34::p2p::DefaultNodeInfo>, + pub default_node_info: ::core::option::Option<::tendermint_proto::p2p::DefaultNodeInfo>, #[prost(message, optional, tag = "2")] pub application_version: ::core::option::Option, } diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.consensus.v1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.consensus.v1.rs index e1c63adb..378b8e0b 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.consensus.v1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.consensus.v1.rs @@ -18,7 +18,7 @@ pub struct QueryParamsResponse { /// Please note that `params.version` is not populated in this response, it is /// tracked separately in the x/upgrade module. #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option<::tendermint_proto::v0_34::types::ConsensusParams>, + pub params: ::core::option::Option<::tendermint_proto::types::ConsensusParams>, } impl ::prost::Name for QueryParamsResponse { const NAME: &'static str = "QueryParamsResponse"; @@ -40,14 +40,14 @@ pub struct MsgUpdateParams { /// /// NOTE: All parameters must be supplied. #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option<::tendermint_proto::v0_34::types::BlockParams>, + pub block: ::core::option::Option<::tendermint_proto::types::BlockParams>, #[prost(message, optional, tag = "3")] - pub evidence: ::core::option::Option<::tendermint_proto::v0_34::types::EvidenceParams>, + pub evidence: ::core::option::Option<::tendermint_proto::types::EvidenceParams>, #[prost(message, optional, tag = "4")] - pub validator: ::core::option::Option<::tendermint_proto::v0_34::types::ValidatorParams>, + pub validator: ::core::option::Option<::tendermint_proto::types::ValidatorParams>, /// Since: cosmos-sdk 0.50 #[prost(message, optional, tag = "5")] - pub abci: ::core::option::Option<::tendermint_proto::v0_34::types::AbciParams>, + pub abci: ::core::option::Option<::tendermint_proto::types::AbciParams>, } impl ::prost::Name for MsgUpdateParams { const NAME: &'static str = "MsgUpdateParams"; diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs index d4c7bede..2bf9c410 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.staking.v1beta1.rs @@ -107,7 +107,7 @@ impl AuthorizationType { #[derive(Clone, PartialEq, ::prost::Message)] pub struct HistoricalInfo { #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option<::tendermint_proto::v0_34::types::Header>, + pub header: ::core::option::Option<::tendermint_proto::types::Header>, #[prost(message, repeated, tag = "2")] pub valset: ::prost::alloc::vec::Vec, } @@ -566,7 +566,7 @@ impl ::prost::Name for Pool { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidatorUpdates { #[prost(message, repeated, tag = "1")] - pub updates: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::ValidatorUpdate>, + pub updates: ::prost::alloc::vec::Vec<::tendermint_proto::abci::ValidatorUpdate>, } impl ::prost::Name for ValidatorUpdates { const NAME: &'static str = "ValidatorUpdates"; diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.streaming.abci.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.streaming.abci.rs index 085b8efc..38e02465 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.streaming.abci.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.streaming.abci.rs @@ -4,9 +4,9 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListenFinalizeBlockRequest { #[prost(message, optional, tag = "1")] - pub req: ::core::option::Option<::tendermint_proto::v0_34::abci::RequestFinalizeBlock>, + pub req: ::core::option::Option<::tendermint_proto::abci::RequestFinalizeBlock>, #[prost(message, optional, tag = "2")] - pub res: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseFinalizeBlock>, + pub res: ::core::option::Option<::tendermint_proto::abci::ResponseFinalizeBlock>, } impl ::prost::Name for ListenFinalizeBlockRequest { const NAME: &'static str = "ListenFinalizeBlockRequest"; @@ -34,7 +34,7 @@ pub struct ListenCommitRequest { #[prost(int64, tag = "1")] pub block_height: i64, #[prost(message, optional, tag = "2")] - pub res: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseCommit>, + pub res: ::core::option::Option<::tendermint_proto::abci::ResponseCommit>, #[prost(message, repeated, tag = "3")] pub change_set: ::prost::alloc::vec::Vec, } diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.v1beta1.rs index 2aa6d56b..89b0a7e3 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.store.v1beta1.rs @@ -31,14 +31,14 @@ impl ::prost::Name for StoreKvPair { #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockMetadata { #[prost(message, optional, tag = "6")] - pub response_commit: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseCommit>, + pub response_commit: ::core::option::Option<::tendermint_proto::abci::ResponseCommit>, #[prost(message, optional, tag = "7")] pub request_finalize_block: - ::core::option::Option<::tendermint_proto::v0_34::abci::RequestFinalizeBlock>, + ::core::option::Option<::tendermint_proto::abci::RequestFinalizeBlock>, /// TODO: should we renumber this? #[prost(message, optional, tag = "8")] pub response_finalize_block: - ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseFinalizeBlock>, + ::core::option::Option<::tendermint_proto::abci::ResponseFinalizeBlock>, } impl ::prost::Name for BlockMetadata { const NAME: &'static str = "BlockMetadata"; diff --git a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs index 06adafdd..f61d78d8 100644 --- a/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs +++ b/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs @@ -580,9 +580,9 @@ pub struct GetBlockWithTxsResponse { #[prost(message, repeated, tag = "1")] pub txs: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] - pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>, + pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>, #[prost(message, optional, tag = "3")] - pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>, + pub block: ::core::option::Option<::tendermint_proto::types::Block>, /// pagination defines a pagination for the response. #[prost(message, optional, tag = "4")] pub pagination: ::core::option::Option, diff --git a/proto-build/buf.sdk.gen.yaml b/proto-build/buf.sdk.gen.yaml index ba2c9a4b..f758cf1e 100644 --- a/proto-build/buf.sdk.gen.yaml +++ b/proto-build/buf.sdk.gen.yaml @@ -6,7 +6,7 @@ plugins: - compile_well_known_types - enable_type_names - extern_path=.google.protobuf=::tendermint_proto::google::protobuf - - extern_path=.tendermint=::tendermint_proto::v0_34 + - extern_path=.tendermint=::tendermint_proto - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0 out: . - plugin: buf.build/community/neoeinstein-tonic:v0.3.0 diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index c5478bbe..04d92f1f 100644 --- a/proto-build/src/main.rs +++ b/proto-build/src/main.rs @@ -280,8 +280,6 @@ fn copy_and_patch(src: impl AsRef, dest: impl AsRef) -> io::Result<( /// Regex substitutions to apply to the prost-generated output // TODO(tarcieri): use prost-build/tonic-build config for this instead const REPLACEMENTS: &[(&str, &str)] = &[ - // Use `tendermint-proto` proto definitions - ("(super::)+tendermint", "tendermint_proto"), // Feature-gate gRPC client modules ( "/// Generated client implementations.", @@ -300,9 +298,6 @@ fn copy_and_patch(src: impl AsRef, dest: impl AsRef) -> io::Result<( "/// Generated server implementations.\n\ #[cfg(feature = \"grpc\")]", ), - // Use `tendermint_proto` as source of `google.protobuf` types - // TODO(tarcieri): figure out what's wrong with our `buf` config and do it there - ("::prost_types::", "::tendermint_proto::google::protobuf::"), // add the feature flag to the serde definitions ( "impl serde::Serialize for",