Root Cause
In ContestManager.sol lines 26-36, the createContest() function lacks critical input validation, allowing creation of broken pots:
Mismatched Arrays → Array Out-of-Bounds Panic: If players.length != rewards.length, Pot constructor panics
Zero Players → Division by Zero: If players.length == 0, closePot() divides by zero
Zero Addresses → Locked Funds: address(0) gets rewards but can never claim
Reward Sum Mismatch → Accounting Errors: totalRewards != sum(rewards) breaks invariants
The createContest() function lacks critical input validation, allowing creation of broken pots that either:
Revert on deployment (array out-of-bounds panic)
Create pots with zero players (division by zero in closePot)
Mismatched reward allocations (players without rewards)
Likelihood:
Mismatched Arrays → Array Out-of-Bounds Panic: If players.length != rewards.length, Pot constructor panics
Zero Players → Division by Zero: If players.length == 0, closePot() divides by zero
Zero Addresses → Locked Funds: address(0) gets rewards but can never claim
Reward Sum Mismatch → Accounting Errors: totalRewards != sum(rewards) breaks invariants
Impact:
Impact Assessment
| Dimension | Assessment |
| ---------------------- | ----------------------------------------------------- |
| Deployment Failure | Mismatched arrays cause panic on creation |
| Fund Lock | Zero-player pots cannot be closed (division by zero) |
| Silent Bugs | Zero addresses in players array = unclaimable rewards |
| Accounting Errors | totalRewards != sum(rewards) breaks invariants |
Test 1: Mismatched Arrays → Array Out-of-Bounds
Result: ✅ REVERTS with panic: array out-of-bounds access (0x32)
Result: closePot doesn't revert because remainingRewards = 0 so loop skipped. But if funded > 0, division by zero occurs.
Factory Level Validation (ContestManager.sol):
Verifies that the players and rewards arrays match in length and are not empty.
Iterates through arrays to reject zero addresses and zero-value rewards.
Ensures that the cumulative sum of individual rewards precisely matches the specified totalRewards.
Also add defense in depth to Pot.sol constructor:
Defense in Depth (Pot.sol Constructor):
Implements redundant safety checks directly inside the Pot contract constructor to independently enforce array length equality and non-empty constraints, securing the contract even if deployed or initialized outside the factory.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.