The FeeCollector contract contains a critical flaw in its reward distribution mechanism where the TimeWeightedAverage.createPeriod function overwrites the active distributionPeriod without accounting for ongoing distributions. This oversight disrupts time-weighted reward calculations, potentially causing incorrect payouts to veRAAC token holders and undermining the protocol’s reward distribution integrity.
FeeCollector Contract – _processDistributions Function:
Overwriting Active Periods: The createPeriod function resets the distributionPeriod state without checking if an active period is already ongoing. Subsequent distributions will overwrite the existing period’s startTime and endTime, disrupting the time-weighted reward calculations.
Lack of State Continuity: The contract fails to track historical periods or prorate rewards across overlapping time windows, leading to data loss for unclaimed rewards from previous periods.
Initialization: The distributionPeriod is initialized in the constructor with a fixed 7-day duration.
First Distribution: When distributeCollectedFees is called, createPeriod sets:
startTime = block.timestamp + 1
endTime = startTime + 7 days
Second Distribution: If distributeCollectedFees is called again before the current endTime, the existing distributionPeriod is overwritten with a new period starting at the new block.timestamp + 1, discarding the remaining time from the previous period.
Users claiming rewards during overlapping periods will receive incorrect amounts, as calculations rely on the most recent (and potentially truncated) distributionPeriod.
Manual Review
Track historical periods to preserve time-weighted data:
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.