The lock function in the veRAACToken contract incorrectly checks the total supply of veRAAC tokens against the amount of RAAC tokens being locked to enforce the MAX_TOTAL_SUPPLY limit. This is invalid because veRAAC tokens are minted based on voting power (newPower), not the amount of RAAC tokens locked. This low-severity issue could lead to incorrect enforcement of the total supply limit.
The lock function enforces a maximum total supply limit (MAX_TOTAL_SUPPLY) by comparing the current total supply of veRAAC tokens with the amount of RAAC tokens being locked. However, veRAAC tokens are minted based on the voting power (newPower) calculated from the lock duration and amount, not directly on the amount of RAAC tokens. This means the current check is invalid and could lead to incorrect enforcement of the total supply limit.
The issue lies in the following line of the lock function:
Here, amount refers to the RAAC tokens being locked, but veRAAC tokens are minted based on the voting power (newPower), which is calculated later in the function:
The correct check should compare the current total supply of veRAAC tokens with the newPower that is about to be minted, not the amount of RAAC tokens being locked.
Incorrect Enforcement of Total Supply Limit: The total supply limit may be enforced incorrectly, leading to unnecessary reverts or failure to prevent exceeding the limit.
Broken Invariant: The total supply can be broken if newPower + totalSupply() is larger than Max supply since it was not checked.
Manual Code Review: The vulnerability was identified through a manual review of the veRAACToken contract.
Check Total Supply Against New Power:
Update the total supply check to compare the current total supply of veRAAC tokens with the newPower that is about to be minted.
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.