Core Contracts

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

M-3 Precision loss in FeeCollector::_calculatePendingRewards

Summary

There is a potential Division Precision Loss in :

function _calculatePendingRewards(address user) internal view returns (uint256) {
uint256 userVotingPower = veRAACToken.getVotingPower(user);
if (userVotingPower == 0) return 0;
uint256 totalVotingPower = veRAACToken.getTotalVotingPower();
if (totalVotingPower == 0) return 0;
// @ audit - division loss
uint256 share = (totalDistributed * userVotingPower) / totalVotingPower;
return share > userRewards[user] ? share - userRewards[user] : 0;
}

Impact

  • In Solidity, integer division truncates decimals, which can cause precision loss.

  • This means share = (totalDistributed * userVotingPower) / totalVotingPower; might not allocate rewards fairly in some case

Tools Used

Manual Review

Recommendations

Since at the upper part of the contract there is constant PRECISION initiated it might be a good idea to actually use it(so far its not used anywhere).

96: uint256 private constant PRECISION = 1e18;

Potential fix coud be :

uint256 share = (totalDistributed * userVotingPower * PRECISION) / totalVotingPower / PRECISION;
Updates

Lead Judging Commences

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

FeeCollector::_calculatePendingRewards suffers from precision loss in integer division, causing users to receive fewer rewards than they're entitled to

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

FeeCollector::_calculatePendingRewards suffers from precision loss in integer division, causing users to receive fewer rewards than they're entitled to

Support

FAQs

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