TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

Casting block.timestamp to uint32 sets the contract

Summary

The difference of block.timestamp and maximum value of uint32 is only ~81years. As a result casting block.timestamp to uint32 means the contract will only function as expected until 81years from now when it starts to overflow. This is fine for most smart contracts as they will most likely be abandoned for new versions, or something like that. However, considering the unpredictability of the future and the inperpetuity property of blockchain, it's always advisable to consider all factors at play. Also, this why the severity is labeled low.

PoC

function yearsToOverflow() external view returns(uint256){
uint256 secondz = type(uint32).max - block.timestamp;
uint256 yearz = (((secondz / 60) / 60) / 24) / 365;
return yearz;
}

Recommendations

Consider increasing the uint dataType to higher versions like uint64.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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