Core Contracts

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

maxTotalLocked Not Enforced

Summary

The LockManager library defines a maxTotalLocked variable, which is intended to restrict the total amount of locked tokens. However, this limit is not enforced in the code, allowing users to exceed the intended cap.

Vulnerability Details

Expected Behavior (as per Documentation)

The LockState struct includes maxTotalLocked, which is described in the documentation as follows:

maxTotalLockedMaximum total amount of tokens that can be locked

Additionally, the Usage Notes section of the documentation states:

Maximum lock amounts per position and globally can be configured in LockState.

This clearly suggests that maxTotalLocked should be enforced to restrict the global token lock limit.

Actual Behavior (Test Findings)

Despite being defined in the struct, maxTotalLocked is never actually enforced in createLock or increaseLock. This means that users can exceed the global lock cap without any restrictions.

Failing Test (Expected to Revert, but It Didn't)

it("Should enforce maxTotalLocked correctly", async function () {
const lockAmount = ethers.parseEther("10");
const maxTotal = ethers.parseEther("15");
// Set max total locked amount
await lockManager.setMaxTotalLocked(maxTotal);
// Lock 10 tokens (valid)
await lockManager.createLock(user1.address, lockAmount, YEAR);
// Lock another 10 tokens (expected to fail but didn't)
await expect(
lockManager.createLock(user2.address, lockAmount, YEAR)
).to.be.revertedWithCustomError(lockManager, "AmountExceedsLimit");
});
  • The test expected a revert because the second lock exceeded maxTotalLocked (15 tokens total vs. 10 + 10 = 20).

  • No error was thrown, confirming that maxTotalLocked is not enforced in the contract.

  • Since maxLockAmount (per-user limit) is enforced but maxTotalLocked is not, this creates an inconsistency in validation logic.

Impact

  • Severity: Low

  • No direct loss of funds, but the system does not behave as intended based on the documentation.

  • If token locking is used for governance, staking, or economic modeling, this could disrupt the system's design.

  • Users can lock unlimited tokens, bypassing restrictions.

Tools Used

Hardhat

Recommendations

To enforce maxTotalLocked, add the following check inside createLock and increaseLock:

if (state.totalLocked + amount > state.maxTotalLocked) revert AmountExceedsLimit();
Updates

Lead Judging Commences

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

veRAACToken::increase doesn't check the maximum total locked amount

`veRAACToken::lock` function doesn't check MAX_TOTAL_LOCKED_AMOUNT

Support

FAQs

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