Skip to content

Commit

Permalink
Merge branch 'main' into carlos/run-all-tests-go-mods
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Sep 25, 2023
2 parents c4d6fe8 + 2bdb699 commit 592ac2b
Show file tree
Hide file tree
Showing 23 changed files with 628 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-compatibility-workflow-call.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
CHAIN_A_TAG: '${{ matrix.chain-a }}'
CHAIN_B_TAG: '${{ matrix.chain-b }}'
CHAIN_BINARY: 'simd'
RELAYER_TYPE: '${{ matrix.relayer-type }}'
RELAYER_ID: '${{ matrix.relayer-type }}'
- name: Upload Diagnostics
uses: actions/upload-artifact@v3
# we only want to upload logs on test failures.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
CHAIN_B_TAG: '${{ inputs.chain-b-tag }}'
RELAYER_IMAGE: '${{ inputs.relayer-image }}'
RELAYER_TAG: '${{ inputs.relayer-tag }}'
RELAYER_TYPE: '${{ inputs.relayer-type }}'
RELAYER_ID: '${{ inputs.relayer-type }}'
CHAIN_BINARY: '${{ inputs.chain-binary }}'
CHAIN_UPGRADE_TAG: '${{ inputs.chain-upgrade-tag }}'
CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}'
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
upgrade-v5-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -27,7 +27,7 @@ jobs:
relayer-type: hermes

upgrade-v7-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -41,7 +41,7 @@ jobs:
relayer-type: hermes

upgrade-v7_1-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -55,7 +55,7 @@ jobs:
relayer-type: hermes

upgrade-v8-hermes:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -69,7 +69,7 @@ jobs:
relayer-type: hermes

upgrade-v5-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -85,7 +85,7 @@ jobs:
relayer-tag: latest

upgrade-v7-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -101,7 +101,7 @@ jobs:
relayer-tag: latest

upgrade-v7_1-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand All @@ -117,7 +117,7 @@ jobs:
relayer-tag: latest

upgrade-v8-rly:
uses: cosmos/ibc-go/.github/workflows/e2e-test-workflow-call.yml@main
uses: .github/workflows/e2e-test-workflow-call.yml
with:
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
Expand Down
2 changes: 1 addition & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ options specified in your config file.
| CHAIN_B_TAG | The tag used for chain A | latest |
| CHAIN_BINARY | The binary used in the container | simd |
| RELAYER_TAG | The tag used for the relayer | main |
| RELAYER_TYPE | The type of relayer to use (rly/hermes) | rly |
| RELAYER_ID | The type of relayer to use (rly/hermes) | hermes |

> Note: when running tests locally, **no images are pushed** to the `ghcr.io/cosmos/ibc-go-simd` registry.
The images which are used only exist on your machine.
Expand Down
16 changes: 4 additions & 12 deletions e2e/relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ const (
type Config struct {
// Tag is the tag used for the relayer image.
Tag string `yaml:"tag"`
// Type specifies the type of relayer that this is.
Type string `yaml:"type"`
// ID specifies the type of relayer that this is.
ID string `yaml:"id"`
// Image is the image that should be used for the relayer.
Image string `yaml:"image"`
}

// New returns an implementation of ibc.Relayer depending on the provided RelayerType.
func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
t.Helper()
switch cfg.Type {
switch cfg.ID {
case Rly:
return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image)
case Hermes:
return newHermesRelayer(t, cfg.Tag, logger, dockerClient, network, cfg.Image)
default:
panic(fmt.Errorf("unknown relayer specified: %s", cfg.Type))
panic(fmt.Errorf("unknown relayer specified: %s", cfg.ID))
}
}

Expand All @@ -49,10 +49,6 @@ func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclien
func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer {
t.Helper()

if relayerImage == "" {
relayerImage = RlyRelayerRepository
}

customImageOption := relayer.CustomDockerImage(relayerImage, tag, rlyRelayerUser)
relayerProcessingOption := relayer.StartupFlags("-p", "events") // relayer processes via events

Expand All @@ -67,10 +63,6 @@ func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient
func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network, relayerImage string) ibc.Relayer {
t.Helper()

if relayerImage == "" {
relayerImage = HermesRelayerRepository
}

customImageOption := relayer.CustomDockerImage(relayerImage, tag, hermesRelayerUser)
relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, logger, customImageOption)

