diff --git a/.github/workflows/e2e-test-workflow-call.yml b/.github/workflows/e2e-test-workflow-call.yml index 54a34c17444..2731c9c90cf 100644 --- a/.github/workflows/e2e-test-workflow-call.yml +++ b/.github/workflows/e2e-test-workflow-call.yml @@ -31,11 +31,6 @@ on: description: 'The tag to use for chain B' required: true type: string - chain-upgrade-tag: - default: '' - description: 'The image tag that the chain will be upgraded to' - required: false - type: string # upgrade-plan-name is only required during upgrade tests, and is otherwise ignored. upgrade-plan-name: default: '' @@ -77,7 +72,6 @@ jobs: run: | echo "Chain A Tag: ${{ inputs.chain-a-tag }}" echo "Chain B Tag: ${{ inputs.chain-b-tag }}" - echo "Chain Upgrade Tag: ${{ inputs.chain-upgrade-tag }}" echo "Upgrade Plan Name: ${{ inputs.upgrade-plan-name }}" echo "Test Entry Point: ${{ inputs.test-entry-point }}" echo "Test: ${{ inputs.test }}" @@ -201,6 +195,7 @@ jobs: - docker-build - docker-build-wasm env: + CHAIN_UPGRADE_PLAN: '${{ inputs.upgrade-plan-name }}' CHAIN_A_TAG: '${{ inputs.chain-a-tag }}' CHAIN_B_TAG: '${{ inputs.chain-b-tag }}' E2E_CONFIG_PATH: '${{ inputs.e2e-config-path }}' diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index 25a906c966b..7d2980c577d 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -5,215 +5,110 @@ on: branches: - main paths: - # upgrade tests will run on any changes to the upgrade_test.go file. + # upgrade tests will run on any changes to the upgrade_test.go file, + # and changes to the workflow itself. - 'e2e/tests/upgrades/upgrade_test.go' + - '.github/workflows/e2e-upgrade.yaml' schedule: - cron: '0 0 * * *' jobs: - upgrade-v7-hermes: + upgrade-v7: uses: ./.github/workflows/e2e-test-workflow-call.yml 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: hermes - upgrade-v7_1-hermes: + upgrade-v7_1: uses: ./.github/workflows/e2e-test-workflow-call.yml 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: hermes - upgrade-v8-hermes: + upgrade-v8: uses: ./.github/workflows/e2e-test-workflow-call.yml 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: v8.0.0 upgrade-plan-name: "v8" test-entry-point: "TestUpgradeTestSuite" test: "TestV7ToV8ChainUpgrade" upload-logs: true - relayer-type: hermes - upgrade-v8_1-hermes: + upgrade-v8_1: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd chain-a-tag: v8.0.0 chain-b-tag: v8.0.0 - chain-upgrade-tag: v8.1.0 upgrade-plan-name: "v8.1" test-entry-point: "TestUpgradeTestSuite" test: "TestV8ToV8_1ChainUpgrade" upload-logs: true - relayer-type: hermes - upgrade-v8_1-channel-upgrades-hermes: + upgrade-v8_1-channel-upgrades: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd chain-a-tag: v8.0.0 chain-b-tag: v8.0.0 - chain-upgrade-tag: v8.1.0 upgrade-plan-name: "v8.1" test-entry-point: "TestUpgradeTestSuite" test: "TestV8ToV8_1ChainUpgrade_FeeMiddlewareChannelUpgrade" upload-logs: true - relayer-type: hermes - upgrade-v7-rly: - uses: ./.github/workflows/e2e-test-workflow-call.yml - 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: ./.github/workflows/e2e-test-workflow-call.yml - 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: ./.github/workflows/e2e-test-workflow-call.yml - 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: v8.0.0 - 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 - - upgrade-v8_1-rly: - uses: ./.github/workflows/e2e-test-workflow-call.yml - with: - chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd - chain-a-tag: v8.0.0 - chain-b-tag: v8.0.0 - chain-upgrade-tag: v8.1.0 - upgrade-plan-name: "v8.1" - test-entry-point: "TestUpgradeTestSuite" - test: "TestV8ToV8_1ChainUpgrade" - upload-logs: true - relayer-type: rly - relayer-image: ghcr.io/cosmos/relayer - relayer-tag: latest - - upgrade-ibcwasm-v8-hermes: + upgrade-ibcwasm-v8: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-wasm-simd - chain-binary: simd chain-a-tag: v7.3.0-e2e-upgrade chain-b-tag: v7.3.0-e2e-upgrade - chain-upgrade-tag: v8.0.0-e2e-upgrade upgrade-plan-name: "ibcwasm-v8" test-entry-point: "TestIBCWasmUpgradeTestSuite" test: "TestIBCWasmChainUpgrade" upload-logs: true - relayer-type: hermes - - upgrade-v9-hermes: - uses: ./.github/workflows/e2e-test-workflow-call.yml - with: - chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd - chain-a-tag: v8.4.0 - chain-b-tag: v8.4.0 - chain-upgrade-tag: main # TODO: Update tag to v9.0.0 once it is (pre)released - upgrade-plan-name: "v9" - test-entry-point: "TestUpgradeTestSuite" - test: "TestV8ToV9ChainUpgrade" - upload-logs: true - relayer-type: hermes - upgrade-v9-rly: + upgrade-v9: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd chain-a-tag: v8.4.0 chain-b-tag: v8.4.0 - chain-upgrade-tag: main # TODO: Update tag to v9.0.0 once it is (pre)released upgrade-plan-name: "v9" test-entry-point: "TestUpgradeTestSuite" test: "TestV8ToV9ChainUpgrade" upload-logs: true - relayer-type: rly - relayer-image: ghcr.io/cosmos/relayer - relayer-tag: latest upgrade-v9-localhost: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd chain-a-tag: v8.4.0 chain-b-tag: v8.4.0 - chain-upgrade-tag: main # TODO: Update tag to v9.0.0 once it is (pre)released upgrade-plan-name: "v9" test-entry-point: "TestUpgradeTestSuite" test: "TestV8ToV9ChainUpgrade_Localhost" upload-logs: true - relayer-type: hermes - upgrade-v9-channel-upgrades-hermes: + upgrade-v9-channel-upgrades: uses: ./.github/workflows/e2e-test-workflow-call.yml with: chain-image: ghcr.io/cosmos/ibc-go-simd - chain-binary: simd chain-a-tag: v8.4.0 - chain-b-tag: main # TODO: Update tag to v9.0.0 once it is (pre)released - chain-upgrade-tag: main # TODO: Update tag to v9.0.0 once it is (pre)released + chain-b-tag: v8.4.0 upgrade-plan-name: "v9" test-entry-point: "TestUpgradeTestSuite" test: "TestV8ToV9ChainUpgrade_ICS20v2ChannelUpgrade" upload-logs: true - relayer-type: hermes diff --git a/e2e/ci-e2e-config.yaml b/e2e/ci-e2e-config.yaml index b855c434eea..96322612884 100644 --- a/e2e/ci-e2e-config.yaml +++ b/e2e/ci-e2e-config.yaml @@ -18,18 +18,18 @@ --- chains: # the entry at index 0 corresponds to CHAIN_A -- chainId: chainA-1 - numValidators: 4 - numFullNodes: 1 - image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE - binary: simd # override with CHAIN_BINARY - - # the entry at index 1 corresponds to CHAIN_B -- chainId: chainB-1 - numValidators: 4 - numFullNodes: 1 - image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE - binary: simd # override with CHAIN_BINARY + - chainId: chainA-1 + numValidators: 4 + numFullNodes: 1 + image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE + binary: simd # override with CHAIN_BINARY + + # the entry at index 1 corresponds to CHAIN_B + - chainId: chainB-1 + numValidators: 4 + numFullNodes: 1f + image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE + binary: simd # override with CHAIN_BINARY activeRelayer: hermes # override with RELAYER_ID relayers: @@ -51,3 +51,18 @@ debug: dumpLogs: false # settings this value to true will keep the containers running after the test finishes. keepContainers: true + +upgradePlanName: "" +upgrades: + - planName: "v7" + tag: "v7.0.0" + - planName: "v7.1" + tag: "v7.1.0" + - planName: "v8" + tag: "v8.0.0" + - planName: "v8.1" + tag: "v8.1.0" + - planName: "v9" + tag: "v9.0.0" + - planName: "ibcwasm-v8" + tag: "v8.0.0-e2e-upgrade" diff --git a/e2e/sample.config.extended.yaml b/e2e/sample.config.extended.yaml index f14db4912dd..e45160f971f 100644 --- a/e2e/sample.config.extended.yaml +++ b/e2e/sample.config.extended.yaml @@ -58,9 +58,17 @@ debug: # settings this value to true will keep the containers running after the test finishes. keepContainers: true -# Required only for upgrade tests. -# Chain A will be upgraded the specified tag. -# The plan name must be registered as an upgrade handler in the given tag. -upgrade: - planName: "" # override with CHAIN_UPGRADE_PLAN - tag: "" # override with CHAIN_UPGRADE_TAG +upgradePlanName: "" # specify a value that matches a planName in the upgrades list below. +upgrades: + - planName: "v7" + tag: "v7.0.0" + - planName: "v7.1" + tag: "v7.1.0" + - planName: "v8" + tag: "v8.0.0" + - planName: "v8.1" + tag: "v8.1.0" + - planName: "v9" + tag: "v9.0.0" + - planName: "ibcwasm-v8" + tag: "v8.0.0-e2e-upgrade" diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index b2fc69cff28..00b00668b23 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -46,7 +46,7 @@ const ( func TestUpgradeTestSuite(t *testing.T) { testCfg := testsuite.LoadConfig() - if testCfg.UpgradeConfig.Tag == "" || testCfg.UpgradeConfig.PlanName == "" { + if testCfg.UpgradePlanName == "" { t.Fatalf("%s and %s must be set when running an upgrade test", testsuite.ChainUpgradeTagEnv, testsuite.ChainUpgradePlanEnv) } diff --git a/e2e/testsuite/testconfig.go b/e2e/testsuite/testconfig.go index 291bef4bc30..deb20e0f051 100644 --- a/e2e/testsuite/testconfig.go +++ b/e2e/testsuite/testconfig.go @@ -102,6 +102,11 @@ type TestConfig struct { CometBFTConfig CometBFTConfig `yaml:"cometbft"` // DebugConfig holds configuration for miscellaneous options. DebugConfig DebugConfig `yaml:"debug"` + // UpgradePlanName specifies which upgrade plan to use. It must match a plan name for an entry in the + // list of UpgradeConfigs. + UpgradePlanName string `yaml:"upgradePlanName"` + // UpgradeConfigs provides a list of all possible upgrades. + UpgradeConfigs []UpgradeConfig `yaml:"upgrades"` } // Validate validates the test configuration is valid for use within the tests. @@ -118,6 +123,11 @@ func (tc TestConfig) Validate() error { if err := tc.validateGenesisDebugConfig(); err != nil { return fmt.Errorf("invalid Genesis debug configuration: %w", err) } + + if err := tc.validateUpgradeConfig(); err != nil { + return fmt.Errorf("invalid upgrade configuration: %w", err) + } + return nil } @@ -173,6 +183,16 @@ func (tc TestConfig) validateRelayers() error { return nil } +// GetUpgradeConfig returns the upgrade configuration for the current test configuration. +func (tc TestConfig) GetUpgradeConfig() UpgradeConfig { + for _, upgrade := range tc.UpgradeConfigs { + if upgrade.PlanName == tc.UpgradePlanName { + return upgrade + } + } + panic("upgrade plan not found in upgrade configs, this test config should not have passed validation") +} + // GetChainIndex returns the index of the chain with the given name, if it // exists. func (tc TestConfig) GetChainIndex(name string) (int, error) { @@ -198,6 +218,35 @@ func (tc TestConfig) validateGenesisDebugConfig() error { return err } +// validateUpgradeConfig ensures the upgrade configuration is valid. +func (tc TestConfig) validateUpgradeConfig() error { + if strings.TrimSpace(tc.UpgradePlanName) == "" { + return nil + } + + // the upgrade plan name specified must match one of the upgrade plans in the upgrade configs. + foundPlan := false + for _, upgrade := range tc.UpgradeConfigs { + if strings.TrimSpace(upgrade.Tag) == "" { + return fmt.Errorf("upgrade config missing tag: %+v", upgrade) + } + + if strings.TrimSpace(upgrade.PlanName) == "" { + return fmt.Errorf("upgrade config missing plan name: %+v", upgrade) + } + + if upgrade.PlanName == tc.UpgradePlanName { + foundPlan = true + } + } + + if foundPlan { + return nil + } + + return fmt.Errorf("upgrade plan %s not found in upgrade configs: %+v", tc.UpgradePlanName, tc.UpgradeConfigs) +} + // GetActiveRelayerConfig returns the currently specified relayer config. func (tc TestConfig) GetActiveRelayerConfig() *relayer.Config { for _, r := range tc.RelayerConfigs { @@ -418,7 +467,7 @@ func applyEnvironmentVariableOverrides(fromFile TestConfig) TestConfig { } if os.Getenv(ChainUpgradePlanEnv) != "" { - fromFile.UpgradeConfig.PlanName = envTc.UpgradeConfig.PlanName + fromFile.UpgradePlanName = envTc.UpgradeConfig.PlanName } if os.Getenv(ChainUpgradeTagEnv) != "" { @@ -435,10 +484,10 @@ func applyEnvironmentVariableOverrides(fromFile TestConfig) TestConfig { // fromEnv returns a TestConfig constructed from environment variables. func fromEnv() TestConfig { return TestConfig{ - ChainConfigs: getChainConfigsFromEnv(), - UpgradeConfig: getUpgradePlanConfigFromEnv(), - ActiveRelayer: os.Getenv(RelayerIDEnv), - CometBFTConfig: CometBFTConfig{LogLevel: "info"}, + ChainConfigs: getChainConfigsFromEnv(), + UpgradePlanName: os.Getenv(ChainUpgradePlanEnv), + ActiveRelayer: os.Getenv(RelayerIDEnv), + CometBFTConfig: CometBFTConfig{LogLevel: "info"}, } }