The getPositionInfo function calculates the net value of a position by adding/subtracting different fees and values. However, there is a critical issue when handling the positionInfo.basePnlUsd, which can be negative. Since netValue is of type uint256, subtracting a large negative value from it can cause an underflow, leading to a revert.
positionInfo.basePnlUsd is an int256, meaning it can be negative.
The function attempts to subtract uint256(-positionInfo.basePnlUsd) from netValue when positionInfo.basePnlUsd < 0.
If netValue is smaller than uint256(-positionInfo.basePnlUsd), an underflow occurs, causing the entire transaction to revert.
if uint256(-positionInfo.basePnlUsd) is larger than netValue, the transaction fails.
Manual Review
netvalue should be changed to int256 not uint256, so it can handle negative values.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.