Skip to content

Commit 2382262

Browse files
committed
fix(x/gov): deposits in simulations
1 parent 177e7f4 commit 2382262

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

x/gov/simulation/operations.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ func SimulateMsgDeposit(
322322
return simtypes.NoOpMsg(types.ModuleName, TypeMsgDeposit, "unable to generate proposalID"), nil, nil
323323
}
324324

325-
deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address, false, false)
325+
p, err := k.Proposals.Get(ctx, proposalID)
326+
if err != nil {
327+
return simtypes.NoOpMsg(types.ModuleName, TypeMsgDeposit, "unable to get proposal"), nil, err
328+
}
329+
330+
deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address, false, p.Expedited)
326331
switch {
327332
case skip:
328333
return simtypes.NoOpMsg(types.ModuleName, TypeMsgDeposit, "skip deposit"), nil, nil
@@ -592,7 +597,6 @@ func randomDeposit(
592597
return nil, false, err
593598
}
594599
amount = amount.Add(minAmount)
595-
amount = amount.MulRaw(3) // 3x what's required // TODO: this is a hack, we need to be able to calculate the correct amount using params
596600

597601
if amount.GT(spendableBalance) || amount.LT(threshold) {
598602
return nil, true, nil

0 commit comments

Comments
 (0)