Skip to content

Commit

Permalink
Upgrade Test Improvements (cosmos#4660)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Sep 18, 2023
1 parent 1321824 commit 059484d
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 5 deletions.
95 changes: 90 additions & 5 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:


jobs:
upgrade-v5:
upgrade-v5-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
Expand All @@ -24,8 +24,9 @@ jobs:
test-entry-point: "TestUpgradeTestSuite"
test: "TestIBCChainUpgrade"
upload-logs: true
relayer-type: hermes

upgrade-v6:
upgrade-v6-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-icad
Expand All @@ -37,8 +38,9 @@ jobs:
test-entry-point: "TestUpgradeTestSuite"
test: "TestV5ToV6ChainUpgrade"
upload-logs: true
relayer-type: hermes

upgrade-v7:
upgrade-v7-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
Expand All @@ -50,8 +52,9 @@ jobs:
test-entry-point: "TestUpgradeTestSuite"
test: "TestV6ToV7ChainUpgrade"
upload-logs: true
relayer-type: hermes

upgrade-v7_1:
upgrade-v7_1-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
Expand All @@ -63,8 +66,9 @@ jobs:
test-entry-point: "TestUpgradeTestSuite"
test: "TestV7ToV7_1ChainUpgrade"
upload-logs: true
relayer-type: hermes

upgrade-v8:
upgrade-v8-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
Expand All @@ -76,3 +80,84 @@ jobs:
test-entry-point: "TestUpgradeTestSuite"
test: "TestV7ToV8ChainUpgrade"
upload-logs: true
relayer-type: hermes

upgrade-v5-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
chain-a-tag: v4.4.1
chain-b-tag: v4.4.1
chain-upgrade-tag: v5.1.0
upgrade-plan-name: "normal upgrade"
test-entry-point: "TestUpgradeTestSuite"
test: "TestIBCChainUpgrade"
upload-logs: true
relayer-type: rly
relayer-image: ghcr.io/cosmos/relayer
relayer-tag: latest

upgrade-v6-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-icad
chain-binary: icad
chain-a-tag: v0.3.5
chain-b-tag: v0.3.5
chain-upgrade-tag: v0.4.1
upgrade-plan-name: "ibc-go/v6"
test-entry-point: "TestUpgradeTestSuite"
test: "TestV5ToV6ChainUpgrade"
upload-logs: true
relayer-type: rly
relayer-image: ghcr.io/cosmos/relayer
relayer-tag: latest

upgrade-v7-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
chain-a-tag: v6.1.0
chain-b-tag: v6.1.0
chain-upgrade-tag: v7.0.0
upgrade-plan-name: "v7"
test-entry-point: "TestUpgradeTestSuite"
test: "TestV6ToV7ChainUpgrade"
upload-logs: true
relayer-type: rly
relayer-image: ghcr.io/cosmos/relayer
relayer-tag: latest

upgrade-v7_1-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
chain-a-tag: v7.0.0
chain-b-tag: v7.0.0
chain-upgrade-tag: v7.1.0
upgrade-plan-name: "v7.1"
test-entry-point: "TestUpgradeTestSuite"
test: "TestV7ToV7_1ChainUpgrade"
upload-logs: true
relayer-type: rly
relayer-image: ghcr.io/cosmos/relayer
relayer-tag: latest

upgrade-v8-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
chain-a-tag: v7.0.0
chain-b-tag: v7.0.0
chain-upgrade-tag: main # TODO: update this to a real tag once v8 is released
upgrade-plan-name: "v8"
test-entry-point: "TestUpgradeTestSuite"
test: "TestV7ToV8ChainUpgrade"
upload-logs: true
relayer-type: rly
relayer-image: ghcr.io/cosmos/relayer
relayer-tag: latest
4 changes: 4 additions & 0 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() {

expected := testvalues.IBCTransferAmount
s.Require().Equal(expected, actualBalance.Int64())

if testvalues.DenomMetadataFeatureReleases.IsSupported(chainBVersion) {
s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA)
}
})

