Beatland Festival

First Flight #44
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Gas Limit / Denial-of-Service via Contract Bloat

Description

  • Normal Behavior:
    The getUserMemorabiliaDetailed(address user) function is a public view function that returns full arrays of all memorabilia token details owned by a user, including:

    • tokenIds

    • collectionIds

    • itemIds

    It likely iterates over the user's ERC1155 balance or internal mappings to compile this information.


  • Specific Issue:
    This type of function does not scale as the number of tokens a user holds increases. Ethereum has a block gas limit, and returning large dynamic arrays can cause out-of-gas errors on-chain or make frontend integrations unreliable.

function getUserMemorabiliaDetailed(address user) external view returns (
@> uint256[] memory tokenIds,
@> uint256[] memory collectionIds,
@> uint256[] memory itemIds
);

Risk

Likelihood:

  • As user adoption grows, collectors may own hundreds or thousands of memorabilia NFTs.

  • Once user balances become large, this function may revert due to gas exhaustion, especially if called from another contract or in batch queries.

Impact:

  • Denial-of-Service: Frontends depending on this function will break or fail to load memorabilia data.

  • Limits usability for power users and collectors.

  • Breaks indexers or integrators trying to query metadata on-chain

Proof of Concept

1- A ollector redeems 1000+ memorabilia NFTs.
2- Calls getUserMemorabiliaDetailed(address user) through frontend or another contract.
3- The call reverts due to out-of-gas, making the user’s inventory inaccessible via this function.

Recommended Mitigation

- return entire arrays of token IDs and metadata on-chain
+ recommend using off-chain indexing (e.g., The Graph, custom backend)
+ add documentation warning that function may become unreliable at scale
+ alternatively, add pagination or filtering capability
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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