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

Flaw in Logic

Summary

There is an issue with the logic of CreateMarketOrder causing the function to revert

Vulnerability Details

We can see that it checks if the position increases or decreases:

// determine whether position is being increased or not
ctx.isIncreasing = Position.isIncreasing(params.tradingAccountId, params.marketId, params.sizeDelta);

then it undergoes this check :

// both markets and settlement can be disabled, however when this happens we want to:
// 1) allow open positions not subject to liquidation to decrease their size or close
// 2) prevent new positions from being opened & existing positions being increased
//
// the idea is to prevent a state where traders have open positions but are unable
// to reduce size or close even though they can still be liquidated; such a state
// would severly disadvantage traders
if (ctx.isIncreasing) {
// both checks revert if disabled
globalConfiguration.checkMarketIsEnabled(params.marketId);
settlementConfiguration.checkIsSettlementEnable

the problem here is globalConfiguration.checkMarketIsEnabled(params.marketId);and settlementConfiguration.checkIsSettlementEnabled(); as they would revert if disabled but according to protocol :

  1. allow open positions not subject to liquidation to decrease their size or close

as we can see this will never happen as it will revert before that

Impact

positions not subject to liquidation won't be able to decrease or close their position

Tools Used

Manual Review

Recommendations

don't revert if the market and settlements are disabled

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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