Core Contracts

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

BaseGauge.periodFinish is a moving ahead with lastUpdateTime

Summary

periodFinish should be a fixed value rather moving in to future with updating the lastUpdateTime. Here periodFinish is never ending due to updating the lastUpdateTime.

Vulnerability Details

When user stake _updateReward is called and there assume lastUpdateTime is update to current timestamp.

function _updateReward(address account) internal {
rewardPerTokenStored = getRewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
UserState storage state = userStates[account];
state.rewards = earned(account);
state.rewardPerTokenPaid = rewardPerTokenStored;
state.lastUpdateTime = block.timestamp;
emit RewardUpdated(account, state.rewards);
}
}
function lastTimeRewardApplicable() public view returns (uint256) {
return block.timestamp < periodFinish() ? block.timestamp : periodFinish();
}

Implementation of periodFinish is this. You can see due to updating the lastUpdateTime , periodFinish is move ahead. Due to that again lastUpdateTime is possible to update via lastTimeRewardApplicable. This looping caused each other variables to update so periodFinish never ending.

function periodFinish() public view returns (uint256) {
return lastUpdateTime + getPeriodDuration();
}

Impact

The periodFinish value never ends, allowing users to continuously earn rewards by staking beyond the intended 7-day period. This could lead to excessive reward distribution and potential depletion of the reward pool.

Tools Used

Manual Review

Recommendations

Use another variable to lastUpdateTime in periodFinish so that periodFinish is fixed.

Updates

Lead Judging Commences

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

BaseGauge period end time miscalculation creates circular dependency between periodFinish() and lastUpdateTime, preventing periods from naturally ending and disrupting reward distribution

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

BaseGauge period end time miscalculation creates circular dependency between periodFinish() and lastUpdateTime, preventing periods from naturally ending and disrupting reward distribution

Support

FAQs

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

Give us feedback!