This condition is checked every time distribute is called for a gauge, which can lead to the activeGaugeNumber being incremented multiple times for the same gauge within an epoch. This could result in an inflated activeGaugeNumber that doesn't accurately represent the number of unique active gauges.
To fix this, we should:
Keep track of which gauges have been counted as active in the current epoch.
Only increment activeGaugeNumber if the gauge hasn't been counted as active in this epoch yet.
Minato7namikazi
High
activeGaugeNumber
could be incremented multiple times for the same gauge within an epoch.Vulnerability Detail
in the
distribute
function:The bug is in the condition for incrementing the
activeGaugeNumber
:This condition is checked every time
distribute
is called for a gauge, which can lead to theactiveGaugeNumber
being incremented multiple times for the same gauge within an epoch. This could result in an inflatedactiveGaugeNumber
that doesn't accurately represent the number of unique active gauges.To fix this, we should:
activeGaugeNumber
if the gauge hasn't been counted as active in this epoch yet.Code Snippet
https://github.com/sherlock-audit/2024-06-velocimeter/blob/main/v4-contracts/contracts/Voter.sol#L555
Tool used
Manual Review