Core Contracts

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

Error in the periodFinish() function in the BaseGuage.sol causes incorrect reward distribution

Summary

The periodFinish function in the BaseGuage.sol is supposed to help the reward calculation by returning the time at which the period will end. But it is incorrect and keeps on adding the periodDuration to the lastUpdateTime variable. This is wrong.

Vulnerability Details

The lastUpdateTime is not just the startTime of the reward distribution period, but it is updated everytime someone stakes/withdraws etc.

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

This causes the reward Distribution to be messed up and give incorrect values. Also the period never ends.



Impact

Never ending reward period

Tools Used

manual review

Recommendations

Update the periodFinish to

return periodState.periodStartTime + getPeriodDuration();

Note: also in the notifyRewarAmount you may have to update the periodState.periodStartTime = block.Timestamp

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!