sherlock-audit / 2023-11-convergence-judging

8 stars 8 forks source link

bulej93 - multiplication after division could lead to precision loss #173

Closed sherlock-admin closed 10 months ago

sherlock-admin commented 10 months ago

bulej93

medium

multiplication after division could lead to precision loss

Summary

it is not advised to divide before you multiply, this could lead to some kind of precision loss

Vulnerability Detail

every time we do some division before multiplication we lose some precision, this can happen if the numeration is smaller than denominator

Impact

loss of precision

Code Snippet

https://github.com/sherlock-audit/2023-11-convergence/blob/main/sherlock-cvg/contracts/Locking/LockingPositionService.sol#L590-L592

https://github.com/sherlock-audit/2023-11-convergence/blob/main/sherlock-cvg/contracts/Locking/LockingPositionService.sol#L672-L676

Tool used

Manual Review

Recommendation

nevillehuang commented 10 months ago

Precision loss with no example required by sherlock rules

  1. In case of issues related to precision loss, there must be a valid POC/example showing the loss to justify the medium/high severity.