Unfair share distribution during open and closed positions
Deposits made when a vault position is open or closed can result in different share amounts due to variations in price impact and fee calculations. This leads to inconsistent share minting for users depositing the same collateral.
The unfair distribution occurs because deposits during open positions use a different calculation process than those during closed positions. The key steps when the position is open are:
A user calls deposit()
, pays the execution fee, and sets NextActionSelector.INCREASE_ACTION
.
The keeper runs runNextAction()
which executes a GMX swap using metadata.
After the swap, afterOrderExecution()
calculates the share amount using the formula:
This formula adjusts the deposited amount based on fees and price impact, leading to varying share minting.
The inconsistency in share distribution can cause users to receive more or fewer shares than they should for the same collateral amount. This creates an unequal system where some users may withdraw more collateral than their fair share.
Manual Review
Ensure consistent share distribution by standardizing the valuation process for deposits, regardless of the position state. Consider smoothing out transient price impacts during share calculations to eliminate disparities.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.