From 80c6e786ed4c8b7cf71e0d61f723c18952e0f6a5 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 8 Nov 2023 11:53:02 +0100 Subject: [PATCH] feat: print out URLs of connected services --- packages/beacon-node/src/eth1/provider/eth1Provider.ts | 5 ++++- packages/beacon-node/src/execution/builder/http.ts | 9 ++++++++- packages/beacon-node/src/execution/builder/index.ts | 6 ++++-- packages/beacon-node/src/execution/engine/index.ts | 1 + packages/beacon-node/src/node/nodejs.ts | 2 +- packages/validator/src/validator.ts | 1 + 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/beacon-node/src/eth1/provider/eth1Provider.ts b/packages/beacon-node/src/eth1/provider/eth1Provider.ts index 151d729e66e..2d1feeb8d1e 100644 --- a/packages/beacon-node/src/eth1/provider/eth1Provider.ts +++ b/packages/beacon-node/src/eth1/provider/eth1Provider.ts @@ -73,7 +73,10 @@ export class Eth1Provider implements IEth1Provider { this.logger = opts.logger; this.deployBlock = opts.depositContractDeployBlock ?? 0; this.depositContractAddress = toHexString(config.DEPOSIT_CONTRACT_ADDRESS); - this.rpc = new JsonRpcHttpClient(opts.providerUrls ?? DEFAULT_PROVIDER_URLS, { + + const providerUrls = opts.providerUrls ?? DEFAULT_PROVIDER_URLS; + this.logger?.info("Eth1 provider", {urls: providerUrls.toString()}); + this.rpc = new JsonRpcHttpClient(providerUrls, { signal, // Don't fallback with is truncated error. Throw early and let the retry on this class handle it shouldNotFallback: isJsonRpcTruncatedError, diff --git a/packages/beacon-node/src/execution/builder/http.ts b/packages/beacon-node/src/execution/builder/http.ts index bfe003372ce..43710bca83e 100644 --- a/packages/beacon-node/src/execution/builder/http.ts +++ b/packages/beacon-node/src/execution/builder/http.ts @@ -6,6 +6,7 @@ import { reconstructFullBlockOrContents, } from "@lodestar/state-transition"; import {ChainForkConfig} from "@lodestar/config"; +import {Logger} from "@lodestar/logger"; import {getClient, Api as BuilderApi} from "@lodestar/api/builder"; import {SLOTS_PER_EPOCH, ForkExecution} from "@lodestar/params"; @@ -41,9 +42,15 @@ export class ExecutionBuilderHttp implements IExecutionBuilder { faultInspectionWindow: number; allowedFaults: number; - constructor(opts: ExecutionBuilderHttpOpts, config: ChainForkConfig, metrics: Metrics | null = null) { + constructor( + opts: ExecutionBuilderHttpOpts, + config: ChainForkConfig, + metrics: Metrics | null = null, + logger?: Logger + ) { const baseUrl = opts.urls[0]; if (!baseUrl) throw Error("No Url provided for executionBuilder"); + logger?.info("External builder", {urls: opts.urls.toString()}); this.api = getClient( { baseUrl, diff --git a/packages/beacon-node/src/execution/builder/index.ts b/packages/beacon-node/src/execution/builder/index.ts index 530d541f845..2f584ad7dad 100644 --- a/packages/beacon-node/src/execution/builder/index.ts +++ b/packages/beacon-node/src/execution/builder/index.ts @@ -1,4 +1,5 @@ import {ChainForkConfig} from "@lodestar/config"; +import {Logger} from "@lodestar/logger"; import {Metrics} from "../../metrics/metrics.js"; import {IExecutionBuilder} from "./interface.js"; @@ -12,11 +13,12 @@ export const defaultExecutionBuilderOpts: ExecutionBuilderOpts = defaultExecutio export function initializeExecutionBuilder( opts: ExecutionBuilderOpts, config: ChainForkConfig, - metrics: Metrics | null = null + metrics: Metrics | null = null, + logger?: Logger ): IExecutionBuilder { switch (opts.mode) { case "http": default: - return new ExecutionBuilderHttp(opts, config, metrics); + return new ExecutionBuilderHttp(opts, config, metrics, logger); } } diff --git a/packages/beacon-node/src/execution/engine/index.ts b/packages/beacon-node/src/execution/engine/index.ts index 743abf203de..1692ea61cf9 100644 --- a/packages/beacon-node/src/execution/engine/index.ts +++ b/packages/beacon-node/src/execution/engine/index.ts @@ -31,6 +31,7 @@ export function getExecutionEngineHttp( opts: ExecutionEngineHttpOpts, modules: ExecutionEngineModules ): IExecutionEngine { + modules.logger.info("Execution client", {urls: opts.urls.toString()}); const rpc = new JsonRpcHttpClient(opts.urls, { ...opts, signal: modules.signal, diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index 3c9f2ec0b54..da4f802a521 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -214,7 +214,7 @@ export class BeaconNode { logger: logger.child({module: LoggerModule.execution}), }), executionBuilder: opts.executionBuilder.enabled - ? initializeExecutionBuilder(opts.executionBuilder, config, metrics) + ? initializeExecutionBuilder(opts.executionBuilder, config, metrics, logger) : undefined, }); diff --git a/packages/validator/src/validator.ts b/packages/validator/src/validator.ts index 4b81aee44de..9cd5fda4ff3 100644 --- a/packages/validator/src/validator.ts +++ b/packages/validator/src/validator.ts @@ -266,6 +266,7 @@ export class Validator { let api: Api; if (typeof opts.api === "string" || Array.isArray(opts.api)) { const urls = typeof opts.api === "string" ? [opts.api] : opts.api; + logger.info("Beacon node", {urls: urls.toString()}); // This new api instance can make do with default timeout as a faster timeout is // not necessary since this instance won't be used for validator duties api = getClient({urls, getAbortSignal: () => opts.abortController.signal}, {config, logger});