fix(simapp,systemtests): fix chain upgrade (#22669)
This commit is contained in:
parent
b5b2f49e81
commit
a267da6ef6
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user