Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

New Deadline can be set even after the time has already passed

Description:

As there is no check if block.timestamp <= newDeadline, It is possible to set new deadline even the time has already gone.

Impact:

It can create a state of confusion and painc among the future participants who are planning to join in near future

Proof of Concept:

function test_tryResettingDeadlineAfterTimePassed() public {
vm.startPrank(deployer);
cd.setDeadline(8);
vm.stopPrank();
console.log(cd.deadline());
vm.warp(8 + 8);
vm.startPrank(deployer);
cd.setDeadline(1);
vm.stopPrank();
console.log(cd.deadline());
}

Recommended Mitigation:

- function setDeadline(uint256 _days) external onlyHost {
+ function setDeadline(uint256 _days) external onlyHost beforeDeadline {
if (deadlineSet) {
revert DeadlineAlreadySet();
} else {
deadline = block.timestamp + _days * 1 days;
emit DeadlineSet(deadline);
}
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

deadline is never set to true

Support

FAQs

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