From 1607f4b5ed9de4ac1460c0bbe99a80557c253489 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:33:02 +0200 Subject: [PATCH 1/3] Bump toml from 0.8.16 to 0.8.19 (#4128) Bumps [toml](https://github.com/toml-rs/toml) from 0.8.16 to 0.8.19. - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.16...toml-v0.8.19) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d20910950e..6b392b6afb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1541,7 +1541,7 @@ dependencies = [ "tendermint", "tendermint-rpc", "time", - "toml 0.8.16", + "toml 0.8.19", "tonic", ] @@ -1625,7 +1625,7 @@ dependencies = [ "tiny-keccak", "tokio", "tokio-stream", - "toml 0.8.16", + "toml 0.8.19", "tonic", "tracing", "tracing-subscriber", @@ -1684,7 +1684,7 @@ dependencies = [ "reqwest", "serde", "tokio", - "toml 0.8.16", + "toml 0.8.19", "tracing", ] @@ -1765,7 +1765,7 @@ dependencies = [ "subtle-encoding", "tendermint-rpc", "tokio", - "toml 0.8.16", + "toml 0.8.19", "tonic", "tracing", "tracing-subscriber", @@ -3350,7 +3350,7 @@ dependencies = [ "serde", "serde_json", "tendermint", - "toml 0.8.16", + "toml 0.8.19", "url", ] @@ -3717,9 +3717,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -3729,18 +3729,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.17" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.2.6", "serde", @@ -4344,9 +4344,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557404e450152cd6795bb558bca69e43c585055f4606e3bcae5894fc6dac9ba0" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 5e8958efac..eec5931ae2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ tiny-bip39 = "1.0.0" tiny-keccak = { version = "2.0.2", default-features = false } tokio = "1.26.0" tokio-stream = "0.1.14" -toml = "0.8.16" +toml = "0.8.19" tonic = "0.12" tracing = { version = "0.1.36", default-features = false } tracing-subscriber = "0.3.14" From e837cecfc540f06380a757131a0ccf67f3345a3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 07:34:02 +0000 Subject: [PATCH 2/3] Bump serde_json from 1.0.121 to 1.0.122 (#4127) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.121 to 1.0.122. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.121...v1.0.122) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b392b6afb..9811203489 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2943,9 +2943,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.121" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ "itoa", "memchr", diff --git a/Cargo.toml b/Cargo.toml index eec5931ae2..4f23180fab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,7 +94,7 @@ secp256k1 = "0.28.2" semver = "1.0.21" serde = "1.0.204" serde_derive = "1.0.104" -serde_json = "1.0.121" +serde_json = "1.0.122" serde_yaml = "0.9.34" serial_test = "3.1.1" sha2 = "0.10.6" From bd750557360716779a74363a072e97ae83482a1a Mon Sep 17 00:00:00 2001 From: Luca Joss <43531661+ljoss17@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:39:12 +0200 Subject: [PATCH 3/3] Update Gaia version running in CI to v18 (#4113) * Update Nix flake and add Gaia v18 * Add new Cosmos chain type which enables dynamic fees during bootstrap * Update Gaia version running in CI to v18 * Use dynamic fee for misbehaviour test scripts * Fix chain CLIs which require fees * Add changelog entry * Increase gas_multiplier for misbehaviour test config * Fix fees for Provenance chain * Improve logs related to failed simulated gas --- .../4114-update-gaia-to-v18.md | 2 ++ .github/workflows/integration.yaml | 10 +++---- .github/workflows/misbehaviour.yml | 2 +- .github/workflows/multi-chains.yaml | 2 +- ci/misbehaviour/config.toml | 14 +++++++++ ci/misbehaviour/config_fork.toml | 18 +++++++++-- crates/relayer/src/sdk_error.rs | 2 +- flake.lock | 30 +++++++++++++++---- flake.nix | 2 +- tools/integration-test/src/mbt/transfer.rs | 2 +- .../src/tests/channel_upgrade/ica.rs | 4 +-- .../src/tests/clear_packet.rs | 2 +- tools/integration-test/src/tests/ica.rs | 4 +-- .../ica_ordered_channel.rs | 2 +- .../tests/interchain_security/ica_transfer.rs | 2 +- .../integration-test/src/tests/supervisor.rs | 6 ++-- tools/test-framework/src/chain/chain_type.rs | 21 ++++++++----- .../test-framework/src/chain/cli/provider.rs | 20 +++++++++++-- .../test-framework/src/chain/cli/transfer.rs | 29 ++++++++++++++++-- tools/test-framework/src/chain/cli/upgrade.rs | 26 +++++++++++++++- tools/test-framework/src/chain/driver.rs | 1 + .../test-framework/src/chain/ext/bootstrap.rs | 3 ++ .../src/framework/binary/ics.rs | 10 ++++--- tools/test-framework/src/relayer/tx.rs | 18 ++++++----- tools/test-framework/src/types/single/node.rs | 8 ++++- 25 files changed, 188 insertions(+), 52 deletions(-) create mode 100644 .changelog/unreleased/improvements/ibc-integration-test/4114-update-gaia-to-v18.md diff --git a/.changelog/unreleased/improvements/ibc-integration-test/4114-update-gaia-to-v18.md b/.changelog/unreleased/improvements/ibc-integration-test/4114-update-gaia-to-v18.md new file mode 100644 index 0000000000..736461adba --- /dev/null +++ b/.changelog/unreleased/improvements/ibc-integration-test/4114-update-gaia-to-v18.md @@ -0,0 +1,2 @@ +- Update the version of Gaia running the integration tests in the CI from `v17.2.1` + to `v18.1.0`([\#4114](https://github.com/informalsystems/hermes/issues/4114)) \ No newline at end of file diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 4131034910..9f44d793ee 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: chain: - - package: gaia17 + - package: gaia18 command: gaiad account_prefix: cosmos native_token: stake @@ -171,10 +171,10 @@ jobs: fail-fast: false matrix: chain: - - package: .#gaia17 .#stride + - package: .#gaia18 .#stride command: gaiad,strided account_prefix: cosmos,stride - - package: .#gaia17 .#neutron + - package: .#gaia18 .#neutron command: gaiad,neutrond account_prefix: cosmos,neutron steps: @@ -216,7 +216,7 @@ jobs: fail-fast: false matrix: chain: - - package: .#gaia17 .#stride-no-admin + - package: .#gaia18 .#stride-no-admin command: gaiad,strided account_prefix: cosmos,stride steps: @@ -257,7 +257,7 @@ jobs: fail-fast: false matrix: chain: - - package: .#celestia .#gaia17 + - package: .#celestia .#gaia18 command: celestia-appd,gaiad account_prefix: celestia,cosmos native_token: utia,stake diff --git a/.github/workflows/misbehaviour.yml b/.github/workflows/misbehaviour.yml index abede42602..43dfc6635d 100644 --- a/.github/workflows/misbehaviour.yml +++ b/.github/workflows/misbehaviour.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: chain: - - package: gaia17 + - package: gaia18 command: gaiad account_prefix: cosmos steps: diff --git a/.github/workflows/multi-chains.yaml b/.github/workflows/multi-chains.yaml index 5d74e8fe02..a4063ee878 100644 --- a/.github/workflows/multi-chains.yaml +++ b/.github/workflows/multi-chains.yaml @@ -58,7 +58,7 @@ jobs: fail-fast: false matrix: first-package: - - package: gaia17 + - package: gaia18 command: gaiad account_prefix: cosmos - package: ibc-go-v7-simapp diff --git a/ci/misbehaviour/config.toml b/ci/misbehaviour/config.toml index 92845f89ed..41b18706fd 100644 --- a/ci/misbehaviour/config.toml +++ b/ci/misbehaviour/config.toml @@ -211,6 +211,19 @@ gas_price = { price = 0.001, denom = 'stake' } # Minimum value: 1.0 gas_multiplier = 1.3 +# Query the current gas price from the chain instead of using the static `gas_price` from the config. +# Useful for chains which have [EIP-1559][eip]-like dynamic gas price. +# +# At the moment, only chains which support the `osmosis.txfees.v1beta1.Query/GetEipBaseFee` +# query or have enabled Skip's `x/feemarket` module https://github.com/skip-mev/feemarket +# can be used with dynamic gas price enabled. +# +# See this page in the Hermes guide for more information: +# https://hermes.informal.systems/documentation/configuration/dynamic-gas-fees.html +# +# Default: { enabled = false, multiplier = 1.1, max = 0.6 } +dynamic_gas_price = { enabled = true, multiplier = 1.3, max = 5.0 } + # Specify how many IBC messages at most to include in a single transaction. # Default: 30 max_msg_num = 30 @@ -314,6 +327,7 @@ default_gas = 100000 max_gas = 400000 gas_price = { price = 0.001, denom = 'stake' } gas_multiplier = 1.3 +dynamic_gas_price = { enabled = true, multiplier = 1.3, max = 5.0 } max_msg_num = 30 max_tx_size = 2097152 clock_drift = '5s' diff --git a/ci/misbehaviour/config_fork.toml b/ci/misbehaviour/config_fork.toml index 060dda1566..d637f8db48 100644 --- a/ci/misbehaviour/config_fork.toml +++ b/ci/misbehaviour/config_fork.toml @@ -208,7 +208,20 @@ gas_price = { price = 0.001, denom = 'stake' } # # Default: 1.1, ie. the gas is increased by 10% # Minimum value: 1.0 -gas_multiplier = 1.1 +gas_multiplier = 1.3 + +# Query the current gas price from the chain instead of using the static `gas_price` from the config. +# Useful for chains which have [EIP-1559][eip]-like dynamic gas price. +# +# At the moment, only chains which support the `osmosis.txfees.v1beta1.Query/GetEipBaseFee` +# query or have enabled Skip's `x/feemarket` module https://github.com/skip-mev/feemarket +# can be used with dynamic gas price enabled. +# +# See this page in the Hermes guide for more information: +# https://hermes.informal.systems/documentation/configuration/dynamic-gas-fees.html +# +# Default: { enabled = false, multiplier = 1.1, max = 0.6 } +dynamic_gas_price = { enabled = true, multiplier = 1.3, max = 5.0 } # Specify how many IBC messages at most to include in a single transaction. # Default: 30 @@ -312,7 +325,8 @@ store_prefix = 'ibc' default_gas = 100000 max_gas = 400000 gas_price = { price = 0.001, denom = 'stake' } -gas_multiplier = 1.1 +gas_multiplier = 1.3 +dynamic_gas_price = { enabled = true, multiplier = 1.3, max = 5.0 } max_msg_num = 30 max_tx_size = 2097152 clock_drift = '5s' diff --git a/crates/relayer/src/sdk_error.rs b/crates/relayer/src/sdk_error.rs index 327404b2e9..f9694716a3 100644 --- a/crates/relayer/src/sdk_error.rs +++ b/crates/relayer/src/sdk_error.rs @@ -32,7 +32,7 @@ define_error! { OutOfGasSimulated { code: u32, amount: u64 } - |e| { format_args!("the issue might have been caused by the configured max gas which binds the gas used. Please check the Hermes config.toml and increase the configured `max_gas`. Curerent value is `{}`", e.amount) }, + |e| { format_args!("the issue might have been caused by a misconfiguration of Hermes. Please check the Hermes config.toml and increase either the `max_gas` or `gas_multiplier` settings. Simulated gas was: {}", e.amount) }, InsufficientFee { code: u32 } diff --git a/flake.lock b/flake.lock index 024b9948d6..0c259e1dfc 100644 --- a/flake.lock +++ b/flake.lock @@ -156,6 +156,7 @@ "gaia14-src": "gaia14-src", "gaia15-src": "gaia15-src", "gaia17-src": "gaia17-src", + "gaia18-src": "gaia18-src", "gaia5-src": "gaia5-src", "gaia6-ordered-src": "gaia6-ordered-src", "gaia6-src": "gaia6-src", @@ -216,11 +217,11 @@ "wasmvm_2_0_0-src": "wasmvm_2_0_0-src" }, "locked": { - "lastModified": 1718033821, - "narHash": "sha256-Y7zF1PWl6W6pSj2Hh6dl+n+udu/6jJV+ODinxk44YqU=", + "lastModified": 1721927677, + "narHash": "sha256-fD8yDMOuJWx0WwlgAO07QrhbDwZ+PRl7HMVG4uwgFnk=", "owner": "informalsystems", "repo": "cosmos.nix", - "rev": "0475f2c4fff872218f70bae9c0c2ea49e2cfe785", + "rev": "826b8ddd3c397306dc67de0646b27dc5656fadf9", "type": "github" }, "original": { @@ -629,6 +630,23 @@ "type": "github" } }, + "gaia18-src": { + "flake": false, + "locked": { + "lastModified": 1720430036, + "narHash": "sha256-wATunCFeMgCP9usv2TK/IKDGZIWfOKx2zWip5qWDuqk=", + "owner": "cosmos", + "repo": "gaia", + "rev": "58b4e54a95c7fc6a64272ccd0f09f46213c005ad", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v18.1.0", + "repo": "gaia", + "type": "github" + } + }, "gaia5-src": { "flake": false, "locked": { @@ -1360,11 +1378,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1717893485, - "narHash": "sha256-WMU6ZRZrBgEUDIF0siu2aIyVAXcxfElSwzZtS/mSpN4=", + "lastModified": 1722640603, + "narHash": "sha256-TcXjLVNd3VeH1qKPH335Tc4RbFDbZQX+d7rqnDUoRaY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3bcedce9f4de37570242faf16e1e143583407eab", + "rev": "81610abc161d4021b29199aa464d6a1a521e0cc9", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fd4d4f6fee..ed71fd6581 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ cometbft evmos gaia6-ordered - gaia17 + gaia18 ibc-go-v2-simapp ibc-go-v3-simapp ibc-go-v4-simapp diff --git a/tools/integration-test/src/mbt/transfer.rs b/tools/integration-test/src/mbt/transfer.rs index 9b8cfcf6a8..e10b595112 100644 --- a/tools/integration-test/src/mbt/transfer.rs +++ b/tools/integration-test/src/mbt/transfer.rs @@ -204,7 +204,7 @@ impl BinaryChannelTest for IbcTransferMBT { *target, *denom, *amount, - &fee_denom_a.with_amount(1200u64).as_ref(), + &fee_denom_a.with_amount(381000000u64).as_ref(), )?; info!("[LocalTransfer] Done"); } diff --git a/tools/integration-test/src/tests/channel_upgrade/ica.rs b/tools/integration-test/src/tests/channel_upgrade/ica.rs index 1721bad2e0..8ddd4fb5c7 100644 --- a/tools/integration-test/src/tests/channel_upgrade/ica.rs +++ b/tools/integration-test/src/tests/channel_upgrade/ica.rs @@ -221,7 +221,7 @@ impl BinaryConnectionTest for ChannelUpgradeICACloseChannel { &chains.node_b.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_host.with_amount(1200u64).as_ref(), + &fee_denom_host.with_amount(381000000u64).as_ref(), )?; chains.node_b.chain_driver().assert_eventual_wallet_amount( @@ -382,7 +382,7 @@ impl BinaryConnectionTest for ChannelUpgradeICAUnordered { &chains.node_b.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_host.with_amount(1200u64).as_ref(), + &fee_denom_host.with_amount(381000000u64).as_ref(), )?; chains.node_b.chain_driver().assert_eventual_wallet_amount( diff --git a/tools/integration-test/src/tests/clear_packet.rs b/tools/integration-test/src/tests/clear_packet.rs index 1bb19077ef..40f3e2c26e 100644 --- a/tools/integration-test/src/tests/clear_packet.rs +++ b/tools/integration-test/src/tests/clear_packet.rs @@ -170,7 +170,7 @@ impl BinaryChannelTest for ClearPacketRecoveryTest { &relayer_wallet_b.as_ref(), &wallet_b.address(), &denom_b1.with_amount(100u64).as_ref(), - &fee_denom_b.with_amount(1200u64).as_ref(), + &fee_denom_b.with_amount(381000000u64).as_ref(), )?; let amount1 = random_u128_range(1000, 5000); diff --git a/tools/integration-test/src/tests/ica.rs b/tools/integration-test/src/tests/ica.rs index 8087a671a1..090c18d2df 100644 --- a/tools/integration-test/src/tests/ica.rs +++ b/tools/integration-test/src/tests/ica.rs @@ -129,7 +129,7 @@ impl BinaryConnectionTest for IcaFilterTestAllow { &chains.node_b.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_host.with_amount(1200u64).as_ref(), + &fee_denom_host.with_amount(381000000u64).as_ref(), )?; chains.node_b.chain_driver().assert_eventual_wallet_amount( @@ -299,7 +299,7 @@ impl BinaryConnectionTest for ICACloseChannelTest { &chains.node_b.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_host.with_amount(1200u64).as_ref(), + &fee_denom_host.with_amount(381000000u64).as_ref(), )?; chains.node_b.chain_driver().assert_eventual_wallet_amount( diff --git a/tools/integration-test/src/tests/interchain_security/ica_ordered_channel.rs b/tools/integration-test/src/tests/interchain_security/ica_ordered_channel.rs index 04fad4bcee..b54786c85c 100644 --- a/tools/integration-test/src/tests/interchain_security/ica_ordered_channel.rs +++ b/tools/integration-test/src/tests/interchain_security/ica_ordered_channel.rs @@ -115,7 +115,7 @@ impl BinaryChannelTest for IcaOrderedChannelTest { &chains.node_a.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_a.with_amount(1200u64).as_ref(), + &fee_denom_a.with_amount(381000000u64).as_ref(), )?; chains.node_a.chain_driver().assert_eventual_wallet_amount( 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 b09fe79c7f..35df6a56aa 100644 --- a/tools/integration-test/src/tests/interchain_security/ica_transfer.rs +++ b/tools/integration-test/src/tests/interchain_security/ica_transfer.rs @@ -88,7 +88,7 @@ impl BinaryChannelTest for InterchainSecurityIcaTransferTest { &chains.node_a.wallets().user1(), &ica_address.as_ref(), &stake_denom.with_amount(ica_fund).as_ref(), - &fee_denom_a.with_amount(1200u64).as_ref(), + &fee_denom_a.with_amount(381000000u64).as_ref(), )?; chains.node_a.chain_driver().assert_eventual_wallet_amount( diff --git a/tools/integration-test/src/tests/supervisor.rs b/tools/integration-test/src/tests/supervisor.rs index 7ddd3597fb..17ee1b5af7 100644 --- a/tools/integration-test/src/tests/supervisor.rs +++ b/tools/integration-test/src/tests/supervisor.rs @@ -7,7 +7,7 @@ use ibc_test_framework::relayer::connection::{ }; #[test] -fn test_supervisor() -> Result<(), Error> { +fn test_supervisor1() -> Result<(), Error> { run_binary_chain_test(&SupervisorTest) } @@ -116,14 +116,14 @@ impl BinaryChainTest for SupervisorTest { &chains.node_a.wallets().relayer(), &chains.node_a.wallets().user2().address(), &denom_a.with_amount(1000u64).as_ref(), - &fee_denom_a.with_amount(1200u64).as_ref(), + &fee_denom_a.with_amount(381000000u64).as_ref(), )?; chains.node_b.chain_driver().local_transfer_token( &chains.node_b.wallets().relayer(), &chains.node_b.wallets().user2().address(), &chains.node_b.denom().with_amount(1000u64).as_ref(), - &fee_denom_b.with_amount(1200u64).as_ref(), + &fee_denom_b.with_amount(381000000u64).as_ref(), )?; info!( diff --git a/tools/test-framework/src/chain/chain_type.rs b/tools/test-framework/src/chain/chain_type.rs index 1eba905087..5dc727c33c 100644 --- a/tools/test-framework/src/chain/chain_type.rs +++ b/tools/test-framework/src/chain/chain_type.rs @@ -11,7 +11,7 @@ const PROVENANCE_HD_PATH: &str = "m/44'/505'/0'/0/0"; #[derive(Clone, Debug)] pub enum ChainType { - Cosmos, + Cosmos { dynamic_fee: bool }, Osmosis, Evmos, Provenance, @@ -21,7 +21,7 @@ pub enum ChainType { impl ChainType { pub fn hd_path(&self) -> &str { match self { - Self::Cosmos | Self::Osmosis => COSMOS_HD_PATH, + Self::Cosmos { dynamic_fee: _ } | Self::Osmosis => COSMOS_HD_PATH, Self::Evmos | Self::Injective => EVMOS_HD_PATH, Self::Provenance => PROVENANCE_HD_PATH, } @@ -29,7 +29,7 @@ impl ChainType { pub fn chain_id(&self, prefix: &str, use_random_id: bool) -> ChainId { match self { - Self::Cosmos => { + Self::Cosmos { dynamic_fee: _ } => { if use_random_id { ChainId::from_string(&format!("ibc-{}-{:x}", prefix, random_u32())) } else { @@ -54,7 +54,7 @@ impl ChainType { let mut res = vec![]; let json_rpc_port = random_unused_tcp_port(); match self { - Self::Cosmos | Self::Injective | Self::Provenance => {} + Self::Cosmos { dynamic_fee: _ } | Self::Injective | Self::Provenance => {} Self::Osmosis => { res.push("--reject-config-defaults".to_owned()); } @@ -70,7 +70,7 @@ impl ChainType { pub fn extra_add_genesis_account_args(&self, chain_id: &ChainId) -> Vec { let mut res = vec![]; match self { - Self::Cosmos | Self::Osmosis | Self::Evmos | Self::Provenance => {} + Self::Cosmos { dynamic_fee: _ } | Self::Osmosis | Self::Evmos | Self::Provenance => {} Self::Injective => { res.push("--chain-id".to_owned()); res.push(format!("{chain_id}")); @@ -81,7 +81,9 @@ impl ChainType { pub fn address_type(&self) -> AddressType { match self { - Self::Cosmos | Self::Osmosis | Self::Provenance => AddressType::default(), + Self::Cosmos { dynamic_fee: _ } | Self::Osmosis | Self::Provenance => { + AddressType::default() + } Self::Evmos => AddressType::Ethermint { pk_type: "/ethermint.crypto.v1.ethsecp256k1.PubKey".to_string(), }, @@ -90,6 +92,10 @@ impl ChainType { }, } } + + pub fn enable_dynamic_fee(&self) -> bool { + matches!(self, Self::Cosmos { dynamic_fee } if *dynamic_fee) + } } impl FromStr for ChainType { @@ -97,11 +103,12 @@ impl FromStr for ChainType { fn from_str(s: &str) -> Result { match s { + name if name.contains("gaiad") => Ok(ChainType::Cosmos { dynamic_fee: true }), name if name.contains("evmosd") => Ok(ChainType::Evmos), name if name.contains("injectived") => Ok(ChainType::Injective), name if name.contains("provenanced") => Ok(ChainType::Provenance), name if name.contains("osmosisd") => Ok(ChainType::Osmosis), - _ => Ok(ChainType::Cosmos), + _ => Ok(ChainType::Cosmos { dynamic_fee: false }), } } } diff --git a/tools/test-framework/src/chain/cli/provider.rs b/tools/test-framework/src/chain/cli/provider.rs index fe52c86512..2c5dc6f8cd 100644 --- a/tools/test-framework/src/chain/cli/provider.rs +++ b/tools/test-framework/src/chain/cli/provider.rs @@ -1,19 +1,21 @@ +use eyre::eyre; use std::collections::HashMap; use std::str; use crate::chain::exec::{simple_exec, ExecOutput}; -use crate::error::Error; +use crate::error::{handle_generic_error, Error}; pub fn submit_consumer_chain_proposal( chain_id: &str, command_path: &str, home_path: &str, rpc_listen_address: &str, + fees: &str, ) -> Result<(), Error> { let proposal_file = format!("{}/consumer_proposal.json", home_path); // The submission might fail silently if there is not enough gas - simple_exec( + let raw_output = simple_exec( chain_id, command_path, &[ @@ -34,10 +36,24 @@ pub fn submit_consumer_chain_proposal( "test", "--gas", "2000000", + "--fees", + fees, + "--output", + "json", "--yes", ], )?; + let output: serde_json::Value = + serde_json::from_str(&raw_output.stdout).map_err(handle_generic_error)?; + + let output_code = output.get("code").and_then(|code| code.as_u64()).ok_or_else(|| Error::generic(eyre!("failed to extract 'code' from 'tx gov submit-legacy-proposal consumer-addition' command")))?; + + if output_code != 0 { + let output_logs = output.get("raw_log").and_then(|code| code.as_str()).ok_or_else(|| Error::generic(eyre!("failed to extract 'raw_logs' from 'tx gov submit-legacy-proposal consumer-addition' command")))?; + return Err(Error::generic(eyre!("output code for commande 'tx gov submit-legacy-proposal consumer-addition' should be 0, but is instead '{output_code}'. Detail: {output_logs}", ))); + } + Ok(()) } diff --git a/tools/test-framework/src/chain/cli/transfer.rs b/tools/test-framework/src/chain/cli/transfer.rs index 39ed3f758b..b1da0efb15 100644 --- a/tools/test-framework/src/chain/cli/transfer.rs +++ b/tools/test-framework/src/chain/cli/transfer.rs @@ -1,9 +1,10 @@ /*! Methods for performing IBC token transfer on a chain. */ +use eyre::eyre; use crate::chain::exec::simple_exec; -use crate::error::Error; +use crate::error::{handle_generic_error, Error}; pub fn local_transfer_token( chain_id: &str, @@ -15,7 +16,7 @@ pub fn local_transfer_token( token: &str, fees: &str, ) -> Result<(), Error> { - simple_exec( + let raw_output = simple_exec( chain_id, command_path, &[ @@ -35,10 +36,34 @@ pub fn local_transfer_token( "test", "--fees", fees, + "--output", + "json", "--yes", ], )?; + let output: serde_json::Value = + serde_json::from_str(&raw_output.stdout).map_err(handle_generic_error)?; + + let output_code = output + .get("code") + .and_then(|code| code.as_u64()) + .ok_or_else(|| { + Error::generic(eyre!("failed to extract 'code' from 'tx gov vote' command")) + })?; + + if output_code != 0 { + let output_logs = output + .get("raw_log") + .and_then(|code| code.as_str()) + .ok_or_else(|| { + Error::generic(eyre!( + "failed to extract 'raw_logs' from 'tx gov vote' command" + )) + })?; + return Err(Error::generic(eyre!("output code for commande 'tx gov vote' should be 0, but is instead '{output_code}'. Detail: {output_logs}", ))); + } + Ok(()) } diff --git a/tools/test-framework/src/chain/cli/upgrade.rs b/tools/test-framework/src/chain/cli/upgrade.rs index cef7e8df0a..b83c6a315b 100644 --- a/tools/test-framework/src/chain/cli/upgrade.rs +++ b/tools/test-framework/src/chain/cli/upgrade.rs @@ -14,7 +14,7 @@ pub fn vote_proposal( fees: &str, proposal_id: &str, ) -> Result<(), Error> { - simple_exec( + let raw_output = simple_exec( chain_id, command_path, &[ @@ -35,10 +35,34 @@ pub fn vote_proposal( "validator", "--fees", fees, + "--output", + "json", "--yes", ], )?; + let output: serde_json::Value = + serde_json::from_str(&raw_output.stdout).map_err(handle_generic_error)?; + + let output_code = output + .get("code") + .and_then(|code| code.as_u64()) + .ok_or_else(|| { + Error::generic(eyre!("failed to extract 'code' from 'tx gov vote' command")) + })?; + + if output_code != 0 { + let output_logs = output + .get("raw_log") + .and_then(|code| code.as_str()) + .ok_or_else(|| { + Error::generic(eyre!( + "failed to extract 'raw_logs' from 'tx gov vote' command" + )) + })?; + return Err(Error::generic(eyre!("output code for commande 'tx gov vote' should be 0, but is instead '{output_code}'. Detail: {output_logs}", ))); + } + Ok(()) } diff --git a/tools/test-framework/src/chain/driver.rs b/tools/test-framework/src/chain/driver.rs index 9fbbddcaeb..85830caf5e 100644 --- a/tools/test-framework/src/chain/driver.rs +++ b/tools/test-framework/src/chain/driver.rs @@ -128,6 +128,7 @@ impl ChainDriver { ) -> Result { let tx_config = new_tx_config_for_test( chain_id.clone(), + chain_type.clone(), format!("http://localhost:{rpc_port}"), format!("http://localhost:{grpc_port}"), chain_type.address_type(), diff --git a/tools/test-framework/src/chain/ext/bootstrap.rs b/tools/test-framework/src/chain/ext/bootstrap.rs index a7344fdb5c..4fef50083d 100644 --- a/tools/test-framework/src/chain/ext/bootstrap.rs +++ b/tools/test-framework/src/chain/ext/bootstrap.rs @@ -106,6 +106,7 @@ pub trait ChainBootstrapMethodsExt { fn submit_consumer_chain_proposal( &self, consumer_chain_id: &str, + fees: &str, spawn_time: &str, ) -> Result<(), Error>; @@ -276,6 +277,7 @@ impl ChainBootstrapMethodsExt for ChainDriver { fn submit_consumer_chain_proposal( &self, consumer_chain_id: &str, + fees: &str, _spawn_time: &str, ) -> Result<(), Error> { let res = simple_exec( @@ -327,6 +329,7 @@ impl ChainBootstrapMethodsExt for ChainDriver { &self.command_path, &self.home_path, &self.rpc_listen_address(), + fees, ) } diff --git a/tools/test-framework/src/framework/binary/ics.rs b/tools/test-framework/src/framework/binary/ics.rs index d11c8ff3e8..24086eff6c 100644 --- a/tools/test-framework/src/framework/binary/ics.rs +++ b/tools/test-framework/src/framework/binary/ics.rs @@ -65,15 +65,17 @@ where 0, )?; let provider_native_token = builder.native_tokens[0].clone(); - let provider_fee = format!("1200{}", provider_native_token); + let provider_fee = format!("381000000{provider_native_token}"); // Get consumer chain id let chain_type = ChainType::from_str(&builder.command_paths[1])?; let chain_id = chain_type.chain_id("consumer", false); - node_a - .chain_driver - .submit_consumer_chain_proposal(chain_id.as_str(), "2023-05-31T12:09:47.048227Z")?; + node_a.chain_driver.submit_consumer_chain_proposal( + chain_id.as_str(), + &provider_fee, + "2023-05-31T12:09:47.048227Z", + )?; node_a.chain_driver.assert_proposal_status( node_a.chain_driver.chain_id.as_str(), diff --git a/tools/test-framework/src/relayer/tx.rs b/tools/test-framework/src/relayer/tx.rs index a2d4e41393..90f62a09fb 100644 --- a/tools/test-framework/src/relayer/tx.rs +++ b/tools/test-framework/src/relayer/tx.rs @@ -12,9 +12,10 @@ use ibc_relayer::config::{AddressType, GasPrice}; use ibc_relayer_types::core::ics24_host::identifier::ChainId; use tendermint_rpc::Url; +use crate::chain::chain_type::ChainType; use crate::error::{handle_generic_error, Error}; -pub fn gas_config_for_test(native_token: String) -> GasConfig { +pub fn gas_config_for_test(native_token: String, chain_type: ChainType) -> GasConfig { let max_gas = 3000000; let gas_multiplier = 1.5; @@ -37,6 +38,12 @@ pub fn gas_config_for_test(native_token: String) -> GasConfig { granter: fee_granter.clone(), }; + let dynamic_gas_price = if chain_type.enable_dynamic_fee() { + DynamicGasPrice::unsafe_new(true, 1.3, 5.0) + } else { + DynamicGasPrice::disabled() + }; + GasConfig { default_gas, max_gas, @@ -44,16 +51,13 @@ pub fn gas_config_for_test(native_token: String) -> GasConfig { gas_price, max_fee, fee_granter, - dynamic_gas_price: DynamicGasPrice { - enabled: false, - multiplier: 1.0, - max: 0.6, - }, + dynamic_gas_price, } } pub fn new_tx_config_for_test( chain_id: ChainId, + chain_type: ChainType, raw_rpc_address: String, raw_grpc_address: String, address_type: AddressType, @@ -61,7 +65,7 @@ pub fn new_tx_config_for_test( ) -> Result { let rpc_address = Url::from_str(&raw_rpc_address).map_err(handle_generic_error)?; let grpc_address = Uri::from_str(&raw_grpc_address).map_err(handle_generic_error)?; - let gas_config = gas_config_for_test(native_token); + let gas_config = gas_config_for_test(native_token, chain_type); let rpc_timeout = Duration::from_secs(30); let max_msg_num = Default::default(); let max_tx_size = Default::default(); diff --git a/tools/test-framework/src/types/single/node.rs b/tools/test-framework/src/types/single/node.rs index 7ec43141b9..ae4d0f34bb 100644 --- a/tools/test-framework/src/types/single/node.rs +++ b/tools/test-framework/src/types/single/node.rs @@ -152,6 +152,12 @@ impl FullNode { _ => config::GasPrice::new(0.003, test_config.native_token(chain_number).clone()), }; + let dynamic_gas_price = if chain_type.enable_dynamic_fee() { + DynamicGasPrice::unsafe_new(true, 1.3, 5.0) + } else { + DynamicGasPrice::disabled() + }; + Ok(config::ChainConfig::CosmosSdk(CosmosSdkConfig { id: self.chain_driver.chain_id.clone(), rpc_addr: Url::from_str(&self.chain_driver.rpc_address())?, @@ -172,7 +178,7 @@ impl FullNode { max_gas: Some(3000000), gas_adjustment: None, gas_multiplier: Some(GasMultiplier::unsafe_new(1.5)), - dynamic_gas_price: DynamicGasPrice::default(), + dynamic_gas_price, fee_granter: None, max_msg_num: Default::default(), max_tx_size: Default::default(),