From 510f753a2cb971820379d7b7ef79014985c520c6 Mon Sep 17 00:00:00 2001 From: Khanh Hoa Date: Thu, 1 Aug 2024 22:17:03 +0700 Subject: [PATCH] update max validator to 45 --- app/app.go | 1 + app/upgrades/v4_2_1/upgrades.go | 8 ++++++++ scripts/upgrade_test.sh | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index b7a8b8a2..6e48ecf4 100644 --- a/app/app.go +++ b/app/app.go @@ -1197,6 +1197,7 @@ func (app *MigalooApp) setupUpgradeHandlers() { v421.UpgradeName, v421.CreateUpgradeHandler( app.mm, + app.StakingKeeper, app.configurator, ), ) diff --git a/app/upgrades/v4_2_1/upgrades.go b/app/upgrades/v4_2_1/upgrades.go index 2966c0fe..9eb1c6f9 100644 --- a/app/upgrades/v4_2_1/upgrades.go +++ b/app/upgrades/v4_2_1/upgrades.go @@ -3,15 +3,23 @@ package v4 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) // CreateUpgradeHandler that migrates the chain from v4.2.0 to v4.2.1 func CreateUpgradeHandler( mm *module.Manager, + sk *stakingKeeper.Keeper, configurator module.Configurator, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + stakingParams := sk.GetParams(ctx) + stakingParams.MaxValidators = 45 + err := sk.SetParams(ctx, stakingParams) + if err != nil { + panic(err) + } return mm.RunMigrations(ctx, configurator, fromVM) } } diff --git a/scripts/upgrade_test.sh b/scripts/upgrade_test.sh index 841c97bc..688ad962 100755 --- a/scripts/upgrade_test.sh +++ b/scripts/upgrade_test.sh @@ -3,13 +3,13 @@ # the upgrade is a fork, "true" otherwise FORK=${FORK:-"false"} -OLD_VERSION=v4.1.3 +OLD_VERSION=v4.2.0 UPGRADE_WAIT=${UPGRADE_WAIT:-20} HOME=mytestnet ROOT=$(pwd) DENOM=uwhale CHAIN_ID=localmigaloo -SOFTWARE_UPGRADE_NAME="v4.2.0" +SOFTWARE_UPGRADE_NAME="v4.2.1" ADDITIONAL_PRE_SCRIPTS=${ADDITIONAL_PRE_SCRIPTS:-""} ADDITIONAL_AFTER_SCRIPTS=${ADDITIONAL_AFTER_SCRIPTS:-""}