From ebd04b289f1500eddd83208deae3af7214823320 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 11:28:10 +0100 Subject: [PATCH 01/15] Add validator address to initialized log clean up add address to all validator logs modify default logging to parse in tagged log data fix types --- yarn-project/foundation/src/log/logger.ts | 21 ++++++++++++------- .../src/key_store/interface.ts | 8 +++++++ .../src/key_store/local_key_store.ts | 9 ++++++++ .../validator-client/src/validator.ts | 2 +- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 0f245882550..d008774f182 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -36,22 +36,27 @@ export type DebugLogger = Logger; * If DEBUG="[module]" env is set, will enable debug logging if the module matches. * Uses npm debug for debug level and console.error for other levels. * @param name - Name of the module. + * @param taggedLogData - Additional data to include in the log message. + * @usage createDebugLogger('aztec:validator', {validatorAddress: '0x1234...'}); + * // will always add the validator address to the log labels * @returns A debug logger. */ -export function createDebugLogger(name: string): DebugLogger { + + +export function createDebugLogger(name: string, taggedLogData?: LogData ): DebugLogger { const debugLogger = debug(name); + if (currentLevel === 'debug') debugLogger.enabled = true; const logger = { silent: () => {}, - error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), - warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, data), - info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, data), - verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, data), - debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, data), + error: (...args: any[]) => logWithDebug(debugLogger, 'error', {...args, ...taggedLogData}), + warn: (...args: any[]) => logWithDebug(debugLogger, 'warn', {...args, ...taggedLogData}), + info: (...args: any[]) => logWithDebug(debugLogger, 'info', {...args, ...taggedLogData}), + verbose: (...args: any[]) => logWithDebug(debugLogger, 'verbose', {...args, ...taggedLogData}), + debug: (...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), }; - return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, data), logger); + return Object.assign((...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), logger); } - /** A callback to capture all logs. */ export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void; diff --git a/yarn-project/validator-client/src/key_store/interface.ts b/yarn-project/validator-client/src/key_store/interface.ts index 2b96c90377b..9752f64f85d 100644 --- a/yarn-project/validator-client/src/key_store/interface.ts +++ b/yarn-project/validator-client/src/key_store/interface.ts @@ -6,6 +6,14 @@ import { type Signature } from '@aztec/foundation/eth-signature'; * A keystore interface that can be replaced with a local keystore / remote signer service */ export interface ValidatorKeyStore { + + /** + * Get the address of the signer + * + * @returns the address + */ + getAddress(): string; + sign(message: Buffer32): Promise; /** * Flavor of sign message that followed EIP-712 eth signed message prefix diff --git a/yarn-project/validator-client/src/key_store/local_key_store.ts b/yarn-project/validator-client/src/key_store/local_key_store.ts index 736ee361a45..75c7bd9f1c2 100644 --- a/yarn-project/validator-client/src/key_store/local_key_store.ts +++ b/yarn-project/validator-client/src/key_store/local_key_store.ts @@ -16,6 +16,15 @@ export class LocalKeyStore implements ValidatorKeyStore { this.signer = new Secp256k1Signer(privateKey); } + /** + * Get the address of the signer + * + * @returns the address + */ + public getAddress() { + return this.signer.address; + } + /** * Sign a message with the keystore private key * diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index 0124029c17b..a3fd67270b5 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -38,7 +38,7 @@ export class ValidatorClient implements Validator { private p2pClient: P2P, private attestationPoolingIntervalMs: number, private attestationWaitTimeoutMs: number, - private log = createDebugLogger('aztec:validator'), + private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress()}), ) { //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 From f5717a7094ee8a13a50b769881e2cde415511466 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 12:29:29 +0100 Subject: [PATCH 02/15] fix createDebugLogger --- yarn-project/foundation/src/log/logger.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index d008774f182..f179f7c2635 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -49,13 +49,13 @@ export function createDebugLogger(name: string, taggedLogData?: LogData ): Debug const logger = { silent: () => {}, - error: (...args: any[]) => logWithDebug(debugLogger, 'error', {...args, ...taggedLogData}), - warn: (...args: any[]) => logWithDebug(debugLogger, 'warn', {...args, ...taggedLogData}), - info: (...args: any[]) => logWithDebug(debugLogger, 'info', {...args, ...taggedLogData}), - verbose: (...args: any[]) => logWithDebug(debugLogger, 'verbose', {...args, ...taggedLogData}), - debug: (...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), + error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), + warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, {...data,...taggedLogData}), + info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, {...data,...taggedLogData} ), + verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, {...data,...taggedLogData}), + debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), }; - return Object.assign((...args: any[]) => logWithDebug(debugLogger, 'debug', {...args, ...taggedLogData}), logger); + return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), logger) } /** A callback to capture all logs. */ export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void; From 1a3f1cf746b3f0b9f752a8d5e08f148daa897538 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 13:08:47 +0100 Subject: [PATCH 03/15] clean up types --- yarn-project/validator-client/src/key_store/interface.ts | 3 ++- yarn-project/validator-client/src/validator.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/yarn-project/validator-client/src/key_store/interface.ts b/yarn-project/validator-client/src/key_store/interface.ts index 9752f64f85d..ad7c37b73f3 100644 --- a/yarn-project/validator-client/src/key_store/interface.ts +++ b/yarn-project/validator-client/src/key_store/interface.ts @@ -1,3 +1,4 @@ +import { EthAddress } from '@aztec/circuits.js'; import { type Buffer32 } from '@aztec/foundation/buffer'; import { type Signature } from '@aztec/foundation/eth-signature'; @@ -12,7 +13,7 @@ export interface ValidatorKeyStore { * * @returns the address */ - getAddress(): string; + getAddress(): EthAddress; sign(message: Buffer32): Promise; /** diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index a3fd67270b5..d0230ce6be7 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -2,7 +2,7 @@ import { type BlockAttestation, type BlockProposal, type TxHash } from '@aztec/c import { type Header } from '@aztec/circuits.js'; import { Buffer32 } from '@aztec/foundation/buffer'; import { type Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createDebugLogger, DebugLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type P2P } from '@aztec/p2p'; @@ -38,10 +38,11 @@ export class ValidatorClient implements Validator { private p2pClient: P2P, private attestationPoolingIntervalMs: number, private attestationWaitTimeoutMs: number, - private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress()}), + private log: DebugLogger, ) { //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 + this.log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}); this.validationService = new ValidationService(keyStore); this.log.verbose('Initialized validator'); } From 165c598f878e23792b6c28fd10f7f24b9ff43947 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 13:10:45 +0100 Subject: [PATCH 04/15] clean up --- yarn-project/foundation/src/log/logger.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index f179f7c2635..81f47bfd7e3 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -43,19 +43,22 @@ export type DebugLogger = Logger; */ -export function createDebugLogger(name: string, taggedLogData?: LogData ): DebugLogger { +export function createDebugLogger(name: string, fixedLogData?: LogData ): DebugLogger { const debugLogger = debug(name); if (currentLevel === 'debug') debugLogger.enabled = true; + const attatchFixedLogData = (data?: LogData) => ({ ...fixedLogData, ...data }); + + const logger = { silent: () => {}, error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), - warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, {...data,...taggedLogData}), - info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, {...data,...taggedLogData} ), - verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, {...data,...taggedLogData}), - debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), + warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, attatchFixedLogData(data)), + info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, attatchFixedLogData(data)), + verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, attatchFixedLogData(data)), + debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, attatchFixedLogData(data)), }; - return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, {...data,...taggedLogData}), logger) + return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, attatchFixedLogData(data)), logger) } /** A callback to capture all logs. */ export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void; From 296d64b929880ab96e45c333224b1c96a3fd3b8c Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 14:35:29 +0100 Subject: [PATCH 05/15] rebase --- yarn-project/validator-client/src/validator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index f7b238b066c..b19822d6580 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -2,7 +2,7 @@ import { type BlockAttestation, type BlockProposal, type TxHash } from '@aztec/c import { type Header } from '@aztec/circuits.js'; import { Buffer32 } from '@aztec/foundation/buffer'; import { type Fr } from '@aztec/foundation/fields'; -import { createDebugLogger, DebugLogger } from '@aztec/foundation/log'; +import { createDebugLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type P2P } from '@aztec/p2p'; import { type TelemetryClient, WithTracer } from '@aztec/telemetry-client'; @@ -39,14 +39,14 @@ export class ValidatorClient extends WithTracer implements Validator { private p2pClient: P2P, private attestationPoolingIntervalMs: number, private attestationWaitTimeoutMs: number, - private log: DebugLogger, telemetry: TelemetryClient, + private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}) ) { // Instatntiate tracer super(telemetry, 'Validator'); - this.log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}); //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 + //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 this.validationService = new ValidationService(keyStore); this.log.verbose('Initialized validator'); } @@ -180,4 +180,4 @@ function validatePrivateKey(privateKey: string): Buffer32 { } catch (error) { throw new InvalidValidatorPrivateKeyError(); } -} +} \ No newline at end of file From 4e0a9c22922310eccc438ab42f47369a3a8aa0ac Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 14:58:35 +0100 Subject: [PATCH 06/15] fix --- yarn-project/validator-client/src/validator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index b19822d6580..5851df9457f 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -40,7 +40,7 @@ export class ValidatorClient extends WithTracer implements Validator { private attestationPoolingIntervalMs: number, private attestationWaitTimeoutMs: number, telemetry: TelemetryClient, - private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}) + private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}), ) { // Instatntiate tracer super(telemetry, 'Validator'); From a9b8a0ef7e942533db37be9ae1444c956890dcb7 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 15:09:56 +0100 Subject: [PATCH 07/15] fix local keystore --- yarn-project/validator-client/src/key_store/local_key_store.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yarn-project/validator-client/src/key_store/local_key_store.ts b/yarn-project/validator-client/src/key_store/local_key_store.ts index 75c7bd9f1c2..8ccc70e23db 100644 --- a/yarn-project/validator-client/src/key_store/local_key_store.ts +++ b/yarn-project/validator-client/src/key_store/local_key_store.ts @@ -3,6 +3,7 @@ import { Secp256k1Signer } from '@aztec/foundation/crypto'; import { type Signature } from '@aztec/foundation/eth-signature'; import { type ValidatorKeyStore } from './interface.js'; +import { EthAddress } from '@aztec/foundation/eth-address'; /** * Local Key Store @@ -21,7 +22,7 @@ export class LocalKeyStore implements ValidatorKeyStore { * * @returns the address */ - public getAddress() { + public getAddress() : EthAddress { return this.signer.address; } From 7b2e97444c80cca2524771c169356ad6238bf57f Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 15:32:51 +0100 Subject: [PATCH 08/15] Tidy formatting --- yarn-project/foundation/src/log/logger.ts | 4 ++-- .../validator-client/src/key_store/local_key_store.ts | 2 +- yarn-project/validator-client/src/validator.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 81f47bfd7e3..502c312a92c 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -43,7 +43,7 @@ export type DebugLogger = Logger; */ -export function createDebugLogger(name: string, fixedLogData?: LogData ): DebugLogger { +export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLogger { const debugLogger = debug(name); if (currentLevel === 'debug') debugLogger.enabled = true; @@ -51,7 +51,7 @@ export function createDebugLogger(name: string, fixedLogData?: LogData ): DebugL const logger = { - silent: () => {}, + silent: () => { }, error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, attatchFixedLogData(data)), info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, attatchFixedLogData(data)), diff --git a/yarn-project/validator-client/src/key_store/local_key_store.ts b/yarn-project/validator-client/src/key_store/local_key_store.ts index 8ccc70e23db..cc047983c73 100644 --- a/yarn-project/validator-client/src/key_store/local_key_store.ts +++ b/yarn-project/validator-client/src/key_store/local_key_store.ts @@ -22,7 +22,7 @@ export class LocalKeyStore implements ValidatorKeyStore { * * @returns the address */ - public getAddress() : EthAddress { + public getAddress(): EthAddress { return this.signer.address; } diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index 5851df9457f..a46c919ada2 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -40,7 +40,7 @@ export class ValidatorClient extends WithTracer implements Validator { private attestationPoolingIntervalMs: number, private attestationWaitTimeoutMs: number, telemetry: TelemetryClient, - private log = createDebugLogger('aztec:validator', {validatorAddress: keyStore.getAddress().toString()}), + private log = createDebugLogger('aztec:validator', { validatorAddress: keyStore.getAddress().toString() }), ) { // Instatntiate tracer super(telemetry, 'Validator'); From a34847d25262ecb367cc1b950a5c940b7b0d8260 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 15:53:26 +0100 Subject: [PATCH 09/15] add validator logging --- yarn-project/foundation/src/log/logger.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 502c312a92c..51a886b7726 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -45,7 +45,9 @@ export type DebugLogger = Logger; export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLogger { const debugLogger = debug(name); - if (currentLevel === 'debug') debugLogger.enabled = true; + if (currentLevel === 'debug') { + debugLogger.enabled = true; + } const attatchFixedLogData = (data?: LogData) => ({ ...fixedLogData, ...data }); From 479139a4ba2c340e57aaeaf512cd8a1d97b18e1d Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 10 Oct 2024 10:57:34 -0400 Subject: [PATCH 10/15] formatting --- yarn-project/foundation/src/log/logger.ts | 9 +++++---- yarn-project/validator-client/src/key_store/interface.ts | 5 ++--- .../validator-client/src/key_store/local_key_store.ts | 2 +- yarn-project/validator-client/src/validator.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 51a886b7726..b90b8ef61cb 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -42,7 +42,6 @@ export type DebugLogger = Logger; * @returns A debug logger. */ - export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLogger { const debugLogger = debug(name); if (currentLevel === 'debug') { @@ -51,16 +50,18 @@ export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLo const attatchFixedLogData = (data?: LogData) => ({ ...fixedLogData, ...data }); - const logger = { - silent: () => { }, + silent: () => {}, error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, attatchFixedLogData(data)), info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, attatchFixedLogData(data)), verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, attatchFixedLogData(data)), debug: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, attatchFixedLogData(data)), }; - return Object.assign((msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, attatchFixedLogData(data)), logger) + return Object.assign( + (msg: string, data?: LogData) => logWithDebug(debugLogger, 'debug', msg, attatchFixedLogData(data)), + logger, + ); } /** A callback to capture all logs. */ export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void; diff --git a/yarn-project/validator-client/src/key_store/interface.ts b/yarn-project/validator-client/src/key_store/interface.ts index ad7c37b73f3..a3ded5580a1 100644 --- a/yarn-project/validator-client/src/key_store/interface.ts +++ b/yarn-project/validator-client/src/key_store/interface.ts @@ -1,4 +1,4 @@ -import { EthAddress } from '@aztec/circuits.js'; +import { type EthAddress } from '@aztec/circuits.js'; import { type Buffer32 } from '@aztec/foundation/buffer'; import { type Signature } from '@aztec/foundation/eth-signature'; @@ -7,8 +7,7 @@ import { type Signature } from '@aztec/foundation/eth-signature'; * A keystore interface that can be replaced with a local keystore / remote signer service */ export interface ValidatorKeyStore { - - /** + /** * Get the address of the signer * * @returns the address diff --git a/yarn-project/validator-client/src/key_store/local_key_store.ts b/yarn-project/validator-client/src/key_store/local_key_store.ts index cc047983c73..436bf4b0c33 100644 --- a/yarn-project/validator-client/src/key_store/local_key_store.ts +++ b/yarn-project/validator-client/src/key_store/local_key_store.ts @@ -1,9 +1,9 @@ import { type Buffer32 } from '@aztec/foundation/buffer'; import { Secp256k1Signer } from '@aztec/foundation/crypto'; +import { type EthAddress } from '@aztec/foundation/eth-address'; import { type Signature } from '@aztec/foundation/eth-signature'; import { type ValidatorKeyStore } from './interface.js'; -import { EthAddress } from '@aztec/foundation/eth-address'; /** * Local Key Store diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index a46c919ada2..da18c926a44 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -180,4 +180,4 @@ function validatePrivateKey(privateKey: string): Buffer32 { } catch (error) { throw new InvalidValidatorPrivateKeyError(); } -} \ No newline at end of file +} From c7b436388e6ec22ce6d2cd9e07e8c13e8666ad77 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 10 Oct 2024 10:59:26 -0400 Subject: [PATCH 11/15] enable debug logger --- yarn-project/foundation/src/log/logger.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index b90b8ef61cb..3af26b6fccc 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -44,9 +44,6 @@ export type DebugLogger = Logger; export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLogger { const debugLogger = debug(name); - if (currentLevel === 'debug') { - debugLogger.enabled = true; - } const attatchFixedLogData = (data?: LogData) => ({ ...fixedLogData, ...data }); From 9e46172c18e952956ea05ead15ad499f10476e74 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 10 Oct 2024 11:00:47 -0400 Subject: [PATCH 12/15] fix comments --- yarn-project/validator-client/src/validator.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index da18c926a44..2cd5c3f9645 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -42,9 +42,8 @@ export class ValidatorClient extends WithTracer implements Validator { telemetry: TelemetryClient, private log = createDebugLogger('aztec:validator', { validatorAddress: keyStore.getAddress().toString() }), ) { - // Instatntiate tracer + // Instantiate tracer super(telemetry, 'Validator'); - //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 //TODO: We need to setup and store all of the currently active validators https://github.com/AztecProtocol/aztec-packages/issues/7962 this.validationService = new ValidationService(keyStore); From 000e89e7d20d3b9bc54fac9de98b17c92410f773 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 16:29:51 +0100 Subject: [PATCH 13/15] add extra logs to error log --- yarn-project/foundation/src/log/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 3af26b6fccc..41bd8133175 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -49,7 +49,7 @@ export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLo const logger = { silent: () => {}, - error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), data), + error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), attatchFixedLogData(data)), warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, attatchFixedLogData(data)), info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, attatchFixedLogData(data)), verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, attatchFixedLogData(data)), From 65c7251bdf9d93e5b017ce04c6bf948ecd1da35c Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 10 Oct 2024 16:31:28 +0100 Subject: [PATCH 14/15] clean up comment --- yarn-project/foundation/src/log/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 41bd8133175..3a1bbdccccb 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -36,7 +36,7 @@ export type DebugLogger = Logger; * If DEBUG="[module]" env is set, will enable debug logging if the module matches. * Uses npm debug for debug level and console.error for other levels. * @param name - Name of the module. - * @param taggedLogData - Additional data to include in the log message. + * @param fixedLogData - Additional data to include in the log message. * @usage createDebugLogger('aztec:validator', {validatorAddress: '0x1234...'}); * // will always add the validator address to the log labels * @returns A debug logger. From c044b334639a908bbe8b708d9cdea5fce150df1e Mon Sep 17 00:00:00 2001 From: Rahul Kothari Date: Thu, 10 Oct 2024 15:45:49 +0000 Subject: [PATCH 15/15] fix formatting --- yarn-project/foundation/src/log/logger.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts index 3a1bbdccccb..9a0dd25cd4f 100644 --- a/yarn-project/foundation/src/log/logger.ts +++ b/yarn-project/foundation/src/log/logger.ts @@ -49,7 +49,8 @@ export function createDebugLogger(name: string, fixedLogData?: LogData): DebugLo const logger = { silent: () => {}, - error: (msg: string, err?: unknown, data?: LogData) => logWithDebug(debugLogger, 'error', fmtErr(msg, err), attatchFixedLogData(data)), + error: (msg: string, err?: unknown, data?: LogData) => + logWithDebug(debugLogger, 'error', fmtErr(msg, err), attatchFixedLogData(data)), warn: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'warn', msg, attatchFixedLogData(data)), info: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'info', msg, attatchFixedLogData(data)), verbose: (msg: string, data?: LogData) => logWithDebug(debugLogger, 'verbose', msg, attatchFixedLogData(data)),