Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/upgrade: added consensus version tracking (part of ADR-041) #8743

Merged
merged 42 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e900fb1
-added consensus version tracking to x/upgrade
technicallyty Mar 2, 2021
036db4f
-added interface to module manager -added e2e test for migrations usi…
technicallyty Mar 3, 2021
b640766
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 3, 2021
8c7b105
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 3, 2021
5c1ae59
Changed MigrationMap identifier to VersionMap
technicallyty Mar 4, 2021
4c48f35
updated docs
technicallyty Mar 4, 2021
6db21e3
forgot this
technicallyty Mar 4, 2021
c9b435a
added line to changelog for this PR
technicallyty Mar 4, 2021
1c5b132
Change set consensus version function to match adr 041 spec
technicallyty Mar 8, 2021
304abfa
add documentation
technicallyty Mar 8, 2021
d06bbbd
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 8, 2021
5c75ead
Merge branch 'ty-8514-module_tracking' of https://github.com/technica…
technicallyty Mar 8, 2021
e53423e
remove newline from changelog
technicallyty Mar 8, 2021
c36086f
updated example in simapp for RunMigrations, SetCurrentConsensusVersi…
technicallyty Mar 8, 2021
758c67d
switch TestMigrations to use Require instead of t.Fatal
technicallyty Mar 8, 2021
0dac9c2
Update CHANGELOG.md
technicallyty Mar 10, 2021
8f526ef
docs for SetVersionManager
technicallyty Mar 10, 2021
027740d
-init genesis method added -removed panics/fails from setting consens…
technicallyty Mar 11, 2021
18eaed2
merge master
technicallyty Mar 11, 2021
fc38e5a
update identifiers to be more go-like
technicallyty Mar 12, 2021
28d5c04
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 12, 2021
1fca959
update docs and UpgradeHandler fnc sig
technicallyty Mar 15, 2021
d912f4f
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 15, 2021
a99c538
Upgrade Keeper now takes a VersionMap instead of a VersionManager int…
technicallyty Mar 15, 2021
e6424ce
upgrade keeper transition to Version Map
technicallyty Mar 16, 2021
9b40fe7
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 16, 2021
799b646
cleanup, added versionmap return to RunMigrations
technicallyty Mar 16, 2021
0f9447c
quick fix
technicallyty Mar 16, 2021
a157c48
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 17, 2021
b839a59
Update docs/architecture/adr-041-in-place-store-migrations.md
technicallyty Mar 17, 2021
75f8ae5
remove support for versionmap field on upgrade keeper
technicallyty Mar 17, 2021
22ab55e
cleanup
technicallyty Mar 17, 2021
47ce533
merge adr change
technicallyty Mar 17, 2021
7f5b6aa
rename get/set version map keeper functions
technicallyty Mar 18, 2021
8547426
update adr doc to match name changes
technicallyty Mar 18, 2021
1504a2d
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 18, 2021
c3072ab
remove redudant line
technicallyty Mar 19, 2021
1f82fff
Merge branch 'ty-8514-module_tracking' of https://github.com/technica…
technicallyty Mar 19, 2021
cf1343f
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 19, 2021
3f6bea8
Merge branch 'master' into ty-8514-module_tracking
aaronc Mar 19, 2021
d987555
Merge branch 'master' into ty-8514-module_tracking
technicallyty Mar 19, 2021
5d6e4ab
Merge branch 'master' into ty-8514-module_tracking
mergify[bot] Mar 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [\#8629](https://github.com/cosmos/cosmos-sdk/pull/8629) Deprecated `SetFullFundraiserPath` from `Config` in favor of `SetPurpose` and `SetCoinType`.
* (x/upgrade) [\#8673](https://github.com/cosmos/cosmos-sdk/pull/8673) Remove IBC logic from x/upgrade. Deprecates IBC fields in an Upgrade Plan. IBC upgrade logic moved to 02-client and an IBC UpgradeProposal is added.
* (x/bank) [\#8517](https://github.com/cosmos/cosmos-sdk/pull/8517) `SupplyI` interface and `Supply` are removed and uses `sdk.Coins` for supply tracking
* (x/upgrade) [\#8743](https://github.com/cosmos/cosmos-sdk/pull/8743) `UpgradeHandler` includes a new argument `VersionMap` which helps facilitate in-place migrations.
* (x/auth) [\#8129](https://github.com/cosmos/cosmos-sdk/pull/8828) Updated `SigVerifiableTx.GetPubKeys` method signature to return error.


Expand Down
30 changes: 12 additions & 18 deletions docs/architecture/adr-041-in-place-store-migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,48 +82,42 @@ Each module's migration functions are specific to the module's store evolutions,
We introduce a new prefix store in `x/upgrade`'s store. This store will track each module's current version, it can be modelized as a `map[string]uint64` of module name to module ConsensusVersion, and will be used when running the migrations (see next section for details). The key prefix used is `0x1`, and the key/value format is:

```
0x2 | {bytes(module_name)} => LittleEndian(module_consensus_version)
0x2 | {bytes(module_name)} => BigEndian(module_consensus_version)
```

s
We add a new private field `versionManager` of type `VersionManager` to `x/upgrade`'s keeper, where `VersionManager` is:
We add a new private field `versionMap` of type `VersionMap` to `x/upgrade`'s keeper, where `VersionMap` is:

```go
type VersionManager interface {
GetConsensusVersions() VersionMap
}

// Map of module name => new module Consensus Version.
type VersionMap map[string]uint64
```

This `versionManager` field can be modified via the `SetVersionManager` field, and will allow the upgrade keeper to know the current versions of loaded modules. `SetVersionManager` MUST be called as early as possible in the app initialization; in the SDK's `simapp`, it is called in the `NewSimApp` constructor function.
This `versionMap` field can be modified via the `SetInitialVersionMap` field, and will allow the upgrade keeper to know the current versions of loaded modules. `SetInitialVersionMap` MUST be called AFTER the `module.NewManager()` is called; in the SDK's `simapp`, it is called in the `NewSimApp` constructor function.
technicallyty marked this conversation as resolved.
Show resolved Hide resolved

The UpgradeHandler signature needs to be updated to take a `VersionMap`, as well as return an error:
The UpgradeHandler signature needs to be updated to take a `VersionMap`, as well as return an upgraded `VersionMap` and an error:

```diff
- type UpgradeHandler func(ctx sdk.Context, plan Plan)
+ type UpgradeHandler func(ctx sdk.Context, plan Plan, versionMap VersionMap) error
+ type UpgradeHandler func(ctx sdk.Context, plan Plan, versionMap VersionMap) (VersionMap, error)
```

To apply an upgrade, we query the `VersionMap` from the `x/upgrade` store and pass it into the handler. The handler runs the actual migration functions (see next section), and if successful, the current ConsensusVersions of all loaded modules will be stored into state.
To apply an upgrade, we query the `VersionMap` from the `x/upgrade` store and pass it into the handler. The handler runs the actual migration functions (see next section), and if successful, returns an updated `VersionMap` to be stored in state.

```diff
func (k UpgradeKeeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) {
// --snip--
- handler(ctx, plan)
+ err := handler(ctx, plan, k.GetConsensusVersions()) // k.GetConsensusVersions() fetches the VersionMap stored in state.
+ updatedVM, err := handler(ctx, plan, k.GetConsensusVersions(ctx)) // k.GetConsensusVersions() fetches the VersionMap stored in state.
+ if err != nil {
+ return err
+ }
+
+ // Get the current ConsensusVersions of the loaded modules (retrieved from
+ // `k.versionManager`), and save them to state.
+ k.SetCurrentConsensusVersions()
+ // Set the updated consensus versions to state
+ k.setConsensusVersions(ctx, updatedVM)
}
```

An gRPC query endpoint to query the `VersionMap` stored in `x/upgrade`'s state will also be added, so that app developers can double-check the `VersionMap` before the upgrade handler runs.
A gRPC query endpoint to query the `VersionMap` stored in `x/upgrade`'s state will also be added, so that app developers can double-check the `VersionMap` before the upgrade handler runs.

### Running Migrations

Expand All @@ -139,8 +133,8 @@ If a required migration is missing (e.g. if it has not been registered in the `C
In practice, the `RunMigrations` method should be called from inside an `UpgradeHandler`.

```go
app.UpgradeKeeper.SetUpgradeHandler("my-plan", func(ctx sdk.Context, plan upgradetypes.Plan, versionMap VersionMap) error {
return app.mm.RunMigrations(ctx, versionMap)
app.UpgradeKeeper.SetUpgradeHandler("my-plan", func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, vm)
})
```

Expand Down
19 changes: 8 additions & 11 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,15 @@ func NewSimApp(
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
upgrade.NewAppModule(app.UpgradeKeeper),
upgrade.NewAppModule(&app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
params.NewAppModule(app.ParamsKeeper),
authz.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
)

// Pass the version map to the upgrade keeper
app.UpgradeKeeper.SetInitialVersionMap(app.mm.GetVersionMap())

// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
Expand All @@ -332,7 +335,7 @@ func NewSimApp(
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
app.mm.SetOrderInitGenesis(
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName,
upgradetypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName,
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName,
genutiltypes.ModuleName, evidencetypes.ModuleName, authztypes.ModuleName,
feegranttypes.ModuleName,
Expand Down Expand Up @@ -535,16 +538,10 @@ func (app *SimApp) RegisterTendermintService(clientCtx client.Context) {
//
// Example:
// cfg := module.NewConfigurator(...)
// app.UpgradeKeeper.SetUpgradeHandler("store-migration", func(ctx sdk.Context, plan upgradetypes.Plan) {
// err := app.RunMigrations(ctx, module.MigrationMap{
// "bank": 1, // Migrate x/bank from v1 to current x/bank's ConsensusVersion
// "staking": 8, // Migrate x/staking from v8 to current x/staking's ConsensusVersion
// })
// if err != nil {
// panic(err)
// }
// app.UpgradeKeeper.SetUpgradeHandler("store-migration", func(ctx sdk.Context, plan upgradetypes.Plan, versionMap module.VersionMap) {
// return app.RunMigrations(ctx, versionMap)
// })
func (app *SimApp) RunMigrations(ctx sdk.Context, migrateFromVersions module.MigrationMap) error {
func (app *SimApp) RunMigrations(ctx sdk.Context, migrateFromVersions module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, migrateFromVersions)
}

Expand Down
4 changes: 2 additions & 2 deletions simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ func TestRunMigrations(t *testing.T) {
// Run migrations only for bank. That's why we put the initial
// version for bank as 1, and for all other modules, we put as
// their latest ConsensusVersion.
err = app.RunMigrations(
_, err = app.RunMigrations(
app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}),
module.MigrationMap{
module.VersionMap{
"bank": 1,
"auth": auth.AppModule{}.ConsensusVersion(),
"authz": authz.AppModule{}.ConsensusVersion(),
Expand Down
28 changes: 21 additions & 7 deletions types/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,25 +333,27 @@ func (m *Manager) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) map[st
// MigrationHandler is the migration function that each module registers.
type MigrationHandler func(sdk.Context) error

// MigrationMap is a map of moduleName -> version, where version denotes the
// VersionMap is a map of moduleName -> version, where version denotes the
// version from which we should perform the migration for each module.
type MigrationMap map[string]uint64
type VersionMap map[string]uint64

// RunMigrations performs in-place store migrations for all modules.
func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, migrateFromVersions MigrationMap) error {
func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, fromVM VersionMap) (VersionMap, error) {
c, ok := cfg.(configurator)
if !ok {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", configurator{}, cfg)
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "expected %T, got %T", configurator{}, cfg)
}

updatedVM := make(VersionMap)
for moduleName, module := range m.Modules {
err := c.runModuleMigrations(ctx, moduleName, migrateFromVersions[moduleName], module.ConsensusVersion())
err := c.runModuleMigrations(ctx, moduleName, fromVM[moduleName], module.ConsensusVersion())
updatedVM[moduleName] = module.ConsensusVersion()
if err != nil {
return err
return nil, err
}
}

return nil
return updatedVM, nil
}

// BeginBlock performs begin block functionality for all modules. It creates a
Expand Down Expand Up @@ -395,3 +397,15 @@ func (m *Manager) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
Events: ctx.EventManager().ABCIEvents(),
}
}

// GetVersionMap gets consensus version from all modules
func (m *Manager) GetVersionMap() VersionMap {
vermap := make(VersionMap)
for _, v := range m.Modules {
version := v.ConsensusVersion()
name := v.Name()
vermap[name] = version
}

return vermap
}
4 changes: 4 additions & 0 deletions x/upgrade/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) {
}
}

func InitChainer(k keeper.Keeper, ctx sdk.Context) {
k.SetCurrentConsensusVersions(ctx)
}

// BuildUpgradeNeededMsg prints the message that notifies that an upgrade is needed.
func BuildUpgradeNeededMsg(plan types.Plan) string {
return fmt.Sprintf("UPGRADE \"%s\" NEEDED at %s: %s", plan.Name, plan.DueAt(), plan.Info)
Expand Down
15 changes: 11 additions & 4 deletions x/upgrade/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func setupTest(height int64, skip map[int64]bool) TestSuite {
s.keeper = app.UpgradeKeeper
s.ctx = app.BaseApp.NewContext(false, tmproto.Header{Height: height, Time: time.Now()})

s.module = upgrade.NewAppModule(s.keeper)
s.module = upgrade.NewAppModule(&s.keeper)
s.querier = s.module.LegacyQuerierHandler(app.LegacyAmino())
s.handler = upgrade.NewSoftwareUpgradeProposalHandler(s.keeper)
return s
Expand Down Expand Up @@ -105,7 +105,9 @@ func VerifyDoUpgrade(t *testing.T) {
})

t.Log("Verify that the upgrade can be successfully applied with a handler")
s.keeper.SetUpgradeHandler("test", func(ctx sdk.Context, plan types.Plan) {})
s.keeper.SetUpgradeHandler("test", func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
return vm, nil
})
require.NotPanics(t, func() {
s.module.BeginBlock(newCtx, req)
})
Expand All @@ -121,7 +123,9 @@ func VerifyDoUpgradeWithCtx(t *testing.T, newCtx sdk.Context, proposalName strin
})

t.Log("Verify that the upgrade can be successfully applied with a handler")
s.keeper.SetUpgradeHandler(proposalName, func(ctx sdk.Context, plan types.Plan) {})
s.keeper.SetUpgradeHandler(proposalName, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
return vm, nil
})
require.NotPanics(t, func() {
s.module.BeginBlock(newCtx, req)
})
Expand All @@ -133,7 +137,10 @@ func TestHaltIfTooNew(t *testing.T) {
s := setupTest(10, map[int64]bool{})
t.Log("Verify that we don't panic with registered plan not in database at all")
var called int
s.keeper.SetUpgradeHandler("future", func(ctx sdk.Context, plan types.Plan) { called++ })
s.keeper.SetUpgradeHandler("future", func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
called++
return vm, nil
})

newCtx := s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1).WithBlockTime(time.Now())
req := abci.RequestBeginBlock{Header: newCtx.BlockHeader()}
Expand Down
5 changes: 4 additions & 1 deletion x/upgrade/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

Expand Down Expand Up @@ -110,7 +111,9 @@ func (suite *UpgradeTestSuite) TestAppliedCurrentPlan() {
suite.app.UpgradeKeeper.ScheduleUpgrade(suite.ctx, plan)

suite.ctx = suite.ctx.WithBlockHeight(expHeight)
suite.app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan types.Plan) {})
suite.app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
return vm, nil
})
suite.app.UpgradeKeeper.ApplyUpgrade(suite.ctx, plan)

req = &types.QueryAppliedPlanRequest{Name: planName}
Expand Down
54 changes: 53 additions & 1 deletion x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

Expand All @@ -28,6 +29,7 @@ type Keeper struct {
storeKey sdk.StoreKey
cdc codec.BinaryMarshaler
upgradeHandlers map[string]types.UpgradeHandler
versionMap module.VersionMap
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
}

// NewKeeper constructs an upgrade Keeper
Expand All @@ -48,6 +50,51 @@ func (k Keeper) SetUpgradeHandler(name string, upgradeHandler types.UpgradeHandl
k.upgradeHandlers[name] = upgradeHandler
}

// SetInitialVersionMap sets an initial version map on the keeper.
// This must be set from app.go after module Manager is initialized.
func (k *Keeper) SetInitialVersionMap(vm module.VersionMap) {
k.versionMap = vm
}

// SetCurrentConsensusVersions saves the current version map
// to state from InitGenesis
func (k Keeper) SetCurrentConsensusVersions(ctx sdk.Context) {
k.setConsensusVersions(ctx, k.versionMap)
}

// setConsensusVersions saves a given version map to state
func (k Keeper) setConsensusVersions(ctx sdk.Context, vm module.VersionMap) {
if len(vm) > 0 {
store := ctx.KVStore(k.storeKey)
versionStore := prefix.NewStore(store, []byte{types.VersionMapByte})
for modName, ver := range vm {
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
nameBytes := []byte(modName)
verBytes := make([]byte, 8)
binary.BigEndian.PutUint64(verBytes, ver)
versionStore.Set(nameBytes, verBytes)
}
}
Comment on lines +54 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these not happen in InitGenesis? I thought we agreed upon that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seemed like correct spot based on the suggestions, did you have somewhere else in mind?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you're right. I guess I was thinking it could be in InitGenesis but maybe it doesn't matter

}

// GetConsensusVersions returns a map of key module name and value module consensus version
// as defined in ADR-041.
func (k Keeper) GetVersionMap(ctx sdk.Context) module.VersionMap {
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
store := ctx.KVStore(k.storeKey)
it := sdk.KVStorePrefixIterator(store, []byte{types.VersionMapByte})

vm := make(module.VersionMap)
defer it.Close()
for ; it.Valid(); it.Next() {
moduleBytes := it.Key()
// first byte is prefix key, so we remove it here
name := string(moduleBytes[1:])
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
moduleVersion := binary.BigEndian.Uint64(it.Value())
vm[name] = moduleVersion
}

return vm
}

// ScheduleUpgrade schedules an upgrade based on the specified plan.
// If there is another Plan already scheduled, it will overwrite it
// (implicitly cancelling the current plan)
Expand Down Expand Up @@ -187,7 +234,12 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) {
panic("ApplyUpgrade should never be called without first checking HasHandler")
}

handler(ctx, plan)
updatedVM, err := handler(ctx, plan, k.GetVersionMap(ctx))
if err != nil {
panic(err)
}

k.setConsensusVersions(ctx, updatedVM)
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved

// Must clear IBC state after upgrade is applied as it is stored separately from the upgrade plan.
// This will prevent resubmission of upgrade msg after upgrade is already completed.
Expand Down
Loading