refactor(x/upgrade)!: use KVStoreService and context.Context (#16227)
This commit is contained in:
+1
-1
@@ -358,7 +358,7 @@ func NewSimApp(
|
||||
}
|
||||
homePath := cast.ToString(appOpts.Get(flags.FlagHome))
|
||||
// set the governance module account as the authority for conducting upgrades
|
||||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
// Register the proposal types
|
||||
// Deprecated: Avoid adding new handlers, instead use the new proposal flow
|
||||
|
||||
+2
-1
@@ -270,7 +270,8 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
|
||||
|
||||
// make sure the upgrade keeper has version map in state
|
||||
ctx := app.NewContext(false)
|
||||
vm := app.UpgradeKeeper.GetModuleVersionMap(ctx)
|
||||
vm, err := app.UpgradeKeeper.GetModuleVersionMap(ctx)
|
||||
require.NoError(t, err)
|
||||
for v, i := range app.ModuleManager.Modules {
|
||||
if i, ok := i.(module.HasConsensusVersion); ok {
|
||||
require.Equal(t, vm[v], i.ConsensusVersion())
|
||||
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
package simapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
upgradetypes "cosmossdk.io/x/upgrade/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
)
|
||||
|
||||
@@ -19,7 +20,7 @@ const UpgradeName = "v047-to-v050"
|
||||
func (app SimApp) RegisterUpgradeHandlers() {
|
||||
app.UpgradeKeeper.SetUpgradeHandler(
|
||||
UpgradeName,
|
||||
func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
||||
func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
||||
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user