getUserMemorabiliaDetailed iterates over every collection ever created (outer loop) and every item within each collection (inner loop) to find what a given user owns. Both loop bounds grow indefinitely as more collections are added and more items are redeemed.
Likelihood:
The function becomes uncallable once the cumulative number of collection-item combinations exceeds the block gas limit.
Growth is continuous; every new collection and every redemption permanently increases the cost.
Impact:
Front-ends and integrating contracts that rely on this function will break as the protocol grows.
Users lose the ability to enumerate their memorabilia on-chain; the data becomes inaccessible without off-chain indexing.
The following illustrates that at the festival scale (500 collections × 200 items each), the function's cumulative balanceOf reads exceed the block gas limit, causing it to revert permanently for every caller.
Replace the unbounded double loop with a paginated version that accepts offset and limit parameters so callers retrieve results in bounded batches. For production scale, off-chain indexing via TransferSingle/TransferBatch events is the preferred long-term approach, and on-chain enumeration should be eliminated entirely.
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.