The current implementation of the liquidation function incorrectly resets the open interest and skew to zero, which are crucial indicators of the amount of long and short positions in the market. This flaw occurs because the `updateOpenInterest` function is called with default values that have not been properly set, leading to the incorrect updating of these indicators during liquidation.
The issue lies in the implementation of the liquidation function, which incorrectly sets the open interest and skew to zero. This happens because the `updateOpenInterest` function is called with `ctx.newOpenInterestX18` and `ctx.newSkewX18`, which have not been properly initialized and hold their initial values of zero. The developers' comments indicate that open interest and skew should be decreased by liquidations, and there should be checks to prevent Denial of Service (DoS) attacks in case those cap checks fail. However, these checks are not properly implemented.
### Key Points:
1. **Current Behavior**:
- Open interest and skew are reset to zero during liquidation due to uninitialized values.
- The function `updateOpenInterest` is called without ensuring the values are correctly set.
2. **Developers' Intentions**: Comment in code
- Open interest and skew should be decreased during liquidation.
- The system should allow a reduction in open interest regardless of the maximum open interest limit to prevent DoS attacks.
- Proper checks should be in place to ensure open interest and skew are correctly updated.
From the above we can see that the developer didn't call CheckOpenInterestLimit first.
Resetting open interest and skew to zero during liquidation. This could result in a significant misrepresentation of the market’s long and short positions.
- Manual Solidity code analysis
- Developer comments review
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.