-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Calculation of Remaining Hours in Day B in _calculateIssuance
Function
#39
Comments
Thank you for your report on the calculation of remaining hours in the _calculateIssuance function. We've reviewed your submission and agree that this is a valid low-severity issue. You've correctly identified that when the current time is exactly on the hour, our calculation incorrectly subtracts an extra hour, potentially resulting in a lost hour's worth of minting. We appreciate your attention to detail in identifying this edge case. Your contribution helps improve the correctness of the system. Thank you for your valuable input. |
|
@aktech297 because the chance of |
Im now coming around to try to write my own tests for this issue; |
@0xmahdirostami for my initial unit tests to cover this issue I am actually (so far) not recovering this as an issue. If you have any tests on your side that highlight this as an issue, it would be good to share. 23 sept. final decision: leaving this as valid, because on first analysis I agreed with the argument, and I need to review this quick test from last week. Leaving this status as 'low' as highest likelihood conclusion |
Github username: @0xmahdirostami
Twitter username: 0xmahdirostami
Submission hash (on-chain): 0x27f21c8e50f4ba7fcba30aeb1c79379e795d8b487a744f8fd21f2a7e6f220413
Severity: low
Description:
Vulnerability Detail
The
_calculateIssuance
function uses a formula to compute the number of incomplete hours remaining in day B from the current timestamp:Circles-0x6ca9ca24d78af44582951825bef9eadcb210e5cf/src/circles/Circles.sol
Line 116 in 507e185
However, the current implementation assumes that an extra hour is always added, which is not the case when:
In this scenario, the function will not calculate the remaining hours correctly, leading to inaccurate results.
Impact
The contract may not work as intended, causing errors in the issuance calculations, which can lead to inaccurate rewards or token minting.
Mitigation
Update the logic to handle cases where the remainder is zero:
The text was updated successfully, but these errors were encountered: