<!-- canonical: https://0xsimao.com/findings/ostium-revert-watch-list-oog -->

# .values() may revert when calling getWatchList() due to OOG

Low/Info · Three Sigma · RWA perpetuals DEX · 19th February, 2024

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

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

---

### Description

If the number of registries in the [s_registries](https://github.com/0xOstium/smart-contracts-threeSigma/blob/dev/src/OstiumLinkUpKeep.sol#L207) set grows too large, it will revert when calling
[getWatchList()](https://github.com/0xOstium/smart-contracts-threeSigma/blob/dev/src/OstiumLinkUpKeep.sol#L206) due to OOG.

### Recommendation

Add a paginated function to get the watch list.

### Status

Acknowledged

---

Related findings:

- [`SortedLinkedList::getAllValues()` could add a paginated function to prevent DoS](https://0xsimao.com/findings/maple-finance-iii-sorted-linked-list-paginated): Maple Withdrawal Queue
- [MerkleTreeOperator::getMerklePath() will revert due to OOG after enough elements](https://0xsimao.com/findings/singularity-merkle-path-revert-elements): Singularity
