diff --git a/op-batcher/batcher/service.go b/op-batcher/batcher/service.go index 6ce56fca7386..1b6e849bb5f3 100644 --- a/op-batcher/batcher/service.go +++ b/op-batcher/batcher/service.go @@ -121,13 +121,13 @@ func (bs *BatcherService) initRPCClients(ctx context.Context, cfg *CLIConfig) er if err != nil { return fmt.Errorf("failed to dial L1 RPC: %w", err) } - bs.L1Client = client.NewInstrumentedClientWithClient(l1Client, bs.Metrics) + bs.L1Client = client.NewInstrumentedClient(l1Client, bs.Metrics) l2Client, err := dial.DialEthClientWithTimeout(ctx, dial.DefaultDialTimeout, bs.Log, cfg.L2EthRpc) if err != nil { return fmt.Errorf("failed to dial L2 engine RPC: %w", err) } - bs.L2Client = client.NewInstrumentedClientWithClient(l2Client, bs.Metrics) + bs.L2Client = client.NewInstrumentedClient(l2Client, bs.Metrics) rollupClient, err := dial.DialRollupClientWithTimeout(ctx, dial.DefaultDialTimeout, bs.Log, cfg.RollupRpc) if err != nil { diff --git a/op-proposer/proposer/l2_output_submitter.go b/op-proposer/proposer/l2_output_submitter.go index 40a86023a299..0f46dbbeddb9 100644 --- a/op-proposer/proposer/l2_output_submitter.go +++ b/op-proposer/proposer/l2_output_submitter.go @@ -177,7 +177,7 @@ func NewL2OutputSubmitterConfigFromCLIConfig(cfg CLIConfig, l log.Logger, m metr if err != nil { return nil, err } - l1Client = client.NewInstrumentedClientWithClient(l1Client, m) + l1Client = client.NewInstrumentedClient(l1Client, m) rollupClient, err := dial.DialRollupClientWithTimeout(context.Background(), dial.DefaultDialTimeout, l, cfg.RollupRpc) if err != nil { diff --git a/op-service/client/client.go b/op-service/client/client.go index c2f37db0124e..e7f5742de9f2 100644 --- a/op-service/client/client.go +++ b/op-service/client/client.go @@ -4,12 +4,9 @@ import ( "context" "math/big" - "github.com/ethereum-optimism/optimism/op-node/metrics" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rpc" ) type Client interface { @@ -60,17 +57,7 @@ type Metricer interface { RecordRPCClientRequest(method string) func(err error) } -// NewInstrumentedClient creates a new instrumented client. It takes -// a concrete *rpc.Client to prevent people from passing in an already -// instrumented client. -func NewInstrumentedClient(c *rpc.Client, m *metrics.Metrics) *InstrumentedClient { - return &InstrumentedClient{ - c: ethclient.NewClient(c), - m: m, - } -} - -func NewInstrumentedClientWithClient(c Client, m Metricer) *InstrumentedClient { +func NewInstrumentedClient(c Client, m Metricer) *InstrumentedClient { return &InstrumentedClient{ c: c, m: m, diff --git a/op-service/txmgr/cli.go b/op-service/txmgr/cli.go index 37918552ac9d..9e71734cb28a 100644 --- a/op-service/txmgr/cli.go +++ b/op-service/txmgr/cli.go @@ -256,7 +256,7 @@ func NewConfig(cfg CLIConfig, l log.Logger, m txmetrics.TxMetricer) (Config, err if err != nil { return Config{}, fmt.Errorf("could not dial eth client: %w", err) } - l1 = client.NewInstrumentedClientWithClient(l1, m) + l1 = client.NewInstrumentedClient(l1, m) ctx, cancel = context.WithTimeout(context.Background(), cfg.NetworkTimeout) defer cancel()