From 435ff988871b05535640501a352c3eb58283bb45 Mon Sep 17 00:00:00 2001 From: Lockwarr Date: Tue, 1 Oct 2024 11:55:08 +0300 Subject: [PATCH] feat: upgrade handler v064 --- app/app.go | 4 ++-- app/upgrades/v064/constants.go | 19 +++++++++++++++++++ app/upgrades/v064/upgrades.go | 33 +++++++++++++++++++++++++++++++++ cmd/nolusd/root.go | 4 ++-- 4 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 app/upgrades/v064/constants.go create mode 100644 app/upgrades/v064/upgrades.go diff --git a/app/app.go b/app/app.go index df75734d..ac02c60a 100644 --- a/app/app.go +++ b/app/app.go @@ -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" @@ -67,7 +67,7 @@ const ( var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v063.Upgrade} + Upgrades = []upgrades.Upgrade{v064.Upgrade} ) var ( diff --git a/app/upgrades/v064/constants.go b/app/upgrades/v064/constants.go new file mode 100644 index 00000000..b2c18c88 --- /dev/null +++ b/app/upgrades/v064/constants.go @@ -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{}, + }, +} diff --git a/app/upgrades/v064/upgrades.go b/app/upgrades/v064/upgrades.go new file mode 100644 index 00000000..ddea98b9 --- /dev/null +++ b/app/upgrades/v064/upgrades.go @@ -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 + } +} diff --git a/cmd/nolusd/root.go b/cmd/nolusd/root.go index 6ecde9ac..8557a2fb 100644 --- a/cmd/nolusd/root.go +++ b/cmd/nolusd/root.go @@ -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",