From 991573efc624c7bca5f75aed744454751ea2a9ca Mon Sep 17 00:00:00 2001 From: Christopher Goes Date: Mon, 29 Oct 2018 00:30:25 +0100 Subject: [PATCH] Avoid dividing-by-zero --- cmd/gaia/app/sim_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/gaia/app/sim_test.go b/cmd/gaia/app/sim_test.go index 6c6d69000d3b..f2efa7154772 100644 --- a/cmd/gaia/app/sim_test.go +++ b/cmd/gaia/app/sim_test.go @@ -100,8 +100,8 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage { SignedBlocksWindow: int64(r.Intn(1000)), DowntimeUnbondDuration: time.Duration(r.Intn(86400)) * time.Second, MinSignedPerWindow: sdk.NewDecWithPrec(int64(r.Intn(10)), 1), - SlashFractionDoubleSign: sdk.NewDec(1).Quo(sdk.NewDec(int64(r.Intn(50)))), - SlashFractionDowntime: sdk.NewDec(1).Quo(sdk.NewDec(int64(r.Intn(200)))), + SlashFractionDoubleSign: sdk.NewDec(1).Quo(sdk.NewDec(int64(r.Intn(50) + 1))), + SlashFractionDowntime: sdk.NewDec(1).Quo(sdk.NewDec(int64(r.Intn(200) + 1))), }, } fmt.Printf("Selected randomly generated slashing parameters: %v\n", slashingGenesis)