Commit a8b14a7d authored by Kelvin Fichter's avatar Kelvin Fichter Committed by kf

feat: transfer messenger ownership during deploy

parent 244d4e3a
---
'@eth-optimism/contracts': patch
---
Adds additional deploy step to transfer messenger ownership
...@@ -25,7 +25,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -25,7 +25,7 @@ const deployFn: DeployFunction = async (hre) => {
// a proxy. However, it's best practice to initialize it anyway just in case there's // a proxy. However, it's best practice to initialize it anyway just in case there's
// some unknown security hole. It also prevents another user from appearing like an // some unknown security hole. It also prevents another user from appearing like an
// official address because it managed to call the initialization function. // official address because it managed to call the initialization function.
console.log(`Initializing L1CrossDomainMessenger...`) console.log(`Initializing L1CrossDomainMessenger (implementation)...`)
await contract.initialize(Lib_AddressManager.address) await contract.initialize(Lib_AddressManager.address)
console.log(`Checking that contract was correctly initialized...`) console.log(`Checking that contract was correctly initialized...`)
...@@ -39,6 +39,23 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -39,6 +39,23 @@ const deployFn: DeployFunction = async (hre) => {
5000, 5000,
100 100
) )
// Same thing as above, we want to transfer ownership of this contract to the owner of the
// AddressManager. Not technically necessary but seems like the right thing to do.
console.log(
`Transferring ownership of L1CrossDomainMessenger (implementation)...`
)
const owner = (hre as any).deployConfig.ovmAddressManagerOwner
await contract.transferOwnership(owner)
console.log(`Checking that contract owner was correctly set...`)
await awaitCondition(
async () => {
return hexStringEquals(await contract.owner(), owner)
},
5000,
100
)
}, },
}) })
} }
......
...@@ -9,8 +9,6 @@ import { names } from '../src/address-names' ...@@ -9,8 +9,6 @@ import { names } from '../src/address-names'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
console.log(`Initializing Proxy__L1CrossDomainMessenger...`)
// There's a risk that we could get front-run during a fresh deployment, which would brick this // There's a risk that we could get front-run during a fresh deployment, which would brick this
// contract and require that the proxy be re-deployed. We will not have this risk once we move // contract and require that the proxy be re-deployed. We will not have this risk once we move
// entirely to chugsplash-style deployments. It's unlikely to happen and relatively easy to // entirely to chugsplash-style deployments. It's unlikely to happen and relatively easy to
...@@ -29,6 +27,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -29,6 +27,7 @@ const deployFn: DeployFunction = async (hre) => {
names.unmanaged.Lib_AddressManager names.unmanaged.Lib_AddressManager
) )
console.log(`Initializing Proxy__OVM_L1CrossDomainMessenger...`)
await Proxy__OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address) await Proxy__OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address)
console.log(`Checking that contract was correctly initialized...`) console.log(`Checking that contract was correctly initialized...`)
...@@ -42,6 +41,22 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -42,6 +41,22 @@ const deployFn: DeployFunction = async (hre) => {
5000, 5000,
100 100
) )
console.log(`Setting Proxy__OVM_L1CrossDomainMessenger owner...`)
const owner = (hre as any).deployConfig.ovmAddressManagerOwner
await Proxy__OVM_L1CrossDomainMessenger.transferOwnership(owner)
console.log(`Checking that the contract owner was correctly set...`)
await awaitCondition(
async () => {
return hexStringEquals(
await Proxy__OVM_L1CrossDomainMessenger.owner(),
owner
)
},
5000,
100
)
} }
deployFn.tags = ['finalize'] deployFn.tags = ['finalize']
......
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