Expand Down
12 changes: 8 additions & 4 deletions e2e/sample.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ chains:
tag: main # override with CHAIN_B_TAG
binary: simd # override with CHAIN_BINARY

relayer:
type: hermes # override with RELAYER_TYPE
image: ghcr.io/informalsystems/hermes # override with RELAYER_IMAGE
tag: "bef2f53" # override with RELAYER_TAG
activeRelayer: hermes # override with RELAYER_ID
relayers:
- id: hermes
image: ghcr.io/informalsystems/hermes
tag: "bef2f53"
- id: rly
image: ghcr.io/cosmos/relayer
tag: "latest"

cometbft:
logLevel: info
Expand Down
42 changes: 36 additions & 6 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
test "github.com/strangelove-ventures/interchaintest/v8/testutil"
testifysuite "github.com/stretchr/testify/suite"

"cosmossdk.io/x/upgrade/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
Expand Down Expand Up @@ -85,6 +85,7 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() {
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)

const planHeight = int64(75)
const legacyPlanHeight = planHeight * 2
var newChainID string

t.Run("execute proposal for MsgIBCSoftwareUpgrade", func(t *testing.T) {
Expand All @@ -107,14 +108,14 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() {

scheduleUpgradeMsg, err := clienttypes.NewMsgIBCSoftwareUpgrade(
authority.String(),
types.Plan{
upgradetypes.Plan{
Name: "upgrade-client",
Height: planHeight,
},
upgradedClientState,
)
s.Require().NoError(err)
s.ExecuteGovV1Proposal(ctx, scheduleUpgradeMsg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, scheduleUpgradeMsg, chainA, chainAWallet)
})

t.Run("check that IBC software upgrade has been scheduled successfully on chainA", func(t *testing.T) {
Expand All @@ -132,6 +133,35 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() {
s.Require().Equal("upgrade-client", plan.Name)
s.Require().Equal(planHeight, plan.Height)
})

t.Run("ensure legacy proposal does not succeed", func(t *testing.T) {

authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA)
s.Require().NoError(err)
s.Require().NotNil(authority)

clientState, err := s.QueryClientState(ctx, chainB, ibctesting.FirstClientID)
s.Require().NoError(err)

originalChainID := clientState.(*ibctm.ClientState).ChainId
revisionNumber := clienttypes.ParseChainID(originalChainID)
// increment revision number even with new chain ID to prevent loss of misbehaviour detection support
newChainID, err = clienttypes.SetRevisionNumber(originalChainID, revisionNumber+1)
s.Require().NoError(err)
s.Require().NotEqual(originalChainID, newChainID)

upgradedClientState := clientState.ZeroCustomFields().(*ibctm.ClientState)
upgradedClientState.ChainId = newChainID

legacyUpgradeProposal, err := clienttypes.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, upgradetypes.Plan{
Name: "upgrade-client-legacy",
Height: legacyPlanHeight,
}, upgradedClientState)

s.Require().NoError(err)
txResp := s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, legacyUpgradeProposal)
s.AssertTxFailure(txResp, govtypes.ErrInvalidProposalContent)
})
}

// TestRecoverClient_Succeeds tests that a governance proposal to recover a client using a MsgRecoverClient is successful.
Expand Down Expand Up @@ -202,7 +232,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() {
s.Require().NoError(err)
recoverClientMsg := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID)
s.Require().NotNil(recoverClientMsg)
s.ExecuteGovV1Proposal(ctx, recoverClientMsg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, recoverClientMsg, chainA, chainAWallet)
})

t.Run("check status of each client", func(t *testing.T) {
Expand Down Expand Up @@ -353,7 +383,7 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
s.Require().NotNil(authority)

msg := clienttypes.NewMsgUpdateParams(authority.String(), clienttypes.NewParams(allowedClient))
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, msg, chainA, chainAWallet)
} else {
value, err := tmjson.Marshal([]string{allowedClient})
s.Require().NoError(err)
Expand All @@ -362,7 +392,7 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
s.Require().NotNil(authority)

msg := connectiontypes.NewMsgUpdateParams(authority.String(), connectiontypes.NewParams(delay))
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, msg, chainA, chainAWallet)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(ibcexported.ModuleName, string(connectiontypes.KeyMaxExpectedTimePerBlock), fmt.Sprintf(`"%d"`, delay)),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) {
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version)
s.ExecuteGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount)
s.ExecuteAndPassGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount)
})

