21/11/2024 - BE - Increase Position, position.price miscalculations

Timeline

Offside labs, who are currently doing our second audit, contacted us at 9:28 am UTC through telegram about the issue.

We acknowledged at 9:29 am and confirmed the issue by 10:30. At 10:51:20 UTC we deployed a hotfix and disabled the Increase on the program as a temporary safety measure.

We worked on a permanent fix, reviewed by Offside Labs, that was deployed at 14:23 UTC.

What

We increasing a position (long or short) the calculation that recalculated the average entry price did not take into account the current PnL and so user were loosing PnL on increase (based on the increase size and price diff between open and increase)

Impact

User loosing PnL, pool profiting. Data : - 18,1% of positions did an increase over the affected period - 29.8% of total trade volume was from positions that has had an increase during their lifespans Roughly 900 positions affected. Some user have up to 61 increase on a single position (Bonk, chasing scarce liquidities). Issue was only causing losses for users (the PnL was reduced). Total of 191 users affected : - 88 users with more than $1 deficit - 45 users with more than $10 deficit - 21 users with more than $100 deficit - 3 users with more than $1000 deficit Total deficit for users $18,881

Resolution

  • Updated the calculation that now take into account the PnL

Now the main resolution will be about what do we do to compensate users. Do we compensate users fully or partially, etc. This will be up for discussion in a proposal.

Details

issue found: Offside Labs issue fix: Orex and Corto patch in: Release/19 - Adrena Program v1.1.5 and 6 proposal url: https://dao.adrena.xyz/dao/AdrenaDAO/proposal/99bni5Vxb9NdR2XtYqigXuWqsXqzTXorx6ae8gG2pnkU

Last updated