Commit fec22bfe authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-bedrock: L2CrossDomainMessenger legibility (#3266)

The `initialize()` function in the L2CrossDomainMessenger
sets some blocked system addresses. It was using `address(this)`
but in reality the contract is a predeploy at a specific address.
It should not be deployed, the `initialize` function will never
run. For the unit tests, the contracts are placed at their correct
addresses. This makes the testing environment as close as possible
to what is experienced on a live network.

This PR hardcodes in the L2 cross domain messenger constant
from the predeploys library instead of using `address(this)`.
In practice this value is set using the chain ops tooling,
so this makes it more clear as to what the value should be.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 2b247595
---
'@eth-optimism/contracts-bedrock': patch
---
Fix legibility in the L2CrossDomainMessengerInitializer
...@@ -32,7 +32,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, Semver { ...@@ -32,7 +32,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, Semver {
*/ */
function initialize(address _l1CrossDomainMessenger) public initializer { function initialize(address _l1CrossDomainMessenger) public initializer {
address[] memory blockedSystemAddresses = new address[](2); address[] memory blockedSystemAddresses = new address[](2);
blockedSystemAddresses[0] = address(this); blockedSystemAddresses[0] = Predeploys.L2_CROSS_DOMAIN_MESSENGER;
blockedSystemAddresses[1] = Predeploys.L2_TO_L1_MESSAGE_PASSER; blockedSystemAddresses[1] = Predeploys.L2_TO_L1_MESSAGE_PASSER;
__CrossDomainMessenger_init(_l1CrossDomainMessenger, blockedSystemAddresses); __CrossDomainMessenger_init(_l1CrossDomainMessenger, blockedSystemAddresses);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment