The createMarketOrder
function only checks if the market and settlement are enabled when increasing a position. However, it does not explicitly check whether closing or reducing a position should be restricted when the market or settlement is disabled. This could allow traders to close or reduce positions in a market that should be completely disabled.
Disable a market using the relevant configuration (perpsEngineConfiguration.chechMarketIsEnabled(params.marketId);
).
Try to close a position by placing a market order with a sizeDelta
that reduces the existing position.
The function will allow the trade bypassing the disabled market restriction because it only checks when ctx.isNotionalValueIncreasing
is true
The position is closed despite the market being disabled, which violates the intended behavior of disabling the market entirely.
If a market is disabled users should not be able to trade at all, including closing or reducing their positions.
Allowing position reductions when a market is disabled could lead to inconsistent system states, unfair advantages for certain traders, and potential arbitrage opportunities.
If settlement is disabled, closing positions might leave the contract in an unsettled state, leading to funds mismanagement or incorrect balances.
Manual Review
Modify the logic to explicitly check whether closing a position should also be prevented when the market or settlement is disabed.
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.