The protocol permits users to maintain up to 254 concurrent short records. When this limit is reached, any additional orders are appended to the final position, rather than creating a new one.
A short record is flagged if it falls below the primary liquidation ratio set by the protocol, signalling to the user that their position is nearing an unhealthy state. The user can resolve this by modifying the position to improve its health or by paying off the short and exiting the position.
A vulnerability exists where, under specific circumstances, a user’s healthy position is flagged and can be instantly liquidated without warning.
Consider the following scenario
User A creates a short order, that gets matched and fills in the last short (ID 254).
User A’s position falls below the primary liquidation ratio and is flagged.
User A calls exitShortErcEscrowed
to pay off the position.
The full amount was paid off but maybeResetFlag is not called.
Another short order gets filled at a healthy ratio, creating the same short record (ID 254).
A healthy short is incorrectly flagged.
If the new short falls below the primary liquidation ratio:
It cannot be flagged by another user until updatedAt (when short was filled) plus the reset time is reached.
It can be liquidated after updatedAt (when short was filled) plus the firstLiquidationTime till resetLiquidationTime even if it was never flagged.
Keep in mind the shorts updatedAt will be updated when the short gets filled so this will push the liquidation times up by the time diff (fillShort - flagged).
The protocol gives users a grace period to reestablish their positions when they fall below the primary liquidation ratio, however in the following situation a user can be liquidated without warning (being flagged).
A user is also unable to use certain protocol functionality (e.g. transfer his short).
Manual Analysis
Foundry
The flag needs to be checked in all three exit functions: exitShortWallet
, exitShortErcEscrowed
, and exitShort
, when a short record is fully paid.
Ensure the flag is reset when a user fully pays off their short, so if it was the last short a user will not start of with a healthy position flagged when a new short gets matched at that spot.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.