Skip to content

Commit c51f58c

Browse files
mergify[bot]luchenqunjulienrbrt
authored
fix(simulation): fix the problem of validator set is empty after InitGenesis in simulation test (backport #18196) (#20897)
Co-authored-by: Chenqun Lu <luchenqun@qq.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
1 parent 1c16683 commit c51f58c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
4848
* [#20631](https://github.com/cosmos/cosmos-sdk/pull/20631) Fix json parsing in the wait-tx command.
4949
* (x/auth) [#20438](https://github.com/cosmos/cosmos-sdk/pull/20438) Add `--skip-signature-verification` flag to multisign command to allow nested multisigs.
5050

51+
## Bug Fixes
52+
53+
* (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test.
54+
5155
## [v0.50.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.7) - 2024-06-04
5256

5357
### Improvements

testutil/sims/state_helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ func AppStateRandomizedFn(
205205
)
206206
appParams.GetOrGenerate(
207207
StakePerAccount, &initialStake, r,
208-
func(r *rand.Rand) { initialStake = math.NewInt(r.Int63n(1e12)) },
208+
func(r *rand.Rand) { initialStake = sdk.DefaultPowerReduction.AddRaw(r.Int63n(1e12)) },
209209
)
210210
appParams.GetOrGenerate(
211211
InitiallyBondedValidators, &numInitiallyBonded, r,
212-
func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) },
212+
func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(299) + 1) },
213213
)
214214

215215
if numInitiallyBonded > numAccs {

0 commit comments

Comments
 (0)