The MarketOrderKeeper contract lacks an error handler for situations when the upkeep cannot fetch the report.
When a user places an order, the OrderBranch::createMarketOrder(...) function is called, emitting a LogCreateMarketOrder event:
The protocol sets up a Chainlink automation upkeep for this event to ensure order fulfillment by a keeper. When this event is emitted, a Chainlink Keeper runs the MarketOrderKeeper::checkLog(...) function, which includes a StreamsLookup revert custom error. The StreamsLookup revert enables upkeep to fetch a report from Data Streams which includes the token price info. If reports are fetched successfully, the MarketOrderKeeper::checkCallback(...). function is evaluated offchain.
However, if the reports cannot be fetched, the upkeep will look for a checkErrorHandler(...) function to determine the next steps. Currently this function is missing from the MarketOrderKeeper.
Without checkErrorHandler(...), the upkeep will not be executed (read here), leaving the keeper unable to proceed if there is an error in fetching the price report. Since order fulfillment depends on the price report, an unfetched report results in unfulfilled market orders, leaving them idle.
Users will have to close the previous order and create a new one, which will incur more gas.
Various issues can cause a report to be unfetched, such as no valid report received for 10 seconds or incorrect feed ID. (Read more here).
The order will not be fulfilled, as the only way to fulfill an order is by calling SettlementBranch::fillMarketOrder(...), which is only callable by the market order keeper.
Manual Review
To handle errors in fetching the price report gracefully, consider the following:
Implement a checkErrorHandler(...) function in the MarketOrderKeeper contract. Create a separate state for pending market orders so that if checkErrorHandler(...) is triggered, the order is stored in this pending state. Users can retry the order from the last state by emitting the same event again.
Implement a checkErrorHandler(...) function in the MarketOrderKeeper contract. In case of an error, automatically cancel the market order for the user and notify them via the frontend that the order couldn't be fulfilled.
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.