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

Remove useless `_revertIfHealthFactorIsBroken` check to save gas

Summary

The _revertIfHealthFactorIsBroken() check in the liquidate() function is useless and can be removed to save gas.

Vulnerability Details

The _revertIfHealthFactorIsBroken() check is useless because the if above is insuring that HealthFactor has improved or it reverts.

uint256 endingUserHealthFactor = _healthFactor(user);
if (endingUserHealthFactor <= startingUserHealthFactor) {
revert DSCEngine__HealthFactorNotImproved();
}

Impact

Useless gas consumption.

Tools Used

Manual review.

Recommendations

Remove the _revertIfHealthFactorIsBroken()check in the liquidate() function

Support

FAQs

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