t.Run("start relayer", func(t *testing.T) {
Expand Down Expand Up @@ -104,7 +104,7 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
}

msgSendTx := controllertypes.NewMsgSendTx(govModuleAddress.String(), ibctesting.FirstConnectionID, uint64(time.Hour.Nanoseconds()), packetData)
s.ExecuteGovV1Proposal(ctx, msgSendTx, chainA, controllerAccount)
s.ExecuteAndPassGovV1Proposal(ctx, msgSendTx, chainA, controllerAccount)
})

t.Run("verify tokens transferred", func(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/interchain_accounts/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ func (s *InterchainAccountsParamsTestSuite) TestControllerEnabledParam() {
Signer: authority.String(),
Params: controllertypes.NewParams(false),
}
s.ExecuteGovV1Proposal(ctx, &msg, chainA, controllerAccount)
s.ExecuteAndPassGovV1Proposal(ctx, &msg, chainA, controllerAccount)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(controllertypes.StoreKey, string(controllertypes.KeyControllerEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, controllerAccount, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainA, controllerAccount, proposal)
}
})

Expand Down Expand Up @@ -133,14 +133,14 @@ func (s *InterchainAccountsParamsTestSuite) TestHostEnabledParam() {
Signer: authority.String(),
Params: hosttypes.NewParams(false, []string{hosttypes.AllowAllHostMsgs}),
}
s.ExecuteGovV1Proposal(ctx, &msg, chainB, chainBUser)
s.ExecuteAndPassGovV1Proposal(ctx, &msg, chainB, chainBUser)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(hosttypes.StoreKey, string(hosttypes.KeyHostEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainB, chainBUser, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainB, chainBUser, proposal)
}
})

Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ func (s *TransferTestSuite) TestSendEnabledParam() {
t.Run("change send enabled parameter to disabled", func(t *testing.T) {
if isSelfManagingParams {
msg := transfertypes.NewMsgUpdateParams(govModuleAddress.String(), transfertypes.NewParams(false, true))
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, msg, chainA, chainAWallet)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(transfertypes.StoreKey, string(transfertypes.KeySendEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down Expand Up @@ -378,14 +378,14 @@ func (s *TransferTestSuite) TestReceiveEnabledParam() {
t.Run("change receive enabled parameter to disabled ", func(t *testing.T) {
if isSelfManagingParams {
msg := transfertypes.NewMsgUpdateParams(govModuleAddress.String(), transfertypes.NewParams(false, false))
s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet)
s.ExecuteAndPassGovV1Proposal(ctx, msg, chainA, chainAWallet)
} else {
changes := []paramsproposaltypes.ParamChange{
paramsproposaltypes.NewParamChange(transfertypes.StoreKey, string(transfertypes.KeyReceiveEnabled), "false"),
}

proposal := paramsproposaltypes.NewParameterChangeProposal(ibctesting.Title, ibctesting.Description, changes)
s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chainA, chainAWallet, proposal)
}
})

Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *UpgradeTestSuite) UpgradeChain(ctx context.Context, chain *cosmos.Cosmo
}

upgradeProposal := upgradetypes.NewSoftwareUpgradeProposal(fmt.Sprintf("upgrade from %s to %s", currentVersion, upgradeVersion), "upgrade chain E2E test", plan)
s.ExecuteGovV1Beta1Proposal(ctx, chain, wallet, upgradeProposal)
s.ExecuteAndPassGovV1Beta1Proposal(ctx, chain, wallet, upgradeProposal)

height, err := chain.Height(ctx)
s.Require().NoError(err, "error fetching height before upgrade")
Expand Down Expand Up @@ -376,7 +376,7 @@ func (s *UpgradeTestSuite) TestV6ToV7ChainUpgrade() {
// 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 {
if tc.GetActiveRelayerConfig().ID == e2erelayer.Hermes {
s.RestartRelayer(ctx, relayer)
}

Expand Down Expand Up @@ -563,7 +563,7 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() {
s.Require().NotNil(authority)

msg := clienttypes.NewMsgUpdateParams(authority.String(), clienttypes.NewParams(exported.Tendermint, "some-client"))
s.ExecuteGovV1Proposal(ctx, msg, chainB, chainBWallet)
s.ExecuteAndPassGovV1Proposal(ctx, msg, chainB, chainBWallet)
})

t.Run("query params", func(t *testing.T) {
Expand Down
Loading

0 comments on commit 592ac2b

Please sign in to comment.