The _updateWeights
function in the BaseGauge
contract contains an if-else block where both branches execute the same logic. This redundancy suggests that the intended differentiated handling for the initial period and subsequent periods is either missing or improperly implemented.
The condition if (weightPeriod.startTime == 0)
is meant to handle the initial period differently from subsequent periods.
However, both branches (the if and the else) execute the exact same logic: calculating nextPeriodStart
in the same way and calling TimeWeightedAverage.createPeriod
with identical parameters.
This results in redundant code and suggests that the intended distinction between the initial period and later periods is not implemented.
Confusion in Code: The presence of redundant conditional branches might mislead developers into thinking there is a different handling mechanism for the initial period and subsequent periods, even though the logic is the same.
Potential Miscalculations: If there was an intention to handle the initial period differently (e.g., with specific rules or adjustments), the current implementation may result in incorrect calculations of time-weighted averages, leading to improper reward distributions or other issues.
Manual Code Review
Clarify the Intended Behavior: Ensure that the logic for handling the initial period is clear. If different handling is necessary for the first period, implement distinct logic in each branch.
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.