Commit 06ef827c authored by Kelvin Fichter's avatar Kelvin Fichter

maint(ctb): remove unnecessary deploy vars

Removes several unused deployment configuration variables and shifts a
few things around. Also removes the systemConfigOwner variable by
replacing it with the single unified finalSystemOwner variable.
parent a37d8623
...@@ -44,8 +44,6 @@ type DeployConfig struct { ...@@ -44,8 +44,6 @@ type DeployConfig struct {
L2OutputOracleProposer common.Address `json:"l2OutputOracleProposer"` L2OutputOracleProposer common.Address `json:"l2OutputOracleProposer"`
L2OutputOracleChallenger common.Address `json:"l2OutputOracleChallenger"` L2OutputOracleChallenger common.Address `json:"l2OutputOracleChallenger"`
SystemConfigOwner common.Address `json:"systemConfigOwner"`
L1BlockTime uint64 `json:"l1BlockTime"` L1BlockTime uint64 `json:"l1BlockTime"`
L1GenesisBlockTimestamp hexutil.Uint64 `json:"l1GenesisBlockTimestamp"` L1GenesisBlockTimestamp hexutil.Uint64 `json:"l1GenesisBlockTimestamp"`
L1GenesisBlockNonce hexutil.Uint64 `json:"l1GenesisBlockNonce"` L1GenesisBlockNonce hexutil.Uint64 `json:"l1GenesisBlockNonce"`
...@@ -146,9 +144,6 @@ func (d *DeployConfig) Check() error { ...@@ -146,9 +144,6 @@ func (d *DeployConfig) Check() error {
if d.L2OutputOracleChallenger == (common.Address{}) { if d.L2OutputOracleChallenger == (common.Address{}) {
return fmt.Errorf("%w: L2OutputOracleChallenger cannot be address(0)", ErrInvalidDeployConfig) return fmt.Errorf("%w: L2OutputOracleChallenger cannot be address(0)", ErrInvalidDeployConfig)
} }
if d.SystemConfigOwner == (common.Address{}) {
return fmt.Errorf("%w: SystemConfigOwner cannot be address(0)", ErrInvalidDeployConfig)
}
if d.FinalSystemOwner == (common.Address{}) { if d.FinalSystemOwner == (common.Address{}) {
return fmt.Errorf("%w: FinalSystemOwner cannot be address(0)", ErrInvalidDeployConfig) return fmt.Errorf("%w: FinalSystemOwner cannot be address(0)", ErrInvalidDeployConfig)
} }
......
...@@ -77,7 +77,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) { ...@@ -77,7 +77,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
} }
data, err := sysCfgABI.Pack( data, err := sysCfgABI.Pack(
"initialize", "initialize",
config.SystemConfigOwner, config.FinalSystemOwner,
uint642Big(config.GasPriceOracleOverhead), uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar), uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(), config.BatchSenderAddress.Hash(),
...@@ -263,7 +263,7 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend) ...@@ -263,7 +263,7 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend)
{ {
Name: "SystemConfig", Name: "SystemConfig",
Args: []interface{}{ Args: []interface{}{
config.SystemConfigOwner, config.FinalSystemOwner,
uint642Big(config.GasPriceOracleOverhead), uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar), uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(), // left-padded 32 bytes value, version is zero anyway config.BatchSenderAddress.Hash(), // left-padded 32 bytes value, version is zero anyway
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x7770000000000000000000000000000000000001", "l2OutputOracleProposer": "0x7770000000000000000000000000000000000001",
"l2OutputOracleChallenger": "0x7770000000000000000000000000000000000002", "l2OutputOracleChallenger": "0x7770000000000000000000000000000000000002",
"systemConfigOwner": "0x7770000000000000000000000000000000000003",
"l1BlockTime": 15, "l1BlockTime": 15,
"l1GenesisBlockNonce": "0x0", "l1GenesisBlockNonce": "0x0",
"cliqueSignerAddress": "0x0000000000000000000000000000000000000000", "cliqueSignerAddress": "0x0000000000000000000000000000000000000000",
......
...@@ -71,7 +71,7 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams { ...@@ -71,7 +71,7 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
L2OutputOracleProposer: addresses.Proposer, L2OutputOracleProposer: addresses.Proposer,
L2OutputOracleChallenger: common.Address{}, // tbd L2OutputOracleChallenger: common.Address{}, // tbd
SystemConfigOwner: addresses.SysCfgOwner, FinalSystemOwner: addresses.SysCfgOwner,
L1BlockTime: 15, L1BlockTime: 15,
L1GenesisBlockNonce: 0, L1GenesisBlockNonce: 0,
...@@ -257,7 +257,7 @@ func ForkedDeployConfig(t require.TestingT, mnemonicCfg *MnemonicConfig, startBl ...@@ -257,7 +257,7 @@ func ForkedDeployConfig(t require.TestingT, mnemonicCfg *MnemonicConfig, startBl
P2PSequencerAddress: addrs.SequencerP2P, P2PSequencerAddress: addrs.SequencerP2P,
BatchInboxAddress: common.HexToAddress("0xff00000000000000000000000000000000000000"), BatchInboxAddress: common.HexToAddress("0xff00000000000000000000000000000000000000"),
BatchSenderAddress: addrs.Batcher, BatchSenderAddress: addrs.Batcher,
SystemConfigOwner: addrs.SysCfgOwner, FinalSystemOwner: addrs.SysCfgOwner,
L1GenesisBlockDifficulty: uint64ToBig(0), L1GenesisBlockDifficulty: uint64ToBig(0),
L1GenesisBlockBaseFeePerGas: uint64ToBig(0), L1GenesisBlockBaseFeePerGas: uint64ToBig(0),
L2OutputOracleSubmissionInterval: 10, L2OutputOracleSubmissionInterval: 10,
......
...@@ -64,7 +64,7 @@ func DefaultSystemConfig(t *testing.T) SystemConfig { ...@@ -64,7 +64,7 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
L2OutputOracleProposer: addresses.Proposer, L2OutputOracleProposer: addresses.Proposer,
L2OutputOracleChallenger: common.Address{}, // tbd L2OutputOracleChallenger: common.Address{}, // tbd
SystemConfigOwner: addresses.SysCfgOwner, FinalSystemOwner: addresses.SysCfgOwner,
L1BlockTime: 2, L1BlockTime: 2,
L1GenesisBlockNonce: 4660, L1GenesisBlockNonce: 4660,
......
...@@ -41,7 +41,6 @@ contract CrossDomainOwnable2_Test is Messenger_Initializer { ...@@ -41,7 +41,6 @@ contract CrossDomainOwnable2_Test is Messenger_Initializer {
setter.set(1); setter.set(1);
} }
function test_onlyOwner_notOwner2_reverts() external { function test_onlyOwner_notOwner2_reverts() external {
uint240 nonce = 0; uint240 nonce = 0;
address sender = bob; address sender = bob;
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc", "p2pSequencerAddress": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
"batchInboxAddress": "0xff00000000000000000000000000000000000000", "batchInboxAddress": "0xff00000000000000000000000000000000000000",
"batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"systemConfigOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
"l2OutputOracleSubmissionInterval": 20, "l2OutputOracleSubmissionInterval": 20,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", "l2OutputOracleProposer": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
"l2OutputOracleChallenger": "0x88BCa4Af3d950625752867f826E073E337076581", "l2OutputOracleChallenger": "0x88BCa4Af3d950625752867f826E073E337076581",
"finalizationPeriodSeconds": 2, "finalizationPeriodSeconds": 2,
"systemConfigOwner": "0x62790eFcB3a5f3A5D398F95B47930A9Addd83807",
"proxyAdminOwner": "0x62790eFcB3a5f3A5D398F95B47930A9Addd83807", "proxyAdminOwner": "0x62790eFcB3a5f3A5D398F95B47930A9Addd83807",
"l2GenesisBlockGasLimit": "0x17D7840", "l2GenesisBlockGasLimit": "0x17D7840",
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
"l2OutputOracleChallenger": "DUMMY", "l2OutputOracleChallenger": "DUMMY",
"finalizationPeriodSeconds": 2, "finalizationPeriodSeconds": 2,
"systemConfigOwner": "DUMMY",
"l2GenesisBlockGasLimit": "0x17D7840", "l2GenesisBlockGasLimit": "0x17D7840",
"l2GenesisBlockCoinbase": "0x4200000000000000000000000000000000000011", "l2GenesisBlockCoinbase": "0x4200000000000000000000000000000000000011",
"l2GenesisBlockBaseFeePerGas": "0x3b9aca00", "l2GenesisBlockBaseFeePerGas": "0x3b9aca00",
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
"batchInboxAddress": "0xff00000000000000000000000000000000000000", "batchInboxAddress": "0xff00000000000000000000000000000000000000",
"batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", "batchSenderAddress": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
"systemConfigOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
"l2OutputOracleSubmissionInterval": 6, "l2OutputOracleSubmissionInterval": 6,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", "l2OutputOracleProposer": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
......
import { ethers } from 'ethers'
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
import '@eth-optimism/hardhat-deploy-config' import '@eth-optimism/hardhat-deploy-config'
...@@ -7,6 +8,24 @@ import { ...@@ -7,6 +8,24 @@ import {
} from '../src/deploy-utils' } from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
let finalOwner = hre.deployConfig.finalSystemOwner
if (finalOwner === ethers.constants.AddressZero) {
if (hre.network.config.live === false) {
console.log(`WARNING!!!`)
console.log(`WARNING!!!`)
console.log(`WARNING!!!`)
console.log(`WARNING!!! A proxy admin owner address was not provided.`)
console.log(
`WARNING!!! Make sure you are ONLY doing this on a test network.`
)
finalOwner = deployer
} else {
throw new Error(`must specify the finalSystemOwner on live networks`)
}
}
const batcherHash = hre.ethers.utils.hexZeroPad( const batcherHash = hre.ethers.utils.hexZeroPad(
hre.deployConfig.batchSenderAddress, hre.deployConfig.batchSenderAddress,
32 32
...@@ -16,18 +35,14 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -16,18 +35,14 @@ const deployFn: DeployFunction = async (hre) => {
hre, hre,
name: 'SystemConfig', name: 'SystemConfig',
args: [ args: [
hre.deployConfig.systemConfigOwner, finalOwner,
hre.deployConfig.gasPriceOracleOverhead, hre.deployConfig.gasPriceOracleOverhead,
hre.deployConfig.gasPriceOracleScalar, hre.deployConfig.gasPriceOracleScalar,
batcherHash, batcherHash,
hre.deployConfig.l2GenesisBlockGasLimit, hre.deployConfig.l2GenesisBlockGasLimit,
], ],
postDeployAction: async (contract) => { postDeployAction: async (contract) => {
await assertContractVariable( await assertContractVariable(contract, 'owner', finalOwner)
contract,
'owner',
hre.deployConfig.systemConfigOwner
)
await assertContractVariable( await assertContractVariable(
contract, contract,
'overhead', 'overhead',
......
...@@ -125,7 +125,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -125,7 +125,7 @@ const deployFn: DeployFunction = async (hre) => {
systemConfigImpl: await getDeploymentAddress(hre, 'SystemConfig'), systemConfigImpl: await getDeploymentAddress(hre, 'SystemConfig'),
}, },
systemConfigConfig: { systemConfigConfig: {
owner: hre.deployConfig.systemConfigOwner, owner: finalOwner,
overhead: hre.deployConfig.gasPriceOracleOverhead, overhead: hre.deployConfig.gasPriceOracleOverhead,
scalar: hre.deployConfig.gasPriceOracleDecimals, scalar: hre.deployConfig.gasPriceOracleDecimals,
batcherHash: hre.ethers.utils.hexZeroPad( batcherHash: hre.ethers.utils.hexZeroPad(
......
...@@ -4,6 +4,11 @@ import { ethers } from 'ethers' ...@@ -4,6 +4,11 @@ import { ethers } from 'ethers'
* Core required deployment configuration. * Core required deployment configuration.
*/ */
interface RequiredDeployConfig { interface RequiredDeployConfig {
/**
* Number of confirmations to wait when deploying contracts.
*/
numDeployConfirmations: number
/** /**
* Address that will own the entire system on L1 when the deploy is complete. * Address that will own the entire system on L1 when the deploy is complete.
*/ */
...@@ -100,20 +105,15 @@ interface RequiredDeployConfig { ...@@ -100,20 +105,15 @@ interface RequiredDeployConfig {
* Output finalization period in seconds. * Output finalization period in seconds.
*/ */
finalizationPeriodSeconds: number finalizationPeriodSeconds: number
/**
* Owner of the SystemConfig contract.
*/
systemConfigOwner: string
} }
/** /**
* Optional deployment configuration when spinning up an L1 network as part of the deployment. * Optional deployment configuration when spinning up an L1 network as part of the deployment.
*/ */
interface OptionalL1DeployConfig { interface OptionalL1DeployConfig {
cliqueSignerAddress: string
l1BlockTime: number l1BlockTime: number
l1GenesisBlockNonce: string l1GenesisBlockNonce: string
cliqueSignerAddress: string
l1GenesisBlockGasLimit: string l1GenesisBlockGasLimit: string
l1GenesisBlockDifficulty: string l1GenesisBlockDifficulty: string
l1GenesisBlockMixHash: string l1GenesisBlockMixHash: string
...@@ -138,13 +138,9 @@ interface OptionalL2DeployConfig { ...@@ -138,13 +138,9 @@ interface OptionalL2DeployConfig {
l2GenesisBlockGasUsed: string l2GenesisBlockGasUsed: string
l2GenesisBlockParentHash: string l2GenesisBlockParentHash: string
l2GenesisBlockBaseFeePerGas: string l2GenesisBlockBaseFeePerGas: string
optimismBaseFeeRecipient: string
optimismL1FeeRecipient: string
l2CrossDomainMessengerOwner: string
gasPriceOracleOverhead: number gasPriceOracleOverhead: number
gasPriceOracleScalar: number gasPriceOracleScalar: number
gasPriceOracleDecimals: number gasPriceOracleDecimals: number
numDeployConfirmations: number
} }
/** /**
...@@ -163,6 +159,10 @@ export const deployConfigSpec: { ...@@ -163,6 +159,10 @@ export const deployConfigSpec: {
default?: any default?: any
} }
} = { } = {
numDeployConfirmations: {
type: 'number',
default: 1,
},
finalSystemOwner: { finalSystemOwner: {
type: 'address', type: 'address',
default: ethers.constants.AddressZero, default: ethers.constants.AddressZero,
...@@ -221,8 +221,9 @@ export const deployConfigSpec: { ...@@ -221,8 +221,9 @@ export const deployConfigSpec: {
type: 'number', type: 'number',
default: 2, default: 2,
}, },
systemConfigOwner: { cliqueSignerAddress: {
type: 'address', type: 'address',
default: ethers.constants.AddressZero,
}, },
l1BlockTime: { l1BlockTime: {
type: 'number', type: 'number',
...@@ -232,10 +233,6 @@ export const deployConfigSpec: { ...@@ -232,10 +233,6 @@ export const deployConfigSpec: {
type: 'string', // uint64 type: 'string', // uint64
default: '0x0', default: '0x0',
}, },
cliqueSignerAddress: {
type: 'address',
default: ethers.constants.AddressZero,
},
l1GenesisBlockGasLimit: { l1GenesisBlockGasLimit: {
type: 'string', type: 'string',
default: ethers.BigNumber.from(15_000_000).toHexString(), default: ethers.BigNumber.from(15_000_000).toHexString(),
...@@ -308,18 +305,6 @@ export const deployConfigSpec: { ...@@ -308,18 +305,6 @@ export const deployConfigSpec: {
type: 'string', // uint256 type: 'string', // uint256
default: ethers.BigNumber.from(1000_000_000).toHexString(), // 1 gwei default: ethers.BigNumber.from(1000_000_000).toHexString(), // 1 gwei
}, },
optimismBaseFeeRecipient: {
type: 'address',
default: ethers.constants.AddressZero,
},
optimismL1FeeRecipient: {
type: 'address',
default: ethers.constants.AddressZero,
},
l2CrossDomainMessengerOwner: {
type: 'address',
default: ethers.constants.AddressZero,
},
gasPriceOracleOverhead: { gasPriceOracleOverhead: {
type: 'number', type: 'number',
default: 2100, default: 2100,
...@@ -332,8 +317,4 @@ export const deployConfigSpec: { ...@@ -332,8 +317,4 @@ export const deployConfigSpec: {
type: 'number', type: 'number',
default: 6, default: 6,
}, },
numDeployConfirmations: {
type: 'number',
default: 1,
},
} }
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