Precision loss in the nextPeriod calculation can cause the start time to be earlier than expected due to fractional parts being truncated.
RAACGauge and RWAGauge both inherits BaseGauge.sol and which calculates the [nextPeriod](https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/governance/gauges/BaseGauge.sol#L146) for creating new period for gauge voting and due to Precision loss in calculation leading to voting period start earlier than expected.
Looking at the below code snippet, nextPeriod is calculated with currentTime and _periodDuration in the code SLOC#145-146.
let's Say currentTime is 1740115384 and _periodDuration is 7 days 604800 if we calculate this, nextPeriod will be 1740720184, where if we try in solidity, due to precision nextPeriod will be 1740614400.
Voting of RWAgauge and RAACGauge Starts earlier than expected time. If nextPeriod is earlier than expected, it could cause premature execution of time-sensitive actions, like rewards or checkpoints, leading to incorrect outcomes. This misalignment may result in missed opportunities or unintended consequences, such as rewards being distributed or gauge voting too soon.
Manual Review
Remix
Performing multiplication before division is generally better to avoid loss of precision. As such, consider performing multiplication before division.
or
apply this.
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.