# 01/10/2024 - BE - Custody internal state for \`Assets\` reports too much locked collateral

### What

When a user increase a long or short position, the whole size of the position is re-added to the `Asset` struct, we keep another value `LockedAmount` in the `Custody` that is increased properly.\ <br>

<figure><img src="https://2570697779-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSrdLcmUOicAVBsHQeHAa%2Fuploads%2F0S5B4tPlm59oDFcDrU7J%2FScreenshot%202024-10-01%20at%2011.01.24%E2%80%AFAM.png?alt=media&#x26;token=74847be2-d87e-4dda-83de-5c40e3726faa" alt=""><figcaption></figcaption></figure>

### Impact

Every-time someone increase an existing positon, the `Assets.locked` of the `Custody` drifts up compared to `positionAccounting.lockedAmount`.&#x20;

In term of impact, this affected the borrow rate calculation: users may have paid a higher borrow rate on positions.

Overall this very marginally increased the AUM due to taking more fees (<br>

### Resolution

* Add integration tests that triggers the issue
* Fix the calculation in the code: add only the increased size and not the whole amount in the code.
* Add an one time patch IX to the program that doctors the existing values of Assets.Locked, aligning them with the correct LockedAmount kept in the stats
* Add related integration tests that check the patch IX

### Details

**issue found:** Gaius & Jaki (initial report), Corto and Orex investigation afterward\
**issue fix:** Orex and Corto\
**patch in**: Release/6 - Adrena Program v1.0.5 on 01/30/2024\
**proposal url:** [**https://dao.adrena.xyz/dao/AdrenaDAO/proposal/J6bGmeSpTU5A7XMuTDeZ4RCznoAyC5JGYYitybEuVvgU**](https://dao.adrena.xyz/dao/AdrenaDAO/proposal/J6bGmeSpTU5A7XMuTDeZ4RCznoAyC5JGYYitybEuVvgU)
