Core Contracts

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

Unnecessary Gas Consumption Due to Missing Zero-Amount Check in notifyRewardAmount()

Summary

The function notifyRewardAmount() does not check if amount > 0 before executing updateReward(address(0)). This results in unnecessary function calls and wasted gas when amount == 0, as there is no reason to proceed with reward calculations in such cases.

Vulnerability Details

Lack of amount > 0 Validation

  • The function does not check if amount == 0 before calling updateReward(address(0)).

  • If amount == 0, updateReward() still executes, consuming unnecessary gas.

  • Since notifyRewardAmount() has no effect when amount == 0, the function should exit early to prevent gas waste.

Impact

Unnecessary Gas Consumption:

  • Calling updateReward(address(0)) when amount == 0 wastes gas.

  • The redundant amount > periodState.emission check increases execution costs.

  • The function executes logic that has no impact when amount == 0.

  • This issue is more severe in high-frequency reward distributions (e.g., staking, farming).

Tools Used

Manual Review

Recommendations

Add amount == 0 validation check in the start of the function.

function notifyRewardAmount(uint256 amount) external override onlyController updateReward(address(0)) {
++ if (amount == 0) revert InvalidRewardAmount();
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);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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