From a267da6ef6a79679333541e70458d2411688db8c Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Wed, 27 Nov 2024 15:51:11 +0100 Subject: [PATCH] fix(simapp,systemtests): fix chain upgrade (#22669) --- simapp/upgrades.go | 20 ++------------------ store/rootmulti/store.go | 2 +- tests/systemtests/upgrade_test.go | 5 +---- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/simapp/upgrades.go b/simapp/upgrades.go index fc754250b6ce..b2302ee53956 100644 --- a/simapp/upgrades.go +++ b/simapp/upgrades.go @@ -5,13 +5,8 @@ import ( "cosmossdk.io/core/appmodule" corestore "cosmossdk.io/core/store" - "cosmossdk.io/x/accounts" bankv2types "cosmossdk.io/x/bank/v2/types" - epochstypes "cosmossdk.io/x/epochs/types" - protocolpooltypes "cosmossdk.io/x/protocolpool/types" upgradetypes "cosmossdk.io/x/upgrade/types" - - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ) // UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade @@ -26,12 +21,6 @@ func (app SimApp) RegisterUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( UpgradeName, func(ctx context.Context, _ upgradetypes.Plan, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) { - // sync accounts and auth module account number - err := authkeeper.MigrateAccountNumberUnsafe(ctx, &app.AuthKeeper) - if err != nil { - return nil, err - } - return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) }, ) @@ -43,13 +32,8 @@ func (app SimApp) RegisterUpgradeHandlers() { if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := corestore.StoreUpgrades{ - Added: []string{ - accounts.StoreKey, - protocolpooltypes.StoreKey, - epochstypes.StoreKey, - bankv2types.ModuleName, - }, - Deleted: []string{"crisis"}, // The SDK discontinued the crisis module in v0.52.0 + Added: []string{bankv2types.StoreKey}, + Deleted: []string{}, } // configure store loader that checks if version == upgradeHeight and applies store upgrades diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 486fffebeba9..e821e930de7f 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -253,7 +253,7 @@ func (rs *Store) loadVersion(ver int64, upgrades *types.StoreUpgrades) error { store, err := rs.loadCommitStoreFromParams(key, commitID, storeParams) if err != nil { - return errorsmod.Wrap(err, "failed to load store") + return errorsmod.Wrapf(err, "failed to load store for %s", key.Name()) } newStores[key] = store diff --git a/tests/systemtests/upgrade_test.go b/tests/systemtests/upgrade_test.go index 94dc1b771e63..ae1e71903e9a 100644 --- a/tests/systemtests/upgrade_test.go +++ b/tests/systemtests/upgrade_test.go @@ -19,16 +19,13 @@ import ( ) func TestChainUpgrade(t *testing.T) { - // err> panic: failed to load latest version: failed to load store: initial version set to 22, but found earlier version 1 [cosmossdk.io/store@v1.1.1/rootmulti/store.go:256] - t.Skip("Skipped until any v052 artifact is available AND main branch handles the store upgrade proper") - // Scenario: // start a legacy chain with some state // when a chain upgrade proposal is executed // then the chain upgrades successfully systest.Sut.StopChain() - legacyBinary := FetchExecutable(t, "v0.52") + legacyBinary := FetchExecutable(t, "0.52.0-beta.3") t.Logf("+++ legacy binary: %s\n", legacyBinary) currentBranchBinary := systest.Sut.ExecBinary() currentInitializer := systest.Sut.TestnetInitializer()