In VERAAC::increase, users can add more locked RAAC tokens to their existing position. However, an issue arises when computing calculateAndUpdatePower. After half of the lock period has passed, newPower can become lower than the current power, causing _mint to revert.
A user locks their tokens at block.timestamp = 0 for a 1-year period (ending at 1 year).
At block.timestamp = 0.5 years + 1, they increase their locked position by 100 tokens.
Initial voting power:
100 × (1 year / 4 years) = 100 × 0.25 = 25
New voting power calculation (assuming an added 50 tokens instead of 100 for demonstration):
(100 + 50) × (0.5 year / 4 years) = 150 × 0.125 = 18
Since newPower < balanceOf(msg.sender), _mint(msg.sender, newPower - balanceOf(msg.sender)) reverts.
calculateAndUpdatePower does not work correctly.
_mint expects an increase in balance, but the calculation results in a lower power.
Users cannot correctly increase their voting power mid-lock, leading to a broken locking mechanism and reduced flexibility in governance participation.
Manual review
Modify increase or calculateAndUpdatePower to ensure newPower never decreases when increasing the locked amount
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.