Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Valid

Missing ERC721Enumerable Features in Huff Implementation of NFT Contract

Summary

The project includes two versions of the NFT contract: one written in Solidity and the other in Huff. The Solidity rendition adheres to the ERC721Enumerable standard, providing additional enumeration functionality over the basic ERC721. However, the Huff rendition of the contract lacks these ERC721Enumerable features.

Vulnerability Details

The Huff implementation of the NFT contract does not fully comply with the ERC721Enumerable standard. This discrepancy arises from:

  1. The supportsInterface method in the Huff rendition fails to acknowledge the ERC721Enumerable interface (type(IERC721Enumerable).interfaceId), leading to a return value of false.

  2. Essential methods of the ERC721Enumerable standard, including tokenOfOwnerByIndex and tokenByIndex(uint256 index), are not implemented in the Huff version.

Impact

This inconsistency between the Solidity and Huff renditions could lead to significant functional limitations and potential incompatibility issues. Users and external contracts interacting with the Huff-based NFT might expect full ERC721Enumerable compliance, which is not met. This could result in failed transactions or incorrect assumptions about the contract's capabilities, potentially affecting user experience and trust.

Tools Used

Manual code review.

Recommendations

To resolve this issue and ensure compatibility and functionality, consider the following steps:

  1. Update the Huff rendition to include the missing ERC721Enumerable methods: tokenOfOwnerByIndex and tokenByIndex(uint256 index).

  2. Modify the supportsInterface method in the Huff version to return true for type(IERC721Enumerable).interfaceId.

  3. Conduct thorough testing of the updated Huff contract to ensure it meets all ERC721Enumerable standards and functions as expected.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Components of ERC721 not properly (or at all) implemented in HUFF

Support

FAQs

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