Less active nominees can be left without rewards after an year of inactivity
The VoteWeighting contract only retains nominee voting history for 53 weeks, so if a nominee receives no votes for over a year, the nomineeRelativeWeight function returns zero even though users still have locked tokens. This causes those users to lose their voting power and potential rewards.
Submitted by marchev, also found by EV_om
Impact
The VoteWeighting within the protocol requires some sort of activity for nominees at least every 53 weeks to maintain its functionality properly. However, some nominees can be less active. Particularly when users lock their veOLAS for long periods (e.g., 4 years) and vote in a set-and-forget manner.
Due to the current one-year lookbehind period, the nomineeRelativeWeight() function will break for less active nominees after one year (it will return 0), causing users with longer lock periods to essentially lose their voting power. This undermines the fairness and intended functionality of the protocol, as these users will no longer be able to influence governance or earn rewards despite their significant long-term commitment.
An attempt to address this issue with keepers would not be effective. A malicious user can create an arbitrarily large number of nominees. This would make iterating over all nominees on a regular basis to ensure checkpoints are made extremely gas-expensive, rendering the keepers model impractical and ineffective.
Proof of Concept
The vulnerability can be observed in the following scenario:
- A user locks their veOLAS tokens for 4 years and votes for a nominee.
- The user does not interact with the nominee for over 53 weeks. No other users interact with it either.
- After this period, when attempting to call the
nomineeRelativeWeight()function, it will return0even though the user has almost 3 years of lock period remaining. - As a result, the voting power associated with the user’s locked veOLAS is lost.
This issue can be traced to the code handling the lookbehind period for nominees, which does not retain historical data beyond 53 weeks:
The following coded PoC demonstrates the issue. Add the following test case to VoteWeighting.js:
it.only("Nominee can get bigger share", async function () {
const oneMillionOLAS = ethers.utils.parseEther("1000000");
// Add nominees
const numNominees = 2;
let nominees = [signers[1].address, signers[2].address];
const chainIds = new Array(numNominees).fill(chainId);
for (let i = 0; i < numNominees; i++) {
await vw.addNomineeEVM(nominees[i], chainIds[i]);
}
nominees = [convertAddressToBytes32(nominees[0]), convertAddressToBytes32(nominees[1])];
// Actors
let charlie = signers[0];
let alice = signers[10];
let bob = signers[11];
// Mint 1M OLAS to Alice & Bob
await olas.mint(alice.address, oneMillionOLAS);
await olas.mint(bob.address, oneMillionOLAS);
// Approve token transfer for locks
await olas.approve(ve.address, oneMillionOLAS);
await olas.connect(alice).approve(ve.address, oneMillionOLAS);
await olas.connect(bob).approve(ve.address, oneMillionOLAS);
// Lock 1M OLAS into veOLAS for 4 years
await ve.createLock(oneMillionOLAS, 4 * oneYear);
await ve.connect(alice).createLock(oneMillionOLAS, 4 * oneYear);
await ve.connect(bob).createLock(oneMillionOLAS, 4 * oneYear);
// Charlie votes for nominees[0], whereas alice and bob - for nominees[1]
await vw.voteForNomineeWeights(nominees[0], chainId, maxVoteWeight);
await vw.connect(alice).voteForNomineeWeights(nominees[1], chainId, maxVoteWeight);
await vw.connect(bob).voteForNomineeWeights(nominees[1], chainId, maxVoteWeight);
// Vote for nominees
// Get the next point timestamp where votes are written after voting
const block = await ethers.provider.getBlock("latest");
const nextTime = getNextTime(block.timestamp);
// Check weights that must represent a half for each
for (let i = 0; i < numNominees; i++) {
const weight = await vw.nomineeRelativeWeight(nominees[i], chainIds[i], nextTime);
console.log("Vote weights @ lock time: nominees[%s] = %s", i, Number(weight.relativeWeight) / E18);
}
// Advance 1 year
await helpers.time.increase(oneWeek * 52);
// Alice & Bob vote, Charlie - does not
await vw.connect(alice).voteForNomineeWeights(nominees[1], chainId, maxVoteWeight);
await vw.connect(bob).voteForNomineeWeights(nominees[1], chainId, maxVoteWeight);
for (let i = 0; i < numNominees; i++) {
const weight = await vw.nomineeRelativeWeight(nominees[i], chainIds[i], nextTime + (oneWeek * 52));
console.log("Vote weights @ 1 year later: nominees[%s] weight = %s", i, Number(weight.relativeWeight) / E18);
}
// Advance 1 more year
await helpers.time.increase(oneWeek * 2); // Beyond 53 weeks
await vw.checkpointNominee(nominees[0], chainId); // Relative weight will be broken despite this checkpoint
await vw.checkpointNominee(nominees[1], chainId);
for (let i = 0; i < numNominees; i++) {
const weight = await vw.nomineeRelativeWeight(nominees[i], chainIds[i], nextTime + (oneWeek * 54));
console.log("Vote weights @ 2 years later: nominees[%s] weight = %s", i, Number(weight.relativeWeight) / E18);
}
});
Recommended Mitigation Steps
To mitigate this vulnerability, it is recommended to extend the lookbehind period to at least the maximum lock period plus one additional year. This approach is effectively implemented in Curve’s VotingEscrow, where the lookbehind period is 5 years while the maximum lock period is 4 years.
Furthermore, since the weight calculation is done on a per-nominee basis, there is isolation between the calculations for different nominees. This isolation ensures that issues with one nominee do not affect the calculations for others. If there are concerns related to reaching the block gas limit, the maximum number of weeks to iterate over can be made configurable.
Assessed type
Governance
kupermind (Olas) acknowledged and commented:
The gas limit concern is real, as the checkpoint for nominees is called in the Dispenser function that is expensive by itself. As for the mitigation steps, we might check in the
voteForNomineeWeights()function that point’snextTimeis equal to the actual next week, otherwise we revert, as the user then has to callcheckpoint()several times in order to extrapolate until the requirednextWeektime.
MAX_NUM_WEEKSis a limit set by the protocol, and the issues that might stem from it are pretty obvious.@kupermind, do you see here any new information on the issue side? I tend to mark this as low, suggesting better mitigation for existing limitations isn’t more than a low.
@0xA5DF - For now we don’t handle the case in the voting function itself for when there is inactive nominee gets voted on, and thus biases won’t be computed correctly.
We deviated from the original 500 weeks value to reduce the possible max gas, but it was really a nice protection from the cases described here, such that in voting itself all the values are correct. I think we can leave it as medium, and the solution is trivial - bring back the bigger number of maximum weeks, at least to cover full 4 years.
Marking as Medium due to sponsor’s comment. It seems like this issue wasn’t obvious; therefore, this is a valid issue.
Note: For full discussion, see here.
Fixed with maximum number of weeks increased to 250.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The lookbehind period for nominee checkpoints is limited to 53 weeks, which is shorter than the maximum lock period of 4 years, so historical voting data is discarded too early.
Impact
Users with long lock periods could lose their voting power and rewards for less active nominees, and a keeper-based workaround is impractical because a malicious user can create many nominees to make checkpoints too expensive.
What the attacker needed
User locks tokens for longer than 53 weeks; nominee receives no votes for over 53 weeks
The fix
The lookbehind period should be extended to at least the maximum lock period plus one year, and the project later mitigated the issue by increasing the maximum number of weeks to 250.
How it was found
- A user locks veOLAS tokens for 4 years and votes for a nominee.
- The user and others do not interact with that nominee for over 53 weeks.
- After this period, calling nomineeRelativeWeight returns 0 even though the user still has almost 3 years of lock remaining.
- The user's voting power is lost.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this system, people lock tokens for years and vote for nominees. The contract only remembers votes for about a year. If nobody votes for a nominee for over a year, the contract forgets the old votes and treats the nominee as having no weight, so the locked tokens no longer count.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.