Description
The veRAACToken::increase function uses an uninitialized locks mapping for boost calculations instead of the correct _lockState.locks storage. This mapping is never updated, causing all boost calculations to use zero amounts.
mapping(address => Lock) public locks;
function increase(uint256 amount) external nonReentrant whenNotPaused {
_lockState.increaseLock(msg.sender, amount);
@> _updateBoostState(msg.sender, locks[msg.sender].amount);
LockManager.Lock memory userLock = _lockState.locks[msg.sender];
}
function lock(uint256 amount, uint256 duration) external {
@> _lockState.createLock(msg.sender, amount, duration);
_updateBoostState(msg.sender, amount);
}
Example of data inconsistency:
user.lock(1000 RAAC):
_lockState.locks[user].amount = 1000
locks[user].amount = 0
user.increase(500):
_updateBoostState uses:
- locks[user].amount = 0
Instead of:
- _lockState.locks[user].amount = 1000
Risk
Likelihood: High
Impact: Medium
Boost calculations use zero amounts
Users lose all boost benefits when increasing position
Affects governance power calculations
Recommended Mitigation
contract veRAACToken {
function increase(uint256 amount) external nonReentrant whenNotPaused {
_lockState.increaseLock(msg.sender, amount);
- _updateBoostState(msg.sender, locks[msg.sender].amount);
+ _updateBoostState(msg.sender, _lockState.locks[msg.sender].amount);
LockManager.Lock memory userLock = _lockState.locks[msg.sender];
}
}
Should use the correct _lockState.locks storage for boost calculations.