Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(e2e): compatibility e2e test fixes #5761

Merged
merged 12 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added new files for compatibility testing of unordered ICA channels.

"chain-a": [
"main"
],
"chain-b": [
"main",
"v8.1.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work until the tag is created, but I added it already anyway, since I am not planning to run this workflow before the release.

],
"entrypoint": [
"TestInterchainAccountsTestSuite"
],
"test": [
"TestMsgSendTx_SuccessfulTransfer_UnorderedChannel"
],
"relayer-type": [
"hermes"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"chain-a": [
"main",
"v8.1.0"
],
"chain-b": [
"main"
],
"entrypoint": [
"TestInterchainAccountsTestSuite"
],
"test": [
"TestMsgSendTx_SuccessfulTransfer_UnorderedChannel"
],
"relayer-type": [
"hermes"
]
}
Original file line number Diff line number Diff line change
@@ -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"
]
}
Original file line number Diff line number Diff line change
@@ -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"
]
}
Original file line number Diff line number Diff line change
@@ -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"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the . as an allowed character in docker image tags.

docker build . -t "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}" -f modules/apps/callbacks/Dockerfile
docker push "${REGISTRY}/${ORG}/${IMAGE_NAME}:${docker_tag}"
2 changes: 1 addition & 1 deletion .github/workflows/build-simd-image-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 1 addition & 1 deletion .github/workflows/build-wasm-simd-image-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
4 changes: 2 additions & 2 deletions .github/workflows/e2e-compatibility-unreleased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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)
})

Expand Down
81 changes: 61 additions & 20 deletions e2e/tests/transfer/incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package transfer

import (
"context"
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
})
Expand Down
14 changes: 14 additions & 0 deletions e2e/testsuite/sanitize/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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.
Expand Down Expand Up @@ -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
}
Loading
Loading