if testvalues.TokenMetadataFeatureReleases.IsSupported(chainBVersion) {
Expand Down
40 changes: 40 additions & 0 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/gogoproto/proto"

// intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
interchaintest "github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
Expand All @@ -20,6 +21,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

e2erelayer "github.com/cosmos/ibc-go/e2e/relayer"
"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
v7migrations "github.com/cosmos/ibc-go/v8/modules/core/02-client/migrations/v7"
Expand Down Expand Up @@ -563,6 +565,14 @@ func (s *UpgradeTestSuite) TestV6ToV7ChainUpgrade() {
s.UpgradeChain(ctx, chainA, chainAUpgradeProposalWallet, testCfg.UpgradeConfig.PlanName, testCfg.ChainConfigs[0].Tag, testCfg.UpgradeConfig.Tag)
})

// see this issue https://github.com/informalsystems/hermes/issues/3579
// this restart is a temporary workaround to a limitation in hermes requiring a restart
// in some cases after an upgrade.
tc := testsuite.LoadConfig()
if tc.RelayerConfig.Type == e2erelayer.Hermes {
s.RestartRelayer(ctx, relayer)
}

t.Run("check that the tendermint clients are active again after upgrade", func(t *testing.T) {
status, err := s.QueryClientStatus(ctx, chainA, testvalues.TendermintClientID(0))
s.Require().NoError(err)
Expand Down Expand Up @@ -669,6 +679,21 @@ func (s *UpgradeTestSuite) TestV7ToV7_1ChainUpgrade() {
expectedTotalEscrow := sdk.NewCoin(chainADenom, sdkmath.NewInt(testvalues.IBCTransferAmount))
s.Require().Equal(expectedTotalEscrow, actualTotalEscrow) // migration has run and total escrow amount has been set
})

t.Run("IBC token transfer from chainA to chainB, to make sure the upgrade did not break the packet flow", func(t *testing.T) {
transferTxResp := s.Transfer(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, testvalues.DefaultTransferAmount(chainADenom), chainAAddress, chainBAddress, s.GetTimeoutHeight(ctx, chainB), 0, "")
s.AssertTxSuccess(transferTxResp)
})

t.Run("packets are relayed", func(t *testing.T) {
s.AssertPacketRelayed(ctx, chainA, channelA.PortID, channelA.ChannelID, 1)

actualBalance, err := chainB.GetBalance(ctx, chainBAddress, chainBIBCToken.IBCDenom())
s.Require().NoError(err)

expected := testvalues.IBCTransferAmount * 2
s.Require().Equal(expected, actualBalance.Int64())
})
}

func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() {
Expand Down Expand Up @@ -748,6 +773,21 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() {
t.Run("query human readable ibc denom", func(t *testing.T) {
s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA)
})

t.Run("IBC token transfer from chainA to chainB, to make sure the upgrade did not break the packet flow", func(t *testing.T) {
transferTxResp := s.Transfer(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, testvalues.DefaultTransferAmount(chainADenom), chainAAddress, chainBAddress, s.GetTimeoutHeight(ctx, chainB), 0, "")
s.AssertTxSuccess(transferTxResp)
})

t.Run("packets are relayed", func(t *testing.T) {
s.AssertPacketRelayed(ctx, chainA, channelA.PortID, channelA.ChannelID, 1)

actualBalance, err := chainB.GetBalance(ctx, chainBAddress, chainBIBCToken.IBCDenom())
s.Require().NoError(err)

expected := testvalues.IBCTransferAmount * 2
s.Require().Equal(expected, actualBalance.Int64())
})
}

// RegisterInterchainAccount will attempt to register an interchain account on the counterparty chain.
Expand Down
6 changes: 6 additions & 0 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,12 @@ func (s *E2ETestSuite) StopRelayer(ctx context.Context, ibcrelayer ibc.Relayer)
s.Require().NoError(err)
}

// RestartRelayer restarts the given relayer.
func (s *E2ETestSuite) RestartRelayer(ctx context.Context, ibcrelayer ibc.Relayer) {
s.StopRelayer(ctx, ibcrelayer)
s.StartRelayer(ibcrelayer)
}

// CreateUserOnChainA creates a user with the given amount of funds on chain A.
func (s *E2ETestSuite) CreateUserOnChainA(ctx context.Context, amount int64) ibc.Wallet {
chainA, _ := s.GetChains()
Expand Down
5 changes: 5 additions & 0 deletions e2e/testvalues/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ var LocalhostClientFeatureReleases = semverutil.FeatureReleases{
"v7.1",
},
}

// DenomMetadataFeatureReleases represents the releases the human readable denom feature was released in.
var DenomMetadataFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v8",
}

0 comments on commit 059484d

Please sign in to comment.