The calculateHealthFactor
function claims to return values in RAY
(1e27) but instead operates in WAD
(1e18) due to incorrect scaling. This results in health factors being 1e9 times smaller than intended,
In LendingPool::calculateHealthFactor
we see the dev comment says that the function should return the health factor in RAY, which is 1e27.
But it returns the value scaled with 1e18 (WAD).
This is wrong. If we check how the user debt is calculated via getUserDebt, we see that it is also calculated with 1e27 (RAY)
So, the values are taken with 1e27 but scaled with 1e18, which is wrong and result in faulty calculations.
Liquidations wouldn't trigger when needed, risking protocol insolvency.
Change scaling factor to RAY
:
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.