<!-- canonical: https://0xsimao.com/findings/nftperp-i-fill-taker-maker-deleted -->

# In fillPair(), when the taker is the maker, the reduceOnly order mapping is not being deleted

Low/Info · Three Sigma · NFT perpetuals · 2nd January, 2024

Finding 3S-NFTPerp-L01 of the Nftperp Exchange security review.

- Report: /reports/nftperp-i
- Source: https://cdn.sanity.io/files/qoqld077/production/c19530de75e234ad15694b4563edb1fc9d2a3fd8.pdf

---

### Description

When filling limit orders, if the trader doing the openPosition() call is the same as the
maker of the limit order, it will [delete](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/1c16f2010a851ac23aec73822d55388901bbe5e7/src/clearinghouse-libs/PositionManager.sol#L524) the limit order.

### Recommendation

If the limit order is a reduceOnly order, it should also delete the [reduceOnlyOrders](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/1c16f2010a851ac23aec73822d55388901bbe5e7/src/ClearingHouseBase.sol#L91) mapping.

### Status

Addressed in [#0dd59c3](https://github.com/nftperp/NFTPerp-V2-Contracts/commit/0dd59c32f997c0d3589c2cfc0115cdac4acd8cd9)

---

Related findings:

- [In AmmRouter:liquidateMaker(), the pools array can safely be deleted from storage](https://0xsimao.com/findings/nftperp-ii-liquidate-array-safely-storage): Nftperp Matching Engine
- [No need to set isActive to false if that mapping entry was deleted](https://0xsimao.com/findings/m-0-active-mapping-entry-deleted): M^0 Minter Gateway
