Skip to content

Commit

Permalink
feat: upgrade handler v0.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockwarr committed Oct 2, 2024
1 parent 1b46ced commit 4095f2e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
"github.com/Nolus-Protocol/nolus-core/app/keepers"
appparams "github.com/Nolus-Protocol/nolus-core/app/params"
"github.com/Nolus-Protocol/nolus-core/app/upgrades"
v064 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v064"
v065 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v065"
"github.com/Nolus-Protocol/nolus-core/docs"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand All @@ -67,7 +67,7 @@ const (
var (
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v064.Upgrade}
Upgrades = []upgrades.Upgrade{v065.Upgrade}
)

var (
Expand Down
19 changes: 19 additions & 0 deletions app/upgrades/v065/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v065

import (
store "cosmossdk.io/store/types"
"github.com/Nolus-Protocol/nolus-core/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrades name.
UpgradeName = "v0.6.5"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
},
}
33 changes: 33 additions & 0 deletions app/upgrades/v065/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package v065

import (
"context"
"fmt"

"github.com/Nolus-Protocol/nolus-core/app/keepers"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *keepers.AppKeepers,
codec codec.Codec,
) upgradetypes.UpgradeHandler {
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(c)

ctx.Logger().Info("Starting module migrations...")
vm, err := mm.RunMigrations(ctx, configurator, vm) //nolint:contextcheck
if err != nil {
return vm, err
}

ctx.Logger().Info(fmt.Sprintf("Migration {%s} applied", UpgradeName))
return vm, nil
}
}
2 changes: 1 addition & 1 deletion cmd/nolusd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var (
{
Section: "consensus",
Key: "timeout_commit",
Value: "2s",
Value: "3s",
},
{
Section: "consensus",
Expand Down

0 comments on commit 4095f2e

Please sign in to comment.