division before multiplication lead to precision loss
Solidity uses fixed-point arithmetic so Division Before Multiplication can result in precision loss errors due to rounding down.
in the functions that calculate the healthFactor
and the function that calculate the collateralValueInUsd
is :
so the general (total) calculation of the actual healthFactor after expanding the function calls & variables in an equation to expose hidden division before multiplication is :
which contain division before multiplications twice , then this will cause a precision loss that will affect the process of liquidation which will result in loss of funds of the user
the precision loss will result in inaccurate health factor which will cause the liquidation of the users and loss their collateral , and this may result in users that exceed the liquidationThreshold
without liquidation .
manual review
perform the multiplication before the division to avoid the precision loss .
the recommended equation of the health factor :
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.