When We Bridge NFTs from Ethereum to Starknet, we are deploying a new NFT collection if needed.
When making the deploying process, we are using Salt
(similar to Create2 in solidity). But the problem is that we are not checking if there is hash collision or not.
collection_manager.cairo#L153-L157
As we can see we are returning the address after deploying, but if there is a Hash Collision the function will not revert it will just return address(0)
as in Solidity/EVM.
Completing the process of Bridging tokens even if deploying NFT collection on Layer 2 fails.
Manual review
Check for the returned address, and revert if it was an address(0)
.
NOTE: reverting is not the best choice here, as this will result in Losing Bridged NFTs, but also hash collision will result in failure of the deployment process, which will make the address not the NFT collection we need, and will result in incorrect L1<->L2 collection mappings. So implementing this check with a method to recover NFTs on L2 is a good choice.
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.