Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

Gas Optimisation

Summary

Since there is no max value for duration, you can easily save some gas with unchecking the value endTime in the function startGame. As it is impossible to overflow, there is no need to check it and pay the gas for it.

Vulnerability Details

endTime = block.timestamp + duration;

Impact

By not stating the value as unchecked, you pay a gas fee for every time the function is called, which you easily can escape.

Tools Used

n/a

Recommendations

Add unchecked for the value.

Updates

Lead Judging Commences

m3dython Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Gas optimization

Strategy to save gas and minimize transaction costs

Support

FAQs

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