Incorrect updates to the market's open interest and skew in function liquidateAccounts. To fix this, the function should calculate the new open interest and skew based on the liquidation size.
The function is using ctx.newOpenInterestX18
and ctx.newSkewX18
to update the open interest and skew of the perpetual market. However, these variables are never defined or calculated in the function.
This error will lead to:
Incorrect updates to the market's open interest and skew.
Potential use of uninitialized variables, which in Solidity default to zero values.
Manual Review
// Calculate new open interest and skew
ctx.newOpenInterestX18 = perpMarket.openInterestX18.sub(ctx.oldPositionSizeX18.abs());
ctx.newSkewX18 = perpMarket.skewX18.sub(ctx.oldPositionSizeX18);
// Update perp market's open interest and skew
perpMarket.updateOpenInterest(ctx.newOpenInterestX18, ctx.newSkewX18);
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.