Repository navigation
fix(markets): add min_bet field to enforce minimum bet threshold - #331
Merged
dultimateade merged 1 commit intoOct 22, 2026
Merged
dultimateade merged 1 commit into
dultimateade merged 1 commit into
Conversation
Dust bets (1–100 stroops) incur full transaction fees but carry no economic weight. An attacker could place thousands of them to bloat on-chain storage at minimal cost and distort pool statistics. Changes ------- * Add `min_bet: i128` field to `MarketData` (persisted on-chain). * Add `min_bet` parameter to `create_market` and `create_market_with_curve`; validate `min_bet >= 1` at creation time (panics with `InvalidConfig` on zero or negative values). * Tighten the `place_bet` guard from `amount <= 0` to `amount <= 0 || amount < market.min_bet` (panics with `StakeTooSmall`). Test coverage (issues_007_012_014_022.rs) ----------------------------------------- * test_create_market_rejects_zero_min_bet * test_create_market_rejects_negative_min_bet * test_place_bet_rejects_dust_below_min_bet * test_place_bet_accepts_amount_at_min_bet * test_place_bet_accepts_amount_above_min_bet * test_place_bet_still_rejects_zero_even_with_min_bet_one * test_get_market_exposes_min_bet All existing call-sites in tests/ and benches/ updated to supply the new `min_bet` argument.
|
@jebprince1-web Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #199 closes #196
Dust bets (1–100 stroops) incur full transaction fees but carry no economic weight. An attacker could place thousands of them to bloat on-chain storage at minimal cost and distort pool statistics.
Changes
min_bet: i128field toMarketData(persisted on-chain).min_betparameter tocreate_marketandcreate_market_with_curve; validatemin_bet >= 1at creation time (panics withInvalidConfigon zero or negative values).place_betguard fromamount <= 0toamount <= 0 || amount < market.min_bet(panics withStakeTooSmall).Test coverage (issues_007_012_014_022.rs)
All existing call-sites in tests/ and benches/ updated to supply the new
min_betargument.