ContestManager::createContest
takes in a rewards
array and a totalRewards
parameter , but doesn't check to see whether the rewards sum up to the total rewards. If sum is less , this makes some users unable to claim their rewards
ContestManager::createContest
is used by owner to create a new contest . 2 of its parameters are :
rewards
- array of rewards to be distributed to players
totalRewards
- (should be -> ) the sum of all the rewards in the rewards
array
But this function doesn't check to see whether sum of all the rewards in the rewards
array is actually equal to totalRewards
or not. Consider 3 cases:
totalRewards
> sum
All users can claim
Leftover rewards distributed via Pot::claimPot
function
But owner wouldn't wanna give away more rewards than what is specified in the rewards
array . so this scenario is unwanted , even though it doesn't revert anywhere.
totalRewards
== sum
Everything works normally
totalRewards
< sum
Some users may face reverts while claiming since contract doesn't have as much balance as it is supposed to have
If somebody doesn't claim and owner calls claimPot
, this call will go through without reverts as it works on ratio calculation and not absolute values
But obviously this scenario is unwanted as users weren't able to claim what they deserved.
The only case that the protocol intends to handle is case no. 2 , so we should only allow the owner to create a pot which corresponds to case 2 , i.e. totalRewards
== sum
If owner doesn't input totalRewards
correctly , the owner or users may lose out on funds
Proof of Concepts
I have written 4 tests to prove cases 1 and 3
Place these tests into TestMyCut.t.sol
Manual review , Foundry tests
Add a check to see if sum of values of rewards
array equals totalRewards
in ContestManager
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.