Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Potential DOS due to external calls in loop

Summary

The withdraw function in ThePredicter contract makes external calls inside a loop, which could lead to a denial-of-service attack.

Vulnerability Details

In the withdraw function:

for (uint256 i = 0; i < players.length; ++i) {
int8 cScore = scoreBoard.getPlayerScore(players[i]);
// ...
}

The function calls an external contract (scoreBoard.getPlayerScore) for each player in the loop.

Impact

As the number of players increases, the gas cost of this function will increase too. This could lead to the function hitting the block gas limit, locking funds in the contract.

Tools Used

Manual code review

Recommendations

Modify the ScoreBoard contract.

Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.