From ceaaf18168f6012e95a4618b82aeebf8f6eed685 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Thu, 15 Aug 2024 15:39:09 +0200 Subject: [PATCH] fix modify bid rand int error --- x/fundraising/simulation/modify_bid.go | 3 +++ x/fundraising/simulation/place_bid.go | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x/fundraising/simulation/modify_bid.go b/x/fundraising/simulation/modify_bid.go index 581d671..4b70614 100644 --- a/x/fundraising/simulation/modify_bid.go +++ b/x/fundraising/simulation/modify_bid.go @@ -28,6 +28,9 @@ func SimulateMsgModifyBid( if err != nil { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "failed to get auctions"), nil, nil } + if len(auctions) == 0 { + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "no auction to modify a bid"), nil, nil + } // Select a random auction auction := auctions[r.Intn(len(auctions))] diff --git a/x/fundraising/simulation/place_bid.go b/x/fundraising/simulation/place_bid.go index 679ba31..e4a53b4 100644 --- a/x/fundraising/simulation/place_bid.go +++ b/x/fundraising/simulation/place_bid.go @@ -30,7 +30,6 @@ func SimulateMsgPlaceBid( if err != nil { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "failed to get auctions"), nil, nil } - if len(auctions) == 0 { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "no auction to place a bid"), nil, nil }