diff --git a/app/app.go b/app/app.go index 45b273e3..d88e5236 100644 --- a/app/app.go +++ b/app/app.go @@ -53,7 +53,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" - v068rc "github.com/Nolus-Protocol/nolus-core/app/upgrades/v068-rc" + v068 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v068" "github.com/Nolus-Protocol/nolus-core/docs" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -68,7 +68,7 @@ const ( var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v068rc.Upgrade} + Upgrades = []upgrades.Upgrade{v068.Upgrade} ) var ( diff --git a/app/upgrades/v068/constants.go b/app/upgrades/v068/constants.go new file mode 100644 index 00000000..4ffa9808 --- /dev/null +++ b/app/upgrades/v068/constants.go @@ -0,0 +1,22 @@ +package v068 + +import ( + store "cosmossdk.io/store/types" + "github.com/Nolus-Protocol/nolus-core/app/upgrades" + + icqtypes "github.com/neutron-org/neutron/v4/x/interchainqueries/types" +) + +const ( + // UpgradeName defines the on-chain upgrades name. + UpgradeName = "v0.6.8" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{icqtypes.ModuleName}, + }, +} diff --git a/app/upgrades/v068/upgrades.go b/app/upgrades/v068/upgrades.go new file mode 100644 index 00000000..4d63ab5a --- /dev/null +++ b/app/upgrades/v068/upgrades.go @@ -0,0 +1,33 @@ +package v068 + +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 + } +}