Commit 50e20ea1 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contract-bedrock: fix initialization logic (#2905)

The `CrossDomainMessenger._initialize` cannot be `initializer`
because the parent `L1CrossDomainMessenger` was also handling
setting the initialized state.

Also update the deployment scripts so that they work with
the latest contract changes.
Co-authored-by: default avatarMatthew Slipper <me@matthewslipper.com>
parent e14351f7
---
'@eth-optimism/contracts-bedrock': patch
---
Fix initialization logic
......@@ -20,7 +20,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger {
*
* @param _l1CrossDomainMessenger Address of the L1CrossDomainMessenger contract.
*/
function initialize(address _l1CrossDomainMessenger) external {
function initialize(address _l1CrossDomainMessenger) external initializer {
address[] memory blockedSystemAddresses = new address[](2);
blockedSystemAddresses[0] = address(this);
blockedSystemAddresses[1] = Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER;
......
......@@ -260,11 +260,11 @@ abstract contract CrossDomainMessenger is
) internal virtual;
/**
* Initializes the contract.
* @notice Initializes the contract. The parent contract MUST handle
* preventing this from being called twice.
*/
function _initialize(address _otherMessenger, address[] memory _blockedSystemAddresses)
internal
initializer
{
xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;
otherMessenger = _otherMessenger;
......
......@@ -17,9 +17,11 @@ const deployFn: DeployFunction = async (hre) => {
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
const portal = await hre.deployments.get('OptimismPortalProxy')
await deploy('L1CrossDomainMessenger', {
from: deployer,
args: [],
args: [portal.address],
log: true,
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
......@@ -27,7 +29,6 @@ const deployFn: DeployFunction = async (hre) => {
const proxy = await hre.deployments.get('L1CrossDomainMessengerProxy')
const Proxy = await hre.ethers.getContractAt('Proxy', proxy.address)
const messenger = await hre.deployments.get('L1CrossDomainMessenger')
const portal = await hre.deployments.get('OptimismPortal')
const L1CrossDomainMessenger = await hre.ethers.getContractAt(
'L1CrossDomainMessenger',
......
......@@ -17,9 +17,11 @@ const deployFn: DeployFunction = async (hre) => {
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
const messenger = await hre.deployments.get('L1CrossDomainMessengerProxy')
await deploy('L1StandardBridge', {
from: deployer,
args: [],
args: [messenger.address],
log: true,
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
......@@ -27,7 +29,6 @@ const deployFn: DeployFunction = async (hre) => {
const proxy = await hre.deployments.get('L1StandardBridgeProxy')
const Proxy = await hre.ethers.getContractAt('Proxy', proxy.address)
const bridge = await hre.deployments.get('L1StandardBridge')
const messenger = await hre.deployments.get('L1CrossDomainMessengerProxy')
const L1StandardBridge = await hre.ethers.getContractAt(
'L1StandardBridge',
......
......@@ -2846,15 +2846,14 @@
dependencies:
squirrelly "^8.0.8"
"@rari-capital/solmate@^6.3.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/@rari-capital/solmate/-/solmate-6.3.0.tgz#01050e276e71dc4cd4169cf8002b447eb07d90c3"
integrity sha512-SWPbnfZUCe4ahHNqcb0qsPrzzAzMZMoA3x6SxZn04g0dLm0xupVeHonM3LK13uhPGIULF8HzXg8CgXE/fEnMlQ==
"@rari-capital/solmate@https://github.com/rari-capital/solmate.git#8f9b23f8838670afda0fd8983f2c41e8037ae6bc":
version "7.0.0-alpha.3"
resolved "https://github.com/rari-capital/solmate.git#8f9b23f8838670afda0fd8983f2c41e8037ae6bc"
"@rari-capital/solmate@https://github.com/rari-capital/solmate.git#eaaccf88ac5290299884437e1aee098a96583d54":
version "6.4.0"
resolved "https://github.com/rari-capital/solmate.git#eaaccf88ac5290299884437e1aee098a96583d54"
"@resolver-engine/core@^0.3.3":
version "0.3.3"
resolved "https://registry.yarnpkg.com/@resolver-engine/core/-/core-0.3.3.tgz#590f77d85d45bc7ecc4e06c654f41345db6ca967"
......
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