diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index 5aedf6957923..8e3f65e4c632 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -34,7 +34,7 @@ func genMaxValidators(r *rand.Rand) (maxValidators uint32) { // getHistEntries returns randomized HistoricalEntries between 0-100. func getHistEntries(r *rand.Rand) uint32 { - return 0 + return uint32(r.Intn(int(types.DefaultHistoricalEntries + 1))) } // getKeyRotationFee returns randomized keyRotationFee between 10000-1000000. diff --git a/x/staking/simulation/genesis_test.go b/x/staking/simulation/genesis_test.go index c3e399a44ecb..d6350a037b28 100644 --- a/x/staking/simulation/genesis_test.go +++ b/x/staking/simulation/genesis_test.go @@ -51,7 +51,7 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, uint32(207), stakingGenesis.Params.MaxValidators) require.Equal(t, uint32(7), stakingGenesis.Params.MaxEntries) - require.Equal(t, uint32(8687), stakingGenesis.Params.HistoricalEntries) + require.Equal(t, uint32(0), stakingGenesis.Params.HistoricalEntries) require.Equal(t, "stake", stakingGenesis.Params.BondDenom) require.Equal(t, float64(238280), stakingGenesis.Params.UnbondingTime.Seconds()) // check numbers of Delegations and Validators diff --git a/x/staking/simulation/proposals.go b/x/staking/simulation/proposals.go index a4821883a875..000984b46cdd 100644 --- a/x/staking/simulation/proposals.go +++ b/x/staking/simulation/proposals.go @@ -39,7 +39,7 @@ func SimulateMsgUpdateParams(r *rand.Rand, _ []simtypes.Account, addressCodec co params := types.DefaultParams() params.BondDenom = simtypes.RandStringOfLength(r, 10) - params.HistoricalEntries = uint32(0) + params.HistoricalEntries = uint32(simtypes.RandIntBetween(r, 0, 1000)) params.MaxEntries = uint32(simtypes.RandIntBetween(r, 1, 1000)) params.MaxValidators = uint32(simtypes.RandIntBetween(r, 1, 1000)) params.UnbondingTime = time.Duration(simtypes.RandTimestamp(r).UnixNano()) diff --git a/x/staking/simulation/proposals_test.go b/x/staking/simulation/proposals_test.go index e3faf605f32b..64eb447a8559 100644 --- a/x/staking/simulation/proposals_test.go +++ b/x/staking/simulation/proposals_test.go @@ -44,7 +44,7 @@ func TestProposalMsgs(t *testing.T) { assert.Equal(t, addr, msgUpdateParams.Authority) assert.Equal(t, "GqiQWIXnku", msgUpdateParams.Params.BondDenom) assert.Equal(t, uint32(213), msgUpdateParams.Params.MaxEntries) - assert.Equal(t, uint32(0), msgUpdateParams.Params.HistoricalEntries) + assert.Equal(t, uint32(300), msgUpdateParams.Params.HistoricalEntries) assert.Equal(t, uint32(539), msgUpdateParams.Params.MaxValidators) assert.Equal(t, 8898194435*time.Second, msgUpdateParams.Params.UnbondingTime) assert.DeepEqual(t, sdkmath.LegacyNewDecWithPrec(579040435581502128, 18), msgUpdateParams.Params.MinCommissionRate) diff --git a/x/staking/types/params.go b/x/staking/types/params.go index dad7ed7d5942..d138c1df9fa7 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -29,7 +29,7 @@ const ( // value by not adding the staking module to the application module manager's // SetOrderBeginBlockers. // Deprecated: HistoricalEntries is deprecated - DefaultHistoricalEntries uint32 = 0 + DefaultHistoricalEntries uint32 = 10000 ) var (