During fuzz testing of the StarklaneEscrow contract, a significant bug was identified. The contract failed to handle ERC1155 token transfers correctly, reverting with the message "ERC1155: transfer to non-ERC1155Receiver implementer." This indicates that the StarklaneEscrow contract does not implement the necessary IERC1155Receiver interface, causing all ERC1155 token transfers to fail.
The StarklaneEscrow
contract does not implement the IERC1155Receiver
interface, which is required to handle incoming ERC1155 token transfers. Without this implementation, the contract reverts any attempt to transfer ERC1155 tokens to it.
The root cause of the issue is the missing implementation of the IERC1155Receiver
interface in the StarklaneEscrow
contract. This interface defines the necessary functions (onERC1155Received
and onERC1155BatchReceived
) that a contract must implement to accept ERC1155 tokens.
Here is the Proof of Concept (POC) from the fuzz test that identified the bug:
The impact of this bug is high as it prevents all ERC1155 token transfers to the StarklaneEscrow
contract from succeeding. This means the escrow functionality for ERC1155 tokens is completely non-functional until the issue is resolved. Users attempting to deposit ERC1155 tokens into the escrow will encounter failed transactions, leading to a poor user experience and potential functionality gaps in the protocol.
High Severity
Given the complete failure to handle incoming ERC1155 token transfers, and the core functionality of an escrow system being affected, this issue is classified as high severity. It blocks a major feature and can severely impair the operations relying on ERC1155 tokens.
Foundry
Implement IERC1155Receiver
Interface:
The StarklaneEscrow
contract should be updated to implement the IERC1155Receiver
interface. This includes adding the necessary functions (onERC1155Received
and onERC1155BatchReceived
) to handle incoming ERC1155 token transfers.
```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(); } … } ```
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.