-
Notifications
You must be signed in to change notification settings - Fork 12
IllIllI - Negative prices will cause old orders to be canceled #177
Comments
Escalate for 10 USDC This finding should be invalid, in "Impact" section, author mentions:
If price is negative, cancelling of order should be desired outcome. author mentions:
this is not 1:1 comparison, here sign of interest rate is compared with sign of asset and both are completly different things |
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. |
You've deleted an escalation for this issue. |
Asset prices can in fact go negative due to carying costs, and the sponsor confirmed the issue |
Escalation rejected Although unlikely the possibility of this must be addressed instead of canceling it. |
This issue's escalations have been rejected! Watsons who escalated this issue will have their escalation amount deducted from their next payout. |
IllIllI
medium
Negative prices will cause old orders to be canceled
Summary
In most cases where orders are submitted using invalid oracle prices, the check for
isEmptyPriceError()
returns true, and the order execution is allowed to revert, rather than canceling the order.Vulnerability Detail
Negative Chainlink oracle prices (think negative interest rates in Europe) result in a plain
revert(<string>)
, which isn't counted as one of these errors, and so if the price becomes negative, any outstanding order will be canceled, even if the order was submitted prior to the price going negative.Impact
Orders to close positions will be canceled, leading to losses.
Code Snippet
Chainlink prices are converted to positive numbers:
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/oracle/Oracle.sol#L577-L579
And if they're negative, the code reverts:
Orders that revert get frozen or canceled
Tool used
Manual Review
Recommendation
Create a new error type, and include it in the list of
OracleUtils.isEmptyPriceError()
errorsThe text was updated successfully, but these errors were encountered: