The veRAACToken::lock
function does not check whether a user already has an existing lock before allowing a new one. Additionally, it does not verify the total locked amount against the global maximum (MAX_TOTAL_LOCKED_AMOUNT
). This oversight allows users to initiate multiple lock operations and potentially exceed the total lockable supply, leading to unintended behavior in the protocol's lock management.
The veRAACToken::lock
function is responsible for locking RAAC
tokens and minting veRAAC
tokens as voting power. However, it does not verify whether the caller already has an active lock. The contract's lock management structure (LockState
) contains an exists
flag within the Lock
struct, which should be checked before creating a new lock. Since this verification is missing, users can repeatedly call lock
, overriding previous locks and creating inconsistencies in the system.
Additionally, the function does not check whether the total amount of locked tokens exceeds the global limit:
Without verifying this limit, the contract could allow more tokens to be locked than intended, leading to economic instability.
Affected Code in veRAACToken
Code Reference: https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/tokens/veRAACToken.sol#L212
Lock State Structure
Since the exists
flag is never checked, users can initiate multiple locks without restrictions. Additionally, MAX_TOTAL_LOCKED_AMOUNT
is never enforced, allowing the system to exceed intended limits.
Steps to Reproduce
A user locks 100e18
RAAC tokens for 1 year.
The user then locks 500e18
RAAC tokens for 2 years.
The contract does not prevent the second lock, overriding the first lock's details without proper handling.
Multiple users can continue locking until the total amount exceeds MAX_TOTAL_LOCKED_AMOUNT
, causing system imbalance.
Proof-of-concept
Inconsistent Locking Behavior: The protocol assumes that a user can have only one active lock, but multiple locks can exist without merging or rejecting the new one.
Incorrect Voting Power Calculation: Since veRAAC tokens represent voting power, multiple locks may cause incorrect voting power distribution.
Total Lock Limit Breach: Exceeding MAX_TOTAL_LOCKED_AMOUNT can lead to unforeseen economic issues within the protocol.
Manual Review
Modify lock
function to ensure that a user cannot create a new lock if one already exists and verify the total locked amount before proceeding.
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.