diff --git a/op-batcher/batcher/driver.go b/op-batcher/batcher/driver.go index a2b2bd8812294..5021f1ff37c9e 100644 --- a/op-batcher/batcher/driver.go +++ b/op-batcher/batcher/driver.go @@ -248,6 +248,12 @@ func (l *BatchSubmitter) loadBlocksIntoState(ctx context.Context, start, end uin if end < start { return fmt.Errorf("start number is > end number %d,%d", start, end) } + + // we don't want to print it in the 1-block case as `loadBlockIntoState` already does + if end > start { + l.Log.Info("Loading range of multiple blocks into state", "start", start, "end", end) + } + var latestBlock *types.Block // Add all blocks to "state" for i := start; i <= end; i++ { diff --git a/op-service/client/rpc.go b/op-service/client/rpc.go index c37a4a53dd0e8..a1413d0d9d903 100644 --- a/op-service/client/rpc.go +++ b/op-service/client/rpc.go @@ -152,18 +152,22 @@ func dialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string, bOff = retry.Fixed(cfg.fixedDialBackoff) } return retry.Do(ctx, cfg.backoffAttempts, bOff, func() (*rpc.Client, error) { - if !IsURLAvailable(ctx, addr) { - log.Warn("failed to dial address, but may connect later", "addr", addr) - return nil, fmt.Errorf("address unavailable (%s)", addr) - } - client, err := rpc.DialOptions(ctx, addr, cfg.gethRPCOptions...) - if err != nil { - return nil, fmt.Errorf("failed to dial address (%s): %w", addr, err) - } - return client, nil + return CheckAndDial(ctx, log, addr, cfg.gethRPCOptions...) }) } +func CheckAndDial(ctx context.Context, log log.Logger, addr string, options ...rpc.ClientOption) (*rpc.Client, error) { + if !IsURLAvailable(ctx, addr) { + log.Warn("failed to dial address, but may connect later", "addr", addr) + return nil, fmt.Errorf("address unavailable (%s)", addr) + } + client, err := rpc.DialOptions(ctx, addr, options...) + if err != nil { + return nil, fmt.Errorf("failed to dial address (%s): %w", addr, err) + } + return client, nil +} + func IsURLAvailable(ctx context.Context, address string) bool { u, err := url.Parse(address) if err != nil { diff --git a/op-service/dial/dial.go b/op-service/dial/dial.go index ee7ca35e5882e..4bd38333189d1 100644 --- a/op-service/dial/dial.go +++ b/op-service/dial/dial.go @@ -2,7 +2,6 @@ package dial import ( "context" - "fmt" "time" "github.com/ethereum-optimism/optimism/op-service/client" @@ -72,13 +71,5 @@ func dialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string) // Dials a JSON-RPC endpoint once. func dialRPCClient(ctx context.Context, log log.Logger, addr string) (*rpc.Client, error) { - if !client.IsURLAvailable(ctx, addr) { - log.Warn("failed to dial address, but may connect later", "addr", addr) - return nil, fmt.Errorf("address unavailable (%s)", addr) - } - client, err := rpc.DialOptions(ctx, addr) - if err != nil { - return nil, fmt.Errorf("failed to dial address (%s): %w", addr, err) - } - return client, nil + return client.CheckAndDial(ctx, log, addr) }