Skip to content

Commit

Permalink
add upgrade migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kruspy committed May 1, 2024
1 parent eaab246 commit 3495ebf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ import (

"github.com/persistenceOne/persistenceCore/v11/app/keepers"
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
v11_10_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.10.0"
v11_11_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.11.0-rc0"
"github.com/persistenceOne/persistenceCore/v11/client/docs"
)

var (
DefaultNodeHome string
Upgrades = []upgrades.Upgrade{v11_10_0.Upgrade}
Upgrades = []upgrades.Upgrade{v11_11_0_rc0.Upgrade}
ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...)
)

Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/testnet/v11.11.0-rc0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v11_11_0_rc0

import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v11.11.0-rc0"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}
22 changes: 22 additions & 0 deletions app/upgrades/testnet/v11.11.0-rc0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v11_11_0_rc0

import (
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/persistenceOne/persistenceCore/v11/app/upgrades"
)

func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("running module migrations...")

err := args.Keepers.StakingKeeper.RefreshTotalLiquidStaked(ctx)
if err != nil {
ctx.Logger().Error("LSM failed to refresh total liquid staked", "error", err)
}

return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm)
}
}

0 comments on commit 3495ebf

Please sign in to comment.