An issue exists in the increase()
function of veRAACToken.sol
where the line:
🚨 Can cause the transaction to revert when newPower
is smaller than balanceOf(msg.sender)
.
This happens because veTokens
are recalculated based on the remaining lock time, which naturally reduces voting power over time unless a much larger amount of RAAC
tokens has been added/increased.
✅ The correct approach is to implement the mint/burn logic as seen in extend()
, ensuring proper veToken balance updates.
When _votingState.calculateAndUpdatePower()
is invoked by increase()
, the following logic will first update duration with the remaining duration, a reduced value compared to when it was first locked. So, the numerator, (amount * duration)
may or may not be larger than the numerator when lock()
was last called by the user. If the proportionate increase of amount
is smaller than the proportionate decrease of duration
, initialPower, i.e. bias
is going to be smaller than the bias
from the first lock.
🚨 Issue: If newPower < balanceOf(msg.sender)
, the subtraction results in a negative value, causing _mint()
to revert.
Example Scenario
1️⃣ User locks 1000 RAAC for 4 years → Initial power = 1000 veTokens
2️⃣ After 2 years, user increases their lock by 500 RAAC
Remaining lock time = 2 years
New voting power = (1500 * 2 years) / 4 years = 750 veTokens
Since newPower = 750
but balanceOf(msg.sender) = 1000
, the _mint()
call fails:
Affects many users who try to increase their lock duration when their remaining lock time is already reduced unless a much larger amount is going to be increased. This flaw prevents users from dynamically managing their locked tokens.
Manual
Consider making the following change:
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.