We want to allow user to adjust the weight they want to use in each gauge. The main issue is if user already set a weight for a gauge and his/her voting power (amount of veRAAC token that he/she holds) has increased. The user won't be able to update the weight for himself and the gauge he desiers to do so. The main root cause of this issue is located in the _updateGaugeWeight function of the GaugeController contract.
The root cause of the issue is that when we update the weight of the gauge we first substract the oldWeight of the user scaled by his/her current voting power. This means if the voting power is big enough(increased for some user that already has set the gauge weight). We would get a negative number when we do oldGaugeWeight - (oldWeight * votingPower / WEIGHT_PRECISION), this would cause an instnt revert before we add the final pice of the calculation that is (newWeight * votingPower / WEIGHT_PRECISION). In our test scenario any increase of the user voting power would do the trick as he/she is the only user that has voted for the weight of the gauge so far.
Users with an increased voting power might not be able to change their gauge weight in specific gauges. This would lead to unsatisfactory rewards payouts from some gagues as gauge weight is no longer satisfactory for the user.
Manual Review
Unit tests
Place the test inside of the GaugeController.test.js in the describe("Weight Management") test suite group.
Switch the order of the arithmetic operation so addition comes before substraction:
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.