From 8058f4b13a61b42a8b699d653cbe49cdf6157e1c Mon Sep 17 00:00:00 2001 From: Kevin Davis Date: Fri, 4 Oct 2019 15:46:41 -0400 Subject: [PATCH] fix simulation initialization --- x/validator-vesting/simulation/genesis.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/x/validator-vesting/simulation/genesis.go b/x/validator-vesting/simulation/genesis.go index 86c20a68..e8bbeab3 100644 --- a/x/validator-vesting/simulation/genesis.go +++ b/x/validator-vesting/simulation/genesis.go @@ -45,7 +45,13 @@ func RandomizedGenState(simState *module.SimulationState) { panic(err) } } else { - consAdd := getRandomValidatorConsAddr(simState, simulation.RandIntBetween(simState.Rand, 0, int(simState.NumBonded)-1)) + var val int + if simState.NumBonded <= 1 { + val = 0 + } else { + val = simulation.RandIntBetween(simState.Rand, 0, int(simState.NumBonded)-1) + } + consAdd := getRandomValidatorConsAddr(simState, val) // convert to validator vesting account 50% // set signing threshold to be anywhere between 1 and 100 gacc = types.NewValidatorVestingAccountRaw(