The increase() function in veRAACToken fails to handle the case where the new voting power is less than the current power due to linear decay over time, leading to an underflow when minting tokens.
In veRAACToken::increase(), after calculating the new voting power, the function attempts to mint the difference between the new power and current balance:
However, due to the linear decay of voting power implemented in VotingPowerLib::calculateAndUpdatePower(), the new power can be less than the current balance, causing an underflow in the subtraction operation.
The root cause is that the function assumes the new power will always be greater than the initial power, but this is not true due to the time-based decay of voting power.
Users attempting to increase their lock amount may have their transactions revert due to underflow
This effectively prevents users from increasing their lock amounts after a certain time period
The contract becomes partially unusable as one of its core functions fails
Add the following test to the veRAACToken.test.js
file:
Handle power decrease similar to the extend() function:
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.