PerpetualVault.Sol
Issue:
The view function getUserDeposits uses a loop variable of type uint8 when iterating over a dynamic set of deposit IDs.
Details:
Here, if a user’s deposit count exceeds 255, the uint8 counter will not be able to index all elements properly (or may wrap around), leading to an incomplete—or even incorrect—return value.
Impact:
A malicious user could intentionally create many (more than 255) deposit records. When they (or an external service) try to retrieve the full list via getUserDeposits, the function would either revert or return an incomplete list. While this is a view function (and does not directly affect fund security), it creates a correctness and usability issue that could be exploited in downstream logic or user interfaces.
Recommendation:
Change the loop variable’s type from uint8 to uint256 so that it can handle an arbitrary number of deposits without risk of overflow or index errors.
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.