Skip to content

Commit

Permalink
feat: upgrade handler v064
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockwarr committed Oct 1, 2024
1 parent c4879fe commit 435ff98
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 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"
v063 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v063"
v064 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v064"
"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{v063.Upgrade}
Upgrades = []upgrades.Upgrade{v064.Upgrade}
)

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

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.4"
)

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

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
}
}
4 changes: 2 additions & 2 deletions cmd/nolusd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ var (
{
Section: "consensus",
Key: "timeout_commit",
Value: "1s",
Value: "2s",
},
{
Section: "consensus",
Key: "timeout_propose",
Value: "2s",
Value: "3s",
},
{
Section: "consensus",
Expand Down

0 comments on commit 435ff98

Please sign in to comment.