The _updateWeights function is responsible for updating the weights required for time-weighted average calculations. However, it is not invoked in the stake and withdraw functions of BaseGauge.sol. This omission may result in outdated or inaccurate weight calculations, leading to potential misalignment in staking rewards distribution.
Root Cause: The stake and withdraw functions alter the _totalSupply and _balances but do not trigger the _updateWeights function.
Effect: Since _updateWeights is designed to update the weight for accurate time-weighted average calculations, not calling it after staking or withdrawal could result in stale weight data.
Unfair Reward Distribution: Users may receive either more or fewer rewards than intended.
Financial Risk: Users exploiting this oversight could stake or withdraw at optimal times, gaining unfair advantages.
Manual Review
Invoke _updateWeights:
Call _updateWeights with the appropriate weight parameter inside both stake and withdraw functions to ensure weights are updated after every balance change.
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.