diff --git a/pkg/rpc/methods.go b/pkg/rpc/methods.go index bb9bf0d8a..72481f64f 100644 --- a/pkg/rpc/methods.go +++ b/pkg/rpc/methods.go @@ -26,7 +26,7 @@ var ( // syncProgressRecheckDelay is the time delay of rechecking the L2 execution engine's sync progress again, // if the previous check failed. syncProgressRecheckDelay = 12 * time.Second - waitL1OriginPollingInterval = 6 * time.Second + waitL1OriginPollingInterval = 3 * time.Second defaultWaitL1OriginTimeout = 3 * time.Minute minTxGasLimit = 21000 ) @@ -187,25 +187,25 @@ func (c *Client) WaitL1Origin(ctx context.Context, blockID *big.Int) (*rawdb.L1O } log.Debug("Start fetching L1Origin from L2 execution engine", "blockID", blockID) - - for { - select { - case <-ctxWithTimeout.Done(): + for ; true; <-ticker.C { + if ctxWithTimeout.Err() != nil { return nil, ctx.Err() - case <-ticker.C: - l1Origin, err = c.L2.L1OriginByID(ctxWithTimeout, blockID) - if err != nil { - log.Warn("Failed to fetch L1Origin from L2 execution engine", "blockID", blockID, "error", err) - continue - } + } - if l1Origin == nil { - continue - } + l1Origin, err = c.L2.L1OriginByID(ctxWithTimeout, blockID) + if err != nil { + log.Warn("L1Origin from L2 execution engine not found, keep retrying", "blockID", blockID, "error", err) + continue + } - return l1Origin, nil + if l1Origin == nil { + continue } + + return l1Origin, nil } + + return nil, fmt.Errorf("failed to fetch L1Origin from L2 execution engine, blockID: %d", blockID) } // GetPoolContent fetches the transactions list from L2 execution engine's transactions pool with given diff --git a/proposer/proposer.go b/proposer/proposer.go index f3ead44d7..5f55507a3 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -332,8 +332,8 @@ func (p *Proposer) updateProposingTicker() { if p.proposingInterval != nil { duration = *p.proposingInterval } else { - // Random number between 12 - 60 - randomSeconds := rand.Intn(60-11) + 12 + // Random number between 12 - 120 + randomSeconds := rand.Intn(120-11) + 12 duration = time.Duration(randomSeconds) * time.Second }