Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tender-rings-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Set L2MessageRelayer name to L1MultiMessageRelayer when deploying to mainnet
15 changes: 15 additions & 0 deletions packages/contracts/deploy/014-OVM_L1MultiMessageRelayer.deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import {
deployAndRegister,
getDeployedContract,
registerAddress,
} from '../src/hardhat-deploy-ethers'

const deployFn: DeployFunction = async (hre) => {
Expand All @@ -18,6 +19,20 @@ const deployFn: DeployFunction = async (hre) => {
name: 'OVM_L1MultiMessageRelayer',
args: [Lib_AddressManager.address],
})

// OVM_L2MessageRelayer *must* be set to multi message relayer address on mainnet.
if (hre.network.name.includes('mainnet')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @smartcontracts how best to only enable this for mainnet & we settled on this approach. Feedback welcome

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but I'll pose the obvious devil's advocate: Are there situations where mainnet would be only a substring of hre.network.name, and we would still want to trigger this condition?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me as it will target one of many possible mainnet deployments at the same time

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, thinking about it more, it is probably the case that we want to trigger this logic as much as we possibly can, because the downside of not triggering it when we do want to is much greated than the downside of triggering it when we do not.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, didn't see @tynes ' comment when I followed up, but sounds good 👍

const OVM_L1MultiMessageRelayer = await getDeployedContract(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this method throw if the given string is not set in the address manager? We should make sure we explicitly avoid a situation where we end up calling setAddress, but the input is still 0x00..., so if it does not, we should add the check here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't pull from the address manager -- it pulls from the local list of known/deployed contracts managed by hardhat-deploy. Will throw if the given contract name does not exist.

hre,
'OVM_L1MultiMessageRelayer'
)

await registerAddress({
hre,
name: 'OVM_L2MessageRelayer',
address: OVM_L1MultiMessageRelayer.address
})
}
}

deployFn.dependencies = ['Lib_AddressManager']
Expand Down