Skip to content

Commit

Permalink
temporary fix for invalid simulation handling for staking denom
Browse files Browse the repository at this point in the history
  • Loading branch information
iramiller committed Aug 28, 2023
1 parent bdbe9c8 commit a3dc938
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion x/marker/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,18 @@ func SimulateCreateSupplyIncreaseProposalContent(k keeper.Keeper) simtypes.Conte
return nil
}

newSupply := randomUint64(r, k.GetMaxTotalSupply(ctx)-k.CurrentCirculation(ctx, m).Uint64())

// TODO: When the simulation tests are fixed to stop breaking supply invariants through incorrect minting, the following check should be removed.
if newSupply > k.GetMaxTotalSupply(ctx) {
println("!!!! WARNING, TOKEN SUPPLY IS INVALID, ABORTING NEW PROPOSAL !!!!")
return nil
}

return types.NewSupplyIncreaseProposal(
simtypes.RandStringOfLength(r, 10),
simtypes.RandStringOfLength(r, 100),
sdk.NewCoin(m.GetDenom(), sdk.NewIntFromUint64(randomUint64(r, k.GetMaxTotalSupply(ctx)-k.CurrentCirculation(ctx, m).Uint64()))),
sdk.NewCoin(m.GetDenom(), sdk.ZeroInt()),
dest,
)
}
Expand Down

0 comments on commit a3dc938

Please sign in to comment.