Smart contracts should manage storage efficiently to minimize gas costs and contract size over time.
Completed orders (filled or cancelled) remain in storage permanently, consuming unnecessary storage slots and increasing contract interaction costs.
Likelihood:
After every order cancellation or purchase
As the protocol grows and processes more transactions over time
When the contract has been running for extended periods
Impact:
Increasing gas costs for contract interactions due to larger state size
Inefficient use of blockchain storage space
Higher costs for users as contract becomes more expensive to interact with
Storage Bloat Demonstration: This shows how completed orders unnecessarily consume storage space permanently.
Storage Impact Analysis:
Order struct: ~5 storage slots (160 bytes per order)
Permanent accumulation: Every order ever created/filled remains in storage
Gas cost increase: Larger state size increases transaction costs over time
Scaling problem: High-volume periods will permanently bloat contract state
No cleanup mechanism: Contract has no way to remove old, completed orders
Solution: Delete completed orders from storage to reduce bloat and get gas refunds.
Why this works:
Gas refunds: Deleting storage slots provides gas refunds (up to 19,200 gas per slot)
Prevents bloat: Keeps contract state size manageable as transaction volume grows
Lower future costs: Smaller state size means lower gas costs for all interactions
Clean architecture: Removes unnecessary data that serves no purpose after completion
Trade-offs to consider:
Historical data: Order details are no longer queryable after completion
Events remain: Order history still available through event logs
Alternative: Consider archival mechanism if historical data is needed
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.