From b9da8f68e733a51255c1307d016d1ff9e241f3c9 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 8 Aug 2023 00:12:10 +0800 Subject: [PATCH] feat(bindings): update go contract bindings (#352) --- bindings/.githead | 2 +- bindings/encoding/input.go | 4 --- bindings/encoding/struct.go | 1 - bindings/encoding/struct_test.go | 1 - bindings/gen_taiko_l2.go | 26 ++++++++++---------- driver/chain_syncer/calldata/syncer.go | 34 ++++++++++++++++++++------ pkg/rpc/utils_test.go | 2 +- proposer/proposer.go | 5 +--- proposer/proposer_test.go | 3 +-- testutils/helper.go | 7 +----- 10 files changed, 45 insertions(+), 40 deletions(-) diff --git a/bindings/.githead b/bindings/.githead index d4bce9fd3..c20380f54 100644 --- a/bindings/.githead +++ b/bindings/.githead @@ -1 +1 @@ -1eeba9d97ed8e6e4a8d07a8b0af163a16fbc9ccf +06710eb41132f7b920d80053ed8b906d90c18bb3 diff --git a/bindings/encoding/input.go b/bindings/encoding/input.go index 26e126890..1df1894f0 100644 --- a/bindings/encoding/input.go +++ b/bindings/encoding/input.go @@ -25,10 +25,6 @@ var ( Name: "beneficiary", Type: "address", }, - { - Name: "gasLimit", - Type: "uint32", - }, { Name: "txListByteStart", Type: "uint24", diff --git a/bindings/encoding/struct.go b/bindings/encoding/struct.go index a1a00bd4c..9e2cda252 100644 --- a/bindings/encoding/struct.go +++ b/bindings/encoding/struct.go @@ -46,7 +46,6 @@ type TaikoL1Evidence struct { type TaikoL1BlockMetadataInput struct { TxListHash [32]byte Beneficiary common.Address - GasLimit uint32 TxListByteStart *big.Int TxListByteEnd *big.Int CacheTxListInfo uint8 diff --git a/bindings/encoding/struct_test.go b/bindings/encoding/struct_test.go index 8271c4a5c..1261fe62a 100644 --- a/bindings/encoding/struct_test.go +++ b/bindings/encoding/struct_test.go @@ -34,7 +34,6 @@ var ( } testMetaInput = TaikoL1BlockMetadataInput{ Beneficiary: common.BytesToAddress(randomHash().Bytes()), - GasLimit: rand.Uint32(), TxListHash: randomHash(), TxListByteStart: common.Big0, TxListByteEnd: common.Big0, diff --git a/bindings/gen_taiko_l2.go b/bindings/gen_taiko_l2.go index f4a735ef3..3c8732674 100644 --- a/bindings/gen_taiko_l2.go +++ b/bindings/gen_taiko_l2.go @@ -47,7 +47,7 @@ type TaikoL2EIP1559Params struct { // TaikoL2ClientMetaData contains all meta data concerning the TaikoL2Client contract. var TaikoL2ClientMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"L2_1559_OUT_OF_STOCK\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_1559_OUT_OF_STOCK\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_1559_UNEXPECTED_CHANGE\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_1559_UNEXPECTED_CHANGE\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_BASEFEE_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_1559_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_GOLDEN_TOUCH_K\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_SENDER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"expected\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"actual\",\"type\":\"bytes32\"}],\"name\":\"L2_PUBLIC_INPUT_HASH_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_TOO_LATE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Overflow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"number\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gaslimit\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"prevrandao\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"chainid\",\"type\":\"uint32\"}],\"name\":\"Anchored\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\":[],\"name\":\"GOLDEN_TOUCH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_PRIVATEKEY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"l1SignalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasExcess\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"timeSinceParent\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"getBasefee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_basefee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getCrossChainBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getCrossChainSignalRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEIP1559Config\",\"outputs\":[{\"components\":[{\"internalType\":\"uint128\",\"name\":\"yscale\",\"type\":\"uint128\"},{\"internalType\":\"uint64\",\"name\":\"xscale\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"}],\"internalType\":\"structTaikoL2.EIP1559Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"gasExcessMax\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"gasTarget\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"ratio2x1x\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoL2.EIP1559Params\",\"name\":\"_param1559\",\"type\":\"tuple\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedL1Height\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parentTimestamp\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"digest\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signAnchor\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"L2_1559_OUT_OF_STOCK\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_1559_OUT_OF_STOCK\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_1559_UNEXPECTED_CHANGE\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_1559_UNEXPECTED_CHANGE\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_BASEFEE_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_1559_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_GOLDEN_TOUCH_K\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_SENDER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"expected\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"actual\",\"type\":\"bytes32\"}],\"name\":\"L2_PUBLIC_INPUT_HASH_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_TOO_LATE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Overflow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"number\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gaslimit\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"prevrandao\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"chainid\",\"type\":\"uint32\"}],\"name\":\"Anchored\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\":[],\"name\":\"GOLDEN_TOUCH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_PRIVATEKEY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"l1SignalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasExcess\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"timeSinceParent\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"getBasefee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_basefee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getCrossChainBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getCrossChainSignalRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEIP1559Config\",\"outputs\":[{\"components\":[{\"internalType\":\"uint128\",\"name\":\"yscale\",\"type\":\"uint128\"},{\"internalType\":\"uint64\",\"name\":\"xscale\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"}],\"internalType\":\"structTaikoL2.EIP1559Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"gasExcessMax\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"gasTarget\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"ratio2x1x\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoL2.EIP1559Params\",\"name\":\"_param1559\",\"type\":\"tuple\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedL1Height\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parentTimestamp\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"digest\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signAnchor\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // TaikoL2ClientABI is the input ABI used to generate the binding from. @@ -320,12 +320,12 @@ func (_TaikoL2Client *TaikoL2ClientCallerSession) GasExcess() (uint64, error) { return _TaikoL2Client.Contract.GasExcess(&_TaikoL2Client.CallOpts) } -// GetBasefee is a free data retrieval call binding the contract method 0xc20ebea5. +// GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint32 timeSinceParent, uint32 gasLimit, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2Client *TaikoL2ClientCaller) GetBasefee(opts *bind.CallOpts, timeSinceParent uint32, gasLimit uint32, parentGasUsed uint32) (*big.Int, error) { +// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) +func (_TaikoL2Client *TaikoL2ClientCaller) GetBasefee(opts *bind.CallOpts, timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { var out []interface{} - err := _TaikoL2Client.contract.Call(opts, &out, "getBasefee", timeSinceParent, gasLimit, parentGasUsed) + err := _TaikoL2Client.contract.Call(opts, &out, "getBasefee", timeSinceParent, parentGasUsed) if err != nil { return *new(*big.Int), err @@ -337,18 +337,18 @@ func (_TaikoL2Client *TaikoL2ClientCaller) GetBasefee(opts *bind.CallOpts, timeS } -// GetBasefee is a free data retrieval call binding the contract method 0xc20ebea5. +// GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint32 timeSinceParent, uint32 gasLimit, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2Client *TaikoL2ClientSession) GetBasefee(timeSinceParent uint32, gasLimit uint32, parentGasUsed uint32) (*big.Int, error) { - return _TaikoL2Client.Contract.GetBasefee(&_TaikoL2Client.CallOpts, timeSinceParent, gasLimit, parentGasUsed) +// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) +func (_TaikoL2Client *TaikoL2ClientSession) GetBasefee(timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { + return _TaikoL2Client.Contract.GetBasefee(&_TaikoL2Client.CallOpts, timeSinceParent, parentGasUsed) } -// GetBasefee is a free data retrieval call binding the contract method 0xc20ebea5. +// GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint32 timeSinceParent, uint32 gasLimit, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2Client *TaikoL2ClientCallerSession) GetBasefee(timeSinceParent uint32, gasLimit uint32, parentGasUsed uint32) (*big.Int, error) { - return _TaikoL2Client.Contract.GetBasefee(&_TaikoL2Client.CallOpts, timeSinceParent, gasLimit, parentGasUsed) +// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) +func (_TaikoL2Client *TaikoL2ClientCallerSession) GetBasefee(timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { + return _TaikoL2Client.Contract.GetBasefee(&_TaikoL2Client.CallOpts, timeSinceParent, parentGasUsed) } // GetBlockHash is a free data retrieval call binding the contract method 0xee82ac5e. diff --git a/driver/chain_syncer/calldata/syncer.go b/driver/chain_syncer/calldata/syncer.go index ab45fa7ae..bbfc25fcb 100644 --- a/driver/chain_syncer/calldata/syncer.go +++ b/driver/chain_syncer/calldata/syncer.go @@ -270,7 +270,6 @@ func (s *Syncer) onBlockProposed( txListBytes, l1Origin, ) - if err != nil { return fmt.Errorf("failed to insert new head to L2 execution engine: %w", err) } @@ -334,8 +333,7 @@ func (s *Syncer) insertNewHead( // Get L2 baseFee baseFee, err := s.rpc.TaikoL2.GetBasefee( &bind.CallOpts{BlockNumber: parent.Number, Context: ctx}, - uint32(event.Meta.Timestamp-parentTimestamp), - event.Meta.GasLimit+uint32(s.anchorConstructor.GasLimit()), + event.Meta.Timestamp-parentTimestamp, uint32(parent.GasUsed), ) if err != nil { @@ -346,7 +344,6 @@ func (s *Syncer) insertNewHead( "GetBasefee", "baseFee", baseFee, "timeSinceParent", uint32(event.Meta.Timestamp-parentTimestamp), - "gasLimit", uint64(event.Meta.GasLimit+uint32(s.anchorConstructor.GasLimit())), "parentGasUsed", parent.GasUsed, ) @@ -386,7 +383,6 @@ func (s *Syncer) insertNewHead( baseFee, withdrawals, ) - if err != nil { return nil, fmt.Errorf("failed to create execution payloads: %w", err) } @@ -437,7 +433,21 @@ func (s *Syncer) createExecutionPayloads( L1Origin: l1Origin, } - log.Debug("PayloadAttributes", "attributes", attributes, "meta", attributes.BlockMetadata) + log.Debug( + "PayloadAttributes", + "blockID", event.BlockId, + "timestamp", attributes.Timestamp, + "random", attributes.Random, + "suggestedFeeRecipient", attributes.SuggestedFeeRecipient, + "withdrawals", len(attributes.Withdrawals), + "highestBlockID", attributes.BlockMetadata.HighestBlockID, + "gasLimit", attributes.BlockMetadata.GasLimit, + "timestamp", attributes.BlockMetadata.Timestamp, + "mixHash", attributes.BlockMetadata.MixHash, + "baseFee", attributes.BaseFeePerGas, + "l1OriginHeight", attributes.L1Origin.L1BlockHeight, + "l1OriginHash", attributes.L1Origin.L1BlockHash, + ) // Step 1, prepare a payload fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, attributes) @@ -457,7 +467,17 @@ func (s *Syncer) createExecutionPayloads( return nil, fmt.Errorf("failed to get payload: %w", err) } - log.Debug("Payload", "payload", payload) + log.Debug( + "Payload", + "blockID", event.BlockId, + "baseFee", payload.BaseFeePerGas, + "number", payload.Number, + "hash", payload.BlockHash, + "gasLimit", payload.GasLimit, + "gasUsed", payload.GasUsed, + "timestamp", payload.Timestamp, + "withdrawalsHash", payload.WithdrawalsHash, + ) // Step 3, execute the payload execStatus, err := s.rpc.L2Engine.NewPayload(ctx, payload) diff --git a/pkg/rpc/utils_test.go b/pkg/rpc/utils_test.go index 4eb9911fc..7a4edac67 100644 --- a/pkg/rpc/utils_test.go +++ b/pkg/rpc/utils_test.go @@ -40,7 +40,7 @@ func TestL1ContentFrom(t *testing.T) { l2Head, err := client.L2.HeaderByNumber(context.Background(), nil) require.Nil(t, err) - baseFee, err := client.TaikoL2.GetBasefee(nil, 0, 60000000, uint32(l2Head.GasUsed)) + baseFee, err := client.TaikoL2.GetBasefee(nil, 0, uint32(l2Head.GasUsed)) require.Nil(t, err) testAddrPrivKey, err := crypto.ToECDSA(common.Hex2Bytes(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) diff --git a/proposer/proposer.go b/proposer/proposer.go index 095adcc90..45b04519e 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -201,8 +201,7 @@ func (p *Proposer) ProposeOp(ctx context.Context) error { baseFee, err := p.rpc.TaikoL2.GetBasefee( &bind.CallOpts{Context: ctx}, - uint32(time.Now().Unix()-int64(l2Head.Time)), - p.protocolConfigs.BlockMaxGasLimit, + uint64(time.Now().Unix())-l2Head.Time, uint32(l2Head.GasUsed), ) if err != nil { @@ -289,7 +288,6 @@ func (p *Proposer) ProposeOp(ctx context.Context) error { txNonce := nonce + uint64(i) if err := p.ProposeTxList(ctx, &encoding.TaikoL1BlockMetadataInput{ Beneficiary: p.l2SuggestedFeeRecipient, - GasLimit: p.protocolConfigs.BlockMaxGasLimit, TxListHash: crypto.Keccak256Hash(txListBytes), TxListByteStart: common.Big0, TxListByteEnd: new(big.Int).SetUint64(uint64(len(txListBytes))), @@ -446,7 +444,6 @@ func (p *Proposer) ProposeEmptyBlockOp(ctx context.Context) error { return p.ProposeTxList(ctx, &encoding.TaikoL1BlockMetadataInput{ TxListHash: crypto.Keccak256Hash([]byte{}), Beneficiary: p.L2SuggestedFeeRecipient(), - GasLimit: p.protocolConfigs.BlockMaxGasLimit, TxListByteStart: common.Big0, TxListByteEnd: common.Big0, CacheTxListInfo: 0, diff --git a/proposer/proposer_test.go b/proposer/proposer_test.go index 294e19a51..0b6010946 100644 --- a/proposer/proposer_test.go +++ b/proposer/proposer_test.go @@ -73,7 +73,7 @@ func (s *ProposerTestSuite) TestProposeOp() { parent, err := s.p.rpc.L2.BlockByNumber(context.Background(), nil) s.Nil(err) - baseFee, err := s.p.rpc.TaikoL2.GetBasefee(nil, 1, uint32(gaslimit), uint32(parent.GasUsed())) + baseFee, err := s.p.rpc.TaikoL2.GetBasefee(nil, 1, uint32(parent.GasUsed())) s.Nil(err) to := common.BytesToAddress(testutils.RandomBytes(32)) @@ -158,7 +158,6 @@ func (s *ProposerTestSuite) TestSendProposeBlockTx() { context.Background(), &encoding.TaikoL1BlockMetadataInput{ Beneficiary: s.p.L2SuggestedFeeRecipient(), - GasLimit: 21000, TxListHash: crypto.Keccak256Hash(encoded), TxListByteStart: common.Big0, TxListByteEnd: new(big.Int).SetUint64(uint64(len(encoded))), diff --git a/testutils/helper.go b/testutils/helper.go index dff77e48e..30008f6ba 100644 --- a/testutils/helper.go +++ b/testutils/helper.go @@ -19,14 +19,10 @@ import ( ) func ProposeInvalidTxListBytes(s *ClientTestSuite, proposer Proposer) { - configs, err := s.RpcClient.TaikoL1.GetConfig(nil) - s.Nil(err) - invalidTxListBytes := RandomBytes(256) s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{ Beneficiary: proposer.L2SuggestedFeeRecipient(), - GasLimit: uint32(rand.Int63n(int64(configs.BlockMaxGasLimit))), TxListHash: crypto.Keccak256Hash(invalidTxListBytes), TxListByteStart: common.Big0, TxListByteEnd: new(big.Int).SetUint64(uint64(len(invalidTxListBytes))), @@ -60,7 +56,6 @@ func ProposeAndInsertEmptyBlocks( s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{ Beneficiary: proposer.L2SuggestedFeeRecipient(), - GasLimit: 21000, TxListHash: crypto.Keccak256Hash(encoded), TxListByteStart: common.Big0, TxListByteEnd: new(big.Int).SetUint64(uint64(len(encoded))), @@ -117,7 +112,7 @@ func ProposeAndInsertValidBlock( close(sink) }() - baseFee, err := s.RpcClient.TaikoL2.GetBasefee(nil, 0, 60000000, uint32(l2Head.GasUsed)) + baseFee, err := s.RpcClient.TaikoL2.GetBasefee(nil, 0, uint32(l2Head.GasUsed)) s.Nil(err) nonce, err := s.RpcClient.L2.PendingNonceAt(context.Background(), s.TestAddr)