sherlock-audit / 2023-12-ubiquity-judging

2 stars 2 forks source link

0xnirlin - Wrong number for blocks in a week #230

Closed sherlock-admin2 closed 10 months ago

sherlock-admin2 commented 10 months ago

0xnirlin

high

Wrong number for blocks in a week

Summary

In a week number of blocks mined on eth currently are around 49500

Vulnerability Detail

Code set number of blocks in week as following diamondinit.sol

       // @note - this is wrong, number of blocks in a week is currently 49700
        ls.blockCountInAWeek = 45361;

Which leads to wrong calculations in whole project.

And also we know this number can change in future with hardforks.

Impact

wrong calculation

Code Snippet

https://github.com/sherlock-audit/2023-12-ubiquity/blob/d9c39e8dfd5601e7e8db2e4b3390e7d8dff42a8e/ubiquity-dollar/packages/contracts/src/dollar/upgradeInitializers/DiamondInit.sol#L74

Tool used

smol cat

Recommendation

Set amount to right value .

sherlock-admin2 commented 10 months ago

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

It's protocol decision, dont have to be correct number though

sherlock-admin2 commented 10 months ago

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

It's protocol decision, dont have to be correct number though

nevillehuang commented 10 months ago

Invalid, this is purely an estimate since block count fluctuates in mainnet. Additionally, it can be adjusted by admin anyways as seen here.