<!-- canonical: https://0xsimao.com/findings/ostium-callbacks-callback-reverts-find -->

# OstiumTradingCallbacks::executeAutomationOpenOrderCallback() reverts if it can not find the openLimitOrder

Medium · Three Sigma · RWA perpetuals DEX · 19th February, 2024

Finding 3S-OS-L13 of the Ostium security review.

- Protocol: https://www.ostium.com/
- Report: /reports/ostium
- Source: https://cdn.sanity.io/files/qoqld077/production/a95b9c69e0f65d1d6b0e649f0d62a362358ca8ce.pdf

---

### Description

[OstiumTradingCallbacks::executeAutomationOpenOrderCallback()](https://github.com/0xOstium/smart-contracts-threeSigma/blob/audit-feedback/src/OstiumTradingCallbacks.sol#L256) fetches the
openLimitOrder before checking for its [existence](https://github.com/0xOstium/smart-contracts-threeSigma/blob/audit-feedback/src/OstiumTradingStorage.sol#L437), which will end up reverting if it does not
exist, not finishing execution.

### Recommendation

Check the existence of the limit order before fetching it.

### Status

Addressed in [#295430f](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/295430f57b23af631bf4279247d26c1db13b64ed), [#4688377](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/468837751d82f27f91a9192c16afacc596f4c2e4).

---

Related findings:

- [reduceOnly limit order update does not take into account that a new amm may be selected, which may lead to loss of funds](https://0xsimao.com/findings/nftperp-i-reduce-account-amm-selected): Nftperp Exchange
- [DoSed withdrawals due to `ManagedLeveragedVault::executeWithdrawalEpoch()` repaying debt above limit](https://0xsimao.com/findings/beraborrow-i-withdrawals-withdrawal-epoch-debt): Beraborrow Managed Dens
