<!-- canonical: https://0xsimao.com/findings/ostium-pairs-storage-reverts-created -->

# OstiumPairsStorage::getAllPairsMaxLeverage() reverts if enough pairs are created

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

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

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

---

### Description

[OstiumPairsStorage::getAllPairsMaxLeverage()](https://github.com/0xOstium/smart-contracts-threeSigma/blob/audit-feedback/src/OstiumPairsStorage.sol#L280) reverts if enough pairs are created due to
OOG.

### Recommendation

Add an additional function OstiumPairsStorage::getAllPairsMaxLeverage(uint256
startId, uint256 finalId) to fetch paginated information.

### Status

Addressed in [#0d2334b](https://github.com/0xOstium/smart-contracts-threeSigma/pull/58/commits/0d2334b3c931e9b5d1ad4832b91877716dfe54d2).

---

Related findings:

- [getTriggerOrders() should be paginated or it may revert if enough orders are created](https://0xsimao.com/findings/nftperp-i-orders-paginated-revert-created): Nftperp Exchange
- [Base calculation in `Leverager::isLiquidateable()` is incorrect as the max leverage may be smaller](https://0xsimao.com/findings/yieldoor-leverager-liquidateable-leverage-smaller): Yieldoor
- [ClampLib::mulDivDownInverse reverts on `target == type(uint256).max` before the overflow guard runs](https://0xsimao.com/findings/tenor-markets-reverts-overflow-guard-runs): Tenor Morpho Migrations
