Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protos to IBC v3.0.0-rc.0 and Cosmos SDK v0.45.1 #1825

Merged
merged 22 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ecbd198
Update Protocol Buffers definitons to Cosmos SDK v0.45 et IBC v3.0.0-…
romac Jan 31, 2022
217a791
Remove channel version negotiation step during channel handshake
romac Jan 31, 2022
e20c847
Use default port id in `ChanOpenTry` step for compatibility with IBC …
romac Jan 31, 2022
0de6ea9
Bump compatibility bounds used in health check
romac Feb 1, 2022
77e8378
Delete `is_unimplemented_port_query` method
romac Feb 1, 2022
476c585
Remove unused error variants
romac Feb 1, 2022
db6cbad
Add changelog entry
romac Feb 1, 2022
215fe9b
Rename `COSMOS_IBC_COMMIT` to `IBC_GO_COMMIT`
romac Feb 2, 2022
c26cdf5
Do not output version info to _COMMIT files
romac Feb 2, 2022
d1ac089
Unify error message casing (#1841)
romac Feb 4, 2022
1a69c4d
Handle non-standard ports in channel handshake (#1840)
romac Feb 4, 2022
9bfc5cc
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 4, 2022
33c7224
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 11, 2022
b3bbe93
Merge remote-tracking branch 'origin/romac/1797-ibc-v3' into romac/17…
romac Feb 11, 2022
692026b
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 15, 2022
d71ea62
Cleanup error messages in `ChannelError`
romac Feb 16, 2022
a2b93b2
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 17, 2022
3d45ce6
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 17, 2022
f686563
Update protos to Cosmos SDK 0.45.1 and IBC-Go v3.0.0-rc.0
romac Feb 18, 2022
982f5ff
Fix location of changelog entries
romac Feb 18, 2022
41f6283
Fix cargo doc
romac Feb 18, 2022
cfaddb4
Merge branch 'master' into romac/1797-ibc-v3
romac Feb 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Handle non-standard ports in channel handshake
([#1837](https://github.com/informalsystems/ibc-rs/issues/1837))
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/1797-ibc-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Upgrade protos and compatibility to IBC v3.0.0-rc.0 and Cosmos SDK v0.45.1
([#1797](https://github.com/informalsystems/ibc-rs/issues/1797))
8 changes: 4 additions & 4 deletions modules/src/mock/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ mod tests {
// All tests should yield a valid context after initialization.
assert!(
test.ctx.validate().is_ok(),
"Failed in test {} while validating context {:?}",
"failed in test {} while validating context {:?}",
test.name,
test.ctx
);
Expand All @@ -1288,7 +1288,7 @@ mod tests {
test.ctx.advance_host_chain_height();
assert!(
test.ctx.validate().is_ok(),
"Failed in test {} while validating context {:?}",
"failed in test {} while validating context {:?}",
test.name,
test.ctx
);
Expand All @@ -1297,14 +1297,14 @@ mod tests {
assert_eq!(
test.ctx.latest_height(),
next_height,
"Failed while increasing height for context {:?}",
"failed while increasing height for context {:?}",
test.ctx
);
if current_height > Height::new(cv, 0) {
assert_eq!(
test.ctx.host_block(current_height).unwrap().height(),
current_height,
"Failed while fetching height {:?} of context {:?}",
"failed while fetching height {:?} of context {:?}",
current_height,
test.ctx
);
Expand Down
5 changes: 0 additions & 5 deletions proto-compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,3 @@ cargo run -- compile --sdk /tmp/cosmos/sdk --ibc /tmp/cosmos/ibc --out ../proto/

Note: the `--ibc` option is not mandatory; if omitted, then the IBC .proto files from the SDK repository will be used

Additionally, this command will output the commit hash at which the Cosmos SDK is checked out into `$out/COSMOS_SDK_COMMIT` and
similarly the commit hash for IBC-go is saved into `$out/COSMOS_IBC_VERSION`.

The two commit values are exposed via the `ibc_proto::COSMOS_SDK_VERSION` and `ibc_proto::COSMOS_IBC_VERSION`
constants in the `ibc-proto` library.
26 changes: 12 additions & 14 deletions proto-compiler/src/cmd/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ pub struct CompileCmd {
#[argh(option)]
/// generate tonic client code
build_tonic: bool,

}

impl CompileCmd {
pub fn run(&self) {
let tmp_sdk = TempDir::new("ibc-proto-sdk").unwrap();
Self::output_version(&self.sdk, tmp_sdk.as_ref(), "COSMOS_SDK_COMMIT");
Self::compile_sdk_protos(&self.sdk, tmp_sdk.as_ref(), self.ibc.clone(), self.build_tonic);
Self::compile_sdk_protos(
&self.sdk,
tmp_sdk.as_ref(),
self.ibc.clone(),
self.build_tonic,
);

match &self.ibc {
None => {
Expand All @@ -43,7 +46,6 @@ impl CompileCmd {
}
Some(ibc_path) => {
let tmp_ibc = TempDir::new("ibc-proto-ibc-go").unwrap();
Self::output_version(ibc_path, tmp_ibc.as_ref(), "COSMOS_IBC_COMMIT");
Self::compile_ibc_protos(ibc_path, tmp_ibc.as_ref(), self.build_tonic);

// Merge the generated files into a single directory, taking care not to overwrite anything
Expand All @@ -52,15 +54,6 @@ impl CompileCmd {
}
}

fn output_version(dir: &Path, out_dir: &Path, commit_file: &str) {
let repo = Repository::open(dir).unwrap();
let commit = repo.head().unwrap();
let rev = commit.shorthand().unwrap();
let path = out_dir.join(commit_file);

std::fs::write(path, rev).unwrap();
}

fn compile_ibc_protos(ibc_dir: &Path, out_dir: &Path, build_tonic: bool) {
println!(
"[info ] Compiling IBC .proto files to Rust into '{}'...",
Expand Down Expand Up @@ -130,7 +123,12 @@ impl CompileCmd {
}
}

fn compile_sdk_protos(sdk_dir: &Path, out_dir: &Path, ibc_dep: Option<PathBuf>, build_tonic: bool) {
fn compile_sdk_protos(
sdk_dir: &Path,
out_dir: &Path,
ibc_dep: Option<PathBuf>,
build_tonic: bool,
) {
println!(
"[info ] Compiling Cosmos-SDK .proto files to Rust into '{}'...",
out_dir.display()
Expand Down
29 changes: 23 additions & 6 deletions proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ macro_rules! include_proto {
}

/// The version (commit hash) of the Cosmos SDK used when generating this library.
pub const COSMOS_SDK_VERSION: &str = include_str!("prost/COSMOS_SDK_COMMIT");
pub const COSMOS_SDK_COMMIT: &str = include_str!("prost/COSMOS_SDK_COMMIT");

/// The version (commit hash) of IBC Go used when generating this library.
pub const IBC_GO_COMMIT: &str = include_str!("prost/IBC_GO_COMMIT");

pub mod cosmos {
pub mod auth {
Expand Down Expand Up @@ -137,12 +140,31 @@ pub mod cosmos {
}

pub mod ibc {
#[deprecated(since = "0.16.0", note = "Use `ibc_proto::ibc::applications` instead")]
pub mod apps {
pub use super::applications::*;
}
pub mod applications {
pub mod transfer {
pub mod v1 {
include_proto!("ibc.applications.transfer.v1.rs");
}
}
pub mod interchain_accounts {
pub mod v1 {
include_proto!("ibc.applications.interchain_accounts.v1.rs");
}
pub mod controller {
pub mod v1 {
include_proto!("ibc.applications.interchain_accounts.controller.v1.rs");
}
}
pub mod host {
pub mod v1 {
include_proto!("ibc.applications.interchain_accounts.host.v1.rs");
}
}
}
}
pub mod core {
pub mod channel {
Expand Down Expand Up @@ -170,11 +192,6 @@ pub mod ibc {
include_proto!("ibc.core.types.v1.rs");
}
}
pub mod port {
pub mod v1 {
include_proto!("ibc.core.port.v1.rs");
}
}
}
pub mod lightclients {
pub mod localhost {
Expand Down
1 change: 0 additions & 1 deletion proto/src/prost/COSMOS_IBC_COMMIT

This file was deleted.

2 changes: 1 addition & 1 deletion proto/src/prost/COSMOS_SDK_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b75c29fc15d3320ec0c7596dbd7c787c48dccad8
2646b474c7beb0c93d4fafd395ef345f41afc251
1 change: 1 addition & 0 deletions proto/src/prost/IBC_GO_COMMIT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
55344184b3a5a5eb2ad2a96a7b0f715a210494f9
1 change: 0 additions & 1 deletion proto/src/prost/no_std/COSMOS_IBC_COMMIT

This file was deleted.

1 change: 0 additions & 1 deletion proto/src/prost/no_std/COSMOS_SDK_COMMIT

This file was deleted.

4 changes: 4 additions & 0 deletions proto/src/prost/no_std/cosmos.auth.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ pub struct Params {
pub sig_verify_cost_secp256k1: u64,
}
/// QueryAccountsRequest is the request type for the Query/Accounts RPC method.
///
/// Since: cosmos-sdk 0.43
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountsRequest {
/// pagination defines an optional pagination for the request.
#[prost(message, optional, tag = "1")]
pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
}
/// QueryAccountsResponse is the response type for the Query/Accounts RPC method.
///
/// Since: cosmos-sdk 0.43
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountsResponse {
/// accounts are the existing accounts
Expand Down
8 changes: 8 additions & 0 deletions proto/src/prost/no_std/cosmos.base.abci.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ pub struct TxResponse {
/// it's genesis time.
#[prost(string, tag = "12")]
pub timestamp: ::prost::alloc::string::String,
/// Events defines all the events emitted by processing a transaction. Note,
/// these events include those emitted by processing all the messages and those
/// emitted from the ante handler. Whereas Logs contains the events, with
/// additional metadata, emitted only by processing the messages.
///
/// 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>,
}
/// ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
2 changes: 2 additions & 0 deletions proto/src/prost/no_std/cosmos.base.query.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct PageRequest {
#[prost(bool, tag = "4")]
pub count_total: bool,
/// reverse is set to true if results are to be returned in the descending order.
///
/// Since: cosmos-sdk 0.43
#[prost(bool, tag = "5")]
pub reverse: bool,
}
Expand Down
76 changes: 39 additions & 37 deletions proto/src/prost/no_std/cosmos.base.store.v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
/// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes)
/// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and
/// Deletes
/// CommitInfo defines commit information used by the multi-store when committing
/// a version/height.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreKvPair {
/// the store key for the KVStore this pair originates from
pub struct CommitInfo {
#[prost(int64, tag = "1")]
pub version: i64,
#[prost(message, repeated, tag = "2")]
pub store_infos: ::prost::alloc::vec::Vec<StoreInfo>,
}
/// StoreInfo defines store-specific commit information. It contains a reference
/// between a store name and the commit ID.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreInfo {
#[prost(string, tag = "1")]
pub store_key: ::prost::alloc::string::String,
/// true indicates a delete operation, false indicates a set operation
#[prost(bool, tag = "2")]
pub delete: bool,
#[prost(bytes = "vec", tag = "3")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "4")]
pub value: ::prost::alloc::vec::Vec<u8>,
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub commit_id: ::core::option::Option<CommitId>,
}
/// CommitID defines the committment information when a specific store is
/// committed.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitId {
#[prost(int64, tag = "1")]
pub version: i64,
#[prost(bytes = "vec", tag = "2")]
pub hash: ::prost::alloc::vec::Vec<u8>,
}
/// SnapshotItem is an item contained in a rootmulti.Store snapshot.
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -50,30 +61,21 @@ pub struct SnapshotIavlItem {
#[prost(int32, tag = "4")]
pub height: i32,
}
/// CommitInfo defines commit information used by the multi-store when committing
/// a version/height.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitInfo {
#[prost(int64, tag = "1")]
pub version: i64,
#[prost(message, repeated, tag = "2")]
pub store_infos: ::prost::alloc::vec::Vec<StoreInfo>,
}
/// StoreInfo defines store-specific commit information. It contains a reference
/// between a store name and the commit ID.
/// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes)
/// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and
/// Deletes
///
/// Since: cosmos-sdk 0.43
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreInfo {
pub struct StoreKvPair {
/// the store key for the KVStore this pair originates from
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub commit_id: ::core::option::Option<CommitId>,
}
/// CommitID defines the committment information when a specific store is
/// committed.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitId {
#[prost(int64, tag = "1")]
pub version: i64,
#[prost(bytes = "vec", tag = "2")]
pub hash: ::prost::alloc::vec::Vec<u8>,
pub store_key: ::prost::alloc::string::String,
/// true indicates a delete operation, false indicates a set operation
#[prost(bool, tag = "2")]
pub delete: bool,
#[prost(bytes = "vec", tag = "3")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "4")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
1 change: 1 addition & 0 deletions proto/src/prost/no_std/cosmos.base.tendermint.v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub struct VersionInfo {
pub go_version: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "7")]
pub build_deps: ::prost::alloc::vec::Vec<Module>,
/// Since: cosmos-sdk 0.43
#[prost(string, tag = "8")]
pub cosmos_sdk_version: ::prost::alloc::string::String,
}
Expand Down
Loading