The Governance contract quorum() relies on the wrong total supply. It calculates the static total veRAACToken supply when it should be calculating the dynamic currentVotingPower supply.
The total supply calculation should account for slope and bias. The contract does not ensure that at all times the sum of all user balance (which decay over time) equals exactly the total supply (which is static as implemented).
The total supply should represent the sum of all users’ current voting power. Currently, quorum() relies on totalVotingPower()::veRAACToken.sol (which relies on totalSupply()).
The total supply doesn’t correctly reflect decayed voting power. In order to calculate the totalSupply, we need a special function which takes into account slope changes.
As a result, the protocol believes there is more voting power available than actually exists, leading to incorrect governance outcomes.
The global total voting power (or totalSupply) must reflect the real-time voting power of all locks.
VotingPowerLib.sol:
Note we are deploying the real VeRAACToken and RAACToken for this PoC.
Step1: Paste the following into the beforeEach block of Governance.test.js:
Step2: Modify the deployment of governance (include address of real veRAACToken):
Step3: Paste in this Describe block of Governance.test.js:
Step4: Run with following command:
1) The bug affects the following other functions which rely on quorum(): state(), getDebugInfo() and _isProposalSuccessful(). The result is that the quorum will be overestimated and be higher than it should be
2) Proposals will fail incorrectly as _isProposalSuccessful() relies on quorum() to check if a vote succeeded or not. Because the quorum will always be higher than it should be, many proposals will fail that should pass.
Manual review, Hardhat
Modify the total voting power calculation to reflect the real-time decayed voting power rather than using a static total supply. Update or add a dedicated function that sums the current voting power of all locked tokens—taking into account both slope and bias—for use in the quorum() calculation.
Ensure that the quorum() function leverages a dynamic total voting power value that decreases over time as individual voting power decays.
This adjustment will prevent governance outcomes from being skewed by an overestimation of available voting power.
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.