-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
repo/nodeAkash node repo issuesAkash node repo issues
Description
Assign the support label to any support escalation issues
Labels: bug, security, market
Describe the bug
The bid count validation check uses > instead of >=, allowing one more bid to be created than the OrderMaxBids parameter allows. This violates the intended limit.
Location: x/market/handler/server.go:43
Code:
if ms.keepers.Market.BidCountForOrder(ctx, msg.ID.OrderID()) > params.OrderMaxBids {
return nil, fmt.Errorf("%w: too many existing bids (%v)", v1.ErrInvalidBid, params.OrderMaxBids)
}Impact:
- Violates parameter limits
- Inconsistent with intended behavior
To Reproduce
- Set
OrderMaxBidsparameter to 20 - Create exactly 20 bids for an order
- Attempt to create a 21st bid
- Observed: Bid creation succeeds (should fail)
- Expected: Bid creation should be rejected
Expected behavior
When the current bid count equals OrderMaxBids, new bid creation should be rejected. The check should use >= instead of >.
Proposed Fix:
if ms.keepers.Market.BidCountForOrder(ctx, msg.ID.OrderID()) >= params.OrderMaxBids {
return nil, fmt.Errorf("%w: too many existing bids (%v)", v1.ErrInvalidBid, params.OrderMaxBids)
}Additional context
- Default
OrderMaxBidsis 20 (fromx/market/simulation/genesis.go:18) - This bug allows creating
OrderMaxBids + 1bids total - Related issue:
BidCountForOrdercounts all bid states (Open/Active/Closed), which may also need review
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
repo/nodeAkash node repo issuesAkash node repo issues
Type
Projects
Status
Backlog (not prioritized)