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

Incorrect verification of deadline to make prediction in the `ThePredicter::makePrediction`

Description

The function ThePredicter::makePrediction has a incorret verification of deadline to make prediction

Impact

The players may not be able to make predictions and the platform will not receive the predictions

Proof Of Concept

// simulate with the match number 1
let time = 1723752000 + 0 * 68400 - 68400
// time: 1723683600
let date = new Date(time * 1000);
// date: Wed Aug 15 2024 01:00:00
// but the output needs to be: Wed Aug 15 2024 19:00:00
// simulate with the match number 2
let time = 1723752000 + 1 * 68400 - 68400
// time: 1723752000
let date = new Date(time * 1000);
// date: Thu Aug 15 2024 20:00:00
// but the output needs to be: Wed Aug 16 2024 19:00:00

Recommended Mitigation

Fix the check in the ThePredicter::makePrediction:

function makePrediction(
uint256 matchNumber,
ScoreBoard.Result prediction
) public payable {
if (msg.value != predictionFee) {
revert ThePredicter__IncorrectPredictionFee();
}
+ if (block.timestamp > START_TIME + matchNumber * 86400 - 3600) {
+ revert ThePredicter__PredictionsAreClosed();
+ }
- if (block.timestamp > START_TIME + matchNumber * 68400 - 68400) {
- revert ThePredicter__PredictionsAreClosed();
- }
scoreBoard.confirmPredictionPayment(msg.sender, matchNumber);
scoreBoard.setPrediction(msg.sender, matchNumber, prediction);
}
Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year 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.