matches Array — getMatches() DoS at ScaleLikeRegistry.sol
Each mutual like pushes to matches[user] without bound. getMatches() returns the entire array. At scale, this exceeds the block gas limit.
Likelihood: Low — Requires many matches per user.
Impact: Low — View function DoS. Users can still interact but cannot enumerate matches.
Severity: Low
SWC: SWC-128 (DoS With Block Gas Limit)
CWE: CWE-400 (Uncontrolled Resource Consumption)
Evidence Grade: A
Alice creates a profile and reciprocally matches with 10 different users. Each mutual like appends to both matches[alice] and matches[user]. After 10 matches, getMatches() returns a 10-element array. In production, a popular user could accumulate thousands of matches, and calling getMatches() would consume gas proportional to the array length, eventually exceeding the block gas limit and making the function uncallable.
forge test --match-test test_FINDING009_unbounded_matches_array -vvvv → PASS
Replace the unbounded return with a paginated getter. This caps gas consumption per call to a fixed maximum regardless of total match count, preventing the view function from exceeding block gas limits. Callers iterate pages off-chain.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.