From b89ac4b1d19ed45e2fa9299cd9e8ec305bd7b707 Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:26:54 +0200 Subject: [PATCH 1/8] Add ICQ tests for interchain-security tests (#3494) * Add ICA transfer test to interchain-security tests * Fix comment typo * Output events from sending CosmosTx in ICA transfer test for interchain-security * Separate interchain-security chains with and without ICA module * Fix cfg for interchain-security ICA tests * Add Stride ICQ test to interchain-security tests * Add ics31 feature to interchain-security-ica tests * Add CI job for Stride v12 ICQ tests * Update nix flake --- .github/workflows/integration.yaml | 40 +++++ flake.lock | 12 +- flake.nix | 3 +- .../src/tests/interchain_security/icq.rs | 165 ++++++++++++++++++ .../src/tests/interchain_security/mod.rs | 2 + .../test-framework/src/chain/cli/host_zone.rs | 2 - 6 files changed, 215 insertions(+), 9 deletions(-) create mode 100644 tools/integration-test/src/tests/interchain_security/icq.rs diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index dcf73eb8ec..0f0c4b7c88 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -486,6 +486,46 @@ jobs: test -p ibc-integration-test --features interchain-security,ica --no-fail-fast -- \ --nocapture --test-threads=1 interchain_security:: + interchain-security-icq: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + chain: + - package: stride-consumer-no-admin + command: strided + account_prefix: stride + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + with: + install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install + install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve' + extra_nix_config: | + experimental-features = nix-command flakes + - uses: cachix/cachix-action@v12 + with: + name: cosmos + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: Swatinem/rust-cache@v1 + - uses: actions-rs/cargo@v1 + with: + command: test + args: -p ibc-integration-test --features interchain-security --no-fail-fast --no-run + - env: + RUST_LOG: info + RUST_BACKTRACE: 1 + NO_COLOR_LOG: 1 + CHAIN_COMMAND_PATHS: gaiad,${{ matrix.chain.command }} + ACCOUNT_PREFIXES: cosmos,${{ matrix.chain.account_prefix }} + run: | + nix shell .#gaia9 .#${{ matrix.chain.package }} -c cargo \ + test -p ibc-integration-test --features interchain-security,ics31 --no-fail-fast -- \ + --nocapture --test-threads=1 interchain_security:: + model-based-test: runs-on: ubuntu-20.04 timeout-minutes: 60 diff --git a/flake.lock b/flake.lock index 5cdb8551ef..18a9bcf689 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ "wasmvm_1_beta7-src": "wasmvm_1_beta7-src" }, "locked": { - "lastModified": 1689927892, - "narHash": "sha256-FLucpKEFzqchpCRMKw7BtHNz46bGNRJhkomej+hLWHw=", + "lastModified": 1690188204, + "narHash": "sha256-b1na7/tipiaLQdmAelpyYBpqcHrI+SIrKETZK0j93PA=", "owner": "informalsystems", "repo": "cosmos.nix", - "rev": "199c8cb77e50865a953ad827c431f580c1f7cef6", + "rev": "425e5a99fcfbe78ccd4f65865bcf8f9f8bfd0728", "type": "github" }, "original": { @@ -758,11 +758,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1689844446, - "narHash": "sha256-ud/6XYWbXFAJuTTApWyYlFtlc54NAxChS1T9Ns+qT7M=", + "lastModified": 1690083312, + "narHash": "sha256-I3egwgNXavad1eIjWu1kYyi0u73di/sMmlnQIuzQASk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2d82894fa1e2d23a22f40275a78bfbb09b92ffde", + "rev": "af8cd5ded7735ca1df1a1174864daab75feeb64a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index abf3be1117..3b1ded4f98 100644 --- a/flake.nix +++ b/flake.nix @@ -47,8 +47,9 @@ evmos juno stride - stride-consumer stride-no-admin + stride-consumer-no-admin + stride-consumer migaloo neutron ; diff --git a/tools/integration-test/src/tests/interchain_security/icq.rs b/tools/integration-test/src/tests/interchain_security/icq.rs new file mode 100644 index 0000000000..693a8ccba0 --- /dev/null +++ b/tools/integration-test/src/tests/interchain_security/icq.rs @@ -0,0 +1,165 @@ +//! The following tests are for the Cross-chain Queries, ICS31. +//! These tests require the first chain to be a Gaia chain and +//! the second chain a Stride chain. Only the Stride chain requires +//! to have the ICS31 enabled. +//! +//! The test `ICS31Test` registers the cosmos account as a host-zone +//! using `strided tx stakeibc register-host-zone` in order to have +//! the Stride chain trigger Cross-chain Queries. +//! The test then waits for a Cross-chain Query to be pending and +//! then processed. + +use ibc_relayer::config::{self, ModeConfig}; + +use ibc_test_framework::prelude::*; +use ibc_test_framework::util::random::random_u128_range; +use ibc_test_framework::{ + chain::{ + cli::host_zone::register_host_zone, + config::{ + set_crisis_denom, set_mint_mint_denom, set_staking_bond_denom, set_staking_max_entries, + set_voting_period, + }, + ext::crosschainquery::CrossChainQueryMethodsExt, + }, + framework::binary::channel::run_binary_interchain_security_channel_test, +}; + +#[test] +fn test_ics31_cross_chain_queries() -> Result<(), Error> { + run_binary_interchain_security_channel_test(&InterchainSecurityIcqTest) +} + +struct InterchainSecurityIcqTest; + +impl TestOverrides for InterchainSecurityIcqTest { + fn modify_genesis_file(&self, genesis: &mut serde_json::Value) -> Result<(), Error> { + // Gaia chain genesis file doesn't have `epochs` key. + if let Some(epochs_list) = genesis + .get_mut("app_state") + .and_then(|app_state| app_state.get_mut("epochs")) + .and_then(|epochs| epochs.get_mut("epochs")) + .and_then(|epochs_list| epochs_list.as_array_mut()) + { + for v in epochs_list { + let identifier = v + .get("identifier") + .ok_or_else(|| eyre!("failed to find identifier"))?; + + if identifier.as_str() == Some("stride_epoch") { + let duration = v + .get_mut("duration") + .ok_or_else(|| eyre!("failed to get duration"))?; + + *duration = serde_json::Value::String("20s".to_owned()); + } + } + set_voting_period(genesis, "10s")?; + set_staking_max_entries(genesis, "10")?; + set_staking_bond_denom(genesis, "stake")?; + set_mint_mint_denom(genesis, "stake")?; + set_crisis_denom(genesis, "stake")?; + } + + if genesis + .get_mut("app_state") + .and_then(|app_state| app_state.get("gov")) + .is_some() + { + set_voting_period(genesis, "10s")?; + } + Ok(()) + } + + // When calling `strided tx stakeibc register-host-zone` new channel + // will be created. So the channel worker needs to be enabled. + fn modify_relayer_config(&self, config: &mut Config) { + config.mode = ModeConfig { + connections: config::Connections { enabled: false }, + channels: config::Channels { enabled: true }, + ..Default::default() + }; + // The `ccv_consumer_chain` must be `true` for the Consumer chain. + // The `trusting_period` must be strictly smaller than the `unbonding_period` + // specified in the Consumer chain proposal. The test framework uses 100s in + // the proposal. + for chain_config in config.chains.iter_mut() { + if chain_config.id == ChainId::from_string("ibcconsumer") { + chain_config.ccv_consumer_chain = true; + chain_config.trusting_period = Some(Duration::from_secs(99)); + } + } + } +} + +impl BinaryChannelTest for InterchainSecurityIcqTest { + fn run( + &self, + _config: &TestConfig, + _relayer: RelayerDriver, + chains: ConnectedChains, + channel: ConnectedChannel, + ) -> Result<(), Error> { + let denom_a = chains.node_a.denom(); + let a_to_b_amount = random_u128_range(1000, 5000); + let wallet_a = chains.node_a.wallets().user1().cloned(); + let wallet_b = chains.node_b.wallets().user1().cloned(); + + info!( + "Sending IBC transfer from chain {} to chain {} with amount of {} {}", + chains.chain_id_a(), + chains.chain_id_b(), + a_to_b_amount, + denom_a + ); + + chains.node_a.chain_driver().ibc_transfer_token( + &channel.port_a.as_ref(), + &channel.channel_id_a.as_ref(), + &wallet_a.as_ref(), + &wallet_b.address(), + &denom_a.with_amount(a_to_b_amount).as_ref(), + )?; + + let denom_b = derive_ibc_denom( + &channel.port_b.as_ref(), + &channel.channel_id_b.as_ref(), + &denom_a, + )?; + + chains.node_b.chain_driver().assert_eventual_wallet_amount( + &wallet_b.address(), + &denom_b.with_amount(a_to_b_amount).as_ref(), + )?; + + info!("Registering host-zone"); + // gaiad binary doesn't have the CLI `tx stakeibc register-host-zone` + // if this method is not called with `strided` command_path it will + // fail. + register_host_zone( + chains.chain_id_b().0.as_str(), + chains.node_b.0.chain_driver.command_path.as_str(), + chains.node_b.0.chain_driver.home_path.as_str(), + chains.node_b.0.chain_driver.rpc_listen_address().as_str(), + channel.channel.dst_connection_id().as_str(), + denom_a.0.as_str(), + "cosmos", + denom_b.0.as_str(), + channel.channel_id_a.0.as_str(), + &wallet_b.0.id.to_string(), + )?; + + // Wait for the cross chain query to be pending. + chains + .node_b + .chain_driver() + .assert_pending_cross_chain_query()?; + + // After there is a pending cross chain query, wait for it to be processed + chains + .node_b + .chain_driver() + .assert_processed_cross_chain_query()?; + Ok(()) + } +} diff --git a/tools/integration-test/src/tests/interchain_security/mod.rs b/tools/integration-test/src/tests/interchain_security/mod.rs index 8b0c57ae08..a2acc74d92 100644 --- a/tools/integration-test/src/tests/interchain_security/mod.rs +++ b/tools/integration-test/src/tests/interchain_security/mod.rs @@ -1,3 +1,5 @@ #[cfg(any(doc, feature = "ica"))] pub mod ica_transfer; +#[cfg(any(doc, feature = "ics31"))] +pub mod icq; pub mod simple_transfer; diff --git a/tools/test-framework/src/chain/cli/host_zone.rs b/tools/test-framework/src/chain/cli/host_zone.rs index 16b227c5c9..5ffb53ad77 100644 --- a/tools/test-framework/src/chain/cli/host_zone.rs +++ b/tools/test-framework/src/chain/cli/host_zone.rs @@ -38,8 +38,6 @@ pub fn register_host_zone( chain_id, "--gas", "auto", - "-b", - "block", "--yes", ], )?; From 35f503a23c776992aba9b477ac5bd51018bbb058 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:40:21 +0000 Subject: [PATCH 2/8] Bump dyn-clone from 1.0.11 to 1.0.12 (#3497) --- Cargo.lock | 4 ++-- crates/relayer-types/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b35682726..1f1f7265cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -740,9 +740,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "ecdsa" diff --git a/crates/relayer-types/Cargo.toml b/crates/relayer-types/Cargo.toml index 222be6fbc7..4206e6b0bb 100644 --- a/crates/relayer-types/Cargo.toml +++ b/crates/relayer-types/Cargo.toml @@ -40,7 +40,7 @@ derive_more = { version = "0.99.17", default-features = false, features = ["from uint = { version = "0.9" } itertools = { version = "0.10.3" } primitive-types = { version = "0.12.1", default-features = false, features = ["serde_no_std"] } -dyn-clone = "1.0.8" +dyn-clone = "1.0.12" num-rational = "0.4.1" [dependencies.tendermint] From 3367744653b0b736b865041fed7278f6209aab75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:41:00 +0000 Subject: [PATCH 3/8] Bump signal-hook from 0.3.15 to 0.3.17 (#3500) --- Cargo.lock | 4 ++-- crates/relayer-cli/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f1f7265cb..3614f3d7d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3135,9 +3135,9 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "signal-hook" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", diff --git a/crates/relayer-cli/Cargo.toml b/crates/relayer-cli/Cargo.toml index 47fd3cd6cd..7b7162da82 100644 --- a/crates/relayer-cli/Cargo.toml +++ b/crates/relayer-cli/Cargo.toml @@ -49,7 +49,7 @@ oneline-eyre = "0.1" regex = "1.8.1" serde = { version = "1.0", features = ["serde_derive"] } serde_json = "1" -signal-hook = "0.3.15" +signal-hook = "0.3.17" subtle-encoding = "0.5" tokio = { version = "1.0", features = ["full"] } tracing = "0.1.36" From 98297d25b4eca9258e184ef1d2846492b1a3286c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:04:50 +0000 Subject: [PATCH 4/8] Bump async-trait from 0.1.71 to 0.1.72 (#3515) --- Cargo.lock | 4 ++-- crates/chain-registry/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3614f3d7d2..6dfa426e45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", diff --git a/crates/chain-registry/Cargo.toml b/crates/chain-registry/Cargo.toml index cbd963a489..c981e07c69 100644 --- a/crates/chain-registry/Cargo.toml +++ b/crates/chain-registry/Cargo.toml @@ -16,7 +16,7 @@ ibc-proto = { version = "0.32.0" } ibc-relayer-types = { version = "0.25.0", path = "../relayer-types" } tendermint-rpc = { version = "0.32.0", features = ["http-client", "websocket-client"] } -async-trait = "0.1.69" +async-trait = "0.1.72" flex-error = { version = "0.4.4", default-features = false } futures = { version = "0.3.27", features = ["executor"] } http = "0.2" From 1b5ead5d5e7abd5b01c3662477a16bb1de7d5f22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:05:57 +0000 Subject: [PATCH 5/8] Bump bitcoin from 0.30.0 to 0.30.1 (#3512) --- Cargo.lock | 4 ++-- crates/relayer/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dfa426e45..f185b9f69a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,9 +239,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bitcoin" -version = "0.30.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36f4c848f6bd9ff208128f08751135846cc23ae57d66ab10a22efff1c675f3c" +checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75" dependencies = [ "bech32", "bitcoin-private", diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index ad77a08eb7..3f60b254b5 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -39,7 +39,7 @@ tonic = { version = "0.9", features = ["tls", "tls-roots"] } futures = "0.3.27" crossbeam-channel = "0.5.8" hex = "0.4" -bitcoin = { version = "0.30.0", features = ["serde"] } +bitcoin = { version = "0.30.1", features = ["serde"] } tiny-bip39 = "1.0.0" hdpath = "0.6.3" sha2 = "0.10.6" From 2554fcc5705892a372d1aa2ad298f1563fc2ac15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:06:31 +0000 Subject: [PATCH 6/8] Bump erased-serde from 0.3.27 to 0.3.28 (#3511) --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f185b9f69a..13bdfceb16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -879,9 +879,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f94c0e13118e7d7533271f754a168ae8400e6a1cc043f2bfd53cc7290f1a1de3" +checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" dependencies = [ "serde", ] From 44e8bdb4e1a06651f13705e35d0bfced9e9e2afb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:03:18 +0200 Subject: [PATCH 7/8] Bump Swatinem/rust-cache from 1 to 2 (#3517) Bumps [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) from 1 to 2. - [Release notes](https://github.com/swatinem/rust-cache/releases) - [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md) - [Commits](https://github.com/swatinem/rust-cache/compare/v1...v2) --- updated-dependencies: - dependency-name: Swatinem/rust-cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/integration.yaml | 24 ++++++++++++------------ .github/workflows/misbehaviour.yml | 2 +- .github/workflows/multi-chains.yaml | 2 +- .github/workflows/rust.yml | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 0f0c4b7c88..eaee23632c 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -94,7 +94,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -132,7 +132,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -173,7 +173,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -222,7 +222,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -268,7 +268,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -308,7 +308,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -350,7 +350,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -390,7 +390,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -430,7 +430,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -470,7 +470,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -510,7 +510,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -548,7 +548,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test diff --git a/.github/workflows/misbehaviour.yml b/.github/workflows/misbehaviour.yml index d216b56bf7..d6790317d5 100644 --- a/.github/workflows/misbehaviour.yml +++ b/.github/workflows/misbehaviour.yml @@ -84,7 +84,7 @@ jobs: toolchain: stable override: true - name: Use Rust cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Build Hermes uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/multi-chains.yaml b/.github/workflows/multi-chains.yaml index 8799782351..4b8a44e015 100644 --- a/.github/workflows/multi-chains.yaml +++ b/.github/workflows/multi-chains.yaml @@ -96,7 +96,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0ebbd39bbd..a9495e3d2d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -56,7 +56,7 @@ jobs: toolchain: stable components: clippy override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: name: clippy-all-features @@ -72,7 +72,7 @@ jobs: toolchain: stable components: clippy override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: name: clippy-no-default-features @@ -88,7 +88,7 @@ jobs: with: toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test From dfae38430c3d9b3d6b2ed822212e960271f71735 Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Wed, 2 Aug 2023 17:44:33 +0200 Subject: [PATCH 8/8] Fix interchain-security test bootstrap flakiness and add helper methods to overwrite configs (#3518) --- .../tests/interchain_security/ica_transfer.rs | 21 +++++---------- .../src/tests/interchain_security/icq.rs | 24 +++++------------ .../interchain_security/simple_transfer.rs | 21 ++++----------- .../test-framework/src/bootstrap/consumer.rs | 2 +- .../src/util/interchain_security.rs | 27 +++++++++++++++++++ tools/test-framework/src/util/mod.rs | 1 + 6 files changed, 47 insertions(+), 49 deletions(-) create mode 100644 tools/test-framework/src/util/interchain_security.rs diff --git a/tools/integration-test/src/tests/interchain_security/ica_transfer.rs b/tools/integration-test/src/tests/interchain_security/ica_transfer.rs index f28732198c..fc44ff7fd2 100644 --- a/tools/integration-test/src/tests/interchain_security/ica_transfer.rs +++ b/tools/integration-test/src/tests/interchain_security/ica_transfer.rs @@ -14,11 +14,13 @@ use ibc_relayer_types::bigint::U256; use ibc_relayer_types::signer::Signer; use ibc_relayer_types::timestamp::Timestamp; use ibc_relayer_types::tx_msg::Msg; -use ibc_test_framework::chain::config::set_voting_period; use ibc_test_framework::chain::ext::ica::register_interchain_account; use ibc_test_framework::framework::binary::channel::run_binary_interchain_security_channel_test; use ibc_test_framework::prelude::*; use ibc_test_framework::relayer::channel::assert_eventually_channel_established; +use ibc_test_framework::util::interchain_security::{ + update_genesis_for_consumer_chain, update_relayer_config_for_consumer_chain, +}; #[test] fn test_ics_ica_transfer() -> Result<(), Error> { @@ -46,14 +48,8 @@ impl TestOverrides for InterchainSecurityIcaTransferTest { return Err(Error::generic(eyre!("failed to update genesis file"))); } - // Consumer chain doesn't have a gov key. - if genesis - .get_mut("app_state") - .and_then(|app_state| app_state.get("gov")) - .is_some() - { - set_voting_period(genesis, "10s")?; - } + update_genesis_for_consumer_chain(genesis)?; + Ok(()) } @@ -64,12 +60,7 @@ impl TestOverrides for InterchainSecurityIcaTransferTest { fn modify_relayer_config(&self, config: &mut Config) { config.mode.channels.enabled = true; - for chain_config in config.chains.iter_mut() { - if chain_config.id == ChainId::from_string("ibcconsumer") { - chain_config.ccv_consumer_chain = true; - chain_config.trusting_period = Some(Duration::from_secs(99)); - } - } + update_relayer_config_for_consumer_chain(config); } } diff --git a/tools/integration-test/src/tests/interchain_security/icq.rs b/tools/integration-test/src/tests/interchain_security/icq.rs index 693a8ccba0..8b305f92e2 100644 --- a/tools/integration-test/src/tests/interchain_security/icq.rs +++ b/tools/integration-test/src/tests/interchain_security/icq.rs @@ -12,6 +12,9 @@ use ibc_relayer::config::{self, ModeConfig}; use ibc_test_framework::prelude::*; +use ibc_test_framework::util::interchain_security::{ + update_genesis_for_consumer_chain, update_relayer_config_for_consumer_chain, +}; use ibc_test_framework::util::random::random_u128_range; use ibc_test_framework::{ chain::{ @@ -61,13 +64,8 @@ impl TestOverrides for InterchainSecurityIcqTest { set_crisis_denom(genesis, "stake")?; } - if genesis - .get_mut("app_state") - .and_then(|app_state| app_state.get("gov")) - .is_some() - { - set_voting_period(genesis, "10s")?; - } + update_genesis_for_consumer_chain(genesis)?; + Ok(()) } @@ -79,16 +77,8 @@ impl TestOverrides for InterchainSecurityIcqTest { channels: config::Channels { enabled: true }, ..Default::default() }; - // The `ccv_consumer_chain` must be `true` for the Consumer chain. - // The `trusting_period` must be strictly smaller than the `unbonding_period` - // specified in the Consumer chain proposal. The test framework uses 100s in - // the proposal. - for chain_config in config.chains.iter_mut() { - if chain_config.id == ChainId::from_string("ibcconsumer") { - chain_config.ccv_consumer_chain = true; - chain_config.trusting_period = Some(Duration::from_secs(99)); - } - } + + update_relayer_config_for_consumer_chain(config); } } diff --git a/tools/integration-test/src/tests/interchain_security/simple_transfer.rs b/tools/integration-test/src/tests/interchain_security/simple_transfer.rs index e418c97111..05317917ed 100644 --- a/tools/integration-test/src/tests/interchain_security/simple_transfer.rs +++ b/tools/integration-test/src/tests/interchain_security/simple_transfer.rs @@ -1,9 +1,11 @@ //! The following tests are for the Interchain Security. //! These tests require the first chain to be a Provider chain and //! the second chain a Consumer chain. -use ibc_test_framework::chain::config::set_voting_period; use ibc_test_framework::framework::binary::channel::run_binary_interchain_security_channel_test; use ibc_test_framework::prelude::*; +use ibc_test_framework::util::interchain_security::{ + update_genesis_for_consumer_chain, update_relayer_config_for_consumer_chain, +}; use ibc_test_framework::util::random::random_u128_range; #[test] @@ -15,15 +17,7 @@ struct InterchainSecurityTransferTest; impl TestOverrides for InterchainSecurityTransferTest { fn modify_genesis_file(&self, genesis: &mut serde_json::Value) -> Result<(), Error> { - // Consumer chain doesn't have a gov key. - if genesis - .get_mut("app_state") - .and_then(|app_state| app_state.get("gov")) - .is_some() - { - set_voting_period(genesis, "10s")?; - } - Ok(()) + update_genesis_for_consumer_chain(genesis) } // The `ccv_consumer_chain` must be `true` for the Consumer chain. @@ -31,12 +25,7 @@ impl TestOverrides for InterchainSecurityTransferTest { // specified in the Consumer chain proposal. The test framework uses 100s in // the proposal. fn modify_relayer_config(&self, config: &mut Config) { - for chain_config in config.chains.iter_mut() { - if chain_config.id == ChainId::from_string("ibcconsumer") { - chain_config.ccv_consumer_chain = true; - chain_config.trusting_period = Some(Duration::from_secs(99)); - } - } + update_relayer_config_for_consumer_chain(config); } } diff --git a/tools/test-framework/src/bootstrap/consumer.rs b/tools/test-framework/src/bootstrap/consumer.rs index 6a7c1a4d5c..ae4336b35c 100644 --- a/tools/test-framework/src/bootstrap/consumer.rs +++ b/tools/test-framework/src/bootstrap/consumer.rs @@ -54,7 +54,7 @@ pub fn bootstrap_consumer_node( chain_driver.add_genesis_account(&user2.address, &[&initial_stake, &initial_coin])?; // Wait for the consumer chain to be initialized before querying the genesis - thread::sleep(Duration::from_secs(10)); + thread::sleep(Duration::from_secs(15)); node_a .chain_driver diff --git a/tools/test-framework/src/util/interchain_security.rs b/tools/test-framework/src/util/interchain_security.rs new file mode 100644 index 0000000000..ab7d4e8254 --- /dev/null +++ b/tools/test-framework/src/util/interchain_security.rs @@ -0,0 +1,27 @@ +use crate::chain::config::set_voting_period; +use crate::prelude::*; + +pub fn update_genesis_for_consumer_chain(genesis: &mut serde_json::Value) -> Result<(), Error> { + // Consumer chain doesn't have a gov key. + if genesis + .get_mut("app_state") + .and_then(|app_state| app_state.get("gov")) + .is_some() + { + set_voting_period(genesis, "10s")?; + } + Ok(()) +} + +pub fn update_relayer_config_for_consumer_chain(config: &mut Config) { + // The `ccv_consumer_chain` must be `true` for the Consumer chain. + // The `trusting_period` must be strictly smaller than the `unbonding_period` + // specified in the Consumer chain proposal. The test framework uses 100s in + // the proposal. + for chain_config in config.chains.iter_mut() { + if chain_config.id == ChainId::from_string("ibcconsumer") { + chain_config.ccv_consumer_chain = true; + chain_config.trusting_period = Some(Duration::from_secs(99)); + } + } +} diff --git a/tools/test-framework/src/util/mod.rs b/tools/test-framework/src/util/mod.rs index 1832a2f3c6..bb1d92e67e 100644 --- a/tools/test-framework/src/util/mod.rs +++ b/tools/test-framework/src/util/mod.rs @@ -5,6 +5,7 @@ pub mod array; pub mod assert; pub mod file; +pub mod interchain_security; pub mod random; pub mod retry; pub mod suspend;