The OrderBook contract allows orders to expire while remaining marked as active (isActive = true
), causing seller funds to be indefinitely locked in the contract. Expired orders cannot be purchased, modified, or automatically cancelled, requiring manual intervention from sellers who may forget or be unable to cancel their orders.
The contract design allows orders to exist in an inconsistent state where:
order.isActive = true
(order appears active)
block.timestamp >= order.deadlineTimestamp
(order is expired)
This creates "zombie orders" that cannot be interacted with:
Order must be created with a deadline timestamp
Current block timestamp must exceed the order's deadline
Order must still have isActive = true
Seller funds are locked in the contract
Seller creates an order and forgets about it
Market conditions change, making the order unattractive
Seller becomes inactive or loses access to their account
Time passes beyond the order deadline
Natural Expiration: Orders naturally expire due to time passage
Fund Lock: Seller funds remain locked in contract
Interaction Failure: All attempts to buy/modify expired orders fail
Manual Recovery Required: Only seller can manually cancel to recover funds
Potential Permanent Lock: If seller is inactive, funds may be permanently locked
Fund Lock Risk: Seller funds can be indefinitely locked
Poor User Experience: Users must manually track and cancel expired orders
Capital Inefficiency: Locked funds cannot be used for other purposes
Protocol Liability: Contract holds funds that cannot be accessed
Scalability Issues: Accumulation of expired orders clutters the system
Test demonstrates the fund lock scenario:
Seller creates order with 1 hour deadline
Time advances beyond deadline (order expires)
Order remains isActive = true
but cannot be purchased
Seller funds remain locked until manual cancellation
Expired order cannot be purchased (reverts with "OrderExpired")
Expired order cannot be modified (reverts with "OrderExpired")
Funds remain locked in contract until seller manually cancels
Multiple expired orders accumulate locked funds
If sellers forget to cancel expired orders or become inactive, their funds may be permanently locked in the contract.
Implement Option 1 (auto-cancel in buyOrder) combined with Option 2 (cleanup function) to provide both automatic and manual cleanup mechanisms.
By design only `seller` can call `cancelSellOrder()` on their `order`. But when an `order` expires, and the `seller` doesn't have access to the protocol, the expired `order `should be be able to be cancelled by an `admin`.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.