From 86c9abe33ffbe36520b67a85439dbf7809ae662b Mon Sep 17 00:00:00 2001 From: Michael de Hoog Date: Mon, 11 Nov 2024 15:41:20 -1000 Subject: [PATCH] Refactor and deploy latest DeployChain contract (#19) --- bindings/deploy_chain.go | 41 +++++-- .../84532/run-1731373076.json | 64 ++++++++++ deployments/84532-deploy.json | 2 +- script/DeployDeployChain.s.sol | 36 ++++++ src/DeployChain.sol | 113 +++++++----------- testnet/genesis.go | 20 ++-- 6 files changed, 187 insertions(+), 89 deletions(-) create mode 100644 broadcast/DeployDeployChain.s.sol/84532/run-1731373076.json create mode 100644 script/DeployDeployChain.s.sol diff --git a/bindings/deploy_chain.go b/bindings/deploy_chain.go index b3f95c9..6b20bd8 100644 --- a/bindings/deploy_chain.go +++ b/bindings/deploy_chain.go @@ -29,6 +29,13 @@ var ( _ = abi.ConvertType ) +// DeployChainAddressConfiguration is an auto generated low-level Go binding around an user-defined struct. +type DeployChainAddressConfiguration struct { + Batcher common.Address + Proposer common.Address + UnsafeBlockSigner common.Address +} + // DeployChainDeployAddresses is an auto generated low-level Go binding around an user-defined struct. type DeployChainDeployAddresses struct { L2OutputOracle common.Address @@ -48,9 +55,17 @@ type DeployChainGasConfiguration struct { GasToken common.Address } +// DeployChainGenesisConfiguration is an auto generated low-level Go binding around an user-defined struct. +type DeployChainGenesisConfiguration struct { + L1Number uint64 + L2Hash [32]byte + L2StateRoot [32]byte + L2Time uint64 +} + // DeployChainMetaData contains all meta data concerning the DeployChain contract. var DeployChainMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_proxyAdmin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_superchainConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_protocolVersions\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"MESSAGE_PASSER_STORAGE_HASH\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"calculateBatchInbox\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"deploy\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"genesisL1Number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"genesisL2Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"genesisL2StateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"genesisL2Time\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasConfig\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.GasConfiguration\",\"components\":[{\"name\":\"basefeeScalar\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobbasefeeScalar\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"gasLimit\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasToken\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"batcherAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"unsafeBlockSigner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deployAddresses\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.DeployAddresses\",\"components\":[{\"name\":\"l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1CrossDomainMessenger\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1ERC721Bridge\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1StandardBridge\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l2OutputOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"optimismMintableERC20Factory\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"optimismPortal\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"protocolVersions\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxyAdmin\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"superchainConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"systemConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"Deploy\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"configHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"outputRoot\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"batchInbox\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"addresses\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structDeployChain.DeployAddresses\",\"components\":[{\"name\":\"l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"}]}],\"anonymous\":false}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_proxyAdmin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_superchainConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_protocolVersions\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"MESSAGE_PASSER_STORAGE_HASH\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"calculateBatchInbox\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"deploy\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"genesisConfig\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.GenesisConfiguration\",\"components\":[{\"name\":\"l1Number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"l2Hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"l2StateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"l2Time\",\"type\":\"uint64\",\"internalType\":\"uint64\"}]},{\"name\":\"gasConfig\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.GasConfiguration\",\"components\":[{\"name\":\"basefeeScalar\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blobbasefeeScalar\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"gasLimit\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"gasToken\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"addressConfig\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.AddressConfiguration\",\"components\":[{\"name\":\"batcher\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"proposer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"unsafeBlockSigner\",\"type\":\"address\",\"internalType\":\"address\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deployAddresses\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structDeployChain.DeployAddresses\",\"components\":[{\"name\":\"l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1CrossDomainMessenger\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1ERC721Bridge\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1StandardBridge\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l2OutputOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"optimismMintableERC20Factory\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"optimismPortal\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"protocolVersions\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxyAdmin\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"superchainConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"systemConfig\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"Deploy\",\"inputs\":[{\"name\":\"chainID\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"configHash\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"outputRoot\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"batchInbox\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"addresses\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structDeployChain.DeployAddresses\",\"components\":[{\"name\":\"l2OutputOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"systemConfig\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismPortal\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1CrossDomainMessenger\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1StandardBridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"l1ERC721Bridge\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"optimismMintableERC20Factory\",\"type\":\"address\",\"internalType\":\"address\"}]}],\"anonymous\":false}]", } // DeployChainABI is the input ABI used to generate the binding from. @@ -602,25 +617,25 @@ func (_DeployChain *DeployChainCallerSession) SystemConfig() (common.Address, er return _DeployChain.Contract.SystemConfig(&_DeployChain.CallOpts) } -// Deploy is a paid mutator transaction binding the contract method 0x6b74d941. +// Deploy is a paid mutator transaction binding the contract method 0xde57d301. // -// Solidity: function deploy(uint256 chainID, uint64 genesisL1Number, bytes32 genesisL2Hash, bytes32 genesisL2StateRoot, uint64 genesisL2Time, (uint32,uint32,uint64,address) gasConfig, address batcherAddress, address unsafeBlockSigner, address proposer) returns() -func (_DeployChain *DeployChainTransactor) Deploy(opts *bind.TransactOpts, chainID *big.Int, genesisL1Number uint64, genesisL2Hash [32]byte, genesisL2StateRoot [32]byte, genesisL2Time uint64, gasConfig DeployChainGasConfiguration, batcherAddress common.Address, unsafeBlockSigner common.Address, proposer common.Address) (*types.Transaction, error) { - return _DeployChain.contract.Transact(opts, "deploy", chainID, genesisL1Number, genesisL2Hash, genesisL2StateRoot, genesisL2Time, gasConfig, batcherAddress, unsafeBlockSigner, proposer) +// Solidity: function deploy(uint256 chainID, (uint64,bytes32,bytes32,uint64) genesisConfig, (uint32,uint32,uint64,address) gasConfig, (address,address,address) addressConfig) returns() +func (_DeployChain *DeployChainTransactor) Deploy(opts *bind.TransactOpts, chainID *big.Int, genesisConfig DeployChainGenesisConfiguration, gasConfig DeployChainGasConfiguration, addressConfig DeployChainAddressConfiguration) (*types.Transaction, error) { + return _DeployChain.contract.Transact(opts, "deploy", chainID, genesisConfig, gasConfig, addressConfig) } -// Deploy is a paid mutator transaction binding the contract method 0x6b74d941. +// Deploy is a paid mutator transaction binding the contract method 0xde57d301. // -// Solidity: function deploy(uint256 chainID, uint64 genesisL1Number, bytes32 genesisL2Hash, bytes32 genesisL2StateRoot, uint64 genesisL2Time, (uint32,uint32,uint64,address) gasConfig, address batcherAddress, address unsafeBlockSigner, address proposer) returns() -func (_DeployChain *DeployChainSession) Deploy(chainID *big.Int, genesisL1Number uint64, genesisL2Hash [32]byte, genesisL2StateRoot [32]byte, genesisL2Time uint64, gasConfig DeployChainGasConfiguration, batcherAddress common.Address, unsafeBlockSigner common.Address, proposer common.Address) (*types.Transaction, error) { - return _DeployChain.Contract.Deploy(&_DeployChain.TransactOpts, chainID, genesisL1Number, genesisL2Hash, genesisL2StateRoot, genesisL2Time, gasConfig, batcherAddress, unsafeBlockSigner, proposer) +// Solidity: function deploy(uint256 chainID, (uint64,bytes32,bytes32,uint64) genesisConfig, (uint32,uint32,uint64,address) gasConfig, (address,address,address) addressConfig) returns() +func (_DeployChain *DeployChainSession) Deploy(chainID *big.Int, genesisConfig DeployChainGenesisConfiguration, gasConfig DeployChainGasConfiguration, addressConfig DeployChainAddressConfiguration) (*types.Transaction, error) { + return _DeployChain.Contract.Deploy(&_DeployChain.TransactOpts, chainID, genesisConfig, gasConfig, addressConfig) } -// Deploy is a paid mutator transaction binding the contract method 0x6b74d941. +// Deploy is a paid mutator transaction binding the contract method 0xde57d301. // -// Solidity: function deploy(uint256 chainID, uint64 genesisL1Number, bytes32 genesisL2Hash, bytes32 genesisL2StateRoot, uint64 genesisL2Time, (uint32,uint32,uint64,address) gasConfig, address batcherAddress, address unsafeBlockSigner, address proposer) returns() -func (_DeployChain *DeployChainTransactorSession) Deploy(chainID *big.Int, genesisL1Number uint64, genesisL2Hash [32]byte, genesisL2StateRoot [32]byte, genesisL2Time uint64, gasConfig DeployChainGasConfiguration, batcherAddress common.Address, unsafeBlockSigner common.Address, proposer common.Address) (*types.Transaction, error) { - return _DeployChain.Contract.Deploy(&_DeployChain.TransactOpts, chainID, genesisL1Number, genesisL2Hash, genesisL2StateRoot, genesisL2Time, gasConfig, batcherAddress, unsafeBlockSigner, proposer) +// Solidity: function deploy(uint256 chainID, (uint64,bytes32,bytes32,uint64) genesisConfig, (uint32,uint32,uint64,address) gasConfig, (address,address,address) addressConfig) returns() +func (_DeployChain *DeployChainTransactorSession) Deploy(chainID *big.Int, genesisConfig DeployChainGenesisConfiguration, gasConfig DeployChainGasConfiguration, addressConfig DeployChainAddressConfiguration) (*types.Transaction, error) { + return _DeployChain.Contract.Deploy(&_DeployChain.TransactOpts, chainID, genesisConfig, gasConfig, addressConfig) } // DeployChainDeployIterator is returned from FilterDeploy and is used to iterate over the raw logs and unpacked data for Deploy events raised by the DeployChain contract. diff --git a/broadcast/DeployDeployChain.s.sol/84532/run-1731373076.json b/broadcast/DeployDeployChain.s.sol/84532/run-1731373076.json new file mode 100644 index 0000000..9a843d5 --- /dev/null +++ b/broadcast/DeployDeployChain.s.sol/84532/run-1731373076.json @@ -0,0 +1,64 @@ +{ + "transactions": [ + { + "hash": "0xda5d9551e14250e02e1bbd8dfbd26f7985513c4e6cf9f63a91b499f1159a3501", + "transactionType": "CREATE2", + "contractName": "DeployChain", + "contractAddress": "0xfd6c9bd1975749ad0c566c2861f7ac09296da994", + "function": null, + "arguments": [ + "0x07D583226bE1636d1b00B479F994a264E183298E", + "0x6837dEf8B12Ea8EfB7E2605B435172f6c657d859", + "0x8E248445a3943f5c680707dEf0AFAd8D24A29248", + "0xfADd9d89fdE7ba0D6053552820A5fEF42b5Fb2Af", + "0xe48337852f6081867E2AfC265b3E5d0475f9d9E5", + "0x1025E8ee4f74743e4DC6acA35387A50d9A1e30A7", + "0x081415893317739FA0BdE509E5C13E54Aef23a0a", + "0xe3047c1cFbc2C748DA9cdc9AF973cD74c14c4122", + "0xC3846e5765816020F32E1C5FE6bb90330A28A2Ed", + "0xc572623Fe2045A8d4A6a8065b8F985124d859B4c" + ], + "transaction": { + "from": "0xb1751506f2813188ea0a4cbf233d665063ab49fc", + "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "gas": "0x250c84", + "value": "0x0", + "input": "0x638627e586f5e36fe67a77519503a7c6da22f92b150d3c6055fd40bdcfe9ffd16101c06040523480156200001257600080fd5b50604051620021803803806200218083398101604081905262000035916200009c565b6001600160a01b03998a1660805297891660a05295881660c05293871660e05291861661010052851661012052841661014052831661016052821661018052166101a0526200016b565b80516001600160a01b03811681146200009757600080fd5b919050565b6000806000806000806000806000806101408b8d031215620000bd57600080fd5b620000c88b6200007f565b9950620000d860208c016200007f565b9850620000e860408c016200007f565b9750620000f860608c016200007f565b96506200010860808c016200007f565b95506200011860a08c016200007f565b94506200012860c08c016200007f565b93506200013860e08c016200007f565b9250620001496101008c016200007f565b91506200015a6101208c016200007f565b90509295989b9194979a5092959850565b60805160a05160c05160e05161010051610120516101405161016051610180516101a051611ee46200029c600039600061021b015260008181610193015281816111ca015281816113bd0152818161148601526115400152600081816101f40152818161041a0152610d3d015260008181610269015281816107980152610e0c01526000818161024201528181610b160152610edb0152600081816102e5015281816109ec0152610e9601526000818160f4015281816108c20152610e5101526000818161016c015281816105440152610d820152600081816101450152818161066e0152610dc70152600081816101cd01528181610492015281816105bc015281816106e6015281816108100152818161093a01528181610a6401528181610b8e015261163d0152611ee46000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80636624856a1161008c578063aabcb26e11610066578063aabcb26e1461028b578063beab4f7e146102c0578063c4e8ddfa146102e0578063de57d3011461030757600080fd5b80636624856a146102165780639b7d7f0a1461023d578063a71198691461026457600080fd5b806335e80ab3116100c857806335e80ab31461018e57806336e0909b146101b55780633e47158c146101c85780634d9f1559146101ef57600080fd5b8063078f29cf146100ef5780630a49cb031461014057806333d7e2bd14610167575b600080fd5b6101167f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101166101c336600461191a565b61031c565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b6102b27f8ed4baae3a927be3dea54996b4d5899f8c01e7594bf50b17dc1e741388ce3d1281565b604051908152602001610137565b6102d36102ce36600461191a565b6103a4565b6040516101379190611933565b6101167f000000000000000000000000000000000000000000000000000000000000000081565b61031a610315366004611adf565b610c3f565b005b6000805b821561035a57610331600a84611c2d565b61033c82600a611c70565b6103469190611cad565b9050610353600a84611cc5565b9250610320565b60005b81156103875761036e600a83611c2d565b60049190911b17610380600a83611cc5565b915061035d565b73ff00000000000000000000000000000000000000179392505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091526000826040516020016103f291815260200190565b6040516020818303038152906040528051906020012090506040518060e001604052806105247f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff16815260200161064e7f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff1681526020016107787f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff1681526020016108a27f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff1681526020016109cc7f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff168152602001610af67f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff168152602001610c207f0000000000000000000000000000000000000000000000000000000000000000846040517f60678060095f395ff363204e1c7a60e01b5f52730000000000000000000000008152606092831b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201527f0000000000000000000000000000000000000000000000000000000000000000831b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf3ff000000000000000000000000000000000000000060658201523090921b60718301526085820152607080822060a5830152605591012090565b73ffffffffffffffffffffffffffffffffffffffff1690529392505050565b6000610c4a85610cc7565b90506000610c5f868686866000015186610f00565b90506000610c6c8761031c565b9050610c7b85858385876110d4565b8151602083015160405189927f49ea8b4c640f12c7d41cb7b7931d984f226f95ce1d55e1e449ee3d61b877c1ad92610cb69286908990611cd9565b60405180910390a250505050505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152600082604051602001610d1591815260200190565b6040516020818303038152906040528051906020012090506040518060e00160405280610d627f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610da77f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610dec7f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610e317f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610e767f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610ebb7f000000000000000000000000000000000000000000000000000000000000000084611638565b73ffffffffffffffffffffffffffffffffffffffff168152602001610c207f000000000000000000000000000000000000000000000000000000000000000084611638565b60408051808201909152600080825260208201526000856000015167ffffffffffffffff164090506000856000015163ffffffff166020876020015163ffffffff16901b60f86001901b171760001b905060008089848a602001518b606001518a878d604001518c604001518d6020015160405160200161102d9a9998979695949392919060c09a8b1b7fffffffffffffffff0000000000000000000000000000000000000000000000009081168252600882019a909a526028810198909852604888019690965293881b87166068870152606092831b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090811660708801526084870192909252871b90951660a485015290811b841660ac8401521b9091169181019190915260d40190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012060808401835260008085528c840151858401527f8ed4baae3a927be3dea54996b4d5899f8c01e7594bf50b17dc1e741388ce3d1293850193909352908b015160608401529250906110b39061179a565b60408051808201909152928352602083015250925050505b95945050505050565b80516020808301518451918501516040517f85f812c300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff928316600482015260248101939093526044830152909116906385f812c390606401600060405180830381600087803b15801561115957600080fd5b505af115801561116d573d6000803e3d6000fd5b505050506040818101518251602084015192517fc0c53b8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015292811660248401527f000000000000000000000000000000000000000000000000000000000000000081166044840152169063c0c53b8b90606401600060405180830381600087803b15801561121557600080fd5b505af1158015611229573d6000803e3d6000fd5b50505050600061123d8287606001516117f6565b9050816020015173ffffffffffffffffffffffffffffffffffffffff1663dc7e20a587600001518860200151886000015173ffffffffffffffffffffffffffffffffffffffff1660001b8a604001518a604001516113146040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152506040805160c0810182526301312d008152600a6020820152600891810191909152633b9aca006060820152620f424060808201526fffffffffffffffffffffffffffffffff60a082015290565b8b8d602001518a6040518a63ffffffff1660e01b815260040161133f99989796959493929190611d74565b600060405180830381600087803b15801561135957600080fd5b505af115801561136d573d6000803e3d6000fd5b505050506060820151604080840151602085015191517fc0c53b8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152918216602482015291811660448301529091169063c0c53b8b90606401600060405180830381600087803b15801561141a57600080fd5b505af115801561142e573d6000803e3d6000fd5b505050506080820151606083015160208401516040517fc0c53b8b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201527f000000000000000000000000000000000000000000000000000000000000000083166024820152908216604482015291169063c0c53b8b90606401600060405180830381600087803b1580156114da57600080fd5b505af11580156114ee573d6000803e3d6000fd5b50505060a083015160608401516040517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000000000000000000000000000000000000000000821660248201529116915063485cc95590604401600060405180830381600087803b15801561158d57600080fd5b505af11580156115a1573d6000803e3d6000fd5b50505060c083015160808401516040517fc4d66de800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529116915063c4d66de890602401600060405180830381600087803b15801561161857600080fd5b505af115801561162c573d6000803e3d6000fd5b50505050505050505050565b6000807f000000000000000000000000000000000000000000000000000000000000000090506040517f60678060095f395ff363204e1c7a60e01b5f527300000000000000000000000081528460601b60148201527f6004525f5f60245f73000000000000000000000000000000000000000000000060288201528160601b60318201527f5afa3d5f5f3e3d60201416604d573d5ffd5b5f5f365f5f51365f5f375af43d5f60458201527f5f3e5f3d91606557fd5bf30000000000000000000000000000000000000000006065820152836070826000f592505073ffffffffffffffffffffffffffffffffffffffff8216611793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f50726f78793a2063726561746532206661696c65640000000000000000000000604482015260640160405180910390fd5b5092915050565b600081600001518260200151836040015184606001516040516020016117d9949392919093845260208401929092526040830152606082015260800190565b604051602081830303815290604052805190602001209050919050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091526040518060e00160405280846060015173ffffffffffffffffffffffffffffffffffffffff1681526020018460a0015173ffffffffffffffffffffffffffffffffffffffff168152602001846080015173ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001846040015173ffffffffffffffffffffffffffffffffffffffff1681526020018460c0015173ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681525090505b92915050565b60006020828403121561192c57600080fd5b5035919050565b60e08101611914828473ffffffffffffffffffffffffffffffffffffffff8082511683528060208301511660208401528060408301511660408401528060608301511660608401528060808301511660808401528060a08301511660a08401528060c08301511660c0840152505050565b6040516080810167ffffffffffffffff811182821017156119ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b803567ffffffffffffffff81168114611a0c57600080fd5b919050565b803563ffffffff81168114611a0c57600080fd5b803573ffffffffffffffffffffffffffffffffffffffff81168114611a0c57600080fd5b600060608284031215611a5b57600080fd5b6040516060810181811067ffffffffffffffff82111715611aa5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052905080611ab483611a25565b8152611ac260208401611a25565b6020820152611ad360408401611a25565b60408201525092915050565b600080600080848603610180811215611af757600080fd5b8535945060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082011215611b2b57600080fd5b611b336119a4565b611b3f602088016119f4565b81526040870135602082015260608701356040820152611b61608088016119f4565b6060820152935060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6082011215611b9857600080fd5b50611ba16119a4565b611bad60a08701611a11565b8152611bbb60c08701611a11565b6020820152611bcc60e087016119f4565b6040820152611bde6101008701611a25565b60608201529150611bf3866101208701611a49565b905092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611c3c57611c3c611bfe565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611ca857611ca8611c41565b500290565b60008219821115611cc057611cc0611c41565b500190565b600082611cd457611cd4611bfe565b500490565b8481526020810184905273ffffffffffffffffffffffffffffffffffffffff8316604082015261014081016110cb606083018473ffffffffffffffffffffffffffffffffffffffff8082511683528060208301511660208401528060408301511660408401528060608301511660608401528060808301511660808401528060a08301511660a08401528060c08301511660c0840152505050565b60006102808201905063ffffffff808c168352808b16602084015289604084015267ffffffffffffffff8916606084015273ffffffffffffffffffffffffffffffffffffffff881660808401528087511660a084015260ff60208801511660c084015260ff60408801511660e08401528060608801511661010084015280608088015116610120840152506fffffffffffffffffffffffffffffffff60a087015116610140830152611e3f61016083018673ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8416610180830152825173ffffffffffffffffffffffffffffffffffffffff9081166101a0840152602084015181166101c0840152604084015181166101e0840152606084015181166102008401526080840151811661022084015260a0840151811661024084015260c0840151166102608301529a995050505050505050505056fea164736f6c634300080f000a00000000000000000000000007d583226be1636d1b00b479f994a264e183298e0000000000000000000000006837def8b12ea8efb7e2605b435172f6c657d8590000000000000000000000008e248445a3943f5c680707def0afad8d24a29248000000000000000000000000fadd9d89fde7ba0d6053552820a5fef42b5fb2af000000000000000000000000e48337852f6081867e2afc265b3e5d0475f9d9e50000000000000000000000001025e8ee4f74743e4dc6aca35387a50d9a1e30a7000000000000000000000000081415893317739fa0bde509e5c13e54aef23a0a000000000000000000000000e3047c1cfbc2c748da9cdc9af973cd74c14c4122000000000000000000000000c3846e5765816020f32e1c5fe6bb90330a28a2ed000000000000000000000000c572623fe2045a8d4a6a8065b8f985124d859b4c", + "nonce": "0x177", + "chainId": "0x14a34" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x1d3334", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xda5d9551e14250e02e1bbd8dfbd26f7985513c4e6cf9f63a91b499f1159a3501", + "transactionIndex": "0x3", + "blockHash": "0xa7b61ba299577d744672ef0f65aaa86cfcbaafa87e2183f798769977ecb66540", + "blockNumber": "0x10fa497", + "gasUsed": "0x1ad29f", + "effectiveGasPrice": "0xece12", + "from": "0xb1751506f2813188ea0a4cbf233d665063ab49fc", + "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "contractAddress": null, + "l1BaseFeeScalar": "0x44d", + "l1BlobBaseFee": "0x1", + "l1BlobBaseFeeScalar": "0xa118b", + "l1Fee": "0xbaeec72", + "l1GasPrice": "0x373e39", + "l1GasUsed": "0xc016" + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1731373076, + "chain": 84532, + "commit": "c5b0eb1" +} \ No newline at end of file diff --git a/deployments/84532-deploy.json b/deployments/84532-deploy.json index 921b60f..920d65f 100644 --- a/deployments/84532-deploy.json +++ b/deployments/84532-deploy.json @@ -2,7 +2,7 @@ "AddressManager": "0x42dffe88Be465d26a8858701252b7aa203bB242E", "AnchorStateRegistryProxy": "0x0000000000000000000000000000000000000001", "DelayedWETHProxy": "0x0000000000000000000000000000000000000001", - "DeployChain": "0x7caf66E61504FA8E72a261a14b29c815Aa7977D0", + "DeployChain": "0xFD6c9Bd1975749Ad0C566c2861F7Ac09296da994", "DisputeGameFactoryProxy": "0x0000000000000000000000000000000000000001", "L1CrossDomainMessenger": "0x4894Ad99C394cCd9a15fCB883fb46701fE228E52", "L1CrossDomainMessengerProxy": "0x081415893317739FA0BdE509E5C13E54Aef23a0a", diff --git a/script/DeployDeployChain.s.sol b/script/DeployDeployChain.s.sol new file mode 100644 index 0000000..1618eb3 --- /dev/null +++ b/script/DeployDeployChain.s.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import {Script} from "forge-std/Script.sol"; +import {console2 as console} from "forge-std/console2.sol"; +import {DeployChain} from "../src/DeployChain.sol"; +import {Artifacts} from "@eth-optimism-bedrock/scripts/Artifacts.s.sol"; +import {Config} from "@eth-optimism-bedrock/scripts/libraries/Config.sol"; + +contract DeployDeployChain is Script, Artifacts { + function run() public { + _loadAddresses(deploymentOutfile); + + console.log("Deploying DeployChain implementation"); + vm.broadcast(); + DeployChain deployChain = new DeployChain{salt: _implSalt()}({ + _proxyAdmin: mustGetAddress("ProxyAdmin"), + _optimismPortal: mustGetAddress("OptimismPortalProxy"), + _systemConfig: mustGetAddress("SystemConfigProxy"), + _l1StandardBridge: mustGetAddress("L1StandardBridgeProxy"), + _l1ERC721Bridge: mustGetAddress("L1ERC721BridgeProxy"), + _optimismMintableERC20Factory: mustGetAddress("OptimismMintableERC20FactoryProxy"), + _l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"), + _l2OutputOracle: mustGetAddress("L2OutputOracleProxy"), + _superchainConfig: mustGetAddress("SuperchainConfigProxy"), + _protocolVersions: mustGetAddress("ProtocolVersionsProxy") + }); + + delete _namedDeployments["DeployChain"]; + save("DeployChain", address(deployChain)); + } + + function _implSalt() internal view returns (bytes32 _env) { + _env = keccak256(bytes(vm.envOr("IMPL_SALT", string("ethers phoenix")))); + } +} diff --git a/src/DeployChain.sol b/src/DeployChain.sol index 51595e8..1c78d12 100644 --- a/src/DeployChain.sol +++ b/src/DeployChain.sol @@ -31,6 +31,13 @@ contract DeployChain { address optimismMintableERC20Factory; } + struct GenesisConfiguration { + uint64 l1Number; + bytes32 l2Hash; + bytes32 l2StateRoot; + uint64 l2Time; + } + struct GasConfiguration { uint32 basefeeScalar; uint32 blobbasefeeScalar; @@ -38,6 +45,12 @@ contract DeployChain { address gasToken; } + struct AddressConfiguration { + address batcher; + address proposer; + address unsafeBlockSigner; + } + struct Hashes { bytes32 configHash; bytes32 genesisOutputRoot; @@ -100,32 +113,17 @@ contract DeployChain { function deploy( uint256 chainID, - uint64 genesisL1Number, - bytes32 genesisL2Hash, - bytes32 genesisL2StateRoot, - uint64 genesisL2Time, + GenesisConfiguration memory genesisConfig, GasConfiguration memory gasConfig, - address batcherAddress, - address unsafeBlockSigner, - address proposer + AddressConfiguration memory addressConfig ) external { DeployAddresses memory addresses = setupProxies(chainID); - bytes32 genesisL1Hash = blockhash(uint256(genesisL1Number)); - - Hashes memory hashes = calculateHashes( - chainID, - genesisL1Hash, - genesisL2Hash, - genesisL2StateRoot, - genesisL2Time, - gasConfig, - batcherAddress, - addresses - ); + + Hashes memory hashes = calculateHashes(chainID, genesisConfig, gasConfig, addressConfig.batcher, addresses); address batchInbox = calculateBatchInbox(chainID); - initializeProxies(gasConfig, batcherAddress, unsafeBlockSigner, batchInbox, proposer, hashes, addresses); + initializeProxies(gasConfig, addressConfig, batchInbox, hashes, addresses); emit Deploy({ chainID: chainID, @@ -163,14 +161,12 @@ contract DeployChain { function calculateHashes( uint256 chainID, - bytes32 genesisL1Hash, - bytes32 genesisL2Hash, - bytes32 genesisL2StateRoot, - uint64 genesisL2Time, + GenesisConfiguration memory genesisConfig, GasConfiguration memory gasConfig, address batcherAddress, DeployAddresses memory addresses - ) internal pure returns (Hashes memory) { + ) internal view returns (Hashes memory) { + bytes32 genesisL1Hash = blockhash(uint256(genesisConfig.l1Number)); bytes32 scalar = bytes32((uint256(0x01) << 248) | (uint256(gasConfig.blobbasefeeScalar) << 32) | gasConfig.basefeeScalar); @@ -179,8 +175,8 @@ contract DeployChain { uint64(0), // version chainID, genesisL1Hash, - genesisL2Hash, - genesisL2Time, + genesisConfig.l2Hash, + genesisConfig.l2Time, batcherAddress, scalar, gasConfig.gasLimit, @@ -192,9 +188,9 @@ contract DeployChain { bytes32 genesisOutputRoot = Hashing.hashOutputRootProof( Types.OutputRootProof({ version: 0, - stateRoot: genesisL2StateRoot, + stateRoot: genesisConfig.l2StateRoot, messagePasserStorageRoot: MESSAGE_PASSER_STORAGE_HASH, - latestBlockhash: genesisL2Hash + latestBlockhash: genesisConfig.l2Hash }) ); @@ -203,19 +199,11 @@ contract DeployChain { function initializeProxies( GasConfiguration memory gasConfig, - address batcherAddress, - address unsafeBlockSigner, + AddressConfiguration memory addressConfig, address batchInbox, - address proposer, Hashes memory hashes, DeployAddresses memory addresses ) internal { - _initializeOracles(addresses, hashes); - _initializeSystemConfig(addresses, gasConfig, batcherAddress, unsafeBlockSigner, batchInbox, proposer); - _initializeBridges(addresses); - } - - function _initializeOracles(DeployAddresses memory addresses, Hashes memory hashes) private { OutputOracle(addresses.l2OutputOracle).initialize( SystemConfigOwnable(addresses.systemConfig), hashes.configHash, hashes.genesisOutputRoot ); @@ -225,48 +213,21 @@ contract DeployChain { ISystemConfig(addresses.systemConfig), ISuperchainConfig(superchainConfig) ); - } - function _initializeSystemConfig( - DeployAddresses memory addresses, - GasConfiguration memory gasConfig, - address batcherAddress, - address unsafeBlockSigner, - address batchInbox, - address proposer - ) private { SystemConfig.Addresses memory systemAddresses = _createSystemAddresses(addresses, gasConfig.gasToken); SystemConfigOwnable(addresses.systemConfig).initialize({ _basefeeScalar: gasConfig.basefeeScalar, _blobbasefeeScalar: gasConfig.blobbasefeeScalar, - _batcherHash: bytes32(uint256(uint160(batcherAddress))), + _batcherHash: bytes32(uint256(uint160(addressConfig.batcher))), _gasLimit: gasConfig.gasLimit, - _unsafeBlockSigner: unsafeBlockSigner, + _unsafeBlockSigner: addressConfig.unsafeBlockSigner, _config: Constants.DEFAULT_RESOURCE_CONFIG(), _batchInbox: batchInbox, - _proposer: proposer, + _proposer: addressConfig.proposer, _addresses: systemAddresses }); - } - function _createSystemAddresses(DeployAddresses memory addresses, address gasToken) - private - pure - returns (SystemConfig.Addresses memory) - { - return SystemConfig.Addresses({ - l1CrossDomainMessenger: addresses.l1CrossDomainMessenger, - l1ERC721Bridge: addresses.l1ERC721Bridge, - l1StandardBridge: addresses.l1StandardBridge, - disputeGameFactory: address(0), - optimismPortal: addresses.optimismPortal, - optimismMintableERC20Factory: addresses.optimismMintableERC20Factory, - gasPayingToken: gasToken - }); - } - - function _initializeBridges(DeployAddresses memory addresses) private { L1CrossDomainMessenger(addresses.l1CrossDomainMessenger).initialize( ISuperchainConfig(superchainConfig), IOptimismPortal(payable(addresses.optimismPortal)), @@ -286,6 +247,22 @@ contract DeployChain { OptimismMintableERC20Factory(addresses.optimismMintableERC20Factory).initialize(addresses.l1StandardBridge); } + function _createSystemAddresses(DeployAddresses memory addresses, address gasToken) + private + pure + returns (SystemConfig.Addresses memory) + { + return SystemConfig.Addresses({ + l1CrossDomainMessenger: addresses.l1CrossDomainMessenger, + l1ERC721Bridge: addresses.l1ERC721Bridge, + l1StandardBridge: addresses.l1StandardBridge, + disputeGameFactory: address(0), + optimismPortal: addresses.optimismPortal, + optimismMintableERC20Factory: addresses.optimismMintableERC20Factory, + gasPayingToken: gasToken + }); + } + function setupProxy(address proxy, bytes32 salt) internal returns (address instance) { address _proxyAdmin = proxyAdmin; /// @solidity memory-safe-assembly diff --git a/testnet/genesis.go b/testnet/genesis.go index 3e4e17e..8744848 100644 --- a/testnet/genesis.go +++ b/testnet/genesis.go @@ -398,24 +398,30 @@ func Main(cliCtx *cli.Context) error { }, } + genesisCfg := bindings.DeployChainGenesisConfiguration{ + L1Number: l1Header.Number.Uint64(), + L2Hash: genesisBlock.Hash(), + L2StateRoot: genesisBlock.Root(), + L2Time: l2Genesis.Timestamp, + } gasConfig := bindings.DeployChainGasConfiguration{ BasefeeScalar: config.GasPriceOracleBaseFeeScalar, BlobbasefeeScalar: config.GasPriceOracleBlobBaseFeeScalar, GasLimit: uint64(config.L2GenesisBlockGasLimit), GasToken: config.CustomGasTokenAddress, } + addressConfig := bindings.DeployChainAddressConfiguration{ + Batcher: config.BatchSenderAddress, + Proposer: config.L2OutputOracleProposer, + UnsafeBlockSigner: config.P2PSequencerAddress, + } tx, err := deployChain.Deploy( opts, l2ChainID, - l1Header.Number.Uint64(), - genesisBlock.Hash(), - genesisBlock.Root(), - l2Genesis.Timestamp, + genesisCfg, gasConfig, - config.BatchSenderAddress, - config.P2PSequencerAddress, - config.L2OutputOracleProposer, + addressConfig, ) if err != nil { return fmt.Errorf("failed to deploy proxies: %w", err)