Commit 0b40e612 authored by protolambda's avatar protolambda Committed by GitHub

op-node: SystemConfig in derivation (#3787)

* op-node: SystemConfig in derivation

* op-node: reduce sys config test boilerplate

* op-node: more readable loop to find L2 block with L1 origin we look for

* op-node: change test addresses to not confuse with predeploys

* op-node: system config field doc comments

* op-node: fix lint

* contracts-bedrock: Sys config contract and L2 contract updates (#3788)

* contracts-bedrock: SystemConfig contract and L2 contract updates
Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>

* contracts-bedrock: SystemConfig/L1Block batcherHash typing

* contracts-bedrock: test updates for SystemConfig/L1Block type changes

* contracts-bedrock: initialize SystemConfig

* contracts-bedrock: batcher hash initialize arg

* contracts-bedrock: all mutable sys config fields now initialize

* contracts-bedrock: update gas-snapshot

* contracts-bedrock: rename deployment system config

Prevent name collisions between contracts

* contracts-bedrock: regenerate storage layout

* contracts-bedrock: lint

* op-bindings: regenerate

* op-node: fix test build

* op-chain-ops: remove dead storage config

* tests: fixup

* tests: fix build

* op-bindings,op-chain-ops,op-node: System config bindings and integration (#3789)

* op-chain-ops,op-bindings,op-node: integrate system config

* op-e2e: system config action tests (#3790)

* op-e2e: system config action tests

* op-e2e: decimals separator formatting fix
Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>

* bindings

* contracts-bedrock: update gas snapshot

* contracts-bedrock: sys config owner address in hardhat

* op-e2e: remove temporary function usage stubs

* op-e2e: add action test descriptions for batcher key and gpo updates

* op-node: fix fuzzing test, batcher hash must be padded

* reset go.work

* update go mod/sum

* remove dead import

* remove more dead config
Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>
Co-authored-by: default avatarMatthew Slipper <me@matthewslipper.com>
parent a60e3979
...@@ -20,7 +20,7 @@ use ( ...@@ -20,7 +20,7 @@ use (
./teleportr ./teleportr
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
// For local debugging: // For local debugging:
//replace github.com/ethereum/go-ethereum v1.10.23 => ../go-ethereum //replace github.com/ethereum/go-ethereum v1.10.23 => ../go-ethereum
This diff is collapsed.
...@@ -70,4 +70,4 @@ require ( ...@@ -70,4 +70,4 @@ require (
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -147,8 +147,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF ...@@ -147,8 +147,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU= github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU=
......
...@@ -5,8 +5,9 @@ pkg := bindings ...@@ -5,8 +5,9 @@ pkg := bindings
all: version mkdir bindings more all: version mkdir bindings more
bindings: l1block-bindings \ bindings: l1block-bindings \
system-config-bindings \
l1-cross-domain-messenger-bindings \ l1-cross-domain-messenger-bindings \
l1-standard-bridge-bindings \ l1-standard-bridge-bindings \
l2-to-l1-message-passer-bindings \ l2-to-l1-message-passer-bindings \
optimism-portal-bindings \ optimism-portal-bindings \
l2-output-oracle-bindings \ l2-output-oracle-bindings \
...@@ -37,6 +38,9 @@ compile: ...@@ -37,6 +38,9 @@ compile:
yarn clean && \ yarn clean && \
npx hardhat compile npx hardhat compile
system-config-bindings: compile
./gen_bindings.sh contracts/L1/SystemConfig.sol:SystemConfig $(pkg)
l1-cross-domain-messenger-bindings: compile l1-cross-domain-messenger-bindings: compile
./gen_bindings.sh contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger $(pkg) ./gen_bindings.sh contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger $(pkg)
...@@ -116,7 +120,7 @@ more: ...@@ -116,7 +120,7 @@ more:
go run ./gen/main.go \ go run ./gen/main.go \
-artifacts ../packages/contracts-bedrock/artifacts \ -artifacts ../packages/contracts-bedrock/artifacts \
-out ./bindings \ -out ./bindings \
-contracts OptimismMintableERC20Factory,L2StandardBridge,L1BlockNumber,LegacyMessagePasser,DeployerWhitelist,Proxy,OptimismPortal,L2ToL1MessagePasser,L2CrossDomainMessenger,GasPriceOracle,L1Block,LegacyERC20ETH,WETH9,GovernanceToken,L1CrossDomainMessenger,L2ERC721Bridge,OptimismMintableERC721Factory,ProxyAdmin \ -contracts SystemConfig,OptimismMintableERC20Factory,L2StandardBridge,L1BlockNumber,LegacyMessagePasser,DeployerWhitelist,Proxy,OptimismPortal,L2ToL1MessagePasser,L2CrossDomainMessenger,GasPriceOracle,SequencerFeeVault,L1Block,LegacyERC20ETH,WETH9,GovernanceToken,L1CrossDomainMessenger,L2ERC721Bridge,OptimismMintableERC721Factory,ProxyAdmin \
-package bindings -package bindings
mkdir: mkdir:
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const DeployerWhitelistStorageLayoutJSON = "{\"storage\":[{\"astId\":4126,\"contract\":\"contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist\",\"label\":\"owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":4131,\"contract\":\"contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist\",\"label\":\"whitelist\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_bool\"}}}" const DeployerWhitelistStorageLayoutJSON = "{\"storage\":[{\"astId\":4375,\"contract\":\"contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist\",\"label\":\"owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":4380,\"contract\":\"contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist\",\"label\":\"whitelist\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_bool\"}}}"
var DeployerWhitelistStorageLayout = new(solc.StorageLayout) var DeployerWhitelistStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const GovernanceTokenStorageLayoutJSON = "{\"storage\":[{\"astId\":30104,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":30110,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":30112,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":30114,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":30116,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":31481,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_nonces\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_mapping(t_address,t_struct(Counter)33667_storage)\"},{\"astId\":31489,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_PERMIT_TYPEHASH_DEPRECATED_SLOT\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_bytes32\"},{\"astId\":30822,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_delegates\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_mapping(t_address,t_address)\"},{\"astId\":30828,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_checkpoints\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_mapping(t_address,t_array(t_struct(Checkpoint)30813_storage)dyn_storage)\"},{\"astId\":30832,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupplyCheckpoints\",\"offset\":0,\"slot\":\"9\",\"type\":\"t_array(t_struct(Checkpoint)30813_storage)dyn_storage\"},{\"astId\":29754,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"10\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_struct(Checkpoint)30813_storage)dyn_storage\":{\"encoding\":\"dynamic_array\",\"label\":\"struct ERC20Votes.Checkpoint[]\",\"numberOfBytes\":\"32\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_address,t_address)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e address)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_address\"},\"t_mapping(t_address,t_array(t_struct(Checkpoint)30813_storage)dyn_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct ERC20Votes.Checkpoint[])\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_array(t_struct(Checkpoint)30813_storage)dyn_storage\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_struct(Counter)33667_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct Counters.Counter)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_struct(Counter)33667_storage\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_struct(Checkpoint)30813_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ERC20Votes.Checkpoint\",\"numberOfBytes\":\"32\"},\"t_struct(Counter)33667_storage\":{\"encoding\":\"inplace\",\"label\":\"struct Counters.Counter\",\"numberOfBytes\":\"32\"},\"t_uint224\":{\"encoding\":\"inplace\",\"label\":\"uint224\",\"numberOfBytes\":\"28\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"}}}" const GovernanceTokenStorageLayoutJSON = "{\"storage\":[{\"astId\":30177,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":30183,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":30185,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":30187,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":30189,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":31554,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_nonces\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_mapping(t_address,t_struct(Counter)33740_storage)\"},{\"astId\":31562,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_PERMIT_TYPEHASH_DEPRECATED_SLOT\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_bytes32\"},{\"astId\":30895,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_delegates\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_mapping(t_address,t_address)\"},{\"astId\":30901,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_checkpoints\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_mapping(t_address,t_array(t_struct(Checkpoint)30886_storage)dyn_storage)\"},{\"astId\":30905,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_totalSupplyCheckpoints\",\"offset\":0,\"slot\":\"9\",\"type\":\"t_array(t_struct(Checkpoint)30886_storage)dyn_storage\"},{\"astId\":29827,\"contract\":\"contracts/L2/GovernanceToken.sol:GovernanceToken\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"10\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_struct(Checkpoint)30886_storage)dyn_storage\":{\"encoding\":\"dynamic_array\",\"label\":\"struct ERC20Votes.Checkpoint[]\",\"numberOfBytes\":\"32\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_address,t_address)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e address)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_address\"},\"t_mapping(t_address,t_array(t_struct(Checkpoint)30886_storage)dyn_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct ERC20Votes.Checkpoint[])\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_array(t_struct(Checkpoint)30886_storage)dyn_storage\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_struct(Counter)33740_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e struct Counters.Counter)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_struct(Counter)33740_storage\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_struct(Checkpoint)30886_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ERC20Votes.Checkpoint\",\"numberOfBytes\":\"32\"},\"t_struct(Counter)33740_storage\":{\"encoding\":\"inplace\",\"label\":\"struct Counters.Counter\",\"numberOfBytes\":\"32\"},\"t_uint224\":{\"encoding\":\"inplace\",\"label\":\"uint224\",\"numberOfBytes\":\"28\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"}}}"
var GovernanceTokenStorageLayout = new(solc.StorageLayout) var GovernanceTokenStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L1CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":25943,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":29131,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29134,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":29745,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":29003,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":29123,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29296,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_paused\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":29401,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29416,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_status\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":29460,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":25995,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26000,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26005,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26008,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":26011,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":26016,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"receivedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26021,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_array(t_uint256)42_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)42_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[42]\",\"numberOfBytes\":\"1344\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const L1CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":26016,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":29204,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29207,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":29818,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":29076,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":29196,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29369,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_paused\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":29474,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29489,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"_status\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":29533,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":26068,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26073,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26078,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26081,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":26084,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":26089,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"receivedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26094,\"contract\":\"contracts/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_array(t_uint256)42_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)42_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[42]\",\"numberOfBytes\":\"1344\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var L1CrossDomainMessengerStorageLayout = new(solc.StorageLayout) var L1CrossDomainMessengerStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L2CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":25943,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":29131,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29134,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":29745,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":29003,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":29123,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29296,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_paused\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":29401,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29416,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_status\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":29460,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":25995,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26000,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26005,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26008,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":26011,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":26016,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"receivedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26021,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_array(t_uint256)42_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)42_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[42]\",\"numberOfBytes\":\"1344\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const L2CrossDomainMessengerStorageLayoutJSON = "{\"storage\":[{\"astId\":26016,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":29204,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_initialized\",\"offset\":20,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29207,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_initializing\",\"offset\":21,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":29818,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":29076,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":29196,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29369,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_paused\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_bool\"},{\"astId\":29474,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":29489,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"_status\",\"offset\":0,\"slot\":\"151\",\"type\":\"t_uint256\"},{\"astId\":29533,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"152\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":26068,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_201_0_32\",\"offset\":0,\"slot\":\"201\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26073,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"spacer_202_0_32\",\"offset\":0,\"slot\":\"202\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26078,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"successfulMessages\",\"offset\":0,\"slot\":\"203\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26081,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"xDomainMsgSender\",\"offset\":0,\"slot\":\"204\",\"type\":\"t_address\"},{\"astId\":26084,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"msgNonce\",\"offset\":0,\"slot\":\"205\",\"type\":\"t_uint240\"},{\"astId\":26089,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"receivedMessages\",\"offset\":0,\"slot\":\"206\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":26094,\"contract\":\"contracts/L2/L2CrossDomainMessenger.sol:L2CrossDomainMessenger\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"207\",\"type\":\"t_array(t_uint256)42_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)42_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[42]\",\"numberOfBytes\":\"1344\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint240\":{\"encoding\":\"inplace\",\"label\":\"uint240\",\"numberOfBytes\":\"30\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var L2CrossDomainMessengerStorageLayout = new(solc.StorageLayout) var L2CrossDomainMessengerStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L2ERC721BridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":26426,\"contract\":\"contracts/L2/L2ERC721Bridge.sol:L2ERC721Bridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_array(t_uint256)49_storage\"}],\"types\":{\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const L2ERC721BridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":26499,\"contract\":\"contracts/L2/L2ERC721Bridge.sol:L2ERC721Bridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_array(t_uint256)49_storage\"}],\"types\":{\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var L2ERC721BridgeStorageLayout = new(solc.StorageLayout) var L2ERC721BridgeStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L2StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":28294,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":28297,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":28304,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28309,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const L2StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":28367,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":28370,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":28377,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":28382,\"contract\":\"contracts/L2/L2StandardBridge.sol:L2StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var L2StandardBridgeStorageLayout = new(solc.StorageLayout) var L2StandardBridgeStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":3026,\"contract\":\"contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser\",\"label\":\"sentMessages\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":3029,\"contract\":\"contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser\",\"label\":\"nonce\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const L2ToL1MessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":3183,\"contract\":\"contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser\",\"label\":\"sentMessages\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_bool)\"},{\"astId\":3186,\"contract\":\"contracts/L2/L2ToL1MessagePasser.sol:L2ToL1MessagePasser\",\"label\":\"nonce\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout) var L2ToL1MessagePasserStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const LegacyERC20ETHStorageLayoutJSON = "{\"storage\":[{\"astId\":30104,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":30110,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":30112,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":30114,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":30116,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":26816,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"remoteToken\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_address\"},{\"astId\":26819,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"bridge\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const LegacyERC20ETHStorageLayoutJSON = "{\"storage\":[{\"astId\":30177,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_balances\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_uint256)\"},{\"astId\":30183,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_allowances\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":30185,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_totalSupply\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_uint256\"},{\"astId\":30187,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_name\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_string_storage\"},{\"astId\":30189,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"_symbol\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_string_storage\"},{\"astId\":26889,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"remoteToken\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_address\"},{\"astId\":26892,\"contract\":\"contracts/legacy/LegacyERC20ETH.sol:LegacyERC20ETH\",\"label\":\"bridge\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var LegacyERC20ETHStorageLayout = new(solc.StorageLayout) var LegacyERC20ETHStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const LegacyMessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":4769,\"contract\":\"contracts/legacy/LegacyMessagePasser.sol:LegacyMessagePasser\",\"label\":\"sentMessages\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"}}}" const LegacyMessagePasserStorageLayoutJSON = "{\"storage\":[{\"astId\":5018,\"contract\":\"contracts/legacy/LegacyMessagePasser.sol:LegacyMessagePasser\",\"label\":\"sentMessages\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"}}}"
var LegacyMessagePasserStorageLayout = new(solc.StorageLayout) var LegacyMessagePasserStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const OptimismMintableERC721FactoryStorageLayoutJSON = "{\"storage\":[{\"astId\":27366,\"contract\":\"contracts/universal/OptimismMintableERC721Factory.sol:OptimismMintableERC721Factory\",\"label\":\"isOptimismMintableERC721\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_bool\"}}}" const OptimismMintableERC721FactoryStorageLayoutJSON = "{\"storage\":[{\"astId\":27439,\"contract\":\"contracts/universal/OptimismMintableERC721Factory.sol:OptimismMintableERC721Factory\",\"label\":\"isOptimismMintableERC721\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_address,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_bool\"}}}"
var OptimismMintableERC721FactoryStorageLayout = new(solc.StorageLayout) var OptimismMintableERC721FactoryStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":29944,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29947,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1618,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1588_storage\"},{\"astId\":1623,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":1189,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":1202,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_struct(ResourceParams)1588_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}" const OptimismPortalStorageLayoutJSON = "{\"storage\":[{\"astId\":30017,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":30020,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1618,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"params\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_struct(ResourceParams)1588_storage\"},{\"astId\":1623,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_array(t_uint256)48_storage\"},{\"astId\":1189,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"l2Sender\",\"offset\":0,\"slot\":\"50\",\"type\":\"t_address\"},{\"astId\":1202,\"contract\":\"contracts/L1/OptimismPortal.sol:OptimismPortal\",\"label\":\"finalizedWithdrawals\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_mapping(t_bytes32,t_bool)\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)48_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[48]\",\"numberOfBytes\":\"1536\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_bool\"},\"t_struct(ResourceParams)1588_storage\":{\"encoding\":\"inplace\",\"label\":\"struct ResourceMetering.ResourceParams\",\"numberOfBytes\":\"32\"},\"t_uint128\":{\"encoding\":\"inplace\",\"label\":\"uint128\",\"numberOfBytes\":\"16\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var OptimismPortalStorageLayout = new(solc.StorageLayout) var OptimismPortalStorageLayout = new(solc.StorageLayout)
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const ProxyAdminStorageLayoutJSON = "{\"storage\":[{\"astId\":37204,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":27766,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"proxyType\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_enum(ProxyType)27760)\"},{\"astId\":27771,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"implementationName\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_string_storage)\"},{\"astId\":27775,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"addressManager\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_contract(AddressManager)4116\"},{\"astId\":27779,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"upgrading\",\"offset\":20,\"slot\":\"3\",\"type\":\"t_bool\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_contract(AddressManager)4116\":{\"encoding\":\"inplace\",\"label\":\"contract AddressManager\",\"numberOfBytes\":\"20\"},\"t_enum(ProxyType)27760\":{\"encoding\":\"inplace\",\"label\":\"enum ProxyAdmin.ProxyType\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_enum(ProxyType)27760)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e enum ProxyAdmin.ProxyType)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_enum(ProxyType)27760\"},\"t_mapping(t_address,t_string_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e string)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_string_storage\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"}}}" const ProxyAdminStorageLayoutJSON = "{\"storage\":[{\"astId\":37277,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"owner\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":27839,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"proxyType\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_address,t_enum(ProxyType)27833)\"},{\"astId\":27844,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"implementationName\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_string_storage)\"},{\"astId\":27848,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"addressManager\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_contract(AddressManager)4365\"},{\"astId\":27852,\"contract\":\"contracts/universal/ProxyAdmin.sol:ProxyAdmin\",\"label\":\"upgrading\",\"offset\":20,\"slot\":\"3\",\"type\":\"t_bool\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_contract(AddressManager)4365\":{\"encoding\":\"inplace\",\"label\":\"contract AddressManager\",\"numberOfBytes\":\"20\"},\"t_enum(ProxyType)27833\":{\"encoding\":\"inplace\",\"label\":\"enum ProxyAdmin.ProxyType\",\"numberOfBytes\":\"1\"},\"t_mapping(t_address,t_enum(ProxyType)27833)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e enum ProxyAdmin.ProxyType)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_enum(ProxyType)27833\"},\"t_mapping(t_address,t_string_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e string)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_string_storage\"},\"t_string_storage\":{\"encoding\":\"bytes\",\"label\":\"string\",\"numberOfBytes\":\"32\"}}}"
var ProxyAdminStorageLayout = new(solc.StorageLayout) var ProxyAdminStorageLayout = new(solc.StorageLayout)
......
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const SequencerFeeVaultStorageLayoutJSON = "{\"storage\":[{\"astId\":3104,\"contract\":\"contracts/L2/SequencerFeeVault.sol:SequencerFeeVault\",\"label\":\"l1FeeWallet\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"}}}" const SequencerFeeVaultStorageLayoutJSON = "{\"storage\":[{\"astId\":3325,\"contract\":\"contracts/L2/SequencerFeeVault.sol:SequencerFeeVault\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"}}}"
var SequencerFeeVaultStorageLayout = new(solc.StorageLayout) var SequencerFeeVaultStorageLayout = new(solc.StorageLayout)
var SequencerFeeVaultDeployedBin = "0x6080604052600436106100435760003560e01c80633ccfd60b1461004f57806354fd4d5014610066578063d3e5792b14610091578063d4ff9218146100bb57600080fd5b3661004a57005b600080fd5b34801561005b57600080fd5b5061006461010d565b005b34801561007257600080fd5b5061007b610296565b60405161008891906104f0565b60405180910390f35b34801561009d57600080fd5b506100ad67d02ab486cedc000081565b604051908152602001610088565b3480156100c757600080fd5b506000546100e89073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610088565b67d02ab486cedc00004710156101cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605360248201527f53657175656e6365724665655661756c743a207769746864726177616c20616d60448201527f6f756e74206d7573742062652067726561746572207468616e206d696e696d7560648201527f6d207769746864726177616c20616d6f756e7400000000000000000000000000608482015260a40160405180910390fd5b600080546040805160208101825283815290517fa3a795480000000000000000000000000000000000000000000000000000000081527342000000000000000000000000000000000000109363a3a795489347936102629373deaddeaddeaddeaddeaddeaddeaddeaddead00009373ffffffffffffffffffffffffffffffffffffffff909316924792909160040161050a565b6000604051808303818588803b15801561027b57600080fd5b505af115801561028f573d6000803e3d6000fd5b5050505050565b60606102c17f0000000000000000000000000000000000000000000000000000000000000000610339565b6102ea7f0000000000000000000000000000000000000000000000000000000000000000610339565b6103137f0000000000000000000000000000000000000000000000000000000000000000610339565b60405160200161032593929190610560565b604051602081830303815290604052905090565b60608160000361037c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156103a6578061039081610605565b915061039f9050600a8361066c565b9150610380565b60008167ffffffffffffffff8111156103c1576103c1610680565b6040519080825280601f01601f1916602001820160405280156103eb576020820181803683370190505b5090505b841561046e576104006001836106af565b915061040d600a866106c6565b6104189060306106da565b60f81b81838151811061042d5761042d6106f2565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610467600a8661066c565b94506103ef565b949350505050565b60005b83811015610491578181015183820152602001610479565b838111156104a0576000848401525b50505050565b600081518084526104be816020860160208601610476565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061050360208301846104a6565b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015263ffffffff8416606083015260a0608083015261055560a08301846104a6565b979650505050505050565b60008451610572818460208901610476565b80830190507f2e0000000000000000000000000000000000000000000000000000000000000080825285516105ae816001850160208a01610476565b600192019182015283516105c9816002840160208801610476565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610636576106366105d6565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261067b5761067b61063d565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000828210156106c1576106c16105d6565b500390565b6000826106d5576106d561063d565b500690565b600082198211156106ed576106ed6105d6565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a" var SequencerFeeVaultDeployedBin = "0x60806040526004361061005e5760003560e01c806354fd4d501161004357806354fd4d50146100df578063d3e5792b14610101578063d4ff92181461014357600080fd5b80630d9019e11461006a5780633ccfd60b146100c857600080fd5b3661006557005b600080fd5b34801561007657600080fd5b5061009e7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156100d457600080fd5b506100dd610176565b005b3480156100eb57600080fd5b506100f461037d565b6040516100bf91906105d7565b34801561010d57600080fd5b506101357f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100bf565b34801561014f57600080fd5b507f000000000000000000000000000000000000000000000000000000000000000061009e565b7f0000000000000000000000000000000000000000000000000000000000000000471015610250576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604a60248201527f4665655661756c743a207769746864726177616c20616d6f756e74206d75737460448201527f2062652067726561746572207468616e206d696e696d756d207769746864726160648201527f77616c20616d6f756e7400000000000000000000000000000000000000000000608482015260a40160405180910390fd5b60408051478082527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166020830152338284015291517fc8a211cc64b6ed1b50595a9fcb1932b6d1e5a6e8ef15b60e5b1f988ea9086bba9181900360600190a1604080516020810182526000815290517fe11013dd0000000000000000000000000000000000000000000000000000000081527342000000000000000000000000000000000000109163e11013dd918491610348917f000000000000000000000000000000000000000000000000000000000000000091614e20916004016105f1565b6000604051808303818588803b15801561036157600080fd5b505af1158015610375573d6000803e3d6000fd5b505050505050565b60606103a87f0000000000000000000000000000000000000000000000000000000000000000610420565b6103d17f0000000000000000000000000000000000000000000000000000000000000000610420565b6103fa7f0000000000000000000000000000000000000000000000000000000000000000610420565b60405160200161040c93929190610635565b604051602081830303815290604052905090565b60608160000361046357505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561048d5780610477816106da565b91506104869050600a83610741565b9150610467565b60008167ffffffffffffffff8111156104a8576104a8610755565b6040519080825280601f01601f1916602001820160405280156104d2576020820181803683370190505b5090505b8415610555576104e7600183610784565b91506104f4600a8661079b565b6104ff9060306107af565b60f81b818381518110610514576105146107c7565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061054e600a86610741565b94506104d6565b949350505050565b60005b83811015610578578181015183820152602001610560565b83811115610587576000848401525b50505050565b600081518084526105a581602086016020860161055d565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006105ea602083018461058d565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff8316602082015260606040820152600061062c606083018461058d565b95945050505050565b6000845161064781846020890161055d565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610683816001850160208a0161055d565b6001920191820152835161069e81600284016020880161055d565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361070b5761070b6106ab565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261075057610750610712565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082821015610796576107966106ab565b500390565b6000826107aa576107aa610712565b500690565b600082198211156107c2576107c26106ab565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
func init() { func init() {
if err := json.Unmarshal([]byte(SequencerFeeVaultStorageLayoutJSON), SequencerFeeVaultStorageLayout); err != nil { if err := json.Unmarshal([]byte(SequencerFeeVaultStorageLayoutJSON), SequencerFeeVaultStorageLayout); err != nil {
......
This diff is collapsed.
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package bindings
import (
"encoding/json"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
const SystemConfigStorageLayoutJSON = "{\"storage\":[{\"astId\":29204,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":29207,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":29818,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_array(t_uint256)50_storage\"},{\"astId\":29076,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"_owner\",\"offset\":0,\"slot\":\"51\",\"type\":\"t_address\"},{\"astId\":29196,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"52\",\"type\":\"t_array(t_uint256)49_storage\"},{\"astId\":1891,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"overhead\",\"offset\":0,\"slot\":\"101\",\"type\":\"t_uint256\"},{\"astId\":1893,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"scalar\",\"offset\":0,\"slot\":\"102\",\"type\":\"t_uint256\"},{\"astId\":1895,\"contract\":\"contracts/L1/SystemConfig.sol:SystemConfig\",\"label\":\"batcherHash\",\"offset\":0,\"slot\":\"103\",\"type\":\"t_bytes32\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)49_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[49]\",\"numberOfBytes\":\"1568\"},\"t_array(t_uint256)50_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[50]\",\"numberOfBytes\":\"1600\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
var SystemConfigStorageLayout = new(solc.StorageLayout)
var SystemConfigDeployedBin = "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063935f029e11610081578063f2fde38b1161005b578063f2fde38b14610173578063f45e65d814610186578063ffa1ad741461018f57600080fd5b8063935f029e14610144578063c9b26f6114610157578063e81b2c6d1461016a57600080fd5b80635fe6b4d0116100b25780635fe6b4d0146100ff578063715018a6146101145780638da5cb5b1461011c57600080fd5b80630c18c162146100ce57806354fd4d50146100ea575b600080fd5b6100d760655481565b6040519081526020015b60405180910390f35b6100f2610197565b6040516100e191906109e5565b61011261010d366004610a28565b61023a565b005b6101126103ed565b60335460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e1565b610112610152366004610a61565b610401565b610112610165366004610a83565b61049a565b6100d760675481565b610112610181366004610a9c565b610524565b6100d760665481565b6100d7600081565b60606101c27f00000000000000000000000000000000000000000000000000000000000000006105f7565b6101eb7f00000000000000000000000000000000000000000000000000000000000000006105f7565b6102147f00000000000000000000000000000000000000000000000000000000000000006105f7565b60405160200161022693929190610ab7565b604051602081830303815290604052905090565b600054610100900460ff161580801561025a5750600054600160ff909116105b806102745750303b158015610274575060005460ff166001145b610305576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561036357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61036b610734565b61037485610524565b60658490556066839055606782905580156103e657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6103f56107d3565b6103ff6000610854565b565b6104096107d3565b606582905560668190556040805160208101849052908101829052600090606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190529050600160007f1d2b0bda21d56b8bd12d4f94ebacffdfb35f5e226f84b461103bb8beab6353be8360405161048d91906109e5565b60405180910390a3505050565b6104a26107d3565b6067819055604080516020810183905260009101604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905290506000807f1d2b0bda21d56b8bd12d4f94ebacffdfb35f5e226f84b461103bb8beab6353be8360405161051891906109e5565b60405180910390a35050565b61052c6107d3565b73ffffffffffffffffffffffffffffffffffffffff81166105cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102fc565b6105d881610854565b50565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60608160000361063a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610664578061064e81610b5c565b915061065d9050600a83610bc3565b915061063e565b60008167ffffffffffffffff81111561067f5761067f610bd7565b6040519080825280601f01601f1916602001820160405280156106a9576020820181803683370190505b5090505b841561072c576106be600183610c06565b91506106cb600a86610c1d565b6106d6906030610c31565b60f81b8183815181106106eb576106eb610c49565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610725600a86610bc3565b94506106ad565b949350505050565b600054610100900460ff166107cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016102fc565b6103ff6108cb565b60335473ffffffffffffffffffffffffffffffffffffffff1633146103ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102fc565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610962576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016102fc565b6103ff33610854565b60005b8381101561098657818101518382015260200161096e565b83811115610995576000848401525b50505050565b600081518084526109b381602086016020860161096b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006109f8602083018461099b565b9392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a2357600080fd5b919050565b60008060008060808587031215610a3e57600080fd5b610a47856109ff565b966020860135965060408601359560600135945092505050565b60008060408385031215610a7457600080fd5b50508035926020909101359150565b600060208284031215610a9557600080fd5b5035919050565b600060208284031215610aae57600080fd5b6109f8826109ff565b60008451610ac981846020890161096b565b80830190507f2e000000000000000000000000000000000000000000000000000000000000008082528551610b05816001850160208a0161096b565b60019201918201528351610b2081600284016020880161096b565b0160020195945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610b8d57610b8d610b2d565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082610bd257610bd2610b94565b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082821015610c1857610c18610b2d565b500390565b600082610c2c57610c2c610b94565b500690565b60008219821115610c4457610c44610b2d565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea164736f6c634300080f000a"
func init() {
if err := json.Unmarshal([]byte(SystemConfigStorageLayoutJSON), SystemConfigStorageLayout); err != nil {
panic(err)
}
layouts["SystemConfig"] = SystemConfigStorageLayout
deployedBytecodes["SystemConfig"] = SystemConfigDeployedBin
}
...@@ -40,6 +40,6 @@ require ( ...@@ -40,6 +40,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
// github.com/ethereum-optimism/op-geth v0.0.0-20220909213840-e6575c0168f1 // github.com/ethereum-optimism/op-geth v0.0.0-20220909213840-e6575c0168f1
...@@ -28,8 +28,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1 ...@@ -28,8 +28,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
......
...@@ -10,6 +10,5 @@ import ( ...@@ -10,6 +10,5 @@ import (
func TestGethAddresses(t *testing.T) { func TestGethAddresses(t *testing.T) {
// We test if the addresses in geth match those in op-bindings, to avoid an import-cycle: // We test if the addresses in geth match those in op-bindings, to avoid an import-cycle:
// we import geth in the monorepo, and do not want to import op-bindings into geth. // we import geth in the monorepo, and do not want to import op-bindings into geth.
require.Equal(t, GasPriceOracleAddr, core.OVM_GasPriceOracleAddr)
require.Equal(t, L1BlockAddr, core.L1BlockAddr) require.Equal(t, L1BlockAddr, core.L1BlockAddr)
} }
...@@ -12,6 +12,7 @@ const ( ...@@ -12,6 +12,7 @@ const (
DevProxyAdmin = "0x6900000000000000000000000000000000000006" DevProxyAdmin = "0x6900000000000000000000000000000000000006"
DevWETH9 = "0x6900000000000000000000000000000000000007" DevWETH9 = "0x6900000000000000000000000000000000000007"
DevL1ERC721Bridge = "0x6900000000000000000000000000000000000008" DevL1ERC721Bridge = "0x6900000000000000000000000000000000000008"
DevSystemConfig = "0x6900000000000000000000000000000000000009"
) )
var ( var (
...@@ -24,6 +25,7 @@ var ( ...@@ -24,6 +25,7 @@ var (
DevProxyAdminAddr = common.HexToAddress(DevProxyAdmin) DevProxyAdminAddr = common.HexToAddress(DevProxyAdmin)
DevWETH9Addr = common.HexToAddress(DevWETH9) DevWETH9Addr = common.HexToAddress(DevWETH9)
DevL1ERC721BridgeAddr = common.HexToAddress(DevL1ERC721Bridge) DevL1ERC721BridgeAddr = common.HexToAddress(DevL1ERC721Bridge)
DevSystemConfigAddr = common.HexToAddress(DevSystemConfig)
DevPredeploys = make(map[string]*common.Address) DevPredeploys = make(map[string]*common.Address)
) )
...@@ -38,4 +40,5 @@ func init() { ...@@ -38,4 +40,5 @@ func init() {
DevPredeploys["Admin"] = &DevProxyAdminAddr DevPredeploys["Admin"] = &DevProxyAdminAddr
DevPredeploys["WETH9"] = &DevWETH9Addr DevPredeploys["WETH9"] = &DevWETH9Addr
DevPredeploys["L1ERC721Bridge"] = &DevL1ERC721BridgeAddr DevPredeploys["L1ERC721Bridge"] = &DevL1ERC721BridgeAddr
DevPredeploys["SystemConfig"] = &DevSystemConfigAddr
} }
...@@ -39,6 +39,8 @@ type DeployConfig struct { ...@@ -39,6 +39,8 @@ type DeployConfig struct {
L2OutputOracleOwner common.Address `json:"l2OutputOracleOwner"` L2OutputOracleOwner common.Address `json:"l2OutputOracleOwner"`
L2OutputOracleGenesisL2Output common.Hash `json:"l2OutputOracleGenesisL2Output"` L2OutputOracleGenesisL2Output common.Hash `json:"l2OutputOracleGenesisL2Output"`
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"`
...@@ -67,10 +69,10 @@ type DeployConfig struct { ...@@ -67,10 +69,10 @@ type DeployConfig struct {
L2CrossDomainMessengerOwner common.Address `json:"l2CrossDomainMessengerOwner"` L2CrossDomainMessengerOwner common.Address `json:"l2CrossDomainMessengerOwner"`
OptimismBaseFeeRecipient common.Address `json:"optimismBaseFeeRecipient"` OptimismBaseFeeRecipient common.Address `json:"optimismBaseFeeRecipient"`
OptimismL1FeeRecipient common.Address `json:"optimismL1FeeRecipient"` OptimismL1FeeRecipient common.Address `json:"optimismL1FeeRecipient"`
GasPriceOracleOwner common.Address `json:"gasPriceOracleOwner"`
GasPriceOracleOverhead uint `json:"gasPriceOracleOverhead"` GasPriceOracleOwner common.Address `json:"gasPriceOracleOwner"`
GasPriceOracleScalar uint `json:"gasPriceOracleScalar"` GasPriceOracleOverhead uint64 `json:"gasPriceOracleOverhead"`
GasPriceOracleDecimals uint `json:"gasPriceOracleDecimals"` GasPriceOracleScalar uint64 `json:"gasPriceOracleScalar"`
DeploymentWaitConfirmations int `json:"deploymentWaitConfirmations"` DeploymentWaitConfirmations int `json:"deploymentWaitConfirmations"`
...@@ -172,10 +174,8 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block, l2Addrs *L2Add ...@@ -172,10 +174,8 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block, l2Addrs *L2Add
"msgNonce": 0, "msgNonce": 0,
} }
storage["GasPriceOracle"] = state.StorageValues{ storage["GasPriceOracle"] = state.StorageValues{
"_owner": config.GasPriceOracleOwner, // TODO: remove this in the future
"overhead": config.GasPriceOracleOverhead, "_owner": config.GasPriceOracleOwner,
"scalar": config.GasPriceOracleScalar,
"decimals": config.GasPriceOracleDecimals,
} }
storage["L1Block"] = state.StorageValues{ storage["L1Block"] = state.StorageValues{
"number": block.Number(), "number": block.Number(),
...@@ -183,6 +183,9 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block, l2Addrs *L2Add ...@@ -183,6 +183,9 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block, l2Addrs *L2Add
"basefee": block.BaseFee(), "basefee": block.BaseFee(),
"hash": block.Hash(), "hash": block.Hash(),
"sequenceNumber": 0, "sequenceNumber": 0,
"batcherHash": config.BatchSenderAddress.Hash(),
"l1FeeOverhead": config.GasPriceOracleOverhead,
"l1FeeScalar": config.GasPriceOracleScalar,
} }
storage["LegacyERC20ETH"] = state.StorageValues{ storage["LegacyERC20ETH"] = state.StorageValues{
"bridge": predeploys.L2StandardBridge, "bridge": predeploys.L2StandardBridge,
......
...@@ -52,8 +52,6 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro ...@@ -52,8 +52,6 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true, TerminalTotalDifficultyPassed: true,
Optimism: &params.OptimismConfig{ Optimism: &params.OptimismConfig{
L1FeeRecipient: config.OptimismL1FeeRecipient,
BaseFeeRecipient: config.OptimismBaseFeeRecipient,
EIP1559Denominator: eip1559Denom, EIP1559Denominator: eip1559Denom,
EIP1559Elasticity: eip1559Elasticity, EIP1559Elasticity: eip1559Elasticity,
}, },
......
...@@ -9,19 +9,21 @@ import ( ...@@ -9,19 +9,21 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/state"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/ethereum-optimism/optimism/op-chain-ops/state"
) )
var proxies = []string{ var proxies = []string{
"SystemConfigProxy",
"L2OutputOracleProxy", "L2OutputOracleProxy",
"L1CrossDomainMessengerProxy", "L1CrossDomainMessengerProxy",
"L1StandardBridgeProxy", "L1StandardBridgeProxy",
...@@ -65,12 +67,35 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) { ...@@ -65,12 +67,35 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
sysCfgABI, err := bindings.SystemConfigMetaData.GetAbi()
if err != nil {
return nil, err
}
data, err := sysCfgABI.Pack(
"initialize",
config.SystemConfigOwner,
uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(),
)
if err != nil {
return nil, err
}
if _, err := upgradeProxy(
backend,
opts,
depsByName["SystemConfigProxy"].Address,
depsByName["SystemConfig"].Address,
data,
); err != nil {
return nil, err
}
l2ooABI, err := bindings.L2OutputOracleMetaData.GetAbi() l2ooABI, err := bindings.L2OutputOracleMetaData.GetAbi()
if err != nil { if err != nil {
return nil, err return nil, err
} }
data, err := l2ooABI.Pack( data, err = l2ooABI.Pack(
"initialize", "initialize",
config.L2OutputOracleGenesisL2Output, config.L2OutputOracleGenesisL2Output,
config.L2OutputOracleProposer, config.L2OutputOracleProposer,
...@@ -227,6 +252,15 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend) ...@@ -227,6 +252,15 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend)
}) })
} }
constructors = append(constructors, []deployer.Constructor{ constructors = append(constructors, []deployer.Constructor{
{
Name: "SystemConfig",
Args: []interface{}{
config.SystemConfigOwner,
uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(), // left-padded 32 bytes value, version is zero anyway
},
},
{ {
Name: "L2OutputOracle", Name: "L2OutputOracle",
Args: []interface{}{ Args: []interface{}{
...@@ -279,6 +313,15 @@ func l1Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep ...@@ -279,6 +313,15 @@ func l1Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
var err error var err error
switch deployment.Name { switch deployment.Name {
case "SystemConfig":
_, tx, _, err = bindings.DeploySystemConfig(
opts,
backend,
deployment.Args[0].(common.Address),
deployment.Args[1].(*big.Int),
deployment.Args[2].(*big.Int),
deployment.Args[3].(common.Hash),
)
case "L2OutputOracle": case "L2OutputOracle":
_, tx, _, err = bindings.DeployL2OutputOracle( _, tx, _, err = bindings.DeployL2OutputOracle(
opts, opts,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": -1,
"l2OutputOracleProposer": "0x7770000000000000000000000000000000000001", "l2OutputOracleProposer": "0x7770000000000000000000000000000000000001",
"l2OutputOracleOwner": "0x7770000000000000000000000000000000000002", "l2OutputOracleOwner": "0x7770000000000000000000000000000000000002",
"systemConfigOwner": "0x7770000000000000000000000000000000000003",
"l1BlockTime": 15, "l1BlockTime": 15,
"l1GenesisBlockNonce": "0x0", "l1GenesisBlockNonce": "0x0",
"cliqueSignerAddress": "0x0000000000000000000000000000000000000000", "cliqueSignerAddress": "0x0000000000000000000000000000000000000000",
...@@ -44,7 +45,6 @@ ...@@ -44,7 +45,6 @@
"proxyAdminOwner": "0x0000000000000000000000000000000000000000", "proxyAdminOwner": "0x0000000000000000000000000000000000000000",
"gasPriceOracleOverhead": 2100, "gasPriceOracleOverhead": 2100,
"gasPriceOracleScalar": 1000000, "gasPriceOracleScalar": 1000000,
"gasPriceOracleDecimals": 6,
"deploymentWaitConfirmations": 1, "deploymentWaitConfirmations": 1,
"eip1559Denominator": 8, "eip1559Denominator": 8,
"eip1559Elasticity": 2, "eip1559Elasticity": 2,
......
...@@ -48,4 +48,4 @@ require ( ...@@ -48,4 +48,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -33,8 +33,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC ...@@ -33,8 +33,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
......
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
...@@ -62,6 +63,7 @@ type L2Batcher struct { ...@@ -62,6 +63,7 @@ type L2Batcher struct {
l2BufferedBlock eth.BlockID l2BufferedBlock eth.BlockID
l2SubmittedBlock eth.BlockID l2SubmittedBlock eth.BlockID
l2BatcherCfg *BatcherCfg l2BatcherCfg *BatcherCfg
batcherAddr common.Address
} }
func NewL2Batcher(log log.Logger, rollupCfg *rollup.Config, batcherCfg *BatcherCfg, api SyncStatusAPI, l1 L1TxAPI, l2 BlocksAPI) *L2Batcher { func NewL2Batcher(log log.Logger, rollupCfg *rollup.Config, batcherCfg *BatcherCfg, api SyncStatusAPI, l1 L1TxAPI, l2 BlocksAPI) *L2Batcher {
...@@ -73,6 +75,7 @@ func NewL2Batcher(log log.Logger, rollupCfg *rollup.Config, batcherCfg *BatcherC ...@@ -73,6 +75,7 @@ func NewL2Batcher(log log.Logger, rollupCfg *rollup.Config, batcherCfg *BatcherC
l2: l2, l2: l2,
l2BatcherCfg: batcherCfg, l2BatcherCfg: batcherCfg,
l1Signer: types.LatestSignerForChainID(rollupCfg.L1ChainID), l1Signer: types.LatestSignerForChainID(rollupCfg.L1ChainID),
batcherAddr: crypto.PubkeyToAddress(batcherCfg.BatcherKey.PublicKey),
} }
} }
...@@ -105,16 +108,24 @@ func (s *L2Batcher) ActL2BatchBuffer(t Testing) { ...@@ -105,16 +108,24 @@ func (s *L2Batcher) ActL2BatchBuffer(t Testing) {
s.l2BufferedBlock = syncStatus.SafeL2.ID() s.l2BufferedBlock = syncStatus.SafeL2.ID()
s.l2ChannelOut = nil s.l2ChannelOut = nil
} }
// Add the next unsafe block to the channel
if s.l2BufferedBlock.Number >= syncStatus.UnsafeL2.Number {
if s.l2BufferedBlock.Number > syncStatus.UnsafeL2.Number || s.l2BufferedBlock.Hash != syncStatus.UnsafeL2.Hash {
s.log.Error("detected a reorg in L2 chain vs previous buffered information, resetting to safe head now", "safe_head", syncStatus.SafeL2)
s.l2SubmittedBlock = syncStatus.SafeL2.ID()
s.l2BufferedBlock = syncStatus.SafeL2.ID()
s.l2ChannelOut = nil
} else {
s.log.Info("nothing left to submit")
return
}
}
// Create channel if we don't have one yet // Create channel if we don't have one yet
if s.l2ChannelOut == nil { if s.l2ChannelOut == nil {
ch, err := derive.NewChannelOut() ch, err := derive.NewChannelOut()
require.NoError(t, err, "failed to create channel") require.NoError(t, err, "failed to create channel")
s.l2ChannelOut = ch s.l2ChannelOut = ch
} }
// Add the next unsafe block to the channel
if s.l2BufferedBlock.Number >= syncStatus.UnsafeL2.Number {
return
}
block, err := s.l2.BlockByNumber(t.Ctx(), big.NewInt(int64(s.l2BufferedBlock.Number+1))) block, err := s.l2.BlockByNumber(t.Ctx(), big.NewInt(int64(s.l2BufferedBlock.Number+1)))
require.NoError(t, err, "need l2 block %d from sync status", s.l2SubmittedBlock.Number+1) require.NoError(t, err, "need l2 block %d from sync status", s.l2SubmittedBlock.Number+1)
if block.ParentHash() != s.l2BufferedBlock.Hash { if block.ParentHash() != s.l2BufferedBlock.Hash {
...@@ -157,7 +168,7 @@ func (s *L2Batcher) ActL2BatchSubmit(t Testing) { ...@@ -157,7 +168,7 @@ func (s *L2Batcher) ActL2BatchSubmit(t Testing) {
t.Fatalf("failed to output channel data to frame: %v", err) t.Fatalf("failed to output channel data to frame: %v", err)
} }
nonce, err := s.l1.PendingNonceAt(t.Ctx(), s.rollupCfg.BatchSenderAddress) nonce, err := s.l1.PendingNonceAt(t.Ctx(), s.batcherAddr)
require.NoError(t, err, "need batcher nonce") require.NoError(t, err, "need batcher nonce")
gasTipCap := big.NewInt(2 * params.GWei) gasTipCap := big.NewInt(2 * params.GWei)
......
...@@ -102,3 +102,17 @@ func (s *L2Sequencer) ActBuildToL1Head(t Testing) { ...@@ -102,3 +102,17 @@ func (s *L2Sequencer) ActBuildToL1Head(t Testing) {
s.ActL2EndBlock(t) s.ActL2EndBlock(t)
} }
} }
// ActBuildToL1HeadExcl builds empty blocks until (excl.) the L1 head becomes the L2 origin
func (s *L2Sequencer) ActBuildToL1HeadExcl(t Testing) {
for {
s.ActL2PipelineFull(t)
nextOrigin, err := s.l1OriginSelector.FindL1Origin(t.Ctx(), s.l1State.L1Head(), s.derivation.UnsafeL2Head())
require.NoError(t, err)
if nextOrigin.Number >= s.l1State.L1Head().Number {
break
}
s.ActL2StartBlock(t)
s.ActL2EndBlock(t)
}
}
...@@ -49,7 +49,7 @@ func TestReorgOrphanBlock(gt *testing.T) { ...@@ -49,7 +49,7 @@ func TestReorgOrphanBlock(gt *testing.T) {
// new L1 block with L2 batch // new L1 block with L2 batch
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
batchTx := miner.l1Transactions[0] batchTx := miner.l1Transactions[0]
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
...@@ -81,7 +81,7 @@ func TestReorgOrphanBlock(gt *testing.T) { ...@@ -81,7 +81,7 @@ func TestReorgOrphanBlock(gt *testing.T) {
// and there's no way to manually trigger runReorg, so we re-insert it ourselves. // and there's no way to manually trigger runReorg, so we re-insert it ourselves.
require.NoError(t, miner.eth.TxPool().AddLocal(batchTx)) require.NoError(t, miner.eth.TxPool().AddLocal(batchTx))
// need to re-insert previously included tx into the block // need to re-insert previously included tx into the block
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
// sync the verifier again: now it should be safe again // sync the verifier again: now it should be safe again
...@@ -134,7 +134,7 @@ func TestReorgFlipFlop(gt *testing.T) { ...@@ -134,7 +134,7 @@ func TestReorgFlipFlop(gt *testing.T) {
// new L1 block A1 with L2 batch // new L1 block A1 with L2 batch
miner.ActL1SetFeeRecipient(common.Address{'A', 1}) miner.ActL1SetFeeRecipient(common.Address{'A', 1})
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
batchTxA := miner.l1Transactions[0] batchTxA := miner.l1Transactions[0]
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
...@@ -159,7 +159,7 @@ func TestReorgFlipFlop(gt *testing.T) { ...@@ -159,7 +159,7 @@ func TestReorgFlipFlop(gt *testing.T) {
miner.ActL1SetFeeRecipient(common.Address{'B', 1}) miner.ActL1SetFeeRecipient(common.Address{'B', 1})
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
require.NoError(t, miner.eth.TxPool().AddLocal(batchTxA)) require.NoError(t, miner.eth.TxPool().AddLocal(batchTxA))
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
// make B2, the reorg is picked up when we have a new longer chain // make B2, the reorg is picked up when we have a new longer chain
...@@ -188,7 +188,7 @@ func TestReorgFlipFlop(gt *testing.T) { ...@@ -188,7 +188,7 @@ func TestReorgFlipFlop(gt *testing.T) {
batcher.ActSubmitAll(t) batcher.ActSubmitAll(t)
miner.ActL1SetFeeRecipient(common.Address{'B', 3}) miner.ActL1SetFeeRecipient(common.Address{'B', 3})
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
// sync the verifier to the L2 chain with origin B2 // sync the verifier to the L2 chain with origin B2
...@@ -215,7 +215,7 @@ func TestReorgFlipFlop(gt *testing.T) { ...@@ -215,7 +215,7 @@ func TestReorgFlipFlop(gt *testing.T) {
miner.ActL1SetFeeRecipient(common.Address{'A', 2}) miner.ActL1SetFeeRecipient(common.Address{'A', 2})
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
require.NoError(t, miner.eth.TxPool().AddLocal(batchTxA)) // replay chain A batches, but now in A2 instead of A1 require.NoError(t, miner.eth.TxPool().AddLocal(batchTxA)) // replay chain A batches, but now in A2 instead of A1
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
// build more L1 blocks, so the chain is long enough for reorg to be picked up // build more L1 blocks, so the chain is long enough for reorg to be picked up
...@@ -244,7 +244,7 @@ func TestReorgFlipFlop(gt *testing.T) { ...@@ -244,7 +244,7 @@ func TestReorgFlipFlop(gt *testing.T) {
batcher.ActSubmitAll(t) batcher.ActSubmitAll(t)
miner.ActL1SetFeeRecipient(common.Address{'A', 5}) miner.ActL1SetFeeRecipient(common.Address{'A', 5})
miner.ActL1StartBlock(12)(t) miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(sd.RollupCfg.BatchSenderAddress)(t) miner.ActL1IncludeTx(sd.RollupCfg.Genesis.SystemConfig.BatcherAddr)(t)
miner.ActL1EndBlock(t) miner.ActL1EndBlock(t)
// sync verifier to what ths sequencer submitted // sync verifier to what ths sequencer submitted
......
This diff is collapsed.
...@@ -44,7 +44,7 @@ func CollectAddresses(sd *SetupData, dp *DeployParams) (out []common.Address) { ...@@ -44,7 +44,7 @@ func CollectAddresses(sd *SetupData, dp *DeployParams) (out []common.Address) {
sd.RollupCfg.P2PSequencerAddress, sd.RollupCfg.P2PSequencerAddress,
predeploys.SequencerFeeVaultAddr, predeploys.SequencerFeeVaultAddr,
sd.RollupCfg.BatchInboxAddress, sd.RollupCfg.BatchInboxAddress,
sd.RollupCfg.BatchSenderAddress, sd.RollupCfg.Genesis.SystemConfig.BatcherAddr,
sd.RollupCfg.DepositContractAddress, sd.RollupCfg.DepositContractAddress,
) )
// - precompiles // - precompiles
......
...@@ -24,6 +24,7 @@ var DefaultMnemonicConfig = &MnemonicConfig{ ...@@ -24,6 +24,7 @@ var DefaultMnemonicConfig = &MnemonicConfig{
Alice: "m/44'/60'/0'/0/6", Alice: "m/44'/60'/0'/0/6",
Bob: "m/44'/60'/0'/0/7", Bob: "m/44'/60'/0'/0/7",
Mallory: "m/44'/60'/0'/0/8", Mallory: "m/44'/60'/0'/0/8",
SysCfgOwner: "m/44'/60'/0'/0/9",
} }
// MnemonicConfig configures the private keys for the hive testnet. // MnemonicConfig configures the private keys for the hive testnet.
...@@ -33,6 +34,7 @@ type MnemonicConfig struct { ...@@ -33,6 +34,7 @@ type MnemonicConfig struct {
Deployer string Deployer string
CliqueSigner string CliqueSigner string
SysCfgOwner string
// rollup actors // rollup actors
Proposer string Proposer string
...@@ -64,6 +66,10 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) { ...@@ -64,6 +66,10 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
sysCfgOwner, err := wallet.PrivateKey(account(m.SysCfgOwner))
if err != nil {
return nil, err
}
proposer, err := wallet.PrivateKey(account(m.Proposer)) proposer, err := wallet.PrivateKey(account(m.Proposer))
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -92,6 +98,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) { ...@@ -92,6 +98,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {
return &Secrets{ return &Secrets{
Deployer: deployer, Deployer: deployer,
CliqueSigner: cliqueSigner, CliqueSigner: cliqueSigner,
SysCfgOwner: sysCfgOwner,
Proposer: proposer, Proposer: proposer,
Batcher: batcher, Batcher: batcher,
SequencerP2P: sequencerP2P, SequencerP2P: sequencerP2P,
...@@ -105,6 +112,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) { ...@@ -105,6 +112,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {
type Secrets struct { type Secrets struct {
Deployer *ecdsa.PrivateKey Deployer *ecdsa.PrivateKey
CliqueSigner *ecdsa.PrivateKey CliqueSigner *ecdsa.PrivateKey
SysCfgOwner *ecdsa.PrivateKey
// rollup actors // rollup actors
Proposer *ecdsa.PrivateKey Proposer *ecdsa.PrivateKey
...@@ -131,6 +139,7 @@ func (s *Secrets) Addresses() *Addresses { ...@@ -131,6 +139,7 @@ func (s *Secrets) Addresses() *Addresses {
return &Addresses{ return &Addresses{
Deployer: crypto.PubkeyToAddress(s.Deployer.PublicKey), Deployer: crypto.PubkeyToAddress(s.Deployer.PublicKey),
CliqueSigner: crypto.PubkeyToAddress(s.CliqueSigner.PublicKey), CliqueSigner: crypto.PubkeyToAddress(s.CliqueSigner.PublicKey),
SysCfgOwner: crypto.PubkeyToAddress(s.SysCfgOwner.PublicKey),
Proposer: crypto.PubkeyToAddress(s.Proposer.PublicKey), Proposer: crypto.PubkeyToAddress(s.Proposer.PublicKey),
Batcher: crypto.PubkeyToAddress(s.Batcher.PublicKey), Batcher: crypto.PubkeyToAddress(s.Batcher.PublicKey),
SequencerP2P: crypto.PubkeyToAddress(s.SequencerP2P.PublicKey), SequencerP2P: crypto.PubkeyToAddress(s.SequencerP2P.PublicKey),
...@@ -144,6 +153,7 @@ func (s *Secrets) Addresses() *Addresses { ...@@ -144,6 +153,7 @@ func (s *Secrets) Addresses() *Addresses {
type Addresses struct { type Addresses struct {
Deployer common.Address Deployer common.Address
CliqueSigner common.Address CliqueSigner common.Address
SysCfgOwner common.Address
// rollup actors // rollup actors
Proposer common.Address Proposer common.Address
...@@ -160,6 +170,7 @@ func (a *Addresses) All() []common.Address { ...@@ -160,6 +170,7 @@ func (a *Addresses) All() []common.Address {
return []common.Address{ return []common.Address{
a.Deployer, a.Deployer,
a.CliqueSigner, a.CliqueSigner,
a.SysCfgOwner,
a.Proposer, a.Proposer,
a.Batcher, a.Batcher,
a.SequencerP2P, a.SequencerP2P,
......
...@@ -70,6 +70,8 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams { ...@@ -70,6 +70,8 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
L2OutputOracleProposer: addresses.Proposer, L2OutputOracleProposer: addresses.Proposer,
L2OutputOracleOwner: common.Address{}, // tbd L2OutputOracleOwner: common.Address{}, // tbd
SystemConfigOwner: addresses.SysCfgOwner,
L1BlockTime: 15, L1BlockTime: 15,
L1GenesisBlockNonce: 0, L1GenesisBlockNonce: 0,
CliqueSignerAddress: common.Address{}, // proof of stake, no clique CliqueSignerAddress: common.Address{}, // proof of stake, no clique
...@@ -102,7 +104,6 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams { ...@@ -102,7 +104,6 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
GasPriceOracleOwner: common.Address{0: 0x42, 19: 0xf3}, // tbd GasPriceOracleOwner: common.Address{0: 0x42, 19: 0xf3}, // tbd
GasPriceOracleOverhead: 2100, GasPriceOracleOverhead: 2100,
GasPriceOracleScalar: 1000_000, GasPriceOracleScalar: 1000_000,
GasPriceOracleDecimals: 6,
DeploymentWaitConfirmations: 1, DeploymentWaitConfirmations: 1,
EIP1559Elasticity: 10, EIP1559Elasticity: 10,
...@@ -126,6 +127,7 @@ type DeploymentsL1 struct { ...@@ -126,6 +127,7 @@ type DeploymentsL1 struct {
L1StandardBridgeProxy common.Address L1StandardBridgeProxy common.Address
L2OutputOracleProxy common.Address L2OutputOracleProxy common.Address
OptimismPortalProxy common.Address OptimismPortalProxy common.Address
SystemConfigProxy common.Address
} }
// SetupData bundles the L1, L2, rollup and deployment configuration data: everything for a full test setup. // SetupData bundles the L1, L2, rollup and deployment configuration data: everything for a full test setup.
...@@ -193,7 +195,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -193,7 +195,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
Hash: l2Genesis.ToBlock().Hash(), Hash: l2Genesis.ToBlock().Hash(),
Number: 0, Number: 0,
}, },
L2Time: uint64(deployConf.L1GenesisBlockTimestamp), L2Time: uint64(deployConf.L1GenesisBlockTimestamp),
SystemConfig: SystemConfigFromDeployConfig(deployConf),
}, },
BlockTime: deployConf.L2BlockTime, BlockTime: deployConf.L2BlockTime,
MaxSequencerDrift: deployConf.MaxSequencerDrift, MaxSequencerDrift: deployConf.MaxSequencerDrift,
...@@ -203,8 +206,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -203,8 +206,8 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
L2ChainID: new(big.Int).SetUint64(deployConf.L2ChainID), L2ChainID: new(big.Int).SetUint64(deployConf.L2ChainID),
P2PSequencerAddress: deployConf.P2PSequencerAddress, P2PSequencerAddress: deployConf.P2PSequencerAddress,
BatchInboxAddress: deployConf.BatchInboxAddress, BatchInboxAddress: deployConf.BatchInboxAddress,
BatchSenderAddress: deployConf.BatchSenderAddress,
DepositContractAddress: predeploys.DevOptimismPortalAddr, DepositContractAddress: predeploys.DevOptimismPortalAddr,
L1SystemConfigAddress: predeploys.DevSystemConfigAddr,
} }
deploymentsL1 := DeploymentsL1{ deploymentsL1 := DeploymentsL1{
...@@ -212,6 +215,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -212,6 +215,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
L1StandardBridgeProxy: predeploys.DevL1StandardBridgeAddr, L1StandardBridgeProxy: predeploys.DevL1StandardBridgeAddr,
L2OutputOracleProxy: predeploys.DevL2OutputOracleAddr, L2OutputOracleProxy: predeploys.DevL2OutputOracleAddr,
OptimismPortalProxy: predeploys.DevOptimismPortalAddr, OptimismPortalProxy: predeploys.DevOptimismPortalAddr,
SystemConfigProxy: predeploys.DevSystemConfigAddr,
} }
return &SetupData{ return &SetupData{
...@@ -221,3 +225,11 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) * ...@@ -221,3 +225,11 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
DeploymentsL1: deploymentsL1, DeploymentsL1: deploymentsL1,
} }
} }
func SystemConfigFromDeployConfig(deployConfig *genesis.DeployConfig) eth.SystemConfig {
return eth.SystemConfig{
BatcherAddr: deployConfig.BatchSenderAddress,
Overhead: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(deployConfig.GasPriceOracleOverhead))),
Scalar: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(deployConfig.GasPriceOracleScalar))),
}
}
...@@ -157,4 +157,4 @@ require ( ...@@ -157,4 +157,4 @@ require (
lukechampine.com/blake3 v1.1.7 // indirect lukechampine.com/blake3 v1.1.7 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -239,8 +239,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m ...@@ -239,8 +239,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-batcher v0.8.10 h1:nnC6Xs6XH/GHb/hDN+SGzDRed+PxsImPRzk6IZKiX6o= github.com/ethereum-optimism/optimism/op-batcher v0.8.10 h1:nnC6Xs6XH/GHb/hDN+SGzDRed+PxsImPRzk6IZKiX6o=
github.com/ethereum-optimism/optimism/op-batcher v0.8.10/go.mod h1:W7QUdBkKsDm09KVUmBSVww/DiCCglBBNuvcayWnedbc= github.com/ethereum-optimism/optimism/op-batcher v0.8.10/go.mod h1:W7QUdBkKsDm09KVUmBSVww/DiCCglBBNuvcayWnedbc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"time" "time"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-node/client" "github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
...@@ -52,7 +53,8 @@ func TestInvalidDepositInFCU(t *testing.T) { ...@@ -52,7 +53,8 @@ func TestInvalidDepositInFCU(t *testing.T) {
Hash: l2GenesisBlock.Hash(), Hash: l2GenesisBlock.Hash(),
Number: l2GenesisBlock.NumberU64(), Number: l2GenesisBlock.NumberU64(),
}, },
L2Time: l2GenesisBlock.Time(), L2Time: l2GenesisBlock.Time(),
SystemConfig: e2eutils.SystemConfigFromDeployConfig(cfg.DeployConfig),
} }
node, _, err := initL2Geth("l2", big.NewInt(int64(cfg.DeployConfig.L2ChainID)), l2Genesis, writeDefaultJWT(t)) node, _, err := initL2Geth("l2", big.NewInt(int64(cfg.DeployConfig.L2ChainID)), l2Genesis, writeDefaultJWT(t))
...@@ -76,7 +78,7 @@ func TestInvalidDepositInFCU(t *testing.T) { ...@@ -76,7 +78,7 @@ func TestInvalidDepositInFCU(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
// Create the test data (L1 Info Tx and then always failing deposit) // Create the test data (L1 Info Tx and then always failing deposit)
l1Info, err := derive.L1InfoDepositBytes(1, l1Block) l1Info, err := derive.L1InfoDepositBytes(1, l1Block, rollupGenesis.SystemConfig)
require.Nil(t, err) require.Nil(t, err)
// Create a deposit from alice that will always fail (not enough funds) // Create a deposit from alice that will always fail (not enough funds)
......
...@@ -69,6 +69,8 @@ func DefaultSystemConfig(t *testing.T) SystemConfig { ...@@ -69,6 +69,8 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
L2OutputOracleProposer: addresses.Proposer, L2OutputOracleProposer: addresses.Proposer,
L2OutputOracleOwner: common.Address{}, // tbd L2OutputOracleOwner: common.Address{}, // tbd
SystemConfigOwner: addresses.SysCfgOwner,
L1BlockTime: 2, L1BlockTime: 2,
L1GenesisBlockNonce: 4660, L1GenesisBlockNonce: 4660,
CliqueSignerAddress: addresses.CliqueSigner, CliqueSignerAddress: addresses.CliqueSigner,
...@@ -99,7 +101,6 @@ func DefaultSystemConfig(t *testing.T) SystemConfig { ...@@ -99,7 +101,6 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
GasPriceOracleOwner: addresses.Alice, // tbd GasPriceOracleOwner: addresses.Alice, // tbd
GasPriceOracleOverhead: 0, GasPriceOracleOverhead: 0,
GasPriceOracleScalar: 0, GasPriceOracleScalar: 0,
GasPriceOracleDecimals: 0,
DeploymentWaitConfirmations: 1, DeploymentWaitConfirmations: 1,
EIP1559Elasticity: 2, EIP1559Elasticity: 2,
...@@ -278,7 +279,8 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -278,7 +279,8 @@ func (cfg SystemConfig) Start() (*System, error) {
Hash: l2Genesis.ToBlock().Hash(), Hash: l2Genesis.ToBlock().Hash(),
Number: 0, Number: 0,
}, },
L2Time: uint64(cfg.DeployConfig.L1GenesisBlockTimestamp), L2Time: uint64(cfg.DeployConfig.L1GenesisBlockTimestamp),
SystemConfig: e2eutils.SystemConfigFromDeployConfig(cfg.DeployConfig),
}, },
BlockTime: cfg.DeployConfig.L2BlockTime, BlockTime: cfg.DeployConfig.L2BlockTime,
MaxSequencerDrift: cfg.DeployConfig.MaxSequencerDrift, MaxSequencerDrift: cfg.DeployConfig.MaxSequencerDrift,
...@@ -288,8 +290,8 @@ func (cfg SystemConfig) Start() (*System, error) { ...@@ -288,8 +290,8 @@ func (cfg SystemConfig) Start() (*System, error) {
L2ChainID: cfg.L2ChainIDBig(), L2ChainID: cfg.L2ChainIDBig(),
P2PSequencerAddress: cfg.DeployConfig.P2PSequencerAddress, P2PSequencerAddress: cfg.DeployConfig.P2PSequencerAddress,
BatchInboxAddress: cfg.DeployConfig.BatchInboxAddress, BatchInboxAddress: cfg.DeployConfig.BatchInboxAddress,
BatchSenderAddress: cfg.DeployConfig.BatchSenderAddress,
DepositContractAddress: predeploys.DevOptimismPortalAddr, DepositContractAddress: predeploys.DevOptimismPortalAddr,
L1SystemConfigAddress: predeploys.DevSystemConfigAddr,
} }
} }
defaultConfig := makeRollupConfig() defaultConfig := makeRollupConfig()
......
...@@ -476,6 +476,24 @@ func L1InfoFromState(ctx context.Context, contract *bindings.L1Block, l2Number * ...@@ -476,6 +476,24 @@ func L1InfoFromState(ctx context.Context, contract *bindings.L1Block, l2Number *
return derive.L1BlockInfo{}, fmt.Errorf("failed to get sequence number: %w", err) return derive.L1BlockInfo{}, fmt.Errorf("failed to get sequence number: %w", err)
} }
overhead, err := contract.L1FeeOverhead(&opts)
if err != nil {
return derive.L1BlockInfo{}, fmt.Errorf("failed to get l1 fee overhead: %w", err)
}
out.L1FeeOverhead = eth.Bytes32(common.BigToHash(overhead))
scalar, err := contract.L1FeeScalar(&opts)
if err != nil {
return derive.L1BlockInfo{}, fmt.Errorf("failed to get l1 fee scalar: %w", err)
}
out.L1FeeScalar = eth.Bytes32(common.BigToHash(scalar))
batcherHash, err := contract.BatcherHash(&opts)
if err != nil {
return derive.L1BlockInfo{}, fmt.Errorf("failed to get batch sender: %w", err)
}
out.BatcherAddr = common.BytesToAddress(batcherHash[:])
return out, nil return out, nil
} }
...@@ -617,6 +635,9 @@ func TestL1InfoContract(t *testing.T) { ...@@ -617,6 +635,9 @@ func TestL1InfoContract(t *testing.T) {
BaseFee: b.BaseFee(), BaseFee: b.BaseFee(),
BlockHash: h, BlockHash: h,
SequenceNumber: 0, // ignored, will be overwritten SequenceNumber: 0, // ignored, will be overwritten
BatcherAddr: sys.RollupConfig.Genesis.SystemConfig.BatcherAddr,
L1FeeOverhead: sys.RollupConfig.Genesis.SystemConfig.Overhead,
L1FeeScalar: sys.RollupConfig.Genesis.SystemConfig.Scalar,
} }
h = b.ParentHash() h = b.ParentHash()
...@@ -853,6 +874,10 @@ func TestFees(t *testing.T) { ...@@ -853,6 +874,10 @@ func TestFees(t *testing.T) {
} }
cfg := DefaultSystemConfig(t) cfg := DefaultSystemConfig(t)
// TODO: after we have the system config contract and new op-geth L1 cost utils,
// we can pull in l1 costs into every e2e test and account for it in assertions easily etc.
cfg.DeployConfig.GasPriceOracleOverhead = 2100
cfg.DeployConfig.GasPriceOracleScalar = 1000_000
sys, err := cfg.Start() sys, err := cfg.Start()
require.Nil(t, err, "Error starting up system") require.Nil(t, err, "Error starting up system")
...@@ -866,37 +891,9 @@ func TestFees(t *testing.T) { ...@@ -866,37 +891,9 @@ func TestFees(t *testing.T) {
fromAddr := crypto.PubkeyToAddress(ethPrivKey.PublicKey) fromAddr := crypto.PubkeyToAddress(ethPrivKey.PublicKey)
// Find gaspriceoracle contract // Find gaspriceoracle contract
gpoContract, err := bindings.NewGasPriceOracle(common.HexToAddress(predeploys.GasPriceOracle), l2Seq) gpoContract, err := bindings.NewGasPriceOracle(predeploys.GasPriceOracleAddr, l2Seq)
require.Nil(t, err)
// GPO signer
l2opts, err := bind.NewKeyedTransactorWithChainID(ethPrivKey, cfg.L2ChainIDBig())
require.Nil(t, err) require.Nil(t, err)
// Update overhead
tx, err := gpoContract.SetOverhead(l2opts, big.NewInt(2100))
require.Nil(t, err, "sending overhead update tx")
receipt, err := waitForTransaction(tx.Hash(), l2Verif, 10*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
require.Nil(t, err, "waiting for overhead update tx")
require.Equal(t, receipt.Status, types.ReceiptStatusSuccessful, "transaction failed")
// Update decimals
tx, err = gpoContract.SetDecimals(l2opts, big.NewInt(6))
require.Nil(t, err, "sending gpo update tx")
receipt, err = waitForTransaction(tx.Hash(), l2Verif, 10*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
require.Nil(t, err, "waiting for gpo decimals update tx")
require.Equal(t, receipt.Status, types.ReceiptStatusSuccessful, "transaction failed")
// Update scalar
tx, err = gpoContract.SetScalar(l2opts, big.NewInt(1_000_000))
require.Nil(t, err, "sending gpo update tx")
receipt, err = waitForTransaction(tx.Hash(), l2Verif, 10*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
require.Nil(t, err, "waiting for gpo scalar update tx")
require.Equal(t, receipt.Status, types.ReceiptStatusSuccessful, "transaction failed")
overhead, err := gpoContract.Overhead(&bind.CallOpts{}) overhead, err := gpoContract.Overhead(&bind.CallOpts{})
require.Nil(t, err, "reading gpo overhead") require.Nil(t, err, "reading gpo overhead")
decimals, err := gpoContract.Decimals(&bind.CallOpts{}) decimals, err := gpoContract.Decimals(&bind.CallOpts{})
...@@ -929,22 +926,25 @@ func TestFees(t *testing.T) { ...@@ -929,22 +926,25 @@ func TestFees(t *testing.T) {
toAddr := common.Address{0xff, 0xff} toAddr := common.Address{0xff, 0xff}
transferAmount := big.NewInt(1_000_000_000) transferAmount := big.NewInt(1_000_000_000)
gasTip := big.NewInt(10) gasTip := big.NewInt(10)
tx = types.MustSignNewTx(ethPrivKey, types.LatestSignerForChainID(cfg.L2ChainIDBig()), &types.DynamicFeeTx{ tx := types.MustSignNewTx(ethPrivKey, types.LatestSignerForChainID(cfg.L2ChainIDBig()), &types.DynamicFeeTx{
ChainID: cfg.L2ChainIDBig(), ChainID: cfg.L2ChainIDBig(),
Nonce: 3, // Already have deposit Nonce: 0,
To: &toAddr, To: &toAddr,
Value: transferAmount, Value: transferAmount,
GasTipCap: gasTip, GasTipCap: gasTip,
GasFeeCap: big.NewInt(200), GasFeeCap: big.NewInt(200),
Gas: 21000, Gas: 21000,
}) })
sender, err := types.LatestSignerForChainID(cfg.L2ChainIDBig()).Sender(tx)
require.NoError(t, err)
t.Logf("waiting for tx %s from %s to %s", tx.Hash(), sender, tx.To())
err = l2Seq.SendTransaction(context.Background(), tx) err = l2Seq.SendTransaction(context.Background(), tx)
require.Nil(t, err, "Sending L2 tx to sequencer") require.Nil(t, err, "Sending L2 tx to sequencer")
_, err = waitForTransaction(tx.Hash(), l2Seq, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) _, err = waitForTransaction(tx.Hash(), l2Seq, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
require.Nil(t, err, "Waiting for L2 tx on sequencer") require.Nil(t, err, "Waiting for L2 tx on sequencer")
receipt, err = waitForTransaction(tx.Hash(), l2Verif, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second) receipt, err := waitForTransaction(tx.Hash(), l2Verif, 3*time.Duration(cfg.DeployConfig.L1BlockTime)*time.Second)
require.Nil(t, err, "Waiting for L2 tx on verifier") require.Nil(t, err, "Waiting for L2 tx on verifier")
require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status, "TX should have succeeded") require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status, "TX should have succeeded")
...@@ -1002,6 +1002,7 @@ func TestFees(t *testing.T) { ...@@ -1002,6 +1002,7 @@ func TestFees(t *testing.T) {
l1Fee := new(big.Int).Mul(l1GasUsed, l1Header.BaseFee) l1Fee := new(big.Int).Mul(l1GasUsed, l1Header.BaseFee)
l1Fee = l1Fee.Mul(l1Fee, scalar) l1Fee = l1Fee.Mul(l1Fee, scalar)
l1Fee = l1Fee.Div(l1Fee, divisor) l1Fee = l1Fee.Div(l1Fee, divisor)
require.Equal(t, l1Fee, l1FeeRecipientDiff, "l1 fee mismatch") require.Equal(t, l1Fee, l1FeeRecipientDiff, "l1 fee mismatch")
// Tally L1 fee against GasPriceOracle // Tally L1 fee against GasPriceOracle
......
...@@ -11,15 +11,16 @@ import ( ...@@ -11,15 +11,16 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat" "github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
) )
var Subcommands = cli.Commands{ var Subcommands = cli.Commands{
...@@ -62,7 +63,7 @@ var Subcommands = cli.Commands{ ...@@ -62,7 +63,7 @@ var Subcommands = cli.Commands{
return err return err
} }
rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, predeploys.DevOptimismPortalAddr) rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, predeploys.DevOptimismPortalAddr, predeploys.DevSystemConfigAddr)
if err := writeGenesisFile(ctx.String("outfile.l1"), l1Genesis); err != nil { if err := writeGenesisFile(ctx.String("outfile.l1"), l1Genesis); err != nil {
return err return err
...@@ -142,6 +143,10 @@ var Subcommands = cli.Commands{ ...@@ -142,6 +143,10 @@ var Subcommands = cli.Commands{
if err != nil { if err != nil {
return err return err
} }
sysCfgProxy, err := hh.GetDeployment("SystemConfigProxy")
if err != nil {
return err
}
l1ERC721BP, err := hh.GetDeployment("L1ERC721BridgeProxy") l1ERC721BP, err := hh.GetDeployment("L1ERC721BridgeProxy")
if err != nil { if err != nil {
return err return err
...@@ -158,7 +163,7 @@ var Subcommands = cli.Commands{ ...@@ -158,7 +163,7 @@ var Subcommands = cli.Commands{
return fmt.Errorf("error creating l2 developer genesis: %w", err) return fmt.Errorf("error creating l2 developer genesis: %w", err)
} }
rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, portalProxy.Address) rollupConfig := makeRollupConfig(config, l1StartBlock, l2Genesis, portalProxy.Address, sysCfgProxy.Address)
if err := writeGenesisFile(ctx.String("outfile.l2"), l2Genesis); err != nil { if err := writeGenesisFile(ctx.String("outfile.l2"), l2Genesis); err != nil {
return err return err
...@@ -173,6 +178,7 @@ func makeRollupConfig( ...@@ -173,6 +178,7 @@ func makeRollupConfig(
l1StartBlock *types.Block, l1StartBlock *types.Block,
l2Genesis *core.Genesis, l2Genesis *core.Genesis,
portalAddr common.Address, portalAddr common.Address,
sysConfigAddr common.Address,
) *rollup.Config { ) *rollup.Config {
return &rollup.Config{ return &rollup.Config{
Genesis: rollup.Genesis{ Genesis: rollup.Genesis{
...@@ -185,6 +191,11 @@ func makeRollupConfig( ...@@ -185,6 +191,11 @@ func makeRollupConfig(
Number: 0, Number: 0,
}, },
L2Time: l1StartBlock.Time(), L2Time: l1StartBlock.Time(),
SystemConfig: eth.SystemConfig{
BatcherAddr: config.BatchSenderAddress,
Overhead: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(config.GasPriceOracleOverhead))),
Scalar: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(config.GasPriceOracleScalar))),
},
}, },
BlockTime: config.L2BlockTime, BlockTime: config.L2BlockTime,
MaxSequencerDrift: config.MaxSequencerDrift, MaxSequencerDrift: config.MaxSequencerDrift,
...@@ -194,8 +205,8 @@ func makeRollupConfig( ...@@ -194,8 +205,8 @@ func makeRollupConfig(
L2ChainID: new(big.Int).SetUint64(config.L2ChainID), L2ChainID: new(big.Int).SetUint64(config.L2ChainID),
P2PSequencerAddress: config.P2PSequencerAddress, P2PSequencerAddress: config.P2PSequencerAddress,
BatchInboxAddress: config.BatchInboxAddress, BatchInboxAddress: config.BatchInboxAddress,
BatchSenderAddress: config.BatchSenderAddress,
DepositContractAddress: portalAddr, DepositContractAddress: portalAddr,
L1SystemConfigAddress: sysConfigAddr,
} }
} }
......
...@@ -314,3 +314,16 @@ func (f FetchedReceipts) Result() (types.Receipts, error) { ...@@ -314,3 +314,16 @@ func (f FetchedReceipts) Result() (types.Receipts, error) {
} }
var _ ReceiptsFetcher = (FetchedReceipts)(nil) var _ ReceiptsFetcher = (FetchedReceipts)(nil)
// SystemConfig represents the rollup system configuration that carries over in every L2 block,
// and may be changed through L1 system config events.
// The initial SystemConfig at rollup genesis is embedded in the rollup configuration.
type SystemConfig struct {
// BatcherAddr identifies the batch-sender address used in batch-inbox data-transaction filtering.
BatcherAddr common.Address `json:"batcherAddr"`
// Overhead identifies the L1 fee overhead, and is passed through opaquely to op-geth.
Overhead Bytes32 `json:"overhead"`
// Scalar identifies the L1 fee scalar, and is passed through opaquely to op-geth.
Scalar Bytes32 `json:"scalar"`
// More fields can be added for future SystemConfig versions.
}
...@@ -160,4 +160,4 @@ require ( ...@@ -160,4 +160,4 @@ require (
lukechampine.com/blake3 v1.1.7 // indirect lukechampine.com/blake3 v1.1.7 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -188,8 +188,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m ...@@ -188,8 +188,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10 h1:ErDuEO7Dsd7+XXlTWToBN/388IgC8eXjAPgiHoXviw4= github.com/ethereum-optimism/optimism/op-chain-ops v0.8.10 h1:ErDuEO7Dsd7+XXlTWToBN/388IgC8eXjAPgiHoXviw4=
......
...@@ -4,12 +4,13 @@ import ( ...@@ -4,12 +4,13 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
) )
// L1ReceiptsFetcher fetches L1 header info and receipts for the payload attributes derivation (the info tx and deposits) // L1ReceiptsFetcher fetches L1 header info and receipts for the payload attributes derivation (the info tx and deposits)
...@@ -18,16 +19,25 @@ type L1ReceiptsFetcher interface { ...@@ -18,16 +19,25 @@ type L1ReceiptsFetcher interface {
FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
} }
type SystemConfigL2Fetcher interface {
SystemConfigByL2Hash(ctx context.Context, hash common.Hash) (eth.SystemConfig, error)
}
// PreparePayloadAttributes prepares a PayloadAttributes template that is ready to build a L2 block with deposits only, on top of the given l2Parent, with the given epoch as L1 origin. // PreparePayloadAttributes prepares a PayloadAttributes template that is ready to build a L2 block with deposits only, on top of the given l2Parent, with the given epoch as L1 origin.
// The template defaults to NoTxPool=true, and no sequencer transactions: the caller has to modify the template to add transactions, // The template defaults to NoTxPool=true, and no sequencer transactions: the caller has to modify the template to add transactions,
// by setting NoTxPool=false as sequencer, or by appending batch transactions as verifier. // by setting NoTxPool=false as sequencer, or by appending batch transactions as verifier.
// The severity of the error is returned; a crit=false error means there was a temporary issue, like a failed RPC or time-out. // The severity of the error is returned; a crit=false error means there was a temporary issue, like a failed RPC or time-out.
// A crit=true error means the input arguments are inconsistent or invalid. // A crit=true error means the input arguments are inconsistent or invalid.
func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1ReceiptsFetcher, l2Parent eth.L2BlockRef, timestamp uint64, epoch eth.BlockID) (attrs *eth.PayloadAttributes, err error) { func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1ReceiptsFetcher, l2 SystemConfigL2Fetcher, l2Parent eth.L2BlockRef, timestamp uint64, epoch eth.BlockID) (attrs *eth.PayloadAttributes, err error) {
var l1Info eth.BlockInfo var l1Info eth.BlockInfo
var depositTxs []hexutil.Bytes var depositTxs []hexutil.Bytes
var seqNumber uint64 var seqNumber uint64
sysConfig, err := l2.SystemConfigByL2Hash(ctx, l2Parent.Hash)
if err != nil {
return nil, NewTemporaryError(fmt.Errorf("failed to retrieve L2 parent block: %w", err))
}
// If the L1 origin changed this block, then we are in the first block of the epoch. In this // If the L1 origin changed this block, then we are in the first block of the epoch. In this
// case we need to fetch all transaction receipts from the L1 origin block so we can scan for // case we need to fetch all transaction receipts from the L1 origin block so we can scan for
// user deposits. // user deposits.
...@@ -47,6 +57,11 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece ...@@ -47,6 +57,11 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece
// deposits may never be ignored. Failing to process them is a critical error. // deposits may never be ignored. Failing to process them is a critical error.
return nil, NewCriticalError(fmt.Errorf("failed to derive some deposits: %w", err)) return nil, NewCriticalError(fmt.Errorf("failed to derive some deposits: %w", err))
} }
// apply sysCfg changes
if err := UpdateSystemConfigWithL1Receipts(&sysConfig, receipts, cfg); err != nil {
return nil, NewCriticalError(fmt.Errorf("failed to apply derived L1 sysCfg updates: %w", err))
}
l1Info = info l1Info = info
depositTxs = deposits depositTxs = deposits
seqNumber = 0 seqNumber = 0
...@@ -63,7 +78,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece ...@@ -63,7 +78,7 @@ func PreparePayloadAttributes(ctx context.Context, cfg *rollup.Config, dl L1Rece
seqNumber = l2Parent.SequenceNumber + 1 seqNumber = l2Parent.SequenceNumber + 1
} }
l1InfoTx, err := L1InfoDepositBytes(seqNumber, l1Info) l1InfoTx, err := L1InfoDepositBytes(seqNumber, l1Info, sysConfig)
if err != nil { if err != nil {
return nil, NewCriticalError(fmt.Errorf("failed to create l1InfoTx: %w", err)) return nil, NewCriticalError(fmt.Errorf("failed to create l1InfoTx: %w", err))
} }
......
...@@ -6,9 +6,10 @@ import ( ...@@ -6,9 +6,10 @@ import (
"io" "io"
"time" "time"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
) )
// The attributes queue sits in between the batch queue and the engine queue // The attributes queue sits in between the batch queue and the engine queue
...@@ -26,15 +27,17 @@ type AttributesQueue struct { ...@@ -26,15 +27,17 @@ type AttributesQueue struct {
log log.Logger log log.Logger
config *rollup.Config config *rollup.Config
dl L1ReceiptsFetcher dl L1ReceiptsFetcher
eng SystemConfigL2Fetcher
prev *BatchQueue prev *BatchQueue
batch *BatchData batch *BatchData
} }
func NewAttributesQueue(log log.Logger, cfg *rollup.Config, l1Fetcher L1ReceiptsFetcher, prev *BatchQueue) *AttributesQueue { func NewAttributesQueue(log log.Logger, cfg *rollup.Config, l1Fetcher L1ReceiptsFetcher, eng SystemConfigL2Fetcher, prev *BatchQueue) *AttributesQueue {
return &AttributesQueue{ return &AttributesQueue{
log: log, log: log,
config: cfg, config: cfg,
dl: l1Fetcher, dl: l1Fetcher,
eng: eng,
prev: prev, prev: prev,
} }
} }
...@@ -73,7 +76,7 @@ func (aq *AttributesQueue) createNextAttributes(ctx context.Context, batch *Batc ...@@ -73,7 +76,7 @@ func (aq *AttributesQueue) createNextAttributes(ctx context.Context, batch *Batc
} }
fetchCtx, cancel := context.WithTimeout(ctx, 20*time.Second) fetchCtx, cancel := context.WithTimeout(ctx, 20*time.Second)
defer cancel() defer cancel()
attrs, err := PreparePayloadAttributes(fetchCtx, aq.config, aq.dl, l2SafeHead, batch.Timestamp, batch.Epoch()) attrs, err := PreparePayloadAttributes(fetchCtx, aq.config, aq.dl, aq.eng, l2SafeHead, batch.Timestamp, batch.Epoch())
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -88,6 +91,6 @@ func (aq *AttributesQueue) createNextAttributes(ctx context.Context, batch *Batc ...@@ -88,6 +91,6 @@ func (aq *AttributesQueue) createNextAttributes(ctx context.Context, batch *Batc
return attrs, nil return attrs, nil
} }
func (aq *AttributesQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error { func (aq *AttributesQueue) Reset(ctx context.Context, _ eth.L1BlockRef, _ eth.SystemConfig) error {
return io.EOF return io.EOF
} }
...@@ -8,13 +8,14 @@ import ( ...@@ -8,13 +8,14 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog" "github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils" "github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
) )
// TestAttributesQueue checks that it properly uses the PreparePayloadAttributes function // TestAttributesQueue checks that it properly uses the PreparePayloadAttributes function
...@@ -27,6 +28,7 @@ func TestAttributesQueue(t *testing.T) { ...@@ -27,6 +28,7 @@ func TestAttributesQueue(t *testing.T) {
L1ChainID: big.NewInt(101), L1ChainID: big.NewInt(101),
L2ChainID: big.NewInt(102), L2ChainID: big.NewInt(102),
DepositContractAddress: common.Address{0xbb}, DepositContractAddress: common.Address{0xbb},
L1SystemConfigAddress: common.Address{0xcc},
} }
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
...@@ -47,7 +49,21 @@ func TestAttributesQueue(t *testing.T) { ...@@ -47,7 +49,21 @@ func TestAttributesQueue(t *testing.T) {
Transactions: []eth.Data{eth.Data("foobar"), eth.Data("example")}, Transactions: []eth.Data{eth.Data("foobar"), eth.Data("example")},
}} }}
l1InfoTx, err := L1InfoDepositBytes(safeHead.SequenceNumber+1, l1Info) parentL1Cfg := eth.SystemConfig{
BatcherAddr: common.Address{42},
Overhead: [32]byte{},
Scalar: [32]byte{},
}
expectedL1Cfg := eth.SystemConfig{
BatcherAddr: common.Address{42},
Overhead: [32]byte{},
Scalar: [32]byte{},
}
l2Fetcher := &testutils.MockL2Client{}
l2Fetcher.ExpectSystemConfigByL2Hash(safeHead.Hash, parentL1Cfg, nil)
l1InfoTx, err := L1InfoDepositBytes(safeHead.SequenceNumber+1, l1Info, expectedL1Cfg)
require.NoError(t, err) require.NoError(t, err)
attrs := eth.PayloadAttributes{ attrs := eth.PayloadAttributes{
Timestamp: eth.Uint64Quantity(safeHead.Time + cfg.BlockTime), Timestamp: eth.Uint64Quantity(safeHead.Time + cfg.BlockTime),
...@@ -57,7 +73,7 @@ func TestAttributesQueue(t *testing.T) { ...@@ -57,7 +73,7 @@ func TestAttributesQueue(t *testing.T) {
NoTxPool: true, NoTxPool: true,
} }
aq := NewAttributesQueue(testlog.Logger(t, log.LvlError), cfg, l1Fetcher, nil) aq := NewAttributesQueue(testlog.Logger(t, log.LvlError), cfg, l1Fetcher, l2Fetcher, nil)
actual, err := aq.createNextAttributes(context.Background(), batch, safeHead) actual, err := aq.createNextAttributes(context.Background(), batch, safeHead)
......
...@@ -10,21 +10,29 @@ import ( ...@@ -10,21 +10,29 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testutils" "github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
) )
func TestPreparePayloadAttributes(t *testing.T) { func TestPreparePayloadAttributes(t *testing.T) {
// test config, only init the necessary fields // test sysCfg, only init the necessary fields
cfg := &rollup.Config{ cfg := &rollup.Config{
BlockTime: 2, BlockTime: 2,
L1ChainID: big.NewInt(101), L1ChainID: big.NewInt(101),
L2ChainID: big.NewInt(102), L2ChainID: big.NewInt(102),
DepositContractAddress: common.Address{0xbb}, DepositContractAddress: common.Address{0xbb},
L1SystemConfigAddress: common.Address{0xcc},
}
testSysCfg := eth.SystemConfig{
BatcherAddr: common.Address{42},
Overhead: [32]byte{},
Scalar: [32]byte{},
} }
t.Run("inconsistent next height origin", func(t *testing.T) { t.Run("inconsistent next height origin", func(t *testing.T) {
...@@ -32,12 +40,15 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -32,12 +40,15 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoNum = l2Parent.L1Origin.Number + 1 l1Info.InfoNum = l2Parent.L1Origin.Number + 1
epoch := l1Info.ID() epoch := l1Info.ID()
l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil) l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil)
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.NotNil(t, err, "inconsistent L1 origin error expected") require.NotNil(t, err, "inconsistent L1 origin error expected")
require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg") require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg")
}) })
...@@ -46,11 +57,14 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -46,11 +57,14 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoNum = l2Parent.L1Origin.Number l1Info.InfoNum = l2Parent.L1Origin.Number
epoch := l1Info.ID() epoch := l1Info.ID()
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.NotNil(t, err, "inconsistent L1 origin error expected") require.NotNil(t, err, "inconsistent L1 origin error expected")
require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg") require.ErrorIs(t, err, ErrReset, "inconsistent L1 origin transition must be handled like a critical error with reorg")
}) })
...@@ -59,12 +73,15 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -59,12 +73,15 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
epoch := l2Parent.L1Origin epoch := l2Parent.L1Origin
epoch.Number += 1 epoch.Number += 1
mockRPCErr := errors.New("mock rpc error") mockRPCErr := errors.New("mock rpc error")
l1Fetcher.ExpectFetchReceipts(epoch.Hash, nil, nil, mockRPCErr) l1Fetcher.ExpectFetchReceipts(epoch.Hash, nil, nil, mockRPCErr)
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected") require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected")
require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg") require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg")
}) })
...@@ -73,11 +90,14 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -73,11 +90,14 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
epoch := l2Parent.L1Origin epoch := l2Parent.L1Origin
mockRPCErr := errors.New("mock rpc error") mockRPCErr := errors.New("mock rpc error")
l1Fetcher.ExpectInfoByHash(epoch.Hash, nil, mockRPCErr) l1Fetcher.ExpectInfoByHash(epoch.Hash, nil, mockRPCErr)
_, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) _, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected") require.ErrorIs(t, err, mockRPCErr, "mock rpc error expected")
require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg") require.ErrorIs(t, err, ErrTemporary, "rpc errors should not be critical, it is not necessary to reorg")
}) })
...@@ -86,15 +106,18 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -86,15 +106,18 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoParentHash = l2Parent.L1Origin.Hash l1Info.InfoParentHash = l2Parent.L1Origin.Hash
l1Info.InfoNum = l2Parent.L1Origin.Number + 1 l1Info.InfoNum = l2Parent.L1Origin.Number + 1
epoch := l1Info.ID() epoch := l1Info.ID()
l1InfoTx, err := L1InfoDepositBytes(0, l1Info) l1InfoTx, err := L1InfoDepositBytes(0, l1Info, testSysCfg)
require.NoError(t, err) require.NoError(t, err)
l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil) l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, nil, nil)
attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, attrs) require.NotNil(t, attrs)
require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp)) require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp))
...@@ -109,6 +132,9 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -109,6 +132,9 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoParentHash = l2Parent.L1Origin.Hash l1Info.InfoParentHash = l2Parent.L1Origin.Hash
...@@ -125,13 +151,13 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -125,13 +151,13 @@ func TestPreparePayloadAttributes(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
epoch := l1Info.ID() epoch := l1Info.ID()
l1InfoTx, err := L1InfoDepositBytes(0, l1Info) l1InfoTx, err := L1InfoDepositBytes(0, l1Info, testSysCfg)
require.NoError(t, err) require.NoError(t, err)
l2Txs := append(append(make([]eth.Data, 0), l1InfoTx), usedDepositTxs...) l2Txs := append(append(make([]eth.Data, 0), l1InfoTx), usedDepositTxs...)
l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, receipts, nil) l1Fetcher.ExpectFetchReceipts(epoch.Hash, l1Info, receipts, nil)
attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, attrs) require.NotNil(t, attrs)
require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp)) require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp))
...@@ -146,17 +172,20 @@ func TestPreparePayloadAttributes(t *testing.T) { ...@@ -146,17 +172,20 @@ func TestPreparePayloadAttributes(t *testing.T) {
l1Fetcher := &testutils.MockL1Source{} l1Fetcher := &testutils.MockL1Source{}
defer l1Fetcher.AssertExpectations(t) defer l1Fetcher.AssertExpectations(t)
l2Parent := testutils.RandomL2BlockRef(rng) l2Parent := testutils.RandomL2BlockRef(rng)
l1CfgFetcher := &testutils.MockL2Client{}
l1CfgFetcher.ExpectSystemConfigByL2Hash(l2Parent.Hash, testSysCfg, nil)
defer l1CfgFetcher.AssertExpectations(t)
l2Time := l2Parent.Time + cfg.BlockTime l2Time := l2Parent.Time + cfg.BlockTime
l1Info := testutils.RandomBlockInfo(rng) l1Info := testutils.RandomBlockInfo(rng)
l1Info.InfoHash = l2Parent.L1Origin.Hash l1Info.InfoHash = l2Parent.L1Origin.Hash
l1Info.InfoNum = l2Parent.L1Origin.Number l1Info.InfoNum = l2Parent.L1Origin.Number
epoch := l1Info.ID() epoch := l1Info.ID()
l1InfoTx, err := L1InfoDepositBytes(l2Parent.SequenceNumber+1, l1Info) l1InfoTx, err := L1InfoDepositBytes(l2Parent.SequenceNumber+1, l1Info, testSysCfg)
require.NoError(t, err) require.NoError(t, err)
l1Fetcher.ExpectInfoByHash(epoch.Hash, l1Info, nil) l1Fetcher.ExpectInfoByHash(epoch.Hash, l1Info, nil)
attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l2Parent, l2Time, epoch) attrs, err := PreparePayloadAttributes(context.Background(), cfg, l1Fetcher, l1CfgFetcher, l2Parent, l2Time, epoch)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, attrs) require.NotNil(t, attrs)
require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp)) require.Equal(t, l2Parent.Time+cfg.BlockTime, uint64(attrs.Timestamp))
......
...@@ -6,9 +6,10 @@ import ( ...@@ -6,9 +6,10 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/log"
) )
// The batch queue is responsible for ordering unordered batches & generating empty batches // The batch queue is responsible for ordering unordered batches & generating empty batches
...@@ -113,7 +114,7 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, safeL2Head eth.L2BlockRef) ...@@ -113,7 +114,7 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, safeL2Head eth.L2BlockRef)
return batch, nil return batch, nil
} }
func (bq *BatchQueue) Reset(ctx context.Context, base eth.L1BlockRef) error { func (bq *BatchQueue) Reset(ctx context.Context, base eth.L1BlockRef, _ eth.SystemConfig) error {
// Copy over the Origin from the next stage // Copy over the Origin from the next stage
// It is set in the engine queue (two stages away) such that the L2 Safe Head origin is the progress // It is set in the engine queue (two stages away) such that the L2 Safe Head origin is the progress
bq.origin = base bq.origin = base
......
...@@ -7,14 +7,15 @@ import ( ...@@ -7,14 +7,15 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
) )
type fakeBatchQueueInput struct { type fakeBatchQueueInput struct {
...@@ -102,7 +103,7 @@ func TestBatchQueueNewOrigin(t *testing.T) { ...@@ -102,7 +103,7 @@ func TestBatchQueueNewOrigin(t *testing.T) {
} }
bq := NewBatchQueue(log, cfg, input) bq := NewBatchQueue(log, cfg, input)
_ = bq.Reset(context.Background(), l1[0]) _ = bq.Reset(context.Background(), l1[0], eth.SystemConfig{})
require.Equal(t, []eth.L1BlockRef{l1[0]}, bq.l1Blocks) require.Equal(t, []eth.L1BlockRef{l1[0]}, bq.l1Blocks)
// Prev Origin: 0; Safehead Origin: 2; Internal Origin: 0 // Prev Origin: 0; Safehead Origin: 2; Internal Origin: 0
...@@ -164,7 +165,7 @@ func TestBatchQueueEager(t *testing.T) { ...@@ -164,7 +165,7 @@ func TestBatchQueueEager(t *testing.T) {
} }
bq := NewBatchQueue(log, cfg, input) bq := NewBatchQueue(log, cfg, input)
_ = bq.Reset(context.Background(), l1[0]) _ = bq.Reset(context.Background(), l1[0], eth.SystemConfig{})
// Advance the origin // Advance the origin
input.origin = l1[1] input.origin = l1[1]
...@@ -215,7 +216,7 @@ func TestBatchQueueMissing(t *testing.T) { ...@@ -215,7 +216,7 @@ func TestBatchQueueMissing(t *testing.T) {
} }
bq := NewBatchQueue(log, cfg, input) bq := NewBatchQueue(log, cfg, input)
_ = bq.Reset(context.Background(), l1[0]) _ = bq.Reset(context.Background(), l1[0], eth.SystemConfig{})
for i := 0; i < len(batches); i++ { for i := 0; i < len(batches); i++ {
b, e := bq.NextBatch(context.Background(), safeHead) b, e := bq.NextBatch(context.Background(), safeHead)
......
...@@ -6,12 +6,13 @@ import ( ...@@ -6,12 +6,13 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
) )
type DataIter interface { type DataIter interface {
...@@ -36,8 +37,8 @@ func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Transact ...@@ -36,8 +37,8 @@ func NewDataSourceFactory(log log.Logger, cfg *rollup.Config, fetcher L1Transact
} }
// OpenData returns a CalldataSourceImpl. This struct implements the `Next` function. // OpenData returns a CalldataSourceImpl. This struct implements the `Next` function.
func (ds *DataSourceFactory) OpenData(ctx context.Context, id eth.BlockID) DataIter { func (ds *DataSourceFactory) OpenData(ctx context.Context, id eth.BlockID, batcherAddr common.Address) DataIter {
return NewDataSource(ctx, ds.log, ds.cfg, ds.fetcher, id) return NewDataSource(ctx, ds.log, ds.cfg, ds.fetcher, id, batcherAddr)
} }
// DataSource is a fault tolerant approach to fetching data. // DataSource is a fault tolerant approach to fetching data.
...@@ -52,24 +53,27 @@ type DataSource struct { ...@@ -52,24 +53,27 @@ type DataSource struct {
cfg *rollup.Config // TODO: `DataFromEVMTransactions` should probably not take the full config cfg *rollup.Config // TODO: `DataFromEVMTransactions` should probably not take the full config
fetcher L1TransactionFetcher fetcher L1TransactionFetcher
log log.Logger log log.Logger
batcherAddr common.Address
} }
// NewDataSource creates a new calldata source. It suppresses errors in fetching the L1 block if they occur. // NewDataSource creates a new calldata source. It suppresses errors in fetching the L1 block if they occur.
// If there is an error, it will attempt to fetch the result on the next call to `Next`. // If there is an error, it will attempt to fetch the result on the next call to `Next`.
func NewDataSource(ctx context.Context, log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher, block eth.BlockID) DataIter { func NewDataSource(ctx context.Context, log log.Logger, cfg *rollup.Config, fetcher L1TransactionFetcher, block eth.BlockID, batcherAddr common.Address) DataIter {
_, txs, err := fetcher.InfoAndTxsByHash(ctx, block.Hash) _, txs, err := fetcher.InfoAndTxsByHash(ctx, block.Hash)
if err != nil { if err != nil {
return &DataSource{ return &DataSource{
open: false, open: false,
id: block, id: block,
cfg: cfg, cfg: cfg,
fetcher: fetcher, fetcher: fetcher,
log: log, log: log,
batcherAddr: batcherAddr,
} }
} else { } else {
return &DataSource{ return &DataSource{
open: true, open: true,
data: DataFromEVMTransactions(cfg, txs, log.New("origin", block)), data: DataFromEVMTransactions(cfg, batcherAddr, txs, log.New("origin", block)),
} }
} }
} }
...@@ -81,7 +85,7 @@ func (ds *DataSource) Next(ctx context.Context) (eth.Data, error) { ...@@ -81,7 +85,7 @@ func (ds *DataSource) Next(ctx context.Context) (eth.Data, error) {
if !ds.open { if !ds.open {
if _, txs, err := ds.fetcher.InfoAndTxsByHash(ctx, ds.id.Hash); err == nil { if _, txs, err := ds.fetcher.InfoAndTxsByHash(ctx, ds.id.Hash); err == nil {
ds.open = true ds.open = true
ds.data = DataFromEVMTransactions(ds.cfg, txs, log.New("origin", ds.id)) ds.data = DataFromEVMTransactions(ds.cfg, ds.batcherAddr, txs, log.New("origin", ds.id))
} else if errors.Is(err, ethereum.NotFound) { } else if errors.Is(err, ethereum.NotFound) {
return nil, NewResetError(fmt.Errorf("failed to open calldata source: %w", err)) return nil, NewResetError(fmt.Errorf("failed to open calldata source: %w", err))
} else { } else {
...@@ -100,7 +104,7 @@ func (ds *DataSource) Next(ctx context.Context) (eth.Data, error) { ...@@ -100,7 +104,7 @@ func (ds *DataSource) Next(ctx context.Context) (eth.Data, error) {
// DataFromEVMTransactions filters all of the transactions and returns the calldata from transactions // DataFromEVMTransactions filters all of the transactions and returns the calldata from transactions
// that are sent to the batch inbox address from the batch sender address. // that are sent to the batch inbox address from the batch sender address.
// This will return an empty array if no valid transactions are found. // This will return an empty array if no valid transactions are found.
func DataFromEVMTransactions(config *rollup.Config, txs types.Transactions, log log.Logger) []eth.Data { func DataFromEVMTransactions(config *rollup.Config, batcherAddr common.Address, txs types.Transactions, log log.Logger) []eth.Data {
var out []eth.Data var out []eth.Data
l1Signer := config.L1Signer() l1Signer := config.L1Signer()
for j, tx := range txs { for j, tx := range txs {
...@@ -111,7 +115,7 @@ func DataFromEVMTransactions(config *rollup.Config, txs types.Transactions, log ...@@ -111,7 +115,7 @@ func DataFromEVMTransactions(config *rollup.Config, txs types.Transactions, log
continue // bad signature, ignore continue // bad signature, ignore
} }
// some random L1 user might have sent a transaction to our batch inbox, ignore them // some random L1 user might have sent a transaction to our batch inbox, ignore them
if seqDataSubmitter != config.BatchSenderAddress { if seqDataSubmitter != batcherAddr {
log.Warn("tx in inbox with unauthorized submitter", "index", j, "err", err) log.Warn("tx in inbox with unauthorized submitter", "index", j, "err", err)
continue // not an authorized batch submitter, ignore continue // not an authorized batch submitter, ignore
} }
......
...@@ -8,15 +8,16 @@ import ( ...@@ -8,15 +8,16 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
) )
type testTx struct { type testTx struct {
...@@ -54,10 +55,10 @@ func TestDataFromEVMTransactions(t *testing.T) { ...@@ -54,10 +55,10 @@ func TestDataFromEVMTransactions(t *testing.T) {
inboxPriv := testutils.RandomKey() inboxPriv := testutils.RandomKey()
batcherPriv := testutils.RandomKey() batcherPriv := testutils.RandomKey()
cfg := &rollup.Config{ cfg := &rollup.Config{
L1ChainID: big.NewInt(100), L1ChainID: big.NewInt(100),
BatchInboxAddress: crypto.PubkeyToAddress(inboxPriv.PublicKey), BatchInboxAddress: crypto.PubkeyToAddress(inboxPriv.PublicKey),
BatchSenderAddress: crypto.PubkeyToAddress(batcherPriv.PublicKey),
} }
batcherAddr := crypto.PubkeyToAddress(batcherPriv.PublicKey)
altInbox := testutils.RandomAddress(rand.New(rand.NewSource(1234))) altInbox := testutils.RandomAddress(rand.New(rand.NewSource(1234)))
altAuthor := testutils.RandomKey() altAuthor := testutils.RandomKey()
...@@ -78,7 +79,7 @@ func TestDataFromEVMTransactions(t *testing.T) { ...@@ -78,7 +79,7 @@ func TestDataFromEVMTransactions(t *testing.T) {
txs: []testTx{{to: &cfg.BatchInboxAddress, dataLen: 1234, author: inboxPriv, good: false}}}, txs: []testTx{{to: &cfg.BatchInboxAddress, dataLen: 1234, author: inboxPriv, good: false}}},
{ {
name: "author is inbox", name: "author is inbox",
txs: []testTx{{to: &cfg.BatchSenderAddress, dataLen: 1234, author: batcherPriv, good: false}}}, txs: []testTx{{to: &batcherAddr, dataLen: 1234, author: batcherPriv, good: false}}},
{ {
name: "unrelated", name: "unrelated",
txs: []testTx{{to: &altInbox, dataLen: 1234, author: altAuthor, good: false}}}, txs: []testTx{{to: &altInbox, dataLen: 1234, author: altAuthor, good: false}}},
...@@ -103,6 +104,7 @@ func TestDataFromEVMTransactions(t *testing.T) { ...@@ -103,6 +104,7 @@ func TestDataFromEVMTransactions(t *testing.T) {
{to: &altInbox, dataLen: 2020, value: 12, author: batcherPriv, good: false}, {to: &altInbox, dataLen: 2020, value: 12, author: batcherPriv, good: false},
}, },
}, },
// TODO: test with different batcher key, i.e. when it's changed from initial config value by L1 contract
} }
for i, tc := range testCases { for i, tc := range testCases {
...@@ -118,7 +120,7 @@ func TestDataFromEVMTransactions(t *testing.T) { ...@@ -118,7 +120,7 @@ func TestDataFromEVMTransactions(t *testing.T) {
} }
} }
out := DataFromEVMTransactions(cfg, txs, testlog.Logger(t, log.LvlCrit)) out := DataFromEVMTransactions(cfg, batcherAddr, txs, testlog.Logger(t, log.LvlCrit))
require.ElementsMatch(t, expectedData, out) require.ElementsMatch(t, expectedData, out)
} }
......
...@@ -4,10 +4,11 @@ import ( ...@@ -4,10 +4,11 @@ import (
"context" "context"
"io" "io"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
) )
type NextFrameProvider interface { type NextFrameProvider interface {
...@@ -158,7 +159,7 @@ func (cb *ChannelBank) NextData(ctx context.Context) ([]byte, error) { ...@@ -158,7 +159,7 @@ func (cb *ChannelBank) NextData(ctx context.Context) ([]byte, error) {
} }
} }
func (cb *ChannelBank) Reset(ctx context.Context, base eth.L1BlockRef) error { func (cb *ChannelBank) Reset(ctx context.Context, base eth.L1BlockRef, _ eth.SystemConfig) error {
cb.channels = make(map[ChannelID]*Channel) cb.channels = make(map[ChannelID]*Channel)
cb.channelQueue = make([]ChannelID, 0, 10) cb.channelQueue = make([]ChannelID, 0, 10)
return io.EOF return io.EOF
......
...@@ -5,8 +5,9 @@ import ( ...@@ -5,8 +5,9 @@ import (
"context" "context"
"io" "io"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
) )
// Channel In Reader reads a batch from the channel // Channel In Reader reads a batch from the channel
...@@ -83,7 +84,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (*BatchData, error) { ...@@ -83,7 +84,7 @@ func (cr *ChannelInReader) NextBatch(ctx context.Context) (*BatchData, error) {
return batch.Batch, nil return batch.Batch, nil
} }
func (cr *ChannelInReader) Reset(ctx context.Context, _ eth.L1BlockRef) error { func (cr *ChannelInReader) Reset(ctx context.Context, _ eth.L1BlockRef, _ eth.SystemConfig) error {
cr.nextBatchFn = nil cr.nextBatchFn = nil
return io.EOF return io.EOF
} }
...@@ -30,6 +30,7 @@ type Engine interface { ...@@ -30,6 +30,7 @@ type Engine interface {
PayloadByNumber(context.Context, uint64) (*eth.ExecutionPayload, error) PayloadByNumber(context.Context, uint64) (*eth.ExecutionPayload, error)
L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L2BlockRef, error) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L2BlockRef, error)
L2BlockRefByHash(ctx context.Context, l2Hash common.Hash) (eth.L2BlockRef, error) L2BlockRefByHash(ctx context.Context, l2Hash common.Hash) (eth.L2BlockRef, error)
SystemConfigL2Fetcher
} }
// Max memory used for buffering unsafe payloads // Max memory used for buffering unsafe payloads
...@@ -83,7 +84,8 @@ type EngineQueue struct { ...@@ -83,7 +84,8 @@ type EngineQueue struct {
engine Engine engine Engine
prev NextAttributesProvider prev NextAttributesProvider
origin eth.L1BlockRef // updated on resets, and whenever we read from the previous stage. origin eth.L1BlockRef // updated on resets, and whenever we read from the previous stage.
sysCfg eth.SystemConfig // only used for pipeline resets
metrics Metrics metrics Metrics
l1Fetcher L1Fetcher l1Fetcher L1Fetcher
...@@ -111,6 +113,10 @@ func (eq *EngineQueue) Origin() eth.L1BlockRef { ...@@ -111,6 +113,10 @@ func (eq *EngineQueue) Origin() eth.L1BlockRef {
return eq.origin return eq.origin
} }
func (eq *EngineQueue) SystemConfig() eth.SystemConfig {
return eq.sysCfg
}
func (eq *EngineQueue) SetUnsafeHead(head eth.L2BlockRef) { func (eq *EngineQueue) SetUnsafeHead(head eth.L2BlockRef) {
eq.unsafeHead = head eq.unsafeHead = head
eq.metrics.RecordL2Ref("l2_unsafe", head) eq.metrics.RecordL2Ref("l2_unsafe", head)
...@@ -468,7 +474,7 @@ func (eq *EngineQueue) forceNextSafeAttributes(ctx context.Context) error { ...@@ -468,7 +474,7 @@ func (eq *EngineQueue) forceNextSafeAttributes(ctx context.Context) error {
// ResetStep Walks the L2 chain backwards until it finds an L2 block whose L1 origin is canonical. // ResetStep Walks the L2 chain backwards until it finds an L2 block whose L1 origin is canonical.
// The unsafe head is set to the head of the L2 chain, unless the existing safe head is not canonical. // The unsafe head is set to the head of the L2 chain, unless the existing safe head is not canonical.
func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error { func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef, _ eth.SystemConfig) error {
result, err := sync.FindL2Heads(ctx, eq.cfg, eq.l1Fetcher, eq.engine, eq.log) result, err := sync.FindL2Heads(ctx, eq.cfg, eq.l1Fetcher, eq.engine, eq.log)
if err != nil { if err != nil {
return NewTemporaryError(fmt.Errorf("failed to find the L2 Heads to start from: %w", err)) return NewTemporaryError(fmt.Errorf("failed to find the L2 Heads to start from: %w", err))
...@@ -483,13 +489,29 @@ func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error { ...@@ -483,13 +489,29 @@ func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error {
safe, safe.Time, l1Origin, l1Origin.Time)) safe, safe.Time, l1Origin, l1Origin.Time))
} }
pipelineNumber := l1Origin.Number - eq.cfg.ChannelTimeout // Walk back L2 chain to find the L1 origin that is old enough to start buffering channel data from.
if l1Origin.Number < eq.cfg.ChannelTimeout { pipelineL2 := safe
pipelineNumber = 0 for {
afterL2Genesis := pipelineL2.Number > eq.cfg.Genesis.L2.Number
afterL1Genesis := pipelineL2.L1Origin.Number > eq.cfg.Genesis.L1.Number
afterChannelTimeout := pipelineL2.L1Origin.Number+eq.cfg.ChannelTimeout > l1Origin.Number
if afterL2Genesis && afterL1Genesis && afterChannelTimeout {
parent, err := eq.engine.L2BlockRefByHash(ctx, pipelineL2.ParentHash)
if err != nil {
return NewResetError(fmt.Errorf("failed to fetch L2 parent block %s", pipelineL2.ParentID()))
}
pipelineL2 = parent
} else {
break
}
}
pipelineOrigin, err := eq.l1Fetcher.L1BlockRefByHash(ctx, pipelineL2.L1Origin.Hash)
if err != nil {
return NewTemporaryError(fmt.Errorf("failed to fetch the new L1 progress: origin: %s; err: %w", pipelineL2.L1Origin, err))
} }
pipelineOrigin, err := eq.l1Fetcher.L1BlockRefByNumber(ctx, pipelineNumber) l1Cfg, err := eq.engine.SystemConfigByL2Hash(ctx, pipelineL2.Hash)
if err != nil { if err != nil {
return NewTemporaryError(fmt.Errorf("failed to fetch the new L1 progress: origin: %v; err: %w", pipelineNumber, err)) return NewTemporaryError(fmt.Errorf("failed to fetch L1 config of L2 block %s: %v", pipelineL2.ID(), err))
} }
eq.log.Debug("Reset engine queue", "safeHead", safe, "unsafe", unsafe, "safe_timestamp", safe.Time, "unsafe_timestamp", unsafe.Time, "l1Origin", l1Origin) eq.log.Debug("Reset engine queue", "safeHead", safe, "unsafe", unsafe, "safe_timestamp", safe.Time, "unsafe_timestamp", unsafe.Time, "l1Origin", l1Origin)
eq.unsafeHead = unsafe eq.unsafeHead = unsafe
...@@ -497,8 +519,9 @@ func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error { ...@@ -497,8 +519,9 @@ func (eq *EngineQueue) Reset(ctx context.Context, _ eth.L1BlockRef) error {
eq.finalized = finalized eq.finalized = finalized
eq.needForkchoiceUpdate = true eq.needForkchoiceUpdate = true
eq.finalityData = eq.finalityData[:0] eq.finalityData = eq.finalityData[:0]
// note: we do not clear the unsafe payloadds queue; if the payloads are not applicable anymore the parent hash checks will clear out the old payloads. // note: we do not clear the unsafe payloads queue; if the payloads are not applicable anymore the parent hash checks will clear out the old payloads.
eq.origin = pipelineOrigin eq.origin = pipelineOrigin
eq.sysCfg = l1Cfg
eq.metrics.RecordL2Ref("l2_finalized", finalized) eq.metrics.RecordL2Ref("l2_finalized", finalized)
eq.metrics.RecordL2Ref("l2_safe", safe) eq.metrics.RecordL2Ref("l2_safe", safe)
eq.metrics.RecordL2Ref("l2_unsafe", unsafe) eq.metrics.RecordL2Ref("l2_unsafe", unsafe)
......
...@@ -226,12 +226,19 @@ func TestEngineQueue_Finalize(t *testing.T) { ...@@ -226,12 +226,19 @@ func TestEngineQueue_Finalize(t *testing.T) {
// and we fetch the L1 origin of that as starting point for engine queue // and we fetch the L1 origin of that as starting point for engine queue
l1F.ExpectL1BlockRefByHash(refB.Hash, refB, nil) l1F.ExpectL1BlockRefByHash(refB.Hash, refB, nil)
l1F.ExpectL1BlockRefByNumber(refB.Number, refB, nil) l1F.ExpectL1BlockRefByHash(refB.Hash, refB, nil)
// and mock a L1 config for the last L2 block that references the L1 starting point
eng.ExpectSystemConfigByL2Hash(refB1.Hash, eth.SystemConfig{
BatcherAddr: common.Address{42},
Overhead: [32]byte{123},
Scalar: [32]byte{42},
}, nil)
prev := &fakeAttributesQueue{} prev := &fakeAttributesQueue{}
eq := NewEngineQueue(logger, cfg, eng, metrics, prev, l1F) eq := NewEngineQueue(logger, cfg, eng, metrics, prev, l1F)
require.ErrorIs(t, eq.Reset(context.Background(), eth.L1BlockRef{}), io.EOF) require.ErrorIs(t, eq.Reset(context.Background(), eth.L1BlockRef{}, eth.SystemConfig{}), io.EOF)
require.Equal(t, refB1, eq.SafeL2Head(), "L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for") require.Equal(t, refB1, eq.SafeL2Head(), "L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for")
require.Equal(t, refB, eq.Origin(), "Expecting to be set back derivation L1 progress to B") require.Equal(t, refB, eq.Origin(), "Expecting to be set back derivation L1 progress to B")
......
...@@ -8,8 +8,6 @@ import ( ...@@ -8,8 +8,6 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
...@@ -18,6 +16,10 @@ import ( ...@@ -18,6 +16,10 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm/runtime" "github.com/ethereum/go-ethereum/core/vm/runtime"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testutils"
) )
var ( var (
...@@ -70,13 +72,16 @@ func FuzzL1InfoRoundTrip(f *testing.F) { ...@@ -70,13 +72,16 @@ func FuzzL1InfoRoundTrip(f *testing.F) {
// FuzzL1InfoAgainstContract checks the custom marshalling functions against the contract // FuzzL1InfoAgainstContract checks the custom marshalling functions against the contract
// bindings to ensure that our functions are up to date and match the bindings. // bindings to ensure that our functions are up to date and match the bindings.
func FuzzL1InfoAgainstContract(f *testing.F) { func FuzzL1InfoAgainstContract(f *testing.F) {
f.Fuzz(func(t *testing.T, number, time uint64, baseFee, hash []byte, seqNumber uint64) { f.Fuzz(func(t *testing.T, number, time uint64, baseFee, hash []byte, seqNumber uint64, batcherHash []byte, l1FeeOverhead []byte, l1FeeScalar []byte) {
expected := L1BlockInfo{ expected := L1BlockInfo{
Number: number, Number: number,
Time: time, Time: time,
BaseFee: BytesToBigInt(baseFee), BaseFee: BytesToBigInt(baseFee),
BlockHash: common.BytesToHash(hash), BlockHash: common.BytesToHash(hash),
SequenceNumber: seqNumber, SequenceNumber: seqNumber,
BatcherAddr: common.BytesToAddress(batcherHash),
L1FeeOverhead: eth.Bytes32(common.BytesToHash(l1FeeOverhead)),
L1FeeScalar: eth.Bytes32(common.BytesToHash(l1FeeScalar)),
} }
// Setup opts // Setup opts
...@@ -92,6 +97,9 @@ func FuzzL1InfoAgainstContract(f *testing.F) { ...@@ -92,6 +97,9 @@ func FuzzL1InfoAgainstContract(f *testing.F) {
BytesToBigInt(baseFee), BytesToBigInt(baseFee),
common.BytesToHash(hash), common.BytesToHash(hash),
seqNumber, seqNumber,
common.BytesToAddress(batcherHash).Hash(),
common.BytesToHash(l1FeeOverhead).Big(),
common.BytesToHash(l1FeeScalar).Big(),
) )
if err != nil { if err != nil {
t.Fatalf("Failed to create the transaction: %v", err) t.Fatalf("Failed to create the transaction: %v", err)
...@@ -104,6 +112,8 @@ func FuzzL1InfoAgainstContract(f *testing.F) { ...@@ -104,6 +112,8 @@ func FuzzL1InfoAgainstContract(f *testing.F) {
t.Fatalf("Failed to marshal binary: %v", err) t.Fatalf("Failed to marshal binary: %v", err)
} }
if !bytes.Equal(enc, tx.Data()) { if !bytes.Equal(enc, tx.Data()) {
t.Logf("encoded %x", enc)
t.Logf("expected %x", tx.Data())
t.Fatalf("Custom marshal does not match contract bindings") t.Fatalf("Custom marshal does not match contract bindings")
} }
......
...@@ -6,15 +6,21 @@ import ( ...@@ -6,15 +6,21 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-node/eth"
)
const (
L1InfoFuncSignature = "setL1BlockValues(uint64,uint64,uint256,bytes32,uint64,bytes32,uint256,uint256)"
L1InfoArguments = 8
L1InfoLen = 4 + 32*L1InfoArguments
) )
var ( var (
L1InfoFuncSignature = "setL1BlockValues(uint64,uint64,uint256,bytes32,uint64)"
L1InfoFuncBytes4 = crypto.Keccak256([]byte(L1InfoFuncSignature))[:4] L1InfoFuncBytes4 = crypto.Keccak256([]byte(L1InfoFuncSignature))[:4]
L1InfoDepositerAddress = common.HexToAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001") L1InfoDepositerAddress = common.HexToAddress("0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001")
L1BlockAddress = predeploys.L1BlockAddr L1BlockAddress = predeploys.L1BlockAddr
...@@ -29,10 +35,14 @@ type L1BlockInfo struct { ...@@ -29,10 +35,14 @@ type L1BlockInfo struct {
// Not strictly a piece of L1 information. Represents the number of L2 blocks since the start of the epoch, // Not strictly a piece of L1 information. Represents the number of L2 blocks since the start of the epoch,
// i.e. when the actual L1 info was first introduced. // i.e. when the actual L1 info was first introduced.
SequenceNumber uint64 SequenceNumber uint64
// BatcherHash version 0 is just the address with 0 padding to the left.
BatcherAddr common.Address
L1FeeOverhead eth.Bytes32
L1FeeScalar eth.Bytes32
} }
func (info *L1BlockInfo) MarshalBinary() ([]byte, error) { func (info *L1BlockInfo) MarshalBinary() ([]byte, error) {
data := make([]byte, 4+32+32+32+32+32) data := make([]byte, L1InfoLen)
offset := 0 offset := 0
copy(data[offset:4], L1InfoFuncBytes4) copy(data[offset:4], L1InfoFuncBytes4)
offset += 4 offset += 4
...@@ -49,11 +59,17 @@ func (info *L1BlockInfo) MarshalBinary() ([]byte, error) { ...@@ -49,11 +59,17 @@ func (info *L1BlockInfo) MarshalBinary() ([]byte, error) {
copy(data[offset:offset+32], info.BlockHash.Bytes()) copy(data[offset:offset+32], info.BlockHash.Bytes())
offset += 32 offset += 32
binary.BigEndian.PutUint64(data[offset+24:offset+32], info.SequenceNumber) binary.BigEndian.PutUint64(data[offset+24:offset+32], info.SequenceNumber)
offset += 32
copy(data[offset+12:offset+32], info.BatcherAddr[:])
offset += 32
copy(data[offset:offset+32], info.L1FeeOverhead[:])
offset += 32
copy(data[offset:offset+32], info.L1FeeScalar[:])
return data, nil return data, nil
} }
func (info *L1BlockInfo) UnmarshalBinary(data []byte) error { func (info *L1BlockInfo) UnmarshalBinary(data []byte) error {
if len(data) != 4+32+32+32+32+32 { if len(data) != L1InfoLen {
return fmt.Errorf("data is unexpected length: %d", len(data)) return fmt.Errorf("data is unexpected length: %d", len(data))
} }
var padding [24]byte var padding [24]byte
...@@ -76,6 +92,12 @@ func (info *L1BlockInfo) UnmarshalBinary(data []byte) error { ...@@ -76,6 +92,12 @@ func (info *L1BlockInfo) UnmarshalBinary(data []byte) error {
if !bytes.Equal(data[offset:offset+24], padding[:]) { if !bytes.Equal(data[offset:offset+24], padding[:]) {
return fmt.Errorf("l1 info sequence number exceeds uint64 bounds: %x", data[offset:offset+32]) return fmt.Errorf("l1 info sequence number exceeds uint64 bounds: %x", data[offset:offset+32])
} }
offset += 32
info.BatcherAddr.SetBytes(data[offset+12 : offset+32])
offset += 32
copy(info.L1FeeOverhead[:], data[offset:offset+32])
offset += 32
copy(info.L1FeeScalar[:], data[offset:offset+32])
return nil return nil
} }
...@@ -88,13 +110,16 @@ func L1InfoDepositTxData(data []byte) (L1BlockInfo, error) { ...@@ -88,13 +110,16 @@ func L1InfoDepositTxData(data []byte) (L1BlockInfo, error) {
// L1InfoDeposit creates a L1 Info deposit transaction based on the L1 block, // L1InfoDeposit creates a L1 Info deposit transaction based on the L1 block,
// and the L2 block-height difference with the start of the epoch. // and the L2 block-height difference with the start of the epoch.
func L1InfoDeposit(seqNumber uint64, block eth.BlockInfo) (*types.DepositTx, error) { func L1InfoDeposit(seqNumber uint64, block eth.BlockInfo, sysCfg eth.SystemConfig) (*types.DepositTx, error) {
infoDat := L1BlockInfo{ infoDat := L1BlockInfo{
Number: block.NumberU64(), Number: block.NumberU64(),
Time: block.Time(), Time: block.Time(),
BaseFee: block.BaseFee(), BaseFee: block.BaseFee(),
BlockHash: block.Hash(), BlockHash: block.Hash(),
SequenceNumber: seqNumber, SequenceNumber: seqNumber,
BatcherAddr: sysCfg.BatcherAddr,
L1FeeOverhead: sysCfg.Overhead,
L1FeeScalar: sysCfg.Scalar,
} }
data, err := infoDat.MarshalBinary() data, err := infoDat.MarshalBinary()
if err != nil { if err != nil {
...@@ -120,8 +145,8 @@ func L1InfoDeposit(seqNumber uint64, block eth.BlockInfo) (*types.DepositTx, err ...@@ -120,8 +145,8 @@ func L1InfoDeposit(seqNumber uint64, block eth.BlockInfo) (*types.DepositTx, err
} }
// L1InfoDepositBytes returns a serialized L1-info attributes transaction. // L1InfoDepositBytes returns a serialized L1-info attributes transaction.
func L1InfoDepositBytes(seqNumber uint64, l1Info eth.BlockInfo) ([]byte, error) { func L1InfoDepositBytes(seqNumber uint64, l1Info eth.BlockInfo, sysCfg eth.SystemConfig) ([]byte, error) {
dep, err := L1InfoDeposit(seqNumber, l1Info) dep, err := L1InfoDeposit(seqNumber, l1Info, sysCfg)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create L1 info tx: %w", err) return nil, fmt.Errorf("failed to create L1 info tx: %w", err)
} }
......
...@@ -8,17 +8,27 @@ import ( ...@@ -8,17 +8,27 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testutils" "github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum/common"
) )
var _ eth.BlockInfo = (*testutils.MockBlockInfo)(nil) var _ eth.BlockInfo = (*testutils.MockBlockInfo)(nil)
type infoTest struct { type infoTest struct {
name string name string
mkInfo func(rng *rand.Rand) *testutils.MockBlockInfo mkInfo func(rng *rand.Rand) *testutils.MockBlockInfo
seqNr func(rng *rand.Rand) uint64 mkL1Cfg func(rng *rand.Rand, l1Info eth.BlockInfo) eth.SystemConfig
seqNr func(rng *rand.Rand) uint64
}
func randomL1Cfg(rng *rand.Rand, l1Info eth.BlockInfo) eth.SystemConfig {
return eth.SystemConfig{
BatcherAddr: testutils.RandomAddress(rng),
Overhead: [32]byte{},
Scalar: [32]byte{},
}
} }
var MockDepositContractAddr = common.HexToAddress("0xdeadbeefdeadbeefdeadbeefdeadbeef00000000") var MockDepositContractAddr = common.HexToAddress("0xdeadbeefdeadbeefdeadbeefdeadbeef00000000")
...@@ -29,22 +39,22 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -29,22 +39,22 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
} }
// Go 1.18 will have native fuzzing for us to use, until then, we cover just the below cases // Go 1.18 will have native fuzzing for us to use, until then, we cover just the below cases
cases := []infoTest{ cases := []infoTest{
{"random", testutils.MakeBlockInfo(nil), randomSeqNr}, {"random", testutils.MakeBlockInfo(nil), randomL1Cfg, randomSeqNr},
{"zero basefee", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) { {"zero basefee", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) {
l.InfoBaseFee = new(big.Int) l.InfoBaseFee = new(big.Int)
}), randomSeqNr}, }), randomL1Cfg, randomSeqNr},
{"zero time", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) { {"zero time", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) {
l.InfoTime = 0 l.InfoTime = 0
}), randomSeqNr}, }), randomL1Cfg, randomSeqNr},
{"zero num", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) { {"zero num", testutils.MakeBlockInfo(func(l *testutils.MockBlockInfo) {
l.InfoNum = 0 l.InfoNum = 0
}), randomSeqNr}, }), randomL1Cfg, randomSeqNr},
{"zero seq", testutils.MakeBlockInfo(nil), func(rng *rand.Rand) uint64 { {"zero seq", testutils.MakeBlockInfo(nil), randomL1Cfg, func(rng *rand.Rand) uint64 {
return 0 return 0
}}, }},
{"all zero", func(rng *rand.Rand) *testutils.MockBlockInfo { {"all zero", func(rng *rand.Rand) *testutils.MockBlockInfo {
return &testutils.MockBlockInfo{InfoBaseFee: new(big.Int)} return &testutils.MockBlockInfo{InfoBaseFee: new(big.Int)}
}, func(rng *rand.Rand) uint64 { }, randomL1Cfg, func(rng *rand.Rand) uint64 {
return 0 return 0
}}, }},
} }
...@@ -52,8 +62,9 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -52,8 +62,9 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) { t.Run(testCase.name, func(t *testing.T) {
rng := rand.New(rand.NewSource(int64(1234 + i))) rng := rand.New(rand.NewSource(int64(1234 + i)))
info := testCase.mkInfo(rng) info := testCase.mkInfo(rng)
l1Cfg := testCase.mkL1Cfg(rng, info)
seqNr := testCase.seqNr(rng) seqNr := testCase.seqNr(rng)
depTx, err := L1InfoDeposit(seqNr, info) depTx, err := L1InfoDeposit(seqNr, info, l1Cfg)
require.NoError(t, err) require.NoError(t, err)
res, err := L1InfoDepositTxData(depTx.Data) res, err := L1InfoDepositTxData(depTx.Data)
require.NoError(t, err, "expected valid deposit info") require.NoError(t, err, "expected valid deposit info")
...@@ -63,6 +74,9 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -63,6 +74,9 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
assert.Equal(t, res.BaseFee.Bytes(), info.BaseFee().Bytes()) assert.Equal(t, res.BaseFee.Bytes(), info.BaseFee().Bytes())
assert.Equal(t, res.BlockHash, info.Hash()) assert.Equal(t, res.BlockHash, info.Hash())
assert.Equal(t, res.SequenceNumber, seqNr) assert.Equal(t, res.SequenceNumber, seqNr)
assert.Equal(t, res.BatcherAddr, l1Cfg.BatcherAddr)
assert.Equal(t, res.L1FeeOverhead, l1Cfg.Overhead)
assert.Equal(t, res.L1FeeScalar, l1Cfg.Scalar)
}) })
} }
t.Run("no data", func(t *testing.T) { t.Run("no data", func(t *testing.T) {
......
...@@ -4,17 +4,20 @@ import ( ...@@ -4,17 +4,20 @@ import (
"context" "context"
"io" "io"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
) )
type DataAvailabilitySource interface { type DataAvailabilitySource interface {
OpenData(ctx context.Context, id eth.BlockID) DataIter OpenData(ctx context.Context, id eth.BlockID, batcherAddr common.Address) DataIter
} }
type NextBlockProvider interface { type NextBlockProvider interface {
NextL1Block(context.Context) (eth.L1BlockRef, error) NextL1Block(context.Context) (eth.L1BlockRef, error)
Origin() eth.L1BlockRef Origin() eth.L1BlockRef
SystemConfig() eth.SystemConfig
} }
type L1Retrieval struct { type L1Retrieval struct {
...@@ -50,7 +53,7 @@ func (l1r *L1Retrieval) NextData(ctx context.Context) ([]byte, error) { ...@@ -50,7 +53,7 @@ func (l1r *L1Retrieval) NextData(ctx context.Context) ([]byte, error) {
} else if err != nil { } else if err != nil {
return nil, err return nil, err
} }
l1r.datas = l1r.dataSrc.OpenData(ctx, next.ID()) l1r.datas = l1r.dataSrc.OpenData(ctx, next.ID(), l1r.prev.SystemConfig().BatcherAddr)
} }
l1r.log.Debug("fetching next piece of data") l1r.log.Debug("fetching next piece of data")
...@@ -69,8 +72,8 @@ func (l1r *L1Retrieval) NextData(ctx context.Context) ([]byte, error) { ...@@ -69,8 +72,8 @@ func (l1r *L1Retrieval) NextData(ctx context.Context) ([]byte, error) {
// ResetStep re-initializes the L1 Retrieval stage to block of it's `next` progress. // ResetStep re-initializes the L1 Retrieval stage to block of it's `next` progress.
// Note that we open up the `l1r.datas` here because it is requires to maintain the // Note that we open up the `l1r.datas` here because it is requires to maintain the
// internal invariants that later propagate up the derivation pipeline. // internal invariants that later propagate up the derivation pipeline.
func (l1r *L1Retrieval) Reset(ctx context.Context, base eth.L1BlockRef) error { func (l1r *L1Retrieval) Reset(ctx context.Context, base eth.L1BlockRef, sysCfg eth.SystemConfig) error {
l1r.datas = l1r.dataSrc.OpenData(ctx, base.ID()) l1r.datas = l1r.dataSrc.OpenData(ctx, base.ID(), sysCfg.BatcherAddr)
l1r.log.Info("Reset of L1Retrieval done", "origin", base) l1r.log.Info("Reset of L1Retrieval done", "origin", base)
return io.EOF return io.EOF
} }
...@@ -9,12 +9,14 @@ import ( ...@@ -9,12 +9,14 @@ import (
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils"
) )
type fakeDataIter struct { type fakeDataIter struct {
...@@ -33,13 +35,13 @@ type MockDataSource struct { ...@@ -33,13 +35,13 @@ type MockDataSource struct {
mock.Mock mock.Mock
} }
func (m *MockDataSource) OpenData(ctx context.Context, id eth.BlockID) DataIter { func (m *MockDataSource) OpenData(ctx context.Context, id eth.BlockID, batcherAddr common.Address) DataIter {
out := m.Mock.MethodCalled("OpenData", id) out := m.Mock.MethodCalled("OpenData", id, batcherAddr)
return out[0].(DataIter) return out[0].(DataIter)
} }
func (m *MockDataSource) ExpectOpenData(id eth.BlockID, iter DataIter) { func (m *MockDataSource) ExpectOpenData(id eth.BlockID, iter DataIter, batcherAddr common.Address) {
m.Mock.On("OpenData", id).Return(iter) m.Mock.On("OpenData", id, batcherAddr).Return(iter)
} }
var _ DataAvailabilitySource = (*MockDataSource)(nil) var _ DataAvailabilitySource = (*MockDataSource)(nil)
...@@ -48,6 +50,15 @@ type MockL1Traversal struct { ...@@ -48,6 +50,15 @@ type MockL1Traversal struct {
mock.Mock mock.Mock
} }
func (m *MockL1Traversal) ExpectSystemConfig(sysCfg eth.SystemConfig) {
m.Mock.On("SystemConfig").Return(sysCfg)
}
func (m *MockL1Traversal) SystemConfig() eth.SystemConfig {
out := m.Mock.MethodCalled("SystemConfig")
return out[0].(eth.SystemConfig)
}
func (m *MockL1Traversal) Origin() eth.L1BlockRef { func (m *MockL1Traversal) Origin() eth.L1BlockRef {
out := m.Mock.MethodCalled("Origin") out := m.Mock.MethodCalled("Origin")
return out[0].(eth.L1BlockRef) return out[0].(eth.L1BlockRef)
...@@ -74,14 +85,17 @@ func TestL1RetrievalReset(t *testing.T) { ...@@ -74,14 +85,17 @@ func TestL1RetrievalReset(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
dataSrc := &MockDataSource{} dataSrc := &MockDataSource{}
a := testutils.RandomBlockRef(rng) a := testutils.RandomBlockRef(rng)
l1Cfg := eth.SystemConfig{
BatcherAddr: common.Address{42},
}
dataSrc.ExpectOpenData(a.ID(), &fakeDataIter{}) dataSrc.ExpectOpenData(a.ID(), &fakeDataIter{}, l1Cfg.BatcherAddr)
defer dataSrc.AssertExpectations(t) defer dataSrc.AssertExpectations(t)
l1r := NewL1Retrieval(testlog.Logger(t, log.LvlError), dataSrc, nil) l1r := NewL1Retrieval(testlog.Logger(t, log.LvlError), dataSrc, nil)
// We assert that it opens up the correct data on a reset // We assert that it opens up the correct data on a reset
_ = l1r.Reset(context.Background(), a) _ = l1r.Reset(context.Background(), a, l1Cfg)
} }
// TestL1RetrievalNextData tests that the `NextData` function properly // TestL1RetrievalNextData tests that the `NextData` function properly
...@@ -94,6 +108,7 @@ func TestL1RetrievalNextData(t *testing.T) { ...@@ -94,6 +108,7 @@ func TestL1RetrievalNextData(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
prevBlock eth.L1BlockRef prevBlock eth.L1BlockRef
sysCfg eth.SystemConfig
prevErr error // error returned by prev.NextL1Block prevErr error // error returned by prev.NextL1Block
openErr error // error returned by NextData if prev.NextL1Block fails openErr error // error returned by NextData if prev.NextL1Block fails
datas []eth.Data datas []eth.Data
...@@ -103,6 +118,7 @@ func TestL1RetrievalNextData(t *testing.T) { ...@@ -103,6 +118,7 @@ func TestL1RetrievalNextData(t *testing.T) {
{ {
name: "simple retrieval", name: "simple retrieval",
prevBlock: a, prevBlock: a,
sysCfg: eth.SystemConfig{BatcherAddr: common.Address{0x55}},
prevErr: nil, prevErr: nil,
openErr: nil, openErr: nil,
datas: []eth.Data{testutils.RandomData(rng, 10), testutils.RandomData(rng, 10), testutils.RandomData(rng, 10), nil}, datas: []eth.Data{testutils.RandomData(rng, 10), testutils.RandomData(rng, 10), testutils.RandomData(rng, 10), nil},
...@@ -117,6 +133,7 @@ func TestL1RetrievalNextData(t *testing.T) { ...@@ -117,6 +133,7 @@ func TestL1RetrievalNextData(t *testing.T) {
{ {
name: "fail to open data", name: "fail to open data",
prevBlock: a, prevBlock: a,
sysCfg: eth.SystemConfig{BatcherAddr: common.Address{0x55}},
prevErr: nil, prevErr: nil,
openErr: nil, openErr: nil,
datas: []eth.Data{nil}, datas: []eth.Data{nil},
...@@ -130,7 +147,7 @@ func TestL1RetrievalNextData(t *testing.T) { ...@@ -130,7 +147,7 @@ func TestL1RetrievalNextData(t *testing.T) {
l1t := &MockL1Traversal{} l1t := &MockL1Traversal{}
l1t.ExpectNextL1Block(test.prevBlock, test.prevErr) l1t.ExpectNextL1Block(test.prevBlock, test.prevErr)
dataSrc := &MockDataSource{} dataSrc := &MockDataSource{}
dataSrc.ExpectOpenData(test.prevBlock.ID(), &fakeDataIter{data: test.datas, errs: test.datasErrs}) dataSrc.ExpectOpenData(test.prevBlock.ID(), &fakeDataIter{data: test.datas, errs: test.datasErrs}, test.sysCfg.BatcherAddr)
ret := NewL1Retrieval(testlog.Logger(t, log.LvlCrit), dataSrc, l1t) ret := NewL1Retrieval(testlog.Logger(t, log.LvlCrit), dataSrc, l1t)
...@@ -144,6 +161,7 @@ func TestL1RetrievalNextData(t *testing.T) { ...@@ -144,6 +161,7 @@ func TestL1RetrievalNextData(t *testing.T) {
// Go through the fake data an assert that data is passed through and the correct // Go through the fake data an assert that data is passed through and the correct
// errors are returned. // errors are returned.
for i := range test.expectedErrs { for i := range test.expectedErrs {
l1t.ExpectSystemConfig(test.sysCfg)
data, err := ret.NextData(context.Background()) data, err := ret.NextData(context.Background())
require.Equal(t, test.datas[i], hexutil.Bytes(data)) require.Equal(t, test.datas[i], hexutil.Bytes(data))
require.ErrorIs(t, err, test.expectedErrs[i]) require.ErrorIs(t, err, test.expectedErrs[i])
......
...@@ -6,15 +6,20 @@ import ( ...@@ -6,15 +6,20 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
) )
// L1 Traversal fetches the next L1 block and exposes it through the progress API // L1 Traversal fetches the next L1 block and exposes it through the progress API
type L1BlockRefByNumberFetcher interface { type L1BlockRefByNumberFetcher interface {
L1BlockRefByNumber(context.Context, uint64) (eth.L1BlockRef, error) L1BlockRefByNumber(context.Context, uint64) (eth.L1BlockRef, error)
FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
} }
type L1Traversal struct { type L1Traversal struct {
...@@ -22,14 +27,17 @@ type L1Traversal struct { ...@@ -22,14 +27,17 @@ type L1Traversal struct {
done bool done bool
l1Blocks L1BlockRefByNumberFetcher l1Blocks L1BlockRefByNumberFetcher
log log.Logger log log.Logger
sysCfg eth.SystemConfig
cfg *rollup.Config
} }
var _ ResetableStage = (*L1Traversal)(nil) var _ ResetableStage = (*L1Traversal)(nil)
func NewL1Traversal(log log.Logger, l1Blocks L1BlockRefByNumberFetcher) *L1Traversal { func NewL1Traversal(log log.Logger, cfg *rollup.Config, l1Blocks L1BlockRefByNumberFetcher) *L1Traversal {
return &L1Traversal{ return &L1Traversal{
log: log, log: log,
l1Blocks: l1Blocks, l1Blocks: l1Blocks,
cfg: cfg,
} }
} }
...@@ -61,6 +69,17 @@ func (l1t *L1Traversal) AdvanceL1Block(ctx context.Context) error { ...@@ -61,6 +69,17 @@ func (l1t *L1Traversal) AdvanceL1Block(ctx context.Context) error {
if l1t.block.Hash != nextL1Origin.ParentHash { if l1t.block.Hash != nextL1Origin.ParentHash {
return NewResetError(fmt.Errorf("detected L1 reorg from %s to %s with conflicting parent %s", l1t.block, nextL1Origin, nextL1Origin.ParentID())) return NewResetError(fmt.Errorf("detected L1 reorg from %s to %s with conflicting parent %s", l1t.block, nextL1Origin, nextL1Origin.ParentID()))
} }
// Parse L1 receipts of the given block and update the L1 system configuration
_, receipts, err := l1t.l1Blocks.FetchReceipts(ctx, nextL1Origin.Hash)
if err != nil {
return NewTemporaryError(fmt.Errorf("failed to fetch receipts of L1 block %s for L1 sysCfg update: %v", origin, err))
}
if err := UpdateSystemConfigWithL1Receipts(&l1t.sysCfg, receipts, l1t.cfg); err != nil {
// the sysCfg changes should always be formatted correctly.
return NewCriticalError(fmt.Errorf("failed to update L1 sysCfg with receipts from block %s: %v", origin, err))
}
l1t.block = nextL1Origin l1t.block = nextL1Origin
l1t.done = false l1t.done = false
return nil return nil
...@@ -69,9 +88,14 @@ func (l1t *L1Traversal) AdvanceL1Block(ctx context.Context) error { ...@@ -69,9 +88,14 @@ func (l1t *L1Traversal) AdvanceL1Block(ctx context.Context) error {
// Reset sets the internal L1 block to the supplied base. // Reset sets the internal L1 block to the supplied base.
// Note that the next call to `NextL1Block` will return the block after `base` // Note that the next call to `NextL1Block` will return the block after `base`
// TODO: Walk one back/figure this out. // TODO: Walk one back/figure this out.
func (l1t *L1Traversal) Reset(ctx context.Context, base eth.L1BlockRef) error { func (l1t *L1Traversal) Reset(ctx context.Context, base eth.L1BlockRef, cfg eth.SystemConfig) error {
l1t.block = base l1t.block = base
l1t.done = false l1t.done = false
l1t.sysCfg = cfg
l1t.log.Info("completed reset of derivation pipeline", "origin", base) l1t.log.Info("completed reset of derivation pipeline", "origin", base)
return io.EOF return io.EOF
} }
func (l1c *L1Traversal) SystemConfig() eth.SystemConfig {
return l1c.sysCfg
}
...@@ -9,11 +9,15 @@ import ( ...@@ -9,11 +9,15 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/testlog" "github.com/ethereum-optimism/optimism/op-node/testlog"
"github.com/ethereum-optimism/optimism/op-node/testutils" "github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/log"
) )
// TestL1TraversalNext tests that the `Next` function only returns // TestL1TraversalNext tests that the `Next` function only returns
...@@ -21,10 +25,20 @@ import ( ...@@ -21,10 +25,20 @@ import (
func TestL1TraversalNext(t *testing.T) { func TestL1TraversalNext(t *testing.T) {
rng := rand.New(rand.NewSource(1234)) rng := rand.New(rand.NewSource(1234))
a := testutils.RandomBlockRef(rng) a := testutils.RandomBlockRef(rng)
tr := NewL1Traversal(testlog.Logger(t, log.LvlError), nil)
// Load up the initial state with a reset // Load up the initial state with a reset
_ = tr.Reset(context.Background(), a) l1Cfg := eth.SystemConfig{
BatcherAddr: testutils.RandomAddress(rng),
Overhead: [32]byte{42},
Scalar: [32]byte{69},
}
sysCfgAddr := testutils.RandomAddress(rng)
cfg := &rollup.Config{
Genesis: rollup.Genesis{SystemConfig: l1Cfg},
L1SystemConfigAddress: sysCfgAddr,
}
tr := NewL1Traversal(testlog.Logger(t, log.LvlError), cfg, nil)
_ = tr.Reset(context.Background(), a, l1Cfg)
// First call should always succeed // First call should always succeed
ref, err := tr.NextL1Block(context.Background()) ref, err := tr.NextL1Block(context.Background())
...@@ -51,18 +65,27 @@ func TestL1TraversalAdvance(t *testing.T) { ...@@ -51,18 +65,27 @@ func TestL1TraversalAdvance(t *testing.T) {
// x is at the same height as b but does not extend `a` // x is at the same height as b but does not extend `a`
x := testutils.RandomBlockRef(rng) x := testutils.RandomBlockRef(rng)
x.Number = b.Number x.Number = b.Number
sysCfgAddr := testutils.RandomAddress(rng)
tests := []struct { tests := []struct {
name string name string
startBlock eth.L1BlockRef startBlock eth.L1BlockRef
nextBlock eth.L1BlockRef nextBlock eth.L1BlockRef
fetcherErr error initialL1Cfg eth.SystemConfig
expectedErr error l1Receipts []*types.Receipt
fetcherErr error
expectedErr error
}{ }{
{ {
name: "simple extension", name: "simple extension",
startBlock: a, startBlock: a,
nextBlock: b, nextBlock: b,
initialL1Cfg: eth.SystemConfig{
BatcherAddr: common.Address{11},
Overhead: [32]byte{22},
Scalar: [32]byte{33},
},
l1Receipts: []*types.Receipt{},
fetcherErr: nil, fetcherErr: nil,
expectedErr: nil, expectedErr: nil,
}, },
...@@ -87,16 +110,31 @@ func TestL1TraversalAdvance(t *testing.T) { ...@@ -87,16 +110,31 @@ func TestL1TraversalAdvance(t *testing.T) {
fetcherErr: errors.New("interrupted connection"), fetcherErr: errors.New("interrupted connection"),
expectedErr: ErrTemporary, expectedErr: ErrTemporary,
}, },
// TODO: add tests that cover the receipts to config data updates
} }
for _, test := range tests { for _, test := range tests {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
src := &testutils.MockL1Source{} src := &testutils.MockL1Source{}
src.ExpectL1BlockRefByNumber(test.startBlock.Number+1, test.nextBlock, test.fetcherErr) src.ExpectL1BlockRefByNumber(test.startBlock.Number+1, test.nextBlock, test.fetcherErr)
info := &testutils.MockBlockInfo{
InfoHash: test.nextBlock.Hash,
InfoParentHash: test.nextBlock.ParentHash,
InfoNum: test.nextBlock.Number,
InfoTime: test.nextBlock.Time,
// TODO: don't need full L1 info in receipts fetching API maybe?
}
if test.l1Receipts != nil {
src.ExpectFetchReceipts(test.nextBlock.Hash, info, test.l1Receipts, nil)
}
tr := NewL1Traversal(testlog.Logger(t, log.LvlError), src) cfg := &rollup.Config{
Genesis: rollup.Genesis{SystemConfig: test.initialL1Cfg},
L1SystemConfigAddress: sysCfgAddr,
}
tr := NewL1Traversal(testlog.Logger(t, log.LvlError), cfg, src)
// Load up the initial state with a reset // Load up the initial state with a reset
_ = tr.Reset(context.Background(), test.startBlock) _ = tr.Reset(context.Background(), test.startBlock, test.initialL1Cfg)
// Advance it + assert output // Advance it + assert output
err := tr.AdvanceL1Block(context.Background()) err := tr.AdvanceL1Block(context.Background())
......
...@@ -3,9 +3,10 @@ package derive ...@@ -3,9 +3,10 @@ package derive
import ( import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/core/types"
) )
// PayloadToBlockRef extracts the essential L2BlockRef information from an execution payload, // PayloadToBlockRef extracts the essential L2BlockRef information from an execution payload,
...@@ -47,3 +48,32 @@ func PayloadToBlockRef(payload *eth.ExecutionPayload, genesis *rollup.Genesis) ( ...@@ -47,3 +48,32 @@ func PayloadToBlockRef(payload *eth.ExecutionPayload, genesis *rollup.Genesis) (
SequenceNumber: sequenceNumber, SequenceNumber: sequenceNumber,
}, nil }, nil
} }
func PayloadToSystemConfig(payload *eth.ExecutionPayload, cfg *rollup.Config) (eth.SystemConfig, error) {
if uint64(payload.BlockNumber) == cfg.Genesis.L2.Number {
if payload.BlockHash != cfg.Genesis.L2.Hash {
return eth.SystemConfig{}, fmt.Errorf("expected L2 genesis hash to match L2 block at genesis block number %d: %s <> %s", cfg.Genesis.L2.Number, payload.BlockHash, cfg.Genesis.L2.Hash)
}
return cfg.Genesis.SystemConfig, nil
} else {
if len(payload.Transactions) == 0 {
return eth.SystemConfig{}, fmt.Errorf("l2 block is missing L1 info deposit tx, block hash: %s", payload.BlockHash)
}
var tx types.Transaction
if err := tx.UnmarshalBinary(payload.Transactions[0]); err != nil {
return eth.SystemConfig{}, fmt.Errorf("failed to decode first tx to read l1 info from: %w", err)
}
if tx.Type() != types.DepositTxType {
return eth.SystemConfig{}, fmt.Errorf("first payload tx has unexpected tx type: %d", tx.Type())
}
info, err := L1InfoDepositTxData(tx.Data())
if err != nil {
return eth.SystemConfig{}, fmt.Errorf("failed to parse L1 info deposit tx from L2 block: %w", err)
}
return eth.SystemConfig{
BatcherAddr: info.BatcherAddr,
Overhead: info.L1FeeOverhead,
Scalar: info.L1FeeScalar,
}, err
}
}
...@@ -26,8 +26,8 @@ type L1Fetcher interface { ...@@ -26,8 +26,8 @@ type L1Fetcher interface {
} }
type ResetableStage interface { type ResetableStage interface {
// Reset resets a pull stage. `base` refers to the L1 Block Reference to reset to. // Reset resets a pull stage. `base` refers to the L1 Block Reference to reset to, with corresponding configuration.
Reset(ctx context.Context, base eth.L1BlockRef) error Reset(ctx context.Context, base eth.L1BlockRef, baseCfg eth.SystemConfig) error
} }
type EngineQueueStage interface { type EngineQueueStage interface {
...@@ -36,6 +36,7 @@ type EngineQueueStage interface { ...@@ -36,6 +36,7 @@ type EngineQueueStage interface {
UnsafeL2Head() eth.L2BlockRef UnsafeL2Head() eth.L2BlockRef
SafeL2Head() eth.L2BlockRef SafeL2Head() eth.L2BlockRef
Origin() eth.L1BlockRef Origin() eth.L1BlockRef
SystemConfig() eth.SystemConfig
SetUnsafeHead(head eth.L2BlockRef) SetUnsafeHead(head eth.L2BlockRef)
Finalize(l1Origin eth.L1BlockRef) Finalize(l1Origin eth.L1BlockRef)
...@@ -66,14 +67,14 @@ type DerivationPipeline struct { ...@@ -66,14 +67,14 @@ type DerivationPipeline struct {
func NewDerivationPipeline(log log.Logger, cfg *rollup.Config, l1Fetcher L1Fetcher, engine Engine, metrics Metrics) *DerivationPipeline { func NewDerivationPipeline(log log.Logger, cfg *rollup.Config, l1Fetcher L1Fetcher, engine Engine, metrics Metrics) *DerivationPipeline {
// Pull stages // Pull stages
l1Traversal := NewL1Traversal(log, l1Fetcher) l1Traversal := NewL1Traversal(log, cfg, l1Fetcher)
dataSrc := NewDataSourceFactory(log, cfg, l1Fetcher) // auxiliary stage for L1Retrieval dataSrc := NewDataSourceFactory(log, cfg, l1Fetcher) // auxiliary stage for L1Retrieval
l1Src := NewL1Retrieval(log, dataSrc, l1Traversal) l1Src := NewL1Retrieval(log, dataSrc, l1Traversal)
frameQueue := NewFrameQueue(log, l1Src) frameQueue := NewFrameQueue(log, l1Src)
bank := NewChannelBank(log, cfg, frameQueue, l1Fetcher) bank := NewChannelBank(log, cfg, frameQueue, l1Fetcher)
chInReader := NewChannelInReader(log, bank) chInReader := NewChannelInReader(log, bank)
batchQueue := NewBatchQueue(log, cfg, chInReader) batchQueue := NewBatchQueue(log, cfg, chInReader)
attributesQueue := NewAttributesQueue(log, cfg, l1Fetcher, batchQueue) attributesQueue := NewAttributesQueue(log, cfg, l1Fetcher, engine, batchQueue)
// Step stages // Step stages
eng := NewEngineQueue(log, cfg, engine, metrics, attributesQueue, l1Fetcher) eng := NewEngineQueue(log, cfg, engine, metrics, attributesQueue, l1Fetcher)
...@@ -148,7 +149,7 @@ func (dp *DerivationPipeline) Step(ctx context.Context) error { ...@@ -148,7 +149,7 @@ func (dp *DerivationPipeline) Step(ctx context.Context) error {
// if any stages need to be reset, do that first. // if any stages need to be reset, do that first.
if dp.resetting < len(dp.stages) { if dp.resetting < len(dp.stages) {
if err := dp.stages[dp.resetting].Reset(ctx, dp.eng.Origin()); err == io.EOF { if err := dp.stages[dp.resetting].Reset(ctx, dp.eng.Origin(), dp.eng.SystemConfig()); err == io.EOF {
dp.log.Debug("reset of stage completed", "stage", dp.resetting, "origin", dp.eng.Origin()) dp.log.Debug("reset of stage completed", "stage", dp.resetting, "origin", dp.eng.Origin())
dp.resetting += 1 dp.resetting += 1
return nil return nil
......
package derive
import (
"bytes"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/hashicorp/go-multierror"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup"
)
var (
SystemConfigUpdateBatcher = common.Hash{31: 0}
SystemConfigUpdateGasConfig = common.Hash{31: 1}
)
var (
ConfigUpdateEventABI = "ConfigUpdate(uint256,uint8,bytes)"
ConfigUpdateEventABIHash = crypto.Keccak256Hash([]byte(ConfigUpdateEventABI))
ConfigUpdateEventVersion0 = common.Hash{}
)
// UpdateSystemConfigWithL1Receipts filters all L1 receipts to find config updates and applies the config updates to the given sysCfg
func UpdateSystemConfigWithL1Receipts(sysCfg *eth.SystemConfig, receipts []*types.Receipt, cfg *rollup.Config) error {
var result error
for i, rec := range receipts {
if rec.Status != types.ReceiptStatusSuccessful {
continue
}
for j, log := range rec.Logs {
if log.Address == cfg.L1SystemConfigAddress && len(log.Topics) > 0 && log.Topics[0] == ConfigUpdateEventABIHash {
if err := ProcessSystemConfigUpdateLogEvent(sysCfg, log); err != nil {
result = multierror.Append(result, fmt.Errorf("malformatted L1 system sysCfg log in receipt %d, log %d: %w", i, j, err))
}
}
}
}
return result
}
// ProcessSystemConfigUpdateLogEvent decodes an EVM log entry emitted by the system config contract and applies it as a system config change.
//
// parse log data for:
//
// event ConfigUpdate(
// uint256 indexed version,
// UpdateType indexed updateType,
// bytes data
// );
func ProcessSystemConfigUpdateLogEvent(destSysCfg *eth.SystemConfig, ev *types.Log) error {
if len(ev.Topics) != 3 {
return fmt.Errorf("expected 3 event topics (event identity, indexed version, indexed updateType), got %d", len(ev.Topics))
}
if ev.Topics[0] != ConfigUpdateEventABIHash {
return fmt.Errorf("invalid deposit event selector: %s, expected %s", ev.Topics[0], DepositEventABIHash)
}
// indexed 0
version := ev.Topics[1]
if version != ConfigUpdateEventVersion0 {
return fmt.Errorf("unrecognized L1 sysCfg update event version: %s", version)
}
// indexed 1
updateType := ev.Topics[2]
// unindexed data
switch updateType {
case SystemConfigUpdateBatcher:
if len(ev.Data) != 32*3 {
return fmt.Errorf("expected 32*3 bytes in batcher hash update, but got %d bytes", len(ev.Data))
}
if x := common.BytesToHash(ev.Data[:32]); x != (common.Hash{31: 32}) {
return fmt.Errorf("expected offset to point to length location, but got %s", x)
}
if x := common.BytesToHash(ev.Data[32:64]); x != (common.Hash{31: 32}) {
return fmt.Errorf("expected length of 1 bytes32, but got %s", x)
}
if !bytes.Equal(ev.Data[64:64+12], make([]byte, 12)) {
return fmt.Errorf("expected version 0 batcher hash with zero padding, but got %x", ev.Data)
}
destSysCfg.BatcherAddr.SetBytes(ev.Data[64+12:])
return nil
case SystemConfigUpdateGasConfig: // left padded uint8
if len(ev.Data) != 32*4 {
return fmt.Errorf("expected 32*4 bytes in GPO params update data, but got %d", len(ev.Data))
}
if x := common.BytesToHash(ev.Data[:32]); x != (common.Hash{31: 32}) {
return fmt.Errorf("expected offset to point to length location, but got %s", x)
}
if x := common.BytesToHash(ev.Data[32:64]); x != (common.Hash{31: 64}) {
return fmt.Errorf("expected length of 2 bytes32, but got %s", x)
}
copy(destSysCfg.Overhead[:], ev.Data[64:96])
copy(destSysCfg.Scalar[:], ev.Data[96:128])
return nil
default:
return fmt.Errorf("unrecognized L1 sysCfg update type: %s", updateType)
}
}
...@@ -50,7 +50,7 @@ func (d *Sequencer) StartBuildingBlock(ctx context.Context, l2Head eth.L2BlockRe ...@@ -50,7 +50,7 @@ func (d *Sequencer) StartBuildingBlock(ctx context.Context, l2Head eth.L2BlockRe
fetchCtx, cancel := context.WithTimeout(ctx, time.Second*20) fetchCtx, cancel := context.WithTimeout(ctx, time.Second*20)
defer cancel() defer cancel()
attrs, err := derive.PreparePayloadAttributes(fetchCtx, d.config, d.l1, l2Head, l2Head.Time+d.config.BlockTime, l1Origin.ID()) attrs, err := derive.PreparePayloadAttributes(fetchCtx, d.config, d.l1, d.l2, l2Head, l2Head.Time+d.config.BlockTime, l1Origin.ID())
if err != nil { if err != nil {
return err return err
} }
......
...@@ -5,9 +5,10 @@ import ( ...@@ -5,9 +5,10 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-node/eth"
) )
type Genesis struct { type Genesis struct {
...@@ -17,6 +18,10 @@ type Genesis struct { ...@@ -17,6 +18,10 @@ type Genesis struct {
L2 eth.BlockID `json:"l2"` L2 eth.BlockID `json:"l2"`
// Timestamp of L2 block // Timestamp of L2 block
L2Time uint64 `json:"l2_time"` L2Time uint64 `json:"l2_time"`
// Initial system configuration values.
// The L2 genesis block may not include transactions, and thus cannot encode the config values,
// unlike later L2 blocks.
SystemConfig eth.SystemConfig `json:"system_config"`
} }
type Config struct { type Config struct {
...@@ -47,10 +52,10 @@ type Config struct { ...@@ -47,10 +52,10 @@ type Config struct {
// L1 address that batches are sent to. // L1 address that batches are sent to.
BatchInboxAddress common.Address `json:"batch_inbox_address"` BatchInboxAddress common.Address `json:"batch_inbox_address"`
// Acceptable batch-sender address
BatchSenderAddress common.Address `json:"batch_sender_address"`
// L1 Deposit Contract Address // L1 Deposit Contract Address
DepositContractAddress common.Address `json:"deposit_contract_address"` DepositContractAddress common.Address `json:"deposit_contract_address"`
// L1 System Config Address
L1SystemConfigAddress common.Address `json:"l1_system_config_address"`
} }
// Check verifies that the given configuration makes sense // Check verifies that the given configuration makes sense
...@@ -82,9 +87,6 @@ func (cfg *Config) Check() error { ...@@ -82,9 +87,6 @@ func (cfg *Config) Check() error {
if cfg.BatchInboxAddress == (common.Address{}) { if cfg.BatchInboxAddress == (common.Address{}) {
return errors.New("missing batch inbox address") return errors.New("missing batch inbox address")
} }
if cfg.BatchSenderAddress == (common.Address{}) {
return errors.New("missing batch sender address")
}
if cfg.DepositContractAddress == (common.Address{}) { if cfg.DepositContractAddress == (common.Address{}) {
return errors.New("missing deposit contract address") return errors.New("missing deposit contract address")
} }
......
...@@ -9,12 +9,13 @@ import ( ...@@ -9,12 +9,13 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-node/eth"
) )
func randConfig() *Config { func randConfig() *Config {
randHash := func() (out common.Hash) { randHash := func() (out [32]byte) {
rand.Read(out[:]) rand.Read(out[:])
return return
} }
...@@ -27,13 +28,22 @@ func randConfig() *Config { ...@@ -27,13 +28,22 @@ func randConfig() *Config {
L1: eth.BlockID{Hash: randHash(), Number: 424242}, L1: eth.BlockID{Hash: randHash(), Number: 424242},
L2: eth.BlockID{Hash: randHash(), Number: 1337}, L2: eth.BlockID{Hash: randHash(), Number: 1337},
L2Time: uint64(time.Now().Unix()), L2Time: uint64(time.Now().Unix()),
SystemConfig: eth.SystemConfig{
BatcherAddr: randAddr(),
Overhead: randHash(),
Scalar: randHash(),
},
}, },
BlockTime: 2, BlockTime: 2,
MaxSequencerDrift: 100, MaxSequencerDrift: 100,
SeqWindowSize: 2, SeqWindowSize: 2,
L1ChainID: big.NewInt(900), ChannelTimeout: 123,
BatchInboxAddress: randAddr(), L1ChainID: big.NewInt(900),
BatchSenderAddress: randAddr(), L2ChainID: big.NewInt(901),
P2PSequencerAddress: randAddr(),
BatchInboxAddress: randAddr(),
DepositContractAddress: randAddr(),
L1SystemConfigAddress: randAddr(),
} }
} }
......
...@@ -5,22 +5,24 @@ import ( ...@@ -5,22 +5,24 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/client" "github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/eth" "github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive" "github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum-optimism/optimism/op-node/sources/caching" "github.com/ethereum-optimism/optimism/op-node/sources/caching"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
) )
type L2ClientConfig struct { type L2ClientConfig struct {
EthClientConfig EthClientConfig
L2BlockRefsCacheSize int L2BlockRefsCacheSize int
L1ConfigsCacheSize int
Genesis rollup.Genesis RollupCfg *rollup.Config
} }
func L2ClientDefaultConfig(config *rollup.Config, trustRPC bool) *L2ClientConfig { func L2ClientDefaultConfig(config *rollup.Config, trustRPC bool) *L2ClientConfig {
...@@ -48,18 +50,23 @@ func L2ClientDefaultConfig(config *rollup.Config, trustRPC bool) *L2ClientConfig ...@@ -48,18 +50,23 @@ func L2ClientDefaultConfig(config *rollup.Config, trustRPC bool) *L2ClientConfig
MustBePostMerge: true, MustBePostMerge: true,
}, },
L2BlockRefsCacheSize: span, L2BlockRefsCacheSize: span,
Genesis: config.Genesis, L1ConfigsCacheSize: span,
RollupCfg: config,
} }
} }
// L2Client extends EthClient with functions to fetch and cache eth.L2BlockRef values. // L2Client extends EthClient with functions to fetch and cache eth.L2BlockRef values.
type L2Client struct { type L2Client struct {
*EthClient *EthClient
genesis *rollup.Genesis rollupCfg *rollup.Config
// cache L2BlockRef by hash // cache L2BlockRef by hash
// common.Hash -> eth.L2BlockRef // common.Hash -> eth.L2BlockRef
l2BlockRefsCache *caching.LRUCache l2BlockRefsCache *caching.LRUCache
// cache SystemConfig by L2 hash
// common.Hash -> eth.SystemConfig
systemConfigsCache *caching.LRUCache
} }
func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, config *L2ClientConfig) (*L2Client, error) { func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, config *L2ClientConfig) (*L2Client, error) {
...@@ -69,9 +76,10 @@ func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, con ...@@ -69,9 +76,10 @@ func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, con
} }
return &L2Client{ return &L2Client{
EthClient: ethClient, EthClient: ethClient,
genesis: &config.Genesis, rollupCfg: config.RollupCfg,
l2BlockRefsCache: caching.NewLRUCache(metrics, "blockrefs", config.L2BlockRefsCacheSize), l2BlockRefsCache: caching.NewLRUCache(metrics, "blockrefs", config.L2BlockRefsCacheSize),
systemConfigsCache: caching.NewLRUCache(metrics, "systemconfigs", config.L1ConfigsCacheSize),
}, nil }, nil
} }
...@@ -87,7 +95,7 @@ func (s *L2Client) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) ...@@ -87,7 +95,7 @@ func (s *L2Client) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel)
// w%: wrap to preserve ethereum.NotFound case // w%: wrap to preserve ethereum.NotFound case
return eth.L2BlockRef{}, fmt.Errorf("failed to determine L2BlockRef of %s, could not get payload: %w", label, err) return eth.L2BlockRef{}, fmt.Errorf("failed to determine L2BlockRef of %s, could not get payload: %w", label, err)
} }
ref, err := derive.PayloadToBlockRef(payload, s.genesis) ref, err := derive.PayloadToBlockRef(payload, &s.rollupCfg.Genesis)
if err != nil { if err != nil {
return eth.L2BlockRef{}, err return eth.L2BlockRef{}, err
} }
...@@ -102,7 +110,7 @@ func (s *L2Client) L2BlockRefByNumber(ctx context.Context, num uint64) (eth.L2Bl ...@@ -102,7 +110,7 @@ func (s *L2Client) L2BlockRefByNumber(ctx context.Context, num uint64) (eth.L2Bl
// w%: wrap to preserve ethereum.NotFound case // w%: wrap to preserve ethereum.NotFound case
return eth.L2BlockRef{}, fmt.Errorf("failed to determine L2BlockRef of height %v, could not get payload: %w", num, err) return eth.L2BlockRef{}, fmt.Errorf("failed to determine L2BlockRef of height %v, could not get payload: %w", num, err)
} }
ref, err := derive.PayloadToBlockRef(payload, s.genesis) ref, err := derive.PayloadToBlockRef(payload, &s.rollupCfg.Genesis)
if err != nil { if err != nil {
return eth.L2BlockRef{}, err return eth.L2BlockRef{}, err
} }
...@@ -122,10 +130,30 @@ func (s *L2Client) L2BlockRefByHash(ctx context.Context, hash common.Hash) (eth. ...@@ -122,10 +130,30 @@ func (s *L2Client) L2BlockRefByHash(ctx context.Context, hash common.Hash) (eth.
// w%: wrap to preserve ethereum.NotFound case // w%: wrap to preserve ethereum.NotFound case
return eth.L2BlockRef{}, fmt.Errorf("failed to determine block-hash of hash %v, could not get payload: %w", hash, err) return eth.L2BlockRef{}, fmt.Errorf("failed to determine block-hash of hash %v, could not get payload: %w", hash, err)
} }
ref, err := derive.PayloadToBlockRef(payload, s.genesis) ref, err := derive.PayloadToBlockRef(payload, &s.rollupCfg.Genesis)
if err != nil { if err != nil {
return eth.L2BlockRef{}, err return eth.L2BlockRef{}, err
} }
s.l2BlockRefsCache.Add(ref.Hash, ref) s.l2BlockRefsCache.Add(ref.Hash, ref)
return ref, nil return ref, nil
} }
// SystemConfigByL2Hash returns the system config (matching the config updates up to and including the L1 origin) for the given L2 block hash.
// The returned SystemConfig may not be in the canonical chain when the hash is not canonical.
func (s *L2Client) SystemConfigByL2Hash(ctx context.Context, hash common.Hash) (eth.SystemConfig, error) {
if ref, ok := s.systemConfigsCache.Get(hash); ok {
return ref.(eth.SystemConfig), nil
}
payload, err := s.PayloadByHash(ctx, hash)
if err != nil {
// w%: wrap to preserve ethereum.NotFound case
return eth.SystemConfig{}, fmt.Errorf("failed to determine block-hash of hash %v, could not get payload: %w", hash, err)
}
cfg, err := derive.PayloadToSystemConfig(payload, s.rollupCfg)
if err != nil {
return eth.SystemConfig{}, err
}
s.systemConfigsCache.Add(hash, cfg)
return cfg, nil
}
...@@ -3,8 +3,9 @@ package testutils ...@@ -3,8 +3,9 @@ package testutils
import ( import (
"context" "context"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-node/eth"
) )
type MockL2Client struct { type MockL2Client struct {
...@@ -34,3 +35,11 @@ func (c *MockL2Client) L2BlockRefByHash(ctx context.Context, hash common.Hash) ( ...@@ -34,3 +35,11 @@ func (c *MockL2Client) L2BlockRefByHash(ctx context.Context, hash common.Hash) (
func (m *MockL2Client) ExpectL2BlockRefByHash(hash common.Hash, ref eth.L2BlockRef, err error) { func (m *MockL2Client) ExpectL2BlockRefByHash(hash common.Hash, ref eth.L2BlockRef, err error) {
m.Mock.On("L2BlockRefByHash", hash).Once().Return(ref, &err) m.Mock.On("L2BlockRefByHash", hash).Once().Return(ref, &err)
} }
func (m *MockL2Client) SystemConfigByL2Hash(ctx context.Context, hash common.Hash) (eth.SystemConfig, error) {
return m.Mock.MethodCalled("SystemConfigByL2Hash", hash).Get(0).(eth.SystemConfig), nil
}
func (m *MockL2Client) ExpectSystemConfigByL2Hash(hash common.Hash, cfg eth.SystemConfig, err error) {
m.Mock.On("SystemConfigByL2Hash", hash).Once().Return(cfg, &err)
}
...@@ -76,4 +76,4 @@ require ( ...@@ -76,4 +76,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -148,8 +148,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF ...@@ -148,8 +148,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc= github.com/ethereum-optimism/optimism/op-bindings v0.8.10 h1:aSAWCQwBQnbmv03Gvtuvn3qfTWrZu/sTlRAWrpQhiHc=
github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM= github.com/ethereum-optimism/optimism/op-bindings v0.8.10/go.mod h1:pyTCbh2o/SY+5/AL2Qo5GgAao3Gtt9Ff6tfK9Pa9emM=
github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU= github.com/ethereum-optimism/optimism/op-node v0.8.10 h1:1Gc4FtR5B+HgfQ+byNn3P+tiJarpMZSYjj5iLvA3YtU=
......
...@@ -65,4 +65,4 @@ require ( ...@@ -65,4 +65,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 replace github.com/ethereum/go-ethereum v1.10.23 => github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa
...@@ -109,8 +109,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF ...@@ -109,8 +109,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33 h1:UOybCb34mL2rw2cXcFfKsu9134OtvtkR4EU2ZLfbT9A= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa h1:jQ6FlSUf8BOttQexgqHjltQhn495S2oL06/UA20co9w=
github.com/ethereum-optimism/op-geth v0.0.0-20221101003447-b6cc499f3e33/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/ethereum-optimism/op-geth v0.0.0-20221104021113-befc264446fa/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ= github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ=
github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
...@@ -26,34 +26,29 @@ Encoding_Test:test_encodeDepositTransaction_differential(address,address,uint256 ...@@ -26,34 +26,29 @@ Encoding_Test:test_encodeDepositTransaction_differential(address,address,uint256
Encoding_Test:test_nonceVersioning(uint240,uint16) (runs: 256, μ: 652, ~: 652) Encoding_Test:test_nonceVersioning(uint240,uint16) (runs: 256, μ: 652, ~: 652)
FeeVault_Test:test_constructor() (gas: 10748) FeeVault_Test:test_constructor() (gas: 10748)
FeeVault_Test:test_minWithdrawalAmount() (gas: 10711) FeeVault_Test:test_minWithdrawalAmount() (gas: 10711)
GasPriceOracle_Test:test_baseFee() (gas: 8392) GasPriceOracle_Test:test_baseFee() (gas: 8391)
GasPriceOracle_Test:test_gasPrice() (gas: 8381) GasPriceOracle_Test:test_gasPrice() (gas: 8382)
GasPriceOracle_Test:test_l1BaseFee() (gas: 10648) GasPriceOracle_Test:test_l1BaseFee() (gas: 10591)
GasPriceOracle_Test:test_onlyOwnerSetDecimals() (gas: 10590) GasPriceOracle_Test:test_overhead() (gas: 10614)
GasPriceOracle_Test:test_onlyOwnerSetOverhead() (gas: 10625) GasPriceOracle_Test:test_owner() (gas: 9718)
GasPriceOracle_Test:test_onlyOwnerSetScalar() (gas: 10589) GasPriceOracle_Test:test_scalar() (gas: 10633)
GasPriceOracle_Test:test_owner() (gas: 9828) GasPriceOracle_Test:test_setGasPriceReverts() (gas: 11652)
GasPriceOracle_Test:test_setDecimals() (gas: 36866) GasPriceOracle_Test:test_setL1BaseFeeReverts() (gas: 11695)
GasPriceOracle_Test:test_setGasPriceReverts() (gas: 11762)
GasPriceOracle_Test:test_setL1BaseFeeReverts() (gas: 11739)
GasPriceOracle_Test:test_setOverhead() (gas: 36813)
GasPriceOracle_Test:test_setScalar() (gas: 36820)
GasPriceOracle_Test:test_storageLayout() (gas: 86777)
Hashing_Test:test_hashCrossDomainMessage_differential(uint256,address,address,uint256,uint256,bytes) (runs: 256, μ: 23905, ~: 23788) Hashing_Test:test_hashCrossDomainMessage_differential(uint256,address,address,uint256,uint256,bytes) (runs: 256, μ: 23905, ~: 23788)
Hashing_Test:test_hashDepositSource() (gas: 628) Hashing_Test:test_hashDepositSource() (gas: 628)
Hashing_Test:test_hashDepositTransaction_differential(address,address,uint256,uint256,uint64,bytes,uint256) (runs: 256, μ: 66710, ~: 66432) Hashing_Test:test_hashDepositTransaction_differential(address,address,uint256,uint256,uint64,bytes,uint256) (runs: 256, μ: 66710, ~: 66432)
Hashing_Test:test_hashOutputRootProof_differential(bytes32,bytes32,bytes32,bytes32) (runs: 256, μ: 72062, ~: 93483) Hashing_Test:test_hashOutputRootProof_differential(bytes32,bytes32,bytes32,bytes32) (runs: 256, μ: 72062, ~: 93483)
Hashing_Test:test_hashWithdrawal_differential(uint256,address,address,uint256,uint256,bytes) (runs: 256, μ: 23654, ~: 23478) Hashing_Test:test_hashWithdrawal_differential(uint256,address,address,uint256,uint256,bytes) (runs: 256, μ: 23654, ~: 23478)
L1BlockTest:test_basefee() (gas: 7575) L1BlockTest:test_basefee() (gas: 7553)
L1BlockTest:test_hash() (gas: 7552) L1BlockTest:test_hash() (gas: 7597)
L1BlockTest:test_number() (gas: 7629) L1BlockTest:test_number() (gas: 7630)
L1BlockTest:test_sequenceNumber() (gas: 7650) L1BlockTest:test_sequenceNumber() (gas: 7717)
L1BlockTest:test_timestamp() (gas: 7661) L1BlockTest:test_timestamp() (gas: 7661)
L1BlockTest:test_updateValues() (gas: 28193) L1BlockTest:test_updateValues() (gas: 60482)
L1BlockTest:test_updatesValues(uint64,uint64,uint256,bytes32,uint64) (runs: 256, μ: 35307, ~: 35717) L1BlockTest:test_updatesValues(uint64,uint64,uint256,bytes32,uint64,bytes32,uint256,uint256) (runs: 256, μ: 69398, ~: 70615)
L1BlockNumberTest:test_fallback() (gas: 18677) L1BlockNumberTest:test_fallback() (gas: 18678)
L1BlockNumberTest:test_getL1BlockNumber() (gas: 10668) L1BlockNumberTest:test_getL1BlockNumber() (gas: 10669)
L1BlockNumberTest:test_receive() (gas: 25340) L1BlockNumberTest:test_receive() (gas: 25341)
L1CrossDomainMessenger_Test:testCannot_L1MessengerPause() (gas: 24560) L1CrossDomainMessenger_Test:testCannot_L1MessengerPause() (gas: 24560)
L1CrossDomainMessenger_Test:testCannot_L1MessengerUnpause() (gas: 24518) L1CrossDomainMessenger_Test:testCannot_L1MessengerUnpause() (gas: 24518)
L1CrossDomainMessenger_Test:test_L1MessengerMessageVersion() (gas: 24738) L1CrossDomainMessenger_Test:test_L1MessengerMessageVersion() (gas: 24738)
......
...@@ -104,6 +104,30 @@ ...@@ -104,6 +104,30 @@
| finalizedWithdrawals | mapping(bytes32 => bool) | 51 | 0 | 32 | contracts/L1/OptimismPortal.sol:OptimismPortal | | finalizedWithdrawals | mapping(bytes32 => bool) | 51 | 0 | 32 | contracts/L1/OptimismPortal.sol:OptimismPortal |
+----------------------+----------------------------------------+------+--------+-------+------------------------------------------------+ +----------------------+----------------------------------------+------+--------+-------+------------------------------------------------+
=======================
➡ contracts/L1/SystemConfig.sol:SystemConfig
=======================
+---------------+-------------+------+--------+-------+--------------------------------------------+
| Name | Type | Slot | Offset | Bytes | Contract |
+==================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| _initializing | bool | 0 | 1 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[50] | 1 | 0 | 1600 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| _owner | address | 51 | 0 | 20 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[49] | 52 | 0 | 1568 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| overhead | uint256 | 101 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| scalar | uint256 | 102 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| batcherHash | bytes32 | 103 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
+---------------+-------------+------+--------+-------+--------------------------------------------+
======================= =======================
➡ contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist ➡ contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist
======================= =======================
...@@ -129,11 +153,9 @@ ...@@ -129,11 +153,9 @@
|---------------+---------+------+--------+-------+------------------------------------------------| |---------------+---------+------+--------+-------+------------------------------------------------|
| spacer_2_0_32 | uint256 | 2 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle | | spacer_2_0_32 | uint256 | 2 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
|---------------+---------+------+--------+-------+------------------------------------------------| |---------------+---------+------+--------+-------+------------------------------------------------|
| overhead | uint256 | 3 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle | | spacer_3_0_32 | uint256 | 3 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
|---------------+---------+------+--------+-------+------------------------------------------------| |---------------+---------+------+--------+-------+------------------------------------------------|
| scalar | uint256 | 4 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle | | spacer_4_0_32 | uint256 | 4 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
|---------------+---------+------+--------+-------+------------------------------------------------|
| decimals | uint256 | 5 | 0 | 32 | contracts/L2/GasPriceOracle.sol:GasPriceOracle |
+---------------+---------+------+--------+-------+------------------------------------------------+ +---------------+---------+------+--------+-------+------------------------------------------------+
======================= =======================
...@@ -152,6 +174,12 @@ ...@@ -152,6 +174,12 @@
| hash | bytes32 | 2 | 0 | 32 | contracts/L2/L1Block.sol:L1Block | | hash | bytes32 | 2 | 0 | 32 | contracts/L2/L1Block.sol:L1Block |
|----------------+---------+------+--------+-------+----------------------------------| |----------------+---------+------+--------+-------+----------------------------------|
| sequenceNumber | uint64 | 3 | 0 | 8 | contracts/L2/L1Block.sol:L1Block | | sequenceNumber | uint64 | 3 | 0 | 8 | contracts/L2/L1Block.sol:L1Block |
|----------------+---------+------+--------+-------+----------------------------------|
| batcherHash | bytes32 | 4 | 0 | 32 | contracts/L2/L1Block.sol:L1Block |
|----------------+---------+------+--------+-------+----------------------------------|
| l1FeeOverhead | uint256 | 5 | 0 | 32 | contracts/L2/L1Block.sol:L1Block |
|----------------+---------+------+--------+-------+----------------------------------|
| l1FeeScalar | uint256 | 6 | 0 | 32 | contracts/L2/L1Block.sol:L1Block |
+----------------+---------+------+--------+-------+----------------------------------+ +----------------+---------+------+--------+-------+----------------------------------+
======================= =======================
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { Semver } from "../universal/Semver.sol";
/**
* @title SystemConfig
* @notice This contract is used to update L2 configuration via L1
*/
contract SystemConfig is OwnableUpgradeable, Semver {
uint256 public constant VERSION = 0;
uint256 public overhead;
uint256 public scalar;
bytes32 public batcherHash;
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
enum UpdateType {
BATCHER,
GAS_CONFIG
}
constructor(
address _owner,
uint256 _overhead,
uint256 _scalar,
bytes32 _batcherHash
) Semver(0, 0, 1) {
initialize(_owner, _overhead, _scalar, _batcherHash);
}
/**
* @notice Initializer;
*/
function initialize(
address _owner,
uint256 _overhead,
uint256 _scalar,
bytes32 _batcherHash
) public initializer {
__Ownable_init();
transferOwnership(_owner);
overhead = _overhead;
scalar = _scalar;
batcherHash = _batcherHash;
}
function setBatcherHash(bytes32 _batcherHash) external onlyOwner {
batcherHash = _batcherHash;
bytes memory data = abi.encode(_batcherHash);
emit ConfigUpdate(VERSION, UpdateType.BATCHER, data);
}
function setGasConfig(uint256 _overhead, uint256 _scalar) external onlyOwner {
overhead = _overhead;
scalar = _scalar;
bytes memory data = abi.encode(_overhead, _scalar);
emit ConfigUpdate(VERSION, UpdateType.GAS_CONFIG, data);
}
}
...@@ -32,19 +32,23 @@ contract GasPriceOracle is Ownable, Semver { ...@@ -32,19 +32,23 @@ contract GasPriceOracle is Ownable, Semver {
uint256 private spacer_2_0_32; uint256 private spacer_2_0_32;
/** /**
* @notice Constant L1 gas overhead per transaction. * @custom:legacy
* @custom:spacer overhead
* @notice Spacer for backwards compatibility.
*/ */
uint256 public overhead; uint256 private spacer_3_0_32;
/** /**
* @notice Dynamic L1 gas overhead per transaction. * @custom:legacy
* @custom:spacer scalar
* @notice Spacer for backwards compatibility.
*/ */
uint256 public scalar; uint256 private spacer_4_0_32;
/** /**
* @notice Number of decimals used in the scalar. * @notice Number of decimals used in the scalar.
*/ */
uint256 public decimals; uint256 public constant decimals = 6;
/** /**
* @notice Emitted when the overhead value is updated. * @notice Emitted when the overhead value is updated.
...@@ -70,36 +74,6 @@ contract GasPriceOracle is Ownable, Semver { ...@@ -70,36 +74,6 @@ contract GasPriceOracle is Ownable, Semver {
transferOwnership(_owner); transferOwnership(_owner);
} }
/**
* @notice Allows the owner to modify the overhead.
*
* @param _overhead New overhead value.
*/
function setOverhead(uint256 _overhead) external onlyOwner {
overhead = _overhead;
emit OverheadUpdated(_overhead);
}
/**
* @notice Allows the owner to modify the scalar.
*
* @param _scalar New scalar value.
*/
function setScalar(uint256 _scalar) external onlyOwner {
scalar = _scalar;
emit ScalarUpdated(_scalar);
}
/**
* @notice Allows the owner to modify the decimals.
*
* @param _decimals New decimals value.
*/
function setDecimals(uint256 _decimals) external onlyOwner {
decimals = _decimals;
emit DecimalsUpdated(_decimals);
}
/** /**
* @notice Computes the L1 portion of the fee based on the size of the rlp encoded input * @notice Computes the L1 portion of the fee based on the size of the rlp encoded input
* transaction, the current L1 base fee, and the various dynamic parameters. * transaction, the current L1 base fee, and the various dynamic parameters.
...@@ -112,7 +86,7 @@ contract GasPriceOracle is Ownable, Semver { ...@@ -112,7 +86,7 @@ contract GasPriceOracle is Ownable, Semver {
uint256 l1GasUsed = getL1GasUsed(_data); uint256 l1GasUsed = getL1GasUsed(_data);
uint256 l1Fee = l1GasUsed * l1BaseFee(); uint256 l1Fee = l1GasUsed * l1BaseFee();
uint256 divisor = 10**decimals; uint256 divisor = 10**decimals;
uint256 unscaled = l1Fee * scalar; uint256 unscaled = l1Fee * scalar();
uint256 scaled = unscaled / divisor; uint256 scaled = unscaled / divisor;
return scaled; return scaled;
} }
...@@ -135,6 +109,24 @@ contract GasPriceOracle is Ownable, Semver { ...@@ -135,6 +109,24 @@ contract GasPriceOracle is Ownable, Semver {
return block.basefee; return block.basefee;
} }
/**
* @notice Retrieves the current fee overhead.
*
* @return Current fee overhead.
*/
function overhead() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
}
/**
* @notice Retrieves the current fee scalar.
*
* @return Current fee scalar.
*/
function scalar() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
}
/** /**
* @notice Retrieves the latest known L1 base fee. * @notice Retrieves the latest known L1 base fee.
* *
...@@ -164,7 +156,7 @@ contract GasPriceOracle is Ownable, Semver { ...@@ -164,7 +156,7 @@ contract GasPriceOracle is Ownable, Semver {
total += 16; total += 16;
} }
} }
uint256 unsigned = total + overhead; uint256 unsigned = total + overhead();
return unsigned + (68 * 16); return unsigned + (68 * 16);
} }
} }
...@@ -43,6 +43,22 @@ contract L1Block is Semver { ...@@ -43,6 +43,22 @@ contract L1Block is Semver {
*/ */
uint64 public sequenceNumber; uint64 public sequenceNumber;
/**
* @notice The versioned hash to authenticate the batcher by.
*/
bytes32 public batcherHash;
/**
* @notice The overhead value applied to the L1 portion of the transaction
* fee.
*/
uint256 public l1FeeOverhead;
/**
* @notice The scalar value applied to the L1 portion of the transaction fee.
*/
uint256 public l1FeeScalar;
/** /**
* @custom:semver 0.0.1 * @custom:semver 0.0.1
*/ */
...@@ -56,13 +72,19 @@ contract L1Block is Semver { ...@@ -56,13 +72,19 @@ contract L1Block is Semver {
* @param _basefee L1 basefee. * @param _basefee L1 basefee.
* @param _hash L1 blockhash. * @param _hash L1 blockhash.
* @param _sequenceNumber Number of L2 blocks since epoch start. * @param _sequenceNumber Number of L2 blocks since epoch start.
* @param _batcherHash Versioned hash to authenticate batcher by.
* @param _l1FeeOverhead L1 fee overhead.
* @param _l1FeeScalar L1 fee scalar.
*/ */
function setL1BlockValues( function setL1BlockValues(
uint64 _number, uint64 _number,
uint64 _timestamp, uint64 _timestamp,
uint256 _basefee, uint256 _basefee,
bytes32 _hash, bytes32 _hash,
uint64 _sequenceNumber uint64 _sequenceNumber,
bytes32 _batcherHash,
uint256 _l1FeeOverhead,
uint256 _l1FeeScalar
) external { ) external {
require( require(
msg.sender == DEPOSITOR_ACCOUNT, msg.sender == DEPOSITOR_ACCOUNT,
...@@ -74,5 +96,8 @@ contract L1Block is Semver { ...@@ -74,5 +96,8 @@ contract L1Block is Semver {
basefee = _basefee; basefee = _basefee;
hash = _hash; hash = _hash;
sequenceNumber = _sequenceNumber; sequenceNumber = _sequenceNumber;
batcherHash = _batcherHash;
l1FeeOverhead = _l1FeeOverhead;
l1FeeScalar = _l1FeeScalar;
} }
} }
...@@ -11,6 +11,7 @@ import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20 ...@@ -11,6 +11,7 @@ import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20
import { AddressManager } from "../legacy/AddressManager.sol"; import { AddressManager } from "../legacy/AddressManager.sol";
import { PortalSender } from "./PortalSender.sol"; import { PortalSender } from "./PortalSender.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { SystemConfig } from "./DeployConfig.sol";
/** /**
* @title BaseSystemDictator * @title BaseSystemDictator
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { ProxyAdmin } from "../universal/ProxyAdmin.sol";
import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { L1StandardBridge } from "../L1/L1StandardBridge.sol";
import { L1ERC721Bridge } from "../L1/L1ERC721Bridge.sol";
import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20Factory.sol";
import { AddressManager } from "../legacy/AddressManager.sol";
import { PortalSender } from "./PortalSender.sol";
struct GlobalConfig {
AddressManager addressManager;
ProxyAdmin proxyAdmin;
address controller;
address finalOwner;
}
struct ProxyAddressConfig {
address l2OutputOracleProxy;
address optimismPortalProxy;
address l1CrossDomainMessengerProxy;
address l1StandardBridgeProxy;
address optimismMintableERC20FactoryProxy;
address l1ERC721BridgeProxy;
}
struct ImplementationAddressConfig {
L2OutputOracle l2OutputOracleImpl;
OptimismPortal optimismPortalImpl;
L1CrossDomainMessenger l1CrossDomainMessengerImpl;
L1StandardBridge l1StandardBridgeImpl;
OptimismMintableERC20Factory optimismMintableERC20FactoryImpl;
L1ERC721Bridge l1ERC721BridgeImpl;
PortalSender portalSenderImpl;
}
struct L2OutputOracleConfig {
bytes32 l2OutputOracleGenesisL2Output;
address l2OutputOracleProposer;
address l2OutputOracleOwner;
}
struct SystemConfig {
GlobalConfig globalConfig;
ProxyAddressConfig proxyAddressConfig;
ImplementationAddressConfig implementationAddressConfig;
L2OutputOracleConfig l2OutputOracleConfig;
}
...@@ -4,6 +4,7 @@ pragma solidity 0.8.15; ...@@ -4,6 +4,7 @@ pragma solidity 0.8.15;
import { L2OutputOracle } from "../L1/L2OutputOracle.sol"; import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { OptimismPortal } from "../L1/OptimismPortal.sol"; import { OptimismPortal } from "../L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol"; import { L1CrossDomainMessenger } from "../L1/L1CrossDomainMessenger.sol";
import { SystemConfig } from "./DeployConfig.sol";
import { BaseSystemDictator } from "./BaseSystemDictator.sol"; import { BaseSystemDictator } from "./BaseSystemDictator.sol";
/** /**
......
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