<!-- canonical: https://0xsimao.com/findings/nftperp-i-notional-crops-unexpected-profits -->

# _getPositionNotional() crops the size of the position to the available reserves, which may lead to unexpected profits/losses

Medium · Three Sigma · NFT perpetuals · 2nd January, 2024

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

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

---

### Description

[_getPositionNotional()](https://github.com/nftperp/NFTPerp-V2-Contracts/blob/1c16f2010a851ac23aec73822d55388901bbe5e7/src/ClearingHouseBase.sol#L425) fills positions to the amm if it can't find limit orders. However, if the
remaining size of the position is bigger than the available base reserves in the AMM, it crops
the size of the position (for short positions), decreasing the current notional. It does not
seem possible to exploit this situation, as some tests were carried out which led to big
losses, but the position could not be closed as there was not enough liquidity, nor could it
be liquidated as liquidations use the liquidation price and the not the current value of the
position.

### Recommendation

Revert if there is not enough liquidity to make sure the value of the position is correctly
calculated.

### Status

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

---

Related findings:

- [PositionManager:_reversePosition() calculates the notional to reverse but could just use the exchangedQuote](https://0xsimao.com/findings/nftperp-ii-reverse-calculates-exchanged-quote): Nftperp Matching Engine
