The increase
function in the veRAAC token contract incorrectly calculates and updates a user's voting power, resulting in an inflated voting power balance. This is due to the user's locked RAAC balance being updated before the voting power calculation, which then incorrectly adds the increase amount again to the user's balance during the power calculation. This leads to an inflated voting power, allowing users maniplate and influence in governance proposals, receive unfair rewards.
The increase
function updates the user's locked RAAC balance before recalculating their voting power. Specifically, the amount being increased is added to the user's existing balance within the increaseLock
function itself. Subsequently, the calculateAndUpdatePower
function uses this already updated balance to calculate the new voting power. However, the logic within the voting power calculation appears to add the increase amount again to the user's balance, effectively counting it twice. This results in an inflated voting power.
Users receive an inflated voting power, which can have significant consequences:
Governance Manipulation: Users can potentially influence the governance proposals due to their artificially inflated voting power. Malicious actors could exploit this to manipulate proposals in their favor.
Unfair Rewards Distribution: If voting power is used to determine rewards, users with inflated voting power will receive a disproportionately larger share of rewards, unfairly penalizing other users.
Protocol Instability: The incorrect voting power can destabilize the protocol by allowing users to vote on proposals with more weight than they should have, potentially leading to unintended or harmful outcomes.
Mahi locks 100 RAAC tokens for365 days. This gives her, 25 voting power (veRAAC Tokens). Her locked balance is 100, and her voting power is 25.
Mahi calls increase(100)
.
Inside the increaseLock
function, Mahi's locked balance is updated to 200 (100 + 100).
calculateAndUpdatePower
is called, which incorrectly adds the increase amount again calculateAndUpdatePower(200 + 100)
.
The calculation uses 300 as the locked balance, leading to a voting power to be 75 veRAAC tokens.
Mahi now has 75 voting power instead of the correct 50 (based on her 200 locked RAAC). She has effectively been granted voting power for tokens she hasn't locked for the required duration. This inflated voting power gives her undue influence in any governance proposals.
Use this guide to intergrate foundry into your project: foundry
Create a new file FortisAudits.t.sol
in the test
directory.
Add the following gist code to the file: Gist Code
Run the test using forge test --mt test_FortisAudits_InflatedVotingPower -vvvv
.
Manual code review.
To mitigate this vulnerability, the increase
function should be modified to ensure the voting power is calculated correctly, and that the increased amount is not added new updated balance second time during the power calculation.
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.