NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Unreachable Code in ERC721 and ERC1155 Handling

Summary

In the depositTokens function, the code that handles ERC1155 collections is unreachable due to a prior check that reverts if the collection type is ERC1155.

Vulnerability Details

if (ctype == CollectionType.ERC1155) {
revert NotSupportedYetError();
}
if (ctype == CollectionType.ERC721) {
(req.name, req.symbol, req.uri, req.tokenURIs) = TokenUtil.erc721Metadata(
collectionL1,
ids
);
} else {
(req.uri) = TokenUtil.erc1155Metadata(collectionL1); // This code will never be reached
}

The else branch that attempts to handle ERC1155 collections will never be executed because the function reverts if the collection type is ERC1155. This dead code should be removed or adjusted to reflect the actual supported functionality.

Impact

This is a minor issue but indicates potential misunderstanding or outdated code, which can lead to confusion or errors in future code changes.

Tools Used

Manual code review.

Recommendations

Remove the unreachable code or refactor it to handle any future extensions where ERC1155 might be supported.

Updates

Lead Judging Commences

n0kto Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

invalid-ERC1155-not-in-scope

```compatibilities: Blockchains: - Ethereum/Starknet Tokens: - [ERC721](www.tokenstandard.com) ``` ``` function depositTokens( uint256 salt, address collectionL1, snaddress ownerL2, uint256[] calldata ids, bool useAutoBurn ) external payable { if (!Cairo.isFelt252(snaddress.unwrap(ownerL2))) { revert CairoWrapError(); } if (!_enabled) { revert BridgeNotEnabledError(); } CollectionType ctype = TokenUtil.detectInterface(collectionL1); if (ctype == CollectionType.ERC1155) { @> revert NotSupportedYetError(); } … } ```

Support

FAQs

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