-
Notifications
You must be signed in to change notification settings - Fork 8
bughuntoor - Certain functions should not be usable when GaugeController
is locked.
#18
Comments
Hello, Thanks a lot for your attention. Absolutely, if we kill a gauge or change a type weight during the distribution, it would distribute wrong amounts, even though we're not planning to do that. We can make sure it doesn't happen by doing what you said: locking those functions to avoid any problems. Therefore, in conclusion, we must consider your issue as a valid. Regards, |
I will keep this as medium as although on first look this could be "admin error", as sponsor mentioned, honest users claiming during killing of a gauge or weight change can result in inaccurate result distribution. |
GaugeController
is locked.GaugeController
is locked.
Escalate This is an admin function, the admin can be trusted to not call these operations when voting is routinely locked to not interfere with rewards distribution Moreover, outside of routine cycle increments, it would be a good procedure to lock votes before the admin changes weights, as described in other reported issues such as #122 |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
See comments here |
I believe the escalation makes a valid point. Planning to consider this issue a low severity one. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
Fix looks good. _setTotalWeight has now been folded inside _checkpoints to avoid this issue |
bughuntoor
medium
Certain functions should not be usable when
GaugeController
is locked.Summary
Possible unfair over/under distribution of rewards
Vulnerability Detail
When
writeStakingRewards
is invoked for the first time it calls_checkpoints
which sets the lock in the GaugeController to true. What this does is it doesn't allow for any new vote changes. The idea behind it is that until the rewards are fully distributed there are no changes in the gauges' weights so the distribution of rewards is correct.However, there are multiple unrestricted functions which can alter the outcome of the rewards and result in not only unfair distribution, but also to many overdistributed or underdistributed rewards.
If any of
change_gauge_weight
change_type_weight
or is called after thetotalWeightLocked
is calculated, it will result in incorrect distribution of rewards. When_distributeCvgRewards
is called, some gauges may not have the same value that has been used to calculate thetotalWeightLocked
and this may result in distribution too many or too little rewards. It also gives an unfair advantage/disadvantage to the different gauges.Impact
Unfair distribution of rewards. Over/underdistributing rewards.
Code Snippet
https://github.com/sherlock-audit/2023-11-convergence/blob/main/sherlock-cvg/contracts/Rewards/CvgRewards.sol#L244C1-L272C6
Tool used
Manual Review
Recommendation
Add a lock to
change_gauge_weight
change_type_weight
The text was updated successfully, but these errors were encountered: