The GaugeController
uses balanceOf()
instead of getVotingPower()
when processing votes, which leads to using inflated voting power that doesn't account for the time decay of the vote-escrowed token (veRAACToken). This allow users to have more voting influence than they should have based on the intended vote-escrow mechanics.
veRAACToken implements a vote-escrow system similar to veCRV where voting power decays linearly over time
The issue is in the GaugeController's vote function where it uses the raw balance instead of the time-weighted voting power:
Linear decay means a value decreases at a constant rate over time.
Using the actual token balance ignores this mechanism completly, because the balance doesn't decrease, instead the calculated voting power decreases and should be used.
For example, if you lock 1000 RAAC for 4 years:
Initial voting power (bias) = 1000
Slope = 1000 / (4 years in seconds)
As time passes, voting power decreases linearly until it reaches 0 at unlock time
Read more about this behavior here [https://resources.curve.fi/vecrv/overview]
In order to run the test you need to:
Run foundryup
to get the latest version of Foundry
Install hardhat-foundry: npm install --save-dev @nomicfoundation/hardhat-foundry
Import it in your Hardhat config: require("@nomicfoundation/hardhat-foundry");
Make sure you've set the BASE_RPC_URL
in the .env
file or comment out the forking
option in the hardhat config.
Run npx hardhat init-foundry
There is one file in the test folder that will throw an error during compilation so rename the file in test/unit/libraries/ReserveLibraryMock.sol
to => ReserveLibraryMock.sol_broken
so it doesn't get compiled anymore (we don't need it anyways).
Create a new folder test/foundry
Paste the below code into a new test file i.e.: FoundryTest.t.sol
Run the test: forge test --mc FoundryTest -vvvv
Users can vote with more power than they should have based on the time-decay mechanism
This undermines the entire vote-escrow tokenomics where longer lock times should provide more voting power
Lead to manipulation of gauge weights and consequently reward distributions
The impact increases as time passes and the actual voting power decays while the used balance remains constant
Foundry
Manual Review
Update the interface for the veRAACToken :
Then replace the voting 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.