liquidateAccounts should update PerpMarket when one of the accounts is liquidated, but instead it returns the market to its initial state.
When the account is liqudated, perpMarket openInterest and skew must be recalculated. The liquidateAccounts function updates these values, but they are not calculated anywhere, instead updateOpenInterest is called with the default values, which is 0.
In the comment they are mentioning that they don't want to call checkOpenInterestLimits, because they don't want to enforce the limit, but they don't know that this function not only check the limits, but also calculates new openInterest and skew values ( name of this function is misleading )
Liqudating even one account leads to reseting the entire PerpMarket, which results in major system disruptions. Many values are calculated based on these two (skew and OpenInterest), such as: marketPrice, FundingRate, OrderFees, PnL
Manual review
newOpenInterestX18 and newSkewX18 should be recalculated during the liqudation
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.