DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

In the distributePoints function, a potential risk of precision loss

Summary

In the distributePoints function, a potential risk of precision loss was identified. The specific code in question is:

pointsPerToken =
pointsPerToken.add(weeksPending * (pointsPerEpoch.mul(PRECISION_18).div(totalStaked)));

Vulnerability Details

Precision Loss Risk: In this line of code, the division operation is performed early in the expression pointsPerEpoch.mul(PRECISION_18).div(totalStaked), which can lead to precision loss during the calculation of point distribution.
Cause Analysis: Solidity performs integer division by truncating the decimal portion, meaning any fractional component is discarded. This indicates that all significant digits should be preserved as much as possible before performing the division, thereby minimizing the impact of rounding errors.

Impact

precision loss

Tools Used

Manual

Recommendations

pointsPerToken =
pointsPerToken.add((weeksPending * pointsPerEpoch * PRECISION_18).div(totalStaked));
Updates

Lead Judging Commences

inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Division before multiplication

Support

FAQs

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