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/.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: diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index eb82d9666a6..253c56a9df9 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -95,6 +95,7 @@ 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) }) diff --git a/e2e/tests/transfer/incentivized_test.go b/e2e/tests/transfer/incentivized_test.go index 3818f0c0170..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" @@ -35,6 +36,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,12 +118,17 @@ 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. + 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() - testFee.Total().AmountOf(chainADenom).Int64() + expected := testvalues.StartingTokenAmount - walletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected, actualBalance) }) }) @@ -152,6 +159,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,12 +237,17 @@ 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. + 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() - testFee.Total().AmountOf(chainADenom).Int64() + expected := testvalues.StartingTokenAmount - transferAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected, actualBalance) }) }) @@ -264,8 +277,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,12 +342,17 @@ 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. + 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 - testFee.Total().AmountOf(chainADenom).Int64() + expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected, actualBalance) }) @@ -371,6 +389,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,12 +470,17 @@ 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. + 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() - testFee.Total().AmountOf(chainADenom).Int64() + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected, actualBalance) }) }) @@ -486,6 +510,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,12 +574,17 @@ 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. + 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() - testFee.Total().AmountOf(chainADenom).Int64() + expected := testvalues.StartingTokenAmount - chainBWalletAmount.Amount.Int64() - escrowTotalFee.AmountOf(chainADenom).Int64() s.Require().Equal(expected, actualBalance) }) @@ -586,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 @@ -676,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) }) }) diff --git a/e2e/testsuite/sanitize/messages.go b/e2e/testsuite/sanitize/messages.go index ba1a00b47cd..ac475314f4e 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. @@ -38,13 +48,31 @@ 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) { + msg.Ordering = channeltypes.NONE + } } return msg } diff --git a/e2e/testvalues/values.go b/e2e/testvalues/values.go index cadb6417686..b6f750ef7f7 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 the support for capital efficient fee escrow was released in. +var CapitalEfficientFeeEscrowFeatureReleases = semverutil.FeatureReleases{ + MajorVersion: "v9", + MinorVersions: []string{ + "v8.1", + }, +}