The constructor accepts rewards[] and totalRewards as independent parameters without verifying that their sum matches.
A misconfigured Pot can result in players unable to claim (their mapping entry is 0) or the Pot running out of tokens mid-distribution.
Likelihood:
createContest is onlyOwner, so only the trusted admin can create a misconfigured Pot.
A mismatch is most likely to arise from an operator scripting error: a typo, an off-by-one, or a unit mismatch (e.g., passing reward amounts in USDC units while totalRewards is in wei).
Low likelihood in a well-operated deployment, but an on-chain guard is cheap and eliminates a class of silent misconfiguration bugs.
The following test shows a Pot with sum(rewards) < totalRewards is created and funded with no revert. Two hundred ether remain in the Pot, unallocated and unclaimable by any registered player — silently distorting the distribution at closePot. Run with forge test --match-test testL02 -vvv:
Add a sum check in the constructor and declare a dedicated custom error:
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.