Inefficient comparison of two parameters in:
/main/contracts/VaultReader.sol#L134
If the "positionInfo.basePnlUsd" parameter is 0, we choose the "else" branch for the calculation, which contains unnecessary type conversions.
Gas saving for some invariants. The function "vaultReader.willPositionCollateralBeInsufficient" has the view modifier, but this function used by the internal function "_createDecreasePosition" in the "PerpetualVault" contract.
Manual
Replace check from "positionInfo.basePnlUsd > 0" to "positionInfo.basePnlUsd >= 0"
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.