From 23ab621b5f3ad36372442083bc1255b935ebc9fa Mon Sep 17 00:00:00 2001 From: yutianwu Date: Thu, 23 Mar 2023 15:48:46 +0800 Subject: [PATCH] fix: fix the bug introduced by fixing the testnet syncing issue (#331) --- CHANGELOG.md | 3 +++ x/stake/keeper/params.go | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af1f66f18..cf2de82fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +##v0.26.1 +* [sdk] [\#331] (https://github.com/bnb-chain/bnc-cosmos-sdk/pull/331) fix: fix the bug introduced by fixing the testnet syncing issue + ##v0.26.0 * [sec] [\#328](https://github.com/bnb-chain/bnc-cosmos-sdk/pull/328) sec: implement security enhancements (#328) diff --git a/x/stake/keeper/params.go b/x/stake/keeper/params.go index 9eae0e546..aef6a16e4 100644 --- a/x/stake/keeper/params.go +++ b/x/stake/keeper/params.go @@ -162,7 +162,12 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramstore.Set(ctx, types.KeyMaxValidators, params.MaxValidators) k.paramstore.Set(ctx, types.KeyBondDenom, params.BondDenom) if sdk.IsUpgrade(sdk.LaunchBscUpgrade) { - if ctx.ChainID() == sdk.ChainIdGanges { + // the reason for this logic is: + // 1. when the testnet is set up, the config of `MaxValidators` and `MinSelfDelegation` is different from the default value in code + // 2. the first fix has a bug that the overwrite of the configs happens after the bsc upgrade instead of only taking effect block 1 + // 3. so this is why the check `ctx.BlockHeight() == 1 || ctx.BlockHeight() == 37501781` is added to fix the bug. 37501781 is the height + // when the first proposal executed after the first fix + if ctx.ChainID() == sdk.ChainIdGanges && (ctx.BlockHeight() == 1 || ctx.BlockHeight() == 37501781) { k.paramstore.Set(ctx, types.KeyMaxValidators, uint16(11)) k.paramstore.Set(ctx, types.KeyMinSelfDelegation, int64(5000000000000)) k.paramstore.Set(ctx, types.KeyMinDelegationChange, params.MinDelegationChange)