If the maximum score for all players results in 0
all of the funds collected from the entrance fees get locked because the function ThePredicter.withdraw
will revert due to a division by zero error.
If the maximum score for all players results in 0
all of the funds collected from the entrance fees get locked because the function ThePredicter.withdraw
will revert due to a division by zero error.
This happens because the code handles correctly the cases where the maximum score is positive or negative, but does not handle the case where it is 0
.
In the following lines of code where the reward is computed, the variable totalShares
value is 0
if the maximum score is 0
, which causes a division by zero error for all players that want to withdraw their rewards.
The PoC below shows how this scenario might happen, and how no player will be able to withdraw rewards:
Funds collected from entrance fees get locked
Foundry
Make it possible for players to withdraw the entrance fee if the maximum score was 0. The reward computation should be as follows:
The checks related to maxScore do not account possible maxScore of zero leading to stuck funds or a division by zero error.
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.