Skip to content

Commit

Permalink
chore: fix broken lints in upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Nov 4, 2024
1 parent 1d5e2bd commit 494e713
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,36 @@ package app
import (
"fmt"

errorsmod "cosmossdk.io/errors"
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"
)

const (
UpgradeName_Mainnet = "v0.27.0"
UpgradeName_Testnet = "v0.27.0-alpha.0"
UpgradeNameMainnet = "v0.27.0"
UpgradeNameTestnet = "v0.27.0-alpha.0"
)

// RegisterUpgradeHandlers registers the upgrade handlers for the app.
func (app App) RegisterUpgradeHandlers() {
app.upgradeKeeper.SetUpgradeHandler(
UpgradeName_Mainnet,
upgradeHandler(app, UpgradeName_Mainnet),
UpgradeNameMainnet,
upgradeHandler(app, UpgradeNameMainnet),
)
app.upgradeKeeper.SetUpgradeHandler(
UpgradeName_Testnet,
upgradeHandler(app, UpgradeName_Testnet),
UpgradeNameTestnet,
upgradeHandler(app, UpgradeNameTestnet),
)

upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}

doUpgrade := upgradeInfo.Name == UpgradeName_Mainnet ||
upgradeInfo.Name == UpgradeName_Testnet
doUpgrade := upgradeInfo.Name == UpgradeNameMainnet ||
upgradeInfo.Name == UpgradeNameTestnet

if doUpgrade && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{}
Expand All @@ -57,7 +58,7 @@ func upgradeHandler(
// run migrations for all modules and return new consensus version map
versionMap, err := app.mm.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return nil, err
return nil, errorsmod.Wrap(err, "failed to run migrations")
}

logger.Info("completed store migrations")
Expand Down

0 comments on commit 494e713

Please sign in to comment.