Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: low
Invalid

`MartenitsaEvent:startEvent` `uint256 public eventEndTime` can lead to a unconsiderer revert (through built-in overflow protection) during the execution of startEvent function.

Summary

MartenitsaEvent:startEvent uint256 public eventEndTime can lead to unconsiderer revert (through built-in overflow protection) during the execution of startEvent function.. uint256 public eventEndTime get the result of two uint256 variables.

Vulnerability Details

lvalue eventStartTime and eventDuration are declared both as uint256 the result of adding these 2 lvalue can lead to unconsiderer revert (through built-in overflow protection) during the calcul of the eventEndTime lvalue, this is the operation performed on line 33 of the MartenitsaEvent.sol contract

Nota: From version 0.8.0 onward, Solidity includes built-in overflow and underflow protection by default. Arithmetic operations automatically revert if they result in an overflow or underflow.

uint256 public eventStartTime;
uint256 public eventDuration;
uint256 public eventEndTime;
eventEndTime = eventStartTime + duration;

Impact

Unconsiderer revert (through built-in overflow protection) can occur during the calcul of the eventEndTime, owner the owner may not understand that this is the reason for the revert

Tools Used

Manuel review

Recommendations

Using Custom Error Handling

error OverflowDetected();
function startEvent(uint256 duration) external onlyOwner {
eventStartTime = block.timestamp;
eventDuration = duration;
if (eventStartTime + duration < eventStartTime || eventStartTime + duration < duration) { // Check for overflow
revert OverflowDetected();
}
eventEndTime = eventStartTime + duration;
emit EventStarted(eventStartTime, eventEndTime);
}
Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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