DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Loop Index Type in getUserDeposits

PerpetualVault::getUserDeposits()

Observation:
The function PerpetualVault::getUserDeposits() iterating over a user’s deposit IDs uses a loop variable of type uint8:

for (uint8 i = 0; i < length; ) { … }

Risk:
If a user accumulates more than 255 deposits, the loop variable will overflow (or simply stop early), resulting in an incomplete or corrupted list of deposit IDs. Although this is a view function and does not directly affect fund security, it may lead to incorrect data being displayed or used by off-chain systems—potentially opening up avenues for user interface manipulation or misreporting of a user’s positions.

Recommendation:
Use a larger integer type (e.g. uint256) for the loop counter to correctly handle any realistic number of deposits.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!