15,000 USDC
View results
Submission Details
Severity: medium
Valid

Redundant health factor check in the DSCEngine.liquidate method

Summary

At the very end of liquidate method, DSCEngine reverts if the msg.sender's health factor is broken.

_revertIfHealthFactorIsBroken(msg.sender);

However, the state modifications inside liquidate method do not affect the health factor of msg.sender at all. The collateral amount is subtracted from user's balance, as is s_DSCMinted. Therefore the only effect this call has is that it prevents the users whose health factor was already broken from liquidating other users. If this is intended, please consider moving that line of code to the top of the method for gas optimization and strict CEI pattern following. If that was not intented, please consider removing the statement from the method.

Vulnerability Details

n/a

Impact

Users with broken health factors can't liquidate other users, unnecessary gas consumption

Tools Used

Manual review

Recommendations

Depending on the intented business logic, consider moving the _revertIfHealthFactorIsBroken call to the top of the method or removing it.

Support

FAQs

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