position modification is not accounted for when both oldPositionSize
and newPositionSize
are non-zero but different
Let's say we have a trader with the following activity:
Initial state: No position (oldPositionSize = 0)
Opens a position: Long 10 ETH (newPositionSize = 10)
Later, modifies position: Reduces to Long 5 ETH (oldPositionSize = 10, newPositionSize = 5)
Current function behavior:
Step 1 to 2: The function correctly adds the market to active markets.
Step 2 to 3: The function does nothing, because neither condition is met:
oldPositionSize
is not zero (10 ≠ 0)
newPositionSize
is not zero (5 ≠ 0)
The system relies on this function to track changes in position sizes, it will fail to capture these modifications. This could lead to inaccurate reporting or miscalculations in other parts of the system like liquidationbranch and settlementbranch functions
Manual Review
Add the condition for this position change.
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.