The _updateWeights function in the BaseGauge contract contains an if-else block where both branches execute the exact same logic. This redundancy indicates that the intended differentiated behavior for the initial period versus subsequent periods is missing.
Affected Function:
Root Cause:
The if (weightPeriod.startTime == 0) condition is intended to distinguish between the initial period and later periods.
However, both the if and else blocks calculate nextPeriodStart in the same way and call TimeWeightedAverage.createPeriod with identical parameters.
This redundancy means the intended differentiated logic is not implemented.
Misleading Implementation: The redundant branches may confuse developers, suggesting that different handling occurs for the initial period versus subsequent periods when it does not.
Potential Miscalculations: If distinct behavior was intended for the initial period, the lack of differentiation might lead to inaccurate time-weighted average calculations and, consequently, improper reward distribution.
Manual Code Review
Review Intended Behavior: Clarify whether the initial period should be handled differently. If so, implement distinct logic for each branch.
Eliminate Redundancy: If identical behavior is acceptable, simplify the function by removing the if-else condition and directly performing the update.
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.