Christmas Dinner

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

Delayed Deadline Setting can cause Undefined Behaviour

Summary

Until the deadline is explicitly set, functions with the beforeDeadline modifier will behave unpredictably, as the default value of deadline is 0. This makes all timestamp comparisons (block.timestamp > deadline) immediately pass, effectively disabling the beforeDeadline logic until a valid deadline is set.

Vulnerability Details

If the host delays setting the deadline or never sets it, participants can continue interacting with the contract indefinitely (e.g., depositing funds or changing participation status), which defeats the purpose of having a deadline to finalize attendees.

Impact

This allows deposits and refunds even though the deadline logic is supposed to restrict these actions.

Tools Used

mannual check

Recommendations

Set a default deadline value in the constructor or explicitly validate that the deadline is non-zero in the beforeDeadline modifier.

modifier beforeDeadline() {
+ require(deadline > 0, "Deadline not set");
if (block.timestamp > deadline) {
revert BeyondDeadline();
}
_;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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