If for any reason the address of the bridge on L2 is changed (a new contract is deployed), the already deployed collections (i.e. erc721_bridgeable
contracts) would not be able to update the address of the bridge. As a result, all the already deployed collections would keep the address of old bridge as a valid bridge, and unable to use the bridging mechanism by the new bridge.
The reason is that when a erc721_bridgeable
is upgraded, its constructor will not be executed again, only its class is replaced.
Since, the address of the bridge is initialized only during constructor (there is no admin function to update the address of the bridge), there is not any possibility to change the address of the bridge in a erc721_bridgeable
contract.
Please note that such issue is not present for the Bridge
contract. Because the admin can change all the critical state variables of Bridge
which are initialized during constructor.
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/starknet/src/bridge.cairo#L90
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/starknet/src/bridge.cairo#L200-L365
Please note that one possible solution is that Bridge
upgrades the class of every already deployed erc721_bridgeable
contract to include a function (like set_bridge_l2_addr
) to be able to change the address of bridge. Then, the class of Bridge
be upgraded to include a function (like collection_bridge_upgrade
) to be able to call any erc721_bridgeable::set_bridge_l2_addr
.
But, problem with such solution is that upgrading the class of every already deployed erc721_bridgeable
is not straightforward (if there are many deployed ones).
If the address of L2 bridge is changed, all the already deployed collections on L2 would not be possible to interact with this new bridge.
The following function should be added to erc721_bridgeable
contract:
Moreover, the following function should be added to bridge
contract:
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.