Skip to content

Commit

Permalink
fix(e2e): compatibility e2e test fixes (cosmos#5761)
Browse files Browse the repository at this point in the history
* fix: allow dot character in docker image tags

* add capital efficient fee escrow feature releases

* add compatibility e2e tests for unordered ICA channel

* add unordered ica channels feature releases

* more fixes

* more ica fixes

* refactor: move ica unordered field conditionals to santize.Messages

* sanitize message contained in a x/gov or x/group proposal

---------

Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
crodriguezvega and damiannolan authored Jan 29, 2024
1 parent 162eee2 commit 22a1727
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"chain-a": [
"main"
],
"chain-b": [
"main",
"v8.1.0"
],
"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"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/build-callbacks-simd-image-from-tag.yml
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')"
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 @@ -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)
})

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
Loading

0 comments on commit 22a1727

Please sign in to comment.