From b3d32e1506cc2c5319e67a3098f87fce4fe3b5a4 Mon Sep 17 00:00:00 2001 From: Yaroms <103432884+Yaroms@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:17:56 +0300 Subject: [PATCH] add upgrade handler (#1654) Co-authored-by: Yaroms --- app/app.go | 1 + app/upgrades/empty_upgrades.go | 6 ++++++ x/protocol/module.go | 6 +++++- x/protocol/types/params.go | 4 ++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 2fc970e1f4..25365ebc6c 100644 --- a/app/app.go +++ b/app/app.go @@ -200,6 +200,7 @@ var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_2_2_0, upgrades.Upgrade_2_4_0, upgrades.Upgrade_2_5_0, + upgrades.Upgrade_3_0_0, } // this line is used by starport scaffolding # stargate/wasm/app/enabledProposals diff --git a/app/upgrades/empty_upgrades.go b/app/upgrades/empty_upgrades.go index c3142581c1..6ad4284a3e 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -282,3 +282,9 @@ var Upgrade_2_5_0 = Upgrade{ CreateUpgradeHandler: defaultUpgradeHandler, StoreUpgrades: store.StoreUpgrades{}, } + +var Upgrade_3_0_0 = Upgrade{ + UpgradeName: "v3.0.0", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/x/protocol/module.go b/x/protocol/module.go index 6f391396f7..6f0852cf2e 100644 --- a/x/protocol/module.go +++ b/x/protocol/module.go @@ -214,10 +214,14 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // panic:ok: at start up, migration cannot proceed anyhow panic(fmt.Errorf("%s: failed to register migration to v19: %w", types.ModuleName, err)) } + if err := cfg.RegisterMigration(types.ModuleName, 19, migrator.MigrateVersion); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v20: %w", types.ModuleName, err)) + } } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 19 } +func (AppModule) ConsensusVersion() uint64 { return 20 } // RegisterInvariants registers the capability module's invariants. func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} diff --git a/x/protocol/types/params.go b/x/protocol/types/params.go index 85d2d3cf57..11800a41ba 100644 --- a/x/protocol/types/params.go +++ b/x/protocol/types/params.go @@ -12,8 +12,8 @@ import ( var _ paramtypes.ParamSet = (*Params)(nil) const ( - TARGET_VERSION = "2.4.0" - MIN_VERSION = "2.2.2" + TARGET_VERSION = "3.0.0" + MIN_VERSION = "2.2.3" ) var (