code-423n4 / 2021-09-defiprotocol-findings

1 stars 0 forks source link

block.timestamp is a better timer than block.number #271

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

tensors

Vulnerability details

Throughout the code block.number is used to time functions, assuming 1 new block is added every 15 seconds. It is better to use block.timestamp for this purpose.

For example, the variable ONE_DAY in Auction.sol is given by 4 60 24, which assumes 1 block every 15 seconds. It is more natural to use the timestamp where ONE_DAY would be equal to 60 60 24 seconds.

GalloDaSballo commented 2 years ago

I agree with the finding, using the time would avoid the rounding that naturally happens when using block numbers