contracts-bedrock: include `initialize` checks for L2 contracts
To also run the checks for L2 contracts with `initialize`, some changes to the pipelie are required. First off, when foundry compiles a single contract with 2 different versions of solc, it appends the solc version to the name of the file. This broke some of the tooling that we have around reading artifacts from disk. This commit updates the tooling to first check to see if the file exists and if not, then it grabs one of the multiple artifacts instead. This means that we need to be careful about the artifact because it may not exactly match what was used. There isn't a great way around this because its not possible to know the compiler version used within the evm. Also make some modifications that allow for the L2 predeploys to have their contract addresses fetched based on name. The method isn't super nice because it will require the script to be updated if new predeploys are added but its not the end of the world because the tooling likely will not be used with many different predeploys, and if it is in the future we can solve the problem then. In go we handle this problem with an `init` function that registers all of the predeploys into a map that we can iterate over. That just isn't possible in solidity. Add test coverage over the `L2CrossDomainMessenger` to ensure that it cannot be initialized. This is test coverage that unblocks the following PRs: - https://github.com/ethereum-optimism/optimism/pull/8353 - https://github.com/ethereum-optimism/optimism/pull/8365 Both of these are adding new L2 contracts that will be initializable and we want this test coverage ahead of time to prevent reinit bugs from being introduced.
Showing
Please register or sign in to comment