diff --git a/packages/relayer/.golangci.yml b/packages/relayer/.golangci.yml index 57711e7574..aab7bf8558 100644 --- a/packages/relayer/.golangci.yml +++ b/packages/relayer/.golangci.yml @@ -28,8 +28,8 @@ linters: linters-settings: funlen: - lines: 116 - statements: 48 + lines: 117 + statements: 50 gocognit: min-complexity: 37 diff --git a/packages/relayer/TaikoL1.json b/packages/relayer/TaikoL1.json new file mode 100644 index 0000000000..d2f0a18e6f --- /dev/null +++ b/packages/relayer/TaikoL1.json @@ -0,0 +1,788 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "commitSlot", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "commitHeight", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "commitHash", + "type": "bytes32" + } + ], + "name": "BlockCommitted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "l1Height", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "l1Hash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "txListHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "mixHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "extraData", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "gasLimit", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "commitHeight", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "commitSlot", + "type": "uint64" + } + ], + "indexed": false, + "internalType": "struct LibData.BlockMetadata", + "name": "meta", + "type": "tuple" + } + ], + "name": "BlockProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "parentHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "provenAt", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "address", + "name": "prover", + "type": "address" + } + ], + "name": "BlockProven", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + } + ], + "name": "BlockVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "halted", + "type": "bool" + } + ], + "name": "Halted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "height", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "srcHeight", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "srcHash", + "type": "bytes32" + } + ], + "name": "HeaderSynced", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "prover", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "whitelisted", + "type": "bool" + } + ], + "name": "ProverWhitelisted", + "type": "event" + }, + { + "inputs": [], + "name": "addressManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "commitSlot", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "commitHash", + "type": "bytes32" + } + ], + "name": "commitBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "parentHash", + "type": "bytes32" + } + ], + "name": "getBlockProvers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getConstants", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getLatestSyncedHeader", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "getProposedBlock", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "metaHash", + "type": "bytes32" + } + ], + "internalType": "struct LibData.ProposedBlock", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStateVariables", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + } + ], + "name": "getSyncedHeader", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "toHalt", + "type": "bool" + } + ], + "name": "halt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addressManager", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_genesisBlockHash", + "type": "bytes32" + } + ], + "name": "init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "commitSlot", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "commitHeight", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "commitHash", + "type": "bytes32" + } + ], + "name": "isCommitValid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isHalted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "prover", + "type": "address" + } + ], + "name": "isProverWhitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "inputs", + "type": "bytes[]" + } + ], + "name": "proposeBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockIndex", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "inputs", + "type": "bytes[]" + } + ], + "name": "proveBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "blockIndex", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "inputs", + "type": "bytes[]" + } + ], + "name": "proveBlockInvalid", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "resolve", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "k", + "type": "uint8" + } + ], + "name": "signWithGoldenTouch", + "outputs": [ + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "r", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "s", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "uint64", + "name": "statusBits", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "genesisHeight", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "latestVerifiedHeight", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "latestVerifiedId", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "nextBlockId", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "maxBlocks", + "type": "uint256" + } + ], + "name": "verifyBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "prover", + "type": "address" + }, + { + "internalType": "bool", + "name": "whitelisted", + "type": "bool" + } + ], + "name": "whitelistProver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/packages/relayer/abigen.sh b/packages/relayer/abigen.sh index 68e0d76b88..6b6cdd41bb 100755 --- a/packages/relayer/abigen.sh +++ b/packages/relayer/abigen.sh @@ -5,9 +5,9 @@ if [ ! -d "../protocol/artifacts" ]; then exit 1 fi -paths=("bridge/Bridge.sol" "common/IHeaderSync.sol" "L2/V1TaikoL2.sol") +paths=("bridge/Bridge.sol" "common/IHeaderSync.sol" "L2/V1TaikoL2.sol" "L1/TaikoL1.sol") -names=("Bridge" "IHeaderSync" "V1TaikoL2") +names=("Bridge" "IHeaderSync" "V1TaikoL2" "TaikoL1") for (( i = 0; i < ${#paths[@]}; ++i )); do diff --git a/packages/relayer/cli/cli.go b/packages/relayer/cli/cli.go index 8720166736..6850852438 100644 --- a/packages/relayer/cli/cli.go +++ b/packages/relayer/cli/cli.go @@ -186,6 +186,7 @@ func makeIndexers(layer relayer.Layer, db relayer.DB) ([]*indexer.Service, func( BridgeAddress: common.HexToAddress(os.Getenv("L1_BRIDGE_ADDRESS")), DestBridgeAddress: common.HexToAddress(os.Getenv("L2_BRIDGE_ADDRESS")), DestTaikoAddress: common.HexToAddress(os.Getenv("L2_TAIKO_ADDRESS")), + SrcTaikoAddress: common.HexToAddress(os.Getenv("L1_TAIKO_ADDRESS")), BlockBatchSize: uint64(blockBatchSize), NumGoroutines: numGoroutines, diff --git a/packages/relayer/contracts/TaikoL1.go b/packages/relayer/contracts/TaikoL1.go new file mode 100644 index 0000000000..1600a5e8f8 --- /dev/null +++ b/packages/relayer/contracts/TaikoL1.go @@ -0,0 +1,2226 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contracts + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "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/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// LibDataBlockMetadata is an auto generated low-level Go binding around an user-defined struct. +type LibDataBlockMetadata struct { + Id *big.Int + L1Height *big.Int + L1Hash [32]byte + Beneficiary common.Address + TxListHash [32]byte + MixHash [32]byte + ExtraData []byte + GasLimit uint64 + Timestamp uint64 + CommitHeight uint64 + CommitSlot uint64 +} + +// LibDataProposedBlock is an auto generated low-level Go binding around an user-defined struct. +type LibDataProposedBlock struct { + MetaHash [32]byte +} + +// TaikoL1ABI is the input ABI used to generate the binding from. +const TaikoL1ABI = "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"BlockCommitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"l1Height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"beneficiary\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"mixHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"gasLimit\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structLibData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"provenAt\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"}],\"name\":\"BlockProven\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"halted\",\"type\":\"bool\"}],\"name\":\"Halted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"srcHash\",\"type\":\"bytes32\"}],\"name\":\"HeaderSynced\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"ProverWhitelisted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"commitSlot\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"commitBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"getBlockProvers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConstants\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"getProposedBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"metaHash\",\"type\":\"bytes32\"}],\"internalType\":\"structLibData.ProposedBlock\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStateVariables\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"toHalt\",\"type\":\"bool\"}],\"name\":\"halt\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"commitSlot\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commitHeight\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"commitHash\",\"type\":\"bytes32\"}],\"name\":\"isCommitValid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isHalted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"}],\"name\":\"isProverWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proposeBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes[]\",\"name\":\"inputs\",\"type\":\"bytes[]\"}],\"name\":\"proveBlockInvalid\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signWithGoldenTouch\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"statusBits\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"latestVerifiedId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextBlockId\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"maxBlocks\",\"type\":\"uint256\"}],\"name\":\"verifyBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"whitelisted\",\"type\":\"bool\"}],\"name\":\"whitelistProver\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +// TaikoL1 is an auto generated Go binding around an Ethereum contract. +type TaikoL1 struct { + TaikoL1Caller // Read-only binding to the contract + TaikoL1Transactor // Write-only binding to the contract + TaikoL1Filterer // Log filterer for contract events +} + +// TaikoL1Caller is an auto generated read-only Go binding around an Ethereum contract. +type TaikoL1Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1Transactor is an auto generated write-only Go binding around an Ethereum contract. +type TaikoL1Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type TaikoL1Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// TaikoL1Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type TaikoL1Session struct { + Contract *TaikoL1 // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TaikoL1CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type TaikoL1CallerSession struct { + Contract *TaikoL1Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// TaikoL1TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type TaikoL1TransactorSession struct { + Contract *TaikoL1Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// TaikoL1Raw is an auto generated low-level Go binding around an Ethereum contract. +type TaikoL1Raw struct { + Contract *TaikoL1 // Generic contract binding to access the raw methods on +} + +// TaikoL1CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type TaikoL1CallerRaw struct { + Contract *TaikoL1Caller // Generic read-only contract binding to access the raw methods on +} + +// TaikoL1TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type TaikoL1TransactorRaw struct { + Contract *TaikoL1Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewTaikoL1 creates a new instance of TaikoL1, bound to a specific deployed contract. +func NewTaikoL1(address common.Address, backend bind.ContractBackend) (*TaikoL1, error) { + contract, err := bindTaikoL1(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &TaikoL1{TaikoL1Caller: TaikoL1Caller{contract: contract}, TaikoL1Transactor: TaikoL1Transactor{contract: contract}, TaikoL1Filterer: TaikoL1Filterer{contract: contract}}, nil +} + +// NewTaikoL1Caller creates a new read-only instance of TaikoL1, bound to a specific deployed contract. +func NewTaikoL1Caller(address common.Address, caller bind.ContractCaller) (*TaikoL1Caller, error) { + contract, err := bindTaikoL1(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &TaikoL1Caller{contract: contract}, nil +} + +// NewTaikoL1Transactor creates a new write-only instance of TaikoL1, bound to a specific deployed contract. +func NewTaikoL1Transactor(address common.Address, transactor bind.ContractTransactor) (*TaikoL1Transactor, error) { + contract, err := bindTaikoL1(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &TaikoL1Transactor{contract: contract}, nil +} + +// NewTaikoL1Filterer creates a new log filterer instance of TaikoL1, bound to a specific deployed contract. +func NewTaikoL1Filterer(address common.Address, filterer bind.ContractFilterer) (*TaikoL1Filterer, error) { + contract, err := bindTaikoL1(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &TaikoL1Filterer{contract: contract}, nil +} + +// bindTaikoL1 binds a generic wrapper to an already deployed contract. +func bindTaikoL1(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(TaikoL1ABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TaikoL1 *TaikoL1Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TaikoL1.Contract.TaikoL1Caller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TaikoL1 *TaikoL1Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1.Contract.TaikoL1Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TaikoL1 *TaikoL1Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TaikoL1.Contract.TaikoL1Transactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_TaikoL1 *TaikoL1CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _TaikoL1.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_TaikoL1 *TaikoL1TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_TaikoL1 *TaikoL1TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _TaikoL1.Contract.contract.Transact(opts, method, params...) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1 *TaikoL1Caller) AddressManager(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "addressManager") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1 *TaikoL1Session) AddressManager() (common.Address, error) { + return _TaikoL1.Contract.AddressManager(&_TaikoL1.CallOpts) +} + +// AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. +// +// Solidity: function addressManager() view returns(address) +func (_TaikoL1 *TaikoL1CallerSession) AddressManager() (common.Address, error) { + return _TaikoL1.Contract.AddressManager(&_TaikoL1.CallOpts) +} + +// GetBlockProvers is a free data retrieval call binding the contract method 0xea04adba. +// +// Solidity: function getBlockProvers(uint256 id, bytes32 parentHash) view returns(address[]) +func (_TaikoL1 *TaikoL1Caller) GetBlockProvers(opts *bind.CallOpts, id *big.Int, parentHash [32]byte) ([]common.Address, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getBlockProvers", id, parentHash) + + if err != nil { + return *new([]common.Address), err + } + + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) + + return out0, err + +} + +// GetBlockProvers is a free data retrieval call binding the contract method 0xea04adba. +// +// Solidity: function getBlockProvers(uint256 id, bytes32 parentHash) view returns(address[]) +func (_TaikoL1 *TaikoL1Session) GetBlockProvers(id *big.Int, parentHash [32]byte) ([]common.Address, error) { + return _TaikoL1.Contract.GetBlockProvers(&_TaikoL1.CallOpts, id, parentHash) +} + +// GetBlockProvers is a free data retrieval call binding the contract method 0xea04adba. +// +// Solidity: function getBlockProvers(uint256 id, bytes32 parentHash) view returns(address[]) +func (_TaikoL1 *TaikoL1CallerSession) GetBlockProvers(id *big.Int, parentHash [32]byte) ([]common.Address, error) { + return _TaikoL1.Contract.GetBlockProvers(&_TaikoL1.CallOpts, id, parentHash) +} + +// GetConstants is a free data retrieval call binding the contract method 0x9a295e73. +// +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_TaikoL1 *TaikoL1Caller) GetConstants(opts *bind.CallOpts) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getConstants") + + if err != nil { + return *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([32]byte), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([4]byte), *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + out3 := *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + out4 := *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) + out5 := *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) + out6 := *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) + out7 := *abi.ConvertType(out[7], new(*big.Int)).(**big.Int) + out8 := *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) + out9 := *abi.ConvertType(out[9], new(*big.Int)).(**big.Int) + out10 := *abi.ConvertType(out[10], new(*big.Int)).(**big.Int) + out11 := *abi.ConvertType(out[11], new(*big.Int)).(**big.Int) + out12 := *abi.ConvertType(out[12], new([4]byte)).(*[4]byte) + out13 := *abi.ConvertType(out[13], new([32]byte)).(*[32]byte) + + return out0, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12, out13, err + +} + +// GetConstants is a free data retrieval call binding the contract method 0x9a295e73. +// +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_TaikoL1 *TaikoL1Session) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { + return _TaikoL1.Contract.GetConstants(&_TaikoL1.CallOpts) +} + +// GetConstants is a free data retrieval call binding the contract method 0x9a295e73. +// +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_TaikoL1 *TaikoL1CallerSession) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { + return _TaikoL1.Contract.GetConstants(&_TaikoL1.CallOpts) +} + +// GetLatestSyncedHeader is a free data retrieval call binding the contract method 0x5155ce9f. +// +// Solidity: function getLatestSyncedHeader() view returns(bytes32) +func (_TaikoL1 *TaikoL1Caller) GetLatestSyncedHeader(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getLatestSyncedHeader") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetLatestSyncedHeader is a free data retrieval call binding the contract method 0x5155ce9f. +// +// Solidity: function getLatestSyncedHeader() view returns(bytes32) +func (_TaikoL1 *TaikoL1Session) GetLatestSyncedHeader() ([32]byte, error) { + return _TaikoL1.Contract.GetLatestSyncedHeader(&_TaikoL1.CallOpts) +} + +// GetLatestSyncedHeader is a free data retrieval call binding the contract method 0x5155ce9f. +// +// Solidity: function getLatestSyncedHeader() view returns(bytes32) +func (_TaikoL1 *TaikoL1CallerSession) GetLatestSyncedHeader() ([32]byte, error) { + return _TaikoL1.Contract.GetLatestSyncedHeader(&_TaikoL1.CallOpts) +} + +// GetProposedBlock is a free data retrieval call binding the contract method 0x8972b10c. +// +// Solidity: function getProposedBlock(uint256 id) view returns((bytes32)) +func (_TaikoL1 *TaikoL1Caller) GetProposedBlock(opts *bind.CallOpts, id *big.Int) (LibDataProposedBlock, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getProposedBlock", id) + + if err != nil { + return *new(LibDataProposedBlock), err + } + + out0 := *abi.ConvertType(out[0], new(LibDataProposedBlock)).(*LibDataProposedBlock) + + return out0, err + +} + +// GetProposedBlock is a free data retrieval call binding the contract method 0x8972b10c. +// +// Solidity: function getProposedBlock(uint256 id) view returns((bytes32)) +func (_TaikoL1 *TaikoL1Session) GetProposedBlock(id *big.Int) (LibDataProposedBlock, error) { + return _TaikoL1.Contract.GetProposedBlock(&_TaikoL1.CallOpts, id) +} + +// GetProposedBlock is a free data retrieval call binding the contract method 0x8972b10c. +// +// Solidity: function getProposedBlock(uint256 id) view returns((bytes32)) +func (_TaikoL1 *TaikoL1CallerSession) GetProposedBlock(id *big.Int) (LibDataProposedBlock, error) { + return _TaikoL1.Contract.GetProposedBlock(&_TaikoL1.CallOpts, id) +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns(uint64, uint64, uint64, uint64) +func (_TaikoL1 *TaikoL1Caller) GetStateVariables(opts *bind.CallOpts) (uint64, uint64, uint64, uint64, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getStateVariables") + + if err != nil { + return *new(uint64), *new(uint64), *new(uint64), *new(uint64), err + } + + out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + out1 := *abi.ConvertType(out[1], new(uint64)).(*uint64) + out2 := *abi.ConvertType(out[2], new(uint64)).(*uint64) + out3 := *abi.ConvertType(out[3], new(uint64)).(*uint64) + + return out0, out1, out2, out3, err + +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns(uint64, uint64, uint64, uint64) +func (_TaikoL1 *TaikoL1Session) GetStateVariables() (uint64, uint64, uint64, uint64, error) { + return _TaikoL1.Contract.GetStateVariables(&_TaikoL1.CallOpts) +} + +// GetStateVariables is a free data retrieval call binding the contract method 0xdde89cf5. +// +// Solidity: function getStateVariables() view returns(uint64, uint64, uint64, uint64) +func (_TaikoL1 *TaikoL1CallerSession) GetStateVariables() (uint64, uint64, uint64, uint64, error) { + return _TaikoL1.Contract.GetStateVariables(&_TaikoL1.CallOpts) +} + +// GetSyncedHeader is a free data retrieval call binding the contract method 0x25bf86f2. +// +// Solidity: function getSyncedHeader(uint256 number) view returns(bytes32) +func (_TaikoL1 *TaikoL1Caller) GetSyncedHeader(opts *bind.CallOpts, number *big.Int) ([32]byte, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getSyncedHeader", number) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetSyncedHeader is a free data retrieval call binding the contract method 0x25bf86f2. +// +// Solidity: function getSyncedHeader(uint256 number) view returns(bytes32) +func (_TaikoL1 *TaikoL1Session) GetSyncedHeader(number *big.Int) ([32]byte, error) { + return _TaikoL1.Contract.GetSyncedHeader(&_TaikoL1.CallOpts, number) +} + +// GetSyncedHeader is a free data retrieval call binding the contract method 0x25bf86f2. +// +// Solidity: function getSyncedHeader(uint256 number) view returns(bytes32) +func (_TaikoL1 *TaikoL1CallerSession) GetSyncedHeader(number *big.Int) ([32]byte, error) { + return _TaikoL1.Contract.GetSyncedHeader(&_TaikoL1.CallOpts, number) +} + +// IsCommitValid is a free data retrieval call binding the contract method 0x340d9599. +// +// Solidity: function isCommitValid(uint256 commitSlot, uint256 commitHeight, bytes32 commitHash) view returns(bool) +func (_TaikoL1 *TaikoL1Caller) IsCommitValid(opts *bind.CallOpts, commitSlot *big.Int, commitHeight *big.Int, commitHash [32]byte) (bool, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "isCommitValid", commitSlot, commitHeight, commitHash) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsCommitValid is a free data retrieval call binding the contract method 0x340d9599. +// +// Solidity: function isCommitValid(uint256 commitSlot, uint256 commitHeight, bytes32 commitHash) view returns(bool) +func (_TaikoL1 *TaikoL1Session) IsCommitValid(commitSlot *big.Int, commitHeight *big.Int, commitHash [32]byte) (bool, error) { + return _TaikoL1.Contract.IsCommitValid(&_TaikoL1.CallOpts, commitSlot, commitHeight, commitHash) +} + +// IsCommitValid is a free data retrieval call binding the contract method 0x340d9599. +// +// Solidity: function isCommitValid(uint256 commitSlot, uint256 commitHeight, bytes32 commitHash) view returns(bool) +func (_TaikoL1 *TaikoL1CallerSession) IsCommitValid(commitSlot *big.Int, commitHeight *big.Int, commitHash [32]byte) (bool, error) { + return _TaikoL1.Contract.IsCommitValid(&_TaikoL1.CallOpts, commitSlot, commitHeight, commitHash) +} + +// IsHalted is a free data retrieval call binding the contract method 0xc7ff1584. +// +// Solidity: function isHalted() view returns(bool) +func (_TaikoL1 *TaikoL1Caller) IsHalted(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "isHalted") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsHalted is a free data retrieval call binding the contract method 0xc7ff1584. +// +// Solidity: function isHalted() view returns(bool) +func (_TaikoL1 *TaikoL1Session) IsHalted() (bool, error) { + return _TaikoL1.Contract.IsHalted(&_TaikoL1.CallOpts) +} + +// IsHalted is a free data retrieval call binding the contract method 0xc7ff1584. +// +// Solidity: function isHalted() view returns(bool) +func (_TaikoL1 *TaikoL1CallerSession) IsHalted() (bool, error) { + return _TaikoL1.Contract.IsHalted(&_TaikoL1.CallOpts) +} + +// IsProverWhitelisted is a free data retrieval call binding the contract method 0x664d0896. +// +// Solidity: function isProverWhitelisted(address prover) view returns(bool) +func (_TaikoL1 *TaikoL1Caller) IsProverWhitelisted(opts *bind.CallOpts, prover common.Address) (bool, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "isProverWhitelisted", prover) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsProverWhitelisted is a free data retrieval call binding the contract method 0x664d0896. +// +// Solidity: function isProverWhitelisted(address prover) view returns(bool) +func (_TaikoL1 *TaikoL1Session) IsProverWhitelisted(prover common.Address) (bool, error) { + return _TaikoL1.Contract.IsProverWhitelisted(&_TaikoL1.CallOpts, prover) +} + +// IsProverWhitelisted is a free data retrieval call binding the contract method 0x664d0896. +// +// Solidity: function isProverWhitelisted(address prover) view returns(bool) +func (_TaikoL1 *TaikoL1CallerSession) IsProverWhitelisted(prover common.Address) (bool, error) { + return _TaikoL1.Contract.IsProverWhitelisted(&_TaikoL1.CallOpts, prover) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1 *TaikoL1Caller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1 *TaikoL1Session) Owner() (common.Address, error) { + return _TaikoL1.Contract.Owner(&_TaikoL1.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_TaikoL1 *TaikoL1CallerSession) Owner() (common.Address, error) { + return _TaikoL1.Contract.Owner(&_TaikoL1.CallOpts) +} + +// Resolve is a free data retrieval call binding the contract method 0x461a4478. +// +// Solidity: function resolve(string name) view returns(address) +func (_TaikoL1 *TaikoL1Caller) Resolve(opts *bind.CallOpts, name string) (common.Address, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "resolve", name) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve is a free data retrieval call binding the contract method 0x461a4478. +// +// Solidity: function resolve(string name) view returns(address) +func (_TaikoL1 *TaikoL1Session) Resolve(name string) (common.Address, error) { + return _TaikoL1.Contract.Resolve(&_TaikoL1.CallOpts, name) +} + +// Resolve is a free data retrieval call binding the contract method 0x461a4478. +// +// Solidity: function resolve(string name) view returns(address) +func (_TaikoL1 *TaikoL1CallerSession) Resolve(name string) (common.Address, error) { + return _TaikoL1.Contract.Resolve(&_TaikoL1.CallOpts, name) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xf16c7934. +// +// Solidity: function resolve(uint256 chainId, string name) view returns(address) +func (_TaikoL1 *TaikoL1Caller) Resolve0(opts *bind.CallOpts, chainId *big.Int, name string) (common.Address, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "resolve0", chainId, name) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Resolve0 is a free data retrieval call binding the contract method 0xf16c7934. +// +// Solidity: function resolve(uint256 chainId, string name) view returns(address) +func (_TaikoL1 *TaikoL1Session) Resolve0(chainId *big.Int, name string) (common.Address, error) { + return _TaikoL1.Contract.Resolve0(&_TaikoL1.CallOpts, chainId, name) +} + +// Resolve0 is a free data retrieval call binding the contract method 0xf16c7934. +// +// Solidity: function resolve(uint256 chainId, string name) view returns(address) +func (_TaikoL1 *TaikoL1CallerSession) Resolve0(chainId *big.Int, name string) (common.Address, error) { + return _TaikoL1.Contract.Resolve0(&_TaikoL1.CallOpts, chainId, name) +} + +// SignWithGoldenTouch is a free data retrieval call binding the contract method 0xdadec12a. +// +// Solidity: function signWithGoldenTouch(bytes32 hash, uint8 k) view returns(uint8 v, uint256 r, uint256 s) +func (_TaikoL1 *TaikoL1Caller) SignWithGoldenTouch(opts *bind.CallOpts, hash [32]byte, k uint8) (struct { + V uint8 + R *big.Int + S *big.Int +}, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "signWithGoldenTouch", hash, k) + + outstruct := new(struct { + V uint8 + R *big.Int + S *big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.V = *abi.ConvertType(out[0], new(uint8)).(*uint8) + outstruct.R = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.S = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return *outstruct, err + +} + +// SignWithGoldenTouch is a free data retrieval call binding the contract method 0xdadec12a. +// +// Solidity: function signWithGoldenTouch(bytes32 hash, uint8 k) view returns(uint8 v, uint256 r, uint256 s) +func (_TaikoL1 *TaikoL1Session) SignWithGoldenTouch(hash [32]byte, k uint8) (struct { + V uint8 + R *big.Int + S *big.Int +}, error) { + return _TaikoL1.Contract.SignWithGoldenTouch(&_TaikoL1.CallOpts, hash, k) +} + +// SignWithGoldenTouch is a free data retrieval call binding the contract method 0xdadec12a. +// +// Solidity: function signWithGoldenTouch(bytes32 hash, uint8 k) view returns(uint8 v, uint256 r, uint256 s) +func (_TaikoL1 *TaikoL1CallerSession) SignWithGoldenTouch(hash [32]byte, k uint8) (struct { + V uint8 + R *big.Int + S *big.Int +}, error) { + return _TaikoL1.Contract.SignWithGoldenTouch(&_TaikoL1.CallOpts, hash, k) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint64 statusBits, uint64 genesisHeight, uint64 latestVerifiedHeight, uint64 latestVerifiedId, uint64 nextBlockId) +func (_TaikoL1 *TaikoL1Caller) State(opts *bind.CallOpts) (struct { + StatusBits uint64 + GenesisHeight uint64 + LatestVerifiedHeight uint64 + LatestVerifiedId uint64 + NextBlockId uint64 +}, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "state") + + outstruct := new(struct { + StatusBits uint64 + GenesisHeight uint64 + LatestVerifiedHeight uint64 + LatestVerifiedId uint64 + NextBlockId uint64 + }) + if err != nil { + return *outstruct, err + } + + outstruct.StatusBits = *abi.ConvertType(out[0], new(uint64)).(*uint64) + outstruct.GenesisHeight = *abi.ConvertType(out[1], new(uint64)).(*uint64) + outstruct.LatestVerifiedHeight = *abi.ConvertType(out[2], new(uint64)).(*uint64) + outstruct.LatestVerifiedId = *abi.ConvertType(out[3], new(uint64)).(*uint64) + outstruct.NextBlockId = *abi.ConvertType(out[4], new(uint64)).(*uint64) + + return *outstruct, err + +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint64 statusBits, uint64 genesisHeight, uint64 latestVerifiedHeight, uint64 latestVerifiedId, uint64 nextBlockId) +func (_TaikoL1 *TaikoL1Session) State() (struct { + StatusBits uint64 + GenesisHeight uint64 + LatestVerifiedHeight uint64 + LatestVerifiedId uint64 + NextBlockId uint64 +}, error) { + return _TaikoL1.Contract.State(&_TaikoL1.CallOpts) +} + +// State is a free data retrieval call binding the contract method 0xc19d93fb. +// +// Solidity: function state() view returns(uint64 statusBits, uint64 genesisHeight, uint64 latestVerifiedHeight, uint64 latestVerifiedId, uint64 nextBlockId) +func (_TaikoL1 *TaikoL1CallerSession) State() (struct { + StatusBits uint64 + GenesisHeight uint64 + LatestVerifiedHeight uint64 + LatestVerifiedId uint64 + NextBlockId uint64 +}, error) { + return _TaikoL1.Contract.State(&_TaikoL1.CallOpts) +} + +// CommitBlock is a paid mutator transaction binding the contract method 0x7e7a262c. +// +// Solidity: function commitBlock(uint64 commitSlot, bytes32 commitHash) returns() +func (_TaikoL1 *TaikoL1Transactor) CommitBlock(opts *bind.TransactOpts, commitSlot uint64, commitHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "commitBlock", commitSlot, commitHash) +} + +// CommitBlock is a paid mutator transaction binding the contract method 0x7e7a262c. +// +// Solidity: function commitBlock(uint64 commitSlot, bytes32 commitHash) returns() +func (_TaikoL1 *TaikoL1Session) CommitBlock(commitSlot uint64, commitHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.CommitBlock(&_TaikoL1.TransactOpts, commitSlot, commitHash) +} + +// CommitBlock is a paid mutator transaction binding the contract method 0x7e7a262c. +// +// Solidity: function commitBlock(uint64 commitSlot, bytes32 commitHash) returns() +func (_TaikoL1 *TaikoL1TransactorSession) CommitBlock(commitSlot uint64, commitHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.CommitBlock(&_TaikoL1.TransactOpts, commitSlot, commitHash) +} + +// Halt is a paid mutator transaction binding the contract method 0x96a38d22. +// +// Solidity: function halt(bool toHalt) returns() +func (_TaikoL1 *TaikoL1Transactor) Halt(opts *bind.TransactOpts, toHalt bool) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "halt", toHalt) +} + +// Halt is a paid mutator transaction binding the contract method 0x96a38d22. +// +// Solidity: function halt(bool toHalt) returns() +func (_TaikoL1 *TaikoL1Session) Halt(toHalt bool) (*types.Transaction, error) { + return _TaikoL1.Contract.Halt(&_TaikoL1.TransactOpts, toHalt) +} + +// Halt is a paid mutator transaction binding the contract method 0x96a38d22. +// +// Solidity: function halt(bool toHalt) returns() +func (_TaikoL1 *TaikoL1TransactorSession) Halt(toHalt bool) (*types.Transaction, error) { + return _TaikoL1.Contract.Halt(&_TaikoL1.TransactOpts, toHalt) +} + +// Init is a paid mutator transaction binding the contract method 0x2cc0b254. +// +// Solidity: function init(address _addressManager, bytes32 _genesisBlockHash) returns() +func (_TaikoL1 *TaikoL1Transactor) Init(opts *bind.TransactOpts, _addressManager common.Address, _genesisBlockHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "init", _addressManager, _genesisBlockHash) +} + +// Init is a paid mutator transaction binding the contract method 0x2cc0b254. +// +// Solidity: function init(address _addressManager, bytes32 _genesisBlockHash) returns() +func (_TaikoL1 *TaikoL1Session) Init(_addressManager common.Address, _genesisBlockHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.Init(&_TaikoL1.TransactOpts, _addressManager, _genesisBlockHash) +} + +// Init is a paid mutator transaction binding the contract method 0x2cc0b254. +// +// Solidity: function init(address _addressManager, bytes32 _genesisBlockHash) returns() +func (_TaikoL1 *TaikoL1TransactorSession) Init(_addressManager common.Address, _genesisBlockHash [32]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.Init(&_TaikoL1.TransactOpts, _addressManager, _genesisBlockHash) +} + +// ProposeBlock is a paid mutator transaction binding the contract method 0xa043dbdf. +// +// Solidity: function proposeBlock(bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Transactor) ProposeBlock(opts *bind.TransactOpts, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "proposeBlock", inputs) +} + +// ProposeBlock is a paid mutator transaction binding the contract method 0xa043dbdf. +// +// Solidity: function proposeBlock(bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Session) ProposeBlock(inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProposeBlock(&_TaikoL1.TransactOpts, inputs) +} + +// ProposeBlock is a paid mutator transaction binding the contract method 0xa043dbdf. +// +// Solidity: function proposeBlock(bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1TransactorSession) ProposeBlock(inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProposeBlock(&_TaikoL1.TransactOpts, inputs) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x8ed7b3be. +// +// Solidity: function proveBlock(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Transactor) ProveBlock(opts *bind.TransactOpts, blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "proveBlock", blockIndex, inputs) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x8ed7b3be. +// +// Solidity: function proveBlock(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Session) ProveBlock(blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProveBlock(&_TaikoL1.TransactOpts, blockIndex, inputs) +} + +// ProveBlock is a paid mutator transaction binding the contract method 0x8ed7b3be. +// +// Solidity: function proveBlock(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1TransactorSession) ProveBlock(blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProveBlock(&_TaikoL1.TransactOpts, blockIndex, inputs) +} + +// ProveBlockInvalid is a paid mutator transaction binding the contract method 0xa279cec7. +// +// Solidity: function proveBlockInvalid(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Transactor) ProveBlockInvalid(opts *bind.TransactOpts, blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "proveBlockInvalid", blockIndex, inputs) +} + +// ProveBlockInvalid is a paid mutator transaction binding the contract method 0xa279cec7. +// +// Solidity: function proveBlockInvalid(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1Session) ProveBlockInvalid(blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProveBlockInvalid(&_TaikoL1.TransactOpts, blockIndex, inputs) +} + +// ProveBlockInvalid is a paid mutator transaction binding the contract method 0xa279cec7. +// +// Solidity: function proveBlockInvalid(uint256 blockIndex, bytes[] inputs) returns() +func (_TaikoL1 *TaikoL1TransactorSession) ProveBlockInvalid(blockIndex *big.Int, inputs [][]byte) (*types.Transaction, error) { + return _TaikoL1.Contract.ProveBlockInvalid(&_TaikoL1.TransactOpts, blockIndex, inputs) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1 *TaikoL1Transactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1 *TaikoL1Session) RenounceOwnership() (*types.Transaction, error) { + return _TaikoL1.Contract.RenounceOwnership(&_TaikoL1.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_TaikoL1 *TaikoL1TransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _TaikoL1.Contract.RenounceOwnership(&_TaikoL1.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1 *TaikoL1Transactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1 *TaikoL1Session) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1.Contract.TransferOwnership(&_TaikoL1.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_TaikoL1 *TaikoL1TransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _TaikoL1.Contract.TransferOwnership(&_TaikoL1.TransactOpts, newOwner) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x2fb5ae0a. +// +// Solidity: function verifyBlocks(uint256 maxBlocks) returns() +func (_TaikoL1 *TaikoL1Transactor) VerifyBlocks(opts *bind.TransactOpts, maxBlocks *big.Int) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "verifyBlocks", maxBlocks) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x2fb5ae0a. +// +// Solidity: function verifyBlocks(uint256 maxBlocks) returns() +func (_TaikoL1 *TaikoL1Session) VerifyBlocks(maxBlocks *big.Int) (*types.Transaction, error) { + return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocks) +} + +// VerifyBlocks is a paid mutator transaction binding the contract method 0x2fb5ae0a. +// +// Solidity: function verifyBlocks(uint256 maxBlocks) returns() +func (_TaikoL1 *TaikoL1TransactorSession) VerifyBlocks(maxBlocks *big.Int) (*types.Transaction, error) { + return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocks) +} + +// WhitelistProver is a paid mutator transaction binding the contract method 0xa28088ea. +// +// Solidity: function whitelistProver(address prover, bool whitelisted) returns() +func (_TaikoL1 *TaikoL1Transactor) WhitelistProver(opts *bind.TransactOpts, prover common.Address, whitelisted bool) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "whitelistProver", prover, whitelisted) +} + +// WhitelistProver is a paid mutator transaction binding the contract method 0xa28088ea. +// +// Solidity: function whitelistProver(address prover, bool whitelisted) returns() +func (_TaikoL1 *TaikoL1Session) WhitelistProver(prover common.Address, whitelisted bool) (*types.Transaction, error) { + return _TaikoL1.Contract.WhitelistProver(&_TaikoL1.TransactOpts, prover, whitelisted) +} + +// WhitelistProver is a paid mutator transaction binding the contract method 0xa28088ea. +// +// Solidity: function whitelistProver(address prover, bool whitelisted) returns() +func (_TaikoL1 *TaikoL1TransactorSession) WhitelistProver(prover common.Address, whitelisted bool) (*types.Transaction, error) { + return _TaikoL1.Contract.WhitelistProver(&_TaikoL1.TransactOpts, prover, whitelisted) +} + +// TaikoL1BlockCommittedIterator is returned from FilterBlockCommitted and is used to iterate over the raw logs and unpacked data for BlockCommitted events raised by the TaikoL1 contract. +type TaikoL1BlockCommittedIterator struct { + Event *TaikoL1BlockCommitted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1BlockCommittedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockCommitted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockCommitted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1BlockCommittedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1BlockCommittedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1BlockCommitted represents a BlockCommitted event raised by the TaikoL1 contract. +type TaikoL1BlockCommitted struct { + CommitSlot uint64 + CommitHeight uint64 + CommitHash [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockCommitted is a free log retrieval operation binding the contract event 0xd925166ecbc7d0fa7893e375c60319a9fbb17d83674eb3a8d3d57fd89ce3e7fc. +// +// Solidity: event BlockCommitted(uint64 commitSlot, uint64 commitHeight, bytes32 commitHash) +func (_TaikoL1 *TaikoL1Filterer) FilterBlockCommitted(opts *bind.FilterOpts) (*TaikoL1BlockCommittedIterator, error) { + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "BlockCommitted") + if err != nil { + return nil, err + } + return &TaikoL1BlockCommittedIterator{contract: _TaikoL1.contract, event: "BlockCommitted", logs: logs, sub: sub}, nil +} + +// WatchBlockCommitted is a free log subscription operation binding the contract event 0xd925166ecbc7d0fa7893e375c60319a9fbb17d83674eb3a8d3d57fd89ce3e7fc. +// +// Solidity: event BlockCommitted(uint64 commitSlot, uint64 commitHeight, bytes32 commitHash) +func (_TaikoL1 *TaikoL1Filterer) WatchBlockCommitted(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockCommitted) (event.Subscription, error) { + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "BlockCommitted") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1BlockCommitted) + if err := _TaikoL1.contract.UnpackLog(event, "BlockCommitted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockCommitted is a log parse operation binding the contract event 0xd925166ecbc7d0fa7893e375c60319a9fbb17d83674eb3a8d3d57fd89ce3e7fc. +// +// Solidity: event BlockCommitted(uint64 commitSlot, uint64 commitHeight, bytes32 commitHash) +func (_TaikoL1 *TaikoL1Filterer) ParseBlockCommitted(log types.Log) (*TaikoL1BlockCommitted, error) { + event := new(TaikoL1BlockCommitted) + if err := _TaikoL1.contract.UnpackLog(event, "BlockCommitted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1BlockProposedIterator is returned from FilterBlockProposed and is used to iterate over the raw logs and unpacked data for BlockProposed events raised by the TaikoL1 contract. +type TaikoL1BlockProposedIterator struct { + Event *TaikoL1BlockProposed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1BlockProposedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockProposed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockProposed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1BlockProposedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1BlockProposedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1BlockProposed represents a BlockProposed event raised by the TaikoL1 contract. +type TaikoL1BlockProposed struct { + Id *big.Int + Meta LibDataBlockMetadata + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProposed is a free log retrieval operation binding the contract event 0x344fc5d5f80c4a29bd7e06ad7c28a0c8c9c08d682129da3a31936d5982e4f044. +// +// Solidity: event BlockProposed(uint256 indexed id, (uint256,uint256,bytes32,address,bytes32,bytes32,bytes,uint64,uint64,uint64,uint64) meta) +func (_TaikoL1 *TaikoL1Filterer) FilterBlockProposed(opts *bind.FilterOpts, id []*big.Int) (*TaikoL1BlockProposedIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "BlockProposed", idRule) + if err != nil { + return nil, err + } + return &TaikoL1BlockProposedIterator{contract: _TaikoL1.contract, event: "BlockProposed", logs: logs, sub: sub}, nil +} + +// WatchBlockProposed is a free log subscription operation binding the contract event 0x344fc5d5f80c4a29bd7e06ad7c28a0c8c9c08d682129da3a31936d5982e4f044. +// +// Solidity: event BlockProposed(uint256 indexed id, (uint256,uint256,bytes32,address,bytes32,bytes32,bytes,uint64,uint64,uint64,uint64) meta) +func (_TaikoL1 *TaikoL1Filterer) WatchBlockProposed(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockProposed, id []*big.Int) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "BlockProposed", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1BlockProposed) + if err := _TaikoL1.contract.UnpackLog(event, "BlockProposed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProposed is a log parse operation binding the contract event 0x344fc5d5f80c4a29bd7e06ad7c28a0c8c9c08d682129da3a31936d5982e4f044. +// +// Solidity: event BlockProposed(uint256 indexed id, (uint256,uint256,bytes32,address,bytes32,bytes32,bytes,uint64,uint64,uint64,uint64) meta) +func (_TaikoL1 *TaikoL1Filterer) ParseBlockProposed(log types.Log) (*TaikoL1BlockProposed, error) { + event := new(TaikoL1BlockProposed) + if err := _TaikoL1.contract.UnpackLog(event, "BlockProposed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1BlockProvenIterator is returned from FilterBlockProven and is used to iterate over the raw logs and unpacked data for BlockProven events raised by the TaikoL1 contract. +type TaikoL1BlockProvenIterator struct { + Event *TaikoL1BlockProven // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1BlockProvenIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockProven) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockProven) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1BlockProvenIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1BlockProvenIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1BlockProven represents a BlockProven event raised by the TaikoL1 contract. +type TaikoL1BlockProven struct { + Id *big.Int + ParentHash [32]byte + BlockHash [32]byte + Timestamp uint64 + ProvenAt uint64 + Prover common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockProven is a free log retrieval operation binding the contract event 0xf66e10e397da1b4c87429bd76e1d3b85fd417c38c5d43c8ea3e2ec45935bada0. +// +// Solidity: event BlockProven(uint256 indexed id, bytes32 parentHash, bytes32 blockHash, uint64 timestamp, uint64 provenAt, address prover) +func (_TaikoL1 *TaikoL1Filterer) FilterBlockProven(opts *bind.FilterOpts, id []*big.Int) (*TaikoL1BlockProvenIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "BlockProven", idRule) + if err != nil { + return nil, err + } + return &TaikoL1BlockProvenIterator{contract: _TaikoL1.contract, event: "BlockProven", logs: logs, sub: sub}, nil +} + +// WatchBlockProven is a free log subscription operation binding the contract event 0xf66e10e397da1b4c87429bd76e1d3b85fd417c38c5d43c8ea3e2ec45935bada0. +// +// Solidity: event BlockProven(uint256 indexed id, bytes32 parentHash, bytes32 blockHash, uint64 timestamp, uint64 provenAt, address prover) +func (_TaikoL1 *TaikoL1Filterer) WatchBlockProven(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockProven, id []*big.Int) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "BlockProven", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1BlockProven) + if err := _TaikoL1.contract.UnpackLog(event, "BlockProven", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockProven is a log parse operation binding the contract event 0xf66e10e397da1b4c87429bd76e1d3b85fd417c38c5d43c8ea3e2ec45935bada0. +// +// Solidity: event BlockProven(uint256 indexed id, bytes32 parentHash, bytes32 blockHash, uint64 timestamp, uint64 provenAt, address prover) +func (_TaikoL1 *TaikoL1Filterer) ParseBlockProven(log types.Log) (*TaikoL1BlockProven, error) { + event := new(TaikoL1BlockProven) + if err := _TaikoL1.contract.UnpackLog(event, "BlockProven", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1BlockVerifiedIterator is returned from FilterBlockVerified and is used to iterate over the raw logs and unpacked data for BlockVerified events raised by the TaikoL1 contract. +type TaikoL1BlockVerifiedIterator struct { + Event *TaikoL1BlockVerified // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1BlockVerifiedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockVerified) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1BlockVerified) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1BlockVerifiedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1BlockVerifiedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1BlockVerified represents a BlockVerified event raised by the TaikoL1 contract. +type TaikoL1BlockVerified struct { + Id *big.Int + BlockHash [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBlockVerified is a free log retrieval operation binding the contract event 0x68b82650828a9621868d09dc161400acbe189fa002e3fb7cf9dea5c2c6f928ee. +// +// Solidity: event BlockVerified(uint256 indexed id, bytes32 blockHash) +func (_TaikoL1 *TaikoL1Filterer) FilterBlockVerified(opts *bind.FilterOpts, id []*big.Int) (*TaikoL1BlockVerifiedIterator, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "BlockVerified", idRule) + if err != nil { + return nil, err + } + return &TaikoL1BlockVerifiedIterator{contract: _TaikoL1.contract, event: "BlockVerified", logs: logs, sub: sub}, nil +} + +// WatchBlockVerified is a free log subscription operation binding the contract event 0x68b82650828a9621868d09dc161400acbe189fa002e3fb7cf9dea5c2c6f928ee. +// +// Solidity: event BlockVerified(uint256 indexed id, bytes32 blockHash) +func (_TaikoL1 *TaikoL1Filterer) WatchBlockVerified(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockVerified, id []*big.Int) (event.Subscription, error) { + + var idRule []interface{} + for _, idItem := range id { + idRule = append(idRule, idItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "BlockVerified", idRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1BlockVerified) + if err := _TaikoL1.contract.UnpackLog(event, "BlockVerified", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBlockVerified is a log parse operation binding the contract event 0x68b82650828a9621868d09dc161400acbe189fa002e3fb7cf9dea5c2c6f928ee. +// +// Solidity: event BlockVerified(uint256 indexed id, bytes32 blockHash) +func (_TaikoL1 *TaikoL1Filterer) ParseBlockVerified(log types.Log) (*TaikoL1BlockVerified, error) { + event := new(TaikoL1BlockVerified) + if err := _TaikoL1.contract.UnpackLog(event, "BlockVerified", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1HaltedIterator is returned from FilterHalted and is used to iterate over the raw logs and unpacked data for Halted events raised by the TaikoL1 contract. +type TaikoL1HaltedIterator struct { + Event *TaikoL1Halted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1HaltedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1Halted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1Halted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1HaltedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1HaltedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1Halted represents a Halted event raised by the TaikoL1 contract. +type TaikoL1Halted struct { + Halted bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterHalted is a free log retrieval operation binding the contract event 0x92333b0b676476985757350034668cb9ee247674ac7a7479de10cd761381f733. +// +// Solidity: event Halted(bool halted) +func (_TaikoL1 *TaikoL1Filterer) FilterHalted(opts *bind.FilterOpts) (*TaikoL1HaltedIterator, error) { + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "Halted") + if err != nil { + return nil, err + } + return &TaikoL1HaltedIterator{contract: _TaikoL1.contract, event: "Halted", logs: logs, sub: sub}, nil +} + +// WatchHalted is a free log subscription operation binding the contract event 0x92333b0b676476985757350034668cb9ee247674ac7a7479de10cd761381f733. +// +// Solidity: event Halted(bool halted) +func (_TaikoL1 *TaikoL1Filterer) WatchHalted(opts *bind.WatchOpts, sink chan<- *TaikoL1Halted) (event.Subscription, error) { + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "Halted") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1Halted) + if err := _TaikoL1.contract.UnpackLog(event, "Halted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseHalted is a log parse operation binding the contract event 0x92333b0b676476985757350034668cb9ee247674ac7a7479de10cd761381f733. +// +// Solidity: event Halted(bool halted) +func (_TaikoL1 *TaikoL1Filterer) ParseHalted(log types.Log) (*TaikoL1Halted, error) { + event := new(TaikoL1Halted) + if err := _TaikoL1.contract.UnpackLog(event, "Halted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1HeaderSyncedIterator is returned from FilterHeaderSynced and is used to iterate over the raw logs and unpacked data for HeaderSynced events raised by the TaikoL1 contract. +type TaikoL1HeaderSyncedIterator struct { + Event *TaikoL1HeaderSynced // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1HeaderSyncedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1HeaderSynced) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1HeaderSynced) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1HeaderSyncedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1HeaderSyncedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1HeaderSynced represents a HeaderSynced event raised by the TaikoL1 contract. +type TaikoL1HeaderSynced struct { + Height *big.Int + SrcHeight *big.Int + SrcHash [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterHeaderSynced is a free log retrieval operation binding the contract event 0x930c750845026c7bb04c0e3d9111d512b4c86981713c4944a35a10a4a7a854f3. +// +// Solidity: event HeaderSynced(uint256 indexed height, uint256 indexed srcHeight, bytes32 srcHash) +func (_TaikoL1 *TaikoL1Filterer) FilterHeaderSynced(opts *bind.FilterOpts, height []*big.Int, srcHeight []*big.Int) (*TaikoL1HeaderSyncedIterator, error) { + + var heightRule []interface{} + for _, heightItem := range height { + heightRule = append(heightRule, heightItem) + } + var srcHeightRule []interface{} + for _, srcHeightItem := range srcHeight { + srcHeightRule = append(srcHeightRule, srcHeightItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "HeaderSynced", heightRule, srcHeightRule) + if err != nil { + return nil, err + } + return &TaikoL1HeaderSyncedIterator{contract: _TaikoL1.contract, event: "HeaderSynced", logs: logs, sub: sub}, nil +} + +// WatchHeaderSynced is a free log subscription operation binding the contract event 0x930c750845026c7bb04c0e3d9111d512b4c86981713c4944a35a10a4a7a854f3. +// +// Solidity: event HeaderSynced(uint256 indexed height, uint256 indexed srcHeight, bytes32 srcHash) +func (_TaikoL1 *TaikoL1Filterer) WatchHeaderSynced(opts *bind.WatchOpts, sink chan<- *TaikoL1HeaderSynced, height []*big.Int, srcHeight []*big.Int) (event.Subscription, error) { + + var heightRule []interface{} + for _, heightItem := range height { + heightRule = append(heightRule, heightItem) + } + var srcHeightRule []interface{} + for _, srcHeightItem := range srcHeight { + srcHeightRule = append(srcHeightRule, srcHeightItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "HeaderSynced", heightRule, srcHeightRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1HeaderSynced) + if err := _TaikoL1.contract.UnpackLog(event, "HeaderSynced", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseHeaderSynced is a log parse operation binding the contract event 0x930c750845026c7bb04c0e3d9111d512b4c86981713c4944a35a10a4a7a854f3. +// +// Solidity: event HeaderSynced(uint256 indexed height, uint256 indexed srcHeight, bytes32 srcHash) +func (_TaikoL1 *TaikoL1Filterer) ParseHeaderSynced(log types.Log) (*TaikoL1HeaderSynced, error) { + event := new(TaikoL1HeaderSynced) + if err := _TaikoL1.contract.UnpackLog(event, "HeaderSynced", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1InitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the TaikoL1 contract. +type TaikoL1InitializedIterator struct { + Event *TaikoL1Initialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1InitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1Initialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1Initialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1InitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1InitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1Initialized represents a Initialized event raised by the TaikoL1 contract. +type TaikoL1Initialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1 *TaikoL1Filterer) FilterInitialized(opts *bind.FilterOpts) (*TaikoL1InitializedIterator, error) { + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &TaikoL1InitializedIterator{contract: _TaikoL1.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1 *TaikoL1Filterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *TaikoL1Initialized) (event.Subscription, error) { + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1Initialized) + if err := _TaikoL1.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_TaikoL1 *TaikoL1Filterer) ParseInitialized(log types.Log) (*TaikoL1Initialized, error) { + event := new(TaikoL1Initialized) + if err := _TaikoL1.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1OwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the TaikoL1 contract. +type TaikoL1OwnershipTransferredIterator struct { + Event *TaikoL1OwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1OwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1OwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1OwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1OwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1OwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1OwnershipTransferred represents a OwnershipTransferred event raised by the TaikoL1 contract. +type TaikoL1OwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1 *TaikoL1Filterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*TaikoL1OwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &TaikoL1OwnershipTransferredIterator{contract: _TaikoL1.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1 *TaikoL1Filterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *TaikoL1OwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1OwnershipTransferred) + if err := _TaikoL1.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_TaikoL1 *TaikoL1Filterer) ParseOwnershipTransferred(log types.Log) (*TaikoL1OwnershipTransferred, error) { + event := new(TaikoL1OwnershipTransferred) + if err := _TaikoL1.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// TaikoL1ProverWhitelistedIterator is returned from FilterProverWhitelisted and is used to iterate over the raw logs and unpacked data for ProverWhitelisted events raised by the TaikoL1 contract. +type TaikoL1ProverWhitelistedIterator struct { + Event *TaikoL1ProverWhitelisted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *TaikoL1ProverWhitelistedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(TaikoL1ProverWhitelisted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(TaikoL1ProverWhitelisted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *TaikoL1ProverWhitelistedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *TaikoL1ProverWhitelistedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// TaikoL1ProverWhitelisted represents a ProverWhitelisted event raised by the TaikoL1 contract. +type TaikoL1ProverWhitelisted struct { + Prover common.Address + Whitelisted bool + Raw types.Log // Blockchain specific contextual infos +} + +// FilterProverWhitelisted is a free log retrieval operation binding the contract event 0x3ab5de546d706301c6736d6e367d46508c2bd77d9fa8a52813f74fa8a0d8a424. +// +// Solidity: event ProverWhitelisted(address indexed prover, bool whitelisted) +func (_TaikoL1 *TaikoL1Filterer) FilterProverWhitelisted(opts *bind.FilterOpts, prover []common.Address) (*TaikoL1ProverWhitelistedIterator, error) { + + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "ProverWhitelisted", proverRule) + if err != nil { + return nil, err + } + return &TaikoL1ProverWhitelistedIterator{contract: _TaikoL1.contract, event: "ProverWhitelisted", logs: logs, sub: sub}, nil +} + +// WatchProverWhitelisted is a free log subscription operation binding the contract event 0x3ab5de546d706301c6736d6e367d46508c2bd77d9fa8a52813f74fa8a0d8a424. +// +// Solidity: event ProverWhitelisted(address indexed prover, bool whitelisted) +func (_TaikoL1 *TaikoL1Filterer) WatchProverWhitelisted(opts *bind.WatchOpts, sink chan<- *TaikoL1ProverWhitelisted, prover []common.Address) (event.Subscription, error) { + + var proverRule []interface{} + for _, proverItem := range prover { + proverRule = append(proverRule, proverItem) + } + + logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "ProverWhitelisted", proverRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(TaikoL1ProverWhitelisted) + if err := _TaikoL1.contract.UnpackLog(event, "ProverWhitelisted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseProverWhitelisted is a log parse operation binding the contract event 0x3ab5de546d706301c6736d6e367d46508c2bd77d9fa8a52813f74fa8a0d8a424. +// +// Solidity: event ProverWhitelisted(address indexed prover, bool whitelisted) +func (_TaikoL1 *TaikoL1Filterer) ParseProverWhitelisted(log types.Log) (*TaikoL1ProverWhitelisted, error) { + event := new(TaikoL1ProverWhitelisted) + if err := _TaikoL1.contract.UnpackLog(event, "ProverWhitelisted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/packages/relayer/contracts/V1TaikoL2.go b/packages/relayer/contracts/V1TaikoL2.go index 9fd15885c7..9d225a57d1 100644 --- a/packages/relayer/contracts/V1TaikoL2.go +++ b/packages/relayer/contracts/V1TaikoL2.go @@ -27,7 +27,7 @@ var ( ) // V1TaikoL2ABI is the input ABI used to generate the binding from. -const V1TaikoL2ABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"}],\"name\":\"BlockInvalidated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"srcHash\",\"type\":\"bytes32\"}],\"name\":\"HeaderSynced\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l1Height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConstants\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"txList\",\"type\":\"bytes\"},{\"internalType\":\"enumLibInvalidTxList.Reason\",\"name\":\"hint\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"txIdx\",\"type\":\"uint256\"}],\"name\":\"invalidateBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" +const V1TaikoL2ABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"}],\"name\":\"BlockInvalidated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"srcHash\",\"type\":\"bytes32\"}],\"name\":\"HeaderSynced\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l1Height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConstants\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLatestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"number\",\"type\":\"uint256\"}],\"name\":\"getSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"txList\",\"type\":\"bytes\"},{\"internalType\":\"enumLibInvalidTxList.Reason\",\"name\":\"hint\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"txIdx\",\"type\":\"uint256\"}],\"name\":\"invalidateBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedHeader\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]" // V1TaikoL2 is an auto generated Go binding around an Ethereum contract. type V1TaikoL2 struct { @@ -235,13 +235,13 @@ func (_V1TaikoL2 *V1TaikoL2CallerSession) GetBlockHash(number *big.Int) ([32]byt // GetConstants is a free data retrieval call binding the contract method 0x9a295e73. // -// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) -func (_V1TaikoL2 *V1TaikoL2Caller) GetConstants(opts *bind.CallOpts) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_V1TaikoL2 *V1TaikoL2Caller) GetConstants(opts *bind.CallOpts) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { var out []interface{} err := _V1TaikoL2.contract.Call(opts, &out, "getConstants") if err != nil { - return *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([32]byte), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([4]byte), *new([32]byte), err + return *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([32]byte), *new(*big.Int), *new(*big.Int), *new(*big.Int), *new([4]byte), *new([32]byte), err } out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) @@ -251,28 +251,29 @@ func (_V1TaikoL2 *V1TaikoL2Caller) GetConstants(opts *bind.CallOpts) (*big.Int, out4 := *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) out5 := *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) out6 := *abi.ConvertType(out[6], new(*big.Int)).(**big.Int) - out7 := *abi.ConvertType(out[7], new([32]byte)).(*[32]byte) - out8 := *abi.ConvertType(out[8], new(*big.Int)).(**big.Int) + out7 := *abi.ConvertType(out[7], new(*big.Int)).(**big.Int) + out8 := *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) out9 := *abi.ConvertType(out[9], new(*big.Int)).(**big.Int) out10 := *abi.ConvertType(out[10], new(*big.Int)).(**big.Int) - out11 := *abi.ConvertType(out[11], new([4]byte)).(*[4]byte) - out12 := *abi.ConvertType(out[12], new([32]byte)).(*[32]byte) + out11 := *abi.ConvertType(out[11], new(*big.Int)).(**big.Int) + out12 := *abi.ConvertType(out[12], new([4]byte)).(*[4]byte) + out13 := *abi.ConvertType(out[13], new([32]byte)).(*[32]byte) - return out0, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12, err + return out0, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12, out13, err } // GetConstants is a free data retrieval call binding the contract method 0x9a295e73. // -// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) -func (_V1TaikoL2 *V1TaikoL2Session) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_V1TaikoL2 *V1TaikoL2Session) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { return _V1TaikoL2.Contract.GetConstants(&_V1TaikoL2.CallOpts) } // GetConstants is a free data retrieval call binding the contract method 0x9a295e73. // -// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) -func (_V1TaikoL2 *V1TaikoL2CallerSession) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { +// Solidity: function getConstants() pure returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bytes32, uint256, uint256, uint256, bytes4, bytes32) +func (_V1TaikoL2 *V1TaikoL2CallerSession) GetConstants() (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, *big.Int, [32]byte, *big.Int, *big.Int, *big.Int, [4]byte, [32]byte, error) { return _V1TaikoL2.Contract.GetConstants(&_V1TaikoL2.CallOpts) } diff --git a/packages/relayer/indexer/filter_then_subscribe.go b/packages/relayer/indexer/filter_then_subscribe.go index fbc017a34a..ac22a0377f 100644 --- a/packages/relayer/indexer/filter_then_subscribe.go +++ b/packages/relayer/indexer/filter_then_subscribe.go @@ -17,7 +17,11 @@ var ( // FilterThenSubscribe gets the most recent block height that has been indexed, and works it's way // up to the latest block. As it goes, it tries to process messages. // When it catches up, it then starts to Subscribe to latest events as they come in. -func (svc *Service) FilterThenSubscribe(ctx context.Context, mode relayer.Mode, watchMode relayer.WatchMode) error { +func (svc *Service) FilterThenSubscribe( + ctx context.Context, + mode relayer.Mode, + watchMode relayer.WatchMode, +) error { chainID, err := svc.ethClient.ChainID(ctx) if err != nil { return errors.Wrap(err, "svc.ethClient.ChainID()") @@ -37,29 +41,27 @@ func (svc *Service) FilterThenSubscribe(ctx context.Context, mode relayer.Mode, return errors.Wrap(err, "svc.ethClient.HeaderByNumber") } - if svc.processingBlock.Height == header.Number.Uint64() { + if svc.processingBlockHeight == header.Number.Uint64() { log.Info("caught up, subscribing to new incoming events") return svc.subscribe(ctx, chainID) } log.Infof("getting events between %v and %v in batches of %v", - svc.processingBlock.Height, + svc.processingBlockHeight, header.Number.Int64(), svc.blockBatchSize, ) - for i := svc.processingBlock.Height; i < header.Number.Uint64(); i += svc.blockBatchSize { - end := svc.processingBlock.Height + svc.blockBatchSize + for i := svc.processingBlockHeight; i < header.Number.Uint64(); i += svc.blockBatchSize { + end := svc.processingBlockHeight + svc.blockBatchSize // if the end of the batch is greater than the latest block number, set end // to the latest block number if end > header.Number.Uint64() { end = header.Number.Uint64() } - log.Infof("batch from %v to %v", i, end) - events, err := svc.bridge.FilterMessageSent(&bind.FilterOpts{ - Start: svc.processingBlock.Height, + Start: svc.processingBlockHeight, End: &end, Context: ctx, }, nil) @@ -69,19 +71,19 @@ func (svc *Service) FilterThenSubscribe(ctx context.Context, mode relayer.Mode, if !events.Next() || events.Event == nil { if err := svc.handleNoEventsInBatch(ctx, chainID, int64(end)); err != nil { - return errors.Wrap(err, "s.handleNoEventsInBatch") + return errors.Wrap(err, "svc.handleNoEventsInBatch") } continue } - group, ctx := errgroup.WithContext(ctx) + group, groupCtx := errgroup.WithContext(ctx) group.SetLimit(svc.numGoroutines) for { group.Go(func() error { - err := svc.handleEvent(ctx, chainID, events.Event) + err := svc.handleEvent(groupCtx, chainID, events.Event) if err != nil { // log error but always return nil to keep other goroutines active log.Error(err.Error()) @@ -90,13 +92,16 @@ func (svc *Service) FilterThenSubscribe(ctx context.Context, mode relayer.Mode, return nil }) + // if there are no more events if !events.Next() { + // wait for the last of the goroutines to finish if err := group.Wait(); err != nil { return errors.Wrap(err, "group.Wait") } - - if err := svc.handleNoEventsRemaining(ctx, chainID, events); err != nil { - return errors.Wrap(err, "svc.handleNoEventsRemaining") + // handle no events remaining, saving the processing block and restarting the for + // loop + if err := svc.handleNoEventsInBatch(ctx, chainID, int64(end)); err != nil { + return errors.Wrap(err, "svc.handleNoEventsInBatch") } break @@ -111,7 +116,7 @@ func (svc *Service) FilterThenSubscribe(ctx context.Context, mode relayer.Mode, return errors.Wrap(err, "svc.ethclient.HeaderByNumber") } - if svc.processingBlock.Height < latestBlock.Number.Uint64() { + if svc.processingBlockHeight < latestBlock.Number.Uint64() { return svc.FilterThenSubscribe(ctx, relayer.SyncMode, watchMode) } diff --git a/packages/relayer/indexer/filter_then_subscribe_test.go b/packages/relayer/indexer/filter_then_subscribe_test.go index f43f536d63..2bede242ca 100644 --- a/packages/relayer/indexer/filter_then_subscribe_test.go +++ b/packages/relayer/indexer/filter_then_subscribe_test.go @@ -14,9 +14,7 @@ func Test_FilterThenSubscribe(t *testing.T) { svc, bridge := newTestService() b := bridge.(*mock.Bridge) - svc.processingBlock = &relayer.Block{ - Height: 0, - } + svc.processingBlockHeight = 0 go func() { _ = svc.FilterThenSubscribe( @@ -54,9 +52,7 @@ func Test_FilterThenSubscribe_alreadyCaughtUp(t *testing.T) { svc, bridge := newTestService() b := bridge.(*mock.Bridge) - svc.processingBlock = &relayer.Block{ - Height: mock.LatestBlockNumber.Uint64(), - } + svc.processingBlockHeight = mock.LatestBlockNumber.Uint64() go func() { _ = svc.FilterThenSubscribe( diff --git a/packages/relayer/indexer/handle_event.go b/packages/relayer/indexer/handle_event.go index c356cd2ed3..ae31a4f73d 100644 --- a/packages/relayer/indexer/handle_event.go +++ b/packages/relayer/indexer/handle_event.go @@ -18,8 +18,6 @@ func (svc *Service) handleEvent( chainID *big.Int, event *contracts.BridgeMessageSent, ) error { - log.Infof("event found for signal: %v", common.Hash(event.Signal).Hex()) - raw := event.Raw // handle chain re-org by checking Removed property, no need to @@ -28,6 +26,13 @@ func (svc *Service) handleEvent( return nil } + if event.Signal == relayer.ZeroHash { + log.Warn("Zero signal found. This is unexpected. Returning early") + return nil + } + + log.Infof("event found for signal: %v", common.Hash(event.Signal).Hex()) + eventStatus, err := svc.eventStatusFromSignal(ctx, event.Message.GasLimit, event.Signal) if err != nil { return errors.Wrap(err, "svc.eventStatusFromSignal") @@ -57,27 +62,6 @@ func (svc *Service) handleEvent( return errors.Wrap(err, "svc.processMessage") } - // if the block number of the event is higher than the block we are processing, - // we can now consider that previous block processed. save it to the DB - // and bump the block number. - if raw.BlockNumber > svc.processingBlock.Height { - log.Infof("saving new latest processed block to DB: %v", raw.BlockNumber) - - if err := svc.blockRepo.Save(relayer.SaveBlockOpts{ - Height: svc.processingBlock.Height, - Hash: common.HexToHash(svc.processingBlock.Hash), - ChainID: chainID, - EventName: eventName, - }); err != nil { - return errors.Wrap(err, "svc.blockRepo.Save") - } - - svc.processingBlock = &relayer.Block{ - Height: raw.BlockNumber, - Hash: raw.BlockHash.Hex(), - } - } - return nil } @@ -111,16 +95,17 @@ func (svc *Service) eventStatusFromSignal( ) (relayer.EventStatus, error) { var eventStatus relayer.EventStatus - // if gasLimit is 0, relayer can not process this. - if gasLimit == nil || gasLimit.Cmp(common.Big0) == 0 { - eventStatus = relayer.EventStatusNewOnlyOwner - } else { - messageStatus, err := svc.destBridge.GetMessageStatus(nil, signal) - if err != nil { - return 0, errors.Wrap(err, "svc.destBridge.GetMessageStatus") - } + messageStatus, err := svc.destBridge.GetMessageStatus(nil, signal) + if err != nil { + return 0, errors.Wrap(err, "svc.destBridge.GetMessageStatus") + } - eventStatus = relayer.EventStatus(messageStatus) + eventStatus = relayer.EventStatus(messageStatus) + if eventStatus == relayer.EventStatusNew { + if gasLimit == nil || gasLimit.Cmp(common.Big0) == 0 { + // if gasLimit is 0, relayer can not process this. + eventStatus = relayer.EventStatusNewOnlyOwner + } } return eventStatus, nil diff --git a/packages/relayer/indexer/handle_event_test.go b/packages/relayer/indexer/handle_event_test.go index 390e173e3c..5f39c7915b 100644 --- a/packages/relayer/indexer/handle_event_test.go +++ b/packages/relayer/indexer/handle_event_test.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" "github.com/taikoxyz/taiko-mono/packages/relayer" + "github.com/taikoxyz/taiko-mono/packages/relayer/mock" ) var ( @@ -83,21 +84,37 @@ func Test_eventStatusFromSignal(t *testing.T) { wantStatus relayer.EventStatus }{ { - "eventStatusNewOnlyOwner, nilGasLimit", + "eventStatusDone", context.Background(), nil, [32]byte{}, nil, - relayer.EventStatusNewOnlyOwner, + relayer.EventStatusDone, }, { "eventStatusNewOnlyOwner, 0GasLimit", context.Background(), common.Big0, - [32]byte{}, + mock.SuccessSignal, + nil, + relayer.EventStatusNewOnlyOwner, + }, + { + "eventStatusNewOnlyOwner, nilGasLimit", + context.Background(), + nil, + mock.SuccessSignal, nil, relayer.EventStatusNewOnlyOwner, }, + { + "eventStatusNewOnlyOwner, non0GasLimit", + context.Background(), + big.NewInt(100), + mock.SuccessSignal, + nil, + relayer.EventStatusNew, + }, } for _, tt := range tests { diff --git a/packages/relayer/indexer/handle_no_events_in_batch.go b/packages/relayer/indexer/handle_no_events_in_batch.go index a2e367cf02..6ee402922b 100644 --- a/packages/relayer/indexer/handle_no_events_in_batch.go +++ b/packages/relayer/indexer/handle_no_events_in_batch.go @@ -11,9 +11,11 @@ import ( // handleNoEventsInBatch is used when an entire batch call has no events in the entire response, // and we need to update the latest block processed -func (svc *Service) handleNoEventsInBatch(ctx context.Context, chainID *big.Int, blockNumber int64) error { - log.Infof("no events in batch") - +func (svc *Service) handleNoEventsInBatch( + ctx context.Context, + chainID *big.Int, + blockNumber int64, +) error { header, err := svc.ethClient.HeaderByNumber(ctx, big.NewInt(blockNumber)) if err != nil { return errors.Wrap(err, "svc.ethClient.HeaderByNumber") @@ -30,10 +32,7 @@ func (svc *Service) handleNoEventsInBatch(ctx context.Context, chainID *big.Int, return errors.Wrap(err, "svc.blockRepo.Save") } - svc.processingBlock = &relayer.Block{ - Height: uint64(blockNumber), - Hash: header.Hash().Hex(), - } + svc.processingBlockHeight = uint64(blockNumber) return nil } diff --git a/packages/relayer/indexer/handle_no_events_in_batch_test.go b/packages/relayer/indexer/handle_no_events_in_batch_test.go index d4d5e92f72..fe0bb71685 100644 --- a/packages/relayer/indexer/handle_no_events_in_batch_test.go +++ b/packages/relayer/indexer/handle_no_events_in_batch_test.go @@ -27,13 +27,13 @@ func Test_handleNoEventsInBatch(t *testing.T) { t.Run(tt.name, func(t *testing.T) { svc, _ := newTestService() - assert.NotEqual(t, svc.processingBlock.Height, uint64(tt.blockNumber)) + assert.NotEqual(t, svc.processingBlockHeight, uint64(tt.blockNumber)) err := svc.handleNoEventsInBatch(context.Background(), tt.chainID, tt.blockNumber) assert.Equal(t, tt.wantErr, err) - assert.Equal(t, svc.processingBlock.Height, uint64(tt.blockNumber)) + assert.Equal(t, svc.processingBlockHeight, uint64(tt.blockNumber)) }) } } diff --git a/packages/relayer/indexer/handle_no_events_remaining.go b/packages/relayer/indexer/handle_no_events_remaining.go deleted file mode 100644 index 6645211ee6..0000000000 --- a/packages/relayer/indexer/handle_no_events_remaining.go +++ /dev/null @@ -1,38 +0,0 @@ -package indexer - -import ( - "context" - "math/big" - - "github.com/pkg/errors" - log "github.com/sirupsen/logrus" - "github.com/taikoxyz/taiko-mono/packages/relayer" - "github.com/taikoxyz/taiko-mono/packages/relayer/contracts" -) - -// handleNoEventsRemaining is used when the batch had events, but is now finished, and we need to -// update the latest block processed -func (svc *Service) handleNoEventsRemaining( - ctx context.Context, - chainID *big.Int, - events *contracts.BridgeMessageSentIterator, -) error { - log.Info("no events remaining to be processed") - - if events.Error() != nil { - return errors.Wrap(events.Error(), "events.Error") - } - - log.Infof("saving new latest processed block to DB: %v", events.Event.Raw.BlockNumber) - - if err := svc.blockRepo.Save(relayer.SaveBlockOpts{ - Height: events.Event.Raw.BlockNumber, - Hash: events.Event.Raw.BlockHash, - ChainID: chainID, - EventName: eventName, - }); err != nil { - return errors.Wrap(err, "svc.blockRepo.Save") - } - - return nil -} diff --git a/packages/relayer/indexer/handle_no_events_remaining_test.go b/packages/relayer/indexer/handle_no_events_remaining_test.go deleted file mode 100644 index c3c4cd4455..0000000000 --- a/packages/relayer/indexer/handle_no_events_remaining_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package indexer - -import ( - "context" - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/stretchr/testify/assert" - "github.com/taikoxyz/taiko-mono/packages/relayer/contracts" -) - -func Test_handleNoEventsRemaining(t *testing.T) { - tests := []struct { - name string - chainID *big.Int - events *contracts.BridgeMessageSentIterator - wantErr error - }{ - { - "success", - big.NewInt(167001), - &contracts.BridgeMessageSentIterator{ - Event: &contracts.BridgeMessageSent{ - Raw: types.Log{ - BlockNumber: 1, - }, - }, - }, - nil, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - svc, _ := newTestService() - err := svc.handleNoEventsRemaining(context.Background(), tt.chainID, tt.events) - assert.Equal(t, tt.wantErr, err) - }) - } -} diff --git a/packages/relayer/indexer/service.go b/packages/relayer/indexer/service.go index 72402cfdc9..1e3e732cf8 100644 --- a/packages/relayer/indexer/service.go +++ b/packages/relayer/indexer/service.go @@ -33,7 +33,7 @@ type Service struct { ethClient ethClient destRPC *rpc.Client - processingBlock *relayer.Block + processingBlockHeight uint64 bridge relayer.Bridge destBridge relayer.Bridge @@ -42,11 +42,11 @@ type Service struct { relayerAddr common.Address - errChan chan error - blockBatchSize uint64 numGoroutines int subscriptionBackoff time.Duration + + taikol1 *contracts.TaikoL1 } type NewServiceOpts struct { @@ -59,6 +59,7 @@ type NewServiceOpts struct { ECDSAKey string BridgeAddress common.Address DestBridgeAddress common.Address + SrcTaikoAddress common.Address DestTaikoAddress common.Address BlockBatchSize uint64 NumGoroutines int @@ -133,6 +134,14 @@ func NewService(opts NewServiceOpts) (*Service, error) { return nil, errors.Wrap(err, "contracts.NewV1TaikoL2") } + var taikoL1 *contracts.TaikoL1 + if opts.SrcTaikoAddress != ZeroAddress { + taikoL1, err = contracts.NewTaikoL1(opts.SrcTaikoAddress, opts.EthClient) + if err != nil { + return nil, errors.Wrap(err, "contracts.NewTaikoL1") + } + } + processor, err := message.NewProcessor(message.NewProcessorOpts{ Prover: prover, ECDSAKey: privateKey, @@ -157,13 +166,12 @@ func NewService(opts NewServiceOpts) (*Service, error) { bridge: bridge, destBridge: destBridge, + taikol1: taikoL1, processor: processor, relayerAddr: relayerAddr, - errChan: make(chan error), - blockBatchSize: opts.BlockBatchSize, numGoroutines: opts.NumGoroutines, subscriptionBackoff: opts.SubscriptionBackoff, diff --git a/packages/relayer/indexer/service_test.go b/packages/relayer/indexer/service_test.go index f39c9dcafe..2d3c6bc73b 100644 --- a/packages/relayer/indexer/service_test.go +++ b/packages/relayer/indexer/service_test.go @@ -47,9 +47,9 @@ func newTestService() (*Service, relayer.Bridge) { ethClient: &mock.EthClient{}, numGoroutines: 10, - processingBlock: &relayer.Block{}, - processor: processor, - blockBatchSize: 100, + processingBlockHeight: 0, + processor: processor, + blockBatchSize: 100, }, b } diff --git a/packages/relayer/indexer/set_initial_processing_block_by_mode.go b/packages/relayer/indexer/set_initial_processing_block_by_mode.go index b1dc20c28f..f29d831d8c 100644 --- a/packages/relayer/indexer/set_initial_processing_block_by_mode.go +++ b/packages/relayer/indexer/set_initial_processing_block_by_mode.go @@ -13,6 +13,17 @@ func (svc *Service) setInitialProcessingBlockByMode( mode relayer.Mode, chainID *big.Int, ) error { + var startingBlock uint64 = 0 + + if svc.taikol1 != nil { + genesis, _, _, _, err := svc.taikol1.GetStateVariables(nil) + if err != nil { + return errors.Wrap(err, "svc.taikoL1.GetStateVariables") + } + + startingBlock = genesis + } + switch mode { case relayer.SyncMode: // get most recently processed block height from the DB @@ -21,23 +32,18 @@ func (svc *Service) setInitialProcessingBlockByMode( chainID, ) if err != nil { - return errors.Wrap(err, "s.blockRepo.GetLatestBlock()") + return errors.Wrap(err, "svc.blockRepo.GetLatestBlock()") } - svc.processingBlock = latestProcessedBlock - - return nil - case relayer.ResyncMode: - header, err := svc.ethClient.HeaderByNumber(ctx, big.NewInt(0)) - if err != nil { - return errors.Wrap(err, "s.blockRepo.GetLatestBlock()") + if latestProcessedBlock.Height != 0 { + startingBlock = latestProcessedBlock.Height } - svc.processingBlock = &relayer.Block{ - Height: header.Number.Uint64(), - Hash: header.Hash().Hex(), - } + svc.processingBlockHeight = startingBlock + return nil + case relayer.ResyncMode: + svc.processingBlockHeight = startingBlock return nil default: return relayer.ErrInvalidMode diff --git a/packages/relayer/indexer/set_initial_processing_block_by_mode_test.go b/packages/relayer/indexer/set_initial_processing_block_by_mode_test.go index 1a3f848358..0f85fe2a2e 100644 --- a/packages/relayer/indexer/set_initial_processing_block_by_mode_test.go +++ b/packages/relayer/indexer/set_initial_processing_block_by_mode_test.go @@ -59,7 +59,7 @@ func Test_SetInitialProcessingBlockByMode(t *testing.T) { assert.Equal(t, tt.wantErr, err != nil) - assert.Equal(t, tt.wantHeight, svc.processingBlock.Height) + assert.Equal(t, tt.wantHeight, svc.processingBlockHeight) }) } } diff --git a/packages/relayer/indexer/subscribe.go b/packages/relayer/indexer/subscribe.go index 0656235d30..7d1a96216c 100644 --- a/packages/relayer/indexer/subscribe.go +++ b/packages/relayer/indexer/subscribe.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/pkg/errors" log "github.com/sirupsen/logrus" - "github.com/taikoxyz/taiko-mono/packages/relayer" "github.com/taikoxyz/taiko-mono/packages/relayer/contracts" "golang.org/x/sync/errgroup" ) @@ -17,15 +16,6 @@ import ( func (svc *Service) subscribe(ctx context.Context, chainID *big.Int) error { log.Info("subscribing to new events") - latestBlock, err := svc.ethClient.HeaderByNumber(ctx, nil) - if err != nil { - return errors.Wrap(err, "svc.ethClient.HeaderByNumber") - } - - svc.processingBlock = &relayer.Block{ - Height: latestBlock.Number.Uint64(), - } - sink := make(chan *contracts.BridgeMessageSent) sub := event.ResubscribeErr(svc.subscriptionBackoff, func(ctx context.Context, err error) (event.Subscription, error) { diff --git a/packages/relayer/repo/block.go b/packages/relayer/repo/block.go index f14b6d7dd3..3527206b06 100644 --- a/packages/relayer/repo/block.go +++ b/packages/relayer/repo/block.go @@ -27,7 +27,7 @@ func (r *BlockRepository) startQuery() *gorm.DB { func (r *BlockRepository) Save(opts relayer.SaveBlockOpts) error { exists := &relayer.Block{} - _ = r.startQuery().Where("block_height = ?", opts.Height).First(exists) + _ = r.startQuery().Where("block_height = ?", opts.Height).Where("chain_id = ?", opts.ChainID.Int64()).First(exists) // block procesed already if exists.Height == opts.Height { return nil