From ffd6ccc5577b3a9a1c5375c4fd8964270713b9f6 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 28 Jan 2024 20:38:34 +0100 Subject: [PATCH 1/8] fix: allow dot character in docker image tags --- .github/workflows/build-callbacks-simd-image-from-tag.yml | 2 +- .github/workflows/build-simd-image-from-tag.yml | 2 +- .github/workflows/build-wasm-simd-image-from-tag.yml | 2 +- .github/workflows/e2e-compatibility-unreleased.yaml | 4 ++-- .github/workflows/e2e-compatibility.yaml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-callbacks-simd-image-from-tag.yml b/.github/workflows/build-callbacks-simd-image-from-tag.yml index 66298adabc6..65bf7ceecf4 100644 --- a/.github/workflows/build-callbacks-simd-image-from-tag.yml +++ b/.github/workflows/build-callbacks-simd-image-from-tag.yml @@ -30,6 +30,6 @@ jobs: - name: Build image run: | # remove any `/` characters from the docker tag and replace them with a - - docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" -f modules/apps/callbacks/Dockerfile docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" diff --git a/.github/workflows/build-simd-image-from-tag.yml b/.github/workflows/build-simd-image-from-tag.yml index 21bbb8e9a71..1518110eed8 100644 --- a/.github/workflows/build-simd-image-from-tag.yml +++ b/.github/workflows/build-simd-image-from-tag.yml @@ -34,6 +34,6 @@ jobs: - name: Build image run: | # remove any `/` characters from the docker tag and replace them with a - - docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" --build-arg IBC_GO_VERSION=${{ inputs.ibc-go-version }} docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" diff --git a/.github/workflows/build-wasm-simd-image-from-tag.yml b/.github/workflows/build-wasm-simd-image-from-tag.yml index d0a10e21fb8..616ef30942f 100644 --- a/.github/workflows/build-wasm-simd-image-from-tag.yml +++ b/.github/workflows/build-wasm-simd-image-from-tag.yml @@ -39,6 +39,6 @@ jobs: # remove all `/` or `+` characters from the docker tag and replace them with a -. # this ensures the docker tag is valid. - docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo $GIT_TAG | sed 's/[^a-zA-Z0-9\.]/-/g')" docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" -f modules/light-clients/08-wasm/Dockerfile --build-arg LIBWASM_VERSION=${version} --build-arg LIBWASM_CHECKSUM=${checksum} docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" diff --git a/.github/workflows/e2e-compatibility-unreleased.yaml b/.github/workflows/e2e-compatibility-unreleased.yaml index 27605d9e447..945305a2a54 100644 --- a/.github/workflows/e2e-compatibility-unreleased.yaml +++ b/.github/workflows/e2e-compatibility-unreleased.yaml @@ -29,13 +29,13 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build image run: | - docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9\.]/-/g')" # TODO: IBC_GO_VERSION does not yet do anything in the tests but is required. docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" --build-arg IBC_GO_VERSION=${{ matrix.release-branch }} docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" - name: Display image details run: | - docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9\.]/-/g')" docker inspect "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" transfer-1: diff --git a/.github/workflows/e2e-compatibility.yaml b/.github/workflows/e2e-compatibility.yaml index 1055008f022..b322bceb717 100644 --- a/.github/workflows/e2e-compatibility.yaml +++ b/.github/workflows/e2e-compatibility.yaml @@ -64,13 +64,13 @@ jobs: - name: Build image if: env.RELEASE_BRANCH == matrix.release-branch run: | - docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9\.]/-/g')" docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" --build-arg IBC_GO_VERSION=${{ inputs.ibc-go-version }} docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" - name: Display image details if: env.RELEASE_BRANCH == matrix.release-branch run: | - docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9]/-/g')" + docker_tag="$(echo ${{ matrix.release-branch }} | sed 's/[^a-zA-Z0-9\.]/-/g')" docker inspect "${REGISTRY}/${ORG}/${IMAGE_NAME}:$docker_tag" transfer-chain-a: From 95055bc976d4effff424917958161f0c4983c8dc Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 28 Jan 2024 22:46:04 +0100 Subject: [PATCH 2/8] add capital efficient fee escrow feature releases --- e2e/tests/transfer/incentivized_test.go | 136 +++++++++++++++++------- e2e/testvalues/values.go | 8 ++ 2 files changed, 108 insertions(+), 36 deletions(-) diff --git a/e2e/tests/transfer/incentivized_test.go b/e2e/tests/transfer/incentivized_test.go index 3818f0c0170..1c799fb4220 100644 --- a/e2e/tests/transfer/incentivized_test.go +++ b/e2e/tests/transfer/incentivized_test.go @@ -35,6 +35,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Su relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -116,14 +117,26 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Su s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - t.Run("balance should be lowered by sum of recv ack and timeout", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) + if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { + // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) - expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } else { + t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { + // The balance should be lowered by the sum of the recv, ack and timeout fees. + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } }) t.Run("start relayer", func(t *testing.T) { @@ -152,6 +165,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_InvalidReceiverAccou relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -229,14 +243,26 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_InvalidReceiverAccou s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - t.Run("balance should be lowered by sum of recv, ack and timeout", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) + if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { + // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) - expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } else { + t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { + // The balance should be lowered by the sum of the recv, ack and timeout fees. + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } }) t.Run("start relayer", func(t *testing.T) { @@ -264,8 +290,8 @@ func (s *IncentivizedTransferTestSuite) TestMultiMsg_MsgPayPacketFeeSingleSender ctx := context.TODO() relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) - chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -329,14 +355,26 @@ func (s *IncentivizedTransferTestSuite) TestMultiMsg_MsgPayPacketFeeSingleSender s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - t.Run("balance should be lowered by sum of recv ack and timeout", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) + if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { + // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) - expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - testFee.Total().AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } else { + t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { + // The balance should be lowered by the sum of the recv, ack and timeout fees. + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - legacyFeeTotal.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } t.Run("start relayer", func(t *testing.T) { s.StartRelayer(relayer) @@ -371,6 +409,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_SingleSender_TimesOu relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -451,14 +490,26 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_SingleSender_TimesOu s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - t.Run("balance should be lowered by sum of recv ack and timeout", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) + if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { + // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } else { + t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { + // The balance should be lowered by the sum of the recv, ack and timeout fees. + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } }) t.Run("start relayer", func(t *testing.T) { @@ -486,6 +537,7 @@ func (s *IncentivizedTransferTestSuite) TestPayPacketFeeAsync_SingleSender_NoCou relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) chainA, _ := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -549,14 +601,26 @@ func (s *IncentivizedTransferTestSuite) TestPayPacketFeeAsync_SingleSender_NoCou }) }) - t.Run("balance should be lowered by sum of recv, ack and timeout", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) + if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { + // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } else { + t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { + // The balance should be lowered by the sum of the recv, ack and timeout fees. + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) + } t.Run("start relayer", func(t *testing.T) { s.StartRelayer(relayer) diff --git a/e2e/testvalues/values.go b/e2e/testvalues/values.go index cadb6417686..c94999d7e69 100644 --- a/e2e/testvalues/values.go +++ b/e2e/testvalues/values.go @@ -112,3 +112,11 @@ var ChannelParamsFeatureReleases = semverutil.FeatureReleases{ var GovV1MessagesFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v8", } + +// CapitalEfficientFeeEscrowFeatureReleases represents the releases . +var CapitalEfficientFeeEscrowFeatureReleases = semverutil.FeatureReleases{ + MajorVersion: "v9", + MinorVersions: []string{ + "v8.1", + }, +} From 9f1f2611ed674fa8a3f654d05604b0fc744cdda2 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 28 Jan 2024 22:55:25 +0100 Subject: [PATCH 3/8] add compatibility e2e tests for unordered ICA channel --- .../main/ica-unordered-channel-chain-a.json | 18 ++++++++++++++++++ .../main/ica-unordered-channel-chain-b.json | 18 ++++++++++++++++++ .../ica-unordered-channel-chain-a.json | 17 +++++++++++++++++ .../ica-unordered-channel-chain-b.json | 17 +++++++++++++++++ .../unreleased/ica-unordered-channel.json | 17 +++++++++++++++++ e2e/testvalues/values.go | 2 +- 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 .github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json create mode 100644 .github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json create mode 100644 .github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-a.json create mode 100644 .github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-b.json create mode 100644 .github/compatibility-test-matrices/unreleased/ica-unordered-channel.json diff --git a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json new file mode 100644 index 00000000000..03fa7129666 --- /dev/null +++ b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-a.json @@ -0,0 +1,18 @@ +{ + "chain-a": [ + "main" + ], + "chain-b": [ + "main", + "v8.1.0" + ], + "entrypoint": [ + "TestInterchainAccountsTestSuite" + ], + "test": [ + "TestMsgSendTx_SuccessfulTransfer_UnorderedChannel" + ], + "relayer-type": [ + "hermes" + ] +} \ No newline at end of file diff --git a/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json new file mode 100644 index 00000000000..50eeb698296 --- /dev/null +++ b/.github/compatibility-test-matrices/main/ica-unordered-channel-chain-b.json @@ -0,0 +1,18 @@ +{ + "chain-a": [ + "main", + "v8.1.0" + ], + "chain-b": [ + "main" + ], + "entrypoint": [ + "TestInterchainAccountsTestSuite" + ], + "test": [ + "TestMsgSendTx_SuccessfulTransfer_UnorderedChannel" + ], + "relayer-type": [ + "hermes" + ] +} \ No newline at end of file diff --git a/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-a.json b/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-a.json new file mode 100644 index 00000000000..df950997c70 --- /dev/null +++ b/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-a.json @@ -0,0 +1,17 @@ +{ + "chain-a": [ + "release-v8.1.x" + ], + "chain-b": [ + "release-v8.1.x" + ], + "entrypoint": [ + "TestInterchainAccountsTestSuite" + ], + "test": [ + "TestMsgSendTx_SuccessfulTransfer_UnorderedChannel" + ], + "relayer-type": [ + "hermes" + ] +} \ No newline at end of file diff --git a/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-b.json b/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-b.json new file mode 100644 index 00000000000..df950997c70 --- /dev/null +++ b/.github/compatibility-test-matrices/release-v8.1.x/ica-unordered-channel-chain-b.json @@ -0,0 +1,17 @@ +{ + "chain-a": [ + "release-v8.1.x" + ], + "chain-b": [ + "release-v8.1.x" + ], + "entrypoint": [ + "TestInterchainAccountsTestSuite" + ], + "test": [ + "TestMsgSendTx_SuccessfulTransfer_UnorderedChannel" + ], + "relayer-type": [ + "hermes" + ] +} \ No newline at end of file diff --git a/.github/compatibility-test-matrices/unreleased/ica-unordered-channel.json b/.github/compatibility-test-matrices/unreleased/ica-unordered-channel.json new file mode 100644 index 00000000000..df950997c70 --- /dev/null +++ b/.github/compatibility-test-matrices/unreleased/ica-unordered-channel.json @@ -0,0 +1,17 @@ +{ + "chain-a": [ + "release-v8.1.x" + ], + "chain-b": [ + "release-v8.1.x" + ], + "entrypoint": [ + "TestInterchainAccountsTestSuite" + ], + "test": [ + "TestMsgSendTx_SuccessfulTransfer_UnorderedChannel" + ], + "relayer-type": [ + "hermes" + ] +} \ No newline at end of file diff --git a/e2e/testvalues/values.go b/e2e/testvalues/values.go index c94999d7e69..b6f750ef7f7 100644 --- a/e2e/testvalues/values.go +++ b/e2e/testvalues/values.go @@ -113,7 +113,7 @@ var GovV1MessagesFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v8", } -// CapitalEfficientFeeEscrowFeatureReleases represents the releases . +// CapitalEfficientFeeEscrowFeatureReleases represents the releases the support for capital efficient fee escrow was released in. var CapitalEfficientFeeEscrowFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v9", MinorVersions: []string{ From 27741c8dc5a3b6c738e82ac4bda7611a143d1ee5 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 28 Jan 2024 23:24:15 +0100 Subject: [PATCH 4/8] add unordered ica channels feature releases --- e2e/tests/interchain_accounts/base_test.go | 18 ++++++++++++++++-- e2e/testvalues/values.go | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index 1199e0f35b8..e31b330fb1c 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -63,6 +63,7 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -72,9 +73,16 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan var hostAccount string t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { + // for the versions that don't support unordered channels, MsgRegisterInterchainAccount + // must be broadcasted with the default value for the order field + msgOrder := order + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, order) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -94,7 +102,13 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan s.Require().NoError(err) s.Require().Equal(len(channels), 2) icaChannel := channels[0] - s.Require().Contains(orderMapping[order], icaChannel.Ordering) + + // for the versions that don't support unordered channels, the ordering will default to ordered + orderKey := order + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + orderKey = channeltypes.ORDERED + } + s.Require().Contains(orderMapping[orderKey], icaChannel.Ordering) }) t.Run("interchain account executes a bank transfer on behalf of the corresponding owner account", func(t *testing.T) { diff --git a/e2e/testvalues/values.go b/e2e/testvalues/values.go index b6f750ef7f7..27edd2d470c 100644 --- a/e2e/testvalues/values.go +++ b/e2e/testvalues/values.go @@ -113,6 +113,14 @@ var GovV1MessagesFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v8", } +// UnorderedICAChannelFeatureReleases represents the releases the support for unordered ICA channels was released in. +var UnorderedICAChannelFeatureReleases = semverutil.FeatureReleases{ + MajorVersion: "v9", + MinorVersions: []string{ + "v8.1", + }, +} + // CapitalEfficientFeeEscrowFeatureReleases represents the releases the support for capital efficient fee escrow was released in. var CapitalEfficientFeeEscrowFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v9", From 2159cab7c8b55a89c9f5ddc9a236aad093892cdb Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 29 Jan 2024 08:53:07 +0100 Subject: [PATCH 5/8] more fixes --- e2e/tests/interchain_accounts/base_test.go | 14 +- e2e/tests/interchain_accounts/gov_test.go | 10 +- e2e/tests/interchain_accounts/groups_test.go | 10 +- .../interchain_accounts/incentivized_test.go | 20 +- e2e/tests/transfer/incentivized_test.go | 175 ++++++++---------- 5 files changed, 123 insertions(+), 106 deletions(-) diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index e31b330fb1c..8a24180a03e 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -73,8 +73,8 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan var hostAccount string t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - // for the versions that don't support unordered channels, MsgRegisterInterchainAccount - // must be broadcasted with the default value for the order field + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field msgOrder := order if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { msgOrder = channeltypes.NONE @@ -175,6 +175,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -184,9 +185,16 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF var hostAccount string t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index 212b5d173f4..f41460b6cb8 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -43,6 +43,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version controllerAccount := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) @@ -53,8 +54,15 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() s.Require().NotNil(govModuleAddress) t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, channeltypes.ORDERED) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, msgOrder) s.ExecuteAndPassGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount) }) diff --git a/e2e/tests/interchain_accounts/groups_test.go b/e2e/tests/interchain_accounts/groups_test.go index 43faca17a3f..561cbe64578 100644 --- a/e2e/tests/interchain_accounts/groups_test.go +++ b/e2e/tests/interchain_accounts/groups_test.go @@ -90,6 +90,7 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) chainAAddress := chainAWallet.FormattedAddress() @@ -114,8 +115,15 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat }) t.Run("submit proposal for MsgRegisterInterchainAccount", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + groupPolicyAddr = s.QueryGroupPolicyAddress(ctx, chainA) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), channeltypes.ORDERED) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), msgOrder) msgSubmitProposal, err := grouptypes.NewMsgSubmitProposal(groupPolicyAddr, []string{chainAAddress}, []sdk.Msg{msgRegisterAccount}, DefaultMetadata, grouptypes.Exec_EXEC_UNSPECIFIED, "e2e groups proposal: for MsgRegisterInterchainAccount", "e2e groups proposal: for MsgRegisterInterchainAccount") s.Require().NoError(err) diff --git a/e2e/tests/interchain_accounts/incentivized_test.go b/e2e/tests/interchain_accounts/incentivized_test.go index 309a8e92b8f..cb12d5e5f82 100644 --- a/e2e/tests/interchain_accounts/incentivized_test.go +++ b/e2e/tests/interchain_accounts/incentivized_test.go @@ -43,6 +43,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -71,8 +72,15 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, msgOrder) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -221,6 +229,7 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -249,8 +258,15 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, msgOrder) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/e2e/tests/transfer/incentivized_test.go b/e2e/tests/transfer/incentivized_test.go index 1c799fb4220..0fa493f24be 100644 --- a/e2e/tests/transfer/incentivized_test.go +++ b/e2e/tests/transfer/incentivized_test.go @@ -4,6 +4,7 @@ package transfer import ( "context" + "fmt" "testing" "time" @@ -117,26 +118,19 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Su s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { - t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { - // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) - } else { - t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) - expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + msg := "balance should be lowered by max(recv_fee + ack_fee, timeout_fee)" + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msg = "balance should be lowered by sum of recv_fee, ack_fee and timeout_fee" + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) } + t.Run(msg, func(t *testing.T) { + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) }) t.Run("start relayer", func(t *testing.T) { @@ -243,26 +237,19 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_InvalidReceiverAccou s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { - t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { - // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) - } else { - t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) - expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + msg := "balance should be lowered by max(recv_fee + ack_fee, timeout_fee)" + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msg = "balance should be lowered by sum of recv_fee, ack_fee and timeout_fee" + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) } + t.Run(msg, func(t *testing.T) { + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) }) t.Run("start relayer", func(t *testing.T) { @@ -355,26 +342,19 @@ func (s *IncentivizedTransferTestSuite) TestMultiMsg_MsgPayPacketFeeSingleSender s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { - t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { - // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) - } else { - t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) - expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - legacyFeeTotal.AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + msg := "balance should be lowered by max(recv_fee + ack_fee, timeout_fee)" + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msg = "balance should be lowered by sum of recv_fee, ack_fee and timeout_fee" + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) } + t.Run(msg, func(t *testing.T) { + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - escrowTotalFee.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) t.Run("start relayer", func(t *testing.T) { s.StartRelayer(relayer) @@ -490,26 +470,19 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_SingleSender_TimesOu s.Require().True(actualFee.TimeoutFee.Equal(testFee.TimeoutFee)) }) - if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { - t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { - // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) - } else { - t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + msg := "balance should be lowered by max(recv_fee + ack_fee, timeout_fee)" + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msg = "balance should be lowered by sum of recv_fee, ack_fee and timeout_fee" + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) } + t.Run(msg, func(t *testing.T) { + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) }) t.Run("start relayer", func(t *testing.T) { @@ -601,26 +574,19 @@ func (s *IncentivizedTransferTestSuite) TestPayPacketFeeAsync_SingleSender_NoCou }) }) - if testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { - t.Run("balance should be lowered by max(recv_fee + ack_fee, timeout_fee)", func(t *testing.T) { - // The balance should be lowered by max(recv_fee + ack_fee, timeout_fee). - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) - } else { - t.Run("balance should be lowered by sum of recv_fee, ack_fee and timeout_fee", func(t *testing.T) { - // The balance should be lowered by the sum of the recv, ack and timeout fees. - actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) - s.Require().NoError(err) - - legacyFeeTotal := testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) - expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - legacyFeeTotal.AmountOf(chainADenom).Int64() - s.Require().Equal(expected, actualBalance) - }) + msg := "balance should be lowered by max(recv_fee + ack_fee, timeout_fee)" + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msg = "balance should be lowered by sum of recv_fee, ack_fee and timeout_fee" + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) } + t.Run(msg, func(t *testing.T) { + actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet) + s.Require().NoError(err) + + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() + s.Require().Equal(expected, actualBalance) + }) t.Run("start relayer", func(t *testing.T) { s.StartRelayer(relayer) @@ -650,6 +616,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncMultipleSenders relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.FeeMiddlewareChannelOptions()) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -740,19 +707,29 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncMultipleSenders s.Require().True(actualFee2.TimeoutFee.Equal(testFee.TimeoutFee)) }) - t.Run("balance of chainAWallet1 should be lowered by sum of recv ack and timeout", func(t *testing.T) { + msgFn := func(wallet string) string { + return fmt.Sprintf("balance of %s should be lowered by max(recv_fee + ack_fee, timeout_fee)", wallet) + } + escrowTotalFee := testFee.Total() + if !testvalues.CapitalEfficientFeeEscrowFeatureReleases.IsSupported(chainAVersion) { + msgFn = func(wallet string) string { + return fmt.Sprintf("balance of %s should be lowered by sum of recv_fee, ack_fee and timeout_fee", wallet) + } + escrowTotalFee = testFee.RecvFee.Add(testFee.AckFee...).Add(testFee.TimeoutFee...) + } + t.Run(msgFn("chainAWallet1"), func(t *testing.T) { actualBalance1, err := s.GetChainANativeBalance(ctx, chainAWallet1) s.Require().NoError(err) - expected1 := testvalues.StartingTokenAmount - walletAmount1.Amount.Int64() - testFee.Total().AmountOf(chainADenom).Int64() + expected1 := testvalues.StartingTokenAmount - walletAmount1.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected1, actualBalance1) }) - t.Run("balance of chainAWallet2 should be lowered by sum of recv ack and timeout", func(t *testing.T) { + t.Run(msgFn("chainAWallet2"), func(t *testing.T) { actualBalance2, err := s.GetChainANativeBalance(ctx, chainAWallet2) s.Require().NoError(err) - expected2 := testvalues.StartingTokenAmount - testFee.Total().AmountOf(chainADenom).Int64() + expected2 := testvalues.StartingTokenAmount - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected2, actualBalance2) }) }) From 33d6f81eaccc0c627de12f1860c9c9ae37780add Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 29 Jan 2024 09:14:58 +0100 Subject: [PATCH 6/8] more ica fixes --- e2e/tests/interchain_accounts/base_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index 8a24180a03e..f95419698bb 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -273,6 +273,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() + chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -289,10 +290,17 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop ) t.Run("register interchain account", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + var err error // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) portID, err = icatypes.NewControllerPortID(controllerAddress) s.Require().NoError(err) @@ -388,9 +396,16 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop // re-register interchain account to reopen the channel now that it has been closed due to timeout // on an ordered channel t.Run("register interchain account", func(t *testing.T) { + // Must broadcast MsgRegisterInterchainAccount with default value for order field + // for those versions where MsgRegisterInterchainAccount does not have the order field + msgOrder := channeltypes.ORDERED + if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { + msgOrder = channeltypes.NONE + } + // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB)) From c949d5b02b5576ba6d2064879ee9f02b33139776 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 29 Jan 2024 13:17:09 +0100 Subject: [PATCH 7/8] refactor: move ica unordered field conditionals to santize.Messages --- e2e/tests/interchain_accounts/base_test.go | 46 ++----------------- e2e/tests/interchain_accounts/gov_test.go | 10 +--- e2e/tests/interchain_accounts/groups_test.go | 10 +--- .../interchain_accounts/incentivized_test.go | 20 +------- e2e/testsuite/sanitize/messages.go | 14 ++++++ e2e/testvalues/values.go | 8 ---- 6 files changed, 23 insertions(+), 85 deletions(-) diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index f95419698bb..c3948dca81b 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -63,7 +63,6 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -73,16 +72,9 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan var hostAccount string t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := order - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, order) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -103,12 +95,7 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan s.Require().Equal(len(channels), 2) icaChannel := channels[0] - // for the versions that don't support unordered channels, the ordering will default to ordered - orderKey := order - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - orderKey = channeltypes.ORDERED - } - s.Require().Contains(orderMapping[orderKey], icaChannel.Ordering) + s.Require().Contains(orderMapping[order], icaChannel.Ordering) }) t.Run("interchain account executes a bank transfer on behalf of the corresponding owner account", func(t *testing.T) { @@ -175,7 +162,6 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -185,16 +171,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF var hostAccount string t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -273,7 +252,6 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version // setup 2 accounts: controller account on chain A, a second chain B account. // host account will be created when the ICA is registered @@ -290,17 +268,10 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop ) t.Run("register interchain account", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - var err error // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) portID, err = icatypes.NewControllerPortID(controllerAddress) s.Require().NoError(err) @@ -396,16 +367,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop // re-register interchain account to reopen the channel now that it has been closed due to timeout // on an ordered channel t.Run("register interchain account", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - // explicitly set the version string because we don't want to use incentivized channels. version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, msgOrder) + msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED) s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount) s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB)) diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index f41460b6cb8..212b5d173f4 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -43,7 +43,6 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version controllerAccount := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) @@ -54,15 +53,8 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration() s.Require().NotNil(govModuleAddress) t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, channeltypes.ORDERED) s.ExecuteAndPassGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount) }) diff --git a/e2e/tests/interchain_accounts/groups_test.go b/e2e/tests/interchain_accounts/groups_test.go index 561cbe64578..43faca17a3f 100644 --- a/e2e/tests/interchain_accounts/groups_test.go +++ b/e2e/tests/interchain_accounts/groups_test.go @@ -90,7 +90,6 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) chainAAddress := chainAWallet.FormattedAddress() @@ -115,15 +114,8 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat }) t.Run("submit proposal for MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - groupPolicyAddr = s.QueryGroupPolicyAddress(ctx, chainA) - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), channeltypes.ORDERED) msgSubmitProposal, err := grouptypes.NewMsgSubmitProposal(groupPolicyAddr, []string{chainAAddress}, []sdk.Msg{msgRegisterAccount}, DefaultMetadata, grouptypes.Exec_EXEC_UNSPECIFIED, "e2e groups proposal: for MsgRegisterInterchainAccount", "e2e groups proposal: for MsgRegisterInterchainAccount") s.Require().NoError(err) diff --git a/e2e/tests/interchain_accounts/incentivized_test.go b/e2e/tests/interchain_accounts/incentivized_test.go index cb12d5e5f82..309a8e92b8f 100644 --- a/e2e/tests/interchain_accounts/incentivized_test.go +++ b/e2e/tests/interchain_accounts/incentivized_test.go @@ -43,7 +43,6 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -72,15 +71,8 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_SuccessfulBankSe chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) @@ -229,7 +221,6 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I // channel-0 is a transfer channel but it will not be used in this test case relayer, _ := s.SetupChainsRelayerAndChannel(ctx, nil) chainA, chainB := s.GetChains() - chainAVersion := chainA.Config().Images[0].Version var ( chainADenom = chainA.Config().Denom @@ -258,15 +249,8 @@ func (s *IncentivizedInterchainAccountsTestSuite) TestMsgSendTx_FailedBankSend_I chainBAccount := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) { - // Must broadcast MsgRegisterInterchainAccount with default value for order field - // for those versions where MsgRegisterInterchainAccount does not have the order field - msgOrder := channeltypes.ORDERED - if !testvalues.UnorderedICAChannelFeatureReleases.IsSupported(chainAVersion) { - msgOrder = channeltypes.NONE - } - version := "" // allow version to be specified by the controller chain since both chains should support incentivized channels - msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, msgOrder) + msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAccount.FormattedAddress(), version, channeltypes.ORDERED) txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount) s.AssertTxSuccess(txResp) diff --git a/e2e/testsuite/sanitize/messages.go b/e2e/testsuite/sanitize/messages.go index ba1a00b47cd..481f9218ec1 100644 --- a/e2e/testsuite/sanitize/messages.go +++ b/e2e/testsuite/sanitize/messages.go @@ -5,6 +5,9 @@ import ( govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" grouptypes "github.com/cosmos/cosmos-sdk/x/group" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + "github.com/cosmos/ibc-go/e2e/semverutil" ) @@ -17,6 +20,13 @@ var ( govv1ProposalTitleAndSummary = semverutil.FeatureReleases{ MajorVersion: "v7", } + // icaUnorderedChannelFeatureReleases represents the releasees that support the new ordering field. + icaUnorderedChannelFeatureReleases = semverutil.FeatureReleases{ + MajorVersion: "v9", + MinorVersions: []string{ + "v8.1", + }, + } ) // Messages removes any fields that are not supported by the chain version. @@ -45,6 +55,10 @@ func removeUnknownFields(tag string, msg sdk.Msg) sdk.Msg { msg.Summary = "" } return msg + case *icacontrollertypes.MsgRegisterInterchainAccount: + if !icaUnorderedChannelFeatureReleases.IsSupported(tag) { + msg.Ordering = channeltypes.NONE + } } return msg } diff --git a/e2e/testvalues/values.go b/e2e/testvalues/values.go index 27edd2d470c..b6f750ef7f7 100644 --- a/e2e/testvalues/values.go +++ b/e2e/testvalues/values.go @@ -113,14 +113,6 @@ var GovV1MessagesFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v8", } -// UnorderedICAChannelFeatureReleases represents the releases the support for unordered ICA channels was released in. -var UnorderedICAChannelFeatureReleases = semverutil.FeatureReleases{ - MajorVersion: "v9", - MinorVersions: []string{ - "v8.1", - }, -} - // CapitalEfficientFeeEscrowFeatureReleases represents the releases the support for capital efficient fee escrow was released in. var CapitalEfficientFeeEscrowFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v9", From 2538051c963e0da27b9ca2dc749e2d791273e0d9 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 29 Jan 2024 14:58:10 +0100 Subject: [PATCH 8/8] sanitize message contained in a x/gov or x/group proposal --- e2e/testsuite/sanitize/messages.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/e2e/testsuite/sanitize/messages.go b/e2e/testsuite/sanitize/messages.go index 481f9218ec1..ac475314f4e 100644 --- a/e2e/testsuite/sanitize/messages.go +++ b/e2e/testsuite/sanitize/messages.go @@ -48,12 +48,26 @@ func removeUnknownFields(tag string, msg sdk.Msg) sdk.Msg { msg.Title = "" msg.Summary = "" } + // sanitize messages contained in the x/gov proposal + msgs, err := msg.GetMsgs() + if err != nil { + panic(err) + } + sanitizedMsgs := Messages(tag, msgs...) + msg.SetMsgs(sanitizedMsgs) return msg case *grouptypes.MsgSubmitProposal: if !groupsv1ProposalTitleAndSummary.IsSupported(tag) { msg.Title = "" msg.Summary = "" } + // sanitize messages contained in the x/group proposal + msgs, err := msg.GetMsgs() + if err != nil { + panic(err) + } + sanitizedMsgs := Messages(tag, msgs...) + msg.SetMsgs(sanitizedMsgs) return msg case *icacontrollertypes.MsgRegisterInterchainAccount: if !icaUnorderedChannelFeatureReleases.IsSupported(tag) {