Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Denial-of-Service (DoS) in lock Function Due to Incorrect Scaling of amount for Total Supply Validation

Summary

The lock function in the veRAACToken contract contains a vulnerability where the total supply validation is incorrectly performed against the amount parameter instead of the actual value being minted (newPower). This misalignment lead to incorrect enforcement of the MAX_TOTAL_SUPPLY limit, potentially allowing the contract to mint more tokens than intended or creating DOS.


Vulnerability Details

Location

The vulnerability is located in the lock function :

link

function lock(uint256 amount, uint256 duration) external nonReentrant whenNotPaused {
// ...
if (totalSupply() + amount > MAX_TOTAL_SUPPLY) revert TotalSupplyLimitExceeded();
// ...
}

Root Cause

The issue arises because the function validates the total supply against the amount parameter, which represents the number of tokens being locked. However, the actual value being minted is newPower, calculated as uint256(uint128(bias)), where bias is derived from the initialPower formula:

uint256 initialPower = (amount * duration) / MAX_LOCK_DURATION;

Since newPower is not guaranteed to be equal to amount, the validation logic is flawed. This will result in a DOS.

Impact

This will result in a Denial-of-Service (DoS) for minting veToken because amount is not scaled in the same way as the total supply. Since newPower is derived from amount and duration, and is typically much smaller than amount, the validation totalSupply() + amount > MAX_TOTAL_SUPPLY will revert when supply of veToken increase at some point.

Tools Used

The vulnerability was identified through a thorough review of the lock function and its associated logic.

Recommendations

Modify the lock function to validate the total supply against newPower instead of amount.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Incorrect `MAX_TOTAL_SUPPLY` check in the `veRAACToken::lock/extend` function of `veRAACToken` could harm locking functionality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.