Skip to content

Commit

Permalink
Bump tendermint-rs dependencies to v0.34 (#431)
Browse files Browse the repository at this point in the history
This additionally bumps `prost` to v0.12 and `tonic` to v0.10.

This release is the first we've used with tendermint-rs multi-version
support, which for now we've also pinned to (upstream) Tendermint v0.34.
  • Loading branch information
tony-iqlusion authored Oct 3, 2023
1 parent c1b4025 commit 860cb1d
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 208 deletions.
350 changes: 191 additions & 159 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions cosmos-sdk-proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cosmos-sdk-proto"
version = "0.19.0"
version = "0.20.0-pre"
authors = [
"Justin Kilpatrick <justin@althea.net>",
"Greg Szabo <greg@informal.systems>",
Expand All @@ -16,12 +16,12 @@ edition = "2021"
rust-version = "1.63"

[dependencies]
prost = "0.11"
prost-types = "0.11"
tendermint-proto = "0.32"
prost = "0.12"
prost-types = "0.12"
tendermint-proto = "0.34"

# Optional dependencies
tonic = { version = "0.9", optional = true, default-features = false, features = ["codegen", "prost"] }
tonic = { version = "0.10", optional = true, default-features = false, features = ["codegen", "prost"] }

[features]
default = ["grpc-transport"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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::abci::Event>,
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>,
}
/// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -107,7 +107,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::abci::Event>,
pub events: ::prost::alloc::vec::Vec<::tendermint_proto::v0_34::abci::Event>,
/// msg_responses contains the Msg handler responses type packed in Anys.
///
/// Since: cosmos-sdk 0.46
Expand Down
17 changes: 10 additions & 7 deletions cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.base.store.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,30 @@ pub struct StoreKvPair {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockMetadata {
#[prost(message, optional, tag = "1")]
pub request_begin_block: ::core::option::Option<::tendermint_proto::abci::RequestBeginBlock>,
pub request_begin_block:
::core::option::Option<::tendermint_proto::v0_34::abci::RequestBeginBlock>,
#[prost(message, optional, tag = "2")]
pub response_begin_block: ::core::option::Option<::tendermint_proto::abci::ResponseBeginBlock>,
pub response_begin_block:
::core::option::Option<::tendermint_proto::v0_34::abci::ResponseBeginBlock>,
#[prost(message, repeated, tag = "3")]
pub deliver_txs: ::prost::alloc::vec::Vec<block_metadata::DeliverTx>,
#[prost(message, optional, tag = "4")]
pub request_end_block: ::core::option::Option<::tendermint_proto::abci::RequestEndBlock>,
pub request_end_block: ::core::option::Option<::tendermint_proto::v0_34::abci::RequestEndBlock>,
#[prost(message, optional, tag = "5")]
pub response_end_block: ::core::option::Option<::tendermint_proto::abci::ResponseEndBlock>,
pub response_end_block:
::core::option::Option<::tendermint_proto::v0_34::abci::ResponseEndBlock>,
#[prost(message, optional, tag = "6")]
pub response_commit: ::core::option::Option<::tendermint_proto::abci::ResponseCommit>,
pub response_commit: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseCommit>,
}
/// Nested message and enum types in `BlockMetadata`.
pub mod block_metadata {
/// DeliverTx encapulate deliver tx request and response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeliverTx {
#[prost(message, optional, tag = "1")]
pub request: ::core::option::Option<::tendermint_proto::abci::RequestDeliverTx>,
pub request: ::core::option::Option<::tendermint_proto::v0_34::abci::RequestDeliverTx>,
#[prost(message, optional, tag = "2")]
pub response: ::core::option::Option<::tendermint_proto::abci::ResponseDeliverTx>,
pub response: ::core::option::Option<::tendermint_proto::v0_34::abci::ResponseDeliverTx>,
}
}
// @@protoc_insertion_point(module)
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ pub struct Block {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<Header>,
#[prost(message, optional, tag = "2")]
pub data: ::core::option::Option<::tendermint_proto::types::Data>,
pub data: ::core::option::Option<::tendermint_proto::v0_34::types::Data>,
#[prost(message, optional, tag = "3")]
pub evidence: ::core::option::Option<::tendermint_proto::types::EvidenceList>,
pub evidence: ::core::option::Option<::tendermint_proto::v0_34::types::EvidenceList>,
#[prost(message, optional, tag = "4")]
pub last_commit: ::core::option::Option<::tendermint_proto::types::Commit>,
pub last_commit: ::core::option::Option<::tendermint_proto::v0_34::types::Commit>,
}
/// Header defines the structure of a Tendermint block header.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Header {
/// basic block info
#[prost(message, optional, tag = "1")]
pub version: ::core::option::Option<::tendermint_proto::version::Consensus>,
pub version: ::core::option::Option<::tendermint_proto::v0_34::version::Consensus>,
#[prost(string, tag = "2")]
pub chain_id: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
Expand All @@ -26,7 +26,7 @@ pub struct Header {
pub time: ::core::option::Option<::prost_types::Timestamp>,
/// prev block info
#[prost(message, optional, tag = "5")]
pub last_block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
pub last_block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>,
/// hashes of block data
///
/// commit from validators from the last block
Expand Down Expand Up @@ -131,10 +131,10 @@ pub struct GetBlockByHeightRequest {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBlockByHeightResponse {
#[prost(message, optional, tag = "1")]
pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>,
/// Deprecated: please use `sdk_block` instead
#[prost(message, optional, tag = "2")]
pub block: ::core::option::Option<::tendermint_proto::types::Block>,
pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>,
/// Since: cosmos-sdk 0.47
#[prost(message, optional, tag = "3")]
pub sdk_block: ::core::option::Option<Block>,
Expand All @@ -148,10 +148,10 @@ pub struct GetLatestBlockRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLatestBlockResponse {
#[prost(message, optional, tag = "1")]
pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>,
/// Deprecated: please use `sdk_block` instead
#[prost(message, optional, tag = "2")]
pub block: ::core::option::Option<::tendermint_proto::types::Block>,
pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>,
/// Since: cosmos-sdk 0.47
#[prost(message, optional, tag = "3")]
pub sdk_block: ::core::option::Option<Block>,
Expand All @@ -173,7 +173,7 @@ pub struct GetNodeInfoRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeInfoResponse {
#[prost(message, optional, tag = "1")]
pub default_node_info: ::core::option::Option<::tendermint_proto::p2p::DefaultNodeInfo>,
pub default_node_info: ::core::option::Option<::tendermint_proto::v0_34::p2p::DefaultNodeInfo>,
#[prost(message, optional, tag = "2")]
pub application_version: ::core::option::Option<VersionInfo>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl AuthorizationType {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HistoricalInfo {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<::tendermint_proto::types::Header>,
pub header: ::core::option::Option<::tendermint_proto::v0_34::types::Header>,
#[prost(message, repeated, tag = "2")]
pub valset: ::prost::alloc::vec::Vec<Validator>,
}
Expand Down
4 changes: 2 additions & 2 deletions cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ pub struct GetBlockWithTxsResponse {
#[prost(message, repeated, tag = "1")]
pub txs: ::prost::alloc::vec::Vec<Tx>,
#[prost(message, optional, tag = "2")]
pub block_id: ::core::option::Option<::tendermint_proto::types::BlockId>,
pub block_id: ::core::option::Option<::tendermint_proto::v0_34::types::BlockId>,
#[prost(message, optional, tag = "3")]
pub block: ::core::option::Option<::tendermint_proto::types::Block>,
pub block: ::core::option::Option<::tendermint_proto::v0_34::types::Block>,
/// pagination defines a pagination for the response.
#[prost(message, optional, tag = "4")]
pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub struct QueryParamsResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryDenomHashRequest {
/// The denomination trace (\[port_id]/[channel_id])+/[denom\]
/// The denomination trace (\[port_id\]/[channel_id])+/\[denom\]
#[prost(string, tag = "1")]
pub trace: ::prost::alloc::string::String,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct ClientState {
/// chained proof. NOTE: ClientState must stored under
/// `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored
/// under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using
/// the default upgrade module, upgrade_path should be []string{"upgrade",
/// the default upgrade module, upgrade_path should be \[\]string{"upgrade",
/// "upgradedIBCState"}`
#[prost(string, repeated, tag = "9")]
pub upgrade_path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
Expand Down
4 changes: 2 additions & 2 deletions cosmos-sdk-proto/src/prost/ibc-go/ics23.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ pub struct ProofSpec {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InnerSpec {
/// Child order is the ordering of the children node, must count from 0
/// iavl tree is [0, 1] (left then right)
/// merk is [0, 2, 1] (left, right, here)
/// iavl tree is \[0, 1\] (left then right)
/// merk is \[0, 2, 1\] (left, right, here)
#[prost(int32, repeated, tag = "1")]
pub child_order: ::prost::alloc::vec::Vec<i32>,
#[prost(int32, tag = "2")]
Expand Down
8 changes: 4 additions & 4 deletions cosmrs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cosmrs"
version = "0.14.0"
version = "0.15.0-pre"
authors = ["Tony Arcieri <tony@iqlusion.io>"]
license = "Apache-2.0"
repository = "https://github.com/cosmos/cosmos-rust/tree/main/cosmrs"
Expand All @@ -12,20 +12,20 @@ edition = "2021"
rust-version = "1.72"

[dependencies]
cosmos-sdk-proto = { version = "0.19", default-features = false, path = "../cosmos-sdk-proto" }
cosmos-sdk-proto = { version = "=0.20.0-pre", default-features = false, path = "../cosmos-sdk-proto" }
ecdsa = { version = "0.16", features = ["std"] }
eyre = "0.6"
k256 = { version = "0.13", features = ["ecdsa", "sha256"] }
rand_core = { version = "0.6", features = ["std"] }
serde = { version = "1", features = ["serde_derive"] }
serde_json = "1"
subtle-encoding = { version = "0.5", features = ["bech32-preview"] }
tendermint = { version = "0.32", features = ["secp256k1"] }
tendermint = { version = "0.34", features = ["secp256k1"] }
thiserror = "1"

# optional dependencies
bip32 = { version = "0.5", optional = true }
tendermint-rpc = { version = "0.32", optional = true, features = ["http-client"] }
tendermint-rpc = { version = "0.34", optional = true, features = ["http-client"] }
tokio = { version = "1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
9 changes: 5 additions & 4 deletions cosmrs/src/cosmwasm/access_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ impl TryFrom<&proto::cosmwasm::wasm::v1::AccessConfig> for AccessConfig {
type Error = ErrorReport;

fn try_from(proto: &proto::cosmwasm::wasm::v1::AccessConfig) -> Result<AccessConfig> {
let permission = AccessType::from_i32(proto.permission).ok_or(Error::InvalidEnumValue {
name: "permission",
found_value: proto.permission,
})?;
let permission =
AccessType::try_from(proto.permission).map_err(|_| Error::InvalidEnumValue {
name: "permission",
found_value: proto.permission,
})?;

let mut addresses = Vec::with_capacity(proto.addresses.len());

Expand Down
4 changes: 2 additions & 2 deletions cosmrs/src/cosmwasm/contract_code_history_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ impl TryFrom<proto::cosmwasm::wasm::v1::ContractCodeHistoryEntry> for ContractCo
proto: proto::cosmwasm::wasm::v1::ContractCodeHistoryEntry,
) -> Result<ContractCodeHistoryEntry> {
Ok(ContractCodeHistoryEntry {
operation: ContractCodeHistoryOperationType::from_i32(proto.operation).ok_or(
Error::InvalidEnumValue {
operation: ContractCodeHistoryOperationType::try_from(proto.operation).map_err(
|_| Error::InvalidEnumValue {
name: "operation",
found_value: proto.operation,
},
Expand Down
4 changes: 2 additions & 2 deletions cosmrs/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ fn msg_send() {
panic!("check_tx failed: {:?}", tx_commit_response.check_tx);
}

if tx_commit_response.deliver_tx.code.is_err() {
panic!("deliver_tx failed: {:?}", tx_commit_response.deliver_tx);
if tx_commit_response.tx_result.code.is_err() {
panic!("tx_result error: {:?}", tx_commit_response.tx_result);
}

let tx = dev::poll_for_tx(&rpc_client, tx_commit_response.hash).await;
Expand Down
8 changes: 4 additions & 4 deletions proto-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ edition = "2018"
publish = false

[dependencies]
prost = "0.11"
prost-build = "0.11"
tonic = "0.9"
tonic-build = "0.9"
prost = "0.12"
prost-build = "0.12"
tonic = "0.10"
tonic-build = "0.10"
regex = "1"
walkdir = "2"
4 changes: 2 additions & 2 deletions proto-build/buf.sdk.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins:
- plugin: buf.build/community/neoeinstein-prost:v0.2.1
out: .
opt:
- extern_path=.tendermint=::tendermint_proto
- extern_path=.tendermint=::tendermint_proto::v0_34
- plugin: buf.build/community/neoeinstein-tonic:v0.3.0
out: .
opt:
- extern_path=.tendermint=::tendermint_proto
- extern_path=.tendermint=::tendermint_proto::v0_34

0 comments on commit 860cb1d

Please sign in to comment.