Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add info logs for connected services URLS #6088

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/cli/src/cmds/beacon/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {BeaconArgs} from "./options.js";
import {getBeaconPaths} from "./paths.js";
import {initBeaconState} from "./initBeaconState.js";
import {initPeerIdAndEnr} from "./initPeerIdAndEnr.js";
import {logArguments} from "./logArguments.js";

const DEFAULT_RETENTION_SSZ_OBJECTS_HOURS = 15 * 24;
const HOURS_TO_MS = 3600 * 1000;
Expand Down Expand Up @@ -208,6 +209,8 @@ export async function beaconHandlerInit(args: BeaconArgs & GlobalArgs) {
// Render final options
const options = beaconNodeOptions.getWithDefaults();

logArguments(logger, args);

return {config, options, beaconPaths, network, version, commit, peerId, logger};
}

Expand Down
35 changes: 35 additions & 0 deletions packages/cli/src/cmds/beacon/logArguments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {LogLevel, Logger} from "@lodestar/utils";
import {GlobalArgs} from "../../options/index.js";
import {BeaconArgs} from "./options.js";

/**
* Log urls from CLI arguments for execution.urls, eth1.providerUrls and builder.urls
*/
export function logArguments(logger: Pick<Logger, LogLevel.info>, args: BeaconArgs & GlobalArgs): void {
const executionUrls = args["execution.urls"];

if (executionUrls?.length > 0) {
logger.info(`Total execution urls: ${executionUrls.length}`);
executionUrls.forEach((url, index) => {
logger.info(`Execution url (${index + 1}): ${url}`);
});
}

const eth1ProviderUrls = args["eth1.providerUrls"];

if (eth1ProviderUrls && eth1ProviderUrls?.length > 0) {
logger.info(`Total eth1 provider urls: ${eth1ProviderUrls.length}`);
eth1ProviderUrls.forEach((url, index) => {
logger.info(`Eth1 provider url (${index + 1}): ${url}`);
});
}

const builderUrls = args["builder.urls"];

if (builderUrls && builderUrls?.length > 0) {
logger.info(`Total builder url(s): ${builderUrls.length}`);
builderUrls.forEach((url, index) => {
logger.info(`Builder url (${index + 1}): ${url}`);
});
}
}
2 changes: 2 additions & 0 deletions packages/cli/src/cmds/validator/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {KeymanagerApi} from "./keymanager/impl.js";
import {PersistedKeysBackend} from "./keymanager/persistedKeys.js";
import {IPersistedKeysBackend} from "./keymanager/interface.js";
import {KeymanagerRestApiServer} from "./keymanager/server.js";
import {logArguments} from "./logArguments.js";

/**
* Runs a validator client.
Expand Down Expand Up @@ -102,6 +103,7 @@ export async function validatorHandler(args: IValidatorCliArgs & GlobalArgs): Pr
}

logSigners(logger, signers);
logArguments(logger, args);

const db = await LevelDbController.create({name: dbPath}, {metrics: null, logger});
onGracefulShutdownCbs.push(() => db.close());
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/cmds/validator/logArguments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {LogLevel, Logger} from "@lodestar/utils";
import {GlobalArgs} from "../../options/index.js";
import {IValidatorCliArgs} from "./options.js";

/**
* Log beacon node urls
*/
export function logArguments(logger: Pick<Logger, LogLevel.info>, args: IValidatorCliArgs & GlobalArgs): void {
const beaconNodes = args["beaconNodes"];

if (beaconNodes?.length > 0) {
logger.info(`${beaconNodes.length} beacon nodes`);
beaconNodes.forEach((url, index) => {
logger.info(`Beacon node url ${index + 1}: ${url}`);
});
}
}