The veRAACToken::lock
function uses the LockManager::createLock
function in the LockManager
library. This function has a vulnerability where it overwrites the existing lock amount instead of increasing it when a user creates a new lock while already having an active lock.
In the veRAACToken::lock
function, when a user creates a new lock, the function directly assigns a new Lock
struct to the state.locks[user]
mapping without checking if the user already has an existing lock. This results in the previous lock amount being overwritten, effectively losing the previously locked tokens.
Loss of user funds when withdrawing
Users who create a new lock while having an existing lock will lose their previously locked tokens when withdrawing.
Incorrect accounting of locked tokens
The veRAACToken::_lockState.totalLocked
will return the correct total locked amount, but the sum of all the lock amounts will be incorrect.
and the output of the test is:
Manual Review
To fix this issue, the LockManager::createLock
function should check if the user already has an existing lock and either revert or increase the existing lock amount.
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.