diff --git a/packages/taiko-client/bindings/.githead b/packages/taiko-client/bindings/.githead index 65f7ccb8387..cf0bf0044cb 100644 --- a/packages/taiko-client/bindings/.githead +++ b/packages/taiko-client/bindings/.githead @@ -1 +1 @@ -adc47f408282c25c7a50c26e31130fc495734dcc +db7b7a03af3797d37cce04cc2b05614c8dfeece4 diff --git a/packages/taiko-client/bindings/gen_prover_set.go b/packages/taiko-client/bindings/gen_prover_set.go index abfe03a6779..b00641ce1c3 100644 --- a/packages/taiko-client/bindings/gen_prover_set.go +++ b/packages/taiko-client/bindings/gen_prover_set.go @@ -31,7 +31,7 @@ var ( // ProverSetMetaData contains all meta data concerning the ProverSet contract. var ProverSetMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addressManager\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"admin\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approveAllowance\",\"inputs\":[{\"name\":\"_address\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_allowance\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delegate\",\"inputs\":[{\"name\":\"_delegatee\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"enableProver\",\"inputs\":[{\"name\":\"_prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_isProver\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"impl\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"inNonReentrant\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"init\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_rollupAddressManager\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isProver\",\"inputs\":[{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"isProver\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isValidSignature\",\"inputs\":[{\"name\":\"_hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"magicValue_\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"lastUnpausedAt\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeBlock\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proposeBlockV2\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proveBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlocks\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_input\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_batchProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"withdrawBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawEtherToAdmin\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawToAdmin\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProverEnabled\",\"inputs\":[{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ETH_TRANSFER_FAILED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FUNC_NOT_IMPLEMENTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PERMISSION_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"REENTRANT_CALL\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_INVALID_MANAGER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_UNEXPECTED_CHAINID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_ZERO_ADDR\",\"inputs\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ZERO_ADDRESS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZERO_VALUE\",\"inputs\":[]}]", + ABI: "[{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addressManager\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"admin\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approveAllowance\",\"inputs\":[{\"name\":\"_address\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_allowance\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delegate\",\"inputs\":[{\"name\":\"_delegatee\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"enableProver\",\"inputs\":[{\"name\":\"_prover\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_isProver\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"impl\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"inNonReentrant\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"init\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_rollupAddressManager\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isProver\",\"inputs\":[{\"name\":\"prover\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"isProver\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isValidSignature\",\"inputs\":[{\"name\":\"_hash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"magicValue_\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"lastUnpausedAt\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeBlock\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proposeBlockV2\",\"inputs\":[{\"name\":\"_params\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_txList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proposeBlocksV2\",\"inputs\":[{\"name\":\"_paramsArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_txListArr\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proveBlock\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proveBlocks\",\"inputs\":[{\"name\":\"_blockId\",\"type\":\"uint64[]\",\"internalType\":\"uint64[]\"},{\"name\":\"_input\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"_batchProof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_allowZeroAddress\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeTo\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"withdrawBond\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawEtherToAdmin\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawToAdmin\",\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminChanged\",\"inputs\":[{\"name\":\"previousAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"newAdmin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"BeaconUpgraded\",\"inputs\":[{\"name\":\"beacon\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProverEnabled\",\"inputs\":[{\"name\":\"prover\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"enabled\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ETH_TRANSFER_FAILED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FUNC_NOT_IMPLEMENTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"INVALID_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PERMISSION_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"REENTRANT_CALL\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_DENIED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_INVALID_MANAGER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_UNEXPECTED_CHAINID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RESOLVER_ZERO_ADDR\",\"inputs\":[{\"name\":\"chainId\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"name\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ZERO_ADDRESS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZERO_VALUE\",\"inputs\":[]}]", } // ProverSetABI is the input ABI used to generate the binding from. @@ -772,6 +772,27 @@ func (_ProverSet *ProverSetTransactorSession) ProposeBlockV2(_params []byte, _tx return _ProverSet.Contract.ProposeBlockV2(&_ProverSet.TransactOpts, _params, _txList) } +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) payable returns() +func (_ProverSet *ProverSetTransactor) ProposeBlocksV2(opts *bind.TransactOpts, _paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _ProverSet.contract.Transact(opts, "proposeBlocksV2", _paramsArr, _txListArr) +} + +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) payable returns() +func (_ProverSet *ProverSetSession) ProposeBlocksV2(_paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _ProverSet.Contract.ProposeBlocksV2(&_ProverSet.TransactOpts, _paramsArr, _txListArr) +} + +// ProposeBlocksV2 is a paid mutator transaction binding the contract method 0x0c8f4a10. +// +// Solidity: function proposeBlocksV2(bytes[] _paramsArr, bytes[] _txListArr) payable returns() +func (_ProverSet *ProverSetTransactorSession) ProposeBlocksV2(_paramsArr [][]byte, _txListArr [][]byte) (*types.Transaction, error) { + return _ProverSet.Contract.ProposeBlocksV2(&_ProverSet.TransactOpts, _paramsArr, _txListArr) +} + // ProveBlock is a paid mutator transaction binding the contract method 0x10d008bd. // // Solidity: function proveBlock(uint64 _blockId, bytes _input) returns() diff --git a/packages/taiko-client/bindings/metadata/metadata_legacy.go b/packages/taiko-client/bindings/metadata/metadata_legacy.go index 15408346892..10b1b0eef2e 100644 --- a/packages/taiko-client/bindings/metadata/metadata_legacy.go +++ b/packages/taiko-client/bindings/metadata/metadata_legacy.go @@ -22,7 +22,7 @@ type TaikoDataBlockMetadataLegacy struct { // NewTaikoDataBlockMetadataLegacy creates a new instance of TaikoDataBlockMetadataLegacy // from the TaikoL1.BlockProposed event. -func NewTaikoDataBlockMetadataLegacy(e *bindings.LibProposingBlockProposed) *TaikoDataBlockMetadataLegacy { +func NewTaikoDataBlockMetadataLegacy(e *bindings.TaikoL1ClientBlockProposed) *TaikoDataBlockMetadataLegacy { return &TaikoDataBlockMetadataLegacy{ TaikoDataBlockMetadata: e.Meta, Log: e.Raw, diff --git a/packages/taiko-client/bindings/metadata/metadata_ontake.go b/packages/taiko-client/bindings/metadata/metadata_ontake.go index 70f44a6b8c2..5ae06a9e11b 100644 --- a/packages/taiko-client/bindings/metadata/metadata_ontake.go +++ b/packages/taiko-client/bindings/metadata/metadata_ontake.go @@ -20,7 +20,7 @@ type TaikoDataBlockMetadataOntake struct { // NewTaikoDataBlockMetadataOntake creates a new instance of TaikoDataBlockMetadataOntake // from the TaikoL1.BlockProposedV2 event. -func NewTaikoDataBlockMetadataOntake(e *bindings.LibProposingBlockProposedV2) *TaikoDataBlockMetadataOntake { +func NewTaikoDataBlockMetadataOntake(e *bindings.TaikoL1ClientBlockProposedV2) *TaikoDataBlockMetadataOntake { return &TaikoDataBlockMetadataOntake{ TaikoDataBlockMetadataV2: e.Meta, Log: e.Raw, diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer.go b/packages/taiko-client/driver/chain_syncer/blob/syncer.go index a5287f39d30..47f2d997a15 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer.go @@ -134,7 +134,6 @@ func (s *Syncer) processL1Blocks(ctx context.Context) error { iter, err := eventIterator.NewBlockProposedIterator(ctx, &eventIterator.BlockProposedIteratorConfig{ Client: s.rpc.L1, TaikoL1: s.rpc.TaikoL1, - LibProposing: s.rpc.LibProposing, StartHeight: s.state.GetL1Current().Number, EndHeight: l1End.Number, FilterQuery: nil, diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go index 530e1943a7a..22b27b665a2 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go @@ -129,7 +129,7 @@ func (s *BlobSyncerTestSuite) TestTreasuryIncomeAllAnchors() { s.Nil(err) s.Greater(headAfter, headBefore) - s.Zero(balanceAfter.Cmp(balance)) + s.Equal(1, balanceAfter.Cmp(balance)) } func (s *BlobSyncerTestSuite) TestTreasuryIncome() { diff --git a/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go b/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go index 2d3f225a3d1..5327317f02e 100644 --- a/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go +++ b/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go @@ -17,6 +17,7 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer" ) @@ -50,11 +51,15 @@ func (s *ChainSyncerTestSuite) SetupTest() { prop := new(proposer.Proposer) l1ProposerPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) s.Nil(err) + jwtSecret, err := jwt.ParseSecretFromFile(os.Getenv("JWT_SECRET")) + s.Nil(err) s.Nil(prop.InitFromConfig(context.Background(), &proposer.Config{ ClientConfig: &rpc.ClientConfig{ L1Endpoint: os.Getenv("L1_WS"), L2Endpoint: os.Getenv("L2_WS"), + L2EngineEndpoint: os.Getenv("L2_AUTH"), + JwtSecret: string(jwtSecret), TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1")), TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN")), diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index 82dc9fded7e..cbae3bf9525 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -86,7 +86,7 @@ func (s *DriverTestSuite) TestProcessL1Blocks() { txCount, err := s.d.rpc.L2.TransactionCount(context.Background(), header.Hash()) s.Nil(err) - s.Equal(uint(1), txCount) + s.GreaterOrEqual(txCount, uint(1)) anchorTx, err := s.d.rpc.L2.TransactionInBlock(context.Background(), header.Hash(), 0) s.Nil(err) @@ -132,7 +132,7 @@ func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { // Because of evm_revert operation, the nonce of the proposer need to be adjusted. // Propose ten blocks on another fork for i := 0; i < 10; i++ { - s.ProposeInvalidTxListBytes(s.p) + s.ProposeAndInsertValidBlock(s.p, s.d.ChainSyncer().BlobSyncer()) } l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) @@ -140,8 +140,6 @@ func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() { s.Greater(l1Head4.Number.Uint64(), l1Head2.Number.Uint64()) - s.Nil(s.d.ChainSyncer().BlobSyncer().ProcessL1Blocks(context.Background())) - l2Head3, err := s.d.rpc.L2.HeaderByNumber(context.Background(), nil) s.Nil(err) @@ -190,7 +188,7 @@ func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() { s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) // Propose one blocks on another fork - s.ProposeInvalidTxListBytes(s.p) + s.ProposeValidBlock(s.p) l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) @@ -246,9 +244,9 @@ func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() { s.GreaterOrEqual(l1Head3.Number.Uint64(), l1Head1.Number.Uint64()) // Propose two blocks on another fork - s.ProposeInvalidTxListBytes(s.p) + s.ProposeValidBlock(s.p) time.Sleep(3 * time.Second) - s.ProposeInvalidTxListBytes(s.p) + s.ProposeValidBlock(s.p) l1Head4, err := s.d.rpc.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) diff --git a/packages/taiko-client/driver/state/state.go b/packages/taiko-client/driver/state/state.go index c9f30c36522..3f27585bcf4 100644 --- a/packages/taiko-client/driver/state/state.go +++ b/packages/taiko-client/driver/state/state.go @@ -64,11 +64,11 @@ func (s *State) init(ctx context.Context) error { return err } - log.Info("Genesis L1 height", "height", stateVars.A.GenesisHeight) s.GenesisL1Height = new(big.Int).SetUint64(stateVars.A.GenesisHeight) + log.Info("Genesis L1 height", "height", stateVars.A.GenesisHeight) s.OnTakeForkHeight = new(big.Int).SetUint64(encoding.GetProtocolConfig(s.rpc.L2.ChainID.Uint64()).OntakeForkHeight) - log.Info("OnTake fork height", "L2 height", s.OnTakeForkHeight) + log.Info("OnTake fork height", "height", s.OnTakeForkHeight) // Set the L2 head's latest known L1 origin as current L1 sync cursor. latestL2KnownL1Header, err := s.rpc.LatestL2KnownL1Header(ctx) @@ -107,10 +107,10 @@ func (s *State) eventLoop(ctx context.Context) { // Channels for subscriptions. l1HeadCh = make(chan *types.Header, 10) l2HeadCh = make(chan *types.Header, 10) - blockProposedCh = make(chan *bindings.LibProposingBlockProposed, 10) + blockProposedCh = make(chan *bindings.TaikoL1ClientBlockProposed, 10) transitionProvedCh = make(chan *bindings.TaikoL1ClientTransitionProved, 10) blockVerifiedCh = make(chan *bindings.TaikoL1ClientBlockVerified, 10) - blockProposedV2Ch = make(chan *bindings.LibProposingBlockProposedV2, 10) + blockProposedV2Ch = make(chan *bindings.TaikoL1ClientBlockProposedV2, 10) transitionProvedV2Ch = make(chan *bindings.TaikoL1ClientTransitionProvedV2, 10) blockVerifiedV2Ch = make(chan *bindings.TaikoL1ClientBlockVerifiedV2, 10) @@ -118,10 +118,10 @@ func (s *State) eventLoop(ctx context.Context) { l1HeadSub = rpc.SubscribeChainHead(s.rpc.L1, l1HeadCh) l2HeadSub = rpc.SubscribeChainHead(s.rpc.L2, l2HeadCh) l2BlockVerifiedSub = rpc.SubscribeBlockVerified(s.rpc.TaikoL1, blockVerifiedCh) - l2BlockProposedSub = rpc.SubscribeBlockProposed(s.rpc.LibProposing, blockProposedCh) + l2BlockProposedSub = rpc.SubscribeBlockProposed(s.rpc.TaikoL1, blockProposedCh) l2TransitionProvedSub = rpc.SubscribeTransitionProved(s.rpc.TaikoL1, transitionProvedCh) l2BlockVerifiedV2Sub = rpc.SubscribeBlockVerifiedV2(s.rpc.TaikoL1, blockVerifiedV2Ch) - l2BlockProposedV2Sub = rpc.SubscribeBlockProposedV2(s.rpc.LibProposing, blockProposedV2Ch) + l2BlockProposedV2Sub = rpc.SubscribeBlockProposedV2(s.rpc.TaikoL1, blockProposedV2Ch) l2TransitionProvedV2Sub = rpc.SubscribeTransitionProvedV2(s.rpc.TaikoL1, transitionProvedV2Ch) ) diff --git a/packages/taiko-client/internal/testutils/helper.go b/packages/taiko-client/internal/testutils/helper.go index f8a96b2a582..d93e3499f15 100644 --- a/packages/taiko-client/internal/testutils/helper.go +++ b/packages/taiko-client/internal/testutils/helper.go @@ -14,24 +14,16 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" "github.com/phayes/freeport" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/metadata" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" ) -func (s *ClientTestSuite) ProposeInvalidTxListBytes(proposer Proposer) { - invalidTxListBytes := RandomBytes(256) - - s.Nil(proposer.ProposeTxList(context.Background(), invalidTxListBytes, 1)) -} - func (s *ClientTestSuite) proposeEmptyBlockOp(ctx context.Context, proposer Proposer) { - emptyTxListBytes, err := rlp.EncodeToBytes(types.Transactions{}) - s.Nil(err) - s.Nil(proposer.ProposeTxList(ctx, emptyTxListBytes, 0)) + s.Nil(proposer.ProposeTxLists(ctx, []types.Transactions{{}})) } func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks( @@ -43,18 +35,16 @@ func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks( l1Head, err := s.RPCClient.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) - sink := make(chan *bindings.LibProposingBlockProposed) - - sub, err := s.RPCClient.LibProposing.WatchBlockProposed(nil, sink, nil, nil) + sink := make(chan *bindings.TaikoL1ClientBlockProposed) + sub, err := s.RPCClient.TaikoL1.WatchBlockProposed(nil, sink, nil, nil) s.Nil(err) defer func() { sub.Unsubscribe() close(sink) }() - sink2 := make(chan *bindings.LibProposingBlockProposedV2) - - sub2, err := s.RPCClient.LibProposing.WatchBlockProposedV2(nil, sink2, nil) + sink2 := make(chan *bindings.TaikoL1ClientBlockProposedV2) + sub2, err := s.RPCClient.TaikoL1.WatchBlockProposedV2(nil, sink2, nil) s.Nil(err) defer func() { sub2.Unsubscribe() @@ -62,16 +52,16 @@ func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks( }() // RLP encoded empty list - var emptyTxs []types.Transaction - encoded, err := rlp.EncodeToBytes(emptyTxs) - s.Nil(err) - - s.Nil(proposer.ProposeTxList(context.Background(), encoded, 0)) + s.Nil(proposer.ProposeTxLists(context.Background(), []types.Transactions{{}})) + s.Nil(blobSyncer.ProcessL1Blocks(context.Background())) - s.ProposeInvalidTxListBytes(proposer) + // Valid transactions lists. + s.ProposeValidBlock(proposer) + s.Nil(blobSyncer.ProcessL1Blocks(context.Background())) // Random bytes txList s.proposeEmptyBlockOp(context.Background(), proposer) + s.Nil(blobSyncer.ProcessL1Blocks(context.Background())) var txHash common.Hash for i := 0; i < 3; i++ { @@ -93,13 +83,6 @@ func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks( s.Nil(err) s.Greater(newL1Head.Number.Uint64(), l1Head.Number.Uint64()) - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - s.Nil(backoff.Retry(func() error { - return blobSyncer.ProcessL1Blocks(ctx) - }, backoff.NewExponentialBackOff())) - s.Nil(s.RPCClient.WaitTillL2ExecutionEngineSynced(context.Background())) return metadataList @@ -114,39 +97,31 @@ func (s *ClientTestSuite) ProposeAndInsertValidBlock( l1Head, err := s.RPCClient.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) - l2Head, err := s.RPCClient.L2.HeaderByNumber(context.Background(), nil) - s.Nil(err) - // Propose txs in L2 execution engine's mempool - sink := make(chan *bindings.LibProposingBlockProposed) - - sub, err := s.RPCClient.LibProposing.WatchBlockProposed(nil, sink, nil, nil) + sink := make(chan *bindings.TaikoL1ClientBlockProposed) + sub, err := s.RPCClient.TaikoL1.WatchBlockProposed(nil, sink, nil, nil) s.Nil(err) - defer func() { - sub.Unsubscribe() - close(sink) - }() - sink2 := make(chan *bindings.LibProposingBlockProposedV2) - sub2, err := s.RPCClient.LibProposing.WatchBlockProposedV2(nil, sink2, nil) + sink2 := make(chan *bindings.TaikoL1ClientBlockProposedV2) + sub2, err := s.RPCClient.TaikoL1.WatchBlockProposedV2(nil, sink2, nil) s.Nil(err) + defer func() { + sub.Unsubscribe() sub2.Unsubscribe() + close(sink) close(sink2) }() - baseFeeInfo, err := s.RPCClient.TaikoL2.GetBasefee(nil, l1Head.Number.Uint64()+1, uint32(l2Head.GasUsed)) - s.Nil(err) - nonce, err := s.RPCClient.L2.PendingNonceAt(context.Background(), s.TestAddr) s.Nil(err) tx := types.NewTransaction( nonce, common.BytesToAddress(RandomBytes(32)), - common.Big1, - 100000, - new(big.Int).SetUint64(uint64(10*params.GWei)+baseFeeInfo.Basefee.Uint64()), + common.Big0, + 100_000, + new(big.Int).SetUint64(uint64(10*params.GWei)), []byte{}, ) signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(s.RPCClient.L2.ChainID), s.TestAddrPrivKey) @@ -197,24 +172,44 @@ func (s *ClientTestSuite) ProposeAndInsertValidBlock( func (s *ClientTestSuite) ProposeValidBlock( proposer Proposer, -) *bindings.LibProposingBlockProposed { +) { l1Head, err := s.RPCClient.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) - l2Head, err := s.RPCClient.L2.HeaderByNumber(context.Background(), nil) + state, err := s.RPCClient.GetProtocolStateVariables(nil) + s.Nil(err) + + l2Head, err := s.RPCClient.L2.HeaderByNumber(context.Background(), new(big.Int).SetUint64(state.B.NumBlocks-1)) s.Nil(err) // Propose txs in L2 execution engine's mempool - sink := make(chan *bindings.LibProposingBlockProposed) + sink := make(chan *bindings.TaikoL1ClientBlockProposed) + sink2 := make(chan *bindings.TaikoL1ClientBlockProposedV2) + + sub, err := s.RPCClient.TaikoL1.WatchBlockProposed(nil, sink, nil, nil) + s.Nil(err) - sub, err := s.RPCClient.LibProposing.WatchBlockProposed(nil, sink, nil, nil) + sub2, err := s.RPCClient.TaikoL1.WatchBlockProposedV2(nil, sink2, nil) s.Nil(err) + defer func() { sub.Unsubscribe() + sub2.Unsubscribe() close(sink) + close(sink2) }() - baseFeeInfo, err := s.RPCClient.TaikoL2.GetBasefee(nil, l1Head.Number.Uint64()+1, uint32(l2Head.GasUsed)) + ontakeForkHeight, err := s.RPCClient.TaikoL2.OntakeForkHeight(nil) + s.Nil(err) + + baseFee, err := s.RPCClient.CalculateBaseFee( + context.Background(), + l2Head, + l1Head.Number, + l2Head.Number.Uint64()+1 >= ontakeForkHeight, + &encoding.InternlDevnetProtocolConfig.BaseFeeConfig, + l1Head.Time, + ) s.Nil(err) nonce, err := s.RPCClient.L2.PendingNonceAt(context.Background(), s.TestAddr) @@ -223,9 +218,9 @@ func (s *ClientTestSuite) ProposeValidBlock( tx := types.NewTransaction( nonce, common.BytesToAddress(RandomBytes(32)), - common.Big1, - 100000, - new(big.Int).SetUint64(uint64(10*params.GWei)+baseFeeInfo.Basefee.Uint64()), + common.Big0, + 100_000, + new(big.Int).SetUint64(uint64(10*params.GWei)+baseFee.Uint64()), []byte{}, ) signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(s.RPCClient.L2.ChainID), s.TestAddrPrivKey) @@ -234,21 +229,25 @@ func (s *ClientTestSuite) ProposeValidBlock( s.Nil(proposer.ProposeOp(context.Background())) - event := <-sink + var txHash common.Hash + select { + case event := <-sink: + txHash = event.Raw.TxHash + case event := <-sink2: + txHash = event.Raw.TxHash + } - _, isPending, err := s.RPCClient.L1.TransactionByHash(context.Background(), event.Raw.TxHash) + _, isPending, err := s.RPCClient.L1.TransactionByHash(context.Background(), txHash) s.Nil(err) s.False(isPending) - receipt, err := s.RPCClient.L1.TransactionReceipt(context.Background(), event.Raw.TxHash) + receipt, err := s.RPCClient.L1.TransactionReceipt(context.Background(), txHash) s.Nil(err) s.Equal(types.ReceiptStatusSuccessful, receipt.Status) newL1Head, err := s.RPCClient.L1.HeaderByNumber(context.Background(), nil) s.Nil(err) s.Greater(newL1Head.Number.Uint64(), l1Head.Number.Uint64()) - - return event } // RandomHash generates a random blob of data and returns it as a hash. diff --git a/packages/taiko-client/internal/testutils/interfaces.go b/packages/taiko-client/internal/testutils/interfaces.go index d8d1a401899..d35f125ade5 100644 --- a/packages/taiko-client/internal/testutils/interfaces.go +++ b/packages/taiko-client/internal/testutils/interfaces.go @@ -3,6 +3,8 @@ package testutils import ( "context" + "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/cmd/utils" ) @@ -13,9 +15,5 @@ type BlobSyncer interface { type Proposer interface { utils.SubcommandApplication ProposeOp(ctx context.Context) error - ProposeTxList( - ctx context.Context, - txListBytes []byte, - txNum uint, - ) error + ProposeTxLists(ctx context.Context, txLists []types.Transactions) error } diff --git a/packages/taiko-client/pkg/chain_iterator/event_iterator/block_proposed_iterator.go b/packages/taiko-client/pkg/chain_iterator/event_iterator/block_proposed_iterator.go index 75ca82b8209..67fc0fea23d 100644 --- a/packages/taiko-client/pkg/chain_iterator/event_iterator/block_proposed_iterator.go +++ b/packages/taiko-client/pkg/chain_iterator/event_iterator/block_proposed_iterator.go @@ -39,7 +39,6 @@ type BlockProposedIterator struct { type BlockProposedIteratorConfig struct { Client *rpc.EthClient TaikoL1 *bindings.TaikoL1Client - LibProposing *bindings.LibProposing MaxBlocksReadPerEpoch *uint64 StartHeight *big.Int EndHeight *big.Int @@ -69,7 +68,7 @@ func NewBlockProposedIterator(ctx context.Context, cfg *BlockProposedIteratorCon BlockConfirmations: cfg.BlockConfirmations, OnBlocks: assembleBlockProposedIteratorCallback( cfg.Client, - cfg.LibProposing, + cfg.TaikoL1, cfg.FilterQuery, cfg.OnBlockProposedEvent, iterator, @@ -99,7 +98,7 @@ func (i *BlockProposedIterator) end() { // by a event iterator's inner block iterator. func assembleBlockProposedIteratorCallback( client *rpc.EthClient, - libProposing *bindings.LibProposing, + taikoL1 *bindings.TaikoL1Client, filterQuery []*big.Int, callback OnBlockProposedEvent, eventIter *BlockProposedIterator, @@ -112,7 +111,7 @@ func assembleBlockProposedIteratorCallback( ) error { endHeight := end.Number.Uint64() - iter, err := libProposing.FilterBlockProposed( + iter, err := taikoL1.FilterBlockProposed( &bind.FilterOpts{Start: start.Number.Uint64(), End: &endHeight, Context: ctx}, filterQuery, nil, @@ -122,7 +121,7 @@ func assembleBlockProposedIteratorCallback( } defer iter.Close() - iterOntake, err := libProposing.FilterBlockProposedV2( + iterOntake, err := taikoL1.FilterBlockProposedV2( &bind.FilterOpts{Start: start.Number.Uint64(), End: &endHeight, Context: ctx}, filterQuery, ) diff --git a/packages/taiko-client/pkg/rpc/dial_test.go b/packages/taiko-client/pkg/rpc/dial_test.go index aeea111769e..f488d781230 100644 --- a/packages/taiko-client/pkg/rpc/dial_test.go +++ b/packages/taiko-client/pkg/rpc/dial_test.go @@ -15,7 +15,6 @@ import ( func TestDialEngineClientWithBackoff(t *testing.T) { jwtSecret, err := jwt.ParseSecretFromFile(os.Getenv("JWT_SECRET")) - require.Nil(t, err) require.NotEmpty(t, jwtSecret) diff --git a/packages/taiko-client/pkg/rpc/engine.go b/packages/taiko-client/pkg/rpc/engine.go index 8b0428ae8bb..ca30e6ae192 100644 --- a/packages/taiko-client/pkg/rpc/engine.go +++ b/packages/taiko-client/pkg/rpc/engine.go @@ -112,8 +112,8 @@ func (c *EngineClient) TxPoolContentWithMinTip( ) ([]*miner.PreBuiltTxList, error) { timeoutCtx, cancel := context.WithTimeout(ctx, defaultTimeout) defer cancel() - var result []*miner.PreBuiltTxList + if err := c.CallContext( timeoutCtx, &result, diff --git a/packages/taiko-client/pkg/rpc/methods.go b/packages/taiko-client/pkg/rpc/methods.go index b32af19169a..d89b1457a7c 100644 --- a/packages/taiko-client/pkg/rpc/methods.go +++ b/packages/taiko-client/pkg/rpc/methods.go @@ -383,7 +383,7 @@ func (c *Client) GetPoolContent( ctx, l2Head, l1Head.Number, - chainConfig.IsOntake(l2Head.Number), + chainConfig.IsOntake(new(big.Int).Add(l2Head.Number, common.Big1)), &chainConfig.ProtocolConfigs.BaseFeeConfig, uint64(time.Now().Unix()), ) diff --git a/packages/taiko-client/pkg/rpc/subscription.go b/packages/taiko-client/pkg/rpc/subscription.go index 8f148ed8b2c..b1e14b958d3 100644 --- a/packages/taiko-client/pkg/rpc/subscription.go +++ b/packages/taiko-client/pkg/rpc/subscription.go @@ -66,11 +66,11 @@ func SubscribeBlockVerifiedV2( // SubscribeBlockProposed subscribes the protocol's BlockProposed events. func SubscribeBlockProposed( - libProposing *bindings.LibProposing, - ch chan *bindings.LibProposingBlockProposed, + taikoL1 *bindings.TaikoL1Client, + ch chan *bindings.TaikoL1ClientBlockProposed, ) event.Subscription { return SubscribeEvent("BlockProposed", func(ctx context.Context) (event.Subscription, error) { - sub, err := libProposing.WatchBlockProposed(nil, ch, nil, nil) + sub, err := taikoL1.WatchBlockProposed(nil, ch, nil, nil) if err != nil { log.Error("Create TaikoL1.BlockProposed subscription error", "error", err) return nil, err @@ -84,11 +84,11 @@ func SubscribeBlockProposed( // SubscribeBlockProposedV2 subscribes the protocol's BlockProposedV2 events. func SubscribeBlockProposedV2( - libProposing *bindings.LibProposing, - ch chan *bindings.LibProposingBlockProposedV2, + taikoL1 *bindings.TaikoL1Client, + ch chan *bindings.TaikoL1ClientBlockProposedV2, ) event.Subscription { return SubscribeEvent("BlockProposedV2", func(ctx context.Context) (event.Subscription, error) { - sub, err := libProposing.WatchBlockProposedV2(nil, ch, nil) + sub, err := taikoL1.WatchBlockProposedV2(nil, ch, nil) if err != nil { log.Error("Create TaikoL1.BlockProposedV2 subscription error", "error", err) return nil, err diff --git a/packages/taiko-client/pkg/rpc/subscription_test.go b/packages/taiko-client/pkg/rpc/subscription_test.go index da79cc3b54a..2248a1d2357 100644 --- a/packages/taiko-client/pkg/rpc/subscription_test.go +++ b/packages/taiko-client/pkg/rpc/subscription_test.go @@ -26,8 +26,8 @@ func TestSubscribeBlockVerified(t *testing.T) { func TestSubscribeBlockProposed(t *testing.T) { require.NotNil(t, SubscribeBlockProposed( - newTestClient(t).LibProposing, - make(chan *bindings.LibProposingBlockProposed, 1024)), + newTestClient(t).TaikoL1, + make(chan *bindings.TaikoL1ClientBlockProposed, 1024)), ) } diff --git a/packages/taiko-client/proposer/config.go b/packages/taiko-client/proposer/config.go index d8444e080ea..7ad390c4863 100644 --- a/packages/taiko-client/proposer/config.go +++ b/packages/taiko-client/proposer/config.go @@ -74,6 +74,11 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { return nil, err } + maxProposedTxListsPerEpoch := c.Uint64(flags.MaxProposedTxListsPerEpoch.Name) + if maxProposedTxListsPerEpoch > 2 { + return nil, fmt.Errorf("max proposed tx lists per epoch should not exceed 2, got: %d", maxProposedTxListsPerEpoch) + } + return &Config{ ClientConfig: &rpc.ClientConfig{ L1Endpoint: c.String(flags.L1WSEndpoint.Name), @@ -96,7 +101,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { MinTxListBytes: c.Uint64(flags.MinTxListBytes.Name), MinTip: minTip.Uint64(), MinProposingInternal: c.Duration(flags.MinProposingInternal.Name), - MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name), + MaxProposedTxListsPerEpoch: maxProposedTxListsPerEpoch, AllowZeroInterval: c.Uint64(flags.AllowZeroInterval.Name), ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name), IncludeParentMetaHash: c.Bool(flags.ProposeBlockIncludeParentMetaHash.Name), diff --git a/packages/taiko-client/proposer/proposer.go b/packages/taiko-client/proposer/proposer.go index 480e127027d..065d8711faa 100644 --- a/packages/taiko-client/proposer/proposer.go +++ b/packages/taiko-client/proposer/proposer.go @@ -4,11 +4,13 @@ import ( "context" "errors" "fmt" + "math/big" "math/rand" "sync" "time" "github.com/ethereum-optimism/optimism/op-service/txmgr" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" @@ -291,46 +293,60 @@ func (p *Proposer) ProposeOp(ctx context.Context) error { return nil } - g, gCtx := errgroup.WithContext(ctx) - // Propose all L2 transactions lists. - for _, txs := range txLists[:utils.Min(p.MaxProposedTxListsPerEpoch, uint64(len(txLists)))] { - nonce, err := p.rpc.L1.PendingNonceAt(ctx, p.proposerAddress) - if err != nil { - log.Error("Failed to get proposer nonce", "error", err) - break - } + // Propose the transactions lists. + return p.ProposeTxLists(ctx, txLists) +} - log.Info("Proposer current pending nonce", "nonce", nonce) +// ProposeTxList proposes the given transactions lists to TaikoL1 smart contract. +func (p *Proposer) ProposeTxLists(ctx context.Context, txLists []types.Transactions) error { + // Check if the current L2 chain is after ontake fork. + state, err := rpc.GetProtocolStateVariables(p.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) + if err != nil { + return err + } - g.Go(func() error { - txListBytes, err := rlp.EncodeToBytes(txs) + // If the current L2 chain is before ontake fork, propose the transactions lists one by one. + if !p.chainConfig.IsOntake(new(big.Int).SetUint64(state.B.NumBlocks)) { + g, gCtx := errgroup.WithContext(ctx) + for _, txs := range txLists[:utils.Min(p.MaxProposedTxListsPerEpoch, uint64(len(txLists)))] { + nonce, err := p.rpc.L1.PendingNonceAt(ctx, p.proposerAddress) if err != nil { - return fmt.Errorf("failed to encode transactions: %w", err) - } - if err := p.ProposeTxList(gCtx, txListBytes, uint(txs.Len())); err != nil { - return err + log.Error("Failed to get proposer nonce", "error", err) + break } - p.lastProposedAt = time.Now() - return nil - }) - if err := p.rpc.WaitL1NewPendingTransaction(ctx, p.proposerAddress, nonce); err != nil { - log.Error("Failed to wait for new pending transaction", "error", err) + log.Info("Proposer current pending nonce", "nonce", nonce) + + g.Go(func() error { + if err := p.ProposeTxListLegacy(gCtx, txs); err != nil { + return err + } + p.lastProposedAt = time.Now() + return nil + }) + + if err := p.rpc.WaitL1NewPendingTransaction(ctx, p.proposerAddress, nonce); err != nil { + log.Error("Failed to wait for new pending transaction", "error", err) + } } - } - if err := g.Wait(); err != nil { - return err + + return g.Wait() } - return nil + // If the current L2 chain is after ontake fork, batch propose all L2 transactions lists. + return p.ProposeTxListOntake(ctx, txLists) } -// ProposeTxList proposes the given transactions list to TaikoL1 smart contract. -func (p *Proposer) ProposeTxList( +// ProposeTxListLegacy proposes the given transactions list to TaikoL1 smart contract. +func (p *Proposer) ProposeTxListLegacy( ctx context.Context, - txListBytes []byte, - txNum uint, + txList types.Transactions, ) error { + txListBytes, err := rlp.EncodeToBytes(txList) + if err != nil { + return fmt.Errorf("failed to encode transactions: %w", err) + } + compressedTxListBytes, err := utils.Compress(txListBytes) if err != nil { return err @@ -358,7 +374,7 @@ func (p *Proposer) ProposeTxList( return errors.New("insufficient prover balance") } - txCandidate, err := p.txBuilder.Build( + txCandidate, err := p.txBuilder.BuildLegacy( ctx, p.IncludeParentMetaHash, compressedTxListBytes, @@ -372,10 +388,76 @@ func (p *Proposer) ProposeTxList( return err } - log.Info("📝 Propose transactions succeeded", "txs", txNum) + log.Info("📝 Propose transactions succeeded", "txs", len(txList)) metrics.ProposerProposedTxListsCounter.Add(1) - metrics.ProposerProposedTxsCounter.Add(float64(txNum)) + metrics.ProposerProposedTxsCounter.Add(float64(len(txList))) + + return nil +} + +// ProposeTxListOntake proposes the given transactions lists to TaikoL1 smart contract. +func (p *Proposer) ProposeTxListOntake( + ctx context.Context, + txLists []types.Transactions, +) error { + var ( + proverAddress = p.proposerAddress + txListsBytesArray [][]byte + txNums []int + totalTxs int + ) + for _, txs := range txLists { + txListBytes, err := rlp.EncodeToBytes(txs) + if err != nil { + return fmt.Errorf("failed to encode transactions: %w", err) + } + + compressedTxListBytes, err := utils.Compress(txListBytes) + if err != nil { + return err + } + + txListsBytesArray = append(txListsBytesArray, compressedTxListBytes) + txNums = append(txNums, len(txs)) + totalTxs += len(txs) + } + + if p.Config.ClientConfig.ProverSetAddress != rpc.ZeroAddress { + proverAddress = p.Config.ClientConfig.ProverSetAddress + } + + ok, err := rpc.CheckProverBalance( + ctx, + p.rpc, + proverAddress, + p.TaikoL1Address, + new(big.Int).Mul(p.protocolConfigs.LivenessBond, new(big.Int).SetUint64(uint64(len(txLists)))), + ) + + if err != nil { + log.Warn("Failed to check prover balance", "error", err) + return err + } + + if !ok { + return errors.New("insufficient prover balance") + } + + txCandidate, err := p.txBuilder.BuildOntake(ctx, txListsBytesArray) + if err != nil { + log.Warn("Failed to build TaikoL1.proposeBlocksV2 transaction", "error", encoding.TryParsingCustomError(err)) + return err + } + + if err := p.sendTx(ctx, txCandidate); err != nil { + return err + } + + log.Info("📝 Batch propose transactions succeeded", "txs", txNums) + + metrics.ProposerProposedTxListsCounter.Add(float64(len(txLists))) + metrics.ProposerProposedTxsCounter.Add(float64(totalTxs)) return nil } @@ -404,7 +486,7 @@ func (p *Proposer) sendTx(ctx context.Context, txCandidate *txmgr.TxCandidate) e receipt, err := txMgr.Send(ctx, *txCandidate) if err != nil { log.Warn( - "Failed to send TaikoL1.proposeBlock / TaikoL1.proposeBlockV2 transaction by tx manager", + "Failed to send TaikoL1.proposeBlock / TaikoL1.proposeBlocksV2 transaction by tx manager", "isPrivateMempool", isPrivate, "error", encoding.TryParsingCustomError(err), ) diff --git a/packages/taiko-client/proposer/proposer_test.go b/packages/taiko-client/proposer/proposer_test.go index 5d3d5f1c62a..2e0cd796c03 100644 --- a/packages/taiko-client/proposer/proposer_test.go +++ b/packages/taiko-client/proposer/proposer_test.go @@ -145,7 +145,7 @@ func (s *ProposerTestSuite) TestProposeTxLists() { break } - candidate, err := txBuilder.Build( + candidate, err := txBuilder.BuildLegacy( p.ctx, p.IncludeParentMetaHash, compressedTxListBytes, @@ -232,18 +232,18 @@ func (s *ProposerTestSuite) TestName() { func (s *ProposerTestSuite) TestProposeOp() { // Propose txs in L2 execution engine's mempool - sink := make(chan *bindings.LibProposingBlockProposed) + sink := make(chan *bindings.TaikoL1ClientBlockProposed) - sub, err := s.p.rpc.LibProposing.WatchBlockProposed(nil, sink, nil, nil) + sub, err := s.p.rpc.TaikoL1.WatchBlockProposed(nil, sink, nil, nil) s.Nil(err) defer func() { sub.Unsubscribe() close(sink) }() - sink2 := make(chan *bindings.LibProposingBlockProposedV2) + sink2 := make(chan *bindings.TaikoL1ClientBlockProposedV2) - sub2, err := s.p.rpc.LibProposing.WatchBlockProposedV2(nil, sink2, nil) + sub2, err := s.p.rpc.TaikoL1.WatchBlockProposedV2(nil, sink2, nil) s.Nil(err) defer func() { sub2.Unsubscribe() diff --git a/packages/taiko-client/proposer/transaction_builder/blob.go b/packages/taiko-client/proposer/transaction_builder/blob.go index a76741c2a3d..b5270f3ac3c 100644 --- a/packages/taiko-client/proposer/transaction_builder/blob.go +++ b/packages/taiko-client/proposer/transaction_builder/blob.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "crypto/sha256" + "fmt" "math/big" "github.com/ethereum-optimism/optimism/op-service/eth" @@ -54,22 +55,47 @@ func NewBlobTransactionBuilder( } } -// Build implements the ProposeBlockTransactionBuilder interface. -func (b *BlobTransactionBuilder) Build( +// BuildLegacy implements the ProposeBlockTransactionBuilder interface. +func (b *BlobTransactionBuilder) BuildLegacy( ctx context.Context, includeParentMetaHash bool, txListBytes []byte, ) (*txmgr.TxCandidate, error) { + // Check if the current L2 chain is after ontake fork. + state, err := rpc.GetProtocolStateVariables(b.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) + if err != nil { + return nil, err + } + + if b.chainConfig.IsOntake(new(big.Int).SetUint64(state.B.NumBlocks)) { + return nil, fmt.Errorf("legacy transaction builder is not supported after ontake fork") + } + var blob = ð.Blob{} if err := blob.FromData(txListBytes); err != nil { return nil, err } - // If the current proposer wants to include the parent meta hash, then fetch it from the protocol. + commitment, err := blob.ComputeKZGCommitment() + if err != nil { + return nil, err + } + blobHash := kzg4844.CalcBlobHashV1(sha256.New(), &commitment) + + signature, err := crypto.Sign(blobHash[:], b.proposerPrivateKey) + if err != nil { + return nil, err + } + signature[64] = signature[64] + 27 + var ( parentMetaHash = [32]byte{} - err error + to = &b.taikoL1Address + data []byte + encodedParams []byte ) + + // If the current proposer wants to include the parent meta hash, then fetch it from the protocol. if includeParentMetaHash { if parentMetaHash, err = getParentMetaHash( ctx, @@ -80,28 +106,44 @@ func (b *BlobTransactionBuilder) Build( } } - commitment, err := blob.ComputeKZGCommitment() + // ABI encode the TaikoL1.proposeBlock / ProverSet.proposeBlock parameters. + encodedParams, err = encoding.EncodeBlockParams(&encoding.BlockParams{ + ExtraData: rpc.StringToBytes32(b.extraData), + Coinbase: b.l2SuggestedFeeRecipient, + ParentMetaHash: parentMetaHash, + Signature: signature, + }) if err != nil { return nil, err } - blobHash := kzg4844.CalcBlobHashV1(sha256.New(), &commitment) - signature, err := crypto.Sign(blobHash[:], b.proposerPrivateKey) - if err != nil { - return nil, err - } - signature[64] = signature[64] + 27 - - var ( - to = &b.taikoL1Address - data []byte - encodedParams []byte - method string - ) if b.proverSetAddress != rpc.ZeroAddress { to = &b.proverSetAddress + + data, err = encoding.ProverSetABI.Pack("proposeBlock", encodedParams, []byte{}) + if err != nil { + return nil, err + } + } else { + data, err = encoding.TaikoL1ABI.Pack("proposeBlock", encodedParams, []byte{}) + if err != nil { + return nil, err + } } + return &txmgr.TxCandidate{ + TxData: data, + Blobs: []*eth.Blob{blob}, + To: to, + GasLimit: b.gasLimit, + }, nil +} + +// BuildOntake implements the ProposeBlockTransactionBuilder interface. +func (b *BlobTransactionBuilder) BuildOntake( + ctx context.Context, + txListBytesArray [][]byte, +) (*txmgr.TxCandidate, error) { // Check if the current L2 chain is after ontake fork. state, err := rpc.GetProtocolStateVariables(b.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) if err != nil { @@ -109,44 +151,51 @@ func (b *BlobTransactionBuilder) Build( } if !b.chainConfig.IsOntake(new(big.Int).SetUint64(state.B.NumBlocks)) { - // ABI encode the TaikoL1.proposeBlock / ProverSet.proposeBlock parameters. - method = "proposeBlock" - - // ABI encode the TaikoL1.proposeBlock / ProverSet.proposeBlock parameters. - encodedParams, err = encoding.EncodeBlockParams(&encoding.BlockParams{ - ExtraData: rpc.StringToBytes32(b.extraData), - Coinbase: b.l2SuggestedFeeRecipient, - ParentMetaHash: parentMetaHash, - Signature: signature, - }) - if err != nil { + return nil, fmt.Errorf("ontake transaction builder is not supported before ontake fork") + } + + // ABI encode the TaikoL1.proposeBlocksV2 / ProverSet.proposeBlocksV2 parameters. + var ( + to = &b.taikoL1Address + data []byte + blobs []*eth.Blob + encodedParamsArray [][]byte + ) + if b.proverSetAddress != rpc.ZeroAddress { + to = &b.proverSetAddress + } + + for i := range txListBytesArray { + var blob = ð.Blob{} + if err := blob.FromData(txListBytesArray[i]); err != nil { return nil, err } - } else { - // ABI encode the TaikoL1.proposeBlockV2 / ProverSet.proposeBlockV2 parameters. - method = "proposeBlockV2" - if encodedParams, err = encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ + blobs = append(blobs, blob) + + encodedParams, err := encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ Coinbase: b.l2SuggestedFeeRecipient, - ParentMetaHash: parentMetaHash, + ParentMetaHash: [32]byte{}, AnchorBlockId: 0, Timestamp: 0, BlobTxListOffset: 0, - - BlobTxListLength: uint32(len(txListBytes)), - BlobIndex: 0, - }); err != nil { + BlobTxListLength: uint32(len(txListBytesArray[i])), + BlobIndex: uint8(i), + }) + if err != nil { return nil, err } + + encodedParamsArray = append(encodedParamsArray, encodedParams) } if b.proverSetAddress != rpc.ZeroAddress { - data, err = encoding.ProverSetABI.Pack(method, encodedParams, []byte{}) + data, err = encoding.ProverSetABI.Pack("proposeBlocksV2", encodedParamsArray, []byte{}) if err != nil { return nil, err } } else { - data, err = encoding.TaikoL1ABI.Pack(method, encodedParams, []byte{}) + data, err = encoding.TaikoL1ABI.Pack("proposeBlocksV2", encodedParamsArray, []byte{}) if err != nil { return nil, err } @@ -154,7 +203,7 @@ func (b *BlobTransactionBuilder) Build( return &txmgr.TxCandidate{ TxData: data, - Blobs: []*eth.Blob{blob}, + Blobs: blobs, To: to, GasLimit: b.gasLimit, }, nil diff --git a/packages/taiko-client/proposer/transaction_builder/calldata.go b/packages/taiko-client/proposer/transaction_builder/calldata.go index fa22fb675f2..1eb7322967c 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata.go @@ -3,6 +3,7 @@ package builder import ( "context" "crypto/ecdsa" + "fmt" "math/big" "github.com/ethereum-optimism/optimism/op-service/txmgr" @@ -51,8 +52,8 @@ func NewCalldataTransactionBuilder( } } -// Build implements the ProposeBlockTransactionBuilder interface. -func (b *CalldataTransactionBuilder) Build( +// BuildLegacy implements the ProposeBlockTransactionBuilder interface. +func (b *CalldataTransactionBuilder) BuildLegacy( ctx context.Context, includeParentMetaHash bool, txListBytes []byte, @@ -79,54 +80,90 @@ func (b *CalldataTransactionBuilder) Build( signature[64] = signature[64] + 27 var ( - to = &b.taikoL1Address - data []byte - encodedParams []byte - method string + to = &b.taikoL1Address + data []byte ) if b.proverSetAddress != rpc.ZeroAddress { to = &b.proverSetAddress } - // Check if the current L2 chain is after ontake fork. - state, err := rpc.GetProtocolStateVariables(b.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) + // ABI encode the TaikoL1.proposeBlock / ProverSet.proposeBlock parameters. + encodedParams, err := encoding.EncodeBlockParams(&encoding.BlockParams{ + Coinbase: b.l2SuggestedFeeRecipient, + ExtraData: rpc.StringToBytes32(b.extraData), + ParentMetaHash: parentMetaHash, + Signature: signature, + }) if err != nil { return nil, err } - if !b.chainConfig.IsOntake(new(big.Int).SetUint64(state.B.NumBlocks)) { - // ABI encode the TaikoL1.proposeBlock / ProverSet.proposeBlock parameters. - method = "proposeBlock" + if b.proverSetAddress != rpc.ZeroAddress { + to = &b.proverSetAddress - if encodedParams, err = encoding.EncodeBlockParams(&encoding.BlockParams{ - Coinbase: b.l2SuggestedFeeRecipient, - ExtraData: rpc.StringToBytes32(b.extraData), - ParentMetaHash: parentMetaHash, - Signature: signature, - }); err != nil { + data, err = encoding.ProverSetABI.Pack("proposeBlock", encodedParams, txListBytes) + if err != nil { return nil, err } } else { - // ABI encode the TaikoL1.proposeBlockV2 / ProverSet.proposeBlockV2 parameters. - method = "proposeBlockV2" + data, err = encoding.TaikoL1ABI.Pack("proposeBlock", encodedParams, txListBytes) + if err != nil { + return nil, err + } + } + + return &txmgr.TxCandidate{ + TxData: data, + Blobs: nil, + To: to, + GasLimit: b.gasLimit, + }, nil +} + +// BuildOntake implements the ProposeBlockTransactionBuilder interface. +func (b *CalldataTransactionBuilder) BuildOntake( + ctx context.Context, + txListBytesArray [][]byte, +) (*txmgr.TxCandidate, error) { + // Check if the current L2 chain is after ontake fork. + state, err := rpc.GetProtocolStateVariables(b.rpc.TaikoL1, &bind.CallOpts{Context: ctx}) + if err != nil { + return nil, err + } - if encodedParams, err = encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ + if !b.chainConfig.IsOntake(new(big.Int).SetUint64(state.B.NumBlocks)) { + return nil, fmt.Errorf("ontake transaction builder is not supported before ontake fork") + } + + // ABI encode the TaikoL1.proposeBlocksV2 / ProverSet.proposeBlocksV2 parameters. + var ( + to = &b.taikoL1Address + data []byte + encodedParamsArray [][]byte + ) + + for range txListBytesArray { + encodedParams, err := encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ Coinbase: b.l2SuggestedFeeRecipient, - ParentMetaHash: parentMetaHash, + ParentMetaHash: [32]byte{}, AnchorBlockId: 0, Timestamp: 0, - }); err != nil { + }) + if err != nil { return nil, err } + encodedParamsArray = append(encodedParamsArray, encodedParams) } if b.proverSetAddress != rpc.ZeroAddress { - data, err = encoding.ProverSetABI.Pack(method, encodedParams, txListBytes) + to = &b.proverSetAddress + + data, err = encoding.ProverSetABI.Pack("proposeBlocksV2", encodedParamsArray, txListBytesArray) if err != nil { return nil, err } } else { - data, err = encoding.TaikoL1ABI.Pack(method, encodedParams, txListBytes) + data, err = encoding.TaikoL1ABI.Pack("proposeBlocksV2", encodedParamsArray, txListBytesArray) if err != nil { return nil, err } diff --git a/packages/taiko-client/proposer/transaction_builder/calldata_test.go b/packages/taiko-client/proposer/transaction_builder/calldata_test.go index 8bc54e226d2..a268508ee88 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata_test.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata_test.go @@ -5,7 +5,10 @@ import ( ) func (s *TransactionBuilderTestSuite) TestBuildCalldata() { - tx, err := s.calldataTxBuilder.Build(context.Background(), false, []byte{1}) + tx, err := s.calldataTxBuilder.BuildLegacy(context.Background(), false, []byte{1}) s.Nil(err) s.Nil(tx.Blobs) + + _, err = s.calldataTxBuilder.BuildOntake(context.Background(), [][]byte{{1}, {2}}) + s.Error(err, "ontake transaction builder is not supported before ontake fork") } diff --git a/packages/taiko-client/proposer/transaction_builder/interface.go b/packages/taiko-client/proposer/transaction_builder/interface.go index a1cee51f4e3..125a9da092d 100644 --- a/packages/taiko-client/proposer/transaction_builder/interface.go +++ b/packages/taiko-client/proposer/transaction_builder/interface.go @@ -8,9 +8,13 @@ import ( // ProposeBlockTransactionBuilder is an interface for building a TaikoL1.proposeBlock transaction. type ProposeBlockTransactionBuilder interface { - Build( + BuildLegacy( ctx context.Context, includeParentMetaHash bool, txListBytes []byte, ) (*txmgr.TxCandidate, error) + BuildOntake( + ctx context.Context, + txListBytesArray [][]byte, + ) (*txmgr.TxCandidate, error) } diff --git a/packages/taiko-client/prover/event_handler/util.go b/packages/taiko-client/prover/event_handler/util.go index 1cf306ce525..92539d7e1c1 100644 --- a/packages/taiko-client/prover/event_handler/util.go +++ b/packages/taiko-client/prover/event_handler/util.go @@ -93,7 +93,6 @@ func getMetadataFromBlockID( iter, err := eventIterator.NewBlockProposedIterator(ctx, &eventIterator.BlockProposedIteratorConfig{ Client: rpc.L1, TaikoL1: rpc.TaikoL1, - LibProposing: rpc.LibProposing, StartHeight: new(big.Int).Sub(proposedIn, common.Big1), EndHeight: proposedIn, OnBlockProposedEvent: callback, diff --git a/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go b/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go index 84926335d96..7b96d2f226a 100644 --- a/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go +++ b/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go @@ -22,6 +22,7 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/chain_syncer/blob" "github.com/taikoxyz/taiko-mono/packages/taiko-client/driver/state" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" + "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/jwt" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer" producer "github.com/taikoxyz/taiko-mono/packages/taiko-client/prover/proof_producer" @@ -126,11 +127,16 @@ func (s *ProofSubmitterTestSuite) SetupTest() { prop := new(proposer.Proposer) l1ProposerPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) s.Nil(err) + jwtSecret, err := jwt.ParseSecretFromFile(os.Getenv("JWT_SECRET")) + s.Nil(err) + s.NotEmpty(jwtSecret) s.Nil(prop.InitFromConfig(context.Background(), &proposer.Config{ ClientConfig: &rpc.ClientConfig{ L1Endpoint: os.Getenv("L1_WS"), L2Endpoint: os.Getenv("L2_WS"), + L2EngineEndpoint: os.Getenv("L2_AUTH"), + JwtSecret: string(jwtSecret), TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1")), TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN")), diff --git a/packages/taiko-client/prover/prover.go b/packages/taiko-client/prover/prover.go index 3df6bd33a40..36d7985465a 100644 --- a/packages/taiko-client/prover/prover.go +++ b/packages/taiko-client/prover/prover.go @@ -281,20 +281,20 @@ func (p *Prover) eventLoop() { // Channels chBufferSize := p.protocolConfig.BlockMaxProposals - blockProposedCh := make(chan *bindings.LibProposingBlockProposed, chBufferSize) + blockProposedCh := make(chan *bindings.TaikoL1ClientBlockProposed, chBufferSize) blockVerifiedCh := make(chan *bindings.TaikoL1ClientBlockVerified, chBufferSize) transitionProvedCh := make(chan *bindings.TaikoL1ClientTransitionProved, chBufferSize) transitionContestedCh := make(chan *bindings.TaikoL1ClientTransitionContested, chBufferSize) - blockProposedV2Ch := make(chan *bindings.LibProposingBlockProposedV2, chBufferSize) + blockProposedV2Ch := make(chan *bindings.TaikoL1ClientBlockProposedV2, chBufferSize) blockVerifiedV2Ch := make(chan *bindings.TaikoL1ClientBlockVerifiedV2, chBufferSize) transitionProvedV2Ch := make(chan *bindings.TaikoL1ClientTransitionProvedV2, chBufferSize) transitionContestedV2Ch := make(chan *bindings.TaikoL1ClientTransitionContestedV2, chBufferSize) // Subscriptions - blockProposedSub := rpc.SubscribeBlockProposed(p.rpc.LibProposing, blockProposedCh) + blockProposedSub := rpc.SubscribeBlockProposed(p.rpc.TaikoL1, blockProposedCh) blockVerifiedSub := rpc.SubscribeBlockVerified(p.rpc.TaikoL1, blockVerifiedCh) transitionProvedSub := rpc.SubscribeTransitionProved(p.rpc.TaikoL1, transitionProvedCh) transitionContestedSub := rpc.SubscribeTransitionContested(p.rpc.TaikoL1, transitionContestedCh) - blockProposedV2Sub := rpc.SubscribeBlockProposedV2(p.rpc.LibProposing, blockProposedV2Ch) + blockProposedV2Sub := rpc.SubscribeBlockProposedV2(p.rpc.TaikoL1, blockProposedV2Ch) blockVerifiedV2Sub := rpc.SubscribeBlockVerifiedV2(p.rpc.TaikoL1, blockVerifiedV2Ch) transitionProvedV2Sub := rpc.SubscribeTransitionProvedV2(p.rpc.TaikoL1, transitionProvedV2Ch) transitionContestedV2Sub := rpc.SubscribeTransitionContestedV2(p.rpc.TaikoL1, transitionContestedV2Ch) @@ -376,7 +376,6 @@ func (p *Prover) proveOp() error { iter, err := eventIterator.NewBlockProposedIterator(p.ctx, &eventIterator.BlockProposedIteratorConfig{ Client: p.rpc.L1, TaikoL1: p.rpc.TaikoL1, - LibProposing: p.rpc.LibProposing, StartHeight: new(big.Int).SetUint64(p.sharedState.GetL1Current().Number.Uint64()), OnBlockProposedEvent: p.blockProposedHandler.Handle, BlockConfirmations: &p.cfg.BlockConfirmations,