Skip to content

Commit

Permalink
fix(simulation): fix the problem of `validator set is empty after Ini…
Browse files Browse the repository at this point in the history
…tGenesis` in simulation test (#18196)

(cherry picked from commit f2f47ff)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
luchenqun authored and mergify[bot] committed Jul 5, 2024
1 parent 1c16683 commit c11c4e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

<<<<<<< HEAD
* (baseapp) [#20346](https://github.com/cosmos/cosmos-sdk/pull/20346) Correctly assign `execModeSimulate` to context for `simulateTx`.
* (baseapp) [#20144](https://github.com/cosmos/cosmos-sdk/pull/20144) Remove txs from mempool when AnteHandler fails in recheck.
* (baseapp) [#20107](https://github.com/cosmos/cosmos-sdk/pull/20107) Avoid header height overwrite block height.
* (cli) [#20020](https://github.com/cosmos/cosmos-sdk/pull/20020) Make bootstrap-state command support both new and legacy genesis format.
* (testutil/sims) [#20151](https://github.com/cosmos/cosmos-sdk/pull/20151) Set all signatures and don't overwrite the previous one in `GenSignedMockTx`.
=======
* (x/slashing) [#18016](https://github.com/cosmos/cosmos-sdk/pull/18016) Fixed builder function for missed blocks key (`validatorMissedBlockBitArrayPrefixKey`) in slashing/migration/v4
* (x/gov) [#17873](https://github.com/cosmos/cosmos-sdk/pull/17873) Fail any inactive and active proposals whose messages cannot be decoded.
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
* (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test.
>>>>>>> f2f47ffd4 (fix(simulation): fix the problem of `validator set is empty after InitGenesis` in simulation test (#18196))
## [v0.50.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.6) - 2024-04-22

Expand Down
4 changes: 2 additions & 2 deletions testutil/sims/state_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ func AppStateRandomizedFn(
)
appParams.GetOrGenerate(
StakePerAccount, &initialStake, r,
func(r *rand.Rand) { initialStake = math.NewInt(r.Int63n(1e12)) },
func(r *rand.Rand) { initialStake = sdk.DefaultPowerReduction.AddRaw(r.Int63n(1e12)) },
)
appParams.GetOrGenerate(
InitiallyBondedValidators, &numInitiallyBonded, r,
func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) },
func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(299) + 1) },
)

if numInitiallyBonded > numAccs {
Expand Down

0 comments on commit c11c4e6

Please sign in to comment.