The createLock
function in the contract does not check if a user already has an existing lock before allowing them to create a new one. Since the implementation does not support multiple locks per user, any new lock creation will overwrite the existing lock, leading to potential fund loss for users who expect multiple locks to be stored separately.
Affected code: veRAACToken::lock
Paste the following code into the veRAACToken.test.js
file
First lock creation: A user locks 1000
tokens for 1 year
.
Second lock creation: The same user locks 2000
tokens for 1 year + 5 days
.
Expected behavior: If multiple locks were supported, the user should have two separate locks.
Actual behavior: The second lock completely replaces the first one, overriding the amount, unlock time, and voting power.
Verification: The PoC confirms this by logging the lock details and asserting that only the most recent lock remains.
Loss of locked funds: If a user mistakenly assumes multiple locks are supported, they could lose access to their previous lock.
Unexpected user experience: Users may believe they have multiple active locks when, in reality, only the most recent one remains.
Manual Review
Prevent Overwriting: Before creating a new lock, check if the user already has an active lock.
Support Multiple Locks: Modify the contract to store locks in a mapping(address => Lock[])
to allow multiple simultaneous locks per user.
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.