Core Contracts

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

Incorrect periodFinish() leads to faulty rewards calculation

Description

perodFinish() has incorrect logic and should be:

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

This is because lastUpdateTime can easily get updated if a function like notifyRewardAmount() is called:

function notifyRewardAmount(uint256 amount) external override onlyController updateReward(address(0)) {
if (amount > periodState.emission) revert RewardCapExceeded();
rewardRate = notifyReward(periodState, amount, periodState.emission, getPeriodDuration());
periodState.distributed += amount;
uint256 balance = rewardToken.balanceOf(address(this));
if (rewardRate * getPeriodDuration() > balance) {
revert InsufficientRewardBalance();
}
@---> lastUpdateTime = block.timestamp;
emit RewardNotified(amount);
}

Or via stake() --> updateReward() modifier --> _updateReward() --> lastTimeRewardApplicable() which returns:

function lastTimeRewardApplicable() public view returns (uint256) {
return block.timestamp < periodFinish() ? block.timestamp : periodFinish();
}

Since lastTimeRewardApplicable() is internally called by both getRewardPerToken() and _udpate(), it can result in exceeding the period-end timestamp due to this faulty logic. Every time rewards are updated, it would extend the period-end time.

Impact

  1. Reward Period Extension

  2. Incorrect reward distribution among users

  3. Manipulation potential where users could time their interactions to exploit the extending periods

Back to Top

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 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 3 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.