The GaugeController::vote function updates the userGaugeVotes state variable before calling _updateGaugeWeight. If _updateGaugeWeight fails due to underflow or other errors, the userGaugeVotes state will still be updated, leading to an inconsistent state. This violates the checks-effects-interactions pattern and could result in a corrupted contract state.
The vulnerability lies in the following code:
The userGaugeVotes state is updated before calling _updateGaugeWeight. If _updateGaugeWeight fails due to underflow or other errors, the userGaugeVotes state will remain updated, leading to inconsistency. If _updateGaugeWeight fails, the contract state will be left in an inconsistent state, making it difficult to recover or debug.
Inconsistent state updates make it challenging to recover or debug the contract, increasing the risk of permanent damage
Manual code review
Follow the checks-effects-interactions pattern by updating the state only after all validations and calculations are complete.
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.