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

The `ScoreBoard::getPlayerScore` function does not return `score` value, this makes the protocol unable to give the score (points) of predictions made by the players.

Summary

The ScoreBoard::getPlayerScore function should give the number of points made by each players prediction. If a player gets the prediction right, the player gets 2 points but if the player gets the prediction wrong the player gets -1 point. The points determine the sharing formula for each player that makes prediction. Hence The ScoreBoard::getPlayerScore function makes it impossible for the protocol to determine each player's point.

Vulnerability Details

There must be a return score statement in the ScoreBoard::getPlayerScore function to get players prediction points.

function getPlayerScore(address player) public view returns (int8 score) {
for (uint256 i = 0; i < NUM_MATCHES; ++i) {
if (
playersPredictions[player].isPaid[i] &&
playersPredictions[player].predictions[i] != Result.Pending
) {
score += playersPredictions[player].predictions[i] == results[i]
? int8(2)
: -1;
}
}
+ return score;
}

Impact

There would be no reward for players that got their predictions right, making them be in the same position as player that got their predictions wrong (negative points). This would make the protocol not attractive to players, thereby losing some game playing revenue.

Tools Used

Manual Review

Recommendations

Add a return statement for the score in the ScoreBoard::getPlayerScore function

Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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