Uninitialized variables ctx.newOpenInterestX18
and ctx.newSkewX18
are used for setting market open interest value and skew value during liquidation, results in incorrect open interest and skew.
When accounts are liquidated, protocol iterates each account's active markets and do same updates, including updating each market's open interest value and skew value.
Unfortunately, ctx.newOpenInterestX18
and ctx.newSkewX18
are not initialized during liquidation, hence the value are both 0
, leading to each market's open interest value and skew value are set to 0
.
Please copy the following code snippet into testFuzz_GivenThereAreLiquidatableAccountsInTheArray()
in liquidateAccounts.t.sol
to verify:
Open interest and skew are used to determine the mark price for trades and the funding rate for positions.
Incorrect open interest and skew could result in traders being allowed to open positions that exceed the market limits, potentially leading to price manipulation and instability.
Incorrect mark price may also bring huge loss to the traders.
Manual Review
Initialize ctx.newOpenInterestX18
and ctx.newSkewX18
before setting market open interest and skew.
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.