The increase
function in the veRAACToken
contract uses stale lock data from the locks mapping instead of the updated data stored in _lockState.locks
. This occurs because the locks mapping is never synchronized with _lockState.locks
, leading to incorrect calculations in functions like _updateBoostState
. This issue results in inaccurate boost calculations.
The increase
function increases the locked RAAC tokens by calling _lockState.increaseLock
, which updates _lockState.locks
. However, the function then uses the stale locks[msg.sender].amount
value in _updateBoostState
, as the locks
mapping is never updated. This inconsistency arises because the contract maintains two separate data structures (_lockState.locks
and locks
) without synchronizing them.
The root cause of the issue is the inconsistency between the _lockState.locks
and locks
mappings. Specifically:
Duplicate State Variables: The contract maintains two separate data structures for storing lock information:
_lockState.locks
: A LockManager.LockState
struct that is actively updated when locks are created, increased, or extended.
locks
: A mapping (mapping(address => Lock)
) that is never updated after initialization.
Stale Data in locks
Mapping: The locks
mapping is not synchronized with _lockState.locks
. As a result, any function that relies on locks[msg.sender].amount
(e.g., _updateBoostState
) uses stale or outdated data, while _lockState.locks
contains the correct, updated lock information.
Misuse of locks
Mapping: The locks
mapping is redundant and unnecessary since _lockState.locks
already stores the same information. However, the contract inconsistently uses both, leading to incorrect calculations.
The _updateBoostState
function uses stale data, leading to incorrect boost calculations for rewards, voting power calculations may be based on outdated lock amounts, affecting governance decisions.
Manual Review
Use Updated Lock Data: Ensure the increase
function uses the updated lock amount from _lockState.locks[msg.sender].amount
in _updateBoostState
.
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.