In BaseGauge::constructor, the period calculation contains a redundant multiplication after division that can lead to precision loss. The current implementation first divides the timestamp by period duration and then multiplies by the same value, which can truncate the result unnecessarily.
Let's demonstrate with an example:
Assume currentTime = 1000 and _periodDuration = 7 days = 604800
1000 / 604800 = 0 (integer division truncates)
0 * 604800 = 0
0 + 604800 = 604800
The issue is that the division and multiplication by _periodDuration is unnecessary and can lead to precision loss in edge cases where the timestamp is very large.
Remove Redundant Calculation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.