Skip to content

Commit

Permalink
add v6 upgrade handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
tkkwon1998 committed Jul 17, 2023
1 parent 473e019 commit abb0cc5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ import (
v3 "github.com/Canto-Network/Canto/v6/app/upgrades/v3"
v4 "github.com/Canto-Network/Canto/v6/app/upgrades/v4"
v5 "github.com/Canto-Network/Canto/v6/app/upgrades/v5"
v6 "github.com/Canto-Network/Canto/v6/app/upgrades/v6"
)

func init() {
Expand Down Expand Up @@ -1104,6 +1105,8 @@ func (app *Canto) setupUpgradeHandlers() {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{csrtypes.StoreKey},
}
case v6.UpgradeName:
// no store upgrades in v6
}

if storeUpgrades != nil {
Expand Down
6 changes: 6 additions & 0 deletions app/upgrades/v6/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package v6

const (
//UpgradeName is the name of the upgrade to be associated with the chain upgrade
UpgradeName = "v6.0.0"
)
21 changes: 21 additions & 0 deletions app/upgrades/v6/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v6

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// CreateUpgradeHandler creates an SDK upgrade handler for v6
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade: ", UpgradeName)

// Leave modules are as-is to avoid running InitGenesis.
logger.Debug("running module migrations ...")
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit abb0cc5

Please sign in to comment.