The TwentyOne contract lacks a timeout mechanism for abandoned games. While players can always complete their games by calling hit() or call(), there's no mechanism to handle scenarios where players abandon their games without completing them. This could lead to accumulated incomplete games and ETH sitting idle in the contract.
Location: src/TwentyOne.sol
The contract allows players to start a game by depositing 1 ETH but provides no mechanism to handle abandoned games. While players can always return to complete their games, there's no way to resolve situations where players abandon their games entirely:
The vulnerability has several implications:
Contract State
Abandoned games remain in contract state indefinitely
No way to clear inactive games
Contract storage bloat from unfinished games
Game Operation
No incentive for players to properly complete games
No mechanism to resolve abandoned games
Contract state becomes increasingly cluttered over time
User Experience
No way to distinguish between active and abandoned games
Players who forget about games have no reminder mechanism
No automated cleanup of inactive games
Manual Code Review
Foundry Testing Framework
Custom timeout scenario tests
Add Timeout Mechanism:
Add Game Status Tracking:
Track game start times
Implement game state enumeration
Add timeout status checks
Improve Game Flow:
Add Events and Monitoring:
Documentation Updates:
Document timeout period
Explain timeout resolution process
Add warnings about game abandonment
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.