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

Interest check in `checkOpenInterestLimits()` should be removed

Summary

There is a check that PerpMarket::checkOpenInterestLimits() that checks if the newOpenInterest is bigger than the maxOpenInterest and if yes it should revert. The problem is that this will cause unexpected behaviours and bad experience for the users. There will be cases where traders will not be able to open position because the interest is over the maximum and they will need to wait for someone's else position to be liquidated or decreased.

Vulnerability Details

This is the check in the checkOpenInterestLimits() function

if (newOpenInterest.gt(maxOpenInterest)) {
// is the proposed trade reducing open interest?
bool isReducingOpenInterest = currentOpenInterest.gt(newOpenInterest);
// revert if the proposed trade isn't reducing open interest
if (!isReducingOpenInterest) {
revert Errors.ExceedsOpenInterestLimit(
self.id, maxOpenInterest.intoUint256(), newOpenInterest.intoUint256()
);
}
}

The problem is that in the current implementation of the contract in order for a user to be liquidated he needs to lose all of his collateral in the account not his margin of the position which means that liquidations will happen much more rare. So when the open interest is almost at the max the other traders will just need to wait for someone to reduce or close their position so they will be DoSed for indefinite time so they will not be able to enter the market when they want to which means that they will not be able to follow their strategy.

Impact

High because there will be cases where trader's will be DoSed for indefinite time which will prevent them from following their trading strategy

Tools Used

Manual review

Recommendations

Remove the open interest check

Updates

Lead Judging Commences

inallhonesty Lead Judge
11 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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