The setContest function allows the owner to set various properties for a contest, including its closing time. While there are checks to ensure the closeTime is within a maximum range, there is no validation to ensure that the contest has a minimum duration. This could potentially allow the owner to set extremely short contests, which might not give participants adequate time to participate or could be used maliciously.
In the setContest function, the following checks are made for the closeTime:
It should not be more than MAX_CONTEST_PERIOD from the current timestamp.
It should not be before the current timestamp.
However, there's no check to ensure that the closeTime is at least a certain duration from the current timestamp. This means the owner can potentially set a contest that closes almost immediately after it's opened.
User Experience: Participants might not have enough time to participate in the contest if the duration is too short.
Potential for Manipulation: Malicious owners could exploit this to their advantage, for instance, by announcing a contest and then closing it immediately before anyone has a chance to participate.
Manual code review.
Introduce a MIN_CONTEST_PERIOD constant in the contract that defines the minimum duration a contest should last.
Modify the setContest function to include a check that ensures the closeTime is at least MIN_CONTEST_PERIOD from the current timestamp.
Test the updated function to ensure that it correctly enforces the minimum contest duration.
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.