From fac7543d2d9483c6a452135937ea221746331432 Mon Sep 17 00:00:00 2001 From: Yarom Swisa Date: Sun, 13 Oct 2024 18:24:55 +0300 Subject: [PATCH] add upgrade handler --- 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 54dfedb250..448114bdd4 100644 --- a/app/app.go +++ b/app/app.go @@ -167,6 +167,7 @@ const ( // Upgrades add here future upgrades (upgrades.Upgrade) var Upgrades = []upgrades.Upgrade{ upgrades.Upgrade_3_1_0, + upgrades.Upgrade_3_2_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 1b18de859a..a0f05aee56 100644 --- a/app/upgrades/empty_upgrades.go +++ b/app/upgrades/empty_upgrades.go @@ -39,3 +39,9 @@ var Upgrade_3_1_0 = Upgrade{ CreateUpgradeHandler: defaultUpgradeHandler, StoreUpgrades: store.StoreUpgrades{}, } + +var Upgrade_3_2_0 = Upgrade{ + UpgradeName: "v3.2.0", + CreateUpgradeHandler: defaultUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/x/protocol/module.go b/x/protocol/module.go index 7008f5e421..0e648b1a3a 100644 --- a/x/protocol/module.go +++ b/x/protocol/module.go @@ -213,10 +213,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 v22: %w", types.ModuleName, err)) } + if err := cfg.RegisterMigration(types.ModuleName, 22, migrator.MigrateVersion); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v23: %w", types.ModuleName, err)) + } } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 22 } +func (AppModule) ConsensusVersion() uint64 { return 23 } // 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 20d3bfa881..01a44ec010 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 = "3.1.7" - MIN_VERSION = "2.2.2" + TARGET_VERSION = "3.2.0" + MIN_VERSION = "3.1.0" ) var (