From 8262756a3a9723c9eccd6e1cedb9fde40a13aaf7 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Thu, 9 Feb 2023 13:11:44 +0000 Subject: [PATCH 01/18] Register required types for upgrade E2E tests --- e2e/testconfig/testconfig.go | 4 ++-- e2e/tests/upgrades/upgrade_test.go | 2 +- e2e/testsuite/codec.go | 5 ++++- e2e/testsuite/testsuite.go | 18 ++++++------------ 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/e2e/testconfig/testconfig.go b/e2e/testconfig/testconfig.go index 6c96c5942ba..5b3a3cad4f1 100644 --- a/e2e/testconfig/testconfig.go +++ b/e2e/testconfig/testconfig.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "os" - "strings" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -139,7 +138,8 @@ func GetChainBTag() string { // if the tests are running locally. // Note: github actions passes a CI env value of true by default to all runners. func IsCI() bool { - return strings.ToLower(os.Getenv("CI")) == "true" + //return strings.ToLower(os.Getenv("CI")) == "true" + return false } // ChainOptions stores chain configurations for the chains that will be diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 4a84e69a308..e9d912e6594 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -241,7 +241,7 @@ func (s *UpgradeTestSuite) TestV5ToV6ChainUpgrade() { t.Run("interchain account executes a bank transfer on behalf of the corresponding owner account", func(t *testing.T) { t.Run("fund interchain account wallet", func(t *testing.T) { - // fund the host account account so it has some $$ to send + // fund the host account, so it has some $$ to send err := chainB.SendFunds(ctx, interchaintest.FaucetAccountKeyName, ibc.WalletAmount{ Address: hostAccount, Amount: testvalues.StartingTokenAmount, diff --git a/e2e/testsuite/codec.go b/e2e/testsuite/codec.go index db0fa340b6c..93af7520e2c 100644 --- a/e2e/testsuite/codec.go +++ b/e2e/testsuite/codec.go @@ -10,6 +10,8 @@ import ( govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" grouptypes "github.com/cosmos/cosmos-sdk/x/group" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" @@ -42,7 +44,8 @@ func codecAndEncodingConfig() (*codec.ProtoCodec, simappparams.EncodingConfig) { authz.RegisterInterfaces(cfg.InterfaceRegistry) transfertypes.RegisterInterfaces(cfg.InterfaceRegistry) clienttypes.RegisterInterfaces(cfg.InterfaceRegistry) - + intertxtypes.RegisterInterfaces(cfg.InterfaceRegistry) + upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry) cdc := codec.NewProtoCodec(cfg.InterfaceRegistry) return cdc, cfg } diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 23558bae5e4..bc21442f2a6 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -49,10 +49,6 @@ const ( ChainBRelayerName = "rlyB" // DefaultGasValue is the default gas value used to configure tx.Factory DefaultGasValue = 500000 - // emptyLogs is the string value returned from `BroadcastMessages`. There are some situations in which - // the result is empty, when this happens we include the raw logs instead to get as much information - // amount the failure as possible. - emptyLogs = "[]" ) // E2ETestSuite has methods and functionality which can be shared among all test suites. @@ -403,14 +399,12 @@ func (s *E2ETestSuite) InitGRPCClients(chain *cosmos.CosmosChain) { // AssertValidTxResponse verifies that an sdk.TxResponse // has non-empty values. func (s *E2ETestSuite) AssertValidTxResponse(resp sdk.TxResponse) { - respLogsMsg := resp.Logs.String() - if respLogsMsg == emptyLogs { - respLogsMsg = resp.RawLog - } - s.Require().NotEqual(int64(0), resp.GasUsed, respLogsMsg) - s.Require().NotEqual(int64(0), resp.GasWanted, respLogsMsg) - s.Require().NotEmpty(resp.Events, respLogsMsg) - s.Require().NotEmpty(resp.Data, respLogsMsg) + errorMsg := fmt.Sprintf("%+v", resp) + s.Require().NotEmpty(resp.TxHash, errorMsg) + s.Require().NotEqual(int64(0), resp.GasUsed, errorMsg) + s.Require().NotEqual(int64(0), resp.GasWanted, errorMsg) + s.Require().NotEmpty(resp.Events, errorMsg) + s.Require().NotEmpty(resp.Data, errorMsg) } // AssertPacketRelayed asserts that the packet commitment does not exist on the sending chain. From 244271111af8e9788b2fca4521c5f7547ab0bd39 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Thu, 9 Feb 2023 13:12:24 +0000 Subject: [PATCH 02/18] removed temporary function update --- e2e/testconfig/testconfig.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/testconfig/testconfig.go b/e2e/testconfig/testconfig.go index 5b3a3cad4f1..6c96c5942ba 100644 --- a/e2e/testconfig/testconfig.go +++ b/e2e/testconfig/testconfig.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "os" + "strings" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -138,8 +139,7 @@ func GetChainBTag() string { // if the tests are running locally. // Note: github actions passes a CI env value of true by default to all runners. func IsCI() bool { - //return strings.ToLower(os.Getenv("CI")) == "true" - return false + return strings.ToLower(os.Getenv("CI")) == "true" } // ChainOptions stores chain configurations for the chains that will be From 47d6f74380b6e26e0dcf6e377877922e98906226 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Thu, 9 Feb 2023 13:40:15 +0000 Subject: [PATCH 03/18] registering additional types and specifying rc0 tag in upgrade test --- e2e/testsuite/codec.go | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/e2e/testsuite/codec.go b/e2e/testsuite/codec.go index 93af7520e2c..5ad4a78febe 100644 --- a/e2e/testsuite/codec.go +++ b/e2e/testsuite/codec.go @@ -16,7 +16,12 @@ import ( icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + v7migrations "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params" ) @@ -32,20 +37,30 @@ func EncodingConfig() simappparams.EncodingConfig { func codecAndEncodingConfig() (*codec.ProtoCodec, simappparams.EncodingConfig) { cfg := simappparams.MakeTestEncodingConfig() + + // ibc types + icacontrollertypes.RegisterInterfaces(cfg.InterfaceRegistry) + feetypes.RegisterInterfaces(cfg.InterfaceRegistry) + intertxtypes.RegisterInterfaces(cfg.InterfaceRegistry) + solomachine.RegisterInterfaces(cfg.InterfaceRegistry) + v7migrations.RegisterInterfaces(cfg.InterfaceRegistry) + transfertypes.RegisterInterfaces(cfg.InterfaceRegistry) + clienttypes.RegisterInterfaces(cfg.InterfaceRegistry) + channeltypes.RegisterInterfaces(cfg.InterfaceRegistry) + connectiontypes.RegisterInterfaces(cfg.InterfaceRegistry) + ibctmtypes.RegisterInterfaces(cfg.InterfaceRegistry) + + // all other types + upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry) banktypes.RegisterInterfaces(cfg.InterfaceRegistry) govv1beta1.RegisterInterfaces(cfg.InterfaceRegistry) govv1.RegisterInterfaces(cfg.InterfaceRegistry) authtypes.RegisterInterfaces(cfg.InterfaceRegistry) - feetypes.RegisterInterfaces(cfg.InterfaceRegistry) - icacontrollertypes.RegisterInterfaces(cfg.InterfaceRegistry) sdkcodec.RegisterInterfaces(cfg.InterfaceRegistry) grouptypes.RegisterInterfaces(cfg.InterfaceRegistry) proposaltypes.RegisterInterfaces(cfg.InterfaceRegistry) authz.RegisterInterfaces(cfg.InterfaceRegistry) - transfertypes.RegisterInterfaces(cfg.InterfaceRegistry) - clienttypes.RegisterInterfaces(cfg.InterfaceRegistry) - intertxtypes.RegisterInterfaces(cfg.InterfaceRegistry) - upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry) + cdc := codec.NewProtoCodec(cfg.InterfaceRegistry) return cdc, cfg } From 6ed71d8c904b914e9122a1b176217fdc0437eed9 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Thu, 9 Feb 2023 13:55:29 +0000 Subject: [PATCH 04/18] updated workflow tag --- .github/workflows/e2e-upgrade.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index 89d27e50924..303d2ffeb3e 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -24,7 +24,7 @@ jobs: chain-binary: simd chain-a-tag: v6.0.0 chain-b-tag: v6.0.0 - chain-upgrade-tag: v7.0.0 + chain-upgrade-tag: v7.0.0-rc0 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 From ae4ceb1a1d7c8b14ce6f6dd76dde1586956edca6 Mon Sep 17 00:00:00 2001 From: Cian Hatton Date: Thu, 9 Feb 2023 15:27:59 +0000 Subject: [PATCH 05/18] bump version to 6.1.0 --- .github/workflows/e2e-upgrade.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index 303d2ffeb3e..3f5ad92a957 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -22,8 +22,8 @@ jobs: - test: TestV6ToV7ChainUpgrade chain-image: ghcr.io/cosmos/ibc-go-simd chain-binary: simd - chain-a-tag: v6.0.0 - chain-b-tag: v6.0.0 + chain-a-tag: v6.1.0 + chain-b-tag: v6.1.0 chain-upgrade-tag: v7.0.0-rc0 steps: - uses: actions/checkout@v3 From b665d3f316c687c5d502be17f52c3298190bb528 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 10:18:56 +0100 Subject: [PATCH 06/18] adding keytables to params subspaces in app.go --- testing/simapp/app.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 6ed2411f9cd..36222c685d1 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -892,14 +892,14 @@ func BlockedAddresses() map[string]bool { func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable()) + paramsKeeper.Subspace(banktypes.ModuleName).WithKeyTable(banktypes.ParamKeyTable()) + paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable()) + paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) + paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) + paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) From 44c7ece61f8ce0919eef892da7e38f0e8060f0fc Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 10:40:58 +0100 Subject: [PATCH 07/18] replace with pr docker build for testing --- .github/workflows/e2e-upgrade.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index 3f5ad92a957..d173e3ef266 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -24,7 +24,7 @@ jobs: chain-binary: simd chain-a-tag: v6.1.0 chain-b-tag: v6.1.0 - chain-upgrade-tag: v7.0.0-rc0 + chain-upgrade-tag: pr-3136 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 From 4d1cf73443b37b6c25b6df091c27249c60cd1cfd Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 11:06:12 +0100 Subject: [PATCH 08/18] adding more wait for blocks --- e2e/tests/upgrades/upgrade_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index e9d912e6594..42bef31e48b 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -517,6 +517,8 @@ func (s *UpgradeTestSuite) TestV6ToV7ChainUpgrade() { }) t.Run("check that the tendermint clients are active again after upgrade", func(t *testing.T) { + s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA)) + status, err := s.QueryClientStatus(ctx, chainA, testvalues.TendermintClientID(0)) s.Require().NoError(err) s.Require().Equal(exported.Active.String(), status) From d8e3e0569d57151c36084712bbd9841e73656153 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 12:18:00 +0100 Subject: [PATCH 09/18] temporarily add new grpc services --- testing/simapp/app.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 36222c685d1..742e433b333 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -7,6 +7,8 @@ import ( "os" "path/filepath" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" _ "github.com/cosmos/cosmos-sdk/client/docs/statik" // this is used for serving docs @@ -14,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -659,6 +662,14 @@ func NewSimApp( app.setupUpgradeHandlers() + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) + + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) From 889f0c1b574219416d421c69bd40eb6b62b8ac43 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 12:18:34 +0100 Subject: [PATCH 10/18] removing last addition --- testing/simapp/app.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 742e433b333..36222c685d1 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -7,8 +7,6 @@ import ( "os" "path/filepath" - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" _ "github.com/cosmos/cosmos-sdk/client/docs/statik" // this is used for serving docs @@ -16,7 +14,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -662,14 +659,6 @@ func NewSimApp( app.setupUpgradeHandlers() - autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) - - reflectionSvc, err := runtimeservices.NewReflectionService() - if err != nil { - panic(err) - } - reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) - if loadLatest { if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) From e7203d0bd88aea830f930eaeffac06c94d1e8685 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 20:19:22 +0100 Subject: [PATCH 11/18] configure store loaders for upgrade --- testing/simapp/app.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 36222c685d1..073f5225e5a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -2,6 +2,7 @@ package simapp import ( "encoding/json" + "fmt" "io" "net/http" "os" @@ -305,7 +306,7 @@ func NewSimApp( app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[upgradetypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) bApp.SetParamStore(&app.ConsensusParamsKeeper) // add capability keeper and ScopeToModule for ibc module @@ -658,6 +659,7 @@ func NewSimApp( app.SetEndBlocker(app.EndBlocker) app.setupUpgradeHandlers() + app.setupUpgradeStoreLoaders() if loadLatest { if err := app.LoadLatestVersion(); err != nil { @@ -941,3 +943,20 @@ func (app *SimApp) setupUpgradeHandlers() { ), ) } + +// setupUpgradeStoreLoaders sets all necessary store loaders required by upgrades. +func (app *SimApp) setupUpgradeStoreLoaders() { + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + tmos.Exit(fmt.Sprintf("failed to read upgrade info from disk %s", err)) + } + + if upgradeInfo.Name == v7.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Added: []string{consensusparamtypes.StoreKey}, + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } +} From 306a93568fe6b24d029dc2ce4395bdab1b542ed0 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 20:33:53 +0100 Subject: [PATCH 12/18] adding consensus params migration from baseapp --- testing/simapp/app.go | 2 ++ testing/simapp/upgrades/v7/upgrades.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 073f5225e5a..bf6d8f4c39c 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -940,6 +940,8 @@ func (app *SimApp) setupUpgradeHandlers() { app.configurator, app.appCodec, app.IBCKeeper.ClientKeeper, + app.ConsensusParamsKeeper, + app.ParamsKeeper, ), ) } diff --git a/testing/simapp/upgrades/v7/upgrades.go b/testing/simapp/upgrades/v7/upgrades.go index 4cea0b5a9b0..9abf162bda4 100644 --- a/testing/simapp/upgrades/v7/upgrades.go +++ b/testing/simapp/upgrades/v7/upgrades.go @@ -1,9 +1,14 @@ package v7 import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + consensusparamskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" @@ -21,6 +26,8 @@ func CreateUpgradeHandler( configurator module.Configurator, cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper, + consensusParamsKeeper consensusparamskeeper.Keeper, + paramsKeeper paramskeeper.Keeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { // OPTIONAL: prune expired tendermint consensus states to save storage space @@ -28,6 +35,13 @@ func CreateUpgradeHandler( return nil, err } + legacyBaseAppSubspace, ok := paramsKeeper.GetSubspace(baseapp.Paramspace) + if !ok { + return nil, fmt.Errorf("baseapp subspace not found") + } + + baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) + return mm.RunMigrations(ctx, configurator, vm) } } From fe6ad84d3bd3d40fa5bee25a271ca0fcb900b502 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 20:53:53 +0100 Subject: [PATCH 13/18] testing without baseapp param migration --- testing/simapp/upgrades/v7/upgrades.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/testing/simapp/upgrades/v7/upgrades.go b/testing/simapp/upgrades/v7/upgrades.go index 9abf162bda4..1f7a0a38b11 100644 --- a/testing/simapp/upgrades/v7/upgrades.go +++ b/testing/simapp/upgrades/v7/upgrades.go @@ -1,9 +1,6 @@ package v7 import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -35,12 +32,12 @@ func CreateUpgradeHandler( return nil, err } - legacyBaseAppSubspace, ok := paramsKeeper.GetSubspace(baseapp.Paramspace) - if !ok { - return nil, fmt.Errorf("baseapp subspace not found") - } + // legacyBaseAppSubspace, ok := paramsKeeper.GetSubspace(baseapp.Paramspace) + // if !ok { + // return nil, fmt.Errorf("baseapp subspace not found") + // } - baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) + // baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) return mm.RunMigrations(ctx, configurator, vm) } From 14f19d797c6d4b9231cde2e63df2404b31a977b9 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 10 Feb 2023 21:16:15 +0100 Subject: [PATCH 14/18] readd baseapp params migration --- testing/simapp/upgrades/v7/upgrades.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/testing/simapp/upgrades/v7/upgrades.go b/testing/simapp/upgrades/v7/upgrades.go index 1f7a0a38b11..4621c06339b 100644 --- a/testing/simapp/upgrades/v7/upgrades.go +++ b/testing/simapp/upgrades/v7/upgrades.go @@ -1,11 +1,13 @@ package v7 import ( + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" consensusparamskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" @@ -32,12 +34,8 @@ func CreateUpgradeHandler( return nil, err } - // legacyBaseAppSubspace, ok := paramsKeeper.GetSubspace(baseapp.Paramspace) - // if !ok { - // return nil, fmt.Errorf("baseapp subspace not found") - // } - - // baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) + legacyBaseAppSubspace := paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) + baseapp.MigrateParams(ctx, legacyBaseAppSubspace, &consensusParamsKeeper) return mm.RunMigrations(ctx, configurator, vm) } From 82594a1d31c37d2b5392111d31fcb8ad565423c2 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 13 Feb 2023 10:11:05 +0100 Subject: [PATCH 15/18] commiting updates, autocli and reflection svc --- e2e/scripts/run-e2e.sh | 2 +- testing/simapp/app.go | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/e2e/scripts/run-e2e.sh b/e2e/scripts/run-e2e.sh index 2703dd50e0d..d124916d2f8 100755 --- a/e2e/scripts/run-e2e.sh +++ b/e2e/scripts/run-e2e.sh @@ -13,7 +13,7 @@ export CHAIN_BINARY="${CHAIN_BINARY:-simd}" # context for building the image is one directory up. if [ "${CI:-}" != "true" ] then - (cd ..; docker build . -t "${CHAIN_IMAGE}:${CHAIN_A_TAG}") + (cd ..; docker build . -t "${CHAIN_IMAGE}:${CHAIN_A_TAG} --build-arg="IBC_GO_VERSION=${CHAIN_A_TAG}") fi go test -v ./tests/... --run ${ENTRY_POINT} -testify.m ^${TEST}$ diff --git a/testing/simapp/app.go b/testing/simapp/app.go index bf6d8f4c39c..32e432e0165 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -8,6 +8,8 @@ import ( "os" "path/filepath" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" _ "github.com/cosmos/cosmos-sdk/client/docs/statik" // this is used for serving docs @@ -15,6 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -603,6 +606,14 @@ func NewSimApp( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) + + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + // add test gRPC service for testing gRPC queries in isolation testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) @@ -825,6 +836,9 @@ func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICon // Register legacy and grpc-gateway routes for all modules. ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register nodeservice grpc-gateway routes. + nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // register swagger API from root so that other applications can override easily if apiConfig.Swagger { RegisterSwaggerAPI(clientCtx, apiSvr.Router) @@ -955,7 +969,9 @@ func (app *SimApp) setupUpgradeStoreLoaders() { if upgradeInfo.Name == v7.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{consensusparamtypes.StoreKey}, + Added: []string{ + consensusparamtypes.StoreKey, + }, } // configure store loader that checks if version == upgradeHeight and applies store upgrades From dc9907d9ef88ad4af8f31e88b7f9b95e1ab1ac19 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 13 Feb 2023 10:50:29 +0100 Subject: [PATCH 16/18] fix in run e2e script --- e2e/scripts/run-e2e.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/scripts/run-e2e.sh b/e2e/scripts/run-e2e.sh index d124916d2f8..e0afbe5abbf 100755 --- a/e2e/scripts/run-e2e.sh +++ b/e2e/scripts/run-e2e.sh @@ -13,7 +13,7 @@ export CHAIN_BINARY="${CHAIN_BINARY:-simd}" # context for building the image is one directory up. if [ "${CI:-}" != "true" ] then - (cd ..; docker build . -t "${CHAIN_IMAGE}:${CHAIN_A_TAG} --build-arg="IBC_GO_VERSION=${CHAIN_A_TAG}") + (cd ..; docker build . -t "${CHAIN_IMAGE}:${CHAIN_A_TAG}" --build-arg="IBC_GO_VERSION=${CHAIN_A_TAG}") fi go test -v ./tests/... --run ${ENTRY_POINT} -testify.m ^${TEST}$ From 9f0565a2b3ce14cb627bc1086aef16cd544744c1 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 13 Feb 2023 12:30:38 +0100 Subject: [PATCH 17/18] adding crisis storekey to store upgrades --- testing/simapp/app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 32e432e0165..7143af6a41a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -971,6 +971,7 @@ func (app *SimApp) setupUpgradeStoreLoaders() { storeUpgrades := storetypes.StoreUpgrades{ Added: []string{ consensusparamtypes.StoreKey, + crisistypes.StoreKey, }, } From 641b25efb5d88f15b49413d2e48053fa5643c28b Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 13 Feb 2023 14:56:45 +0100 Subject: [PATCH 18/18] removing additional wait for blocks --- e2e/tests/upgrades/upgrade_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 42bef31e48b..e9d912e6594 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -517,8 +517,6 @@ func (s *UpgradeTestSuite) TestV6ToV7ChainUpgrade() { }) t.Run("check that the tendermint clients are active again after upgrade", func(t *testing.T) { - s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA)) - status, err := s.QueryClientStatus(ctx, chainA, testvalues.TendermintClientID(0)) s.Require().NoError(err) s.Require().Equal(exported.Active.String(), status)