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

Players can't submit predictions until 19:00:00 UTC on the day of the match

Relevant GitHub Links

https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ScoreBoard.sol#L66

https://github.com/Cyfrin/2024-07-the-predicter/blob/main/src/ThePredicter.sol#L93

Summary

In the ScoreBoard::setPrediction and ThePredicter::makePrediction functions, there is a condition that should check if a player can make a prediction due to restrictions that allow players to make predictions until 19:00:00 UTC on the day of the match. The condition in these functions is wrong for all matches.

For example, for the first game, players should be able to submit predictions until 2024-08-15 19:00:00 UTC, but they cansubmit predictions only until 2024-08-15 01:00:00 UTC.

Impact

Players can't submit predictions until 19:00:00 UTC on the day of the match.

Recommendations

Replace the incorrect condition in the functions with the correct one. For example in ScoreBoard::setPrediction function:

function setPrediction(
address player,
uint256 matchNumber,
Result result
) public {
- if (block.timestamp <= START_TIME + matchNumber * 68400 - 68400)
+ if (block.timestamp <= START_TIME - 3600 + matchNumber * 86400)
playersPredictions[player].predictions[matchNumber] = result;
playersPredictions[player].predictionsCount = 0;
for (uint256 i = 0; i < NUM_MATCHES; ++i) {
if (
playersPredictions[player].predictions[i] != Result.Pending &&
playersPredictions[player].isPaid[i]
) ++playersPredictions[player].predictionsCount;
}
}
Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Match timestamps are incorrect

In both contracts there is a similar error in the computation of the timestamps of the matches.

Support

FAQs

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