Closed sherlock-admin3 closed 3 months ago
Low severity, extremely small amount of tokens lost + getVotes/getPastVotesIndex/getPastVotes
are never utilized in the codebase i.e. governance that velocimeter are not using, so this is simply a incorrect return value in view function
- Incorrect values in View functions are by default considered low.
Avci
Medium
Depositing a small amount of tokens to
VotingEscrow
contract is not accountedSummary
if users deposit small amount of tokens to
VotingEscrow
the voting power of deposit will not accounted.Vulnerability Detail
During the
_checkpoint()
function, when calculating a new slope, the bias difference is divided by the timestamp. If the bias difference is less than the timestamp, the division results in zero, meaning no increase in bias is applied at the checkpoint. lost is small but It still affects the correctness of accounting.please run POC:
VotingEscrow.t.sol
contractforge test --mt testSmallDepositIssue -vvv
output:
Impact
The Voting power of a user is not increased despite increased deposit.
Code Snippet
https://github.com/sherlock-audit/2024-06-velocimeter/blob/63818925987a5115a80eff4bd12578146a844cfd/v4-contracts/contracts/VotingEscrow.sol#L598-L733
Tool used
Manual Review
Recommendation
consider minimum deposit limit to avoid this issue.