During liquidation, due to a failure to calculate newOpenInterest and newSkew, markets are updated with zero open interest and skew.
During liquidation, open interest is updated as shown:
However, ctx.newOpenInterestX18
and ctx.newSkewX18
are never calculated. Therefore, the market's open interest and skew is updated with the default value of 0
.
See POC here: https://gist.github.com/giraffe0x/a3ad0ab48b0824b9006667ce355ffa2b
Critical. After one liquidation, all existing positions of other traders are wiped out preventing further liquidations and all market operations.
https://github.com/Cyfrin/2024-07-zaros/blob/main/src/perpetuals/branches/LiquidationBranch.sol#L209
Manual Review
Call perpMarket.checkOpenInterestLimits
to calculate new open interest and skew, before updating the market.
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.