refactor(x/upgrade): migrate to appmodule.VersionMap (#20485)
This commit is contained in:
@@ -33,6 +33,7 @@ It is an exautive list of changes that completes the SimApp section in the [UPGR
|
||||
Always refer to the [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md) to understand the changes.
|
||||
|
||||
* [#20409](https://github.com/cosmos/cosmos-sdk/pull/20409) Add `tx` as `SkipStoreKeys` in `app_config.go`.
|
||||
* [#20485](https://github.com/cosmos/cosmos-sdk/pull/20485) The signature of `x/upgrade/types.UpgradeHandler` has changed to accept `appmodule.VersionMap` from `module.VersionMap`. These types are interchangeable, but usages of `UpradeKeeper.SetUpgradeHandler` may need to adjust their usages to match the new signature.
|
||||
|
||||
<!-- TODO: move changelog.md elements to here -->
|
||||
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ func TestRunMigrations(t *testing.T) {
|
||||
// their latest ConsensusVersion.
|
||||
_, err = app.ModuleManager.RunMigrations(
|
||||
app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}), configurator,
|
||||
module.VersionMap{
|
||||
appmodule.VersionMap{
|
||||
"accounts": accounts.AppModule{}.ConsensusVersion(),
|
||||
"bank": 1,
|
||||
"auth": auth.AppModule{}.ConsensusVersion(),
|
||||
@@ -247,7 +247,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
|
||||
// Run migrations only for "mock" module. We exclude it from
|
||||
// the VersionMap to simulate upgrading with a new module.
|
||||
_, err := app.ModuleManager.RunMigrations(ctx, app.Configurator(),
|
||||
module.VersionMap{
|
||||
appmodule.VersionMap{
|
||||
"bank": bank.AppModule{}.ConsensusVersion(),
|
||||
"auth": auth.AppModule{}.ConsensusVersion(),
|
||||
"authz": authzmodule.AppModule{}.ConsensusVersion(),
|
||||
|
||||
+2
-2
@@ -3,13 +3,13 @@ package simapp
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
"cosmossdk.io/x/accounts"
|
||||
epochstypes "cosmossdk.io/x/epochs/types"
|
||||
protocolpooltypes "cosmossdk.io/x/protocolpool/types"
|
||||
upgradetypes "cosmossdk.io/x/upgrade/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ const UpgradeName = "v050-to-v051"
|
||||
func (app SimApp) RegisterUpgradeHandlers() {
|
||||
app.UpgradeKeeper.SetUpgradeHandler(
|
||||
UpgradeName,
|
||||
func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
||||
func(ctx context.Context, _ upgradetypes.Plan, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) {
|
||||
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user