Upon IncreaseAmount the lock may not align to the nearest weekly increment
The IncreaseAmount function sets the lock end time to the current block timestamp plus the lock duration without rounding down to the nearest weekly increment, unlike other lock creation paths. This misalignment can cause the checkpoint logic to compute incorrect slopes, leading to wrong voting power and relative votes.
Note: This audit was preceded by a Code4rena Test Coverage competition. While auditing was not the purpose of the testing phase, relevant and valuable findings reported during that phase were eligible to be judged. This finding [M-02] was discovered during that period and is being included here for completeness.
In most other places, locks are created with the end time rounded down to nearest weekly increment using the _floorToWeek function.
These slope changes would not have been applied (neither the user-specific ones, nor the global ones), resulting in wrong slopes. And if many users did this, many slopes would be messed up at some point, leading to wrong votes / relative votes.
The original report as published on Code4rena, by gzeon. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Impact
If many users increase their lock amount, many slopes would be messed up at some point, leading to wrong votes or relative votes.
What the attacker needed
User calls IncreaseAmount
The fix
The issue was fixed before the audit contest by ensuring the lock end time is aligned to the nearest weekly increment.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
In this voting system, lock end times are supposed to be rounded down to the nearest week so that the maths for calculating voting power works correctly. One function forgot to do that rounding, so the end time could be any day. That mismatch can make the system calculate the wrong voting power for users.
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.