From 579d6ffe6d02003e48cec718da72c2578bf327fb Mon Sep 17 00:00:00 2001 From: Roberto Bayardo <roberto.bayardo@coinbase.com> Date: Mon, 8 Jan 2024 11:49:02 -0800 Subject: [PATCH] Ecotone L2 contract updates (#8726) Co-authored-by: anikaraghu <anika.raghuvanshi@coinbase.com> --- op-bindings/bindings/gaspriceoracle.go | 149 +++++++++++++++++- op-bindings/bindings/gaspriceoracle_more.go | 4 +- op-bindings/bindings/l1block.go | 118 +++++++++++++- op-bindings/bindings/l1block_more.go | 4 +- packages/contracts-bedrock/semver-lock.json | 8 +- .../contracts-bedrock/slither-report.json | 24 +++ .../snapshots/abi/GasPriceOracle.json | 59 +++++++ .../snapshots/abi/L1Block.json | 46 ++++++ .../storageLayout/GasPriceOracle.json | 10 +- .../snapshots/storageLayout/L1Block.json | 21 +++ .../src/L2/GasPriceOracle.sol | 90 +++++++++-- packages/contracts-bedrock/src/L2/L1Block.sol | 47 +++++- .../src/libraries/Encoding.sol | 40 +++++ .../test/L2/GasPriceOracle.t.sol | 104 +++++++++++- .../contracts-bedrock/test/L2/L1Block.t.sol | 131 ++++++++++----- specs/exec-engine.md | 4 +- 16 files changed, 788 insertions(+), 71 deletions(-) diff --git a/op-bindings/bindings/gaspriceoracle.go b/op-bindings/bindings/gaspriceoracle.go index e9e0bfd55..40960d79c 100644 --- a/op-bindings/bindings/gaspriceoracle.go +++ b/op-bindings/bindings/gaspriceoracle.go @@ -30,8 +30,8 @@ var ( // GasPriceOracleMetaData contains all meta data concerning the GasPriceOracle contract. var GasPriceOracleMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"DECIMALS\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"baseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"gasPrice\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getL1Fee\",\"inputs\":[{\"name\":\"_data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getL1GasUsed\",\"inputs\":[{\"name\":\"_data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1BaseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"overhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"scalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"}]", - Bin: "0x608060405234801561001057600080fd5b506107c0806100206000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c806354fd4d5011610076578063de26c4a11161005b578063de26c4a114610157578063f45e65d81461016a578063fe173b971461015157600080fd5b806354fd4d50146101085780636ef25c3a1461015157600080fd5b8063313ce567116100a7578063313ce567146100e657806349948e0e146100ed578063519b4bd31461010057600080fd5b80630c18c162146100c35780632e0f2625146100de575b600080fd5b6100cb610172565b6040519081526020015b60405180910390f35b6100cb600681565b60066100cb565b6100cb6100fb3660046103fd565b6101fc565b6100cb61025d565b6101446040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100d591906104cc565b486100cb565b6100cb6101653660046103fd565b6102be565b6100cb61036d565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f7919061053f565b905090565b600080610208836102be565b9050600061021461025d565b61021e9083610587565b9050600061022e6006600a6106e6565b9050600061023a61036d565b6102449084610587565b9050600061025283836106f9565b979650505050505050565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b80516000908190815b81811015610341578481815181106102e1576102e1610734565b01602001517fff00000000000000000000000000000000000000000000000000000000000000166000036103215761031a600484610763565b925061032f565b61032c601084610763565b92505b806103398161077b565b9150506102c7565b50600061034c610172565b6103569084610763565b905061036481610440610763565b95945050505050565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561040f57600080fd5b813567ffffffffffffffff8082111561042757600080fd5b818401915084601f83011261043b57600080fd5b81358181111561044d5761044d6103ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610493576104936103ce565b816040528281528760208487010111156104ac57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b818110156104f9578581018301518582016040015282016104dd565b8181111561050b576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561055157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156105bf576105bf610558565b500290565b600181815b8085111561061d57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561060357610603610558565b8085161561061057918102915b93841c93908002906105c9565b509250929050565b600082610634575060016106e0565b81610641575060006106e0565b816001811461065757600281146106615761067d565b60019150506106e0565b60ff84111561067257610672610558565b50506001821b6106e0565b5060208310610133831016604e8410600b84101617156106a0575081810a6106e0565b6106aa83836105c4565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156106dc576106dc610558565b0290505b92915050565b60006106f28383610625565b9392505050565b60008261072f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000821982111561077657610776610558565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036107ac576107ac610558565b506001019056fea164736f6c634300080f000a", + ABI: "[{\"type\":\"function\",\"name\":\"DECIMALS\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"baseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"basefeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"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\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"gasPrice\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getL1Fee\",\"inputs\":[{\"name\":\"_data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getL1GasUsed\",\"inputs\":[{\"name\":\"_data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isEcotone\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"l1BaseFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"overhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"scalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setEcotone\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"version\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"}]", + Bin: "0x608060405234801561001057600080fd5b50610fb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806354fd4d5011610097578063bfb14fb711610066578063bfb14fb7146101da578063de26c4a1146101e2578063f45e65d8146101f5578063fe173b97146101af57600080fd5b806354fd4d50146101665780636ef25c3a146101af57806375c7e4a9146101b55780637744864d146101bd57600080fd5b8063313ce567116100d3578063313ce5671461012757806349948e0e1461012e5780634ef6e22414610141578063519b4bd31461015e57600080fd5b80630c18c162146100fa57806322b90ab3146101155780632e0f26251461011f575b600080fd5b6101026101fd565b6040519081526020015b60405180910390f35b61011d61031e565b005b610102600681565b6006610102565b61010261013c366004610b73565b610541565b60005461014e9060ff1681565b604051901515815260200161010c565b610102610565565b6101a26040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161010c9190610c42565b48610102565b6101026105c6565b6101c5610627565b60405163ffffffff909116815260200161010c565b6101c56106ac565b6101026101f0366004610b73565b61070d565b6101026107c1565b6000805460ff1615610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f47617350726963654f7261636c653a206f76657268656164282920697320646560448201527f707265636174656400000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610cb5565b905090565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663e591b2826040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a19190610cce565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e2073657420697345636f746f6e6520666c6160648201527f6700000000000000000000000000000000000000000000000000000000000000608482015260a40161028d565b60005460ff1615610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a2045636f746f6e6520616c72656164792060448201527f6163746976650000000000000000000000000000000000000000000000000000606482015260840161028d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6000805460ff161561055c57610556826108b4565b92915050565b61055682610958565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff166375c7e4a96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16637744864d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610d04565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663bfb14fb76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610688573d6000803e3d6000fd5b60008061071983610ab4565b60005490915060ff161561072d5792915050565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b09190610cb5565b6107ba9082610d59565b9392505050565b6000805460ff1615610855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a207363616c61722829206973206465707260448201527f6563617465640000000000000000000000000000000000000000000000000000606482015260840161028d565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b6000806108c083610ab4565b905060006108cc610565565b6108d46106ac565b6108df906010610d71565b63ffffffff166108ef9190610d9d565b905060006108fb6105c6565b610903610627565b63ffffffff166109139190610d9d565b905060006109218284610d59565b61092b9085610d9d565b90506109396006600a610efa565b610944906010610d9d565b61094e9082610f06565b9695505050505050565b60008061096483610ab4565b9050600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190610cb5565b6109f3610565565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190610cb5565b610a809085610d59565b610a8a9190610d9d565b610a949190610d9d565b9050610aa26006600a610efa565b610aac9082610f06565b949350505050565b80516000908190815b81811015610b3757848181518110610ad757610ad7610f41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016600003610b1757610b10600484610d59565b9250610b25565b610b22601084610d59565b92505b80610b2f81610f70565b915050610abd565b50610aac82610440610d59565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610b8557600080fd5b813567ffffffffffffffff80821115610b9d57600080fd5b818401915084601f830112610bb157600080fd5b813581811115610bc357610bc3610b44565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610c0957610c09610b44565b81604052828152876020848701011115610c2257600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b81811015610c6f57858101830151858201604001528201610c53565b81811115610c81576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600060208284031215610cc757600080fd5b5051919050565b600060208284031215610ce057600080fd5b815173ffffffffffffffffffffffffffffffffffffffff811681146107ba57600080fd5b600060208284031215610d1657600080fd5b815163ffffffff811681146107ba57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610d6c57610d6c610d2a565b500190565b600063ffffffff80831681851681830481118215151615610d9457610d94610d2a565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610dd557610dd5610d2a565b500290565b600181815b80851115610e3357817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610e1957610e19610d2a565b80851615610e2657918102915b93841c9390800290610ddf565b509250929050565b600082610e4a57506001610556565b81610e5757506000610556565b8160018114610e6d5760028114610e7757610e93565b6001915050610556565b60ff841115610e8857610e88610d2a565b50506001821b610556565b5060208310610133831016604e8410600b8410161715610eb6575081810a610556565b610ec08383610dda565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610ef257610ef2610d2a565b029392505050565b60006107ba8383610e3b565b600082610f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610fa157610fa1610d2a565b506001019056fea164736f6c634300080f000a", } // GasPriceOracleABI is the input ABI used to generate the binding from. @@ -263,6 +263,99 @@ func (_GasPriceOracle *GasPriceOracleCallerSession) BaseFee() (*big.Int, error) return _GasPriceOracle.Contract.BaseFee(&_GasPriceOracle.CallOpts) } +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleCaller) BasefeeScalar(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "basefeeScalar") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleSession) BasefeeScalar() (uint32, error) { + return _GasPriceOracle.Contract.BasefeeScalar(&_GasPriceOracle.CallOpts) +} + +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleCallerSession) BasefeeScalar() (uint32, error) { + return _GasPriceOracle.Contract.BasefeeScalar(&_GasPriceOracle.CallOpts) +} + +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleCaller) BlobBasefee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "blobBasefee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleSession) BlobBasefee() (*big.Int, error) { + return _GasPriceOracle.Contract.BlobBasefee(&_GasPriceOracle.CallOpts) +} + +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleCallerSession) BlobBasefee() (*big.Int, error) { + return _GasPriceOracle.Contract.BlobBasefee(&_GasPriceOracle.CallOpts) +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleCaller) BlobBasefeeScalar(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "blobBasefeeScalar") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleSession) BlobBasefeeScalar() (uint32, error) { + return _GasPriceOracle.Contract.BlobBasefeeScalar(&_GasPriceOracle.CallOpts) +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_GasPriceOracle *GasPriceOracleCallerSession) BlobBasefeeScalar() (uint32, error) { + return _GasPriceOracle.Contract.BlobBasefeeScalar(&_GasPriceOracle.CallOpts) +} + // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() pure returns(uint256) @@ -387,6 +480,37 @@ func (_GasPriceOracle *GasPriceOracleCallerSession) GetL1GasUsed(_data []byte) ( return _GasPriceOracle.Contract.GetL1GasUsed(&_GasPriceOracle.CallOpts, _data) } +// IsEcotone is a free data retrieval call binding the contract method 0x4ef6e224. +// +// Solidity: function isEcotone() view returns(bool) +func (_GasPriceOracle *GasPriceOracleCaller) IsEcotone(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "isEcotone") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsEcotone is a free data retrieval call binding the contract method 0x4ef6e224. +// +// Solidity: function isEcotone() view returns(bool) +func (_GasPriceOracle *GasPriceOracleSession) IsEcotone() (bool, error) { + return _GasPriceOracle.Contract.IsEcotone(&_GasPriceOracle.CallOpts) +} + +// IsEcotone is a free data retrieval call binding the contract method 0x4ef6e224. +// +// Solidity: function isEcotone() view returns(bool) +func (_GasPriceOracle *GasPriceOracleCallerSession) IsEcotone() (bool, error) { + return _GasPriceOracle.Contract.IsEcotone(&_GasPriceOracle.CallOpts) +} + // L1BaseFee is a free data retrieval call binding the contract method 0x519b4bd3. // // Solidity: function l1BaseFee() view returns(uint256) @@ -510,3 +634,24 @@ func (_GasPriceOracle *GasPriceOracleSession) Version() (string, error) { func (_GasPriceOracle *GasPriceOracleCallerSession) Version() (string, error) { return _GasPriceOracle.Contract.Version(&_GasPriceOracle.CallOpts) } + +// SetEcotone is a paid mutator transaction binding the contract method 0x22b90ab3. +// +// Solidity: function setEcotone() returns() +func (_GasPriceOracle *GasPriceOracleTransactor) SetEcotone(opts *bind.TransactOpts) (*types.Transaction, error) { + return _GasPriceOracle.contract.Transact(opts, "setEcotone") +} + +// SetEcotone is a paid mutator transaction binding the contract method 0x22b90ab3. +// +// Solidity: function setEcotone() returns() +func (_GasPriceOracle *GasPriceOracleSession) SetEcotone() (*types.Transaction, error) { + return _GasPriceOracle.Contract.SetEcotone(&_GasPriceOracle.TransactOpts) +} + +// SetEcotone is a paid mutator transaction binding the contract method 0x22b90ab3. +// +// Solidity: function setEcotone() returns() +func (_GasPriceOracle *GasPriceOracleTransactorSession) SetEcotone() (*types.Transaction, error) { + return _GasPriceOracle.Contract.SetEcotone(&_GasPriceOracle.TransactOpts) +} diff --git a/op-bindings/bindings/gaspriceoracle_more.go b/op-bindings/bindings/gaspriceoracle_more.go index 56099ac32..d98069cc4 100644 --- a/op-bindings/bindings/gaspriceoracle_more.go +++ b/op-bindings/bindings/gaspriceoracle_more.go @@ -9,11 +9,11 @@ import ( "github.com/ethereum-optimism/optimism/op-bindings/solc" ) -const GasPriceOracleStorageLayoutJSON = "{\"storage\":null,\"types\":{}}" +const GasPriceOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/L2/GasPriceOracle.sol:GasPriceOracle\",\"label\":\"isEcotone\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_bool\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"}}}" var GasPriceOracleStorageLayout = new(solc.StorageLayout) -var GasPriceOracleDeployedBin = "0x608060405234801561001057600080fd5b50600436106100be5760003560e01c806354fd4d5011610076578063de26c4a11161005b578063de26c4a114610157578063f45e65d81461016a578063fe173b971461015157600080fd5b806354fd4d50146101085780636ef25c3a1461015157600080fd5b8063313ce567116100a7578063313ce567146100e657806349948e0e146100ed578063519b4bd31461010057600080fd5b80630c18c162146100c35780632e0f2625146100de575b600080fd5b6100cb610172565b6040519081526020015b60405180910390f35b6100cb600681565b60066100cb565b6100cb6100fb3660046103fd565b6101fc565b6100cb61025d565b6101446040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100d591906104cc565b486100cb565b6100cb6101653660046103fd565b6102be565b6100cb61036d565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f7919061053f565b905090565b600080610208836102be565b9050600061021461025d565b61021e9083610587565b9050600061022e6006600a6106e6565b9050600061023a61036d565b6102449084610587565b9050600061025283836106f9565b979650505050505050565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b80516000908190815b81811015610341578481815181106102e1576102e1610734565b01602001517fff00000000000000000000000000000000000000000000000000000000000000166000036103215761031a600484610763565b925061032f565b61032c601084610763565b92505b806103398161077b565b9150506102c7565b50600061034c610172565b6103569084610763565b905061036481610440610763565b95945050505050565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101d3573d6000803e3d6000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561040f57600080fd5b813567ffffffffffffffff8082111561042757600080fd5b818401915084601f83011261043b57600080fd5b81358181111561044d5761044d6103ce565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610493576104936103ce565b816040528281528760208487010111156104ac57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b818110156104f9578581018301518582016040015282016104dd565b8181111561050b576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561055157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156105bf576105bf610558565b500290565b600181815b8085111561061d57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561060357610603610558565b8085161561061057918102915b93841c93908002906105c9565b509250929050565b600082610634575060016106e0565b81610641575060006106e0565b816001811461065757600281146106615761067d565b60019150506106e0565b60ff84111561067257610672610558565b50506001821b6106e0565b5060208310610133831016604e8410600b84101617156106a0575081810a6106e0565b6106aa83836105c4565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156106dc576106dc610558565b0290505b92915050565b60006106f28383610625565b9392505050565b60008261072f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000821982111561077657610776610558565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036107ac576107ac610558565b506001019056fea164736f6c634300080f000a" +var GasPriceOracleDeployedBin = "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806354fd4d5011610097578063bfb14fb711610066578063bfb14fb7146101da578063de26c4a1146101e2578063f45e65d8146101f5578063fe173b97146101af57600080fd5b806354fd4d50146101665780636ef25c3a146101af57806375c7e4a9146101b55780637744864d146101bd57600080fd5b8063313ce567116100d3578063313ce5671461012757806349948e0e1461012e5780634ef6e22414610141578063519b4bd31461015e57600080fd5b80630c18c162146100fa57806322b90ab3146101155780632e0f26251461011f575b600080fd5b6101026101fd565b6040519081526020015b60405180910390f35b61011d61031e565b005b610102600681565b6006610102565b61010261013c366004610b73565b610541565b60005461014e9060ff1681565b604051901515815260200161010c565b610102610565565b6101a26040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161010c9190610c42565b48610102565b6101026105c6565b6101c5610627565b60405163ffffffff909116815260200161010c565b6101c56106ac565b6101026101f0366004610b73565b61070d565b6101026107c1565b6000805460ff1615610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f47617350726963654f7261636c653a206f76657268656164282920697320646560448201527f707265636174656400000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610cb5565b905090565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663e591b2826040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a19190610cce565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e2073657420697345636f746f6e6520666c6160648201527f6700000000000000000000000000000000000000000000000000000000000000608482015260a40161028d565b60005460ff1615610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a2045636f746f6e6520616c72656164792060448201527f6163746976650000000000000000000000000000000000000000000000000000606482015260840161028d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6000805460ff161561055c57610556826108b4565b92915050565b61055682610958565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff166375c7e4a96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16637744864d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610d04565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663bfb14fb76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610688573d6000803e3d6000fd5b60008061071983610ab4565b60005490915060ff161561072d5792915050565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b09190610cb5565b6107ba9082610d59565b9392505050565b6000805460ff1615610855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a207363616c61722829206973206465707260448201527f6563617465640000000000000000000000000000000000000000000000000000606482015260840161028d565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b6000806108c083610ab4565b905060006108cc610565565b6108d46106ac565b6108df906010610d71565b63ffffffff166108ef9190610d9d565b905060006108fb6105c6565b610903610627565b63ffffffff166109139190610d9d565b905060006109218284610d59565b61092b9085610d9d565b90506109396006600a610efa565b610944906010610d9d565b61094e9082610f06565b9695505050505050565b60008061096483610ab4565b9050600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190610cb5565b6109f3610565565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190610cb5565b610a809085610d59565b610a8a9190610d9d565b610a949190610d9d565b9050610aa26006600a610efa565b610aac9082610f06565b949350505050565b80516000908190815b81811015610b3757848181518110610ad757610ad7610f41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016600003610b1757610b10600484610d59565b9250610b25565b610b22601084610d59565b92505b80610b2f81610f70565b915050610abd565b50610aac82610440610d59565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610b8557600080fd5b813567ffffffffffffffff80821115610b9d57600080fd5b818401915084601f830112610bb157600080fd5b813581811115610bc357610bc3610b44565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610c0957610c09610b44565b81604052828152876020848701011115610c2257600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b81811015610c6f57858101830151858201604001528201610c53565b81811115610c81576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600060208284031215610cc757600080fd5b5051919050565b600060208284031215610ce057600080fd5b815173ffffffffffffffffffffffffffffffffffffffff811681146107ba57600080fd5b600060208284031215610d1657600080fd5b815163ffffffff811681146107ba57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610d6c57610d6c610d2a565b500190565b600063ffffffff80831681851681830481118215151615610d9457610d94610d2a565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610dd557610dd5610d2a565b500290565b600181815b80851115610e3357817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610e1957610e19610d2a565b80851615610e2657918102915b93841c9390800290610ddf565b509250929050565b600082610e4a57506001610556565b81610e5757506000610556565b8160018114610e6d5760028114610e7757610e93565b6001915050610556565b60ff841115610e8857610e88610d2a565b50506001821b610556565b5060208310610133831016604e8410600b8410161715610eb6575081810a610556565b610ec08383610dda565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610ef257610ef2610d2a565b029392505050565b60006107ba8383610e3b565b600082610f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610fa157610fa1610d2a565b506001019056fea164736f6c634300080f000a" func init() { diff --git a/op-bindings/bindings/l1block.go b/op-bindings/bindings/l1block.go index 5b7249c03..57a6a72b3 100644 --- a/op-bindings/bindings/l1block.go +++ b/op-bindings/bindings/l1block.go @@ -30,8 +30,8 @@ var ( // 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\":\"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\":\"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\":\"_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\"}],\"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: "0x608060405234801561001057600080fd5b5061045b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638381f58a11610081578063b80777ea1161005b578063b80777ea146101a4578063e591b282146101c4578063e81b2c6d1461020457600080fd5b80638381f58a1461017e5780638b239f73146101925780639e8c49661461019b57600080fd5b806354fd4d50116100b257806354fd4d50146100ff5780635cf249691461014857806364ca23ef1461015157600080fd5b8063015d8eb9146100ce57806309bd5a60146100e3575b600080fd5b6100e16100dc366004610369565b61020d565b005b6100ec60025481565b6040519081526020015b60405180910390f35b61013b6040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100f691906103db565b6100ec60015481565b6003546101659067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016100f6565b6000546101659067ffffffffffffffff1681565b6100ec60055481565b6100ec60065481565b6000546101659068010000000000000000900467ffffffffffffffff1681565b6101df73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f6565b6100ec60045481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146102b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b803567ffffffffffffffff8116811461036457600080fd5b919050565b600080600080600080600080610100898b03121561038657600080fd5b61038f8961034c565b975061039d60208a0161034c565b965060408901359550606089013594506103b960808a0161034c565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b81811015610408578581018301518582016040015282016103ec565b8181111561041a576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a", + ABI: "[{\"type\":\"function\",\"name\":\"DEPOSITOR_ACCOUNT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"basefee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"basefeeScalar\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"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\":\"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\":\"_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\"}],\"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: "0x608060405234801561001057600080fd5b5061053e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80637744864d11610097578063b80777ea11610066578063b80777ea14610212578063bfb14fb714610232578063e591b28214610252578063e81b2c6d1461029257600080fd5b80637744864d146101bb5780638381f58a146101ec5780638b239f73146102005780639e8c49661461020957600080fd5b806354fd4d50116100d357806354fd4d50146101335780635cf249691461017c57806364ca23ef1461018557806375c7e4a9146101b257600080fd5b8063015d8eb9146100fa57806309bd5a601461010f578063440a5e201461012b575b600080fd5b61010d61010836600461044c565b61029b565b005b61011860025481565b6040519081526020015b60405180910390f35b61010d6103da565b61016f6040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161012291906104be565b61011860015481565b6003546101999067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610122565b61011860075481565b6003546101d79068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610122565b6000546101999067ffffffffffffffff1681565b61011860055481565b61011860065481565b6000546101999068010000000000000000900467ffffffffffffffff1681565b6003546101d7906c01000000000000000000000000900463ffffffff1681565b61026d73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610122565b61011860045481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461040357633cc50b456000526004601cfd5b60043560801c60035560143560801c600055602435600155604435600755606435600255608435600455565b803567ffffffffffffffff8116811461044757600080fd5b919050565b600080600080600080600080610100898b03121561046957600080fd5b6104728961042f565b975061048060208a0161042f565b9650604089013595506060890135945061049c60808a0161042f565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b818110156104eb578581018301518582016040015282016104cf565b818111156104fd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a", } // L1BlockABI is the input ABI used to generate the binding from. @@ -263,6 +263,37 @@ func (_L1Block *L1BlockCallerSession) Basefee() (*big.Int, error) { return _L1Block.Contract.Basefee(&_L1Block.CallOpts) } +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_L1Block *L1BlockCaller) BasefeeScalar(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _L1Block.contract.Call(opts, &out, "basefeeScalar") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_L1Block *L1BlockSession) BasefeeScalar() (uint32, error) { + return _L1Block.Contract.BasefeeScalar(&_L1Block.CallOpts) +} + +// BasefeeScalar is a free data retrieval call binding the contract method 0xbfb14fb7. +// +// Solidity: function basefeeScalar() view returns(uint32) +func (_L1Block *L1BlockCallerSession) BasefeeScalar() (uint32, error) { + return _L1Block.Contract.BasefeeScalar(&_L1Block.CallOpts) +} + // BatcherHash is a free data retrieval call binding the contract method 0xe81b2c6d. // // Solidity: function batcherHash() view returns(bytes32) @@ -294,6 +325,68 @@ func (_L1Block *L1BlockCallerSession) BatcherHash() ([32]byte, error) { return _L1Block.Contract.BatcherHash(&_L1Block.CallOpts) } +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_L1Block *L1BlockCaller) BlobBasefee(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _L1Block.contract.Call(opts, &out, "blobBasefee") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_L1Block *L1BlockSession) BlobBasefee() (*big.Int, error) { + return _L1Block.Contract.BlobBasefee(&_L1Block.CallOpts) +} + +// BlobBasefee is a free data retrieval call binding the contract method 0x75c7e4a9. +// +// Solidity: function blobBasefee() view returns(uint256) +func (_L1Block *L1BlockCallerSession) BlobBasefee() (*big.Int, error) { + return _L1Block.Contract.BlobBasefee(&_L1Block.CallOpts) +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_L1Block *L1BlockCaller) BlobBasefeeScalar(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _L1Block.contract.Call(opts, &out, "blobBasefeeScalar") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_L1Block *L1BlockSession) BlobBasefeeScalar() (uint32, error) { + return _L1Block.Contract.BlobBasefeeScalar(&_L1Block.CallOpts) +} + +// BlobBasefeeScalar is a free data retrieval call binding the contract method 0x7744864d. +// +// Solidity: function blobBasefeeScalar() view returns(uint32) +func (_L1Block *L1BlockCallerSession) BlobBasefeeScalar() (uint32, error) { + return _L1Block.Contract.BlobBasefeeScalar(&_L1Block.CallOpts) +} + // Hash is a free data retrieval call binding the contract method 0x09bd5a60. // // Solidity: function hash() view returns(bytes32) @@ -531,3 +624,24 @@ func (_L1Block *L1BlockSession) SetL1BlockValues(_number uint64, _timestamp uint func (_L1Block *L1BlockTransactorSession) SetL1BlockValues(_number uint64, _timestamp uint64, _basefee *big.Int, _hash [32]byte, _sequenceNumber uint64, _batcherHash [32]byte, _l1FeeOverhead *big.Int, _l1FeeScalar *big.Int) (*types.Transaction, error) { return _L1Block.Contract.SetL1BlockValues(&_L1Block.TransactOpts, _number, _timestamp, _basefee, _hash, _sequenceNumber, _batcherHash, _l1FeeOverhead, _l1FeeScalar) } + +// SetL1BlockValuesEcotone is a paid mutator transaction binding the contract method 0x440a5e20. +// +// Solidity: function setL1BlockValuesEcotone() returns() +func (_L1Block *L1BlockTransactor) SetL1BlockValuesEcotone(opts *bind.TransactOpts) (*types.Transaction, error) { + return _L1Block.contract.Transact(opts, "setL1BlockValuesEcotone") +} + +// SetL1BlockValuesEcotone is a paid mutator transaction binding the contract method 0x440a5e20. +// +// Solidity: function setL1BlockValuesEcotone() returns() +func (_L1Block *L1BlockSession) SetL1BlockValuesEcotone() (*types.Transaction, error) { + return _L1Block.Contract.SetL1BlockValuesEcotone(&_L1Block.TransactOpts) +} + +// SetL1BlockValuesEcotone is a paid mutator transaction binding the contract method 0x440a5e20. +// +// Solidity: function setL1BlockValuesEcotone() returns() +func (_L1Block *L1BlockTransactorSession) SetL1BlockValuesEcotone() (*types.Transaction, error) { + return _L1Block.Contract.SetL1BlockValuesEcotone(&_L1Block.TransactOpts) +} diff --git a/op-bindings/bindings/l1block_more.go b/op-bindings/bindings/l1block_more.go index 8af96ff11..b410a8725 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\":\"batcherHash\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_bytes32\"},{\"astId\":1006,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeOverhead\",\"offset\":0,\"slot\":\"5\",\"type\":\"t_uint256\"},{\"astId\":1007,\"contract\":\"src/L2/L1Block.sol:L1Block\",\"label\":\"l1FeeScalar\",\"offset\":0,\"slot\":\"6\",\"type\":\"t_uint256\"}],\"types\":{\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"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\"}],\"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 = "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80638381f58a11610081578063b80777ea1161005b578063b80777ea146101a4578063e591b282146101c4578063e81b2c6d1461020457600080fd5b80638381f58a1461017e5780638b239f73146101925780639e8c49661461019b57600080fd5b806354fd4d50116100b257806354fd4d50146100ff5780635cf249691461014857806364ca23ef1461015157600080fd5b8063015d8eb9146100ce57806309bd5a60146100e3575b600080fd5b6100e16100dc366004610369565b61020d565b005b6100ec60025481565b6040519081526020015b60405180910390f35b61013b6040518060400160405280600581526020017f312e312e3000000000000000000000000000000000000000000000000000000081525081565b6040516100f691906103db565b6100ec60015481565b6003546101659067ffffffffffffffff1681565b60405167ffffffffffffffff90911681526020016100f6565b6000546101659067ffffffffffffffff1681565b6100ec60055481565b6100ec60065481565b6000546101659068010000000000000000900467ffffffffffffffff1681565b6101df73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f6565b6100ec60045481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146102b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b803567ffffffffffffffff8116811461036457600080fd5b919050565b600080600080600080600080610100898b03121561038657600080fd5b61038f8961034c565b975061039d60208a0161034c565b965060408901359550606089013594506103b960808a0161034c565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b81811015610408578581018301518582016040015282016103ec565b8181111561041a576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a" +var L1BlockDeployedBin = "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80637744864d11610097578063b80777ea11610066578063b80777ea14610212578063bfb14fb714610232578063e591b28214610252578063e81b2c6d1461029257600080fd5b80637744864d146101bb5780638381f58a146101ec5780638b239f73146102005780639e8c49661461020957600080fd5b806354fd4d50116100d357806354fd4d50146101335780635cf249691461017c57806364ca23ef1461018557806375c7e4a9146101b257600080fd5b8063015d8eb9146100fa57806309bd5a601461010f578063440a5e201461012b575b600080fd5b61010d61010836600461044c565b61029b565b005b61011860025481565b6040519081526020015b60405180910390f35b61010d6103da565b61016f6040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161012291906104be565b61011860015481565b6003546101999067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610122565b61011860075481565b6003546101d79068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610122565b6000546101999067ffffffffffffffff1681565b61011860055481565b61011860065481565b6000546101999068010000000000000000900467ffffffffffffffff1681565b6003546101d7906c01000000000000000000000000900463ffffffff1681565b61026d73deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610122565b61011860045481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461040357633cc50b456000526004601cfd5b60043560801c60035560143560801c600055602435600155604435600755606435600255608435600455565b803567ffffffffffffffff8116811461044757600080fd5b919050565b600080600080600080600080610100898b03121561046957600080fd5b6104728961042f565b975061048060208a0161042f565b9650604089013595506060890135945061049c60808a0161042f565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b818110156104eb578581018301518582016040015282016104cf565b818111156104fd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a" func init() { diff --git a/packages/contracts-bedrock/semver-lock.json b/packages/contracts-bedrock/semver-lock.json index 94505dab1..87710e9f6 100644 --- a/packages/contracts-bedrock/semver-lock.json +++ b/packages/contracts-bedrock/semver-lock.json @@ -48,12 +48,12 @@ "sourceCodeHash": "0xd787bd2a192ba5025fa0a8de2363af66a8de20de226e411bdb576adb64636cd0" }, "src/L2/GasPriceOracle.sol": { - "initCodeHash": "0x6e235d82993606ca4d19b523096678b3cb13bad7a140567dd4f42de2cf0a2b8e", - "sourceCodeHash": "0x6dd53c5d8164eb2c96c3e210d0b667a24daa674056c9b75ac1f93433b7e737fa" + "initCodeHash": "0xc980e2ca81850ca4f72fd207e8f8a4e5eebe966393c03e3ecc21c5e87a55aa05", + "sourceCodeHash": "0x9eea8b1f68dd6a244323d58aaef24a3938e166575c71b3665a804dd4f32060de" }, "src/L2/L1Block.sol": { - "initCodeHash": "0x280927b73942e7d00c6170b15c0b1e087da0be3adf5a63a59d3a71ad64b33685", - "sourceCodeHash": "0x50e1aae72b91da2d288bbd0b7ffb693b13bd375962d9c1ac0d8b47a913520fd9" + "initCodeHash": "0xecdd18698880762e6c9561d271a447e64fdad03f25d144580fb0ebb39bfb7148", + "sourceCodeHash": "0x271b6c80593bca95dfcd3543116bed541d8177f0751bbded611680b64a81818a" }, "src/L2/L1FeeVault.sol": { "initCodeHash": "0x2744d34573be83206d1b75d049d18a7bb37f9058e68c0803e5008c46b0dc2474", diff --git a/packages/contracts-bedrock/slither-report.json b/packages/contracts-bedrock/slither-report.json index dfe0e896a..41306c5be 100644 --- a/packages/contracts-bedrock/slither-report.json +++ b/packages/contracts-bedrock/slither-report.json @@ -683,6 +683,30 @@ "length": 29, "filename_relative": "src/universal/Proxy.sol" }, + { + "id": "8a3cbb409970f13c99fdfb6c1c35d7cdb67fa2ea79f2578425f5d167153382c3", + "impact": "High", + "confidence": "High", + "check": "uninitialized-state", + "description": "L1Block.blobBasefee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n", + "type": "variable", + "name": "blobBasefee", + "start": 1897, + "length": 26, + "filename_relative": "src/L2/L1Block.sol" + }, + { + "id": "8a3cbb409970f13c99fdfb6c1c35d7cdb67fa2ea79f2578425f5d167153382c3", + "impact": "High", + "confidence": "High", + "check": "uninitialized-state", + "description": "L1Block.blobBasefee (src/L2/L1Block.sol#50) is never initialized. It is used in:\n\t- L1Block.setL1BlockValuesEcotone() (src/L2/L1Block.sol#101-118)\n", + "type": "function", + "name": "setL1BlockValuesEcotone", + "start": 3879, + "length": 956, + "filename_relative": "src/L2/L1Block.sol" + }, { "id": "89460308ae3bd86a612657eb7bfe28221ced6a7a7fe723ec2a19149bfc819cb5", "impact": "Medium", diff --git a/packages/contracts-bedrock/snapshots/abi/GasPriceOracle.json b/packages/contracts-bedrock/snapshots/abi/GasPriceOracle.json index d6f005dae..69994b638 100644 --- a/packages/contracts-bedrock/snapshots/abi/GasPriceOracle.json +++ b/packages/contracts-bedrock/snapshots/abi/GasPriceOracle.json @@ -25,6 +25,45 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "basefeeScalar", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "blobBasefee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "blobBasefeeScalar", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "decimals", @@ -89,6 +128,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "isEcotone", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "l1BaseFee", @@ -128,6 +180,13 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "setEcotone", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "version", diff --git a/packages/contracts-bedrock/snapshots/abi/L1Block.json b/packages/contracts-bedrock/snapshots/abi/L1Block.json index 6edc3d54e..8a9a1849f 100644 --- a/packages/contracts-bedrock/snapshots/abi/L1Block.json +++ b/packages/contracts-bedrock/snapshots/abi/L1Block.json @@ -25,6 +25,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "basefeeScalar", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "batcherHash", @@ -38,6 +51,32 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "blobBasefee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "blobBasefeeScalar", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "hash", @@ -151,6 +190,13 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "setL1BlockValuesEcotone", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "timestamp", diff --git a/packages/contracts-bedrock/snapshots/storageLayout/GasPriceOracle.json b/packages/contracts-bedrock/snapshots/storageLayout/GasPriceOracle.json index 0637a088a..9dd2e57a3 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/GasPriceOracle.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/GasPriceOracle.json @@ -1 +1,9 @@ -[] \ No newline at end of file +[ + { + "bytes": "1", + "label": "isEcotone", + "offset": 0, + "slot": "0", + "type": "bool" + } +] \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json b/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json index 43d6bb2f1..263aa551e 100644 --- a/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json +++ b/packages/contracts-bedrock/snapshots/storageLayout/L1Block.json @@ -34,6 +34,20 @@ "slot": "3", "type": "uint64" }, + { + "bytes": "4", + "label": "blobBasefeeScalar", + "offset": 8, + "slot": "3", + "type": "uint32" + }, + { + "bytes": "4", + "label": "basefeeScalar", + "offset": 12, + "slot": "3", + "type": "uint32" + }, { "bytes": "32", "label": "batcherHash", @@ -54,5 +68,12 @@ "offset": 0, "slot": "6", "type": "uint256" + }, + { + "bytes": "32", + "label": "blobBasefee", + "offset": 0, + "slot": "7", + "type": "uint256" } ] \ No newline at end of file diff --git a/packages/contracts-bedrock/src/L2/GasPriceOracle.sol b/packages/contracts-bedrock/src/L2/GasPriceOracle.sol index 30ab88c19..6e5045a0e 100644 --- a/packages/contracts-bedrock/src/L2/GasPriceOracle.sol +++ b/packages/contracts-bedrock/src/L2/GasPriceOracle.sol @@ -24,20 +24,31 @@ contract GasPriceOracle is ISemver { uint256 public constant DECIMALS = 6; /// @notice Semantic version. - /// @custom:semver 1.1.0 - string public constant version = "1.1.0"; + /// @custom:semver 1.2.0 + string public constant version = "1.2.0"; + + /// @notice Indicates whether the network has gone through the Ecotone upgrade. + bool public isEcotone; /// @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. /// @param _data Unsigned fully RLP-encoded transaction to get the L1 fee for. /// @return L1 fee that should be paid for the tx function getL1Fee(bytes memory _data) external view returns (uint256) { - uint256 l1GasUsed = getL1GasUsed(_data); - uint256 l1Fee = l1GasUsed * l1BaseFee(); - uint256 divisor = 10 ** DECIMALS; - uint256 unscaled = l1Fee * scalar(); - uint256 scaled = unscaled / divisor; - return scaled; + if (isEcotone) { + return _getL1FeeEcotone(_data); + } + return _getL1FeeBedrock(_data); + } + + /// @notice Set chain to be Ecotone chain (callable by depositor account) + function setEcotone() external { + require( + msg.sender == L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT(), + "GasPriceOracle: only the depositor account can set isEcotone flag" + ); + require(isEcotone == false, "GasPriceOracle: Ecotone already active"); + isEcotone = true; } /// @notice Retrieves the current gas price (base fee). @@ -52,15 +63,19 @@ contract GasPriceOracle is ISemver { return block.basefee; } + /// @custom:legacy /// @notice Retrieves the current fee overhead. /// @return Current fee overhead. function overhead() public view returns (uint256) { + require(!isEcotone, "GasPriceOracle: overhead() is deprecated"); return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead(); } + /// @custom:legacy /// @notice Retrieves the current fee scalar. /// @return Current fee scalar. function scalar() public view returns (uint256) { + require(!isEcotone, "GasPriceOracle: scalar() is deprecated"); return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar(); } @@ -70,6 +85,24 @@ contract GasPriceOracle is ISemver { return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee(); } + /// @notice Retrieves the current blob base fee. + /// @return Current blob base fee. + function blobBasefee() public view returns (uint256) { + return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBasefee(); + } + + /// @notice Retrieves the current base fee scalar. + /// @return Current base fee scalar. + function basefeeScalar() public view returns (uint32) { + return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefeeScalar(); + } + + /// @notice Retrieves the current blob base fee scalar. + /// @return Current blob base fee scalar. + function blobBasefeeScalar() public view returns (uint32) { + return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBasefeeScalar(); + } + /// @custom:legacy /// @notice Retrieves the number of decimals used in the scalar. /// @return Number of decimals used in the scalar. @@ -77,13 +110,43 @@ contract GasPriceOracle is ISemver { return DECIMALS; } - /// @notice Computes the amount of L1 gas used for a transaction. Adds the overhead which - /// represents the per-transaction gas overhead of posting the transaction and state - /// roots to L1. Adds 68 bytes of padding to account for the fact that the input does - /// not have a signature. + /// @notice Computes the amount of L1 gas used for a transaction. Adds 68 bytes + /// of padding to account for the fact that the input does not have a signature. /// @param _data Unsigned fully RLP-encoded transaction to get the L1 gas for. /// @return Amount of L1 gas used to publish the transaction. function getL1GasUsed(bytes memory _data) public view returns (uint256) { + uint256 l1GasUsed = _getCalldataGas(_data); + if (isEcotone) { + return l1GasUsed; + } + return l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead(); + } + + /// @notice Computation of the L1 portion of the fee for Bedrock. + /// @param _data Unsigned fully RLP-encoded transaction to get the L1 fee for. + /// @return L1 fee that should be paid for the tx + function _getL1FeeBedrock(bytes memory _data) internal view returns (uint256) { + uint256 l1GasUsed = _getCalldataGas(_data); + uint256 fee = (l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead()) * l1BaseFee() + * L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar(); + return fee / (10 ** DECIMALS); + } + + /// @notice L1 portion of the fee after Ecotone. + /// @param _data Unsigned fully RLP-encoded transaction to get the L1 fee for. + /// @return L1 fee that should be paid for the tx + function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) { + uint256 l1GasUsed = _getCalldataGas(_data); + uint256 scaledBasefee = basefeeScalar() * 16 * l1BaseFee(); + uint256 scaledBlobBasefee = blobBasefeeScalar() * blobBasefee(); + uint256 fee = l1GasUsed * (scaledBasefee + scaledBlobBasefee); + return fee / (16 * 10 ** DECIMALS); + } + + /// @notice L1 gas estimation calculation. + /// @param _data Unsigned fully RLP-encoded transaction to get the L1 gas for. + /// @return Amount of L1 gas used to publish the transaction. + function _getCalldataGas(bytes memory _data) internal pure returns (uint256) { uint256 total = 0; uint256 length = _data.length; for (uint256 i = 0; i < length; i++) { @@ -93,7 +156,6 @@ contract GasPriceOracle is ISemver { total += 16; } } - uint256 unsigned = total + overhead(); - return unsigned + (68 * 16); + return total + (68 * 16); } } diff --git a/packages/contracts-bedrock/src/L2/L1Block.sol b/packages/contracts-bedrock/src/L2/L1Block.sol index 7ed45ce0d..7ab28b1ad 100644 --- a/packages/contracts-bedrock/src/L2/L1Block.sol +++ b/packages/contracts-bedrock/src/L2/L1Block.sol @@ -29,18 +29,30 @@ contract L1Block is ISemver { /// @notice The number of L2 blocks in the same epoch. uint64 public sequenceNumber; + /// @notice The scalar value applied to the L1 blob base fee portion of the blob-capable L1 cost func. + uint32 public blobBasefeeScalar; + + /// @notice The scalar value applied to the L1 base fee portion of the blob-capable L1 cost func. + uint32 public basefeeScalar; + /// @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. + /// @custom:legacy uint256 public l1FeeOverhead; /// @notice The scalar value applied to the L1 portion of the transaction fee. + /// @custom:legacy uint256 public l1FeeScalar; - /// @custom:semver 1.1.0 - string public constant version = "1.1.0"; + /// @notice The latest L1 blob basefee. + uint256 public blobBasefee; + + /// @custom:semver 1.2.0 + string public constant version = "1.2.0"; + /// @custom:legacy /// @notice Updates the L1 block values. /// @param _number L1 blocknumber. /// @param _timestamp L1 timestamp. @@ -73,4 +85,35 @@ contract L1Block is ISemver { l1FeeOverhead = _l1FeeOverhead; l1FeeScalar = _l1FeeScalar; } + + /// @notice Updates the L1 block values for an Ecotone upgraded chain. + /// Params are packed and passed in as raw msg.data instead of ABI to reduce calldata size. + /// Params are expected to be in the following order: + /// 1. _basefeeScalar L1 basefee scalar + /// 2. _blobBasefeeScalar L1 blob basefee scalar + /// 3. _sequenceNumber Number of L2 blocks since epoch start. + /// 4. _timestamp L1 timestamp. + /// 5. _number L1 blocknumber. + /// 6. _basefee L1 basefee. + /// 7. _blobBasefee L1 blobBasefee. + /// 8. _hash L1 blockhash. + /// 9. _batcherHash Versioned hash to authenticate batcher by. + function setL1BlockValuesEcotone() external { + assembly { + // Revert if the caller is not the depositor account. + if xor(caller(), DEPOSITOR_ACCOUNT) { + mstore(0x00, 0x3cc50b45) // 0x3cc50b45 is the 4-byte selector of "NotDepositor()" + revert(0x1C, 0x04) // returns the stored 4-byte selector from above + } + let data := calldataload(4) + // sequencenum (uint64), blobBasefeeScalar (uint32), basefeeScalar (uint32) + sstore(sequenceNumber.slot, shr(128, calldataload(4))) + // number (uint64) and timestamp (uint64) + sstore(number.slot, shr(128, calldataload(20))) + sstore(basefee.slot, calldataload(36)) // uint256 + sstore(blobBasefee.slot, calldataload(68)) // uint256 + sstore(hash.slot, calldataload(100)) // bytes32 + sstore(batcherHash.slot, calldataload(132)) // bytes32 + } + } } diff --git a/packages/contracts-bedrock/src/libraries/Encoding.sol b/packages/contracts-bedrock/src/libraries/Encoding.sol index 0177ddc65..e70ab5dba 100644 --- a/packages/contracts-bedrock/src/libraries/Encoding.sol +++ b/packages/contracts-bedrock/src/libraries/Encoding.sol @@ -133,4 +133,44 @@ library Encoding { } return (nonce, version); } + + /// @notice Returns an appropriately encoded call to L1Block.setL1BlockValuesEcotone + /// @param basefeeScalar L1 basefee Scalar + /// @param blobBasefeeScalar L1 blob basefee Scalar + /// @param sequenceNumber Number of L2 blocks since epoch start. + /// @param timestamp L1 timestamp. + /// @param number L1 blocknumber. + /// @param basefee L1 basefee. + /// @param blobBasefee L1 blob basefee. + /// @param hash L1 blockhash. + /// @param batcherHash Versioned hash to authenticate batcher by. + function encodeSetL1BlockValuesEcotone( + uint32 basefeeScalar, + uint32 blobBasefeeScalar, + uint64 sequenceNumber, + uint64 timestamp, + uint64 number, + uint256 basefee, + uint256 blobBasefee, + bytes32 hash, + bytes32 batcherHash + ) + internal + pure + returns (bytes memory) + { + bytes4 functionSignature = bytes4(keccak256("setL1BlockValuesEcotone()")); + return abi.encodePacked( + functionSignature, + basefeeScalar, + blobBasefeeScalar, + sequenceNumber, + timestamp, + number, + basefee, + blobBasefee, + hash, + batcherHash + ); + } } diff --git a/packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol b/packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol index 5e9d71e7b..43daf208b 100644 --- a/packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol +++ b/packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol @@ -4,6 +4,9 @@ pragma solidity 0.8.15; // Testing utilities import { CommonTest } from "test/setup/CommonTest.sol"; +// Libraries +import { Encoding } from "src/libraries/Encoding.sol"; + contract GasPriceOracle_Test is CommonTest { event OverheadUpdated(uint256); event ScalarUpdated(uint256); @@ -14,18 +17,27 @@ contract GasPriceOracle_Test is CommonTest { // The initial L1 context values uint64 constant number = 10; uint64 constant timestamp = 11; - uint256 constant basefee = 100; + uint256 constant basefee = 2 * (10 ** 6); + uint256 constant blobBasefee = 3 * (10 ** 6); bytes32 constant hash = bytes32(uint256(64)); uint64 constant sequenceNumber = 0; bytes32 constant batcherHash = bytes32(uint256(777)); uint256 constant l1FeeOverhead = 310; uint256 constant l1FeeScalar = 10; + uint32 constant blobBasefeeScalar = 15; + uint32 constant basefeeScalar = 20; /// @dev Sets up the test suite. function setUp() public virtual override { super.setUp(); - depositor = l1Block.DEPOSITOR_ACCOUNT(); + } +} + +contract GasPriceOracleBedrock_Test is GasPriceOracle_Test { + /// @dev Sets up the test suite. + function setUp() public virtual override { + super.setUp(); vm.prank(depositor); l1Block.setL1BlockValues({ @@ -93,3 +105,91 @@ contract GasPriceOracle_Test is CommonTest { assertEq(returndata, hex""); } } + +contract GasPriceOracleEcotone_Test is GasPriceOracle_Test { + /// @dev Sets up the test suite. + function setUp() public virtual override { + super.setUp(); + + bytes memory calldataPacked = Encoding.encodeSetL1BlockValuesEcotone( + basefeeScalar, blobBasefeeScalar, sequenceNumber, timestamp, number, basefee, blobBasefee, hash, batcherHash + ); + + // Execute the function call + vm.prank(depositor); + (bool success,) = address(l1Block).call(calldataPacked); + require(success, "Function call failed"); + + vm.prank(depositor); + gasPriceOracle.setEcotone(); + } + + /// @dev Tests that `setEcotone` is only callable by the depositor. + function test_setEcotone_wrongCaller_reverts() external { + vm.expectRevert("GasPriceOracle: only the depositor account can set isEcotone flag"); + gasPriceOracle.setEcotone(); + } + + /// @dev Tests that `gasPrice` is set correctly. + function test_gasPrice_succeeds() external { + vm.fee(100); + uint256 gasPrice = gasPriceOracle.gasPrice(); + assertEq(gasPrice, 100); + } + + /// @dev Tests that `baseFee` is set correctly. + function test_baseFee_succeeds() external { + vm.fee(64); + uint256 gasPrice = gasPriceOracle.baseFee(); + assertEq(gasPrice, 64); + } + + /// @dev Tests that `overhead` reverts since it was removed in ecotone. + function test_overhead_legacyFunction_reverts() external { + vm.expectRevert("GasPriceOracle: overhead() is deprecated"); + gasPriceOracle.overhead(); + } + + /// @dev Tests that `scalar` reverts since it was removed in ecotone. + function test_scalar_legacyFunction_reverts() external { + vm.expectRevert("GasPriceOracle: scalar() is deprecated"); + gasPriceOracle.scalar(); + } + + /// @dev Tests that `l1BaseFee` is set correctly. + function test_l1BaseFee_succeeds() external { + assertEq(gasPriceOracle.l1BaseFee(), basefee); + } + + /// @dev Tests that `blobBasefee` is set correctly. + function test_blobBasefee_succeeds() external { + assertEq(gasPriceOracle.blobBasefee(), blobBasefee); + } + + /// @dev Tests that `basefeeScalar` is set correctly. + function test_basefeeScalar_succeeds() external { + assertEq(gasPriceOracle.basefeeScalar(), basefeeScalar); + } + + /// @dev Tests that `blobBasefeeScalar` is set correctly. + function test_blobBasefeeScalar_succeeds() external { + assertEq(gasPriceOracle.blobBasefeeScalar(), blobBasefeeScalar); + } + + /// @dev Tests that `decimals` is set correctly. + function test_decimals_succeeds() external { + assertEq(gasPriceOracle.decimals(), 6); + assertEq(gasPriceOracle.DECIMALS(), 6); + } + + /// @dev Tests that `getL1GasUsed` and `getL1Fee` return expected values + function test_getL1Fee_succeeds() external { + bytes memory data = hex"0000010203"; // 2 zero bytes, 3 non-zero bytes + // (2*4) + (3*16) + (68*16) == 1144 + uint256 gas = gasPriceOracle.getL1GasUsed(data); + assertEq(gas, 1144); + uint256 price = gasPriceOracle.getL1Fee(data); + // gas * (2M*16*20 + 3M*15) / 16M == 48977.5 + assertEq(price, 48977); + } +} diff --git a/packages/contracts-bedrock/test/L2/L1Block.t.sol b/packages/contracts-bedrock/test/L2/L1Block.t.sol index c62a32e44..f71d7235c 100644 --- a/packages/contracts-bedrock/test/L2/L1Block.t.sol +++ b/packages/contracts-bedrock/test/L2/L1Block.t.sol @@ -4,6 +4,9 @@ pragma solidity 0.8.15; // Testing utilities import { CommonTest } from "test/setup/CommonTest.sol"; +// Libraries +import { Encoding } from "src/libraries/Encoding.sol"; + // Target contract import { L1Block } from "src/L2/L1Block.sol"; @@ -13,22 +16,12 @@ contract L1BlockTest is CommonTest { /// @dev Sets up the test suite. function setUp() public virtual override { super.setUp(); - depositor = l1Block.DEPOSITOR_ACCOUNT(); - vm.prank(depositor); - l1Block.setL1BlockValues({ - _number: uint64(1), - _timestamp: uint64(2), - _basefee: 3, - _hash: keccak256(abi.encode(block.number)), - _sequenceNumber: uint64(4), - _batcherHash: bytes32(0), - _l1FeeOverhead: 2, - _l1FeeScalar: 3 - }); } +} - /// @dev Tests that `setL1BlockValues` updates the values correctly. +contract L1BlockBedrock_Test is L1BlockTest { + // @dev Tests that `setL1BlockValues` updates the values correctly. function testFuzz_updatesValues_succeeds( uint64 n, uint64 t, @@ -53,31 +46,6 @@ contract L1BlockTest is CommonTest { assertEq(l1Block.l1FeeScalar(), fs); } - /// @dev Tests that `number` returns the correct value. - function test_number_succeeds() external { - assertEq(l1Block.number(), uint64(1)); - } - - /// @dev Tests that `timestamp` returns the correct value. - function test_timestamp_succeeds() external { - assertEq(l1Block.timestamp(), uint64(2)); - } - - /// @dev Tests that `basefee` returns the correct value. - function test_basefee_succeeds() external { - assertEq(l1Block.basefee(), 3); - } - - /// @dev Tests that `hash` returns the correct value. - function test_hash_succeeds() external { - assertEq(l1Block.hash(), keccak256(abi.encode(block.number))); - } - - /// @dev Tests that `sequenceNumber` returns the correct value. - function test_sequenceNumber_succeeds() external { - assertEq(l1Block.sequenceNumber(), uint64(4)); - } - /// @dev Tests that `setL1BlockValues` can set max values. function test_updateValues_succeeds() external { vm.prank(depositor); @@ -93,3 +61,90 @@ contract L1BlockTest is CommonTest { }); } } + +contract L1BlockEcotone_Test is L1BlockTest { + /// @dev Tests that setL1BlockValuesEcotone updates the values appropriately. + function testFuzz_setL1BlockValuesEcotone_succeeds( + uint32 basefeeScalar, + uint32 blobBasefeeScalar, + uint64 sequenceNumber, + uint64 timestamp, + uint64 number, + uint256 basefee, + uint256 blobBasefee, + bytes32 hash, + bytes32 batcherHash + ) + external + { + bytes memory functionCallDataPacked = Encoding.encodeSetL1BlockValuesEcotone( + basefeeScalar, blobBasefeeScalar, sequenceNumber, timestamp, number, basefee, blobBasefee, hash, batcherHash + ); + + vm.prank(depositor); + (bool success,) = address(l1Block).call(functionCallDataPacked); + assertTrue(success, "Function call failed"); + + assertEq(l1Block.basefeeScalar(), basefeeScalar); + assertEq(l1Block.blobBasefeeScalar(), blobBasefeeScalar); + assertEq(l1Block.sequenceNumber(), sequenceNumber); + assertEq(l1Block.timestamp(), timestamp); + assertEq(l1Block.number(), number); + assertEq(l1Block.basefee(), basefee); + assertEq(l1Block.blobBasefee(), blobBasefee); + assertEq(l1Block.hash(), hash); + assertEq(l1Block.batcherHash(), batcherHash); + + // ensure we didn't accidentally pollute the 128 bits of the sequencenum+scalars slot that + // should be empty + bytes32 scalarsSlot = vm.load(address(l1Block), bytes32(uint256(3))); + bytes32 mask128 = hex"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000"; + + assertEq(0, scalarsSlot & mask128); + + // ensure we didn't accidentally pollute the 128 bits of the number & timestamp slot that + // should be empty + bytes32 numberTimestampSlot = vm.load(address(l1Block), bytes32(uint256(0))); + assertEq(0, numberTimestampSlot & mask128); + } + + /// @dev Tests that `setL1BlockValuesEcotone` succeeds if sender address is the depositor + function test_setL1BlockValuesEcotone_isDepositor_succeeds() external { + bytes memory functionCallDataPacked = Encoding.encodeSetL1BlockValuesEcotone( + type(uint32).max, + type(uint32).max, + type(uint64).max, + type(uint64).max, + type(uint64).max, + type(uint256).max, + type(uint256).max, + bytes32(type(uint256).max), + bytes32(type(uint256).max) + ); + + vm.prank(depositor); + (bool success,) = address(l1Block).call(functionCallDataPacked); + assertTrue(success, "function call failed"); + } + + /// @dev Tests that `setL1BlockValuesEcotone` fails if sender address is not the depositor + function test_setL1BlockValuesEcotone_notDepositor_fails() external { + bytes memory functionCallDataPacked = Encoding.encodeSetL1BlockValuesEcotone( + type(uint32).max, + type(uint32).max, + type(uint64).max, + type(uint64).max, + type(uint64).max, + type(uint256).max, + type(uint256).max, + bytes32(type(uint256).max), + bytes32(type(uint256).max) + ); + + (bool success, bytes memory data) = address(l1Block).call(functionCallDataPacked); + assertTrue(!success, "function call should have failed"); + // make sure return value is the expected function selector for "NotDepositor()" + bytes memory expReturn = hex"3cc50b45"; + assertEq(data, expReturn); + } +} diff --git a/specs/exec-engine.md b/specs/exec-engine.md index bb8521254..69f99a1d7 100644 --- a/specs/exec-engine.md +++ b/specs/exec-engine.md @@ -173,8 +173,8 @@ ways: - using direct storage-reads: - basefee `uint256` in slot `1` - blobBasefee `uint256` in slot `7` - - l1BasefeeScalar big-endian `uint32` slot `8` offset `4` - - l1BlobBasefeeScalar as big-endian `uint32` in slot `8` offset `0` + - l1BasefeeScalar big-endian `uint32` slot `3` at offset `12` + - l1BlobBasefeeScalar big-endian `uint32` in slot `3` at offset `8` ## Engine API -- 2.23.0