liquidate() function has a msg.sender's healthy position check at the end of the execution. However, it shouldn't be there as the msg.sender's position has no relation to the liquidated one. Hence, the liquidation can revert when shouldn't. Also, the person that has such an issue can borrow such amount of assets to make the position liquidatable, transfer them to another wallet and call the liquidate() there and it won't revert.
Impact
The liquidation transaction can revert when not expected.
Redundant healthy position check
Severity
Medium Risk
Summary
liquidate() function can revert when shouldn't.
Vulnerability Details
liquidate() function has a msg.sender's healthy position check at the end of the execution. However, it shouldn't be there as the msg.sender's position has no relation to the liquidated one. Hence, the liquidation can revert when shouldn't. Also, the person that has such an issue can borrow such amount of assets to make the position liquidatable, transfer them to another wallet and call the liquidate() there and it won't revert.
Impact
The liquidation transaction can revert when not expected.
Tools Used
Manually
Recommendations
Remove this check.