DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: high
Valid

skew and openInterest for a market will be completely incorrect after liquidation

Description

In the liquidateAccounts function, the skew and openInterest instead of getting recalculated and updated are being set to zero [reference]

// ctx.newOpenInterestX18 and ctx.newSkewX18 are never initialized with any value
perpMarket.updateOpenInterest(ctx.newOpenInterestX18, ctx.newSkewX18);

Also the assumption open interest and skew are both decreased by liquidations [ref] is incorrect as the skew can increase by liquidation!

Recommendation

Calculate the new openInterest and skew values, and update it.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`liquidateAccounts` calls `updateOpenInterest` with uninitialized OI and skew)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.