-
Notifications
You must be signed in to change notification settings - Fork 0
spyrosonic10 - Account can not be liquidated when price fall by 99%. #61
Comments
Since this is an edge case for the given price fall resulting in reverting liquidations, |
You've created a valid escalation for 10 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalate for 10 USDC I do not agree with escalation raised above. This issue is about failure of liquidation when price fall by x%. This finding is an edge case where it does impact all underwater accounts so it is fair to say that it impact whole protocol. Root cause and impact both are different in this issue compare to #89 so this is definitely not a duplicate of #89. |
You've created a valid escalation for 10 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalation accepted Accepting the first escalation. |
This issue's escalations have been accepted! Contestants' payouts and scores will be updated according to the changes made on this issue. |
Fix looks good. Surcharge is now taken on actual amount liquidated rather than undercounted amount |
spyrosonic10
high
Account can not be liquidated when price fall by 99%.
Summary
Liquidation fails when price fall by 99%.
Vulnerability Detail
_calcLiquidation()
method has logic related to liquidations. This method calculate total liquidation discount, collateral to liquidate and liquidation surcharge. All these calculations looks okay in normal scenarios but there is an edge case when liquidation fails if price crashes by 99% or more. In such scenariocollateralToLiquidateWithoutDiscount
will be very large and calculated liquidation surcharge becomes greater thancollateralToLiquidate
Contract revert from below line hence liquidation will fail in this scenario.
Impact
Liquidation fails when price crash by 99% or more. Expected behaviour is that liquidation should be successful in all scenarios.
Code Snippet
Block of code that has bug.
https://github.com/sherlock-audit/2023-03-taurus/blob/main/taurus-contracts/contracts/Vault/BaseVault.sol#L396-L422
Below is POC that prove failed liquidation.
Tool used
Manual Review
Recommendation
Presently liquidation surcharge is calculated on
collateralToLiquidateWithoutDiscount
. Project team may want to reconsider this logic and calculate surcharge oncollateralToLiquidate
instead ofcollateralToLiquidateWithoutDiscount
. This will be business decision but easy fixAnother option is you may want to calculate surcharge on
Math.min(collateralToLiquidate, collateralToLiquidateWithoutDiscount)
.The text was updated successfully, but these errors were encountered: