Skip to content

Commit

Permalink
Add log prefix to validators to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Oct 5, 2023
1 parent cdb9771 commit a5c6929
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe("beacon node api", function () {

// To make BN communicate with EL, it needs to produce some blocks and for that need validators
const {validators} = await getAndInitDevValidators({
logPrefix: "Offline-BN",
node: bnElOffline,
validatorClientCount: 1,
validatorsPerClient: validatorCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("lightclient api", function () {
const genesisValidatorsRoot = Buffer.alloc(32, 0xaa);
const config = createBeaconConfig(chainConfig, genesisValidatorsRoot);
const testLoggerOpts: TestLoggerOpts = {level: LogLevel.info};
const loggerNodeA = testLogger("Node-A", testLoggerOpts);
const loggerNodeA = testLogger("lightclient-api", testLoggerOpts);
const validatorCount = 2;

let bn: BeaconNode;
Expand Down Expand Up @@ -54,6 +54,7 @@ describe("lightclient api", function () {
validators = (
await getAndInitDevValidators({
node: bn,
logPrefix: "lightclient-api",
validatorsPerClient: validatorCount,
validatorClientCount: 1,
startIndex: 0,
Expand Down
3 changes: 2 additions & 1 deletion packages/beacon-node/test/e2e/chain/lightclient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("chain / lightclient", function () {
},
};

const loggerNodeA = testLogger("Node", testLoggerOpts);
const loggerNodeA = testLogger("lightclientNode", testLoggerOpts);
const loggerLC = testLogger("LC", {...testLoggerOpts, level: LogLevel.debug});

const bn = await getDevBeaconNode({
Expand All @@ -89,6 +89,7 @@ describe("chain / lightclient", function () {

const {validators} = await getAndInitDevValidators({
node: bn,
logPrefix: "lightclientNode",
validatorsPerClient: validatorCount,
validatorClientCount,
startIndex: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe.skip("doppelganger / doppelganger test", function () {

async function createBNAndVC(config?: TestConfig): Promise<{beaconNode: BeaconNode; validators: Validator[]}> {
const testLoggerOpts: TestLoggerOpts = {level: LogLevel.info};
const loggerNodeA = testLogger("Node-A", testLoggerOpts);
const loggerNodeA = testLogger("doppelganger", testLoggerOpts);

const bn = await getDevBeaconNode({
params: beaconParams,
Expand All @@ -65,6 +65,7 @@ describe.skip("doppelganger / doppelganger test", function () {

const {validators: validatorsWithDoppelganger} = await getAndInitDevValidators({
node: bn,
logPrefix: "doppelganger",
validatorsPerClient: validatorCount,
validatorClientCount: 1,
startIndex: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe("sync / unknown block sync", function () {

const {validators} = await getAndInitDevValidators({
node: bn,
logPrefix: "UnknownSync",
validatorsPerClient: validatorCount,
validatorClientCount: 1,
startIndex: 0,
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/test/sim/4844-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {
const {data: bnIdentity} = await bn.api.node.getNetworkIdentity();

const {validators} = await getAndInitDevValidators({
logPrefix: "Node-A",
node: bn,
validatorsPerClient,
validatorClientCount,
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/test/sim/merge-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {
} as ValidatorProposerConfig;

const {validators} = await getAndInitDevValidators({
logPrefix: "Node-A",
node: bn,
validatorsPerClient,
validatorClientCount,
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/test/sim/mergemock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {
} as ValidatorProposerConfig;

const {validators} = await getAndInitDevValidators({
logPrefix: "mergemock",
node: bn,
validatorsPerClient,
validatorClientCount,
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/test/sim/withdrawal-interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ describe("executionEngine / ExecutionEngineHttp", function () {
} as ValidatorProposerConfig;

const {validators} = await getAndInitDevValidators({
logPrefix: "withdrawal-interop",
node: bn,
validatorsPerClient,
validatorClientCount,
Expand Down
4 changes: 3 additions & 1 deletion packages/beacon-node/test/utils/node/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {testLogger, TestLoggerOpts} from "../logger.js";

export async function getAndInitDevValidators({
node,
logPrefix,
validatorsPerClient = 8,
validatorClientCount = 1,
startIndex = 0,
Expand All @@ -20,6 +21,7 @@ export async function getAndInitDevValidators({
valProposerConfig,
}: {
node: BeaconNode;
logPrefix: string;
validatorsPerClient: number;
validatorClientCount: number;
startIndex: number;
Expand All @@ -36,7 +38,7 @@ export async function getAndInitDevValidators({
for (let clientIndex = 0; clientIndex < validatorClientCount; clientIndex++) {
const startIndexVc = startIndex + clientIndex * validatorsPerClient;
const endIndex = startIndexVc + validatorsPerClient - 1;
const logger = testLogger(`Vali ${startIndexVc}-${endIndex}`, testLoggerOpts);
const logger = testLogger(`${logPrefix}-VAL-${startIndexVc}-${endIndex}`, testLoggerOpts);
const tmpDir = tmp.dirSync({unsafeCleanup: true});
const db = await LevelDbController.create({name: tmpDir.name}, {logger});
const slashingProtection = new SlashingProtection(db);
Expand Down

0 comments on commit a5c6929

Please sign in to comment.