From e42292ed8fe5098d6f3aaf63f18d9acc8c76fd77 Mon Sep 17 00:00:00 2001 From: Jeb Bearer Date: Wed, 31 Jan 2024 11:01:04 -0500 Subject: [PATCH] Fix packed encoding of espresso L1 block values --- op-bindings/bindings/l1block.go | 20 +- op-bindings/bindings/l1block_more.go | 4 +- op-node/rollup/derive/l1_block_info.go | 14 +- packages/contracts-bedrock/package.json | 2 +- packages/contracts-bedrock/semver-lock.json | 4 +- .../snapshots/abi/AddressManager.json | 88 +++--- .../snapshots/abi/AssetReceiver.json | 250 +++++++++--------- .../snapshots/abi/L1Block.json | 124 ++++++--- .../snapshots/abi/SystemConfig.json | 223 ++++++++++------ .../snapshots/storageLayout/L1Block.json | 14 + .../snapshots/storageLayout/SystemConfig.json | 14 + packages/contracts-bedrock/src/L2/L1Block.sol | 8 +- .../src/libraries/Encoding.sol | 2 +- .../contracts-bedrock/test/L2/L1Block.t.sol | 4 +- 14 files changed, 458 insertions(+), 313 deletions(-) diff --git a/op-bindings/bindings/l1block.go b/op-bindings/bindings/l1block.go index 53b7014b3af3..88180c0186e0 100644 --- a/op-bindings/bindings/l1block.go +++ b/op-bindings/bindings/l1block.go @@ -45,8 +45,8 @@ type L1BlockL1BlockValues struct { // L1BlockMetaData contains all meta data concerning the L1Block contract. var L1BlockMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"DEPOSITOR_ACCOUNT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"baseFeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"basefee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"batcherHash\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"blobBaseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"blobBaseFeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"espresso\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"espressoL1ConfDepth\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"hash\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1FeeOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1FeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"number\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"sequenceNumber\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setL1BlockValues\",\"inputs\":[{\"name\":\"v\",\"type\":\"tuple\",\"internalType\":\"structL1Block.L1BlockValues\",\"components\":[{\"name\":\"number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"basefee\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"sequenceNumber\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"batcherHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"l1FeeOverhead\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"l1FeeScalar\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"espresso\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"espressoL1ConfDepth\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"justification\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setL1BlockValuesEcotone\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timestamp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"}]", - Bin: "0x608060405234801561001057600080fd5b50610696806100206000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80638381f58a116100b2578063c598591811610081578063e591b28211610066578063e591b282146102a5578063e81b2c6d146102e5578063f8206140146102ee57600080fd5b8063c59859181461026c578063dc59462c1461028c57600080fd5b80638381f58a146102265780638b239f731461023a5780639e8c496614610243578063b80777ea1461024c57600080fd5b80635cf24969116100ee5780635cf24969146101a257806361fba0ca146101ab57806364ca23ef146101c857806368d5dca6146101f557600080fd5b806309bd5a6014610120578063440a5e201461013c57806354b7325c1461014657806354fd4d5014610159575b600080fd5b61012960025481565b6040519081526020015b60405180910390f35b6101446102f7565b005b610144610154366004610587565b610355565b6101956040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161013391906105ca565b61012960015481565b6008546101b89060ff1681565b6040519015158152602001610133565b6003546101dc9067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610133565b6003546102119068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610133565b6000546101dc9067ffffffffffffffff1681565b61012960055481565b61012960065481565b6000546101dc9068010000000000000000900467ffffffffffffffff1681565b600354610211906c01000000000000000000000000900463ffffffff1681565b6008546101dc90610100900467ffffffffffffffff1681565b6102c073deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610133565b61012960045481565b61012960075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461032057633cc50b456000526004601cfd5b60043560801c60035560143560801c60005560243560015560443560075560643560025560843560045560a43560801c600855565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146103fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b610409602082018261063d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff92909216919091179055610452604082016020830161063d565b6000805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055604081013560015560608101356002556104b860a082016080830161063d565b600380547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9290921691909117905560a081013560045560c081013560055560e081013560065561051b61012082016101008301610667565b600880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905561055c6101408201610120830161063d565b600860016101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b60006020828403121561059957600080fd5b813567ffffffffffffffff8111156105b057600080fd5b820161016081850312156105c357600080fd5b9392505050565b600060208083528351808285015260005b818110156105f7578581018301518582016040015282016105db565b81811115610609576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561064f57600080fd5b813567ffffffffffffffff811681146105c357600080fd5b60006020828403121561067957600080fd5b813580151581146105c357600080fdfea164736f6c634300080f000a", + ABI: "[{\"type\":\"function\",\"name\":\"DEPOSITOR_ACCOUNT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"baseFeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"basefee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"batcherHash\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"blobBaseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"blobBaseFeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"espresso\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"espressoL1ConfDepth\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"hash\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1FeeOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1FeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"number\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"sequenceNumber\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setL1BlockValues\",\"inputs\":[{\"name\":\"v\",\"type\":\"tuple\",\"internalType\":\"structL1Block.L1BlockValues\",\"components\":[{\"name\":\"number\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"timestamp\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"basefee\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"sequenceNumber\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"batcherHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"l1FeeOverhead\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"l1FeeScalar\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"espresso\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"espressoL1ConfDepth\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"justification\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setL1BlockValuesEcotone\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"timestamp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"}]", + Bin: "0x608060405234801561001057600080fd5b506106a4806100206000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80638381f58a116100b2578063c598591811610081578063e591b28211610066578063e591b282146102a3578063e81b2c6d146102e3578063f8206140146102ec57600080fd5b8063c598591814610263578063dc59462c1461028357600080fd5b80638381f58a1461021d5780638b239f73146102315780639e8c49661461023a578063b80777ea1461024357600080fd5b80635cf24969116100ee5780635cf24969146101a257806361fba0ca146101ab57806364ca23ef146101d857806368d5dca6146101ec57600080fd5b806309bd5a6014610120578063440a5e201461013c57806354b7325c1461014657806354fd4d5014610159575b600080fd5b61012960025481565b6040519081526020015b60405180910390f35b6101446102f5565b005b610144610154366004610595565b610353565b6101956040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161013391906105d8565b61012960015481565b6008546101bf9067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610133565b6003546101bf9067ffffffffffffffff1681565b6003546102089068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610133565b6000546101bf9067ffffffffffffffff1681565b61012960055481565b61012960065481565b6000546101bf9068010000000000000000900467ffffffffffffffff1681565b600354610208906c01000000000000000000000000900463ffffffff1681565b6008546101bf9068010000000000000000900467ffffffffffffffff1681565b6102be73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610133565b61012960045481565b61012960075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461031e57633cc50b456000526004601cfd5b60043560801c60035560143560801c60005560243560015560443560075560643560025560843560045560a43560801c600855565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146103fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b610407602082018261064b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff92909216919091179055610450604082016020830161064b565b6000805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055604081013560015560608101356002556104b660a082016080830161064b565b600380547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9290921691909117905560a081013560045560c081013560055560e081013560065561051961012082016101008301610675565b610524576000610527565b60015b600880547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660ff9290921691909117905561056b6101408201610120830161064b565b6008806101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b6000602082840312156105a757600080fd5b813567ffffffffffffffff8111156105be57600080fd5b820161016081850312156105d157600080fd5b9392505050565b600060208083528351808285015260005b81811015610605578581018301518582016040015282016105e9565b81811115610617576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561065d57600080fd5b813567ffffffffffffffff811681146105d157600080fd5b60006020828403121561068757600080fd5b813580151581146105d157600080fdfea164736f6c634300080f000a", } // L1BlockABI is the input ABI used to generate the binding from. @@ -404,16 +404,16 @@ func (_L1Block *L1BlockCallerSession) BlobBaseFeeScalar() (uint32, error) { // Espresso is a free data retrieval call binding the contract method 0x61fba0ca. // -// Solidity: function espresso() view returns(bool) -func (_L1Block *L1BlockCaller) Espresso(opts *bind.CallOpts) (bool, error) { +// Solidity: function espresso() view returns(uint64) +func (_L1Block *L1BlockCaller) Espresso(opts *bind.CallOpts) (uint64, error) { var out []interface{} err := _L1Block.contract.Call(opts, &out, "espresso") if err != nil { - return *new(bool), err + return *new(uint64), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) return out0, err @@ -421,15 +421,15 @@ func (_L1Block *L1BlockCaller) Espresso(opts *bind.CallOpts) (bool, error) { // Espresso is a free data retrieval call binding the contract method 0x61fba0ca. // -// Solidity: function espresso() view returns(bool) -func (_L1Block *L1BlockSession) Espresso() (bool, error) { +// Solidity: function espresso() view returns(uint64) +func (_L1Block *L1BlockSession) Espresso() (uint64, error) { return _L1Block.Contract.Espresso(&_L1Block.CallOpts) } // Espresso is a free data retrieval call binding the contract method 0x61fba0ca. // -// Solidity: function espresso() view returns(bool) -func (_L1Block *L1BlockCallerSession) Espresso() (bool, error) { +// Solidity: function espresso() view returns(uint64) +func (_L1Block *L1BlockCallerSession) Espresso() (uint64, error) { return _L1Block.Contract.Espresso(&_L1Block.CallOpts) } diff --git a/op-bindings/bindings/l1block_more.go b/op-bindings/bindings/l1block_more.go index 78728cb3f0e9..ec541b64c7e2 100644 --- a/op-bindings/bindings/l1block_more.go +++ b/op-bindings/bindings/l1block_more.go @@ -9,11 +9,11 @@ import ( "github.com/ethereum-optimism/optimism/op-bindings/solc" ) -const L1BlockStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"number\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1001,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"timestamp\",\"offset\":8,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1002,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"basefee\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1003,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"hash\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_bytes32\"},{\"astId\":1004,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"sequenceNumber\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint64\"},{\"astId\":1005,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFeeScalar\",\"offset\":8,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1006,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"baseFeeScalar\",\"offset\":12,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1007,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"batcherHash\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_bytes32\"},{\"astId\":1008,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeOverhead\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeScalar\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_uint256\"},{\"astId\":1010,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFee\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_uint256\"},{\"astId\":1011,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"espresso\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_bool\"},{\"astId\":1012,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"espressoL1ConfDepth\",\"offset\":1,\"slot\":\"8\",\"type\":\"t_uint64\"}],\"types\":{\"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_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"}}}" +const L1BlockStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"number\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1001,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"timestamp\",\"offset\":8,\"slot\":\"0\",\"type\":\"t_uint64\"},{\"astId\":1002,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"basefee\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_uint256\"},{\"astId\":1003,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"hash\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_bytes32\"},{\"astId\":1004,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"sequenceNumber\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_uint64\"},{\"astId\":1005,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFeeScalar\",\"offset\":8,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1006,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"baseFeeScalar\",\"offset\":12,\"slot\":\"3\",\"type\":\"t_uint32\"},{\"astId\":1007,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"batcherHash\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_bytes32\"},{\"astId\":1008,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeOverhead\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"},{\"astId\":1009,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeScalar\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_uint256\"},{\"astId\":1010,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"blobBaseFee\",\"offset\":0,\"slot\":\"7\",\"type\":\"t_uint256\"},{\"astId\":1011,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"espresso\",\"offset\":0,\"slot\":\"8\",\"type\":\"t_uint64\"},{\"astId\":1012,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"espressoL1ConfDepth\",\"offset\":8,\"slot\":\"8\",\"type\":\"t_uint64\"}],\"types\":{\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint32\":{\"encoding\":\"inplace\",\"label\":\"uint32\",\"numberOfBytes\":\"4\"},\"t_uint64\":{\"encoding\":\"inplace\",\"label\":\"uint64\",\"numberOfBytes\":\"8\"}}}" var L1BlockStorageLayout = new(solc.StorageLayout) -var L1BlockDeployedBin = "0x608060405234801561001057600080fd5b506004361061011b5760003560e01c80638381f58a116100b2578063c598591811610081578063e591b28211610066578063e591b282146102a5578063e81b2c6d146102e5578063f8206140146102ee57600080fd5b8063c59859181461026c578063dc59462c1461028c57600080fd5b80638381f58a146102265780638b239f731461023a5780639e8c496614610243578063b80777ea1461024c57600080fd5b80635cf24969116100ee5780635cf24969146101a257806361fba0ca146101ab57806364ca23ef146101c857806368d5dca6146101f557600080fd5b806309bd5a6014610120578063440a5e201461013c57806354b7325c1461014657806354fd4d5014610159575b600080fd5b61012960025481565b6040519081526020015b60405180910390f35b6101446102f7565b005b610144610154366004610587565b610355565b6101956040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161013391906105ca565b61012960015481565b6008546101b89060ff1681565b6040519015158152602001610133565b6003546101dc9067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610133565b6003546102119068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610133565b6000546101dc9067ffffffffffffffff1681565b61012960055481565b61012960065481565b6000546101dc9068010000000000000000900467ffffffffffffffff1681565b600354610211906c01000000000000000000000000900463ffffffff1681565b6008546101dc90610100900467ffffffffffffffff1681565b6102c073deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610133565b61012960045481565b61012960075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461032057633cc50b456000526004601cfd5b60043560801c60035560143560801c60005560243560015560443560075560643560025560843560045560a43560801c600855565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146103fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b610409602082018261063d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff92909216919091179055610452604082016020830161063d565b6000805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055604081013560015560608101356002556104b860a082016080830161063d565b600380547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9290921691909117905560a081013560045560c081013560055560e081013560065561051b61012082016101008301610667565b600880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905561055c6101408201610120830161063d565b600860016101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b60006020828403121561059957600080fd5b813567ffffffffffffffff8111156105b057600080fd5b820161016081850312156105c357600080fd5b9392505050565b600060208083528351808285015260005b818110156105f7578581018301518582016040015282016105db565b81811115610609576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561064f57600080fd5b813567ffffffffffffffff811681146105c357600080fd5b60006020828403121561067957600080fd5b813580151581146105c357600080fdfea164736f6c634300080f000a" +var L1BlockDeployedBin = "0x608060405234801561001057600080fd5b506004361061011b5760003560e01c80638381f58a116100b2578063c598591811610081578063e591b28211610066578063e591b282146102a3578063e81b2c6d146102e3578063f8206140146102ec57600080fd5b8063c598591814610263578063dc59462c1461028357600080fd5b80638381f58a1461021d5780638b239f73146102315780639e8c49661461023a578063b80777ea1461024357600080fd5b80635cf24969116100ee5780635cf24969146101a257806361fba0ca146101ab57806364ca23ef146101d857806368d5dca6146101ec57600080fd5b806309bd5a6014610120578063440a5e201461013c57806354b7325c1461014657806354fd4d5014610159575b600080fd5b61012960025481565b6040519081526020015b60405180910390f35b6101446102f5565b005b610144610154366004610595565b610353565b6101956040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161013391906105d8565b61012960015481565b6008546101bf9067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610133565b6003546101bf9067ffffffffffffffff1681565b6003546102089068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610133565b6000546101bf9067ffffffffffffffff1681565b61012960055481565b61012960065481565b6000546101bf9068010000000000000000900467ffffffffffffffff1681565b600354610208906c01000000000000000000000000900463ffffffff1681565b6008546101bf9068010000000000000000900467ffffffffffffffff1681565b6102be73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610133565b61012960045481565b61012960075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461031e57633cc50b456000526004601cfd5b60043560801c60035560143560801c60005560243560015560443560075560643560025560843560045560a43560801c600855565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146103fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b610407602082018261064b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff92909216919091179055610450604082016020830161064b565b6000805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055604081013560015560608101356002556104b660a082016080830161064b565b600380547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff9290921691909117905560a081013560045560c081013560055560e081013560065561051961012082016101008301610675565b610524576000610527565b60015b600880547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001660ff9290921691909117905561056b6101408201610120830161064b565b6008806101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b6000602082840312156105a757600080fd5b813567ffffffffffffffff8111156105be57600080fd5b820161016081850312156105d157600080fd5b9392505050565b600060208083528351808285015260005b81811015610605578581018301518582016040015282016105e9565b81811115610617576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561065d57600080fd5b813567ffffffffffffffff811681146105d157600080fd5b60006020828403121561068757600080fd5b813580151581146105d157600080fdfea164736f6c634300080f000a" func init() { diff --git a/op-node/rollup/derive/l1_block_info.go b/op-node/rollup/derive/l1_block_info.go index fd502a7e704a..6dd13844a8e9 100644 --- a/op-node/rollup/derive/l1_block_info.go +++ b/op-node/rollup/derive/l1_block_info.go @@ -244,8 +244,8 @@ func (info *L1BlockInfo) unmarshalBinaryBedrock(data []byte) error { // | 32 | BlobBaseFee | // | 32 | BlockHash | // | 32 | BatcherHash | -// | 8 | Espresso | // | 8 | EspressoL1ConfDepth | +// | 8 | Espresso | // | variable| Justification | // +---------+--------------------------+ @@ -286,6 +286,9 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) { if err := solabi.WriteAddress(w, info.BatcherAddr); err != nil { return nil, err } + if err := binary.Write(w, binary.BigEndian, info.EspressoL1ConfDepth); err != nil { + return nil, err + } if info.Espresso { if err := binary.Write(w, binary.BigEndian, uint64(1)); err != nil { return nil, err @@ -295,9 +298,6 @@ func (info *L1BlockInfo) marshalBinaryEcotone() ([]byte, error) { return nil, err } } - if err := binary.Write(w, binary.BigEndian, info.EspressoL1ConfDepth); err != nil { - return nil, err - } rlpBytes, err := rlp.EncodeToBytes(info.Justification) if err != nil { return nil, err @@ -343,14 +343,14 @@ func (info *L1BlockInfo) unmarshalBinaryEcotone(data []byte) error { if info.BatcherAddr, err = solabi.ReadAddress(r); err != nil { return err } + if err := binary.Read(r, binary.BigEndian, &info.EspressoL1ConfDepth); err != nil { + return fmt.Errorf("invalid ecotone l1 block info format: %w", err) + } var espresso uint64 if err := binary.Read(r, binary.BigEndian, &espresso); err != nil { return fmt.Errorf("invalid ecotone l1 block info format: %w", err) } info.Espresso = espresso != 0 - if err := binary.Read(r, binary.BigEndian, &info.EspressoL1ConfDepth); err != nil { - return fmt.Errorf("invalid ecotone l1 block info format: %w", err) - } rlpBytes, err := io.ReadAll(r) if err != nil { return fmt.Errorf("invalid ecotone l1 block info format: %w", err) diff --git a/packages/contracts-bedrock/package.json b/packages/contracts-bedrock/package.json index 8aeed85d3793..329dc5c08076 100644 --- a/packages/contracts-bedrock/package.json +++ b/packages/contracts-bedrock/package.json @@ -18,7 +18,7 @@ "build": "forge build", "build:go-ffi": "(cd scripts/go-ffi && go build)", "autogen:invariant-docs": "npx tsx scripts/invariant-doc-gen.ts", - "test": "pnpm build:go-ffi && forge test", + "test": "pnpm build:go-ffi && forge test -vvv", "test:kontrol": "./test/kontrol/scripts/run-kontrol.sh", "genesis": "./scripts/generate-l2-genesis.sh", "coverage": "pnpm build:go-ffi && forge coverage", diff --git a/packages/contracts-bedrock/semver-lock.json b/packages/contracts-bedrock/semver-lock.json index 9c79aa363345..1b0b6d74ed3b 100644 --- a/packages/contracts-bedrock/semver-lock.json +++ b/packages/contracts-bedrock/semver-lock.json @@ -52,8 +52,8 @@ "sourceCodeHash": "0xde06becce9514f46ba78b4cb0732c7a714d49ba8f131258d56a5f5b22b51be7e" }, "src/L2/L1Block.sol": { - "initCodeHash": "0xf039cf5c5f0787d2e76feead9206fbc36bd27ca2a58b853df4e0a64f8b065e23", - "sourceCodeHash": "0x8f318ea1f16af6ccf7bed5cdaacd8d31bdaf485f072a746b8a88eec35054ed55" + "initCodeHash": "0x4b17c70695f872a8f68a8be4c2971481b9fc4827a397076f7e5e8c61aa4c2993", + "sourceCodeHash": "0x72e6257fc5fec28b56865d2e1f8627944e9f9f06b91bb63e24d98ce3ecd680c9" }, "src/L2/L1FeeVault.sol": { "initCodeHash": "0x2744d34573be83206d1b75d049d18a7bb37f9058e68c0803e5008c46b0dc2474", diff --git a/packages/contracts-bedrock/snapshots/abi/AddressManager.json b/packages/contracts-bedrock/snapshots/abi/AddressManager.json index a91570931fdf..f0efe2ed4d57 100644 --- a/packages/contracts-bedrock/snapshots/abi/AddressManager.json +++ b/packages/contracts-bedrock/snapshots/abi/AddressManager.json @@ -1,48 +1,4 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "oldAddress", - "type": "address" - } - ], - "name": "AddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, { "inputs": [ { @@ -112,5 +68,49 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "oldAddress", + "type": "address" + } + ], + "name": "AddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/AssetReceiver.json b/packages/contracts-bedrock/snapshots/abi/AssetReceiver.json index 790693e34d73..543e32913df9 100644 --- a/packages/contracts-bedrock/snapshots/abi/AssetReceiver.json +++ b/packages/contracts-bedrock/snapshots/abi/AssetReceiver.json @@ -11,129 +11,8 @@ "type": "constructor" }, { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnerUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ReceivedETH", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "withdrawer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithdrewERC20", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "withdrawer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "WithdrewERC721", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "withdrawer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithdrewETH", - "type": "event" + "stateMutability": "payable", + "type": "receive" }, { "inputs": [ @@ -320,7 +199,128 @@ "type": "function" }, { - "stateMutability": "payable", - "type": "receive" + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ReceivedETH", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrewERC20", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "WithdrewERC721", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrewETH", + "type": "event" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/L1Block.json b/packages/contracts-bedrock/snapshots/abi/L1Block.json index cb7b3029bfef..6e9891ff128b 100644 --- a/packages/contracts-bedrock/snapshots/abi/L1Block.json +++ b/packages/contracts-bedrock/snapshots/abi/L1Block.json @@ -77,6 +77,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "espresso", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "espressoL1ConfDepth", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "hash", @@ -145,44 +171,66 @@ { "inputs": [ { - "internalType": "uint64", - "name": "_number", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "_timestamp", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "_basefee", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_hash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "_sequenceNumber", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "_batcherHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_l1FeeOverhead", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l1FeeScalar", - "type": "uint256" + "components": [ + { + "internalType": "uint64", + "name": "number", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "basefee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "sequenceNumber", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "batcherHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "l1FeeOverhead", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l1FeeScalar", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "espresso", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "espressoL1ConfDepth", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "justification", + "type": "bytes" + } + ], + "internalType": "struct L1Block.L1BlockValues", + "name": "v", + "type": "tuple" } ], "name": "setL1BlockValues", diff --git a/packages/contracts-bedrock/snapshots/abi/SystemConfig.json b/packages/contracts-bedrock/snapshots/abi/SystemConfig.json index eb334e29d26c..8044c3deb777 100644 --- a/packages/contracts-bedrock/snapshots/abi/SystemConfig.json +++ b/packages/contracts-bedrock/snapshots/abi/SystemConfig.json @@ -162,7 +162,20 @@ }, { "inputs": [], - "name": "gasLimit", + "name": "espresso", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "espressoL1ConfDepth", "outputs": [ { "internalType": "uint64", @@ -174,114 +187,144 @@ "type": "function" }, { - "inputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_overhead", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_scalar", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_batcherHash", - "type": "bytes32" - }, + "inputs": [], + "name": "gasLimit", + "outputs": [ { "internalType": "uint64", - "name": "_gasLimit", + "name": "", "type": "uint64" - }, - { - "internalType": "address", - "name": "_unsafeBlockSigner", - "type": "address" - }, + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ { "components": [ { - "internalType": "uint32", - "name": "maxResourceLimit", - "type": "uint32" + "internalType": "address", + "name": "owner", + "type": "address" }, { - "internalType": "uint8", - "name": "elasticityMultiplier", - "type": "uint8" + "internalType": "uint256", + "name": "overhead", + "type": "uint256" }, { - "internalType": "uint8", - "name": "baseFeeMaxChangeDenominator", - "type": "uint8" + "internalType": "uint256", + "name": "scalar", + "type": "uint256" }, { - "internalType": "uint32", - "name": "minimumBaseFee", - "type": "uint32" + "internalType": "bytes32", + "name": "batcherHash", + "type": "bytes32" }, { - "internalType": "uint32", - "name": "systemTxMaxGas", - "type": "uint32" + "internalType": "uint64", + "name": "gasLimit", + "type": "uint64" }, { - "internalType": "uint128", - "name": "maximumBaseFee", - "type": "uint128" - } - ], - "internalType": "struct ResourceMetering.ResourceConfig", - "name": "_config", - "type": "tuple" - }, - { - "internalType": "address", - "name": "_batchInbox", - "type": "address" - }, - { - "components": [ - { - "internalType": "address", - "name": "l1CrossDomainMessenger", - "type": "address" + "internalType": "bool", + "name": "espresso", + "type": "bool" }, { - "internalType": "address", - "name": "l1ERC721Bridge", - "type": "address" + "internalType": "uint64", + "name": "espressoL1ConfDepth", + "type": "uint64" }, { "internalType": "address", - "name": "l1StandardBridge", + "name": "unsafeBlockSigner", "type": "address" }, { - "internalType": "address", - "name": "l2OutputOracle", - "type": "address" + "components": [ + { + "internalType": "uint32", + "name": "maxResourceLimit", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "elasticityMultiplier", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "baseFeeMaxChangeDenominator", + "type": "uint8" + }, + { + "internalType": "uint32", + "name": "minimumBaseFee", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "systemTxMaxGas", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "maximumBaseFee", + "type": "uint128" + } + ], + "internalType": "struct ResourceMetering.ResourceConfig", + "name": "config", + "type": "tuple" }, { "internalType": "address", - "name": "optimismPortal", + "name": "batchInbox", "type": "address" }, { - "internalType": "address", - "name": "optimismMintableERC20Factory", - "type": "address" + "components": [ + { + "internalType": "address", + "name": "l1CrossDomainMessenger", + "type": "address" + }, + { + "internalType": "address", + "name": "l1ERC721Bridge", + "type": "address" + }, + { + "internalType": "address", + "name": "l1StandardBridge", + "type": "address" + }, + { + "internalType": "address", + "name": "l2OutputOracle", + "type": "address" + }, + { + "internalType": "address", + "name": "optimismPortal", + "type": "address" + }, + { + "internalType": "address", + "name": "optimismMintableERC20Factory", + "type": "address" + } + ], + "internalType": "struct SystemConfig.Addresses", + "name": "addresses", + "type": "tuple" } ], - "internalType": "struct SystemConfig.Addresses", - "name": "_addresses", + "internalType": "struct SystemConfig.Initialize", + "name": "args", "type": "tuple" } ], @@ -485,6 +528,32 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_espresso", + "type": "bool" + } + ], + "name": "setEspresso", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "l1ConfDepth", + "type": "uint64" + } + ], + "name": "setEspressoL1ConfDepth", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json b/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json index 2928d2147b5c..16f98e5f635e 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json @@ -75,5 +75,19 @@ "offset": 0, "slot": "7", "type": "uint256" + }, + { + "bytes": "8", + "label": "espresso", + "offset": 0, + "slot": "8", + "type": "uint64" + }, + { + "bytes": "8", + "label": "espressoL1ConfDepth", + "offset": 8, + "slot": "8", + "type": "uint64" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json b/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json index f9f63083c274..8dd747c8bac6 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json @@ -62,6 +62,20 @@ "slot": "104", "type": "uint64" }, + { + "bytes": "1", + "label": "espresso", + "offset": 8, + "slot": "104", + "type": "bool" + }, + { + "bytes": "8", + "label": "espressoL1ConfDepth", + "offset": 9, + "slot": "104", + "type": "uint64" + }, { "bytes": "32", "label": "_resourceConfig", diff --git a/packages/contracts-bedrock/src/L2/L1Block.sol b/packages/contracts-bedrock/src/L2/L1Block.sol index d6855ec8e570..f0bcebfab42d 100644 --- a/packages/contracts-bedrock/src/L2/L1Block.sol +++ b/packages/contracts-bedrock/src/L2/L1Block.sol @@ -50,7 +50,7 @@ contract L1Block is ISemver { uint256 public blobBaseFee; /// @notice Whether the Espresso Sequencer is enabled. - bool public espresso; + uint64 public espresso; /// @notice Minimum confirmation depth for L1 origin blocks. uint64 public espressoL1ConfDepth; @@ -96,7 +96,7 @@ contract L1Block is ISemver { batcherHash = v.batcherHash; l1FeeOverhead = v.l1FeeOverhead; l1FeeScalar = v.l1FeeScalar; - espresso = v.espresso; + espresso = v.espresso ? 1 : 0; espressoL1ConfDepth = v.espressoL1ConfDepth; } @@ -112,8 +112,8 @@ contract L1Block is ISemver { /// 7. _blobBaseFee L1 blob base fee. /// 8. _hash L1 blockhash. /// 9. _batcherHash Versioned hash to authenticate batcher by. - /// 10. _espresso Whether the Espresso Sequencer is enabled - /// 11. _espressoL1ConfDepth Minimum confirmation depth for L1 origin blocks + /// 10. _espressoL1ConfDepth Minimum confirmation depth for L1 origin blocks + /// 11. _espresso Whether the Espresso Sequencer is enabled /// 12. _justification The RLP-encoded L2 batch justification function setL1BlockValuesEcotone() external { assembly { diff --git a/packages/contracts-bedrock/src/libraries/Encoding.sol b/packages/contracts-bedrock/src/libraries/Encoding.sol index 2e89c22e5334..6e34617bd49c 100644 --- a/packages/contracts-bedrock/src/libraries/Encoding.sol +++ b/packages/contracts-bedrock/src/libraries/Encoding.sol @@ -177,8 +177,8 @@ library Encoding { blobBaseFee, hash, batcherHash, - espresso, espressoL1ConfDepth, + espresso ? uint64(1) : uint64(0), justification ); } diff --git a/packages/contracts-bedrock/test/L2/L1Block.t.sol b/packages/contracts-bedrock/test/L2/L1Block.t.sol index 49a8c72f8f12..d8aa1536962c 100644 --- a/packages/contracts-bedrock/test/L2/L1Block.t.sol +++ b/packages/contracts-bedrock/test/L2/L1Block.t.sol @@ -60,7 +60,7 @@ contract L1BlockBedrock_Test is L1BlockTest { assertEq(l1Block.batcherHash(), bt); assertEq(l1Block.l1FeeOverhead(), fo); assertEq(l1Block.l1FeeScalar(), fs); - assertEq(l1Block.espresso(), e); + assertEq(l1Block.espresso(), e ? 1 : 0); assertEq(l1Block.espressoL1ConfDepth(), ed); } @@ -132,7 +132,7 @@ contract L1BlockEcotone_Test is L1BlockTest { assertEq(l1Block.blobBaseFee(), blobBaseFee); assertEq(l1Block.hash(), hash); assertEq(l1Block.batcherHash(), batcherHash); - assertEq(l1Block.espresso(), espresso); + assertEq(l1Block.espresso(), espresso ? 1 : 0); assertEq(l1Block.espressoL1ConfDepth(), espressoL1ConfDepth); // ensure we didn't accidentally pollute the 128 bits of the sequencenum+scalars slot that