From 12ce79ea75be8d77ba49df658c41acea14d8a876 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 10 Apr 2024 12:55:27 +0800 Subject: [PATCH] feat(bindings): update Go contract bindings --- bindings/.githead | 2 +- bindings/gen_lib_proving.go | 33 +-------------------------------- cmd/flags/common.go | 3 ++- cmd/flags/prover.go | 2 +- prover/config.go | 9 ++++----- prover/prover.go | 3 +-- 6 files changed, 10 insertions(+), 42 deletions(-) diff --git a/bindings/.githead b/bindings/.githead index a71157525..c971e4a82 100644 --- a/bindings/.githead +++ b/bindings/.githead @@ -1 +1 @@ -2c63cb0c796495948f1dd887662044397394d852 +03d610d8a94e4f1ef52b4c3e5656ed9081b8585f diff --git a/bindings/gen_lib_proving.go b/bindings/gen_lib_proving.go index dbc4b7f1e..b81e5981e 100644 --- a/bindings/gen_lib_proving.go +++ b/bindings/gen_lib_proving.go @@ -31,7 +31,7 @@ var ( // LibProvingMetaData contains all meta data concerning the LibProving contract. var LibProvingMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"function\",\"name\":\"RETURN_LIVENESS_BOND\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContested\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProved\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_ALREADY_CONTESTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_ALREADY_PROVED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_CANNOT_CONTEST\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TRANSITION\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_MISSING_VERIFIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"inputs\":[]}]", + ABI: "[{\"type\":\"event\",\"name\":\"ProvingPaused\",\"inputs\":[{\"name\":\"paused\",\"type\":\"bool\",\"indexed\":false,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionContested\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"contester\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"contestBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransitionProved\",\"inputs\":[{\"name\":\"blockId\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"tran\",\"type\":\"tuple\",\"indexed\":false,\"internalType\":\"structTaikoData.Transition\",\"components\":[{\"name\":\"parentHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"blockHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"stateRoot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"graffiti\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"prover\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"validityBond\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"tier\",\"type\":\"uint16\",\"indexed\":false,\"internalType\":\"uint16\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"L1_ALREADY_CONTESTED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_ALREADY_PROVED\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_BLOCK_MISMATCH\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_CANNOT_CONTEST\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_BLOCK_ID\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_PAUSE_STATUS\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_INVALID_TRANSITION\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_MISSING_VERIFIER\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"inputs\":[]}]", } // LibProvingABI is the input ABI used to generate the binding from. @@ -180,37 +180,6 @@ func (_LibProving *LibProvingTransactorRaw) Transact(opts *bind.TransactOpts, me return _LibProving.Contract.contract.Transact(opts, method, params...) } -// RETURNLIVENESSBOND is a free data retrieval call binding the contract method 0x53712a96. -// -// Solidity: function RETURN_LIVENESS_BOND() view returns(bytes32) -func (_LibProving *LibProvingCaller) RETURNLIVENESSBOND(opts *bind.CallOpts) ([32]byte, error) { - var out []interface{} - err := _LibProving.contract.Call(opts, &out, "RETURN_LIVENESS_BOND") - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// RETURNLIVENESSBOND is a free data retrieval call binding the contract method 0x53712a96. -// -// Solidity: function RETURN_LIVENESS_BOND() view returns(bytes32) -func (_LibProving *LibProvingSession) RETURNLIVENESSBOND() ([32]byte, error) { - return _LibProving.Contract.RETURNLIVENESSBOND(&_LibProving.CallOpts) -} - -// RETURNLIVENESSBOND is a free data retrieval call binding the contract method 0x53712a96. -// -// Solidity: function RETURN_LIVENESS_BOND() view returns(bytes32) -func (_LibProving *LibProvingCallerSession) RETURNLIVENESSBOND() ([32]byte, error) { - return _LibProving.Contract.RETURNLIVENESSBOND(&_LibProving.CallOpts) -} - // LibProvingProvingPausedIterator is returned from FilterProvingPaused and is used to iterate over the raw logs and unpacked data for ProvingPaused events raised by the LibProving contract. type LibProvingProvingPausedIterator struct { Event *LibProvingProvingPaused // Event containing the contract specifics and raw log diff --git a/cmd/flags/common.go b/cmd/flags/common.go index 95a37a01e..1aeeda8ee 100644 --- a/cmd/flags/common.go +++ b/cmd/flags/common.go @@ -3,6 +3,7 @@ package flags import ( "time" + "github.com/cenkalti/backoff/v4" "github.com/urfave/cli/v2" ) @@ -119,7 +120,7 @@ var ( Name: "backoff.retryInterval", Usage: "Retry interval in seconds when there is an error", Category: commonCategory, - Value: 12 * time.Second, + Value: backoff.DefaultMaxInterval, } RPCTimeout = &cli.DurationFlag{ Name: "rpc.timeout", diff --git a/cmd/flags/prover.go b/cmd/flags/prover.go index 535c4da6f..b27fd0fdb 100644 --- a/cmd/flags/prover.go +++ b/cmd/flags/prover.go @@ -164,7 +164,7 @@ var ( // Confirmations specific flag BlockConfirmations = &cli.Uint64Flag{ Name: "prover.blockConfirmations", - Usage: "Confirmations to the latest l1 block before submitting a proof for a l2 block", + Usage: "Confirmations to the latest L1 block before submitting a proof for a L2 block", Value: 6, Category: proverCategory, } diff --git a/prover/config.go b/prover/config.go index 299cdc1af..a5cb9bd2c 100644 --- a/prover/config.go +++ b/prover/config.go @@ -100,21 +100,20 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { if err := c.Set(flags.ProveUnassignedBlocks.Name, "true"); err != nil { return nil, err } - if err := c.Set(flags.ContesterMode.Name, "true"); err != nil { return nil, err } - // l1 and l2 node version flags are required only if guardian prover + // L1 and L2 node version flags are required only if guardian prover if !c.IsSet(flags.L1NodeVersion.Name) { - return nil, errors.New("L1NodeVersion is required if guardian prover is set") + return nil, errors.New("--prover.l1NodeVersion flag is required if guardian prover is set") } - if !c.IsSet(flags.L2NodeVersion.Name) { - return nil, errors.New("L2NodeVersion is required if guardian prover is set") + return nil, errors.New("--prover.l2NodeVersion flag is required if guardian prover is set") } } + // If we are not running a guardian prover, a raiko host endpoint is required. if !c.IsSet(flags.GuardianProver.Name) && !c.IsSet(flags.RaikoHostEndpoint.Name) { return nil, fmt.Errorf("raiko host not provided") } diff --git a/prover/prover.go b/prover/prover.go index b37b597b8..72ff30c3c 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -444,8 +444,7 @@ func (p *Prover) withRetry(f func() error) { p.wg.Add(1) go func() { defer p.wg.Done() - err := backoff.Retry(f, p.backoff) - if err != nil { + if err := backoff.Retry(f, p.backoff); err != nil { log.Error("Operation failed", "error", err) } }()