When bridging from L2 to L1, if the associated collection on L1 is not present, it will be deployed and then the NFT will be minted. There are two issue regarding handling uris:
First: When deploying the NFT collection, the base uri is not set even if non-empty base uri is forwarded from L2.
Second: When minting the NFT, the token uri is not set even if non-empty token uris are forwarded from L2.
Thus, forwarded uris (base uri or token uris) from L2 are not playing any role when deploying/minting the NFT on L1.
When bridging from L1 to L2, during withdrawal on L2, if the associated collection is not present, it will be deployed. During deployment, the base uri (which is provided from L1) will be set in the constructor.
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/starknet/src/bridge.cairo#L141
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/starknet/src/bridge.cairo#L448
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/starknet/src/token/collection_manager.cairo#L146
If NFT is not escrowed, it will be minted. If token uris are provided, then erc721_bridgeable
will be deployed and the token uris will be set by calling mint_from_bridge_uri
.
The issue is when bridging from L2 to L1:
When L2 to L1 bridging, during withdrawal on L1, if the associated collection is not present, it will be deployed. But during deployment, the base uri (which is provided from L2) is not used. It means that the newly-deployed ERC721Bridgeable
will have empty base uri even if it is provided by L2.
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/ethereum/src/Bridge.sol#L185
Moreover, if NFT is not escrowed, it will be minted. But, even if token uris are provided by L2, they will not be used during minting when invoking the function mintFromBridge
. It means that, the newly-minted NFT will have empty token uri even if it is provided by L2.
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/ethereum/src/Bridge.sol#L208
Not using the uris forwarded from L2.
The newly-minted/deployed NFT on L1 will have empty uris.
The same mechanism implemented on L2, during bridging from L1 to L2, should be used to handle the forwarded uris from the source chain.
URI is not lost on the origin chain and it can be modified with `ERC721UriImpl`. As explained in the TODO below, that’s a design choice and it will be implemented as a future feature. https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/ethereum/src/Bridge.sol#L206 `ERC721Bridgable` is out of scope.
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.