The configureSystemParameters function in the GlobalConfigurationBranch contract does not validate the marketOrderMinLifetime parameter. This oversight can lead to a scenario where newly created orders can be cancel directly without any delay.
The configureSystemParameters function sets various system parameters and does validation for all params except marketOrderMinLifetime. If marketOrderMinLifetime is not initialzed or set to zero, it will cause the MarketOrder:checkPendingOrder function to always return true if order is not pending, leading to orders being canceled with any delay. Which is not what is expected, according to comments in the OrderBranch:cancelMarketOrder,
reverts if a trader has a pending order and that pending order hasn't existed for the minimum order lifetime; pending orders can't be cancelled until they have existed for the minimum order lifetime
See the following code:
The OrderBranch:cancelMarketOrder function relies on MarketOrder:checkPendingOrder to ensure that a market order can only be canceled after it has existed for at least marketOrderMinLifetime seconds.
The MarketOrder.checkPendingOrder function checks if the current timestamp minus the order's timestamp is less than marketOrderMinLifetime. So it will always allow the cancellation of market orders, regardless of how recently they were created. This could have significant impacts on the trading system's behavior and security.
Market orders can be canceled immediately after they are created, without any enforced waiting period. Traders might use this to rapidly place and cancel orders, potentially manipulating the market or testing trading strategies without committing to any trade for a meaningful period. Traders could exploit the ability to place and immediately cancel orders to gather information about market movements or to influence the market without significant risk. Traders could place large orders to temporarily affect prices and then cancel them immediately, causing price fluctuations that might benefit their other positions.
Manual Review
Ensure that marketOrderMinLifetime is set to a reasonable minimum value. For example, setting a minimum threshold can prevent immediate cancellations and reduce the risk of manipulation and instability.
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.