The BaseGauge::updatePeriod
function miscalculates the next period start time, leading to skipped periods. This issue impacts gauges that rely on accurate period tracking, potentially causing incorrect emissions and reward distributions.
The updatePeriod
function behaves as follows:
When called within the current period, it reverts because the period has not yet elapsed.
When called in a new period, it calculates the next period start time using the following formula:
This calculation advances the period by two additional periods, instead of just moving to the next period.
As a result, the function skips multiple periods (e.g., moving 3 weeks ahead instead of 1 week).
This vulnerability disrupts the continuous progression of rewards and voting periods, leading to:
Missed reward distributions due to skipped periods.
Inaccurate time-weighted averages, affecting calculations relying on period tracking.
The following test demonstrates how the incorrect nextPeriodStart
calculation causes period skipping.
and the output:
Manual Review
Replace the incorrect nextPeriodStart calculation with the following formula:
This ensures that the gauge progresses one period at a time instead of skipping multiple periods.
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.