Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Jul 3, 2024
1 parent b1cede0 commit fe47d58
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x/staking/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion x/staking/simulation/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/staking/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion x/staking/simulation/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit fe47d58

Please sign in to comment.