The getPositionInfo, getNegativeFundingFeeAmount, and getPnl functions incorrectly use sizeInTokens to store the result of getPositionSizeInUsd() (USD value), while using it to check for token existence.
Code Snippet:
Critical: Positions with valid token balances () but $0 USD value (e.g., token price crashes) will be:
Treated as non-existent (incorrect liquidation)
Excluded from protocol TVL calculations
Unavailable for user interactions (withdrawals/transfers)
Test Case: test_zero_usd_position_returns_valid_token_size
Expected Failure:
Code Fix:
Validation:
| Item | Status |
|---|---|
| Root cause analysis | ✅ |
| Impact scenarios | ✅ |
| Reproducible test | ✅ |
| Fix guidance | ✅ |
| Affected functions | ❌ (Add tests for getNegativeFundingFeeAmount/getPnl) |
Missing:
Tests for other affected functions (getNegativeFundingFeeAmount, getPnl)
Fuzz testing to validate across random sizes
Only check if there are no tokens. Checking if USD is 0 is equivalent. There is no problem here, even if the variable has an incorrect name: Informational.
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.