Core Contracts

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

poolBoost.workingSupply incorrectly overwritten

Summary

When updating a user/pool boost, the pool's working supply is incorrectly overwritten.

Vulnerability Details

When users call updateUserBoost() in order to boost a pool, the function incorrectly overwrites the poolBoost.workingSupply variable:

function updateUserBoost(address user, address pool) external override nonReentrant whenNotPaused {
...
if (newBoost >= oldBoost) {
poolBoost.totalBoost = poolBoost.totalBoost + (newBoost - oldBoost);
} else {
poolBoost.totalBoost = poolBoost.totalBoost - (oldBoost - newBoost);
}
@> poolBoost.workingSupply = newBoost; // Set working supply directly to new boost
poolBoost.lastUpdateTime = block.timestamp;
...
}

This is incorrect since the workingSupply variable is supposed to track the "total working supply including boosts". And what the function does is just overwrite it with the newBoost amount which is the current user's boost amount. It should increment the variable with newBoost instead of overwrite it.

Impact

The poolBoost.workingSupply will never be correctly reflected since the value is overwritten on every new boost with only the current boosting user's newBoost amount. This will calculate the pool rewards boosts incorrectly.

Tools Used

Manual Review

Recommendations

Increment the working supply instead of overwriting it.

Updates

Lead Judging Commences

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

BoostController::updateUserBoost overwrites workingSupply with single user's boost value instead of accumulating, breaking reward multipliers and allowing last updater to capture all benefits

Support

FAQs

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

Give us feedback!