Commit c73d36f1 authored by ben-chain's avatar ben-chain Committed by Kelvin Fichter

fix(contracts): remove no-op address setting from AddressSetter

parent 98f3aa42
/* Imports: External */ /* Imports: External */
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { import {
...@@ -13,8 +14,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -13,8 +14,7 @@ const deployFn: DeployFunction = async (hre) => {
// ToDo: Clean up the method of mapping names to addresses esp. // ToDo: Clean up the method of mapping names to addresses esp.
// There's probably a more functional way to generate an object or something. // There's probably a more functional way to generate an object or something.
// ToDo: in the case of an upgrade, only add names of contracts that are new deployed. const allContractNames = [
const names = [
'ChainStorageContainer-CTC-batches', 'ChainStorageContainer-CTC-batches',
'ChainStorageContainer-SCC-batches', 'ChainStorageContainer-SCC-batches',
'CanonicalTransactionChain', 'CanonicalTransactionChain',
...@@ -25,28 +25,48 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -25,28 +25,48 @@ const deployFn: DeployFunction = async (hre) => {
'Proxy__OVM_L1StandardBridge', 'Proxy__OVM_L1StandardBridge',
] ]
const addresses = await Promise.all( let namesAndAddresses: {
names.map(async (n) => { name: string
return (await getLiveContract(hre, n)).address address: string
}[] = await Promise.all(
allContractNames.map(async (name) => {
return {
name,
address: (await getLiveContract(hre, name)).address,
}
}) })
) )
// Add non-deployed addresses to the Address Setter argument arrays // Add non-deployed addresses to the Address Setter arguments.
namesAndAddresses = [
...namesAndAddresses,
// L2CrossDomainMessenger is the address of the predeploy on L2. We can refactor off-chain // L2CrossDomainMessenger is the address of the predeploy on L2. We can refactor off-chain
// services such that we can remove the need to set this address, but for now it's easier // services such that we can remove the need to set this address, but for now it's easier
// to simply keep setting the address. // to simply keep setting the address.
names.push('L2CrossDomainMessenger') {
addresses.push(predeploys.L2CrossDomainMessenger) name: 'L2CrossDomainMessenger',
address: predeploys.L2CrossDomainMessenger,
},
// OVM_Sequencer is the address allowed to submit "Sequencer" blocks to the // OVM_Sequencer is the address allowed to submit "Sequencer" blocks to the
// CanonicalTransactionChain. // CanonicalTransactionChain.
names.push('OVM_Sequencer') {
addresses.push((hre as any).deployConfig.ovmSequencerAddress) name: 'OVM_Sequencer',
address: (hre as any).deployConfig.ovmSequencerAddress,
},
// OVM_Proposer is the address allowed to submit state roots (transaction results) to the // OVM_Proposer is the address allowed to submit state roots (transaction results) to the
// StateCommitmentChain. // StateCommitmentChain.
names.push('OVM_Proposer') {
addresses.push((hre as any).deployConfig.ovmProposerAddress) name: 'OVM_Proposer',
address: (hre as any).deployConfig.ovmProposerAddress,
},
]
// Filter out all addresses that will not change, so that the log statement is maximally
// verifiable and readable.
namesAndAddresses = namesAndAddresses.filter(async ({ name, address }) => {
const existingAddress = await Lib_AddressManager.getAddress(name)
return !hexStringEquals(existingAddress, address)
})
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
...@@ -55,8 +75,12 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -55,8 +75,12 @@ const deployFn: DeployFunction = async (hre) => {
args: [ args: [
Lib_AddressManager.address, Lib_AddressManager.address,
(hre as any).deployConfig.ovmAddressManagerOwner, (hre as any).deployConfig.ovmAddressManagerOwner,
names, namesAndAddresses.map((pair) => {
addresses, return pair.name
}),
namesAndAddresses.map((pair) => {
return pair.address
}),
], ],
}) })
} }
......
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