The veRAACToken contract contains two separate storage variables, locks and _lockState.locks, intended to track user lock positions. However, the locks mapping is never updated, yet it is still referenced in multiple functions, leading to incorrect data retrieval.
The contract defines two mappings for tracking user lock positions:
While _lockState.locks is correctly used and updated within the LockManager, the locks mapping is never assigned values. Despite this, the contract references locks[msg.sender] in multiple places:
increase Function
Here, locks[msg.sender].amount is always zero, as locks is never updated.
getLockedBalance Function
This function returns incorrect values since locks[account].amount is never set.
getLockEndTime Function
Similar to getLockedBalance, this function always returns 0, providing inaccurate data.
PoC
Add the following test to test/unit/core/tokens/veRAACToken.test.js.
The test shows that after the user locks 1000 ETH, both the balance and endTime return 0.
The incorrect usage of the locks mapping results in:
getLockedBalance and getLockEndTime always returning 0, misleading users regarding their locked funds.
The increase function incorrectly referencing locks[msg.sender].amount, potentially affecting voting power calculations and other dependent logic.
Manual review
Remove the unused locks mapping and ensure all references use _lockState.locks.
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.