Skip to content

Commit

Permalink
fix: added missing v6.3.0 upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM committed Dec 7, 2023
1 parent d6e3347 commit 93ddccf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package app

import (
v620 "github.com/desmos-labs/desmos/v6/app/upgrades/v620"
v630 "github.com/desmos-labs/desmos/v6/app/upgrades/v630"
)

// registerUpgradeHandlers registers all the upgrade handlers that are supported by the app
func (app *DesmosApp) registerUpgradeHandlers() {
app.registerUpgrade(v620.NewUpgrade(app.ModuleManager, app.Configurator()))
app.registerUpgrade(v630.NewUpgrade(app.ModuleManager, app.Configurator()))
}
46 changes: 46 additions & 0 deletions app/upgrades/v630/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package v630

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

"github.com/desmos-labs/desmos/v6/app/upgrades"
)

var (
_ upgrades.Upgrade = &Upgrade{}
)

// Upgrade represents the v6.3.0 upgrade
type Upgrade struct {
mm *module.Manager
configurator module.Configurator
}

// NewUpgrade returns a new Upgrade instance
func NewUpgrade(mm *module.Manager, configurator module.Configurator) *Upgrade {
return &Upgrade{
mm: mm,
configurator: configurator,
}
}

// Name implements upgrades.Upgrade
func (u *Upgrade) Name() string {
return "v6.3.0"
}

// Handler implements upgrades.Upgrade
func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// This upgrade does not require any migration, so we can simply return the current version map
return u.mm.RunMigrations(ctx, u.configurator, fromVM)
}
}

// StoreUpgrades implements upgrades.Upgrade
func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades {
return &storetypes.StoreUpgrades{}
}

0 comments on commit 93ddccf

Please sign in to comment.