diff --git a/README.md b/README.md index 83a2d819572c..7b2c6d3c5ea4 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ This provide an interactive environment for debugging the CI test. ## Debugging -Logging goes through the [DebugLogger](yarn-project/foundation/src/log/debug.ts) module in Typescript. To see the log output, set a `DEBUG` environment variable to the name of the module you want to debug, to `aztec:*`, or to `*` to see all logs. +Logging goes through the [DebugLogger](yarn-project/foundation/src/log/debug.ts) module in Typescript. `LOG_LEVEL` controls the default log level, and one can set alternate levels for specific modules, such as `debug; warn: module1, module2; error: module3`. ## Releases diff --git a/aztec-up/bin/.aztec-run b/aztec-up/bin/.aztec-run index a7ab48a53131..142e71fb75ca 100755 --- a/aztec-up/bin/.aztec-run +++ b/aztec-up/bin/.aztec-run @@ -104,8 +104,8 @@ while [[ "$#" -gt 0 ]]; do done DOCKER_ENV="-e HOME=$HOME" -if ! [ -z "${DEBUG:-}" ] ; then - DOCKER_ENV="-e DEBUG=$DEBUG" +if ! [ -z "${LOG_LEVEL:-}" ] ; then + DOCKER_ENV="-e LOG_LEVEL=$LOG_LEVEL" fi for env in ${ENV_VARS_TO_INJECT:-}; do # SSH_AUTH_SOCK must be handled separately diff --git a/aztec-up/bin/docker-compose.sandbox.yml b/aztec-up/bin/docker-compose.sandbox.yml index 39d6ff203199..186ba3dec698 100644 --- a/aztec-up/bin/docker-compose.sandbox.yml +++ b/aztec-up/bin/docker-compose.sandbox.yml @@ -20,7 +20,7 @@ services: ports: - "${PXE_PORT:-8080}:${PXE_PORT:-8080}" environment: - DEBUG: # Loaded from the user shell if explicitly set + LOG_LEVEL: # Loaded from the user shell if explicitly set HOST_WORKDIR: "${PWD}" # Loaded from the user shell to show log files absolute path in host ETHEREUM_HOST: ${ETHEREUM_HOST:-http://ethereum}:${ANVIL_PORT:-8545} L1_CHAIN_ID: 31337 diff --git a/aztec-up/bin/docker-compose.test.yml b/aztec-up/bin/docker-compose.test.yml index 796e4c69b5a2..d3ad459b9de8 100644 --- a/aztec-up/bin/docker-compose.test.yml +++ b/aztec-up/bin/docker-compose.test.yml @@ -2,7 +2,6 @@ services: txe: image: "aztecprotocol/aztec" environment: - DEBUG: # Loaded from the user shell if explicitly set LOG_LEVEL: # Loaded from the user shell if explicitly set HOST_WORKDIR: "${PWD}" # Loaded from the user shell to show log files absolute path in host volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 12d365c8e039..c0928538e49f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,8 +6,6 @@ services: platform: linux/amd64 environment: LOG_LEVEL: ${LOG_LEVEL:-info} - DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton} - DEBUG_COLORS: 1 L1_CHAIN_ID: 31337 VERSION: 1 PXE_PROVER_ENABLED: ${PXE_PROVER_ENABLED:-1} @@ -38,8 +36,6 @@ services: platform: linux/amd64 environment: LOG_LEVEL: ${LOG_LEVEL:-info} - DEBUG: ${DEBUG:-aztec:*,-json-rpc:*,-aztec:circuits:artifact_hash,-aztec:randomness_singleton,-aztec:avm_simulator:*} - DEBUG_COLORS: 1 L1_CHAIN_ID: 31337 VERSION: 1 NODE_NO_WARNINGS: 1 diff --git a/docs/docs/migration_notes.md b/docs/docs/migration_notes.md index bb841a9952ed..ec28ac22ecc9 100644 --- a/docs/docs/migration_notes.md +++ b/docs/docs/migration_notes.md @@ -6,6 +6,35 @@ keywords: [sandbox, aztec, notes, migration, updating, upgrading] Aztec is in full-speed development. Literally every version breaks compatibility with the previous ones. This page attempts to target errors and difficulties you might encounter when upgrading, and how to resolve them. +## 0.66 + +### DEBUG env var is removed + +The `DEBUG` variable is no longer used. Use `LOG_LEVEL` with one of `silent`, `fatal`, `error`, `warn`, `info`, `verbose`, `debug`, or `trace`. To tweak log levels per module, add a list of module prefixes with their overridden level. For example, LOG_LEVEL="info; verbose: aztec:sequencer, aztec:archiver; debug: aztec:kv-store" sets `info` as the default log level, `verbose` for the sequencer and archiver, and `debug` for the kv-store. Module name match is done by prefix. + +### `tty` resolve fallback required for browser bundling + +When bundling `aztec.js` for web, the `tty` package now needs to be specified as an empty fallback: + +```diff +resolve: { + plugins: [new ResolveTypeScriptPlugin()], + alias: { './node/index.js': false }, + fallback: { + crypto: false, + os: false, + fs: false, + path: false, + url: false, ++ tty: false, + worker_threads: false, + buffer: require.resolve('buffer/'), + util: require.resolve('util/'), + stream: require.resolve('stream-browserify'), + }, +}, +``` + ## 0.65 ### [aztec.nr] Removed SharedImmutable diff --git a/docs/docs/reference/developer_references/debugging.md b/docs/docs/reference/developer_references/debugging.md index 01b8d6d06aaa..edb5c05ae10c 100644 --- a/docs/docs/reference/developer_references/debugging.md +++ b/docs/docs/reference/developer_references/debugging.md @@ -53,7 +53,7 @@ debug_log_array(my_array); ### Start Sandbox in debug mode -Update the `DEBUG` environment variable in docker-compose.sandbox.yml to the following: +Set `LOG_LEVEL` to `verbose` or `debug`: ```yml # ~/.aztec/docker-compose.sandbox.yml @@ -65,8 +65,7 @@ aztec: ports: - "${PXE_PORT:-8080}:${PXE_PORT:-8080}" environment: - DEBUG: aztec:simulator:client_execution_context, aztec:sandbox, aztec:avm_simulator:debug_log - LOG_LEVEL: verbose # optionally add this for more logs + LOG_LEVEL: verbose # ... ``` diff --git a/spartan/aztec-network/templates/deploy-l1-verifier.yaml b/spartan/aztec-network/templates/deploy-l1-verifier.yaml index 8866dd1ca09a..4da0eda45076 100644 --- a/spartan/aztec-network/templates/deploy-l1-verifier.yaml +++ b/spartan/aztec-network/templates/deploy-l1-verifier.yaml @@ -62,8 +62,6 @@ spec: env: - name: NODE_NO_WARNINGS value: "1" - - name: DEBUG - value: "aztec:*" - name: LOG_LEVEL value: "debug" - name: L1_CHAIN_ID diff --git a/spartan/aztec-network/templates/prover-agent.yaml b/spartan/aztec-network/templates/prover-agent.yaml index a4517c7a5030..fee445c68aab 100644 --- a/spartan/aztec-network/templates/prover-agent.yaml +++ b/spartan/aztec-network/templates/prover-agent.yaml @@ -85,8 +85,6 @@ spec: value: "{{ .Values.proverAgent.logLevel }}" - name: LOG_JSON value: "1" - - name: DEBUG - value: "{{ .Values.proverAgent.debug }}" - name: PROVER_REAL_PROOFS value: "{{ .Values.aztec.realProofs }}" - name: PROVER_AGENT_COUNT diff --git a/spartan/aztec-network/templates/prover-broker.yaml b/spartan/aztec-network/templates/prover-broker.yaml index 214b6720fcef..1de2caa4fcda 100644 --- a/spartan/aztec-network/templates/prover-broker.yaml +++ b/spartan/aztec-network/templates/prover-broker.yaml @@ -66,8 +66,6 @@ spec: value: "{{ .Values.proverBroker.logLevel }}" - name: LOG_JSON value: "1" - - name: DEBUG - value: "{{ .Values.proverBroker.debug }}" - name: PROVER_BROKER_POLL_INTERVAL_MS value: "{{ .Values.proverBroker.pollIntervalMs }}" - name: PROVER_BROKER_JOB_TIMEOUT_MS diff --git a/spartan/aztec-network/templates/pxe.yaml b/spartan/aztec-network/templates/pxe.yaml index bb15f206c2df..553f6699e6d2 100644 --- a/spartan/aztec-network/templates/pxe.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -84,8 +84,6 @@ spec: value: "1" - name: LOG_LEVEL value: "{{ .Values.pxe.logLevel }}" - - name: DEBUG - value: "{{ .Values.pxe.debug }}" - name: PXE_PROVER_ENABLED value: "{{ .Values.aztec.realProofs }}" ports: diff --git a/spartan/aztec-network/templates/setup-l2-contracts.yaml b/spartan/aztec-network/templates/setup-l2-contracts.yaml index 56cf8fc57f2a..2d4383423da9 100644 --- a/spartan/aztec-network/templates/setup-l2-contracts.yaml +++ b/spartan/aztec-network/templates/setup-l2-contracts.yaml @@ -61,8 +61,6 @@ spec: node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js setup-protocol-contracts --skipProofWait --l1-chain-id {{ .Values.ethereum.chainId }} echo "L2 contracts initialized" env: - - name: DEBUG - value: "aztec:*" - name: LOG_LEVEL value: "debug" - name: NETWORK_PUBLIC diff --git a/spartan/aztec-network/templates/transaction-bot.yaml b/spartan/aztec-network/templates/transaction-bot.yaml index 762c6bd7c07e..3981ad5d3f95 100644 --- a/spartan/aztec-network/templates/transaction-bot.yaml +++ b/spartan/aztec-network/templates/transaction-bot.yaml @@ -79,8 +79,6 @@ spec: value: "1" - name: LOG_LEVEL value: "{{ .Values.bot.logLevel }}" - - name: DEBUG - value: "{{ .Values.bot.debug }}" - name: BOT_PRIVATE_KEY value: "{{ .Values.bot.botPrivateKey }}" - name: BOT_TX_INTERVAL_SECONDS diff --git a/spartan/aztec-network/values.yaml b/spartan/aztec-network/values.yaml index fbc957e802f3..125f38278f55 100644 --- a/spartan/aztec-network/values.yaml +++ b/spartan/aztec-network/values.yaml @@ -44,7 +44,7 @@ bootNode: p2pUdpPort: 40400 nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" + debug: "" coinbaseAddress: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" sequencer: maxSecondsBetweenBlocks: 0 @@ -87,7 +87,7 @@ validator: p2pUdpPort: 40400 nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" + debug: "" sequencer: maxSecondsBetweenBlocks: 0 minTxsPerBlock: 1 @@ -117,7 +117,7 @@ proverNode: p2pUdpPort: 40400 nodePort: 8080 logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" + debug: "" proverAgent: count: 0 pollIntervalMs: 1000 @@ -136,7 +136,6 @@ proverNode: pxe: logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" replicas: 1 service: nodePort: 8081 @@ -155,7 +154,6 @@ bot: enabled: true nodeUrl: "" logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:database" replicas: 1 botPrivateKey: "0xcafe" txIntervalSeconds: 24 @@ -216,7 +214,6 @@ proverAgent: gke: spotEnabled: false logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" bb: hardwareConcurrency: "" nodeSelector: {} @@ -232,7 +229,6 @@ proverBroker: jobMaxRetries: 3 dataDirectory: "" logLevel: "debug" - debug: "aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*" nodeSelector: {} resources: {} diff --git a/spartan/aztec-network/values/prover-node-with-agents.yaml b/spartan/aztec-network/values/prover-node-with-agents.yaml index a1b981a5fc91..c5dbfa010def 100644 --- a/spartan/aztec-network/values/prover-node-with-agents.yaml +++ b/spartan/aztec-network/values/prover-node-with-agents.yaml @@ -12,7 +12,7 @@ validator: external: true bootNode: - debug: "aztec:*,-aztec:avm_simulator:*,-aztec:world-state:database,discv5:*,-JsonProxy:*" + debug: "discv5:*" validator: disabled: true diff --git a/spartan/releases/rough-rhino/aztec-spartan.sh b/spartan/releases/rough-rhino/aztec-spartan.sh index 5198a7bf78c8..6513a949c209 100755 --- a/spartan/releases/rough-rhino/aztec-spartan.sh +++ b/spartan/releases/rough-rhino/aztec-spartan.sh @@ -178,7 +178,6 @@ services: - VALIDATOR_PRIVATE_KEY=${KEY} - SEQ_PUBLISHER_PRIVATE_KEY=${KEY} - L1_PRIVATE_KEY=${KEY} - - DEBUG=aztec:*,-aztec:avm_simulator*,-aztec:circuits:artifact_hash,-aztec:libp2p_service,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream* - LOG_LEVEL=debug - AZTEC_PORT=${PORT} - P2P_ENABLED=true diff --git a/spartan/testnet-runbook.md b/spartan/testnet-runbook.md index 30a224a33cf2..f9b7dbc45582 100644 --- a/spartan/testnet-runbook.md +++ b/spartan/testnet-runbook.md @@ -45,7 +45,6 @@ Verbose logging on Aztec nodes should be enabled by default using the following - `LOG_JSON=1` - `LOG_LEVEL=debug` -- `DEBUG=discv5*,aztec:*,-aztec:avm_simulator*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:world-state:database,-aztec:l2_block_stream*` Deployments are initiated from CI by manually running the (_name pending_) workflow. diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index c25214fc97a6..c937bc7f915e 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -302,15 +302,16 @@ test: run-e2e: ARG test + ARG log_level="" ARG debug="" FROM +end-to-end - RUN DEBUG=$debug yarn test $test + RUN DEBUG=$debug LOG_LEVEL=$log_level yarn test $test prover-client-test: FROM +build ARG test - ARG debug="" - RUN cd prover-client && DEBUG=$debug yarn test $test + ARG log_level="" + RUN cd prover-client && LOG_LEVEL=$log_level yarn test $test # NOTE: This is not in the end-to-end Earthfile as that is entirely LOCALLY commands that will go away sometime. # Running this inside the main builder as the point is not to run this through dockerization. diff --git a/yarn-project/archiver/src/archiver/archiver.ts b/yarn-project/archiver/src/archiver/archiver.ts index 94c664d0f114..a2abac5e0a21 100644 --- a/yarn-project/archiver/src/archiver/archiver.ts +++ b/yarn-project/archiver/src/archiver/archiver.ts @@ -35,7 +35,7 @@ import { type ContractArtifact } from '@aztec/foundation/abi'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; import { type EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { count } from '@aztec/foundation/string'; import { Timer } from '@aztec/foundation/timer'; @@ -119,7 +119,7 @@ export class Archiver implements ArchiveSource { private readonly pollingIntervalMs: number, private readonly instrumentation: ArchiverInstrumentation, private readonly l1constants: L1RollupConstants = EmptyL1RollupConstants, - private readonly log: DebugLogger = createDebugLogger('aztec:archiver'), + private readonly log: Logger = createLogger('archiver'), ) { this.store = new ArchiverStoreHelper(dataStore); @@ -805,7 +805,7 @@ class ArchiverStoreHelper | 'addFunctions' > { - #log = createDebugLogger('aztec:archiver:block-helper'); + #log = createLogger('archiver:block-helper'); constructor(private readonly store: ArchiverDataStore) {} diff --git a/yarn-project/archiver/src/archiver/data_retrieval.ts b/yarn-project/archiver/src/archiver/data_retrieval.ts index 3249a5fc541a..3074e0906e88 100644 --- a/yarn-project/archiver/src/archiver/data_retrieval.ts +++ b/yarn-project/archiver/src/archiver/data_retrieval.ts @@ -2,7 +2,7 @@ import { Body, InboxLeaf, L2Block } from '@aztec/circuit-types'; import { AppendOnlyTreeSnapshot, Fr, Header, Proof } from '@aztec/circuits.js'; import { type EthAddress } from '@aztec/foundation/eth-address'; import { type ViemSignature } from '@aztec/foundation/eth-signature'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { numToUInt32BE } from '@aztec/foundation/serialize'; import { type InboxAbi, RollupAbi } from '@aztec/l1-artifacts'; @@ -37,7 +37,7 @@ export async function retrieveBlockFromRollup( blockUntilSynced: boolean, searchStartBlock: bigint, searchEndBlock: bigint, - logger: DebugLogger = createDebugLogger('aztec:archiver'), + logger: Logger = createLogger('archiver'), ): Promise[]> { const retrievedBlocks: L1Published[] = []; do { @@ -79,7 +79,7 @@ export async function processL2BlockProposedLogs( rollup: GetContractReturnType>, publicClient: PublicClient, logs: GetContractEventsReturnType, - logger: DebugLogger, + logger: Logger, ): Promise[]> { const retrievedBlocks: L1Published[] = []; for (const log of logs) { diff --git a/yarn-project/archiver/src/archiver/instrumentation.ts b/yarn-project/archiver/src/archiver/instrumentation.ts index 1d6343b8f9dd..57c5b3a3e770 100644 --- a/yarn-project/archiver/src/archiver/instrumentation.ts +++ b/yarn-project/archiver/src/archiver/instrumentation.ts @@ -1,5 +1,5 @@ import { type L2Block } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { Attributes, type Gauge, @@ -21,7 +21,7 @@ export class ArchiverInstrumentation { private proofsSubmittedCount: UpDownCounter; private dbMetrics: LmdbMetrics; - private log = createDebugLogger('aztec:archiver:instrumentation'); + private log = createLogger('archiver:instrumentation'); constructor(private telemetry: TelemetryClient) { const meter = telemetry.getMeter('Archiver'); diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/block_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/block_store.ts index 3d15de3fbbb8..6ca9eaa95c73 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/block_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/block_store.ts @@ -1,6 +1,6 @@ import { Body, type InBlock, L2Block, L2BlockHash, type TxEffect, type TxHash, TxReceipt } from '@aztec/circuit-types'; import { AppendOnlyTreeSnapshot, type AztecAddress, Header, INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton, type Range } from '@aztec/kv-store'; import { type L1Published, type L1PublishedData } from '../structs/published.js'; @@ -38,7 +38,7 @@ export class BlockStore { /** Index mapping a contract's address (as a string) to its location in a block */ #contractIndex: AztecMap; - #log = createDebugLogger('aztec:archiver:block_store'); + #log = createLogger('archiver:block_store'); constructor(private db: AztecKVStore) { this.#blocks = db.openMap('archiver_blocks'); diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts index 618abf9cbfde..caaf82053f62 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts @@ -19,7 +19,7 @@ import { } from '@aztec/circuits.js'; import { type ContractArtifact, FunctionSelector } from '@aztec/foundation/abi'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore } from '@aztec/kv-store'; import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js'; @@ -46,7 +46,7 @@ export class KVArchiverDataStore implements ArchiverDataStore { #contractArtifactStore: ContractArtifactsStore; private functionNames = new Map(); - #log = createDebugLogger('aztec:archiver:data-store'); + #log = createLogger('archiver:data-store'); constructor(private db: AztecKVStore, logsMaxPageSize: number = 1000) { this.#blockStore = new BlockStore(db); diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts index efb4922d328c..a6926491e296 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/log_store.ts @@ -11,7 +11,7 @@ import { } from '@aztec/circuit-types'; import { Fr, PrivateLog } from '@aztec/circuits.js'; import { INITIAL_L2_BLOCK_NUM, MAX_NOTE_HASHES_PER_TX } from '@aztec/circuits.js/constants'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { BufferReader } from '@aztec/foundation/serialize'; import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; @@ -27,7 +27,7 @@ export class LogStore { #unencryptedLogsByBlock: AztecMap; #contractClassLogsByBlock: AztecMap; #logsMaxPageSize: number; - #log = createDebugLogger('aztec:archiver:log_store'); + #log = createLogger('archiver:log_store'); constructor(private db: AztecKVStore, private blockStore: BlockStore, logsMaxPageSize: number = 1000) { this.#logsByTag = db.openMap('archiver_tagged_logs_by_tag'); diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/message_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/message_store.ts index 6e522948b506..fe54bd4f4b90 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/message_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/message_store.ts @@ -1,6 +1,6 @@ import { InboxLeaf } from '@aztec/circuit-types'; import { Fr, L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; import { type DataRetrieval } from '../structs/data_retrieval.js'; @@ -14,7 +14,7 @@ export class MessageStore { #lastSynchedL1Block: AztecSingleton; #totalMessageCount: AztecSingleton; - #log = createDebugLogger('aztec:archiver:message_store'); + #log = createLogger('archiver:message_store'); #l1ToL2MessagesSubtreeSize = 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT; diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/nullifier_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/nullifier_store.ts index 716dedc5a0a0..069dda60c33e 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/nullifier_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/nullifier_store.ts @@ -1,13 +1,13 @@ import { type InBlock, type L2Block } from '@aztec/circuit-types'; import { type Fr, MAX_NULLIFIERS_PER_TX } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; export class NullifierStore { #nullifiersToBlockNumber: AztecMap; #nullifiersToBlockHash: AztecMap; #nullifiersToIndex: AztecMap; - #log = createDebugLogger('aztec:archiver:log_store'); + #log = createLogger('archiver:log_store'); constructor(private db: AztecKVStore) { this.#nullifiersToBlockNumber = db.openMap('archiver_nullifiers_to_block_number'); diff --git a/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts b/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts index 5a0c7085c61b..cdcadb8bf27f 100644 --- a/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts +++ b/yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts @@ -30,7 +30,7 @@ import { } from '@aztec/circuits.js'; import { type ContractArtifact, FunctionSelector } from '@aztec/foundation/abi'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type ArchiverDataStore, type ArchiverL1SynchPoint } from '../archiver_store.js'; import { type DataRetrieval } from '../structs/data_retrieval.js'; @@ -86,7 +86,7 @@ export class MemoryArchiverStore implements ArchiverDataStore { private lastProvenL2BlockNumber: number = 0; private lastProvenL2EpochNumber: number = 0; - #log = createDebugLogger('aztec:archiver:data-store'); + #log = createLogger('archiver:data-store'); constructor( /** The max number of logs that can be obtained in 1 "getUnencryptedLogs" call. */ diff --git a/yarn-project/archiver/src/factory.ts b/yarn-project/archiver/src/factory.ts index a2bd3c66ac7a..6bbf55780754 100644 --- a/yarn-project/archiver/src/factory.ts +++ b/yarn-project/archiver/src/factory.ts @@ -4,7 +4,7 @@ import { computePublicBytecodeCommitment, getContractClassFromArtifact, } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type Maybe } from '@aztec/foundation/types'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { createStore } from '@aztec/kv-store/utils'; @@ -24,7 +24,7 @@ export async function createArchiver( opts: { blockUntilSync: boolean } = { blockUntilSync: true }, ): Promise> { if (!config.archiverUrl) { - const store = await createStore('archiver', config, createDebugLogger('aztec:archiver:lmdb')); + const store = await createStore('archiver', config, createLogger('archiver:lmdb')); const archiverStore = new KVArchiverDataStore(store, config.maxLogs); await registerProtocolContracts(archiverStore); await registerCommonContracts(archiverStore); diff --git a/yarn-project/archiver/src/index.ts b/yarn-project/archiver/src/index.ts index 24112863fc1c..ba23fc0e0e34 100644 --- a/yarn-project/archiver/src/index.ts +++ b/yarn-project/archiver/src/index.ts @@ -1,5 +1,5 @@ import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { fileURLToPath } from '@aztec/foundation/url'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -16,7 +16,7 @@ export * from './factory.js'; export { retrieveL2ProofVerifiedEvents, retrieveBlockFromRollup } from './archiver/data_retrieval.js'; -const log = createDebugLogger('aztec:archiver'); +const log = createLogger('archiver'); /** * A function which instantiates and starts Archiver. diff --git a/yarn-project/archiver/src/test/mock_l2_block_source.ts b/yarn-project/archiver/src/test/mock_l2_block_source.ts index cbd2e3363d33..b72fa2a8160d 100644 --- a/yarn-project/archiver/src/test/mock_l2_block_source.ts +++ b/yarn-project/archiver/src/test/mock_l2_block_source.ts @@ -9,7 +9,7 @@ import { } from '@aztec/circuit-types'; import { EthAddress, type Header } from '@aztec/circuits.js'; import { DefaultL1ContractsConfig } from '@aztec/ethereum'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getSlotRangeForEpoch } from '../archiver/epoch_helpers.js'; @@ -22,7 +22,7 @@ export class MockL2BlockSource implements L2BlockSource { private provenEpochNumber: number = 0; private provenBlockNumber: number = 0; - private log = createDebugLogger('aztec:archiver:mock_l2_block_source'); + private log = createLogger('archiver:mock_l2_block_source'); public createBlocks(numBlocks: number) { for (let i = 0; i < numBlocks; i++) { diff --git a/yarn-project/aztec-faucet/src/bin/index.ts b/yarn-project/aztec-faucet/src/bin/index.ts index 456c067e4ed0..b6baf9d6b94a 100644 --- a/yarn-project/aztec-faucet/src/bin/index.ts +++ b/yarn-project/aztec-faucet/src/bin/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env -S node --no-warnings import { NULL_KEY, createEthereumChain } from '@aztec/ethereum'; import { EthAddress } from '@aztec/foundation/eth-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TestERC20Abi } from '@aztec/l1-artifacts'; import http from 'http'; @@ -34,7 +34,7 @@ const { EXTRA_ASSET_AMOUNT = '', } = process.env; -const logger = createDebugLogger('aztec:faucet'); +const logger = createLogger('faucet'); const rpcUrl = RPC_URL; const l1ChainId = +L1_CHAIN_ID; diff --git a/yarn-project/aztec-faucet/terraform/main.tf b/yarn-project/aztec-faucet/terraform/main.tf index 2326d9e3e4ef..d77dd205300e 100644 --- a/yarn-project/aztec-faucet/terraform/main.tf +++ b/yarn-project/aztec-faucet/terraform/main.tf @@ -107,8 +107,8 @@ resource "aws_ecs_task_definition" "aztec-faucet" { value = "80" }, { - name = "DEBUG", - value = "aztec:*" + name = "LOG_LEVEL", + value = "verbose" }, { name = "RPC_URL", diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index 57690bd78d97..237ea6f763ec 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -57,7 +57,7 @@ import { type L1ContractAddresses, createEthereumChain } from '@aztec/ethereum'; import { type ContractArtifact } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { padArrayEnd } from '@aztec/foundation/collection'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { type AztecKVStore } from '@aztec/kv-store'; import { openTmpStore } from '@aztec/kv-store/utils'; @@ -105,7 +105,7 @@ export class AztecNodeService implements AztecNode { protected readonly globalVariableBuilder: GlobalVariableBuilder, private proofVerifier: ClientProtocolCircuitVerifier, private telemetry: TelemetryClient, - private log = createDebugLogger('aztec:node'), + private log = createLogger('node'), ) { this.packageVersion = getPackageInfo().version; this.metrics = new NodeMetrics(telemetry, 'AztecNodeService'); @@ -140,12 +140,12 @@ export class AztecNodeService implements AztecNode { config: AztecNodeConfig, deps: { telemetry?: TelemetryClient; - logger?: DebugLogger; + logger?: Logger; publisher?: L1Publisher; } = {}, ): Promise { const telemetry = deps.telemetry ?? new NoopTelemetryClient(); - const log = deps.logger ?? createDebugLogger('aztec:node'); + const log = deps.logger ?? createLogger('node'); const ethereumChain = createEthereumChain(config.l1RpcUrl, config.l1ChainId); //validate that the actual chain id matches that specified in configuration if (config.l1ChainId !== ethereumChain.chainInfo.id) { diff --git a/yarn-project/aztec-node/src/bin/index.ts b/yarn-project/aztec-node/src/bin/index.ts index e1688b791985..36ab58b7e30a 100644 --- a/yarn-project/aztec-node/src/bin/index.ts +++ b/yarn-project/aztec-node/src/bin/index.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S node --no-warnings -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import http from 'http'; @@ -7,7 +7,7 @@ import { type AztecNodeConfig, AztecNodeService, createAztecNodeRpcServer, getCo const { AZTEC_NODE_PORT = 8081, API_PREFIX = '' } = process.env; -const logger = createDebugLogger('aztec:node'); +const logger = createLogger('node'); /** * Creates the node from provided config diff --git a/yarn-project/aztec.js/src/contract/base_contract_interaction.ts b/yarn-project/aztec.js/src/contract/base_contract_interaction.ts index 7761a2da1298..8ab2f2c91bde 100644 --- a/yarn-project/aztec.js/src/contract/base_contract_interaction.ts +++ b/yarn-project/aztec.js/src/contract/base_contract_interaction.ts @@ -1,6 +1,6 @@ import { type TxExecutionRequest, type TxProvingResult } from '@aztec/circuit-types'; import { type Fr, GasSettings } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type Wallet } from '../account/wallet.js'; import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js'; @@ -30,7 +30,7 @@ export type SendMethodOptions = { * Implements the sequence create/simulate/send. */ export abstract class BaseContractInteraction { - protected log = createDebugLogger('aztec:js:contract_interaction'); + protected log = createLogger('aztecjs:contract_interaction'); constructor(protected wallet: Wallet) {} diff --git a/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts b/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts index 6f59cfeb2617..6f294db1f03d 100644 --- a/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts +++ b/yarn-project/aztec.js/src/contract/deploy_sent_tx.ts @@ -1,6 +1,6 @@ import { type PXE, type TxHash, type TxReceipt } from '@aztec/circuit-types'; import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type FieldsOf } from '@aztec/foundation/types'; import { type Wallet } from '../account/index.js'; @@ -24,7 +24,7 @@ export type DeployTxReceipt = FieldsO * A contract deployment transaction sent to the network, extending SentTx with methods to create a contract instance. */ export class DeploySentTx extends SentTx { - private log = createDebugLogger('aztec:js:deploy_sent_tx'); + private log = createLogger('aztecjs:deploy_sent_tx'); constructor( wallet: PXE | Wallet, diff --git a/yarn-project/aztec.js/src/index.ts b/yarn-project/aztec.js/src/index.ts index 3a67fd9a6fd3..f806d0e0bd56 100644 --- a/yarn-project/aztec.js/src/index.ts +++ b/yarn-project/aztec.js/src/index.ts @@ -156,7 +156,7 @@ export { decodeFromAbi, encodeArguments, type AbiType } from '@aztec/foundation/ export { toBigIntBE } from '@aztec/foundation/bigint-buffer'; export { sha256 } from '@aztec/foundation/crypto'; export { makeFetch } from '@aztec/foundation/json-rpc/client'; -export { createDebugLogger, onLog, type DebugLogger } from '@aztec/foundation/log'; +export { createLogger, type Logger } from '@aztec/foundation/log'; export { retry, retryUntil } from '@aztec/foundation/retry'; export { to2Fields, toBigInt } from '@aztec/foundation/serialize'; export { sleep } from '@aztec/foundation/sleep'; diff --git a/yarn-project/aztec.js/src/rpc_clients/node/index.ts b/yarn-project/aztec.js/src/rpc_clients/node/index.ts index 0db9d0edf354..0c596beb5248 100644 --- a/yarn-project/aztec.js/src/rpc_clients/node/index.ts +++ b/yarn-project/aztec.js/src/rpc_clients/node/index.ts @@ -1,6 +1,6 @@ import { type PXE } from '@aztec/circuit-types'; import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { NoRetryError, makeBackoff, retry } from '@aztec/foundation/retry'; import { Axios, type AxiosError } from 'axios'; @@ -51,7 +51,7 @@ async function axiosFetch(host: string, rpcMethod: string, body: any, useApiEndp * @param _logger - Debug logger to warn version incompatibilities. * @returns A PXE client. */ -export function createCompatibleClient(rpcUrl: string, logger: DebugLogger): Promise { +export function createCompatibleClient(rpcUrl: string, logger: Logger): Promise { // Use axios due to timeout issues with fetch when proving TXs. const fetch = async (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) => { return await retry( diff --git a/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts b/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts index 79f4705449bf..33d32ae42fd2 100644 --- a/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts +++ b/yarn-project/aztec.js/src/utils/anvil_test_watcher.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, type EthCheatCodes, createDebugLogger } from '@aztec/aztec.js'; +import { type EthCheatCodes, type Logger, createLogger } from '@aztec/aztec.js'; import { type EthAddress } from '@aztec/circuits.js'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { RollupAbi } from '@aztec/l1-artifacts'; @@ -18,7 +18,7 @@ export class AnvilTestWatcher { private filledRunningPromise?: RunningPromise; - private logger: DebugLogger = createDebugLogger(`aztec:utils:watcher`); + private logger: Logger = createLogger(`aztecjs:utils:watcher`); constructor( private cheatcodes: EthCheatCodes, @@ -31,7 +31,7 @@ export class AnvilTestWatcher { client: publicClient, }); - this.logger.info(`Watcher created for rollup at ${rollupAddress}`); + this.logger.debug(`Watcher created for rollup at ${rollupAddress}`); } async start() { @@ -48,7 +48,7 @@ export class AnvilTestWatcher { if (isAutoMining) { this.filledRunningPromise = new RunningPromise(() => this.mineIfSlotFilled(), 1000); this.filledRunningPromise.start(); - this.logger.info(`Watcher started`); + this.logger.info(`Watcher started for rollup at ${this.rollup.address}`); } else { this.logger.info(`Watcher not started because not auto mining`); } diff --git a/yarn-project/aztec.js/src/utils/cheat_codes.ts b/yarn-project/aztec.js/src/utils/cheat_codes.ts index 10b837a9b04a..b92366b94e57 100644 --- a/yarn-project/aztec.js/src/utils/cheat_codes.ts +++ b/yarn-project/aztec.js/src/utils/cheat_codes.ts @@ -2,7 +2,7 @@ import { type EpochProofClaim, type Note, type PXE } from '@aztec/circuit-types' import { type AztecAddress, EthAddress, Fr } from '@aztec/circuits.js'; import { deriveStorageSlotInMap } from '@aztec/circuits.js/hash'; import { EthCheatCodes, type L1ContractAddresses } from '@aztec/ethereum'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { @@ -51,7 +51,7 @@ export class RollupCheatCodes { private client: WalletClient & PublicClient; private rollup: GetContractReturnType; - private logger = createDebugLogger('aztec:js:cheat_codes'); + private logger = createLogger('aztecjs:cheat_codes'); constructor(private ethCheatCodes: EthCheatCodes, addresses: Pick) { this.client = createWalletClient({ chain: foundry, transport: http(ethCheatCodes.rpcUrl) }).extend(publicActions); @@ -197,7 +197,7 @@ export class AztecCheatCodes { /** * The logger to use for the aztec cheatcodes */ - public logger = createDebugLogger('aztec:cheat_codes:aztec'), + public logger = createLogger('aztecjs:cheat_codes'), ) {} /** diff --git a/yarn-project/aztec.js/src/utils/portal_manager.ts b/yarn-project/aztec.js/src/utils/portal_manager.ts index 7d3c3d2bae22..660a63687d23 100644 --- a/yarn-project/aztec.js/src/utils/portal_manager.ts +++ b/yarn-project/aztec.js/src/utils/portal_manager.ts @@ -1,8 +1,8 @@ import { type AztecAddress, - type DebugLogger, EthAddress, Fr, + type Logger, type PXE, type SiblingPath, computeSecretHash, @@ -49,7 +49,7 @@ function stringifyEthAddress(address: EthAddress | Hex, name?: string) { } /** Generates a pair secret and secret hash */ -export function generateClaimSecret(logger?: DebugLogger): [Fr, Fr] { +export function generateClaimSecret(logger?: Logger): [Fr, Fr] { const secret = Fr.random(); const secretHash = computeSecretHash(secret); logger?.verbose(`Generated claim secret=${secret.toString()} hash=${secretHash.toString()}`); @@ -65,7 +65,7 @@ export class L1TokenManager { public readonly address: EthAddress, private publicClient: PublicClient, private walletClient: WalletClient, - private logger: DebugLogger, + private logger: Logger, ) { this.contract = getContract({ address: this.address.toString(), @@ -122,7 +122,7 @@ export class L1FeeJuicePortalManager { tokenAddress: EthAddress, private readonly publicClient: PublicClient, private readonly walletClient: WalletClient, - private readonly logger: DebugLogger, + private readonly logger: Logger, ) { this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger); this.contract = getContract({ @@ -192,7 +192,7 @@ export class L1FeeJuicePortalManager { pxe: PXE, publicClient: PublicClient, walletClient: WalletClient, - logger: DebugLogger, + logger: Logger, ): Promise { const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress }, @@ -216,7 +216,7 @@ export class L1ToL2TokenPortalManager { tokenAddress: EthAddress, protected publicClient: PublicClient, protected walletClient: WalletClient, - protected logger: DebugLogger, + protected logger: Logger, ) { this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger); this.portal = getContract({ @@ -334,7 +334,7 @@ export class L1TokenPortalManager extends L1ToL2TokenPortalManager { outboxAddress: EthAddress, publicClient: PublicClient, walletClient: WalletClient, - logger: DebugLogger, + logger: Logger, ) { super(portalAddress, tokenAddress, publicClient, walletClient, logger); this.outbox = getContract({ diff --git a/yarn-project/aztec.js/src/utils/pxe.ts b/yarn-project/aztec.js/src/utils/pxe.ts index 57d79ce15ae3..2eb165411d23 100644 --- a/yarn-project/aztec.js/src/utils/pxe.ts +++ b/yarn-project/aztec.js/src/utils/pxe.ts @@ -1,8 +1,8 @@ import { type PXE } from '@aztec/circuit-types'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { retryUntil } from '@aztec/foundation/retry'; -export const waitForPXE = async (pxe: PXE, logger?: DebugLogger) => { +export const waitForPXE = async (pxe: PXE, logger?: Logger) => { await retryUntil(async () => { try { logger?.verbose('Attempting to contact PXE...'); diff --git a/yarn-project/aztec.js/webpack.config.js b/yarn-project/aztec.js/webpack.config.js index d377a5fa0563..3ba9561af4e1 100644 --- a/yarn-project/aztec.js/webpack.config.js +++ b/yarn-project/aztec.js/webpack.config.js @@ -61,6 +61,7 @@ export default { fs: false, path: false, url: false, + tty: false, worker_threads: false, buffer: require.resolve('buffer/'), util: require.resolve('util/'), diff --git a/yarn-project/aztec/docker-compose.yml b/yarn-project/aztec/docker-compose.yml index f26a2e548286..3fe35cd42f82 100644 --- a/yarn-project/aztec/docker-compose.yml +++ b/yarn-project/aztec/docker-compose.yml @@ -21,7 +21,7 @@ services: ports: - '${SANDBOX_PXE_PORT:-8080}:8080' environment: - DEBUG: # Loaded from the user shell if explicitly set + LOG_LEVEL: # Loaded from the user shell if explicitly set HOST_WORKDIR: '${PWD}' # Loaded from the user shell to show log files absolute path in host ETHEREUM_HOST: http://ethereum:8545 L1_CHAIN_ID: 31337 diff --git a/yarn-project/aztec/package.json b/yarn-project/aztec/package.json index e9ff10afa77d..f8732bff89b1 100644 --- a/yarn-project/aztec/package.json +++ b/yarn-project/aztec/package.json @@ -22,7 +22,7 @@ "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "build:dev": "tsc -b --watch", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests", - "run:example:token": "DEBUG='aztec:*' node ./dest/examples/token.js" + "run:example:token": "LOG_LEVEL='verbose' node ./dest/examples/token.js" }, "inherits": [ "../package.common.json" @@ -55,16 +55,13 @@ "@aztec/telemetry-client": "workspace:^", "@aztec/txe": "workspace:^", "@aztec/types": "workspace:^", - "@opentelemetry/winston-transport": "^0.7.0", "@types/chalk": "^2.2.0", "abitype": "^0.8.11", "chalk": "^5.3.0", "commander": "^12.1.0", "koa": "^2.14.2", "koa-router": "^12.0.0", - "viem": "^2.7.15", - "winston": "^3.10.0", - "winston-daily-rotate-file": "^4.7.1" + "viem": "^2.7.15" }, "files": [ "dest", @@ -117,4 +114,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/aztec/src/bin/index.ts b/yarn-project/aztec/src/bin/index.ts index 158543eb80be..39426945fd51 100644 --- a/yarn-project/aztec/src/bin/index.ts +++ b/yarn-project/aztec/src/bin/index.ts @@ -8,7 +8,7 @@ import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infra import { injectCommands as injectL1Commands } from '@aztec/cli/l1'; import { injectCommands as injectMiscCommands } from '@aztec/cli/misc'; import { injectCommands as injectPXECommands } from '@aztec/cli/pxe'; -import { createConsoleLogger, createDebugLogger } from '@aztec/foundation/log'; +import { createConsoleLogger, createLogger } from '@aztec/foundation/log'; import { Command } from 'commander'; import { readFileSync } from 'fs'; @@ -17,7 +17,7 @@ import { dirname, resolve } from 'path'; import { injectAztecCommands } from '../cli/index.js'; const userLog = createConsoleLogger(); -const debugLogger = createDebugLogger('aztec:cli'); +const debugLogger = createLogger('cli'); /** CLI & full node main entrypoint */ async function main() { diff --git a/yarn-project/aztec/src/cli/cli.ts b/yarn-project/aztec/src/cli/cli.ts index 91d803851e40..2f79a231db17 100644 --- a/yarn-project/aztec/src/cli/cli.ts +++ b/yarn-project/aztec/src/cli/cli.ts @@ -5,11 +5,10 @@ import { createNamespacedSafeJsonRpcServer, startHttpRpcServer, } from '@aztec/foundation/json-rpc/server'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { Command } from 'commander'; -import { setupConsoleJsonLog } from '../logging.js'; import { createSandbox } from '../sandbox.js'; import { github, splash } from '../splash.js'; import { aztecStartOptions } from './aztec_start_options.js'; @@ -26,7 +25,7 @@ import { * @param userLog - log function for logging user output. * @param debugLogger - logger for logging debug messages. */ -export function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: DebugLogger): Command { +export function injectAztecCommands(program: Command, userLog: LogFn, debugLogger: Logger): Command { const startCmd = new Command('start').description( 'Starts Aztec modules. Options for each module can be set as key-value pairs (e.g. "option1=value1,option2=value2") or as environment variables.', ); @@ -39,11 +38,6 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge startCmd.helpInformation = printAztecStartHelpText; startCmd.action(async options => { - // setup json logging - if (['1', 'true', 'TRUE'].includes(process.env.LOG_JSON ?? '')) { - setupConsoleJsonLog(); - } - // list of 'stop' functions to call when process ends const signalHandlers: Array<() => Promise> = []; const services: NamespacedApiHandlers = {}; diff --git a/yarn-project/aztec/src/cli/cmds/start_archiver.ts b/yarn-project/aztec/src/cli/cmds/start_archiver.ts index 541ec726db54..1d19799574b7 100644 --- a/yarn-project/aztec/src/cli/cmds/start_archiver.ts +++ b/yarn-project/aztec/src/cli/cmds/start_archiver.ts @@ -1,5 +1,5 @@ import { Archiver, type ArchiverConfig, KVArchiverDataStore, archiverConfigMappings } from '@aztec/archiver'; -import { createDebugLogger } from '@aztec/aztec.js'; +import { createLogger } from '@aztec/aztec.js'; import { ArchiverApiSchema } from '@aztec/circuit-types'; import { type NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server'; import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config'; @@ -26,7 +26,7 @@ export async function startArchiver( 'archiver', ); - const storeLog = createDebugLogger('aztec:archiver:lmdb'); + const storeLog = createLogger('archiver:lmdb'); const store = await createStore('archiver', archiverConfig, storeLog); const archiverStore = new KVArchiverDataStore(store, archiverConfig.maxLogs); diff --git a/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts b/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts index c93bb1353950..4d4f7618d80c 100644 --- a/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts +++ b/yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '@aztec/aztec.js'; +import { type Logger } from '@aztec/aztec.js'; import { type LogFn } from '@aztec/foundation/log'; import { type BootnodeConfig, bootnodeConfigMappings } from '@aztec/p2p'; import runBootstrapNode from '@aztec/p2p-bootstrap'; @@ -9,7 +9,7 @@ import { import { extractRelevantOptions } from '../util.js'; -export const startP2PBootstrap = async (options: any, userLog: LogFn, debugLogger: DebugLogger) => { +export const startP2PBootstrap = async (options: any, userLog: LogFn, debugLogger: Logger) => { // Start a P2P bootstrap node. const config = extractRelevantOptions(options, bootnodeConfigMappings, 'p2p'); const telemetryClient = await createAndStartTelemetryClient(getTelemetryClientConfig()); diff --git a/yarn-project/aztec/src/cli/cmds/start_txe.ts b/yarn-project/aztec/src/cli/cmds/start_txe.ts index 3412ca770a4a..bef3cd2fb538 100644 --- a/yarn-project/aztec/src/cli/cmds/start_txe.ts +++ b/yarn-project/aztec/src/cli/cmds/start_txe.ts @@ -1,8 +1,8 @@ import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { createTXERpcServer } from '@aztec/txe'; -export async function startTXE(options: any, debugLogger: DebugLogger) { +export async function startTXE(options: any, debugLogger: Logger) { debugLogger.info(`Setting up TXE...`); const txeServer = createTXERpcServer(debugLogger); diff --git a/yarn-project/aztec/src/examples/token.ts b/yarn-project/aztec/src/examples/token.ts index 763eb40540de..282ae050b86a 100644 --- a/yarn-project/aztec/src/examples/token.ts +++ b/yarn-project/aztec/src/examples/token.ts @@ -1,9 +1,9 @@ import { getSingleKeyAccount } from '@aztec/accounts/single_key'; import { type AccountWallet, Fr, createPXEClient } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; -const logger = createDebugLogger('aztec:http-rpc-client'); +const logger = createLogger('example:token'); export const alicePrivateKey = Fr.random(); export const bobPrivateKey = Fr.random(); diff --git a/yarn-project/aztec/src/logging.ts b/yarn-project/aztec/src/logging.ts deleted file mode 100644 index a7deed55ae50..000000000000 --- a/yarn-project/aztec/src/logging.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { currentLevel, onLog, setLevel } from '@aztec/foundation/log'; - -import { OpenTelemetryTransportV3 } from '@opentelemetry/winston-transport'; -import * as path from 'path'; -import * as process from 'process'; -import * as winston from 'winston'; -import DailyRotateFile from 'winston-daily-rotate-file'; - -const { format } = winston; -const CURRENT_LOG_FILE_NAME = 'aztec.debug.log'; -const LOG_DIR = 'log'; - -/** Creates a winston logger that logs everything to a local rotating file */ -function createWinstonLocalFileLogger() { - // See https://www.npmjs.com/package/winston-daily-rotate-file#user-content-options - const transport: DailyRotateFile = new DailyRotateFile({ - filename: 'aztec-%DATE%.debug.log', - dirname: LOG_DIR, - datePattern: 'YYYY-MM-DD', - zippedArchive: true, - maxSize: '30m', - maxFiles: '5', - createSymlink: true, - symlinkName: CURRENT_LOG_FILE_NAME, - }); - - return winston.createLogger({ - level: 'debug', - transports: [transport], - format: format.combine(format.timestamp(), format.json()), - }); -} - -/** Creates a winston logger that logs everything to stdout in json format */ -function createWinstonJsonStdoutLogger() { - return winston.createLogger({ - level: currentLevel, - transports: [ - new winston.transports.Console({ - format: format.combine(format.timestamp(), format.json()), - }), - new OpenTelemetryTransportV3(), - ], - }); -} - -/** - * Hooks to all log statements and outputs them to a local rotating file. - * @returns Output log name. - */ -export function setupFileDebugLog() { - const logger = createWinstonLocalFileLogger(); - onLog((level, module, message, data) => { - logger.log({ ...data, level, module, message }); - }); - const workdir = process.env.HOST_WORKDIR ?? process.cwd(); - return path.join(workdir, LOG_DIR, CURRENT_LOG_FILE_NAME); -} - -/** - * Silences the foundation stdout logger and funnels all logs through a winston JSON logger. - */ -export function setupConsoleJsonLog() { - const logger = createWinstonJsonStdoutLogger(); - setLevel('silent'); - onLog((level, module, message, data) => { - logger.log({ ...data, level, module, message }); - }); -} diff --git a/yarn-project/aztec/src/sandbox.ts b/yarn-project/aztec/src/sandbox.ts index cd2a799df92f..0545db16714c 100644 --- a/yarn-project/aztec/src/sandbox.ts +++ b/yarn-project/aztec/src/sandbox.ts @@ -11,7 +11,7 @@ import { deployL1Contracts, getL1ContractsConfigEnvVars, } from '@aztec/ethereum'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; @@ -27,7 +27,7 @@ import { foundry } from 'viem/chains'; export const defaultMnemonic = 'test test test test test test test test test test test junk'; -const logger = createDebugLogger('aztec:sandbox'); +const logger = createLogger('sandbox'); const localAnvil = foundry; diff --git a/yarn-project/aztec/terraform/node/main.tf b/yarn-project/aztec/terraform/node/main.tf index f419a3568a7e..4dbef1867cc1 100644 --- a/yarn-project/aztec/terraform/node/main.tf +++ b/yarn-project/aztec/terraform/node/main.tf @@ -252,10 +252,6 @@ resource "aws_ecs_task_definition" "aztec-node" { name = "AZTEC_PORT" value = "80" }, - { - name = "DEBUG" - value = "aztec:*,-json-rpc:json_proxy:*,-aztec:avm_simulator:*" - }, { name = "ETHEREUM_HOST" value = "${local.eth_host}" diff --git a/yarn-project/aztec/terraform/prover-node/main.tf b/yarn-project/aztec/terraform/prover-node/main.tf index 45bdfcb0be81..ef30e5fd7e2e 100644 --- a/yarn-project/aztec/terraform/prover-node/main.tf +++ b/yarn-project/aztec/terraform/prover-node/main.tf @@ -235,7 +235,6 @@ resource "aws_ecs_task_definition" "aztec-prover-node" { { name = "NODE_ENV", value = "production" }, { name = "LOG_LEVEL", value = "verbose" }, { name = "LOG_JSON", value = "1" }, - { name = "DEBUG", value = "aztec:*,-json-rpc:json_proxy:*,-aztec:avm_simulator:*" }, { name = "DEPLOY_TAG", value = var.DEPLOY_TAG }, { name = "NETWORK_NAME", value = "${var.DEPLOY_TAG}" }, { name = "ETHEREUM_HOST", value = "${local.eth_host}" }, diff --git a/yarn-project/aztec/terraform/prover/main.tf b/yarn-project/aztec/terraform/prover/main.tf index 72b48ff520bf..97f62ee8995e 100644 --- a/yarn-project/aztec/terraform/prover/main.tf +++ b/yarn-project/aztec/terraform/prover/main.tf @@ -250,8 +250,8 @@ resource "aws_ecs_task_definition" "aztec-proving-agent" { "value": "production" }, { - "name": "DEBUG", - "value": "aztec:*" + "name": "LOG_LEVEL", + "value": "verbose" }, { "name": "DEPLOY_TAG", diff --git a/yarn-project/bb-prover/src/avm_proving.test.ts b/yarn-project/bb-prover/src/avm_proving.test.ts index 3e0ae84cf228..89cee260204c 100644 --- a/yarn-project/bb-prover/src/avm_proving.test.ts +++ b/yarn-project/bb-prover/src/avm_proving.test.ts @@ -1,6 +1,6 @@ import { VerificationKeyData } from '@aztec/circuits.js'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { simulateAvmTestContractGenerateCircuitInputs } from '@aztec/simulator/public/fixtures'; import fs from 'node:fs/promises'; @@ -22,7 +22,7 @@ describe('AVM WitGen, proof generation and verification', () => { async function proveAndVerifyAvmTestContract(functionName: string, calldata: Fr[] = []) { const avmCircuitInputs = await simulateAvmTestContractGenerateCircuitInputs(functionName, calldata); - const internalLogger = createDebugLogger('aztec:avm-proving-test'); + const internalLogger = createLogger('bb-prover:avm-proving-test'); const logger = (msg: string, _data?: any) => internalLogger.verbose(msg); // The paths for the barretenberg binary and the write path are hardcoded for now. @@ -30,7 +30,7 @@ async function proveAndVerifyAvmTestContract(functionName: string, calldata: Fr[ const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); // Then we prove. - const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, logger); + const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, internalLogger); if (proofRes.status === BB_RESULT.FAILURE) { internalLogger.error(`Proof generation failed: ${proofRes.reason}`); } diff --git a/yarn-project/bb-prover/src/bb/execute.ts b/yarn-project/bb-prover/src/bb/execute.ts index a14598863a9f..e5927dc66a7c 100644 --- a/yarn-project/bb-prover/src/bb/execute.ts +++ b/yarn-project/bb-prover/src/bb/execute.ts @@ -1,6 +1,6 @@ import { type AvmCircuitInputs } from '@aztec/circuits.js'; import { sha256 } from '@aztec/foundation/crypto'; -import { type LogFn, currentLevel as currentLogLevel } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { type NoirCompiledCircuit } from '@aztec/types/noir'; @@ -505,7 +505,7 @@ export async function generateAvmProof( pathToBB: string, workingDirectory: string, input: AvmCircuitInputs, - log: LogFn, + logger: Logger, ): Promise { // Check that the working directory exists try { @@ -562,11 +562,11 @@ export async function generateAvmProof( avmHintsPath, '-o', outputPath, - currentLogLevel == 'debug' ? '-d' : currentLogLevel == 'verbose' ? '-v' : '', + logger.level === 'debug' || logger.level === 'trace' ? '-d' : logger.level === 'verbose' ? '-v' : '', ]; const timer = new Timer(); const logFunction = (message: string) => { - log(`AvmCircuit (prove) BB out - ${message}`); + logger.verbose(`AvmCircuit (prove) BB out - ${message}`); }; const result = await executeBB(pathToBB, 'avm_prove', args, logFunction); const duration = timer.ms(); diff --git a/yarn-project/bb-prover/src/prover/bb_private_kernel_prover.ts b/yarn-project/bb-prover/src/prover/bb_private_kernel_prover.ts index 7f16b0292fd9..5ea97eb97ee7 100644 --- a/yarn-project/bb-prover/src/prover/bb_private_kernel_prover.ts +++ b/yarn-project/bb-prover/src/prover/bb_private_kernel_prover.ts @@ -20,7 +20,7 @@ import { type VerificationKeyData, } from '@aztec/circuits.js'; import { runInDirectory } from '@aztec/foundation/fs'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { ClientCircuitArtifacts, @@ -79,10 +79,10 @@ export class BBNativePrivateKernelProver implements PrivateKernelProver { private bbBinaryPath: string, private bbWorkingDirectory: string, private skipCleanup: boolean, - private log = createDebugLogger('aztec:bb-native-prover'), + private log = createLogger('bb-prover:native'), ) {} - public static async new(config: BBConfig, log?: DebugLogger) { + public static async new(config: BBConfig, log?: Logger) { await fs.mkdir(config.bbWorkingDirectory, { recursive: true }); return new BBNativePrivateKernelProver(config.bbBinaryPath, config.bbWorkingDirectory, !!config.bbSkipCleanup, log); } diff --git a/yarn-project/bb-prover/src/prover/bb_prover.ts b/yarn-project/bb-prover/src/prover/bb_prover.ts index f737b093a382..7a6ff314021e 100644 --- a/yarn-project/bb-prover/src/prover/bb_prover.ts +++ b/yarn-project/bb-prover/src/prover/bb_prover.ts @@ -42,7 +42,7 @@ import { makeRecursiveProofFromBinary, } from '@aztec/circuits.js'; import { runInDirectory } from '@aztec/foundation/fs'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { BufferReader } from '@aztec/foundation/serialize'; import { Timer } from '@aztec/foundation/timer'; import { @@ -100,7 +100,7 @@ import { ProverInstrumentation } from '../instrumentation.js'; import { mapProtocolArtifactNameToCircuitName } from '../stats.js'; import { extractAvmVkData, extractVkData } from '../verification_key/verification_key_data.js'; -const logger = createDebugLogger('aztec:bb-prover'); +const logger = createLogger('bb-prover'); // All `ServerCircuitArtifact` are recursive. const SERVER_CIRCUIT_RECURSIVE = true; @@ -535,7 +535,7 @@ export class BBNativeRollupProver implements ServerCircuitProver { private async generateAvmProofWithBB(input: AvmCircuitInputs, workingDirectory: string): Promise { logger.info(`Proving avm-circuit for ${input.functionName}...`); - const provingResult = await generateAvmProof(this.config.bbBinaryPath, workingDirectory, input, logger.verbose); + const provingResult = await generateAvmProof(this.config.bbBinaryPath, workingDirectory, input, logger); if (provingResult.status === BB_RESULT.FAILURE) { logger.error(`Failed to generate AVM proof for ${input.functionName}: ${provingResult.reason}`); diff --git a/yarn-project/bb-prover/src/test/test_circuit_prover.ts b/yarn-project/bb-prover/src/test/test_circuit_prover.ts index 506728a6558a..ca81962cbdab 100644 --- a/yarn-project/bb-prover/src/test/test_circuit_prover.ts +++ b/yarn-project/bb-prover/src/test/test_circuit_prover.ts @@ -35,7 +35,7 @@ import { makeEmptyRecursiveProof, makeRecursiveProof, } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { Timer } from '@aztec/foundation/timer'; import { @@ -78,7 +78,7 @@ import { mapProtocolArtifactNameToCircuitName } from '../stats.js'; export class TestCircuitProver implements ServerCircuitProver { private wasmSimulator = new WASMSimulator(); private instrumentation: ProverInstrumentation; - private logger = createDebugLogger('aztec:test-prover'); + private logger = createLogger('bb-prover:test-prover'); constructor( telemetry: TelemetryClient, diff --git a/yarn-project/bb-prover/src/verifier/bb_verifier.ts b/yarn-project/bb-prover/src/verifier/bb_verifier.ts index af05a695ae05..b095755f24bd 100644 --- a/yarn-project/bb-prover/src/verifier/bb_verifier.ts +++ b/yarn-project/bb-prover/src/verifier/bb_verifier.ts @@ -2,7 +2,7 @@ import { type ClientProtocolCircuitVerifier, Tx } from '@aztec/circuit-types'; import { type CircuitVerificationStats } from '@aztec/circuit-types/stats'; import { type Proof, type VerificationKeyData } from '@aztec/circuits.js'; import { runInDirectory } from '@aztec/foundation/fs'; -import { type DebugLogger, type LogFn, createDebugLogger } from '@aztec/foundation/log'; +import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log'; import { type ClientProtocolArtifact, type ProtocolArtifact, @@ -30,13 +30,13 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier { private constructor( private config: BBConfig, private verificationKeys = new Map>(), - private logger: DebugLogger, + private logger: Logger, ) {} public static async new( config: BBConfig, initialCircuits: ProtocolArtifact[] = [], - logger = createDebugLogger('aztec:bb-verifier'), + logger = createLogger('bb-prover:verifier'), ) { await fs.mkdir(config.bbWorkingDirectory, { recursive: true }); const keys = new Map>(); diff --git a/yarn-project/bot/src/bot.ts b/yarn-project/bot/src/bot.ts index 45d6142bb4a2..ffaeb9cf028f 100644 --- a/yarn-project/bot/src/bot.ts +++ b/yarn-project/bot/src/bot.ts @@ -5,7 +5,7 @@ import { NoFeePaymentMethod, type SendMethodOptions, type Wallet, - createDebugLogger, + createLogger, } from '@aztec/aztec.js'; import { type AztecNode, type FunctionCall, type PXE } from '@aztec/circuit-types'; import { Gas } from '@aztec/circuits.js'; @@ -19,7 +19,7 @@ import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils const TRANSFER_AMOUNT = 1; export class Bot { - private log = createDebugLogger('aztec:bot'); + private log = createLogger('bot'); private attempts: number = 0; private successes: number = 0; diff --git a/yarn-project/bot/src/factory.ts b/yarn-project/bot/src/factory.ts index d41ddf174ff1..1e00d40870b3 100644 --- a/yarn-project/bot/src/factory.ts +++ b/yarn-project/bot/src/factory.ts @@ -4,7 +4,7 @@ import { BatchCall, type DeployMethod, type DeployOptions, - createDebugLogger, + createLogger, createPXEClient, retryUntil, } from '@aztec/aztec.js'; @@ -22,7 +22,7 @@ const MIN_BALANCE = 1e3; export class BotFactory { private pxe: PXE; private node?: AztecNode; - private log = createDebugLogger('aztec:bot'); + private log = createLogger('bot'); constructor(private readonly config: BotConfig, dependencies: { pxe?: PXE; node?: AztecNode } = {}) { if (config.flushSetupTransactions && !dependencies.node) { diff --git a/yarn-project/bot/src/runner.ts b/yarn-project/bot/src/runner.ts index dbb592123529..a15a1ffba853 100644 --- a/yarn-project/bot/src/runner.ts +++ b/yarn-project/bot/src/runner.ts @@ -1,4 +1,4 @@ -import { type AztecNode, type PXE, createAztecNodeClient, createDebugLogger } from '@aztec/aztec.js'; +import { type AztecNode, type PXE, createAztecNodeClient, createLogger } from '@aztec/aztec.js'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { Bot } from './bot.js'; @@ -6,7 +6,7 @@ import { type BotConfig } from './config.js'; import { type BotRunnerApi } from './interface.js'; export class BotRunner implements BotRunnerApi { - private log = createDebugLogger('aztec:bot'); + private log = createLogger('bot'); private bot?: Promise; private pxe?: PXE; private node: AztecNode; diff --git a/yarn-project/circuit-types/src/interfaces/merkle_tree_operations.ts b/yarn-project/circuit-types/src/interfaces/merkle_tree_operations.ts index 9017c1a6a846..c9edef7a1c06 100644 --- a/yarn-project/circuit-types/src/interfaces/merkle_tree_operations.ts +++ b/yarn-project/circuit-types/src/interfaces/merkle_tree_operations.ts @@ -5,7 +5,7 @@ import { type PublicDataTreeLeaf, type StateReference, } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type IndexedTreeLeafPreimage } from '@aztec/foundation/trees'; import { type MerkleTreeId } from '../merkle_tree_id.js'; @@ -263,7 +263,7 @@ export interface MerkleTreeWriteOperations extends MerkleTreeReadOperations { export async function inspectTree( db: MerkleTreeReadOperations, treeId: MerkleTreeId, - log = createDebugLogger('aztec:inspect-tree'), + log = createLogger('types:inspect-tree'), ) { const info = await db.getTreeInfo(treeId); const output = [`Tree id=${treeId} size=${info.size} root=0x${info.root.toString('hex')}`]; diff --git a/yarn-project/circuit-types/src/interfaces/service.ts b/yarn-project/circuit-types/src/interfaces/service.ts index 573dad106cb5..7b4c458f8418 100644 --- a/yarn-project/circuit-types/src/interfaces/service.ts +++ b/yarn-project/circuit-types/src/interfaces/service.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { type Maybe } from '@aztec/foundation/types'; /** Represents a local service that can be started and stopped. */ @@ -14,7 +14,7 @@ export interface Service { } /** Tries to call stop on a given object and awaits it. Logs any errors and does not rethrow. */ -export async function tryStop(service: Maybe, logger?: DebugLogger): Promise { +export async function tryStop(service: Maybe, logger?: Logger): Promise { try { return typeof service === 'object' && service && 'stop' in service && typeof service.stop === 'function' ? await service.stop() diff --git a/yarn-project/circuit-types/src/l2_block_downloader/l2_block_downloader.ts b/yarn-project/circuit-types/src/l2_block_downloader/l2_block_downloader.ts index ce4e2eb5f679..6aae7fe32f06 100644 --- a/yarn-project/circuit-types/src/l2_block_downloader/l2_block_downloader.ts +++ b/yarn-project/circuit-types/src/l2_block_downloader/l2_block_downloader.ts @@ -1,12 +1,12 @@ import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { FifoMemoryQueue, Semaphore, SerialQueue } from '@aztec/foundation/queue'; import { InterruptibleSleep } from '@aztec/foundation/sleep'; import { type L2Block } from '../l2_block.js'; import { type L2BlockSource } from '../l2_block_source.js'; -const log = createDebugLogger('aztec:l2_block_downloader'); +const log = createLogger('types:l2_block_downloader'); /** * Downloads L2 blocks from a L2BlockSource. diff --git a/yarn-project/circuit-types/src/l2_block_downloader/l2_block_stream.ts b/yarn-project/circuit-types/src/l2_block_downloader/l2_block_stream.ts index 41eb4581346c..b4fce559ca95 100644 --- a/yarn-project/circuit-types/src/l2_block_downloader/l2_block_stream.ts +++ b/yarn-project/circuit-types/src/l2_block_downloader/l2_block_stream.ts @@ -1,5 +1,5 @@ import { AbortError } from '@aztec/foundation/error'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { type L2Block } from '../l2_block.js'; @@ -9,7 +9,7 @@ import { type L2BlockId, type L2BlockSource, type L2Tips } from '../l2_block_sou export class L2BlockStream { private readonly runningPromise: RunningPromise; - private readonly log = createDebugLogger('aztec:l2_block_stream'); + private readonly log = createLogger('types:l2_block_stream'); constructor( private l2BlockSource: Pick, @@ -46,7 +46,7 @@ export class L2BlockStream { try { const sourceTips = await this.l2BlockSource.getL2Tips(); const localTips = await this.localData.getL2Tips(); - this.log.debug(`Running L2 block stream`, { + this.log.trace(`Running L2 block stream`, { sourceLatest: sourceTips.latest.number, localLatest: localTips.latest.number, sourceFinalized: sourceTips.finalized.number, @@ -80,7 +80,7 @@ export class L2BlockStream { while (latestBlockNumber < sourceTips.latest.number) { const from = latestBlockNumber + 1; const limit = Math.min(this.opts.batchSize ?? 20, sourceTips.latest.number - from + 1); - this.log.debug(`Requesting blocks from ${from} limit ${limit} proven=${this.opts.proven}`); + this.log.trace(`Requesting blocks from ${from} limit ${limit} proven=${this.opts.proven}`); const blocks = await this.l2BlockSource.getBlocks(from, limit, this.opts.proven); if (blocks.length === 0) { break; @@ -119,7 +119,7 @@ export class L2BlockStream { const sourceBlockHash = args.sourceCache.find(id => id.number === blockNumber && id.hash)?.hash ?? (await this.l2BlockSource.getBlockHeader(blockNumber).then(h => h?.hash().toString())); - this.log.debug(`Comparing block hashes for block ${blockNumber}`, { + this.log.trace(`Comparing block hashes for block ${blockNumber}`, { localBlockHash, sourceBlockHash, sourceCacheNumber: args.sourceCache[0]?.number, diff --git a/yarn-project/circuits.js/src/barretenberg/crypto/grumpkin/index.test.ts b/yarn-project/circuits.js/src/barretenberg/crypto/grumpkin/index.test.ts index 25f2de5f5d23..db0b31c6fcf2 100644 --- a/yarn-project/circuits.js/src/barretenberg/crypto/grumpkin/index.test.ts +++ b/yarn-project/circuits.js/src/barretenberg/crypto/grumpkin/index.test.ts @@ -1,9 +1,9 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { GrumpkinScalar, type Point } from '../../../index.js'; import { Grumpkin } from './index.js'; -const log = createDebugLogger('bb:grumpkin_test'); +const log = createLogger('circuits:grumpkin_test'); describe('grumpkin', () => { let grumpkin!: Grumpkin; diff --git a/yarn-project/circuits.js/src/contract/artifact_hash.ts b/yarn-project/circuits.js/src/contract/artifact_hash.ts index a7bc52ae7adf..cbfa334609c2 100644 --- a/yarn-project/circuits.js/src/contract/artifact_hash.ts +++ b/yarn-project/circuits.js/src/contract/artifact_hash.ts @@ -1,7 +1,7 @@ import { type ContractArtifact, type FunctionArtifact, FunctionSelector, FunctionType } from '@aztec/foundation/abi'; import { sha256 } from '@aztec/foundation/crypto'; import { Fr, reduceFn } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { numToUInt8 } from '@aztec/foundation/serialize'; import { type MerkleTree } from '../merkle/merkle_tree.js'; @@ -47,7 +47,7 @@ export function computeArtifactHash( const preimage = computeArtifactHashPreimage(artifact); const artifactHash = computeArtifactHash(computeArtifactHashPreimage(artifact)); - getLogger().debug('Computed artifact hash', { artifactHash, ...preimage }); + getLogger().trace('Computed artifact hash', { artifactHash, ...preimage }); return artifactHash; } @@ -103,7 +103,7 @@ export function computeFunctionMetadataHash(fn: FunctionArtifact) { } function getLogger() { - return createDebugLogger('aztec:circuits:artifact_hash'); + return createLogger('circuits:artifact_hash'); } export function getArtifactMerkleTreeHasher() { diff --git a/yarn-project/circuits.js/src/contract/private_function_membership_proof.ts b/yarn-project/circuits.js/src/contract/private_function_membership_proof.ts index 0d46fc62f5f0..9d1e28212ae5 100644 --- a/yarn-project/circuits.js/src/contract/private_function_membership_proof.ts +++ b/yarn-project/circuits.js/src/contract/private_function_membership_proof.ts @@ -1,7 +1,7 @@ import { type ContractArtifact, type FunctionSelector, FunctionType } from '@aztec/foundation/abi'; import { poseidon2Hash } from '@aztec/foundation/crypto'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { computeRootFromSiblingPath } from '../merkle/index.js'; import { @@ -29,7 +29,7 @@ export function createPrivateFunctionMembershipProof( selector: FunctionSelector, artifact: ContractArtifact, ): PrivateFunctionMembershipProof { - const log = createDebugLogger('aztec:circuits:function_membership_proof'); + const log = createLogger('circuits:function_membership_proof'); // Locate private function definition and artifact const privateFunctions = artifact.functions @@ -107,7 +107,7 @@ export function isValidPrivateFunctionMembershipProof( fn: ExecutablePrivateFunctionWithMembershipProof, contractClass: Pick, ) { - const log = createDebugLogger('aztec:circuits:function_membership_proof'); + const log = createLogger('circuits:function_membership_proof'); // Check private function tree membership const functionLeaf = computePrivateFunctionLeaf(fn); diff --git a/yarn-project/circuits.js/src/contract/unconstrained_function_membership_proof.ts b/yarn-project/circuits.js/src/contract/unconstrained_function_membership_proof.ts index 309078338f76..fb36b03110ea 100644 --- a/yarn-project/circuits.js/src/contract/unconstrained_function_membership_proof.ts +++ b/yarn-project/circuits.js/src/contract/unconstrained_function_membership_proof.ts @@ -1,6 +1,6 @@ import { type ContractArtifact, type FunctionSelector, FunctionType } from '@aztec/foundation/abi'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { computeRootFromSiblingPath } from '../merkle/index.js'; import { @@ -26,7 +26,7 @@ export function createUnconstrainedFunctionMembershipProof( selector: FunctionSelector, artifact: ContractArtifact, ): UnconstrainedFunctionMembershipProof { - const log = createDebugLogger('aztec:circuits:function_membership_proof'); + const log = createLogger('circuits:function_membership_proof'); // Locate function artifact const fn = artifact.functions.find(fn => selector.equals(fn)); @@ -85,7 +85,7 @@ export function isValidUnconstrainedFunctionMembershipProof( fn: UnconstrainedFunctionWithMembershipProof, contractClass: Pick, ) { - const log = createDebugLogger('aztec:circuits:function_membership_proof'); + const log = createLogger('circuits:function_membership_proof'); const functionArtifactHash = computeFunctionArtifactHash(fn); const computedArtifactFunctionTreeRoot = Fr.fromBuffer( diff --git a/yarn-project/circuits.js/src/structs/global_variables.ts b/yarn-project/circuits.js/src/structs/global_variables.ts index 914dc7b5fb61..240b4d9abedf 100644 --- a/yarn-project/circuits.js/src/structs/global_variables.ts +++ b/yarn-project/circuits.js/src/structs/global_variables.ts @@ -159,10 +159,22 @@ export class GlobalVariables { ); } + toInspect() { + return { + chainId: this.chainId.toNumber(), + version: this.version.toNumber(), + blockNumber: this.blockNumber.toNumber(), + slotNumber: this.slotNumber.toNumber(), + timestamp: this.timestamp.toNumber(), + coinbase: this.coinbase.toString(), + feeRecipient: this.feeRecipient.toString(), + feePerDaGas: this.gasFees.feePerDaGas.toNumber(), + feePerL2Gas: this.gasFees.feePerL2Gas.toNumber(), + }; + } + [inspect.custom]() { - return `GlobalVariables { chainId: ${this.chainId.toString()}, version: ${this.version.toString()}, blockNumber: ${this.blockNumber.toString()}, slotNumber: ${this.slotNumber.toString()}, timestamp: ${this.timestamp.toString()}, coinbase: ${this.coinbase.toString()}, feeRecipient: ${this.feeRecipient.toString()}, gasFees: ${inspect( - this.gasFees, - )} }`; + return `GlobalVariables ${inspect(this.toInspect())}`; } public equals(other: this): boolean { diff --git a/yarn-project/cli-wallet/package.json b/yarn-project/cli-wallet/package.json index e8fe9b83dfb5..e33bf41c8058 100644 --- a/yarn-project/cli-wallet/package.json +++ b/yarn-project/cli-wallet/package.json @@ -19,7 +19,7 @@ "scripts": { "start": "node --no-warnings ./dest/bin", "start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin", - "dev": "DEBUG='aztec:*' LOG_LEVEL=debug && node ./dest/bin", + "dev": "LOG_LEVEL=debug && node ./dest/bin", "build": "yarn clean && tsc -b", "build:dev": "tsc -b --watch", "clean": "rm -rf ./dest .tsbuildinfo", @@ -100,4 +100,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/cli-wallet/src/bin/index.ts b/yarn-project/cli-wallet/src/bin/index.ts index 638c800d1907..28957c0aac49 100644 --- a/yarn-project/cli-wallet/src/bin/index.ts +++ b/yarn-project/cli-wallet/src/bin/index.ts @@ -1,5 +1,5 @@ import { Fr, computeSecretHash, fileURLToPath } from '@aztec/aztec.js'; -import { type LogFn, createConsoleLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type LogFn, createConsoleLogger, createLogger } from '@aztec/foundation/log'; import { AztecLmdbStore } from '@aztec/kv-store/lmdb'; import { Argument, Command } from 'commander'; @@ -11,7 +11,7 @@ import { Aliases, WalletDB } from '../storage/wallet_db.js'; import { createAliasOption } from '../utils/options/index.js'; const userLog = createConsoleLogger(); -const debugLogger = createDebugLogger('aztec:wallet'); +const debugLogger = createLogger('wallet'); const { WALLET_DATA_DIRECTORY } = process.env; diff --git a/yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts b/yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts index 12daf7172c39..82f02d28784e 100644 --- a/yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts +++ b/yarn-project/cli-wallet/src/cmds/bridge_fee_juice.ts @@ -3,7 +3,7 @@ import { prettyPrintJSON } from '@aztec/cli/utils'; import { createEthereumChain, createL1Clients } from '@aztec/ethereum'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; export async function bridgeL1FeeJuice( amount: bigint, @@ -18,7 +18,7 @@ export async function bridgeL1FeeJuice( wait: boolean, interval = 60_000, log: LogFn, - debugLogger: DebugLogger, + debugLogger: Logger, ) { // Prepare L1 client const chain = createEthereumChain(l1RpcUrl, chainId); diff --git a/yarn-project/cli-wallet/src/cmds/create_account.ts b/yarn-project/cli-wallet/src/cmds/create_account.ts index 4d21262c97fb..c339f8a70464 100644 --- a/yarn-project/cli-wallet/src/cmds/create_account.ts +++ b/yarn-project/cli-wallet/src/cmds/create_account.ts @@ -1,7 +1,7 @@ import { type DeployAccountOptions, type PXE } from '@aztec/aztec.js'; import { prettyPrintJSON } from '@aztec/cli/cli-utils'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type AccountType, createOrRetrieveAccount } from '../utils/accounts.js'; import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js'; @@ -18,7 +18,7 @@ export async function createAccount( wait: boolean, feeOpts: IFeeOpts, json: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { secretKey ??= Fr.random(); diff --git a/yarn-project/cli-wallet/src/cmds/deploy.ts b/yarn-project/cli-wallet/src/cmds/deploy.ts index d105e8e50634..a4e28b78a8e1 100644 --- a/yarn-project/cli-wallet/src/cmds/deploy.ts +++ b/yarn-project/cli-wallet/src/cmds/deploy.ts @@ -2,7 +2,7 @@ import { type AccountWalletWithSecretKey, ContractDeployer, type DeployMethod, F import { PublicKeys } from '@aztec/circuits.js'; import { GITHUB_TAG_PREFIX, encodeArgs, getContractArtifact } from '@aztec/cli/utils'; import { getInitializer } from '@aztec/foundation/abi'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js'; @@ -21,7 +21,7 @@ export async function deploy( universalDeploy: boolean | undefined, wait: boolean, feeOpts: IFeeOpts, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, logJson: (output: any) => void, ) { diff --git a/yarn-project/cli-wallet/src/cmds/deploy_account.ts b/yarn-project/cli-wallet/src/cmds/deploy_account.ts index 0c9c8235094e..d6b76f482dae 100644 --- a/yarn-project/cli-wallet/src/cmds/deploy_account.ts +++ b/yarn-project/cli-wallet/src/cmds/deploy_account.ts @@ -1,6 +1,6 @@ import { type AccountManager, type DeployAccountOptions } from '@aztec/aztec.js'; import { prettyPrintJSON } from '@aztec/cli/cli-utils'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js'; @@ -9,7 +9,7 @@ export async function deployAccount( wait: boolean, feeOpts: IFeeOpts, json: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const out: Record = {}; diff --git a/yarn-project/cli-wallet/src/cmds/index.ts b/yarn-project/cli-wallet/src/cmds/index.ts index a286ad586038..9ff7c46928d4 100644 --- a/yarn-project/cli-wallet/src/cmds/index.ts +++ b/yarn-project/cli-wallet/src/cmds/index.ts @@ -13,7 +13,7 @@ import { parsePublicKey, pxeOption, } from '@aztec/cli/utils'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command, Option } from 'commander'; import inquirer from 'inquirer'; @@ -40,7 +40,7 @@ import { parsePaymentMethod, } from '../utils/options/index.js'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger, db?: WalletDB) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger, db?: WalletDB) { const createAccountCommand = program .command('create-account') .description( diff --git a/yarn-project/cli/src/cmds/contracts/index.ts b/yarn-project/cli/src/cmds/contracts/index.ts index 368151c92a03..99bf4788a73a 100644 --- a/yarn-project/cli/src/cmds/contracts/index.ts +++ b/yarn-project/cli/src/cmds/contracts/index.ts @@ -1,8 +1,8 @@ -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command } from 'commander'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { program .command('inspect-contract') .description('Shows list of external callable functions for a contract') diff --git a/yarn-project/cli/src/cmds/contracts/inspect_contract.ts b/yarn-project/cli/src/cmds/contracts/inspect_contract.ts index 7274141cc2f8..f1d4bbbb8edc 100644 --- a/yarn-project/cli/src/cmds/contracts/inspect_contract.ts +++ b/yarn-project/cli/src/cmds/contracts/inspect_contract.ts @@ -6,11 +6,11 @@ import { decodeFunctionSignatureWithParameterNames, } from '@aztec/foundation/abi'; import { sha256 } from '@aztec/foundation/crypto'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { getContractArtifact } from '../../utils/aztec.js'; -export async function inspectContract(contractArtifactFile: string, debugLogger: DebugLogger, log: LogFn) { +export async function inspectContract(contractArtifactFile: string, debugLogger: Logger, log: LogFn) { const contractArtifact = await getContractArtifact(contractArtifactFile, log); const contractFns = contractArtifact.functions.filter(f => f.name !== 'compute_note_hash_and_optionally_a_nullifier'); if (contractFns.length === 0) { diff --git a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts index 12073936e110..8e0f6e56532c 100644 --- a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts +++ b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts @@ -9,7 +9,7 @@ import { createL1Clients, deployL1Contract, } from '@aztec/ethereum'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { getContract } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; @@ -34,7 +34,7 @@ export async function bootstrapNetwork( l1Mnemonic: string, json: boolean, log: LogFn, - debugLog: DebugLogger, + debugLog: Logger, ) { const pxe = await createCompatibleClient(pxeUrl, debugLog); @@ -248,7 +248,7 @@ async function fundFPC( wallet: Wallet, l1Clients: L1Clients, fpcAddress: AztecAddress, - debugLog: DebugLogger, + debugLog: Logger, ) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment diff --git a/yarn-project/cli/src/cmds/devnet/index.ts b/yarn-project/cli/src/cmds/devnet/index.ts index 3fdbe0121ec9..bf56f1d0b51f 100644 --- a/yarn-project/cli/src/cmds/devnet/index.ts +++ b/yarn-project/cli/src/cmds/devnet/index.ts @@ -1,10 +1,10 @@ -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command } from 'commander'; import { ETHEREUM_HOST, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { program .command('bootstrap-network') .description('Bootstrap a new network') diff --git a/yarn-project/cli/src/cmds/infrastructure/index.ts b/yarn-project/cli/src/cmds/infrastructure/index.ts index 836e6b822580..1c1f1eb272f5 100644 --- a/yarn-project/cli/src/cmds/infrastructure/index.ts +++ b/yarn-project/cli/src/cmds/infrastructure/index.ts @@ -1,10 +1,10 @@ -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command } from 'commander'; import { ETHEREUM_HOST, l1ChainIdOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { program .command('setup-protocol-contracts') .description('Bootstrap the blockchain by initializing all the protocol contracts') diff --git a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts index 341744f0a6c4..e7a610f859b5 100644 --- a/yarn-project/cli/src/cmds/infrastructure/sequencers.ts +++ b/yarn-project/cli/src/cmds/infrastructure/sequencers.ts @@ -1,6 +1,6 @@ import { createCompatibleClient } from '@aztec/aztec.js'; import { createEthereumChain } from '@aztec/ethereum'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { createPublicClient, createWalletClient, getContract, http } from 'viem'; @@ -15,7 +15,7 @@ export async function sequencers(opts: { chainId: number; blockNumber?: number; log: LogFn; - debugLogger: DebugLogger; + debugLogger: Logger; }) { const { command, who: maybeWho, mnemonic, rpcUrl, l1RpcUrl, chainId, log, debugLogger } = opts; const client = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/l1/bridge_erc20.ts b/yarn-project/cli/src/cmds/l1/bridge_erc20.ts index 393c315f6a40..f62bf05e7cc6 100644 --- a/yarn-project/cli/src/cmds/l1/bridge_erc20.ts +++ b/yarn-project/cli/src/cmds/l1/bridge_erc20.ts @@ -1,7 +1,7 @@ import { L1ToL2TokenPortalManager } from '@aztec/aztec.js'; import { type AztecAddress, type EthAddress, type Fr } from '@aztec/circuits.js'; import { createEthereumChain, createL1Clients } from '@aztec/ethereum'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { prettyPrintJSON } from '../../utils/commands.js'; @@ -18,7 +18,7 @@ export async function bridgeERC20( mint: boolean, json: boolean, log: LogFn, - debugLogger: DebugLogger, + debugLogger: Logger, ) { // Prepare L1 client const chain = createEthereumChain(l1RpcUrl, chainId); diff --git a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts index 2d7165ff442e..0bca9b676a39 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_contracts.ts @@ -1,6 +1,6 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { type EthAddress } from '@aztec/foundation/eth-address'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { deployAztecContracts } from '../../utils/aztec.js'; @@ -13,7 +13,7 @@ export async function deployL1Contracts( json: boolean, initialValidators: EthAddress[], log: LogFn, - debugLogger: DebugLogger, + debugLogger: Logger, ) { const config = getL1ContractsConfigEnvVars(); diff --git a/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts b/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts index 4150479fbd69..6a587422d5b5 100644 --- a/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts +++ b/yarn-project/cli/src/cmds/l1/deploy_l1_verifier.ts @@ -1,6 +1,6 @@ import { createCompatibleClient } from '@aztec/aztec.js'; import { compileContract, createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { InvalidOptionArgumentError } from 'commander'; // @ts-expect-error solc-js doesn't publish its types https://github.com/ethereum/solc-js/issues/689 @@ -17,7 +17,7 @@ export async function deployUltraHonkVerifier( bbBinaryPath: string, bbWorkingDirectory: string, log: LogFn, - debugLogger: DebugLogger, + debugLogger: Logger, ) { if (!bbBinaryPath || !bbWorkingDirectory) { throw new InvalidOptionArgumentError('Missing path to bb binary and working directory'); @@ -79,7 +79,7 @@ export async function deployMockVerifier( mnemonic: string, pxeRpcUrl: string, log: LogFn, - debugLogger: DebugLogger, + debugLogger: Logger, ) { const { publicClient, walletClient } = createL1Clients( ethRpcUrl, diff --git a/yarn-project/cli/src/cmds/l1/index.ts b/yarn-project/cli/src/cmds/l1/index.ts index 5bb1ff71240b..f5d67fa77f70 100644 --- a/yarn-project/cli/src/cmds/l1/index.ts +++ b/yarn-project/cli/src/cmds/l1/index.ts @@ -1,5 +1,5 @@ import { EthAddress } from '@aztec/foundation/eth-address'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command, Option } from 'commander'; @@ -14,7 +14,7 @@ import { pxeOption, } from '../../utils/commands.js'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env; program diff --git a/yarn-project/cli/src/cmds/l1/prover_stats.ts b/yarn-project/cli/src/cmds/l1/prover_stats.ts index 8a9acbb0da04..424b37b50bb8 100644 --- a/yarn-project/cli/src/cmds/l1/prover_stats.ts +++ b/yarn-project/cli/src/cmds/l1/prover_stats.ts @@ -3,7 +3,7 @@ import { createAztecNodeClient } from '@aztec/circuit-types'; import { EthAddress } from '@aztec/circuits.js'; import { createEthereumChain } from '@aztec/ethereum'; import { compactArray, mapValues, unique } from '@aztec/foundation/collection'; -import { type LogFn, type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import chunk from 'lodash.chunk'; @@ -22,7 +22,7 @@ export async function proverStats(opts: { provingTimeout: bigint | undefined; rawLogs: boolean; }) { - const debugLog = createDebugLogger('aztec:cli:prover_stats'); + const debugLog = createLogger('cli:prover_stats'); const { startBlock, chainId, l1RpcUrl, l1RollupAddress, batchSize, nodeUrl, provingTimeout, endBlock, rawLogs, log } = opts; if (!l1RollupAddress && !nodeUrl) { diff --git a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts index 4f3d33eb5745..81add7e93578 100644 --- a/yarn-project/cli/src/cmds/l1/update_l1_validators.ts +++ b/yarn-project/cli/src/cmds/l1/update_l1_validators.ts @@ -1,7 +1,7 @@ import { EthCheatCodes } from '@aztec/aztec.js'; import { type EthAddress } from '@aztec/circuits.js'; import { createEthereumChain, getL1ContractsConfigEnvVars, isAnvilTestChain } from '@aztec/ethereum'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { createPublicClient, createWalletClient, getContract, http } from 'viem'; @@ -17,7 +17,7 @@ export interface RollupCommandArgs { export interface LoggerArgs { log: LogFn; - debugLogger: DebugLogger; + debugLogger: Logger; } export function generateL1Account() { @@ -180,7 +180,7 @@ export async function debugRollup({ rpcUrl, chainId, rollupAddress, log }: Rollu log(`Proposer NOW: ${proposer.toString()}`); } -function makeDualLog(log: LogFn, debugLogger: DebugLogger) { +function makeDualLog(log: LogFn, debugLogger: Logger) { return (msg: string) => { log(msg); debugLogger.info(msg); diff --git a/yarn-project/cli/src/cmds/pxe/add_contract.ts b/yarn-project/cli/src/cmds/pxe/add_contract.ts index 3904930d04cc..0638c50239f0 100644 --- a/yarn-project/cli/src/cmds/pxe/add_contract.ts +++ b/yarn-project/cli/src/cmds/pxe/add_contract.ts @@ -2,7 +2,7 @@ import { AztecAddress, type ContractInstanceWithAddress, type Fr, getContractCla import { createCompatibleClient } from '@aztec/aztec.js'; import { PublicKeys } from '@aztec/circuits.js'; import { computeContractAddressFromInstance } from '@aztec/circuits.js/contract'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { getContractArtifact } from '../../utils/aztec.js'; @@ -14,7 +14,7 @@ export async function addContract( salt: Fr, publicKeys: PublicKeys, deployer: AztecAddress | undefined, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const artifact = await getContractArtifact(contractArtifactPath, log); diff --git a/yarn-project/cli/src/cmds/pxe/block_number.ts b/yarn-project/cli/src/cmds/pxe/block_number.ts index 63af6bc25a01..8e34ec157b37 100644 --- a/yarn-project/cli/src/cmds/pxe/block_number.ts +++ b/yarn-project/cli/src/cmds/pxe/block_number.ts @@ -1,7 +1,7 @@ import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; -export async function blockNumber(rpcUrl: string, debugLogger: DebugLogger, log: LogFn) { +export async function blockNumber(rpcUrl: string, debugLogger: Logger, log: LogFn) { const client = await createCompatibleClient(rpcUrl, debugLogger); const [latestNum, provenNum] = await Promise.all([client.getBlockNumber(), client.getProvenBlockNumber()]); log(`Latest block: ${latestNum}`); diff --git a/yarn-project/cli/src/cmds/pxe/get_account.ts b/yarn-project/cli/src/cmds/pxe/get_account.ts index e54f8ada5680..90e95b211300 100644 --- a/yarn-project/cli/src/cmds/pxe/get_account.ts +++ b/yarn-project/cli/src/cmds/pxe/get_account.ts @@ -1,8 +1,8 @@ import { type AztecAddress } from '@aztec/aztec.js'; import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; -export async function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: DebugLogger, log: LogFn) { +export async function getAccount(aztecAddress: AztecAddress, rpcUrl: string, debugLogger: Logger, log: LogFn) { const client = await createCompatibleClient(rpcUrl, debugLogger); const account = await client.getRegisteredAccount(aztecAddress); diff --git a/yarn-project/cli/src/cmds/pxe/get_accounts.ts b/yarn-project/cli/src/cmds/pxe/get_accounts.ts index baa64d6bf404..71d70d0d713c 100644 --- a/yarn-project/cli/src/cmds/pxe/get_accounts.ts +++ b/yarn-project/cli/src/cmds/pxe/get_accounts.ts @@ -1,10 +1,10 @@ import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; export async function getAccounts( rpcUrl: string, json: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, logJson: (output: any) => void, ) { diff --git a/yarn-project/cli/src/cmds/pxe/get_block.ts b/yarn-project/cli/src/cmds/pxe/get_block.ts index efe47f4148e5..d1584950ff19 100644 --- a/yarn-project/cli/src/cmds/pxe/get_block.ts +++ b/yarn-project/cli/src/cmds/pxe/get_block.ts @@ -1,5 +1,5 @@ import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { inspectBlock } from '../../utils/inspect.js'; @@ -7,7 +7,7 @@ export async function getBlock( rpcUrl: string, maybeBlockNumber: number | undefined, follow: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const client = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/pxe/get_contract_data.ts b/yarn-project/cli/src/cmds/pxe/get_contract_data.ts index 34972a33d840..e8bbea555030 100644 --- a/yarn-project/cli/src/cmds/pxe/get_contract_data.ts +++ b/yarn-project/cli/src/cmds/pxe/get_contract_data.ts @@ -1,12 +1,12 @@ import { type AztecAddress } from '@aztec/aztec.js'; import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; export async function getContractData( rpcUrl: string, contractAddress: AztecAddress, includeBytecode: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const client = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/pxe/get_current_base_fee.ts b/yarn-project/cli/src/cmds/pxe/get_current_base_fee.ts index c736a4766b64..b77e3c3595ed 100644 --- a/yarn-project/cli/src/cmds/pxe/get_current_base_fee.ts +++ b/yarn-project/cli/src/cmds/pxe/get_current_base_fee.ts @@ -1,8 +1,8 @@ import { createCompatibleClient } from '@aztec/aztec.js'; import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; -export async function getCurrentBaseFee(rpcUrl: string, debugLogger: DebugLogger, log: LogFn) { +export async function getCurrentBaseFee(rpcUrl: string, debugLogger: Logger, log: LogFn) { const client = await createCompatibleClient(rpcUrl, debugLogger); const fees = await client.getCurrentBaseFees(); log(`Current fees: ${jsonStringify(fees)}`); diff --git a/yarn-project/cli/src/cmds/pxe/get_l1_to_l2_message_witness.ts b/yarn-project/cli/src/cmds/pxe/get_l1_to_l2_message_witness.ts index aff3b463507c..c339dc211302 100644 --- a/yarn-project/cli/src/cmds/pxe/get_l1_to_l2_message_witness.ts +++ b/yarn-project/cli/src/cmds/pxe/get_l1_to_l2_message_witness.ts @@ -1,12 +1,12 @@ import { type AztecAddress, type Fr, createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; export async function getL1ToL2MessageWitness( rpcUrl: string, contractAddress: AztecAddress, messageHash: Fr, secret: Fr, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const client = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/pxe/get_logs.ts b/yarn-project/cli/src/cmds/pxe/get_logs.ts index cd089afff0b6..b976956d7b7c 100644 --- a/yarn-project/cli/src/cmds/pxe/get_logs.ts +++ b/yarn-project/cli/src/cmds/pxe/get_logs.ts @@ -1,6 +1,6 @@ import { type AztecAddress, type LogFilter, type LogId, type TxHash } from '@aztec/aztec.js'; import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; export async function getLogs( @@ -11,7 +11,7 @@ export async function getLogs( contractAddress: AztecAddress, rpcUrl: string, follow: boolean, - debugLogger: DebugLogger, + debugLogger: Logger, log: LogFn, ) { const pxe = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/pxe/get_node_info.ts b/yarn-project/cli/src/cmds/pxe/get_node_info.ts index bbef7fde3e80..7ce7911ca65e 100644 --- a/yarn-project/cli/src/cmds/pxe/get_node_info.ts +++ b/yarn-project/cli/src/cmds/pxe/get_node_info.ts @@ -1,7 +1,7 @@ import { type AztecNode, type PXE, createAztecNodeClient, createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; -export async function getNodeInfo(rpcUrl: string, pxeRequest: boolean, debugLogger: DebugLogger, log: LogFn) { +export async function getNodeInfo(rpcUrl: string, pxeRequest: boolean, debugLogger: Logger, log: LogFn) { let client: AztecNode | PXE; if (pxeRequest) { client = await createCompatibleClient(rpcUrl, debugLogger); diff --git a/yarn-project/cli/src/cmds/pxe/get_pxe_info.ts b/yarn-project/cli/src/cmds/pxe/get_pxe_info.ts index ac10160694b3..57e3511997f0 100644 --- a/yarn-project/cli/src/cmds/pxe/get_pxe_info.ts +++ b/yarn-project/cli/src/cmds/pxe/get_pxe_info.ts @@ -1,7 +1,7 @@ import { createCompatibleClient } from '@aztec/aztec.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; -export async function getPXEInfo(rpcUrl: string, debugLogger: DebugLogger, log: LogFn) { +export async function getPXEInfo(rpcUrl: string, debugLogger: Logger, log: LogFn) { const client = await createCompatibleClient(rpcUrl, debugLogger); const info = await client.getPXEInfo(); log(`PXE Version: ${info.pxeVersion}`); diff --git a/yarn-project/cli/src/cmds/pxe/index.ts b/yarn-project/cli/src/cmds/pxe/index.ts index ec3fec68ee7a..1a36d7e72266 100644 --- a/yarn-project/cli/src/cmds/pxe/index.ts +++ b/yarn-project/cli/src/cmds/pxe/index.ts @@ -1,5 +1,5 @@ import { Fr } from '@aztec/circuits.js'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type Command } from 'commander'; @@ -19,7 +19,7 @@ import { pxeOption, } from '../../utils/commands.js'; -export function injectCommands(program: Command, log: LogFn, debugLogger: DebugLogger) { +export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) { program .command('add-contract') .description( diff --git a/yarn-project/cli/src/utils/aztec.ts b/yarn-project/cli/src/utils/aztec.ts index 08d4d4d02001..97759f65ec53 100644 --- a/yarn-project/cli/src/utils/aztec.ts +++ b/yarn-project/cli/src/utils/aztec.ts @@ -3,7 +3,7 @@ import { type PXE } from '@aztec/circuit-types'; import { type DeployL1Contracts, type L1ContractsConfig } from '@aztec/ethereum'; import { FunctionType } from '@aztec/foundation/abi'; import { type EthAddress } from '@aztec/foundation/eth-address'; -import { type DebugLogger, type LogFn } from '@aztec/foundation/log'; +import { type LogFn, type Logger } from '@aztec/foundation/log'; import { type NoirPackageConfig } from '@aztec/foundation/noir'; import { RollupAbi } from '@aztec/l1-artifacts'; import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts'; @@ -59,7 +59,7 @@ export async function deployAztecContracts( salt: number | undefined, initialValidators: EthAddress[], config: L1ContractsConfig, - debugLogger: DebugLogger, + debugLogger: Logger, ): Promise { const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum'); const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts'); diff --git a/yarn-project/end-to-end/package.json b/yarn-project/end-to-end/package.json index d9514c42dfb4..047609c40157 100644 --- a/yarn-project/end-to-end/package.json +++ b/yarn-project/end-to-end/package.json @@ -15,11 +15,11 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "run -T prettier --check ./src \"!src/web/main.js\" && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", - "test": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", + "test": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", "test:with-alerts": "./scripts/test-with-alerts.sh", - "test:profile": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 0x --output-dir \"flame_graph/{pid}.0x\" -- node --experimental-vm-modules ../node_modules/jest/bin/jest.js --runInBand --testTimeout=300000 --forceExit", + "test:profile": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 0x --output-dir \"flame_graph/{pid}.0x\" -- node --experimental-vm-modules ../node_modules/jest/bin/jest.js --runInBand --testTimeout=300000 --forceExit", "serve:flames": "python3 -m http.server --directory \"flame_graph\" 8000", - "test:debug": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --inspect --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", + "test:debug": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --inspect --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", "test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"", "test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --no-cache --runInBand --config jest.integration.config.json", "test:unit": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest src/fixtures" @@ -93,7 +93,6 @@ "viem": "^2.7.15", "webpack": "^5.88.2", "webpack-cli": "^5.1.4", - "winston": "^3.10.0", "zod": "^3.23.8" }, "devDependencies": { @@ -157,4 +156,4 @@ "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$", "rootDir": "./src" } -} +} \ No newline at end of file diff --git a/yarn-project/end-to-end/package.local.json b/yarn-project/end-to-end/package.local.json index a5214893419b..cbb0987a9dc8 100644 --- a/yarn-project/end-to-end/package.local.json +++ b/yarn-project/end-to-end/package.local.json @@ -2,7 +2,7 @@ "scripts": { "build": "yarn clean && tsc -b && webpack", "formatting": "run -T prettier --check ./src \"!src/web/main.js\" && run -T eslint ./src", - "test": "LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", + "test": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", "test:unit": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest src/fixtures" } -} +} \ No newline at end of file diff --git a/yarn-project/end-to-end/scripts/docker-compose-devnet.yml b/yarn-project/end-to-end/scripts/docker-compose-devnet.yml index 4f6efe441ad2..d8ce6a6b7b47 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-devnet.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-devnet.yml @@ -7,8 +7,7 @@ services: - aztec-node-url - faucet-url environment: - DEBUG: ${DEBUG:-'aztec:*'} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: JOB_NAME: ${JOB_NAME:-''} PXE_PROVER_ENABLED: ${PXE_PROVER_ENABLED:-1} diff --git a/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml b/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml index 26aee9130358..2fbbabb4d6dd 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-no-sandbox.yml @@ -11,8 +11,7 @@ services: image: aztecprotocol/end-to-end:${AZTEC_DOCKER_TAG:-latest} environment: BENCHMARK: 'true' - DEBUG: ${DEBUG:-'aztec:*'} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 diff --git a/yarn-project/end-to-end/scripts/docker-compose-p2p.yml b/yarn-project/end-to-end/scripts/docker-compose-p2p.yml index f5c79b9c0c28..c16d467ac9e2 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-p2p.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-p2p.yml @@ -14,8 +14,8 @@ services: - '40400:40400/tcp' - '40400:40400/udp' environment: - DEBUG: 'aztec:*' - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} + DEBUG: ${DEBUG:-""} P2P_TCP_LISTEN_ADDR: '0.0.0.0:40400' P2P_TCP_ANNOUNCE_ADDR: 'p2p-bootstrap:40400' P2P_UDP_ANNOUNCE_ADDR: 'p2p-bootstrap:40400' @@ -25,8 +25,8 @@ services: image: aztecprotocol/end-to-end:${AZTEC_DOCKER_TAG:-latest} environment: BENCHMARK: true - DEBUG: ${DEBUG:-'aztec:*'} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} + DEBUG: ${DEBUG:-""} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 500 diff --git a/yarn-project/end-to-end/scripts/docker-compose-wallet.yml b/yarn-project/end-to-end/scripts/docker-compose-wallet.yml index 7aa1646aa727..b1a421ed5752 100644 --- a/yarn-project/end-to-end/scripts/docker-compose-wallet.yml +++ b/yarn-project/end-to-end/scripts/docker-compose-wallet.yml @@ -11,8 +11,7 @@ services: image: aztecprotocol/aztec:${AZTEC_DOCKER_TAG:-latest} command: 'start --sandbox' environment: - DEBUG: 'aztec:*' - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 @@ -29,8 +28,7 @@ services: end-to-end: image: aztecprotocol/end-to-end:${AZTEC_DOCKER_TAG:-latest} environment: - DEBUG: ${DEBUG:-aztec:*} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 PXE_URL: http://sandbox:8080 diff --git a/yarn-project/end-to-end/scripts/docker-compose.yml b/yarn-project/end-to-end/scripts/docker-compose.yml index 75b9cd0d36ff..f1aa66cc7ff4 100644 --- a/yarn-project/end-to-end/scripts/docker-compose.yml +++ b/yarn-project/end-to-end/scripts/docker-compose.yml @@ -11,8 +11,7 @@ services: image: aztecprotocol/aztec:${AZTEC_DOCKER_TAG:-latest} command: 'start --sandbox' environment: - DEBUG: ${DEBUG:-aztec:*,-aztec:avm_simulator:memory} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 ARCHIVER_POLLING_INTERVAL_MS: 50 @@ -30,8 +29,7 @@ services: image: aztecprotocol/end-to-end:${AZTEC_DOCKER_TAG:-latest} environment: BENCHMARK: 'true' - DEBUG: ${DEBUG:-aztec:*,-aztec:avm_simulator:memory} - DEBUG_COLORS: 1 + LOG_LEVEL: ${LOG_LEVEL:-'verbose'} ETHEREUM_HOST: http://fork:8545 L1_CHAIN_ID: 31337 PXE_URL: http://sandbox:8080 diff --git a/yarn-project/end-to-end/scripts/e2e_compose_test.sh b/yarn-project/end-to-end/scripts/e2e_compose_test.sh index e6a74f587457..2cfdda8f712e 100755 --- a/yarn-project/end-to-end/scripts/e2e_compose_test.sh +++ b/yarn-project/end-to-end/scripts/e2e_compose_test.sh @@ -3,7 +3,7 @@ # Usage: ./e2e_compose_test.sh # Optional environment variables: # COMPOSE_FILE (default: ./scripts/docker-compose.yml) -# DEBUG (default: "aztec:*") +# LOG_LEVEL (default: "verbose") # HARDWARE_CONCURRENCY (default: "") # ENABLE_GAS (default: "") # AZTEC_DOCKER_TAG (default: current git commit) @@ -16,7 +16,7 @@ set -eu export TEST="$1" # Variables with defaults COMPOSE_FILE="${COMPOSE_FILE:-./scripts/docker-compose.yml}" -export DEBUG="${DEBUG:-aztec:*,-aztec:avm_simulator:*}" +export LOG_LEVEL="${LOG_LEVEL:-verbose}" export HARDWARE_CONCURRENCY="${HARDWARE_CONCURRENCY:-}" export AZTEC_DOCKER_TAG="${AZTEC_DOCKER_TAG:-$(git rev-parse HEAD)}" diff --git a/yarn-project/end-to-end/scripts/e2e_test_config.yml b/yarn-project/end-to-end/scripts/e2e_test_config.yml index 8a65a011708d..2fb7902c93f8 100644 --- a/yarn-project/end-to-end/scripts/e2e_test_config.yml +++ b/yarn-project/end-to-end/scripts/e2e_test_config.yml @@ -4,19 +4,19 @@ tests: env: HARDWARE_CONCURRENCY: '32' COMPOSE_FILE: 'scripts/docker-compose-no-sandbox.yml' - DEBUG: 'aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees' + LOG_LEVEL: 'verbose; debug: aztec:benchmarks,aztec:sequencer,aztec:world_state,aztec:merkle_trees' command: './scripts/e2e_compose_test.sh bench_prover' bench_publish_rollup: env: HARDWARE_CONCURRENCY: '32' COMPOSE_FILE: 'scripts/docker-compose-no-sandbox.yml' - DEBUG: 'aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees' + LOG_LEVEL: 'verbose; debug: aztec:benchmarks,aztec:sequencer,aztec:world_state,aztec:merkle_trees' command: './scripts/e2e_compose_test.sh bench_publish_rollup' bench_tx_size: env: HARDWARE_CONCURRENCY: '32' COMPOSE_FILE: 'scripts/docker-compose-no-sandbox.yml' - DEBUG: 'aztec:benchmarks:*,aztec:sequencer,aztec:sequencer:*,aztec:world_state,aztec:merkle_trees' + LOG_LEVEL: 'verbose; debug: aztec:benchmarks,aztec:sequencer,aztec:world_state,aztec:merkle_trees' command: './scripts/e2e_compose_test.sh bench_tx_size' e2e_2_pxes: {} e2e_account_contracts: {} diff --git a/yarn-project/end-to-end/scripts/native-network/boot-node.sh b/yarn-project/end-to-end/scripts/native-network/boot-node.sh index 39067971ab94..0a569f93b10d 100755 --- a/yarn-project/end-to-end/scripts/native-network/boot-node.sh +++ b/yarn-project/end-to-end/scripts/native-network/boot-node.sh @@ -11,8 +11,8 @@ exec > >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log") 2> >(tee -a "$(dirname # Set environment variables export PORT=${PORT:-"8080"} -export DEBUG=${DEBUG:-"aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:*"} -export LOG_LEVEL=${LOG_LEVEL:-"debug"} +export DEBUG=${DEBUG:-""} +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://127.0.0.1:8545"} export P2P_ENABLED="true" export VALIDATOR_DISABLED="true" diff --git a/yarn-project/end-to-end/scripts/native-network/prover-node.sh b/yarn-project/end-to-end/scripts/native-network/prover-node.sh index 866ee0f73e9d..08a4c748855f 100755 --- a/yarn-project/end-to-end/scripts/native-network/prover-node.sh +++ b/yarn-project/end-to-end/scripts/native-network/prover-node.sh @@ -32,8 +32,8 @@ output=$(node --no-warnings "$REPO"/yarn-project/aztec/dest/bin/index.js get-nod export BOOTSTRAP_NODES=$(echo "$output" | grep -oP 'Node ENR: \K.*') # Set environment variables -export LOG_LEVEL=${LOG_LEVEL:-"debug"} -export DEBUG=${DEBUG:-"aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:*"} +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} +export DEBUG=${DEBUG:-""} export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://127.0.0.1:8545"} export PROVER_AGENT_COUNT="1" export PROVER_AGENT_ENABLED="true" diff --git a/yarn-project/end-to-end/scripts/native-network/pxe.sh b/yarn-project/end-to-end/scripts/native-network/pxe.sh index c7db13a4c562..ee1fbca03e5a 100755 --- a/yarn-project/end-to-end/scripts/native-network/pxe.sh +++ b/yarn-project/end-to-end/scripts/native-network/pxe.sh @@ -12,8 +12,7 @@ exec > >(tee -a "$(dirname $0)/logs/${SCRIPT_NAME}.log") 2> >(tee -a "$(dirname export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://127.0.0.1:8545"} export AZTEC_NODE_URL=${AZTEC_NODE_URL:-"http://127.0.0.1:8080"} export VALIDATOR_NODE_URL=${VALIDATOR_NODE_URL:-"http://127.0.0.1:8081"} -export LOG_LEVEL=${LOG_LEVEL:-"debug"} -export DEBUG="aztec:*" +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} echo "Waiting for Aztec Node..." until curl -s $AZTEC_NODE_URL/status >/dev/null; do diff --git a/yarn-project/end-to-end/scripts/native-network/test-4epochs.sh b/yarn-project/end-to-end/scripts/native-network/test-4epochs.sh index 3edbcd486372..3e00718517c3 100755 --- a/yarn-project/end-to-end/scripts/native-network/test-4epochs.sh +++ b/yarn-project/end-to-end/scripts/native-network/test-4epochs.sh @@ -31,7 +31,6 @@ until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/state/l2-contr done echo "Done waiting." -export DEBUG="aztec:*" -export LOG_LEVEL=${LOG_LEVEL:-"debug"} +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} cd $(git rev-parse --show-toplevel)/yarn-project/end-to-end -DEBUG=aztec:* yarn test src/spartan/4epochs.test.ts \ No newline at end of file +yarn test src/spartan/4epochs.test.ts \ No newline at end of file diff --git a/yarn-project/end-to-end/scripts/native-network/test-transfer.sh b/yarn-project/end-to-end/scripts/native-network/test-transfer.sh index e54d8966ede1..a58483c3fc06 100755 --- a/yarn-project/end-to-end/scripts/native-network/test-transfer.sh +++ b/yarn-project/end-to-end/scripts/native-network/test-transfer.sh @@ -32,7 +32,6 @@ until [ -f "$REPO"/yarn-project/end-to-end/scripts/native-network/state/l2-contr done echo "Done waiting." -export DEBUG="aztec:*" -export LOG_LEVEL=${LOG_LEVEL:-"debug"} +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} cd $(git rev-parse --show-toplevel)/yarn-project/end-to-end -DEBUG=aztec:* yarn test src/spartan/transfer.test.ts \ No newline at end of file +yarn test src/spartan/transfer.test.ts \ No newline at end of file diff --git a/yarn-project/end-to-end/scripts/native-network/transaction-bot.sh b/yarn-project/end-to-end/scripts/native-network/transaction-bot.sh index a42c2417ffde..038236dd63e3 100755 --- a/yarn-project/end-to-end/scripts/native-network/transaction-bot.sh +++ b/yarn-project/end-to-end/scripts/native-network/transaction-bot.sh @@ -37,8 +37,7 @@ fi # Set environment variables export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://127.0.0.1:8545"} export AZTEC_NODE_URL=${AZTEC_NODE_URL:-"http://127.0.0.1:8080"} -export LOG_LEVEL=${LOG_LEVEL:-"debug"} -export DEBUG="aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:*" +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} export BOT_PRIVATE_KEY="0xcafe" export BOT_TX_INTERVAL_SECONDS="5" export BOT_PRIVATE_TRANSFERS_PER_TX="1" diff --git a/yarn-project/end-to-end/scripts/native-network/validator.sh b/yarn-project/end-to-end/scripts/native-network/validator.sh index fa183829d61a..207952f9b0d0 100755 --- a/yarn-project/end-to-end/scripts/native-network/validator.sh +++ b/yarn-project/end-to-end/scripts/native-network/validator.sh @@ -49,7 +49,8 @@ fi export L1_PRIVATE_KEY=$VALIDATOR_PRIVATE_KEY export SEQ_PUBLISHER_PRIVATE_KEY=$VALIDATOR_PRIVATE_KEY -export DEBUG=${DEBUG:-"aztec:*,-aztec:avm_simulator*,-aztec:libp2p_service*,-aztec:circuits:artifact_hash,-json-rpc*,-aztec:l2_block_stream,-aztec:world-state:*"} +export DEBUG=${DEBUG:-""} +export LOG_LEVEL=${LOG_LEVEL:-"verbose"} export ETHEREUM_HOST=${ETHEREUM_HOST:-"http://127.0.0.1:8545"} # Automatically detect if we're using Anvil diff --git a/yarn-project/end-to-end/scripts/network_test.sh b/yarn-project/end-to-end/scripts/network_test.sh index e5de5ca71856..bcbda75d0504 100755 --- a/yarn-project/end-to-end/scripts/network_test.sh +++ b/yarn-project/end-to-end/scripts/network_test.sh @@ -176,7 +176,7 @@ docker run --rm --network=host \ -e HOST_METRICS_PORT=$METRICS_PORT \ -e CONTAINER_METRICS_PORT=80 \ -e GRAFANA_PASSWORD=$GRAFANA_PASSWORD \ - -e DEBUG="aztec:*" \ + -e DEBUG=${DEBUG:-""} \ -e LOG_JSON=1 \ - -e LOG_LEVEL=debug \ + -e LOG_LEVEL=verbose \ aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $TEST diff --git a/yarn-project/end-to-end/scripts/start_p2p_e2e.sh b/yarn-project/end-to-end/scripts/start_p2p_e2e.sh index edb89f08d827..d407b5623b70 100755 --- a/yarn-project/end-to-end/scripts/start_p2p_e2e.sh +++ b/yarn-project/end-to-end/scripts/start_p2p_e2e.sh @@ -1,6 +1,7 @@ #! /bin/bash set -eu -export DEBUG='aztec:*' +export LOG_LEVEL='verbose' +export DEBUG='libp2p:*' export ARCHIVER_POLLING_INTERVAL_MS=500 export P2P_CHECK_INTERVAL=50 export WS_CHECK_INTERVAL=50 @@ -13,6 +14,5 @@ export BOOTSTRAP_NODES='/ip4/127.0.0.1/tcp/40400/p2p/12D3KooWGBpbC6qQFkaCYphjNeY export P2P_TCP_LISTEN_ADDR='0.0.0.0:40400' export P2P_NAT_ENABLED='false' export P2P_ENABLED='true' -export DEBUG='aztec:*,libp2p:*' yarn test e2e_p2p_network.test.ts diff --git a/yarn-project/end-to-end/src/composed/e2e_aztec_js_browser.test.ts b/yarn-project/end-to-end/src/composed/e2e_aztec_js_browser.test.ts index 6bbd6215923f..51c7d8eab454 100644 --- a/yarn-project/end-to-end/src/composed/e2e_aztec_js_browser.test.ts +++ b/yarn-project/end-to-end/src/composed/e2e_aztec_js_browser.test.ts @@ -1,4 +1,4 @@ -import { createDebugLogger, fileURLToPath } from '@aztec/aztec.js'; +import { createLogger, fileURLToPath } from '@aztec/aztec.js'; import { startPXEHttpServer } from '@aztec/pxe'; import Koa from 'koa'; @@ -15,8 +15,8 @@ const __dirname = dirname(__filename); const PORT = 4000; const PXE_PORT = 4001; -const logger = createDebugLogger('aztec:e2e_aztec_browser.js:web'); -const pageLogger = createDebugLogger('aztec:e2e_aztec_browser.js:web:page'); +const logger = createLogger('e2e:aztec_browser.js:web'); +const pageLogger = createLogger('e2e:aztec_browser.js:web:page'); /** * This test is a bit of a special case as it's on a web browser and not only on anvil and node.js. diff --git a/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts b/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts index b2ed9d69432a..77697c5a7795 100644 --- a/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts +++ b/yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts @@ -1,7 +1,7 @@ // docs:start:imports import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing'; -import { Fr, GrumpkinScalar, type PXE, createDebugLogger, createPXEClient, waitForPXE } from '@aztec/aztec.js'; +import { Fr, GrumpkinScalar, type PXE, createLogger, createPXEClient, waitForPXE } from '@aztec/aztec.js'; import { format } from 'util'; @@ -14,7 +14,7 @@ describe('e2e_sandbox_example', () => { it('sandbox example works', async () => { // docs:start:setup ////////////// CREATE THE CLIENT INTERFACE AND CONTACT THE SANDBOX ////////////// - const logger = createDebugLogger('token'); + const logger = createLogger('e2e:token'); // We create PXE client connected to the sandbox URL const pxe = createPXEClient(PXE_URL); @@ -118,7 +118,7 @@ describe('e2e_sandbox_example', () => { }); it('can create accounts on the sandbox', async () => { - const logger = createDebugLogger('token'); + const logger = createLogger('e2e:token'); // We create PXE client connected to the sandbox URL const pxe = createPXEClient(PXE_URL); // Wait for sandbox to be ready diff --git a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts index 1d9f1c178015..16d222927a7c 100644 --- a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts @@ -1,6 +1,6 @@ import { type ArchiveSource } from '@aztec/archiver'; import { getConfigEnvVars } from '@aztec/aztec-node'; -import { AztecAddress, EthCheatCodes, Fr, GlobalVariables, type L2Block, createDebugLogger } from '@aztec/aztec.js'; +import { AztecAddress, EthCheatCodes, Fr, GlobalVariables, type L2Block, createLogger } from '@aztec/aztec.js'; // eslint-disable-next-line no-restricted-imports import { type L2Tips, @@ -60,7 +60,7 @@ import { setupL1Contracts } from '../fixtures/utils.js'; const sequencerPK = '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a'; const deployerPK = '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba'; -const logger = createDebugLogger('aztec:integration_l1_publisher'); +const logger = createLogger('integration_l1_publisher'); const config = getConfigEnvVars(); config.l1RpcUrl = config.l1RpcUrl || 'http://127.0.0.1:8545'; diff --git a/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts b/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts index 3ca5e9171685..808c8c0f0aa6 100644 --- a/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts +++ b/yarn-project/end-to-end/src/devnet/e2e_smoke.test.ts @@ -17,7 +17,7 @@ import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint'; import { PXESchema } from '@aztec/circuit-types'; import { deriveSigningKey } from '@aztec/circuits.js'; import { createNamespacedSafeJsonRpcServer, startHttpRpcServer } from '@aztec/foundation/json-rpc/server'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { FeeJuiceContract, TestContract } from '@aztec/noir-contracts.js'; @@ -58,7 +58,7 @@ describe('End-to-end tests for devnet', () => { // eslint-disable-next-line let pxe: PXE; let pxeUrl: string; // needed for the CLI - let logger: DebugLogger; + let logger: Logger; let l1ChainId: number; let feeJuiceL1: EthAddress; let teardown: () => void | Promise; diff --git a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts index d3dded0788d4..2705e3855324 100644 --- a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_pxes.test.ts @@ -3,9 +3,9 @@ import { createAccounts } from '@aztec/accounts/testing'; import { type AztecAddress, type AztecNode, - type DebugLogger, type ExtendedNote, Fr, + type Logger, type PXE, type Wallet, retryUntil, @@ -28,7 +28,7 @@ describe('e2e_2_pxes', () => { let pxeB: PXE; let walletA: Wallet; let walletB: Wallet; - let logger: DebugLogger; + let logger: Logger; let teardownA: () => Promise; let teardownB: () => Promise; diff --git a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts index 454be00bf217..1f6385417aa4 100644 --- a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts +++ b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts @@ -6,9 +6,9 @@ import { AccountManager, AccountWallet, type CompleteAddress, - type DebugLogger, Fr, GrumpkinScalar, + type Logger, type PXE, type Wallet, } from '@aztec/aztec.js'; @@ -29,7 +29,7 @@ function itShouldBehaveLikeAnAccountContract( let secretKey: Fr; let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; beforeEach(async () => { diff --git a/yarn-project/end-to-end/src/e2e_amm.test.ts b/yarn-project/end-to-end/src/e2e_amm.test.ts index 6b1d741487f4..476bfb8be8bb 100644 --- a/yarn-project/end-to-end/src/e2e_amm.test.ts +++ b/yarn-project/end-to-end/src/e2e_amm.test.ts @@ -1,4 +1,4 @@ -import { type AccountWallet, type DebugLogger, Fr, type Wallet } from '@aztec/aztec.js'; +import { type AccountWallet, Fr, type Logger, type Wallet } from '@aztec/aztec.js'; import { AMMContract, type TokenContract } from '@aztec/noir-contracts.js'; import { jest } from '@jest/globals'; @@ -13,7 +13,7 @@ describe('AMM', () => { let teardown: () => Promise; - let logger: DebugLogger; + let logger: Logger; let adminWallet: AccountWallet; let liquidityProvider: AccountWallet; diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts index e2ca5a2fa640..d7dc45a2ca61 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts @@ -2,13 +2,13 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountWallet, type CompleteAddress, - type DebugLogger, ExtendedNote, Fr, + type Logger, Note, type TxHash, computeSecretHash, - createDebugLogger, + createLogger, } from '@aztec/aztec.js'; import { DocsExampleContract, TokenBlacklistContract, type TokenContract } from '@aztec/noir-contracts.js'; @@ -58,7 +58,7 @@ export class BlacklistTokenContractTest { static DELAY = 2; private snapshotManager: ISnapshotManager; - logger: DebugLogger; + logger: Logger; wallets: AccountWallet[] = []; accounts: CompleteAddress[] = []; asset!: TokenBlacklistContract; @@ -70,7 +70,7 @@ export class BlacklistTokenContractTest { blacklisted!: AccountWallet; constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_blacklist_token_contract:${testName}`); + this.logger = createLogger(`e2e:e2e_blacklist_token_contract:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_blacklist_token_contract/${testName}`, dataPath); } diff --git a/yarn-project/end-to-end/src/e2e_block_building.test.ts b/yarn-project/end-to-end/src/e2e_block_building.test.ts index 4989a66d0a9c..ef865e3dae64 100644 --- a/yarn-project/end-to-end/src/e2e_block_building.test.ts +++ b/yarn-project/end-to-end/src/e2e_block_building.test.ts @@ -5,11 +5,11 @@ import { type CheatCodes, ContractDeployer, ContractFunctionInteraction, - type DebugLogger, Fq, Fr, L1EventPayload, L1NotePayload, + type Logger, type PXE, TxStatus, type Wallet, @@ -31,7 +31,7 @@ import { setup } from './fixtures/utils.js'; describe('e2e_block_building', () => { let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let owner: Wallet; let minter: Wallet; let aztecNode: AztecNode; diff --git a/yarn-project/end-to-end/src/e2e_card_game.test.ts b/yarn-project/end-to-end/src/e2e_card_game.test.ts index d845ec81ff0d..9ba38b9c4356 100644 --- a/yarn-project/end-to-end/src/e2e_card_game.test.ts +++ b/yarn-project/end-to-end/src/e2e_card_game.test.ts @@ -3,8 +3,8 @@ import { INITIAL_TEST_SECRET_KEYS } from '@aztec/accounts/testing'; import { type AccountWallet, AztecAddress, - type DebugLogger, GrumpkinScalar, + type Logger, type PXE, type Wallet, computeAppNullifierSecretKey, @@ -67,7 +67,7 @@ describe('e2e_card_game', () => { jest.setTimeout(TIMEOUT); let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let wallets: AccountWallet[]; diff --git a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts index 887d1c9609c8..2ee9eee8b68d 100644 --- a/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +++ b/yarn-project/end-to-end/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts @@ -5,10 +5,10 @@ import { AztecAddress, type AztecNode, type CompleteAddress, - type DebugLogger, EthAddress, + type Logger, type PXE, - createDebugLogger, + createLogger, } from '@aztec/aztec.js'; import { createL1Clients } from '@aztec/ethereum'; import { InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts'; @@ -30,7 +30,7 @@ const { E2E_DATA_PATH: dataPath } = process.env; export class CrossChainMessagingTest { private snapshotManager: ISnapshotManager; - logger: DebugLogger; + logger: Logger; wallets: AccountWallet[] = []; accounts: CompleteAddress[] = []; aztecNode!: AztecNode; @@ -52,7 +52,7 @@ export class CrossChainMessagingTest { outbox!: any; // GetContractReturnType | undefined; constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_cross_chain_messaging:${testName}`); + this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath); } diff --git a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts b/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts index c05d6d0d1a7c..4dcc22cad577 100644 --- a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts +++ b/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts @@ -3,8 +3,8 @@ import { type AccountWallet, type AztecNode, type CheatCodes, - type DebugLogger, Fr, + type Logger, type PXE, PackedValues, TxExecutionRequest, @@ -45,7 +45,7 @@ describe('e2e_crowdfunding_and_claim', () => { let operatorWallet: AccountWallet; let donorWallets: AccountWallet[]; let wallets: AccountWallet[]; - let logger: DebugLogger; + let logger: Logger; let donationToken: TokenContract; let rewardToken: TokenContract; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts index d436c38e0ac9..6e348dd12243 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts @@ -4,9 +4,9 @@ import { type ContractArtifact, type ContractClassWithId, type ContractInstanceWithAddress, - type DebugLogger, type FieldsOf, Fr, + type Logger, type PXE, type TxReceipt, TxStatus, @@ -33,7 +33,7 @@ describe('e2e_deploy_contract contract class registration', () => { const t = new DeployTest('contract class'); let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let wallet: Wallet; let aztecNode: AztecNode; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts index cebc961785b5..89e9ae4624dd 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts @@ -1,5 +1,5 @@ import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing'; -import { AztecAddress, type DebugLogger, type PXE, type Wallet, createPXEClient, makeFetch } from '@aztec/aztec.js'; +import { AztecAddress, type Logger, type PXE, type Wallet, createPXEClient, makeFetch } from '@aztec/aztec.js'; import { CounterContract, StatefulTestContract } from '@aztec/noir-contracts.js'; import { TestContract } from '@aztec/noir-contracts.js/Test'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; @@ -10,7 +10,7 @@ describe('e2e_deploy_contract deploy method', () => { const t = new DeployTest('deploy method'); let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let wallet: Wallet; const ignoredArg = AztecAddress.random(); diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts index ec32d515422c..2632b9e4d6d4 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts @@ -5,12 +5,12 @@ import { type AztecNode, type ContractArtifact, type ContractBase, - type DebugLogger, Fr, + type Logger, type PXE, type PublicKeys, type Wallet, - createDebugLogger, + createLogger, getContractInstanceFromDeployParams, } from '@aztec/aztec.js'; import { type StatefulTestContract } from '@aztec/noir-contracts.js'; @@ -23,13 +23,13 @@ export class DeployTest { private snapshotManager: ISnapshotManager; private wallets: AccountWallet[] = []; - public logger: DebugLogger; + public logger: Logger; public pxe!: PXE; public wallet!: AccountWallet; public aztecNode!: AztecNode; constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_deploy_contract:${testName}`); + this.logger = createLogger(`e2e:e2e_deploy_contract:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_deploy_contract/${testName}`, dataPath); } diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts index a1f6442a81ff..1187950bbe94 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts @@ -1,8 +1,8 @@ import { AztecAddress, ContractDeployer, - type DebugLogger, Fr, + type Logger, type PXE, TxStatus, type Wallet, @@ -18,7 +18,7 @@ describe('e2e_deploy_contract legacy', () => { const t = new DeployTest('legacy'); let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let wallet: Wallet; beforeAll(async () => { diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts index ca7dff265c2d..ca5eba6b2c2d 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts +++ b/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts @@ -1,4 +1,4 @@ -import { BatchCall, type DebugLogger, Fr, type PXE, SignerlessWallet, type Wallet } from '@aztec/aztec.js'; +import { BatchCall, Fr, type Logger, type PXE, SignerlessWallet, type Wallet } from '@aztec/aztec.js'; import { siloNullifier } from '@aztec/circuits.js/hash'; import { StatefulTestContract } from '@aztec/noir-contracts.js'; import { TestContract } from '@aztec/noir-contracts.js/Test'; @@ -9,7 +9,7 @@ describe('e2e_deploy_contract private initialization', () => { const t = new DeployTest('private initialization'); let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let wallet: Wallet; beforeAll(async () => { diff --git a/yarn-project/end-to-end/src/e2e_epochs.test.ts b/yarn-project/end-to-end/src/e2e_epochs.test.ts index 3ac4e07afd86..d456a86d5331 100644 --- a/yarn-project/end-to-end/src/e2e_epochs.test.ts +++ b/yarn-project/end-to-end/src/e2e_epochs.test.ts @@ -1,5 +1,5 @@ import { type EpochConstants, getTimestampRangeForEpoch } from '@aztec/archiver/epoch'; -import { type DebugLogger, retryUntil } from '@aztec/aztec.js'; +import { type Logger, retryUntil } from '@aztec/aztec.js'; import { RollupContract } from '@aztec/ethereum/contracts'; import { type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test'; @@ -15,7 +15,7 @@ describe('e2e_epochs', () => { let l1Client: PublicClient; let rollup: RollupContract; let constants: EpochConstants; - let logger: DebugLogger; + let logger: Logger; let proverDelayer: Delayer; let sequencerDelayer: Delayer; diff --git a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts index 9a40a99563cb..588cc2262cb3 100644 --- a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts @@ -2,8 +2,8 @@ import { type AccountWallet, type AztecAddress, BatchCall, - type DebugLogger, Fr, + type Logger, type PXE, deriveKeys, } from '@aztec/aztec.js'; @@ -19,7 +19,7 @@ describe('e2e_escrow_contract', () => { let wallet: AccountWallet; let recipientWallet: AccountWallet; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let token: TokenContract; diff --git a/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts b/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts index 7b2abe306b01..820d2a51ea5e 100644 --- a/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/account_init.test.ts @@ -2,10 +2,10 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AccountManager, type AccountWallet, - type DebugLogger, FeeJuicePaymentMethod, FeeJuicePaymentMethodWithClaim, Fr, + type Logger, type PXE, PrivateFeePaymentMethod, PublicFeePaymentMethod, @@ -43,7 +43,7 @@ describe('e2e_fees account_init', () => { }); // eslint-disable-next-line @typescript-eslint/no-unused-vars - let logger: DebugLogger; + let logger: Logger; let pxe: PXE; let gasSettings: GasSettings; let bananaCoin: BananaCoin; diff --git a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts index 87699648c198..dcb1faa9d96c 100644 --- a/yarn-project/end-to-end/src/e2e_fees/fees_test.ts +++ b/yarn-project/end-to-end/src/e2e_fees/fees_test.ts @@ -3,10 +3,10 @@ import { type AccountWallet, type AztecAddress, type AztecNode, - type DebugLogger, + type Logger, type PXE, SignerlessWallet, - createDebugLogger, + createLogger, sleep, } from '@aztec/aztec.js'; import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint'; @@ -51,7 +51,7 @@ export class FeesTest { private snapshotManager: ISnapshotManager; private wallets: AccountWallet[] = []; - public logger: DebugLogger; + public logger: Logger; public pxe!: PXE; public aztecNode!: AztecNode; @@ -83,7 +83,7 @@ export class FeesTest { public readonly APP_SPONSORED_TX_GAS_LIMIT = BigInt(10e9); constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_fees:${testName}`); + this.logger = createLogger(`e2e:e2e_fees:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_fees/${testName}`, dataPath); } diff --git a/yarn-project/end-to-end/src/e2e_l1_with_wall_time.test.ts b/yarn-project/end-to-end/src/e2e_l1_with_wall_time.test.ts index 01a6d9f96ea4..52eab07fa8a0 100644 --- a/yarn-project/end-to-end/src/e2e_l1_with_wall_time.test.ts +++ b/yarn-project/end-to-end/src/e2e_l1_with_wall_time.test.ts @@ -1,5 +1,5 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; -import { type DebugLogger, Fr, GrumpkinScalar, type PXE, TxStatus } from '@aztec/aztec.js'; +import { Fr, GrumpkinScalar, type Logger, type PXE, TxStatus } from '@aztec/aztec.js'; import { EthAddress } from '@aztec/circuits.js'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; import { type PXEService } from '@aztec/pxe'; @@ -9,7 +9,7 @@ import { privateKeyToAccount } from 'viem/accounts'; import { getPrivateKeyFromIndex, setup } from './fixtures/utils.js'; describe('e2e_l1_with_wall_time', () => { - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let pxe: PXE; diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 4b0c502e1e21..6c0df07c5daf 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -1,4 +1,4 @@ -import { type AccountWallet, type CheatCodes, type DebugLogger, type DeployL1Contracts, Fr } from '@aztec/aztec.js'; +import { type AccountWallet, type CheatCodes, type DeployL1Contracts, Fr, type Logger } from '@aztec/aztec.js'; import { RollupAbi } from '@aztec/l1-artifacts'; import { LendingContract, PriceFeedContract, TokenContract } from '@aztec/noir-contracts.js'; @@ -14,7 +14,7 @@ describe('e2e_lending_contract', () => { let wallet: AccountWallet; let deployL1ContractsValues: DeployL1Contracts; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let cc: CheatCodes; diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index ff22b574df3a..77480e552e6c 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -1,9 +1,9 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type CompleteAddress, - type DebugLogger, Fr, GrumpkinScalar, + type Logger, type PXE, type Wallet, deriveKeys, @@ -17,7 +17,7 @@ describe('e2e_multiple_accounts_1_enc_key', () => { let pxe: PXE; const wallets: Wallet[] = []; const accounts: CompleteAddress[] = []; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let token: TokenContract; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts b/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts index 561b79c7fd3b..11db0cb233c6 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts @@ -1,11 +1,5 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; -import { - type AccountWallet, - type CompleteAddress, - type DebugLogger, - type PXE, - createDebugLogger, -} from '@aztec/aztec.js'; +import { type AccountWallet, type CompleteAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js'; import { ChildContract, ParentContract } from '@aztec/noir-contracts.js'; import { @@ -20,7 +14,7 @@ const { E2E_DATA_PATH: dataPath } = process.env; export class NestedContractTest { private snapshotManager: ISnapshotManager; - logger: DebugLogger; + logger: Logger; wallets: AccountWallet[] = []; accounts: CompleteAddress[] = []; pxe!: PXE; @@ -29,7 +23,7 @@ export class NestedContractTest { childContract!: ChildContract; constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_nested_contract:${testName}`); + this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_nested_contract/${testName}`, dataPath); } diff --git a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts index 54e377ad4e93..2b0df92e2152 100644 --- a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts +++ b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, ExtendedNote, Fr, Note, type PXE, SignerlessWallet, type Wallet } from '@aztec/aztec.js'; +import { ExtendedNote, Fr, type Logger, Note, type PXE, SignerlessWallet, type Wallet } from '@aztec/aztec.js'; import { siloNullifier } from '@aztec/circuits.js/hash'; import { TestContract } from '@aztec/noir-contracts.js/Test'; @@ -9,7 +9,7 @@ describe('e2e_non_contract_account', () => { let nonContractAccountWallet: Wallet; let teardown: () => Promise; - let logger: DebugLogger; + let logger: Logger; let contract: TestContract; let wallet: Wallet; diff --git a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts index 3289add932a1..fbb5ec58ddeb 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts @@ -3,7 +3,7 @@ import { type AztecNodeConfig, type AztecNodeService } from '@aztec/aztec-node'; import { type AccountWalletWithSecretKey, EthCheatCodes } from '@aztec/aztec.js'; import { EthAddress } from '@aztec/circuits.js'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { SpamContract } from '@aztec/noir-contracts.js'; import { type BootstrapNode } from '@aztec/p2p'; @@ -36,7 +36,7 @@ export class P2PNetworkTest { private snapshotManager: ISnapshotManager; private baseAccount; - public logger: DebugLogger; + public logger: Logger; public ctx!: SubsystemsContext; public nodePrivateKeys: `0x${string}`[] = []; @@ -59,7 +59,7 @@ export class P2PNetworkTest { // If set enable metrics collection metricsPort?: number, ) { - this.logger = createDebugLogger(`aztec:e2e_p2p:${testName}`); + this.logger = createLogger(`e2e:e2e_p2p:${testName}`); // Set up the base account and node private keys for the initial network deployment this.baseAccount = privateKeyToAccount(`0x${getPrivateKeyFromIndex(0)!.toString('hex')}`); diff --git a/yarn-project/end-to-end/src/e2e_p2p/shared.ts b/yarn-project/end-to-end/src/e2e_p2p/shared.ts index d1c35dfdb662..a3fb06b49ae6 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/shared.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/shared.ts @@ -1,6 +1,6 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { type AztecNodeService } from '@aztec/aztec-node'; -import { type DebugLogger, type SentTx } from '@aztec/aztec.js'; +import { type Logger, type SentTx } from '@aztec/aztec.js'; import { CompleteAddress, TxStatus } from '@aztec/aztec.js'; import { Fr, GrumpkinScalar } from '@aztec/foundation/fields'; import { type SpamContract } from '@aztec/noir-contracts.js'; @@ -9,7 +9,7 @@ import { type PXEService, createPXEService, getPXEServiceConfig as getRpcConfig import { type NodeContext } from '../fixtures/setup_p2p_test.js'; // submits a set of transactions to the provided Private eXecution Environment (PXE) -export const submitComplexTxsTo = async (logger: DebugLogger, spamContract: SpamContract, numTxs: number) => { +export const submitComplexTxsTo = async (logger: Logger, spamContract: SpamContract, numTxs: number) => { const txs: SentTx[] = []; const seed = 1234n; @@ -34,7 +34,7 @@ export const submitComplexTxsTo = async (logger: DebugLogger, spamContract: Spam // creates an instance of the PXE and submit a given number of transactions to it. export const createPXEServiceAndSubmitTransactions = async ( - logger: DebugLogger, + logger: Logger, node: AztecNodeService, numTxs: number, ): Promise => { @@ -55,7 +55,7 @@ export const createPXEServiceAndSubmitTransactions = async ( }; // submits a set of transactions to the provided Private eXecution Environment (PXE) -const submitTxsTo = async (logger: DebugLogger, pxe: PXEService, numTxs: number) => { +const submitTxsTo = async (logger: Logger, pxe: PXEService, numTxs: number) => { const provenTxs = []; for (let i = 0; i < numTxs; i++) { const accountManager = getSchnorrAccount(pxe, Fr.random(), GrumpkinScalar.random(), Fr.random()); diff --git a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts b/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts index a2f6022d7ffc..d541ec386bb2 100644 --- a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts @@ -1,4 +1,4 @@ -import { type AztecAddress, type AztecNode, type DebugLogger, Fr, type Wallet } from '@aztec/aztec.js'; +import { type AztecAddress, type AztecNode, Fr, type Logger, type Wallet } from '@aztec/aztec.js'; import { MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, @@ -12,7 +12,7 @@ import { setup } from './fixtures/utils.js'; describe('e2e_pending_note_hashes_contract', () => { let aztecNode: AztecNode; let wallet: Wallet; - let logger: DebugLogger; + let logger: Logger; let owner: AztecAddress; let teardown: () => Promise; let contract: PendingNoteHashesContract; diff --git a/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts b/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts index fb400a505100..353bd81b11ed 100644 --- a/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts @@ -1,4 +1,4 @@ -import { type AccountWallet, type AztecAddress, type DebugLogger, Fr } from '@aztec/aztec.js'; +import { type AccountWallet, type AztecAddress, Fr, type Logger } from '@aztec/aztec.js'; import { EasyPrivateVotingContract } from '@aztec/noir-contracts.js/EasyPrivateVoting'; import { setup } from './fixtures/utils.js'; @@ -6,7 +6,7 @@ import { setup } from './fixtures/utils.js'; describe('e2e_voting_contract', () => { let wallet: AccountWallet; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; let votingContract: EasyPrivateVotingContract; diff --git a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts index dd19f122d0a3..c6d0bab98a78 100644 --- a/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts +++ b/yarn-project/end-to-end/src/e2e_prover/e2e_prover_test.ts @@ -5,13 +5,13 @@ import { type AztecNode, type CheatCodes, type CompleteAddress, - type DebugLogger, type DeployL1Contracts, EthAddress, type Fq, Fr, + type Logger, type PXE, - createDebugLogger, + createLogger, deployL1Contract, } from '@aztec/aztec.js'; import { @@ -67,7 +67,7 @@ export class FullProverTest { static TOKEN_SYMBOL = 'USD'; static TOKEN_DECIMALS = 18n; private snapshotManager: ISnapshotManager; - logger: DebugLogger; + logger: Logger; keys: Array<[Fr, Fq]> = []; wallets: AccountWalletWithSecretKey[] = []; accounts: CompleteAddress[] = []; @@ -93,7 +93,7 @@ export class FullProverTest { coinbase: EthAddress, private realProofs = true, ) { - this.logger = createDebugLogger(`aztec:full_prover_test:${testName}`); + this.logger = createLogger(`e2e:full_prover_test:${testName}`); this.snapshotManager = createSnapshotManager( `full_prover_integration/${testName}`, dataPath, diff --git a/yarn-project/end-to-end/src/e2e_synching.test.ts b/yarn-project/end-to-end/src/e2e_synching.test.ts index 99670517bfff..d4a5563fa37c 100644 --- a/yarn-project/end-to-end/src/e2e_synching.test.ts +++ b/yarn-project/end-to-end/src/e2e_synching.test.ts @@ -39,10 +39,10 @@ import { AnvilTestWatcher, BatchCall, type Contract, - type DebugLogger, Fr, GrumpkinScalar, - createDebugLogger, + type Logger, + createLogger, sleep, } from '@aztec/aztec.js'; // eslint-disable-next-line no-restricted-imports @@ -96,7 +96,7 @@ type VariantDefinition = { * */ class TestVariant { - private logger: DebugLogger = createDebugLogger(`test_variant`); + private logger: Logger = createLogger(`test_variant`); private pxe!: PXEService; private token!: TokenContract; private spam!: SpamContract; diff --git a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts b/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts index 0eb7afb8b835..9453ef7692f4 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts +++ b/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts @@ -1,5 +1,5 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; -import { type AccountWallet, type CompleteAddress, type DebugLogger, createDebugLogger } from '@aztec/aztec.js'; +import { type AccountWallet, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js'; import { DocsExampleContract, TokenContract } from '@aztec/noir-contracts.js'; import { jest } from '@jest/globals'; @@ -21,7 +21,7 @@ export class TokenContractTest { static TOKEN_SYMBOL = 'USD'; static TOKEN_DECIMALS = 18n; private snapshotManager: ISnapshotManager; - logger: DebugLogger; + logger: Logger; wallets: AccountWallet[] = []; accounts: CompleteAddress[] = []; asset!: TokenContract; @@ -29,7 +29,7 @@ export class TokenContractTest { badAccount!: DocsExampleContract; constructor(testName: string) { - this.logger = createDebugLogger(`aztec:e2e_token_contract:${testName}`); + this.logger = createLogger(`e2e:e2e_token_contract:${testName}`); this.snapshotManager = createSnapshotManager(`e2e_token_contract/${testName}`, dataPath, { metricsPort: metricsPort ? parseInt(metricsPort) : undefined, }); diff --git a/yarn-project/end-to-end/src/fixtures/get_acvm_config.ts b/yarn-project/end-to-end/src/fixtures/get_acvm_config.ts index d11a078c78cf..7fe776460ec8 100644 --- a/yarn-project/end-to-end/src/fixtures/get_acvm_config.ts +++ b/yarn-project/end-to-end/src/fixtures/get_acvm_config.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '@aztec/aztec.js'; +import { type Logger } from '@aztec/aztec.js'; import { randomBytes } from '@aztec/foundation/crypto'; import * as fs from 'fs/promises'; @@ -14,7 +14,7 @@ const { } = process.env; // Determines if we have access to the acvm binary and a tmp folder for temp files -export async function getACVMConfig(logger: DebugLogger): Promise< +export async function getACVMConfig(logger: Logger): Promise< | { acvmWorkingDirectory: string; acvmBinaryPath: string; diff --git a/yarn-project/end-to-end/src/fixtures/get_bb_config.ts b/yarn-project/end-to-end/src/fixtures/get_bb_config.ts index 180152f91a97..90dbd6f7a0c7 100644 --- a/yarn-project/end-to-end/src/fixtures/get_bb_config.ts +++ b/yarn-project/end-to-end/src/fixtures/get_bb_config.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, fileURLToPath } from '@aztec/aztec.js'; +import { type Logger, fileURLToPath } from '@aztec/aztec.js'; import { type BBConfig } from '@aztec/bb-prover'; import fs from 'node:fs/promises'; @@ -14,7 +14,7 @@ const { } = process.env; export const getBBConfig = async ( - logger: DebugLogger, + logger: Logger, ): Promise<(BBConfig & { cleanup: () => Promise }) | undefined> => { try { const bbBinaryPath = diff --git a/yarn-project/end-to-end/src/fixtures/logging.ts b/yarn-project/end-to-end/src/fixtures/logging.ts index 5e16e5585f80..8c2488158c53 100644 --- a/yarn-project/end-to-end/src/fixtures/logging.ts +++ b/yarn-project/end-to-end/src/fixtures/logging.ts @@ -1,10 +1,5 @@ -import { onLog } from '@aztec/aztec.js'; - import { mkdirpSync } from 'fs-extra'; import { dirname } from 'path'; -import * as winston from 'winston'; - -const { format, transports } = winston; let metricsLoggerSet = false; @@ -22,15 +17,6 @@ export function setupMetricsLogger(filename: string) { return; } mkdirpSync(dirname(filename)); - const logger = winston.createLogger({ - level: 'debug', - format: format.combine(format.timestamp(), format.json()), - transports: [new transports.File({ filename })], - }); - onLog((level, namespace, message, data) => { - if (data && data['eventName']) { - logger.log({ ...data, level, namespace, message }); - } - }); + // TODO(palla/log): Reenable or kill metrics logger metricsLoggerSet = true; } diff --git a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.test.ts b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.test.ts index de609cd74ae1..fc0ac7d818ee 100644 --- a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.test.ts +++ b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.test.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type Anvil } from '@viem/anvil'; import { type PrivateKeyAccount } from 'viem'; @@ -10,10 +10,10 @@ describe('deploy_l1_contracts', () => { let anvil: Anvil; let rpcUrl: string; let privateKey: PrivateKeyAccount; - let logger: DebugLogger; + let logger: Logger; beforeAll(async () => { - logger = createDebugLogger('aztec:setup_l1_contracts'); + logger = createLogger('e2e:setup_l1_contracts'); privateKey = privateKeyToAccount('0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba'); ({ anvil, rpcUrl } = await startAnvil()); diff --git a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts index b3fdb26403e9..8c14ea9ded5a 100644 --- a/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts +++ b/yarn-project/end-to-end/src/fixtures/setup_l1_contracts.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, deployL1Contracts } from '@aztec/aztec.js'; +import { type Logger, deployL1Contracts } from '@aztec/aztec.js'; import { type DeployL1ContractsArgs, type L1ContractsConfig } from '@aztec/ethereum'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts'; @@ -11,7 +11,7 @@ export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chai export const setupL1Contracts = async ( l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, - logger: DebugLogger, + logger: Logger, args: Pick & L1ContractsConfig, ) => { const l1Data = await deployL1Contracts(l1RpcUrl, account, foundry, logger, { diff --git a/yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts b/yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts index f8d4fdacaaa4..26b4df79f3ff 100644 --- a/yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts +++ b/yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts @@ -2,7 +2,7 @@ * Test fixtures and utilities to set up and run a test using multiple validators */ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node'; -import { type SentTx, createDebugLogger } from '@aztec/aztec.js'; +import { type SentTx, createLogger } from '@aztec/aztec.js'; import { type AztecAddress } from '@aztec/circuits.js'; import { type PXEService } from '@aztec/pxe'; @@ -72,7 +72,7 @@ export async function createNode( return await AztecNodeService.createAndSync(validatorConfig, { telemetry: telemetryClient, - logger: createDebugLogger(`aztec:node-${tcpPort}`), + logger: createLogger(`node:${tcpPort}`), }); } diff --git a/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts b/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts index 488e7291bda4..71cb8e1a5efd 100644 --- a/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts +++ b/yarn-project/end-to-end/src/fixtures/snapshot_manager.ts @@ -6,11 +6,11 @@ import { BatchCall, CheatCodes, type CompleteAddress, - type DebugLogger, type DeployL1Contracts, EthCheatCodes, Fr, GrumpkinScalar, + type Logger, type PXE, type Wallet, } from '@aztec/aztec.js'; @@ -18,7 +18,7 @@ import { deployInstance, registerContractClass } from '@aztec/aztec.js/deploymen import { type DeployL1ContractsArgs, createL1Clients, getL1ContractsConfigEnvVars, l1Artifacts } from '@aztec/ethereum'; import { startAnvil } from '@aztec/ethereum/test'; import { asyncMap } from '@aztec/foundation/async-map'; -import { type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { resolver, reviver } from '@aztec/foundation/serialize'; import { type ProverNode } from '@aztec/prover-node'; import { type PXEService, createPXEService, getPXEServiceConfig } from '@aztec/pxe'; @@ -87,14 +87,14 @@ export interface ISnapshotManager { /** Snapshot manager that does not perform snapshotting, it just applies transition and restoration functions as it receives them. */ class MockSnapshotManager implements ISnapshotManager { private context?: SubsystemsContext; - private logger: DebugLogger; + private logger: Logger; constructor( testName: string, private config: Partial = {}, private deployL1ContractsArgs: Partial = { assumeProvenThrough: Number.MAX_SAFE_INTEGER }, ) { - this.logger = createDebugLogger(`aztec:snapshot_manager:${testName}`); + this.logger = createLogger(`e2e:snapshot_manager:${testName}`); this.logger.warn(`No data path given, will not persist any snapshots.`); } @@ -134,7 +134,7 @@ class SnapshotManager implements ISnapshotManager { private snapshotStack: SnapshotEntry[] = []; private context?: SubsystemsContext; private livePath: string; - private logger: DebugLogger; + private logger: Logger; constructor( testName: string, @@ -143,7 +143,7 @@ class SnapshotManager implements ISnapshotManager { private deployL1ContractsArgs: Partial = { assumeProvenThrough: Number.MAX_SAFE_INTEGER }, ) { this.livePath = join(this.dataPath, 'live', testName); - this.logger = createDebugLogger(`aztec:snapshot_manager:${testName}`); + this.logger = createLogger(`e2e:snapshot_manager:${testName}`); } public async snapshot( @@ -471,7 +471,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise + (numberOfAccounts: number, logger: Logger, waitUntilProven = false) => async ({ pxe }: { pxe: PXE }) => { // Generate account keys. const accountKeys: [Fr, GrumpkinScalar][] = Array.from({ length: numberOfAccounts }).map(_ => [ diff --git a/yarn-project/end-to-end/src/fixtures/token_utils.ts b/yarn-project/end-to-end/src/fixtures/token_utils.ts index f623bcf3d5da..ab573d3bbc5b 100644 --- a/yarn-project/end-to-end/src/fixtures/token_utils.ts +++ b/yarn-project/end-to-end/src/fixtures/token_utils.ts @@ -1,8 +1,8 @@ // docs:start:token_utils -import { type AztecAddress, type DebugLogger, type Wallet } from '@aztec/aztec.js'; +import { type AztecAddress, type Logger, type Wallet } from '@aztec/aztec.js'; import { TokenContract } from '@aztec/noir-contracts.js'; -export async function deployToken(adminWallet: Wallet, initialAdminBalance: bigint, logger: DebugLogger) { +export async function deployToken(adminWallet: Wallet, initialAdminBalance: bigint, logger: Logger) { logger.info(`Deploying Token contract...`); const contract = await TokenContract.deploy(adminWallet, adminWallet.getAddress(), 'TokenName', 'TokenSymbol', 18) .send() @@ -35,7 +35,7 @@ export async function expectTokenBalance( token: TokenContract, owner: AztecAddress, expectedBalance: bigint, - logger: DebugLogger, + logger: Logger, ) { // Then check the balance const contractWithWallet = await TokenContract.at(token.address, wallet); diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index db1825bb89c3..be4646677238 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -10,16 +10,16 @@ import { BatchCall, CheatCodes, type ContractMethod, - type DebugLogger, type DeployL1Contracts, EthCheatCodes, + type Logger, NoFeePaymentMethod, type PXE, type SentTx, SignerlessWallet, type Wallet, createAztecNodeClient, - createDebugLogger, + createLogger, createPXEClient, deployL1Contracts, makeFetch, @@ -95,7 +95,7 @@ export const getPrivateKeyFromIndex = (index: number): Buffer | null => { export const setupL1Contracts = async ( l1RpcUrl: string, account: HDAccount | PrivateKeyAccount, - logger: DebugLogger, + logger: Logger, args: Partial = {}, chain: Chain = foundry, ) => { @@ -137,7 +137,7 @@ export async function setupPXEService( /** * Logger instance named as the current test. */ - logger: DebugLogger; + logger: Logger; /** * Teardown function */ @@ -169,7 +169,7 @@ export async function setupPXEService( async function setupWithRemoteEnvironment( account: Account, config: AztecNodeConfig, - logger: DebugLogger, + logger: Logger, numberOfAccounts: number, ) { // we are setting up against a remote environment, l1 contracts are already deployed @@ -276,7 +276,7 @@ export type EndToEndContext = { /** The wallets to be used. */ wallets: AccountWalletWithSecretKey[]; /** Logger instance named as the current test. */ - logger: DebugLogger; + logger: Logger; /** The cheat codes. */ cheatCodes: CheatCodes; /** The anvil test watcher (undefined if connected to remove environment) */ @@ -544,9 +544,9 @@ export function getLogger() { const describeBlockName = expect.getState().currentTestName?.split(' ')[0].replaceAll('/', ':'); if (!describeBlockName) { const name = expect.getState().testPath?.split('/').pop()?.split('.')[0] ?? 'unknown'; - return createDebugLogger('aztec:' + name); + return createLogger('e2e:' + name); } - return createDebugLogger('aztec:' + describeBlockName); + return createLogger('e2e:' + describeBlockName); } /** diff --git a/yarn-project/end-to-end/src/guides/up_quick_start.test.ts b/yarn-project/end-to-end/src/guides/up_quick_start.test.ts index 15f31c364e26..635334127c3c 100644 --- a/yarn-project/end-to-end/src/guides/up_quick_start.test.ts +++ b/yarn-project/end-to-end/src/guides/up_quick_start.test.ts @@ -9,9 +9,12 @@ describe('guides/up_quick_start', () => { // TODO: update to not use CLI it('works', async () => { await waitForPXE(createPXEClient(PXE_URL)); - execSync(`DEBUG="aztec:*" PXE_URL=\${PXE_URL:-http://localhost:8080} ./src/guides/up_quick_start.sh`, { - shell: '/bin/bash', - stdio: 'inherit', - }); + execSync( + `LOG_LEVEL=\${LOG_LEVEL:-verbose} PXE_URL=\${PXE_URL:-http://localhost:8080} ./src/guides/up_quick_start.sh`, + { + shell: '/bin/bash', + stdio: 'inherit', + }, + ); }); }); diff --git a/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts b/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts index 899b52437f7f..25755714a887 100644 --- a/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts +++ b/yarn-project/end-to-end/src/prover-coordination/e2e_prover_coordination.test.ts @@ -2,11 +2,11 @@ import { getSchnorrAccount } from '@aztec/accounts/schnorr'; import { createAccount } from '@aztec/accounts/testing'; import { type AccountWalletWithSecretKey, - type DebugLogger, EpochProofQuote, EpochProofQuotePayload, + type Logger, TxStatus, - createDebugLogger, + createLogger, retryUntil, sleep, } from '@aztec/aztec.js'; @@ -57,13 +57,13 @@ describe('e2e_prover_coordination', () => { let proverSigner: Secp256k1Signer; let proverWallet: WalletClient; - let logger: DebugLogger; + let logger: Logger; let snapshotManager: ISnapshotManager; beforeEach(async () => { - logger = createDebugLogger('aztec:prover_coordination:e2e_json_coordination'); + logger = createLogger('e2e:prover_coordination'); snapshotManager = createSnapshotManager( - `prover_coordination/e2e_json_coordination`, + `prover_coordination/e2e_prover_coordination`, process.env.E2E_DATA_PATH, { startProverNode: true }, { assumeProvenThrough: undefined }, diff --git a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts index 31fcb3523946..0eadc53d6ec5 100644 --- a/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts +++ b/yarn-project/end-to-end/src/public-testnet/e2e_public_testnet_transfer.test.ts @@ -1,5 +1,5 @@ import { createAccounts } from '@aztec/accounts/testing'; -import { type DebugLogger, Fr, type PXE } from '@aztec/aztec.js'; +import { Fr, type Logger, type PXE } from '@aztec/aztec.js'; import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js'; import { foundry, sepolia } from 'viem/chains'; @@ -16,7 +16,7 @@ describe(`deploys and transfers a private only token`, () => { let secretKey2: Fr; let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let teardown: () => Promise; beforeEach(async () => { diff --git a/yarn-project/end-to-end/src/quality_of_service/alert_checker.ts b/yarn-project/end-to-end/src/quality_of_service/alert_checker.ts index b01dfa8aeeca..d6006cc082d4 100644 --- a/yarn-project/end-to-end/src/quality_of_service/alert_checker.ts +++ b/yarn-project/end-to-end/src/quality_of_service/alert_checker.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '@aztec/aztec.js'; +import { type Logger } from '@aztec/aztec.js'; import * as fs from 'fs'; import * as yaml from 'js-yaml'; @@ -24,9 +24,9 @@ const DEFAULT_CONFIG: AlertCheckerConfig = { export class AlertChecker { private config: AlertCheckerConfig; - private logger: DebugLogger; + private logger: Logger; - constructor(logger: DebugLogger, config: Partial = {}) { + constructor(logger: Logger, config: Partial = {}) { this.config = { ...DEFAULT_CONFIG, ...config }; this.logger = logger; } diff --git a/yarn-project/end-to-end/src/sample-dapp/index.test.mjs b/yarn-project/end-to-end/src/sample-dapp/index.test.mjs index b03d45b4928a..bbf26d494fec 100644 --- a/yarn-project/end-to-end/src/sample-dapp/index.test.mjs +++ b/yarn-project/end-to-end/src/sample-dapp/index.test.mjs @@ -1,5 +1,5 @@ import { createAccount } from '@aztec/accounts/testing'; -import { createDebugLogger, createPXEClient, waitForPXE } from '@aztec/aztec.js'; +import { createLogger, createPXEClient, waitForPXE } from '@aztec/aztec.js'; import { deployToken } from '../fixtures/token_utils'; @@ -18,7 +18,7 @@ describe('token', () => { recipient = await createAccount(pxe); const initialBalance = 69; - token = await deployToken(owner, initialBalance, createDebugLogger('sample_dapp')); + token = await deployToken(owner, initialBalance, createLogger('e2e:sample_dapp')); }, 120_000); // docs:end:setup diff --git a/yarn-project/end-to-end/src/shared/browser.ts b/yarn-project/end-to-end/src/shared/browser.ts index ea9dde82e564..c2abd9dca269 100644 --- a/yarn-project/end-to-end/src/shared/browser.ts +++ b/yarn-project/end-to-end/src/shared/browser.ts @@ -6,6 +6,7 @@ import * as AztecJs from '@aztec/aztec.js'; import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; import { contractArtifactToBuffer } from '@aztec/types/abi'; +import getPort from 'get-port'; import { type Server } from 'http'; import Koa from 'koa'; import serve from 'koa-static'; @@ -51,7 +52,7 @@ export const browserTestSuite = ( */ pxeURL: string; }>, - pageLogger: AztecJs.DebugLogger, + pageLogger: AztecJs.Logger, ) => describe('e2e_aztec.js_browser', () => { const initialBalance = 33n; @@ -77,16 +78,18 @@ export const browserTestSuite = ( app = new Koa(); app.use(serve(path.resolve(__dirname, './web'))); + const debuggingPort = await getPort({ port: 9222 }); browser = await launch({ executablePath: process.env.CHROME_BIN, headless: true, + debuggingPort, args: [ '--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--disable-software-rasterizer', - '--remote-debugging-port=9222', + `--remote-debugging-port=${debuggingPort}`, ], }); page = await browser.newPage(); diff --git a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts index d68750db2302..2f7aca6e8463 100644 --- a/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/cross_chain_test_harness.ts @@ -3,7 +3,6 @@ import { type AccountWallet, type AztecAddress, type AztecNode, - type DebugLogger, EthAddress, type FieldsOf, Fr, @@ -11,6 +10,7 @@ import { L1TokenPortalManager, type L2AmountClaim, type L2AmountClaimWithRecipient, + type Logger, type PXE, type SiblingPath, type TxReceipt, @@ -140,7 +140,7 @@ export class CrossChainTestHarness { publicClient: PublicClient, walletClient: WalletClient, wallet: AccountWallet, - logger: DebugLogger, + logger: Logger, underlyingERC20Address?: EthAddress, ): Promise { const ethAccount = EthAddress.fromString((await walletClient.getAddresses())[0]); @@ -185,7 +185,7 @@ export class CrossChainTestHarness { /** Private eXecution Environment (PXE). */ public pxeService: PXE, /** Logger. */ - public logger: DebugLogger, + public logger: Logger, /** L2 Token contract. */ public l2Token: TokenContract, diff --git a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts index 458dede26ed4..0d54c623f2c5 100644 --- a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts @@ -1,11 +1,11 @@ import { type AztecAddress, type AztecNode, - type DebugLogger, EthAddress, L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim, + type Logger, type PXE, type Wallet, } from '@aztec/aztec.js'; @@ -28,7 +28,7 @@ export interface FeeJuicePortalTestingHarnessFactoryConfig { publicClient: PublicClient; walletClient: WalletClient; wallet: Wallet; - logger: DebugLogger; + logger: Logger; mockL1?: boolean; } @@ -83,7 +83,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { /** Private eXecution Environment (PXE). */ public pxeService: PXE, /** Logger. */ - public logger: DebugLogger, + public logger: Logger, /** L2 Token/Bridge contract. */ public feeJuice: FeeJuiceContract, diff --git a/yarn-project/end-to-end/src/shared/jest_setup.ts b/yarn-project/end-to-end/src/shared/jest_setup.ts index 6c2c8d880979..8c1ed4e55594 100644 --- a/yarn-project/end-to-end/src/shared/jest_setup.ts +++ b/yarn-project/end-to-end/src/shared/jest_setup.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/aztec.js'; +import { createLogger } from '@aztec/aztec.js'; import { beforeEach, expect } from '@jest/globals'; import { basename } from 'path'; @@ -8,6 +8,6 @@ beforeEach(() => { if (!testPath || !currentTestName) { return; } - const logger = createDebugLogger(`aztec:${basename(testPath).replace('.test.ts', '')}`); + const logger = createLogger(`e2e:${basename(testPath).replace('.test.ts', '')}`); logger.info(`Running test: ${currentTestName}`); }); diff --git a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts index ef6b20c00186..b8284aabfec3 100644 --- a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts +++ b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts @@ -2,9 +2,9 @@ import { type AccountWallet, AztecAddress, type AztecNode, - type DebugLogger, EthAddress, Fr, + type Logger, type PXE, computeAuthWitMessageHash, generateClaimSecret, @@ -48,7 +48,7 @@ export type UniswapSetupContext = { /** The Private eXecution Environment (PXE). */ pxe: PXE; /** Logger instance named as the current test. */ - logger: DebugLogger; + logger: Logger; /** Viem Public client instance. */ publicClient: PublicClient; /** Viem Wallet Client instance. */ @@ -76,7 +76,7 @@ export const uniswapL1L2TestSuite = ( let aztecNode: AztecNode; let pxe: PXE; - let logger: DebugLogger; + let logger: Logger; let walletClient: WalletClient; let publicClient: PublicClient; diff --git a/yarn-project/end-to-end/src/simulators/token_simulator.ts b/yarn-project/end-to-end/src/simulators/token_simulator.ts index 53a4c5d6e2c9..ae259539bec7 100644 --- a/yarn-project/end-to-end/src/simulators/token_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/token_simulator.ts @@ -1,5 +1,5 @@ /* eslint-disable jsdoc/require-jsdoc */ -import { type AztecAddress, BatchCall, type DebugLogger, type Wallet } from '@aztec/aztec.js'; +import { type AztecAddress, BatchCall, type Logger, type Wallet } from '@aztec/aztec.js'; import { type TokenContract } from '@aztec/noir-contracts.js/Token'; import chunk from 'lodash.chunk'; @@ -14,7 +14,7 @@ export class TokenSimulator { constructor( protected token: TokenContract, protected defaultWallet: Wallet, - protected logger: DebugLogger, + protected logger: Logger, protected accounts: AztecAddress[], ) {} diff --git a/yarn-project/end-to-end/src/spartan/4epochs.test.ts b/yarn-project/end-to-end/src/spartan/4epochs.test.ts index 35a16b1f8960..43d2a0da7ba2 100644 --- a/yarn-project/end-to-end/src/spartan/4epochs.test.ts +++ b/yarn-project/end-to-end/src/spartan/4epochs.test.ts @@ -1,6 +1,6 @@ import { EthCheatCodes, readFieldCompressedString } from '@aztec/aztec.js'; import { getL1ContractsConfigEnvVars } from '@aztec/ethereum'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts.js'; import { jest } from '@jest/globals'; @@ -14,7 +14,7 @@ const config = setupEnvironment(process.env); describe('token transfer test', () => { jest.setTimeout(10 * 60 * 4000); // 40 minutes - const logger = createDebugLogger(`aztec:spartan:4epochs`); + const logger = createLogger(`e2e:spartan:4epochs`); const l1Config = getL1ContractsConfigEnvVars(); // We want plenty of minted tokens for a lot of slots that fill up multiple epochs diff --git a/yarn-project/end-to-end/src/spartan/gating-passive.test.ts b/yarn-project/end-to-end/src/spartan/gating-passive.test.ts index 6369f912a7a9..aaf700cf5967 100644 --- a/yarn-project/end-to-end/src/spartan/gating-passive.test.ts +++ b/yarn-project/end-to-end/src/spartan/gating-passive.test.ts @@ -1,5 +1,5 @@ import { EthCheatCodes, createCompatibleClient, sleep } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { expect, jest } from '@jest/globals'; @@ -41,7 +41,7 @@ const { SPARTAN_DIR, INSTANCE_NAME, } = config; -const debugLogger = createDebugLogger('aztec:spartan-test:reorg'); +const debugLogger = createLogger('e2e:spartan-test:reorg'); describe('a test that passively observes the network in the presence of network chaos', () => { jest.setTimeout(60 * 60 * 1000); // 60 minutes diff --git a/yarn-project/end-to-end/src/spartan/proving.test.ts b/yarn-project/end-to-end/src/spartan/proving.test.ts index c4ea1fc0288d..fd1ea281dba2 100644 --- a/yarn-project/end-to-end/src/spartan/proving.test.ts +++ b/yarn-project/end-to-end/src/spartan/proving.test.ts @@ -1,5 +1,5 @@ import { type PXE, createCompatibleClient, sleep } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { jest } from '@jest/globals'; import { type ChildProcess } from 'child_process'; @@ -9,7 +9,7 @@ import { isK8sConfig, setupEnvironment, startPortForward } from './utils.js'; jest.setTimeout(2_400_000); // 40 minutes const config = setupEnvironment(process.env); -const debugLogger = createDebugLogger('aztec:spartan-test:proving'); +const debugLogger = createLogger('e2e:spartan-test:proving'); const SLEEP_MS = 1000; describe('proving test', () => { diff --git a/yarn-project/end-to-end/src/spartan/reorg.test.ts b/yarn-project/end-to-end/src/spartan/reorg.test.ts index 92f724c77ea7..f524503a4cf7 100644 --- a/yarn-project/end-to-end/src/spartan/reorg.test.ts +++ b/yarn-project/end-to-end/src/spartan/reorg.test.ts @@ -1,5 +1,5 @@ import { EthCheatCodes, sleep } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { expect, jest } from '@jest/globals'; @@ -20,7 +20,7 @@ if (!isK8sConfig(config)) { } const { NAMESPACE, HOST_PXE_PORT, HOST_ETHEREUM_PORT, CONTAINER_PXE_PORT, CONTAINER_ETHEREUM_PORT, SPARTAN_DIR } = config; -const debugLogger = createDebugLogger('aztec:spartan-test:reorg'); +const debugLogger = createLogger('e2e:spartan-test:reorg'); async function checkBalances(testWallets: TestWallets, mintAmount: bigint, totalAmountTransferred: bigint) { testWallets.wallets.forEach(async w => { diff --git a/yarn-project/end-to-end/src/spartan/smoke.test.ts b/yarn-project/end-to-end/src/spartan/smoke.test.ts index f58a2d6a4696..5b4e2eb68c11 100644 --- a/yarn-project/end-to-end/src/spartan/smoke.test.ts +++ b/yarn-project/end-to-end/src/spartan/smoke.test.ts @@ -1,5 +1,5 @@ import { type PXE, createCompatibleClient } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { createPublicClient, getAddress, getContract, http } from 'viem'; @@ -10,7 +10,7 @@ import { isK8sConfig, runAlertCheck, setupEnvironment, startPortForward } from ' const config = setupEnvironment(process.env); -const debugLogger = createDebugLogger('aztec:spartan-test:smoke'); +const debugLogger = createLogger('e2e:spartan-test:smoke'); // QoS alerts for when we are running in k8s const qosAlerts: AlertConfig[] = [ diff --git a/yarn-project/end-to-end/src/spartan/transfer.test.ts b/yarn-project/end-to-end/src/spartan/transfer.test.ts index 79cd761cfd43..4f0d79215f7c 100644 --- a/yarn-project/end-to-end/src/spartan/transfer.test.ts +++ b/yarn-project/end-to-end/src/spartan/transfer.test.ts @@ -1,5 +1,5 @@ import { readFieldCompressedString } from '@aztec/aztec.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TokenContract } from '@aztec/noir-contracts.js'; import { jest } from '@jest/globals'; @@ -12,7 +12,7 @@ const config = setupEnvironment(process.env); describe('token transfer test', () => { jest.setTimeout(10 * 60 * 2000); // 20 minutes - const logger = createDebugLogger(`aztec:spartan-test:transfer`); + const logger = createLogger(`e2e:spartan-test:transfer`); const MINT_AMOUNT = 20n; const ROUNDS = 5n; diff --git a/yarn-project/end-to-end/src/spartan/utils.ts b/yarn-project/end-to-end/src/spartan/utils.ts index 120b3b3adcd5..82a4c56d610c 100644 --- a/yarn-project/end-to-end/src/spartan/utils.ts +++ b/yarn-project/end-to-end/src/spartan/utils.ts @@ -1,4 +1,4 @@ -import { createDebugLogger, sleep } from '@aztec/aztec.js'; +import { createLogger, sleep } from '@aztec/aztec.js'; import type { Logger } from '@aztec/foundation/log'; import { exec, execSync, spawn } from 'child_process'; @@ -11,7 +11,7 @@ import { AlertChecker, type AlertConfig } from '../quality_of_service/alert_chec const execAsync = promisify(exec); -const logger = createDebugLogger('k8s-utils'); +const logger = createLogger('e2e:k8s-utils'); const k8sLocalConfigSchema = z.object({ INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'), diff --git a/yarn-project/end-to-end/webpack.config.js b/yarn-project/end-to-end/webpack.config.js index 88f6bb5178c1..3ae5808f82fe 100644 --- a/yarn-project/end-to-end/webpack.config.js +++ b/yarn-project/end-to-end/webpack.config.js @@ -60,6 +60,7 @@ export default { fs: false, path: false, url: false, + tty: false, worker_threads: false, buffer: require.resolve('buffer/'), util: require.resolve('util/'), diff --git a/yarn-project/ethereum/src/deploy_l1_contracts.ts b/yarn-project/ethereum/src/deploy_l1_contracts.ts index 32832708c2a3..f44a648d5bb6 100644 --- a/yarn-project/ethereum/src/deploy_l1_contracts.ts +++ b/yarn-project/ethereum/src/deploy_l1_contracts.ts @@ -1,7 +1,7 @@ import { type AztecAddress } from '@aztec/foundation/aztec-address'; import { EthAddress } from '@aztec/foundation/eth-address'; import { type Fr } from '@aztec/foundation/fields'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { CoinIssuerAbi, CoinIssuerBytecode, @@ -274,7 +274,7 @@ export const deployL1Contracts = async ( rpcUrl: string, account: HDAccount | PrivateKeyAccount, chain: Chain, - logger: DebugLogger, + logger: Logger, args: DeployL1ContractsArgs, ): Promise => { // We are assuming that you are running this on a local anvil node which have 1s block times @@ -297,7 +297,7 @@ export const deployL1Contracts = async ( logger.info(`Set block interval to ${args.ethereumSlotDuration}`); } - logger.info(`Deploying contracts from ${account.address.toString()}...`); + logger.verbose(`Deploying contracts from ${account.address.toString()}`); const walletClient = createWalletClient({ account, chain, transport: http(rpcUrl) }); const publicClient = createPublicClient({ chain, transport: http(rpcUrl) }); @@ -342,7 +342,7 @@ export const deployL1Contracts = async ( logger.info(`Deployed RewardDistributor at ${rewardDistributorAddress}`); await govDeployer.waitForDeployments(); - logger.info(`All governance contracts deployed`); + logger.verbose(`All governance contracts deployed`); const deployer = new L1Deployer(walletClient, publicClient, args.salt, logger); @@ -444,7 +444,7 @@ export const deployL1Contracts = async ( // Set initial blocks as proven if requested if (args.assumeProvenThrough && args.assumeProvenThrough > 0) { await rollup.write.setAssumeProvenThroughBlockNumber([BigInt(args.assumeProvenThrough)], { account }); - logger.info(`Set Rollup assumedProvenUntil to ${args.assumeProvenThrough}`); + logger.warn(`Set Rollup assumedProvenUntil to ${args.assumeProvenThrough}`); } // Inbox and Outbox are immutable and are deployed from Rollup's constructor so we just fetch them from the contract. @@ -515,7 +515,7 @@ class L1Deployer { private walletClient: WalletClient, private publicClient: PublicClient, maybeSalt: number | undefined, - private logger: DebugLogger, + private logger: Logger, ) { this.salt = maybeSalt ? padHex(numberToHex(maybeSalt), { size: 32 }) : undefined; } @@ -605,7 +605,7 @@ export async function deployL1Contract( args: readonly unknown[] = [], maybeSalt?: Hex, libraries?: Libraries, - logger?: DebugLogger, + logger?: Logger, ): Promise<{ address: EthAddress; txHash: Hex | undefined }> { let txHash: Hex | undefined = undefined; let resultingAddress: Hex | null | undefined = undefined; diff --git a/yarn-project/ethereum/src/eth_cheat_codes.ts b/yarn-project/ethereum/src/eth_cheat_codes.ts index 74918bf4653a..ae2f6793891b 100644 --- a/yarn-project/ethereum/src/eth_cheat_codes.ts +++ b/yarn-project/ethereum/src/eth_cheat_codes.ts @@ -1,7 +1,7 @@ import { toBigIntBE, toHex } from '@aztec/foundation/bigint-buffer'; import { keccak256 } from '@aztec/foundation/crypto'; import { type EthAddress } from '@aztec/foundation/eth-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import fs from 'fs'; import { type Hex } from 'viem'; @@ -18,7 +18,7 @@ export class EthCheatCodes { /** * The logger to use for the eth cheatcodes */ - public logger = createDebugLogger('aztec:cheat_codes:eth'), + public logger = createLogger('ethereum:cheat_codes'), ) {} async rpcCall(method: string, params: any[]) { diff --git a/yarn-project/ethereum/src/l1_tx_utils.test.ts b/yarn-project/ethereum/src/l1_tx_utils.test.ts index 7dffaf011ce3..91d4c87e9a7c 100644 --- a/yarn-project/ethereum/src/l1_tx_utils.test.ts +++ b/yarn-project/ethereum/src/l1_tx_utils.test.ts @@ -1,5 +1,5 @@ import { EthAddress } from '@aztec/foundation/eth-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type Anvil } from '@viem/anvil'; @@ -38,7 +38,7 @@ describe('GasUtils', () => { let anvil: Anvil; let cheatCodes: EthCheatCodes; const initialBaseFee = WEI_CONST; // 1 gwei - const logger = createDebugLogger('l1_gas_test'); + const logger = createLogger('ethereum:test:l1_gas_test'); beforeAll(async () => { const { anvil: anvilInstance, rpcUrl } = await startAnvil(1); diff --git a/yarn-project/ethereum/src/l1_tx_utils.ts b/yarn-project/ethereum/src/l1_tx_utils.ts index f95610303b73..5bcaf6f93914 100644 --- a/yarn-project/ethereum/src/l1_tx_utils.ts +++ b/yarn-project/ethereum/src/l1_tx_utils.ts @@ -4,7 +4,7 @@ import { getDefaultConfig, numberConfigHelper, } from '@aztec/foundation/config'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { makeBackoff, retry } from '@aztec/foundation/retry'; import { sleep } from '@aztec/foundation/sleep'; @@ -140,7 +140,7 @@ export class L1TxUtils { constructor( private readonly publicClient: PublicClient, private readonly walletClient: WalletClient, - private readonly logger?: DebugLogger, + private readonly logger?: Logger, config?: Partial, ) { this.config = { @@ -178,9 +178,11 @@ export class L1TxUtils { maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas, }); - this.logger?.verbose( - `Sent L1 transaction ${txHash} with gas limit ${gasLimit} and price ${formatGwei(gasPrice.maxFeePerGas)} gwei`, - ); + this.logger?.verbose(`Sent L1 transaction ${txHash}`, { + gasLimit, + maxFeePerGas: formatGwei(gasPrice.maxFeePerGas), + maxPriorityFeePerGas: formatGwei(gasPrice.maxPriorityFeePerGas), + }); return { txHash, gasLimit, gasPrice }; } @@ -230,9 +232,9 @@ export class L1TxUtils { try { const receipt = await this.publicClient.getTransactionReceipt({ hash }); if (receipt) { - this.logger?.debug(`L1 Transaction ${hash} confirmed`); + this.logger?.debug(`L1 transaction ${hash} mined`); if (receipt.status === 'reverted') { - this.logger?.error(`L1 Transaction ${hash} reverted`); + this.logger?.error(`L1 transaction ${hash} reverted`); } return receipt; } @@ -255,7 +257,7 @@ export class L1TxUtils { const timePassed = Date.now() - lastAttemptSent; if (tx && timePassed < gasConfig.stallTimeMs!) { - this.logger?.debug(`L1 Transaction ${currentTxHash} pending. Time passed: ${timePassed}ms`); + this.logger?.debug(`L1 transaction ${currentTxHash} pending. Time passed: ${timePassed}ms.`); // Check timeout before continuing if (gasConfig.txTimeoutMs) { @@ -280,7 +282,7 @@ export class L1TxUtils { ); this.logger?.debug( - `L1 Transaction ${currentTxHash} appears stuck. Attempting speed-up ${attempts}/${gasConfig.maxAttempts} ` + + `L1 transaction ${currentTxHash} appears stuck. Attempting speed-up ${attempts}/${gasConfig.maxAttempts} ` + `with new priority fee ${formatGwei(newGasPrice.maxPriorityFeePerGas)} gwei`, ); @@ -308,7 +310,7 @@ export class L1TxUtils { txTimedOut = Date.now() - initialTxTime > gasConfig.txTimeoutMs!; } } - throw new Error(`L1 Transaction ${currentTxHash} timed out`); + throw new Error(`L1 transaction ${currentTxHash} timed out`); } /** @@ -377,10 +379,12 @@ export class L1TxUtils { // Ensure priority fee doesn't exceed max fee const maxPriorityFeePerGas = priorityFee > maxFeePerGas ? maxFeePerGas : priorityFee; - this.logger?.debug( - `Gas price calculation (attempt ${attempt}): baseFee=${formatGwei(baseFee)}, ` + - `maxPriorityFee=${formatGwei(maxPriorityFeePerGas)}, maxFee=${formatGwei(maxFeePerGas)}`, - ); + this.logger?.debug(`Computed gas price`, { + attempt, + baseFee: formatGwei(baseFee), + maxFeePerGas: formatGwei(maxFeePerGas), + maxPriorityFeePerGas: formatGwei(maxPriorityFeePerGas), + }); return { maxFeePerGas, maxPriorityFeePerGas }; } diff --git a/yarn-project/ethereum/src/test/tx_delayer.test.ts b/yarn-project/ethereum/src/test/tx_delayer.test.ts index f85bcd453cf7..70449df4eaae 100644 --- a/yarn-project/ethereum/src/test/tx_delayer.test.ts +++ b/yarn-project/ethereum/src/test/tx_delayer.test.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts'; import { type Anvil } from '@viem/anvil'; @@ -13,7 +13,7 @@ import { type Delayer, withDelayer } from './tx_delayer.js'; describe('tx_delayer', () => { let anvil: Anvil; let rpcUrl: string; - let logger: DebugLogger; + let logger: Logger; let account: PrivateKeyAccount; let client: ViemClient; let delayer: Delayer; @@ -22,7 +22,7 @@ describe('tx_delayer', () => { beforeAll(async () => { ({ anvil, rpcUrl } = await startAnvil(ETHEREUM_SLOT_DURATION)); - logger = createDebugLogger('aztec:ethereum:test:tx_delayer'); + logger = createLogger('ethereum:test:tx_delayer'); }); beforeEach(() => { diff --git a/yarn-project/ethereum/src/test/tx_delayer.ts b/yarn-project/ethereum/src/test/tx_delayer.ts index 220823692e11..f96523dc797f 100644 --- a/yarn-project/ethereum/src/test/tx_delayer.ts +++ b/yarn-project/ethereum/src/test/tx_delayer.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { retryUntil } from '@aztec/foundation/retry'; import { inspect } from 'util'; @@ -12,7 +12,7 @@ import { walletActions, } from 'viem'; -export function waitUntilBlock(client: T, blockNumber: number | bigint, logger?: DebugLogger) { +export function waitUntilBlock(client: T, blockNumber: number | bigint, logger?: Logger) { const publicClient = 'getBlockNumber' in client && typeof client.getBlockNumber === 'function' ? (client as unknown as PublicClient) @@ -30,7 +30,7 @@ export function waitUntilBlock(client: T, blockNumber: number ); } -export function waitUntilL1Timestamp(client: T, timestamp: number | bigint, logger?: DebugLogger) { +export function waitUntilL1Timestamp(client: T, timestamp: number | bigint, logger?: Logger) { const publicClient = 'getBlockNumber' in client && typeof client.getBlockNumber === 'function' ? (client as unknown as PublicClient) @@ -94,7 +94,7 @@ export function withDelayer( client: T, opts: { ethereumSlotDuration: bigint | number }, ): { client: T; delayer: Delayer } { - const logger = createDebugLogger('aztec:ethereum:tx_delayer'); + const logger = createLogger('ethereum:tx_delayer'); const delayer = new DelayerImpl(opts); const extended = client // Tweak sendRawTransaction so it uses the delay defined in the delayer. diff --git a/yarn-project/ethereum/src/utils.ts b/yarn-project/ethereum/src/utils.ts index 2e66f6119fed..fbd8d45d55d5 100644 --- a/yarn-project/ethereum/src/utils.ts +++ b/yarn-project/ethereum/src/utils.ts @@ -1,5 +1,5 @@ import { type Fr } from '@aztec/foundation/fields'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { type Abi, @@ -27,7 +27,7 @@ export function extractEvent< abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, - logger?: DebugLogger, + logger?: Logger, ): TEventType { const event = tryExtractEvent(logs, address, abi, eventName, filter, logger); if (!event) { @@ -46,7 +46,7 @@ function tryExtractEvent< abi: TAbi, eventName: TEventName, filter?: (log: TEventType) => boolean, - logger?: DebugLogger, + logger?: Logger, ): TEventType | undefined { for (const log of logs) { if (log.address.toLowerCase() === address.toLowerCase()) { diff --git a/yarn-project/foundation/package.json b/yarn-project/foundation/package.json index cdaaafa04e9a..ae009fa83048 100644 --- a/yarn-project/foundation/package.json +++ b/yarn-project/foundation/package.json @@ -103,6 +103,7 @@ "@koa/cors": "^5.0.0", "@noble/curves": "^1.2.0", "bn.js": "^5.2.1", + "colorette": "^2.0.20", "debug": "^4.3.4", "detect-node": "^2.1.0", "elliptic": "^6.5.4", @@ -117,6 +118,8 @@ "lodash.clonedeepwith": "^4.5.0", "memdown": "^6.1.1", "pako": "^2.1.0", + "pino": "^9.5.0", + "pino-pretty": "^13.0.0", "sha3": "^2.1.4", "zod": "^3.23.8" }, diff --git a/yarn-project/foundation/src/collection/object.ts b/yarn-project/foundation/src/collection/object.ts index 9603daf45435..0eb02b31fb2a 100644 --- a/yarn-project/foundation/src/collection/object.ts +++ b/yarn-project/foundation/src/collection/object.ts @@ -28,3 +28,25 @@ export function compact(obj: T): { [P in keyof T]+?: Exclude(object: T, ...props: U[]): Pick; +export function pick(object: T, ...props: string[]): Partial; +export function pick(object: T, ...props: string[]): Partial { + const obj: any = {}; + for (const prop of props) { + obj[prop] = (object as any)[prop]; + } + return obj; +} + +/** Returns a new object by omitting the given keys. */ +export function omit(object: T, ...props: K[]): Omit; +export function omit(object: T, ...props: string[]): Partial; +export function omit(object: T, ...props: string[]): Partial { + const obj: any = { ...object }; + for (const prop of props) { + delete obj[prop]; + } + return obj; +} diff --git a/yarn-project/foundation/src/crypto/random/randomness_singleton.ts b/yarn-project/foundation/src/crypto/random/randomness_singleton.ts index f226874a9216..fb7181b0d821 100644 --- a/yarn-project/foundation/src/crypto/random/randomness_singleton.ts +++ b/yarn-project/foundation/src/crypto/random/randomness_singleton.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '../../log/logger.js'; +import { createLogger } from '../../log/pino-logger.js'; /** * A number generator which is used as a source of randomness in the system. If the SEED env variable is set, the @@ -15,7 +15,7 @@ export class RandomnessSingleton { private constructor( private readonly seed?: number, - private readonly log = createDebugLogger('aztec:randomness_singleton'), + private readonly log = createLogger('foundation:randomness_singleton'), ) { if (seed !== undefined) { this.log.debug(`Using pseudo-randomness with seed: ${seed}`); diff --git a/yarn-project/foundation/src/json-rpc/client/fetch.ts b/yarn-project/foundation/src/json-rpc/client/fetch.ts index 56773431b6dc..70ecc8ec3633 100644 --- a/yarn-project/foundation/src/json-rpc/client/fetch.ts +++ b/yarn-project/foundation/src/json-rpc/client/fetch.ts @@ -1,10 +1,10 @@ import { format, inspect } from 'util'; -import { type DebugLogger, createDebugLogger } from '../../log/index.js'; +import { type Logger, createLogger } from '../../log/index.js'; import { NoRetryError, makeBackoff, retry } from '../../retry/index.js'; import { jsonStringify } from '../convert.js'; -const log = createDebugLogger('json-rpc:json_rpc_client'); +const log = createLogger('json-rpc:json_rpc_client'); /** * A normal fetch function that does not retry. @@ -73,7 +73,7 @@ export async function defaultFetch( * @param log - Optional logger for logging attempts. * @returns A fetch function. */ -export function makeFetch(retries: number[], defaultNoRetry: boolean, log?: DebugLogger) { +export function makeFetch(retries: number[], defaultNoRetry: boolean, log?: Logger) { return async (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean, noRetry?: boolean) => { return await retry( () => defaultFetch(host, rpcMethod, body, useApiEndpoints, noRetry ?? defaultNoRetry), diff --git a/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts b/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts index 3c2bf3c32ba3..8949ca3e2eac 100644 --- a/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts +++ b/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts @@ -1,6 +1,6 @@ import { format } from 'util'; -import { createDebugLogger } from '../../log/logger.js'; +import { createLogger } from '../../log/pino-logger.js'; import { type ApiSchema, type ApiSchemaFor, schemaHasMethod } from '../../schemas/api.js'; import { defaultFetch } from './fetch.js'; @@ -19,7 +19,7 @@ export function createSafeJsonRpcClient( useApiEndpoints: boolean = false, namespaceMethods?: string | false, fetch = defaultFetch, - log = createDebugLogger('json-rpc:client'), + log = createLogger('json-rpc:client'), ): T { let id = 0; const request = async (methodName: string, params: any[]): Promise => { diff --git a/yarn-project/foundation/src/json-rpc/server/safe_json_rpc_server.ts b/yarn-project/foundation/src/json-rpc/server/safe_json_rpc_server.ts index 41f482347867..54436d63efa8 100644 --- a/yarn-project/foundation/src/json-rpc/server/safe_json_rpc_server.ts +++ b/yarn-project/foundation/src/json-rpc/server/safe_json_rpc_server.ts @@ -8,7 +8,7 @@ import { type AddressInfo } from 'net'; import { format, inspect } from 'util'; import { ZodError } from 'zod'; -import { type DebugLogger, createDebugLogger } from '../../log/index.js'; +import { type Logger, createLogger } from '../../log/index.js'; import { promiseWithResolvers } from '../../promise/utils.js'; import { type ApiSchema, type ApiSchemaFor, parseWithOptionals, schemaHasMethod } from '../../schemas/index.js'; import { jsonStringify } from '../convert.js'; @@ -27,7 +27,7 @@ export class SafeJsonRpcServer { /** Health check function */ private readonly healthCheck: StatusCheckFn = () => true, /** Logger */ - private log = createDebugLogger('json-rpc:server'), + private log = createLogger('json-rpc:server'), ) {} public isHealthy(): boolean | Promise { @@ -170,7 +170,7 @@ interface Proxy { * before forwarding calls, and then converts outputs into JSON using default conversions. */ export class SafeJsonProxy implements Proxy { - private log = createDebugLogger('json-rpc:proxy'); + private log = createLogger('json-rpc:proxy'); private schema: ApiSchema; constructor(private handler: T, schema: ApiSchemaFor) { @@ -233,7 +233,7 @@ export function makeHandler(handler: T, schema: ApiSchemaFor { try { const results = await Promise.all( @@ -259,7 +259,7 @@ function makeAggregateHealthcheck(namedHandlers: NamespacedApiHandlers, log?: De */ export function createNamespacedSafeJsonRpcServer( handlers: NamespacedApiHandlers, - log = createDebugLogger('json-rpc:server'), + log = createLogger('json-rpc:server'), ): SafeJsonRpcServer { const proxy = new NamespacedSafeJsonProxy(handlers); const healthCheck = makeAggregateHealthcheck(handlers, log); diff --git a/yarn-project/foundation/src/log/index.ts b/yarn-project/foundation/src/log/index.ts index 2bf44ed88ba4..8e61bc817825 100644 --- a/yarn-project/foundation/src/log/index.ts +++ b/yarn-project/foundation/src/log/index.ts @@ -1,5 +1,5 @@ export * from './console.js'; export * from './debug.js'; -export * from './logger.js'; +export * from './pino-logger.js'; export * from './log_history.js'; export * from './log_fn.js'; diff --git a/yarn-project/foundation/src/log/log-filters.test.ts b/yarn-project/foundation/src/log/log-filters.test.ts new file mode 100644 index 000000000000..11cabca8ed08 --- /dev/null +++ b/yarn-project/foundation/src/log/log-filters.test.ts @@ -0,0 +1,50 @@ +import { parseEnv } from './log-filters.js'; + +describe('parseEnv', () => { + const defaultLevel = 'info'; + + it('returns default level and empty filters when env is empty', () => { + const env = ''; + const [level, filters] = parseEnv(env, defaultLevel); + expect(level).toBe(defaultLevel); + expect(filters).toEqual([]); + }); + + it('parses level and filters from env string', () => { + const env = 'debug;warn:module1,module2;error:module3'; + const [level, filters] = parseEnv(env, defaultLevel); + expect(level).toBe('debug'); + expect(filters).toEqual([ + ['module3', 'error'], + ['module2', 'warn'], + ['module1', 'warn'], + ]); + }); + + it('handles spaces in env string', () => { + const env = 'debug; warn: module1, module2; error: module3'; + const [level, filters] = parseEnv(env, defaultLevel); + expect(level).toBe('debug'); + expect(filters).toEqual([ + ['module3', 'error'], + ['module2', 'warn'], + ['module1', 'warn'], + ]); + }); + + it('throws an error for invalid default log level', () => { + const env = 'invalid;module1:warn'; + expect(() => parseEnv(env, defaultLevel)).toThrow('Invalid log level: invalid'); + }); + + it('throws an error for invalid log level in filter', () => { + const env = 'invalid;warn:module'; + expect(() => parseEnv(env, defaultLevel)).toThrow('Invalid log level: invalid'); + }); + + it('throws an error for invalid log filter statement', () => { + const defaultLevel = 'info'; + const env = 'debug;warn:module1;error:'; + expect(() => parseEnv(env, defaultLevel)).toThrow('Invalid log filter statement: error'); + }); +}); diff --git a/yarn-project/foundation/src/log/log-filters.ts b/yarn-project/foundation/src/log/log-filters.ts new file mode 100644 index 000000000000..808818c3fd59 --- /dev/null +++ b/yarn-project/foundation/src/log/log-filters.ts @@ -0,0 +1,49 @@ +import { type LogLevel, LogLevels } from './log-levels.js'; + +export type LogFilters = [string, LogLevel][]; + +export function getLogLevelFromFilters(filters: LogFilters, module: string): LogLevel | undefined { + for (const [filterModule, level] of filters) { + if (module.startsWith(filterModule)) { + return level as LogLevel; + } + } + return undefined; +} + +export function assertLogLevel(level: string): asserts level is LogLevel { + if (!LogLevels.includes(level as LogLevel)) { + throw new Error(`Invalid log level: ${level}`); + } +} + +export function parseEnv(env: string | undefined, defaultLevel: LogLevel): [LogLevel, LogFilters] { + if (!env) { + return [defaultLevel, []]; + } + const [level] = env.split(';', 1); + assertLogLevel(level); + return [level, parseFilters(env.slice(level.length + 1))]; +} + +export function parseFilters(definition: string | undefined): LogFilters { + if (!definition) { + return []; + } + + const statements = definition.split(';'); + const filters: LogFilters = []; + for (const statement of statements) { + const [level] = statement.split(':', 1); + const modules = statement.slice(level.length + 1); + if (!modules || !level) { + throw new Error(`Invalid log filter statement: ${statement}`); + } + const sanitizedLevel = level.trim().toLowerCase(); + assertLogLevel(sanitizedLevel); + for (const module of modules.split(',')) { + filters.push([module.trim().toLowerCase(), sanitizedLevel as LogLevel | 'silent']); + } + } + return filters.reverse(); +} diff --git a/yarn-project/foundation/src/log/log-levels.ts b/yarn-project/foundation/src/log/log-levels.ts new file mode 100644 index 000000000000..d2a630de9f30 --- /dev/null +++ b/yarn-project/foundation/src/log/log-levels.ts @@ -0,0 +1,3 @@ +export const LogLevels = ['silent', 'fatal', 'error', 'warn', 'info', 'verbose', 'debug', 'trace'] as const; + +export type LogLevel = (typeof LogLevels)[number]; diff --git a/yarn-project/foundation/src/log/log_fn.ts b/yarn-project/foundation/src/log/log_fn.ts index f01419098867..be761201cd51 100644 --- a/yarn-project/foundation/src/log/log_fn.ts +++ b/yarn-project/foundation/src/log/log_fn.ts @@ -2,4 +2,4 @@ export type LogData = Record; /** A callable logger instance. */ -export type LogFn = (msg: string, data?: LogData) => void; +export type LogFn = (msg: string, data?: unknown) => void; diff --git a/yarn-project/foundation/src/log/logger.ts b/yarn-project/foundation/src/log/logger.ts deleted file mode 100644 index 2f5954f6eb07..000000000000 --- a/yarn-project/foundation/src/log/logger.ts +++ /dev/null @@ -1,179 +0,0 @@ -import debug from 'debug'; -import { inspect } from 'util'; - -import { type LogData, type LogFn } from './log_fn.js'; - -const LogLevels = ['silent', 'error', 'warn', 'info', 'verbose', 'debug'] as const; - -/** - * A valid log severity level. - */ -export type LogLevel = (typeof LogLevels)[number]; - -function getLogLevel() { - const envLogLevel = process.env.LOG_LEVEL?.toLowerCase() as LogLevel; - let defaultLogLevel: LogLevel = 'info'; - if (process.env.DEBUG) { - // if we set DEBUG to a non-empty string, use debug as default - defaultLogLevel = 'debug'; - } else if (process.env.NODE_ENV === 'test') { - // otherwise, be silent in tests as these are frequently ran en-masse - defaultLogLevel = 'silent'; - } - return LogLevels.includes(envLogLevel) ? envLogLevel : defaultLogLevel; -} - -export let currentLevel = getLogLevel(); - -const logElapsedTime = ['1', 'true'].includes(process.env.LOG_ELAPSED_TIME ?? ''); -const firstTimestamp: number = Date.now(); - -function filterNegativePatterns(debugString: string): string { - return debugString - .split(',') - .filter(p => !p.startsWith('-')) - .join(','); -} -function extractNegativePatterns(debugString: string): string[] { - return ( - debugString - .split(',') - .filter(p => p.startsWith('-')) - // Remove the leading '-' from the pattern - .map(p => p.slice(1)) - ); -} - -const namespaces = process.env.DEBUG ?? 'aztec:*'; -debug.enable(filterNegativePatterns(namespaces)); - -/** Log function that accepts an exception object */ -type ErrorLogFn = (msg: string, err?: Error | unknown, data?: LogData) => void; - -/** - * Logger that supports multiple severity levels. - */ -export type Logger = { [K in LogLevel]: LogFn } & { /** Error log function */ error: ErrorLogFn }; - -/** - * Logger that supports multiple severity levels and can be called directly to issue a debug statement. - * Intended as a drop-in replacement for the debug module. - */ -export type DebugLogger = Logger; - -/** - * Creates a new DebugLogger for the current module, defaulting to the LOG_LEVEL env var. - * 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 fixedLogData - Additional data to include in the log message. - * @usage createDebugLogger('aztec:validator'); - * // will always add the validator address to the log labels - * @returns A debug logger. - */ - -export function createDebugLogger(name: string): DebugLogger { - const debugLogger = debug(name); - - const negativePatterns = extractNegativePatterns(namespaces); - const accepted = () => { - return !negativePatterns.some(pattern => name.match(pattern)); - }; - const log = (level: LogLevel, msg: string, data?: LogData) => { - if (accepted()) { - logWithDebug(debugLogger, level, msg, data); - } - }; - const logger = { - silent: () => {}, - error: (msg: string, err?: unknown, data?: LogData) => log('error', fmtErr(msg, err), data), - warn: (msg: string, data?: LogData) => log('warn', msg, data), - info: (msg: string, data?: LogData) => log('info', msg, data), - verbose: (msg: string, data?: LogData) => log('verbose', msg, data), - debug: (msg: string, data?: LogData) => log('debug', msg, data), - }; - return Object.assign((msg: string, data?: LogData) => log('debug', msg, data), logger); -} - -/** - * A function to create a logger that automatically includes fixed data in each log entry. - * @param debugLogger - The base DebugLogger instance to which we attach fixed log data. - * @param fixedLogData - The data to be included in every log entry. - * @returns A DebugLogger with log level methods (error, warn, info, verbose, debug) that - * automatically attach `fixedLogData` to every log message. - */ -export function attachedFixedDataToLogger(debugLogger: DebugLogger, fixedLogData: LogData): DebugLogger { - // Helper function to merge fixed data with additional data passed to log entries. - const attach = (data?: LogData) => ({ ...fixedLogData, ...data }); - // Define the logger with all the necessary log level methods. - const logger = { - // Silent log level does nothing. - silent: () => {}, - error: (msg: string, err?: unknown, data?: LogData) => debugLogger.error(fmtErr(msg, err), attach(data)), - warn: (msg: string, data?: LogData) => debugLogger.warn(msg, attach(data)), - info: (msg: string, data?: LogData) => debugLogger.info(msg, attach(data)), - verbose: (msg: string, data?: LogData) => debugLogger.verbose(msg, attach(data)), - debug: (msg: string, data?: LogData) => debugLogger.debug(msg, attach(data)), - }; - return Object.assign((msg: string, data?: LogData) => debugLogger.debug(msg, attach(data)), logger); -} - -/** A callback to capture all logs. */ -export type LogHandler = (level: LogLevel, namespace: string, msg: string, data?: LogData) => void; - -const logHandlers: LogHandler[] = []; - -/** - * Registers a callback for all logs, whether they are emitted in the current log level or not. - * @param handler - Callback to be called on every log. - */ -export function onLog(handler: LogHandler) { - logHandlers.push(handler); -} - -/** Overrides current log level. */ -export function setLevel(level: LogLevel) { - currentLevel = level; -} - -/** - * Logs args to npm debug if enabled or log level is debug, console.error otherwise. - * @param debug - Instance of npm debug. - * @param level - Intended log level. - * @param args - Args to log. - */ -function logWithDebug(debug: debug.Debugger, level: LogLevel, msg: string, data?: LogData) { - for (const handler of logHandlers) { - handler(level, debug.namespace, msg, data); - } - - msg = data ? `${msg} ${fmtLogData(data)}` : msg; - if (debug.enabled && LogLevels.indexOf(level) <= LogLevels.indexOf(currentLevel)) { - if (logElapsedTime) { - const ts = ((Date.now() - firstTimestamp) / 1000).toFixed(3); - debug('%ss [%s] %s', ts, level.toUpperCase(), msg); - } else { - debug('[%s] %s', level.toUpperCase(), msg); - } - } -} - -/** - * Concatenates a log message and an exception. - * @param msg - Log message - * @param err - Error to log - * @returns A string with both the log message and the error message. - */ -function fmtErr(msg: string, err?: Error | unknown): string { - return err ? `${msg}: ${inspect(err)}` : msg; -} - -/** - * Formats structured log data as a string for console output. - * @param data - Optional log data. - */ -export function fmtLogData(data?: LogData): string { - return Object.entries(data ?? {}) - .map(([key, value]) => `${key}=${typeof value === 'object' && 'toString' in value ? value.toString() : value}`) - .join(' '); -} diff --git a/yarn-project/foundation/src/log/pino-logger.ts b/yarn-project/foundation/src/log/pino-logger.ts new file mode 100644 index 000000000000..f57dba248054 --- /dev/null +++ b/yarn-project/foundation/src/log/pino-logger.ts @@ -0,0 +1,157 @@ +import { createColors } from 'colorette'; +import isNode from 'detect-node'; +import { type LoggerOptions, pino } from 'pino'; +import { inspect } from 'util'; + +import { compactArray } from '../collection/array.js'; +import { getLogLevelFromFilters, parseEnv } from './log-filters.js'; +import { type LogLevel } from './log-levels.js'; +import { type LogData, type LogFn } from './log_fn.js'; + +export function createLogger(module: string): Logger { + // TODO(palla/log): Rename all module names to remove the aztec prefix + const pinoLogger = logger.child( + { module: module.replace(/^aztec:/, '') }, + { level: getLogLevelFromFilters(logFilters, module) }, + ); + + // We check manually for isLevelEnabled to avoid calling processLogData unnecessarily. + // Note that isLevelEnabled is missing from the browser version of pino. + const logFn = (level: LogLevel, msg: string, data?: unknown) => + isLevelEnabled(pinoLogger, level) && pinoLogger[level](processLogData((data as LogData) ?? {}), msg); + + return { + silent: () => {}, + // TODO(palla/log): Should we move err to data instead of the text message? + /** Log as fatal. Use when an error has brought down the system. */ + fatal: (msg: string, err?: unknown, data?: unknown) => logFn('fatal', formatErr(msg, err), data), + /** Log as error. Use for errors in general. */ + error: (msg: string, err?: unknown, data?: unknown) => logFn('error', formatErr(msg, err), data), + /** Log as warn. Use for when we stray from the happy path. */ + warn: (msg: string, data?: unknown) => logFn('warn', msg, data), + /** Log as info. Use for providing an operator with info on what the system is doing. */ + info: (msg: string, data?: unknown) => logFn('info', msg, data), + /** Log as verbose. Use for when we need additional insight on what a subsystem is doing. */ + verbose: (msg: string, data?: unknown) => logFn('verbose', msg, data), + /** Log as debug. Use for when we need debugging info to troubleshoot an issue on a specific component. */ + debug: (msg: string, data?: unknown) => logFn('debug', msg, data), + /** Log as trace. Use for when we want to denial-of-service any recipient of the logs. */ + trace: (msg: string, data?: unknown) => logFn('trace', msg, data), + level: pinoLogger.level as LogLevel, + isLevelEnabled: (level: LogLevel) => isLevelEnabled(pinoLogger, level), + }; +} + +// Allow global hooks for processing log data. +// Used for injecting OTEL trace_id in telemetry client. +type LogDataHandler = (data: LogData) => LogData; +const logDataHandlers: LogDataHandler[] = []; + +export function addLogDataHandler(handler: LogDataHandler): void { + logDataHandlers.push(handler); +} + +function processLogData(data: LogData): LogData { + return logDataHandlers.reduce((accum, handler) => handler(accum), data); +} + +// Patch isLevelEnabled missing from pino/browser. +function isLevelEnabled(logger: pino.Logger<'verbose', boolean>, level: LogLevel): boolean { + return typeof logger.isLevelEnabled === 'function' + ? logger.isLevelEnabled(level) + : logger.levels.values[level] >= logger.levels.values[logger.level]; +} + +// Load log levels from environment variables. +const defaultLogLevel = process.env.NODE_ENV === 'test' ? 'silent' : 'info'; +const [logLevel, logFilters] = parseEnv(process.env.LOG_LEVEL, defaultLogLevel); + +// Transport options for pretty logging to stdout via pino-pretty. +const useColor = true; +const { bold, reset } = createColors({ useColor }); +const prettyTransport: LoggerOptions['transport'] = { + target: 'pino-pretty', + options: { + destination: 2, + sync: true, + colorize: useColor, + ignore: 'module,pid,hostname,trace_id,span_id,trace_flags', + messageFormat: `${bold('{module}')} ${reset('{msg}')}`, + customLevels: 'fatal:60,error:50,warn:40,info:30,verbose:25,debug:20,trace:10', + customColors: 'fatal:bgRed,error:red,warn:yellow,info:green,verbose:magenta,debug:blue,trace:gray', + }, +}; + +// Transport for vanilla stdio logging as JSON. +const stdioTransport: LoggerOptions['transport'] = { + target: 'pino/file', + options: { destination: 2 }, +}; + +// Define custom logging levels for pino. +const customLevels = { verbose: 25 }; +const pinoOpts = { customLevels, useOnlyCustomLevels: false, level: logLevel }; +const levels = { + labels: { ...pino.levels.labels, ...Object.fromEntries(Object.entries(customLevels).map(e => e.reverse())) }, + values: { ...pino.levels.values, ...customLevels }, +}; + +// Transport for OpenTelemetry logging. While defining this here is an abstraction leakage since this +// should live in the telemetry-client, it is necessary to ensure that the logger is initialized with +// the correct transport. Tweaking transports of a live pino instance is tricky, and creating a new instance +// would mean that all child loggers created before the telemetry-client is initialized would not have +// this transport configured. Note that the target is defined as the export in the telemetry-client, +// since pino will load this transport separately on a worker thread, to minimize disruption to the main loop. + +const otelTransport: LoggerOptions['transport'] = { + target: '@aztec/telemetry-client/otel-pino-stream', + options: { levels, messageKey: 'msg' }, +}; + +// In nodejs, create a new pino instance with an stdout transport (either vanilla or json), and optionally +// an OTLP transport if the OTLP endpoint is provided. Note that transports are initialized in a worker thread. +// On the browser, we just log to the console. +const otlpEndpoint = process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT; +const logger = isNode + ? pino( + pinoOpts, + pino.transport({ + targets: compactArray([ + ['1', 'true', 'TRUE'].includes(process.env.LOG_JSON ?? '') ? stdioTransport : prettyTransport, + process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT ? otelTransport : undefined, + ]), + }), + ) + : pino({ ...pinoOpts, browser: { asObject: false } }); + +// Log the logger configuration. +logger.verbose( + { + module: 'logger', + ...logFilters.reduce((accum, [module, level]) => ({ ...accum, [`log.${module}`]: level }), {}), + }, + isNode + ? `Logger initialized with level ${logLevel}` + (otlpEndpoint ? ` with OTLP exporter to ${otlpEndpoint}` : '') + : `Browser console logger initialized with level ${logLevel}`, +); + +/** Log function that accepts an exception object */ +type ErrorLogFn = (msg: string, err?: Error | unknown, data?: LogData) => void; + +/** + * Logger that supports multiple severity levels. + */ +export type Logger = { [K in LogLevel]: LogFn } & { /** Error log function */ error: ErrorLogFn } & { + level: LogLevel; + isLevelEnabled: (level: LogLevel) => boolean; +}; + +/** + * Concatenates a log message and an exception. + * @param msg - Log message + * @param err - Error to log + * @returns A string with both the log message and the error message. + */ +function formatErr(msg: string, err?: Error | unknown): string { + return err ? `${msg}: ${inspect(err)}` : msg; +} diff --git a/yarn-project/foundation/src/queue/base_memory_queue.ts b/yarn-project/foundation/src/queue/base_memory_queue.ts index cd92dbcb85dd..8446e9adf04a 100644 --- a/yarn-project/foundation/src/queue/base_memory_queue.ts +++ b/yarn-project/foundation/src/queue/base_memory_queue.ts @@ -1,11 +1,11 @@ import { TimeoutError } from '../error/index.js'; -import { createDebugLogger } from '../log/index.js'; +import { createLogger } from '../log/index.js'; export abstract class BaseMemoryQueue { private waiting: ((item: T | null) => void)[] = []; private flushing = false; - constructor(private log = createDebugLogger('aztec:foundation:memory_fifo')) {} + constructor(private log = createLogger('foundation:memory_fifo')) {} protected abstract get items(): { length: number; diff --git a/yarn-project/foundation/src/queue/bounded_serial_queue.ts b/yarn-project/foundation/src/queue/bounded_serial_queue.ts index afecfd9b30b2..c27f668b559f 100644 --- a/yarn-project/foundation/src/queue/bounded_serial_queue.ts +++ b/yarn-project/foundation/src/queue/bounded_serial_queue.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '../log/index.js'; +import { createLogger } from '../log/index.js'; import { Semaphore } from './semaphore.js'; import { SerialQueue } from './serial_queue.js'; @@ -10,7 +10,7 @@ export class BoundedSerialQueue { private readonly queue = new SerialQueue(); private semaphore: Semaphore; - constructor(maxQueueSize: number, private log = createDebugLogger('aztec:foundation:bounded_serial_queue')) { + constructor(maxQueueSize: number, private log = createLogger('foundation:bounded_serial_queue')) { this.semaphore = new Semaphore(maxQueueSize); } diff --git a/yarn-project/foundation/src/queue/fifo_memory_queue.ts b/yarn-project/foundation/src/queue/fifo_memory_queue.ts index e2271143ac6f..b440270d1a7d 100644 --- a/yarn-project/foundation/src/queue/fifo_memory_queue.ts +++ b/yarn-project/foundation/src/queue/fifo_memory_queue.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '../log/logger.js'; +import { type Logger } from '../log/index.js'; import { BaseMemoryQueue } from './base_memory_queue.js'; /** @@ -9,7 +9,7 @@ import { BaseMemoryQueue } from './base_memory_queue.js'; export class FifoMemoryQueue extends BaseMemoryQueue { private container = new FifoQueue(); - constructor(log?: DebugLogger) { + constructor(log?: Logger) { super(log); } diff --git a/yarn-project/foundation/src/retry/index.ts b/yarn-project/foundation/src/retry/index.ts index e03f78480bfc..bec54c65d7dd 100644 --- a/yarn-project/foundation/src/retry/index.ts +++ b/yarn-project/foundation/src/retry/index.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '../log/index.js'; +import { createLogger } from '../log/index.js'; import { sleep } from '../sleep/index.js'; import { Timer } from '../timer/index.js'; @@ -48,7 +48,7 @@ export async function retry( fn: () => Promise, name = 'Operation', backoff = backoffGenerator(), - log = createDebugLogger('aztec:foundation:retry'), + log = createLogger('foundation:retry'), failSilently = false, ) { while (true) { diff --git a/yarn-project/foundation/src/schemas/utils.ts b/yarn-project/foundation/src/schemas/utils.ts index 5e12c46848b1..e09ef101d547 100644 --- a/yarn-project/foundation/src/schemas/utils.ts +++ b/yarn-project/foundation/src/schemas/utils.ts @@ -3,13 +3,16 @@ import { type ParseInput, type ParseReturnType, ZodFirstPartyTypeKind, + type ZodObject, ZodOptional, ZodParsedType, + type ZodRawShape, type ZodType, type ZodTypeAny, z, } from 'zod'; +import { pick } from '../collection/object.js'; import { isHex, withoutHexPrefix } from '../string/index.js'; import { type ZodFor } from './types.js'; @@ -102,3 +105,8 @@ export function mapSchema(key: ZodFor, value: ZodFor export function setSchema(value: ZodFor): ZodFor> { return z.array(value).transform(entries => new Set(entries)); } + +/** Given an already parsed and validated object, extracts the keys defined in the given schema. Does not validate again. */ +export function pickFromSchema>(obj: T, schema: S) { + return pick(obj, ...Object.keys(schema.shape)); +} diff --git a/yarn-project/foundation/src/transport/dispatch/create_dispatch_fn.ts b/yarn-project/foundation/src/transport/dispatch/create_dispatch_fn.ts index 944b1d6ef93c..c98e8156d666 100644 --- a/yarn-project/foundation/src/transport/dispatch/create_dispatch_fn.ts +++ b/yarn-project/foundation/src/transport/dispatch/create_dispatch_fn.ts @@ -1,6 +1,6 @@ import { format } from 'util'; -import { createDebugLogger } from '../../log/index.js'; +import { createLogger } from '../../log/index.js'; /** * Represents a message object for dispatching function calls. @@ -26,7 +26,7 @@ export interface DispatchMsg { * @param log - Optional logging function for debugging purposes. * @returns A dispatch function that accepts a DispatchMsg object and calls the target's method with provided arguments. */ -export function createDispatchFn(targetFn: () => any, log = createDebugLogger('aztec:foundation:dispatch')) { +export function createDispatchFn(targetFn: () => any, log = createLogger('foundation:dispatch')) { return async ({ fn, args }: DispatchMsg) => { const target = targetFn(); log.debug(format(`dispatching to ${target}: ${fn}`, args)); diff --git a/yarn-project/foundation/src/transport/transport_client.ts b/yarn-project/foundation/src/transport/transport_client.ts index 292ca8c9f925..ff29a4574884 100644 --- a/yarn-project/foundation/src/transport/transport_client.ts +++ b/yarn-project/foundation/src/transport/transport_client.ts @@ -1,12 +1,12 @@ import EventEmitter from 'events'; import { format } from 'util'; -import { createDebugLogger } from '../log/index.js'; +import { createLogger } from '../log/index.js'; import { type EventMessage, type ResponseMessage, isEventMessage } from './dispatch/messages.js'; import { type Connector } from './interface/connector.js'; import { type Socket } from './interface/socket.js'; -const log = createDebugLogger('aztec:transport_client'); +const log = createLogger('foundation:transport_client'); /** * Represents a pending request in the TransportClient. diff --git a/yarn-project/foundation/src/worker/worker_pool.ts b/yarn-project/foundation/src/worker/worker_pool.ts index 3d6689526723..e32e250b19f4 100644 --- a/yarn-project/foundation/src/worker/worker_pool.ts +++ b/yarn-project/foundation/src/worker/worker_pool.ts @@ -1,7 +1,7 @@ -import { createDebugLogger } from '../log/index.js'; +import { createLogger } from '../log/index.js'; import { type WasmWorker } from './wasm_worker.js'; -const log = createDebugLogger('bb:worker_pool'); +const log = createLogger('foundation:worker_pool'); /** * Type of a worker factory. diff --git a/yarn-project/ivc-integration/src/avm_integration.test.ts b/yarn-project/ivc-integration/src/avm_integration.test.ts index 31a14eac16cb..570c7ab3af32 100644 --- a/yarn-project/ivc-integration/src/avm_integration.test.ts +++ b/yarn-project/ivc-integration/src/avm_integration.test.ts @@ -7,7 +7,7 @@ import { PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH, } from '@aztec/circuits.js/constants'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { BufferReader } from '@aztec/foundation/serialize'; import { type FixedLengthArray } from '@aztec/noir-protocol-circuits-types/types'; import { simulateAvmTestContractGenerateCircuitInputs } from '@aztec/simulator/public/fixtures'; @@ -22,7 +22,7 @@ import { MockPublicBaseCircuit, witnessGenMockPublicBaseCircuit } from './index. // Auto-generated types from noir are not in camel case. /* eslint-disable camelcase */ -const logger = createDebugLogger('aztec:avm-integration'); +const logger = createLogger('ivc-integration:test:avm-integration'); describe('AVM Integration', () => { let bbWorkingDirectory: string; @@ -122,15 +122,14 @@ describe('AVM Integration', () => { async function proveAvmTestContract(functionName: string, calldata: Fr[] = []): Promise { const avmCircuitInputs = await simulateAvmTestContractGenerateCircuitInputs(functionName, calldata); - const internalLogger = createDebugLogger('aztec:avm-proving-test'); - const logger = (msg: string, _data?: any) => internalLogger.verbose(msg); + const internalLogger = createLogger('ivc-integration:test:avm-proving'); // The paths for the barretenberg binary and the write path are hardcoded for now. const bbPath = path.resolve('../../barretenberg/cpp/build/bin/bb'); const bbWorkingDirectory = await fs.mkdtemp(path.join(tmpdir(), 'bb-')); // Then we prove. - const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, logger); + const proofRes = await generateAvmProof(bbPath, bbWorkingDirectory, avmCircuitInputs, internalLogger); if (proofRes.status === BB_RESULT.FAILURE) { internalLogger.error(`Proof generation failed: ${proofRes.reason}`); } diff --git a/yarn-project/ivc-integration/src/native_client_ivc_integration.test.ts b/yarn-project/ivc-integration/src/native_client_ivc_integration.test.ts index 6f413b19a949..476afeff11fe 100644 --- a/yarn-project/ivc-integration/src/native_client_ivc_integration.test.ts +++ b/yarn-project/ivc-integration/src/native_client_ivc_integration.test.ts @@ -1,6 +1,6 @@ import { BB_RESULT, executeBbClientIvcProof, verifyClientIvcProof } from '@aztec/bb-prover'; import { ClientIvcProof } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { jest } from '@jest/globals'; import { encode } from '@msgpack/msgpack'; @@ -13,7 +13,7 @@ import { generate3FunctionTestingIVCStack, generate6FunctionTestingIVCStack } fr /* eslint-disable camelcase */ -const logger = createDebugLogger('aztec:clientivc-integration'); +const logger = createLogger('ivc-integration:test:native'); jest.setTimeout(120_000); diff --git a/yarn-project/ivc-integration/src/wasm_client_ivc_integration.test.ts b/yarn-project/ivc-integration/src/wasm_client_ivc_integration.test.ts index 44c3b7ba2345..84ea09c69b7c 100644 --- a/yarn-project/ivc-integration/src/wasm_client_ivc_integration.test.ts +++ b/yarn-project/ivc-integration/src/wasm_client_ivc_integration.test.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { jest } from '@jest/globals'; import { ungzip } from 'pako'; @@ -21,7 +21,7 @@ import { /* eslint-disable camelcase */ -const logger = createDebugLogger('aztec:clientivc-integration'); +const logger = createLogger('ivc-integration:test:wasm'); jest.setTimeout(120_000); diff --git a/yarn-project/ivc-integration/webpack.config.js b/yarn-project/ivc-integration/webpack.config.js index 679267bc82cc..93ad59791671 100644 --- a/yarn-project/ivc-integration/webpack.config.js +++ b/yarn-project/ivc-integration/webpack.config.js @@ -30,6 +30,9 @@ export default { ], resolve: { plugins: [new ResolveTypeScriptPlugin()], + fallback: { + tty: false, + } }, devServer: { hot: false, diff --git a/yarn-project/kv-store/package.json b/yarn-project/kv-store/package.json index bacc49e1a380..96073106a080 100644 --- a/yarn-project/kv-store/package.json +++ b/yarn-project/kv-store/package.json @@ -15,8 +15,7 @@ "clean": "rm -rf ./dest .tsbuildinfo", "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", - "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests", - "start": "DEBUG='aztec:*' && node ./dest/bin/index.js" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests" }, "inherits": [ "../package.common.json" @@ -80,4 +79,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/kv-store/src/lmdb/store.ts b/yarn-project/kv-store/src/lmdb/store.ts index 3e43972f088a..171d0874c337 100644 --- a/yarn-project/kv-store/src/lmdb/store.ts +++ b/yarn-project/kv-store/src/lmdb/store.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { mkdirSync } from 'fs'; import { mkdtemp, rm } from 'fs/promises'; @@ -25,7 +25,7 @@ export class AztecLmdbStore implements AztecKVStore { #rootDb: RootDatabase; #data: Database; #multiMapData: Database; - #log = createDebugLogger('aztec:kv-store:lmdb'); + #log = createLogger('kv-store:lmdb'); constructor(rootDb: RootDatabase, public readonly isEphemeral: boolean, private path?: string) { this.#rootDb = rootDb; @@ -60,7 +60,7 @@ export class AztecLmdbStore implements AztecKVStore { path?: string, mapSizeKb = 1 * 1024 * 1024, // defaults to 1 GB map size ephemeral: boolean = false, - log = createDebugLogger('aztec:kv-store:lmdb'), + log = createLogger('kv-store:lmdb'), ): AztecLmdbStore { if (path) { mkdirSync(path, { recursive: true }); diff --git a/yarn-project/kv-store/src/utils.ts b/yarn-project/kv-store/src/utils.ts index 25b651d0922e..685bab07b316 100644 --- a/yarn-project/kv-store/src/utils.ts +++ b/yarn-project/kv-store/src/utils.ts @@ -1,5 +1,5 @@ import { type EthAddress } from '@aztec/foundation/eth-address'; -import { type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { join } from 'path'; @@ -7,7 +7,7 @@ import { type DataStoreConfig } from './config.js'; import { type AztecKVStore } from './interfaces/store.js'; import { AztecLmdbStore } from './lmdb/store.js'; -export function createStore(name: string, config: DataStoreConfig, log: Logger = createDebugLogger('aztec:kv-store')) { +export function createStore(name: string, config: DataStoreConfig, log: Logger = createLogger('kv-store')) { let { dataDirectory } = config; if (typeof dataDirectory !== 'undefined') { dataDirectory = join(dataDirectory, name); diff --git a/yarn-project/merkle-tree/src/sparse_tree/sparse_tree.test.ts b/yarn-project/merkle-tree/src/sparse_tree/sparse_tree.test.ts index 56cbaee0a58c..68c776b64fbb 100644 --- a/yarn-project/merkle-tree/src/sparse_tree/sparse_tree.test.ts +++ b/yarn-project/merkle-tree/src/sparse_tree/sparse_tree.test.ts @@ -1,7 +1,7 @@ import { SiblingPath } from '@aztec/circuit-types'; import { randomBigInt } from '@aztec/foundation/crypto'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore } from '@aztec/kv-store'; import { openTmpStore } from '@aztec/kv-store/utils'; import { type Hasher } from '@aztec/types/interfaces'; @@ -14,7 +14,7 @@ import { standardBasedTreeTestSuite } from '../test/standard_based_test_suite.js import { treeTestSuite } from '../test/test_suite.js'; import { SparseTree } from './sparse_tree.js'; -const log = createDebugLogger('aztec:sparse_tree_test'); +const log = createLogger('merkle-tree:test:sparse_tree'); const createDb = async ( db: AztecKVStore, diff --git a/yarn-project/merkle-tree/src/tree_base.ts b/yarn-project/merkle-tree/src/tree_base.ts index cd20e8e0f2d8..395cb6b37799 100644 --- a/yarn-project/merkle-tree/src/tree_base.ts +++ b/yarn-project/merkle-tree/src/tree_base.ts @@ -1,6 +1,6 @@ import { SiblingPath } from '@aztec/circuit-types'; import { toBigIntLE, toBufferLE } from '@aztec/foundation/bigint-buffer'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type Bufferable, type FromBuffer, serializeToBuffer } from '@aztec/foundation/serialize'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; import { type Hasher } from '@aztec/types/interfaces'; @@ -51,7 +51,7 @@ export abstract class TreeBase implements MerkleTree { private root!: Buffer; private zeroHashes: Buffer[] = []; private cache: { [key: string]: Buffer } = {}; - protected log: DebugLogger; + protected log: Logger; protected hasher: HasherWithStats; private nodes: AztecMap; @@ -84,7 +84,7 @@ export abstract class TreeBase implements MerkleTree { this.root = root ? root : current; this.maxIndex = 2n ** BigInt(depth) - 1n; - this.log = createDebugLogger(`aztec:merkle-tree:${name.toLowerCase()}`); + this.log = createLogger(`merkle-tree:${name.toLowerCase()}`); } /** diff --git a/yarn-project/noir-protocol-circuits-types/src/index.ts b/yarn-project/noir-protocol-circuits-types/src/index.ts index 82b3e206384b..33a6adc74e6f 100644 --- a/yarn-project/noir-protocol-circuits-types/src/index.ts +++ b/yarn-project/noir-protocol-circuits-types/src/index.ts @@ -23,7 +23,7 @@ import { type RootRollupInputs, type RootRollupPublicInputs, } from '@aztec/circuits.js'; -import { applyStringFormatting, createDebugLogger } from '@aztec/foundation/log'; +import { applyStringFormatting, createLogger } from '@aztec/foundation/log'; import { type ForeignCallInput, type ForeignCallOutput } from '@noir-lang/acvm_js'; import { type CompiledCircuit, type InputMap, Noir } from '@noir-lang/noir_js'; @@ -730,7 +730,7 @@ function fromACVMField(field: string): Fr { export function foreignCallHandler(name: string, args: ForeignCallInput[]): Promise { // ForeignCallInput is actually a string[], so the args are string[][]. - const log = createDebugLogger('aztec:noir-protocol-circuits:oracle'); + const log = createLogger('noir-protocol-circuits:oracle'); if (name === 'debugLog') { assert(args.length === 3, 'expected 3 arguments for debugLog: msg, fields_length, fields'); diff --git a/yarn-project/p2p-bootstrap/scripts/docker-compose-bootstrap.yml b/yarn-project/p2p-bootstrap/scripts/docker-compose-bootstrap.yml index 1d6be73b473e..508bbf6918fe 100644 --- a/yarn-project/p2p-bootstrap/scripts/docker-compose-bootstrap.yml +++ b/yarn-project/p2p-bootstrap/scripts/docker-compose-bootstrap.yml @@ -6,6 +6,6 @@ services: ports: - '40400:40400' environment: - DEBUG: 'aztec:*' + LOG_LEVEL: 'verbose' P2P_TCP_LISTEN_ADDR: '0.0.0.0:40400' PEER_ID: '0a260024080112205ea53185db2e52dae74d0d4d6cadc494174810d0a713cd09b0ac517c38bc781e1224080112205ea53185db2e52dae74d0d4d6cadc494174810d0a713cd09b0ac517c38bc781e1a44080112402df8b977f356c6e34fa021c9647973234dff4df706c185794405aafb556723cf5ea53185db2e52dae74d0d4d6cadc494174810d0a713cd09b0ac517c38bc781e' diff --git a/yarn-project/p2p-bootstrap/src/index.ts b/yarn-project/p2p-bootstrap/src/index.ts index 373281518908..d6eec090fe2c 100644 --- a/yarn-project/p2p-bootstrap/src/index.ts +++ b/yarn-project/p2p-bootstrap/src/index.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { createStore } from '@aztec/kv-store/utils'; import { type BootnodeConfig, BootstrapNode } from '@aztec/p2p'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -7,7 +7,7 @@ import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import Koa from 'koa'; import Router from 'koa-router'; -const debugLogger = createDebugLogger('aztec:bootstrap_node'); +const debugLogger = createLogger('p2p-bootstrap:bootstrap_node'); const { HTTP_PORT } = process.env; diff --git a/yarn-project/p2p-bootstrap/terraform/main.tf b/yarn-project/p2p-bootstrap/terraform/main.tf index 31b76cb33cd4..e48152f282d8 100644 --- a/yarn-project/p2p-bootstrap/terraform/main.tf +++ b/yarn-project/p2p-bootstrap/terraform/main.tf @@ -137,7 +137,11 @@ resource "aws_ecs_task_definition" "p2p-bootstrap" { }, { "name": "DEBUG", - "value": "aztec:*,discv5:*" + "value": "discv5:*" + }, + { + "name": "LOG_LEVEL", + "value": "debug" }, { "name": "P2P_MIN_PEERS", diff --git a/yarn-project/p2p/src/bootstrap/bootstrap.ts b/yarn-project/p2p/src/bootstrap/bootstrap.ts index fd562fd121f3..d0d459be642d 100644 --- a/yarn-project/p2p/src/bootstrap/bootstrap.ts +++ b/yarn-project/p2p/src/bootstrap/bootstrap.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore } from '@aztec/kv-store'; import { OtelMetricsAdapter, type TelemetryClient } from '@aztec/telemetry-client'; @@ -21,7 +21,7 @@ export class BootstrapNode { constructor( private store: AztecKVStore, private telemetry: TelemetryClient, - private logger = createDebugLogger('aztec:p2p_bootstrap'), + private logger = createLogger('p2p:bootstrap'), ) {} /** diff --git a/yarn-project/p2p/src/client/index.ts b/yarn-project/p2p/src/client/index.ts index 05056a3c54a2..d57f469ec597 100644 --- a/yarn-project/p2p/src/client/index.ts +++ b/yarn-project/p2p/src/client/index.ts @@ -1,5 +1,5 @@ import type { ClientProtocolCircuitVerifier, L2BlockSource, WorldStateSynchronizer } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore } from '@aztec/kv-store'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { createStore } from '@aztec/kv-store/utils'; @@ -35,7 +35,7 @@ export const createP2PClient = async ( } = {}, ) => { let config = { ..._config }; - const store = deps.store ?? (await createStore('p2p', config, createDebugLogger('aztec:p2p:lmdb'))); + const store = deps.store ?? (await createStore('p2p', config, createLogger('p2p:lmdb'))); const mempools: MemPools = { txPool: deps.txPool ?? new AztecKVTxPool(store, telemetry), diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index 58575d5e5994..fdb5f5b23a5c 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -12,7 +12,7 @@ import { type TxHash, } from '@aztec/circuit-types'; import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; import { Attributes, type TelemetryClient, WithTracer, trackSpan } from '@aztec/telemetry-client'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -223,7 +223,7 @@ export class P2PClient extends WithTracer implements P2P { private p2pService: P2PService, private keepProvenTxsFor: number, telemetry: TelemetryClient = new NoopTelemetryClient(), - private log = createDebugLogger('aztec:p2p'), + private log = createLogger('p2p'), ) { super(telemetry, 'P2PClient'); diff --git a/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts b/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts index 95f9af415cb1..fe39a3fba186 100644 --- a/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts +++ b/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts @@ -1,5 +1,5 @@ import { type BlockAttestation } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type TelemetryClient } from '@aztec/telemetry-client'; import { PoolInstrumentation, PoolName } from '../instrumentation.js'; @@ -10,7 +10,7 @@ export class InMemoryAttestationPool implements AttestationPool { private attestations: Map>>; - constructor(telemetry: TelemetryClient, private log = createDebugLogger('aztec:attestation_pool')) { + constructor(telemetry: TelemetryClient, private log = createLogger('p2p:attestation_pool')) { this.attestations = new Map(); this.metrics = new PoolInstrumentation(telemetry, PoolName.ATTESTATION_POOL); } diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts index 865fbd8fdf28..27c87c1432e7 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts @@ -1,6 +1,6 @@ import { Tx, TxHash } from '@aztec/circuit-types'; import { type TxAddedToPoolStats } from '@aztec/circuit-types/stats'; -import { type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSet } from '@aztec/kv-store'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -30,7 +30,7 @@ export class AztecKVTxPool implements TxPool { * @param store - A KV store. * @param log - A logger. */ - constructor(store: AztecKVStore, telemetry: TelemetryClient, log = createDebugLogger('aztec:tx_pool')) { + constructor(store: AztecKVStore, telemetry: TelemetryClient, log = createLogger('p2p:tx_pool')) { this.#txs = store.openMap('txs'); this.#minedTxs = store.openMap('minedTxs'); this.#pendingTxs = store.openSet('pendingTxs'); diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts b/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts index 21c240894981..12619656ef42 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts @@ -1,6 +1,6 @@ import { Tx, TxHash } from '@aztec/circuit-types'; import { type TxAddedToPoolStats } from '@aztec/circuit-types/stats'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type TelemetryClient } from '@aztec/telemetry-client'; import { PoolInstrumentation, PoolName } from '../instrumentation.js'; @@ -23,7 +23,7 @@ export class InMemoryTxPool implements TxPool { * Class constructor for in-memory TxPool. Initiates our transaction pool as a JS Map. * @param log - A logger. */ - constructor(telemetry: TelemetryClient, private log = createDebugLogger('aztec:tx_pool')) { + constructor(telemetry: TelemetryClient, private log = createLogger('p2p:tx_pool')) { this.txs = new Map(); this.minedTxs = new Map(); this.pendingTxs = new Set(); diff --git a/yarn-project/p2p/src/service/discV5_service.ts b/yarn-project/p2p/src/service/discV5_service.ts index 06c3b740e014..a39d58725e8c 100644 --- a/yarn-project/p2p/src/service/discV5_service.ts +++ b/yarn-project/p2p/src/service/discV5_service.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { OtelMetricsAdapter, type TelemetryClient } from '@aztec/telemetry-client'; @@ -46,7 +46,7 @@ export class DiscV5Service extends EventEmitter implements PeerDiscoveryService private peerId: PeerId, config: P2PConfig, telemetry: TelemetryClient, - private logger = createDebugLogger('aztec:discv5_service'), + private logger = createLogger('p2p:discv5_service'), ) { super(); const { tcpAnnounceAddress, udpAnnounceAddress, udpListenAddress, bootstrapNodes } = config; diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index 18d2d180a4a5..350989851e0f 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -15,7 +15,7 @@ import { metricsTopicStrToLabels, } from '@aztec/circuit-types'; import { Fr } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { RunningPromise } from '@aztec/foundation/running-promise'; import type { AztecKVStore } from '@aztec/kv-store'; @@ -87,7 +87,7 @@ export class LibP2PService extends WithTracer implements P2PService { private worldStateSynchronizer: WorldStateSynchronizer, private telemetry: TelemetryClient, private requestResponseHandlers: ReqRespSubProtocolHandlers = DEFAULT_SUB_PROTOCOL_HANDLERS, - private logger = createDebugLogger('aztec:libp2p_service'), + private logger = createLogger('p2p:libp2p_service'), ) { super(telemetry, 'LibP2PService'); @@ -139,7 +139,7 @@ export class LibP2PService extends WithTracer implements P2PService { // add GossipSub listener this.node.services.pubsub.addEventListener('gossipsub:message', async e => { const { msg, propagationSource: peerId } = e.detail; - this.logger.debug(`Received PUBSUB message.`); + this.logger.trace(`Received PUBSUB message.`); await this.jobQueue.put(() => this.handleNewGossipMessage(msg, peerId)); }); @@ -451,7 +451,7 @@ export class LibP2PService extends WithTracer implements P2PService { * @param message - The message to propagate. */ public propagate(message: T): void { - this.logger.debug(`[${message.p2pMessageIdentifier()}] queued`); + this.logger.trace(`[${message.p2pMessageIdentifier()}] queued`); void this.jobQueue.put(async () => { await this.sendToPeers(message); }); diff --git a/yarn-project/p2p/src/service/peer_manager.ts b/yarn-project/p2p/src/service/peer_manager.ts index edb0ee58f9a4..b413db5d59cc 100644 --- a/yarn-project/p2p/src/service/peer_manager.ts +++ b/yarn-project/p2p/src/service/peer_manager.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type ENR } from '@chainsafe/enr'; import { type PeerId } from '@libp2p/interface'; @@ -27,7 +27,7 @@ export class PeerManager { private libP2PNode: PubSubLibp2p, private peerDiscoveryService: PeerDiscoveryService, private config: P2PConfig, - private logger = createDebugLogger('aztec:p2p:peer_manager'), + private logger = createLogger('p2p:peer_manager'), ) { this.peerScoring = new PeerScoring(config); // Handle new established connections diff --git a/yarn-project/p2p/src/service/reqresp/reqresp.integration.test.ts b/yarn-project/p2p/src/service/reqresp/reqresp.integration.test.ts index c6545c5b4930..8ec811f024ec 100644 --- a/yarn-project/p2p/src/service/reqresp/reqresp.integration.test.ts +++ b/yarn-project/p2p/src/service/reqresp/reqresp.integration.test.ts @@ -1,7 +1,7 @@ // An integration test for the p2p client to test req resp protocols import { MockL2BlockSource } from '@aztec/archiver/test'; import { type ClientProtocolCircuitVerifier, type WorldStateSynchronizer, mockTx } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type AztecKVStore } from '@aztec/kv-store'; import { type DataStoreConfig } from '@aztec/kv-store/config'; @@ -82,7 +82,7 @@ describe('Req Resp p2p client integration', () => { let kvStore: AztecKVStore; let worldState: WorldStateSynchronizer; let proofVerifier: ClientProtocolCircuitVerifier; - const logger = createDebugLogger('p2p-client-integration-test'); + const logger = createLogger('p2p:test:client-integration'); beforeEach(() => { ({ txPool, attestationPool, epochProofQuotePool } = makeMockPools()); diff --git a/yarn-project/p2p/src/service/reqresp/reqresp.ts b/yarn-project/p2p/src/service/reqresp/reqresp.ts index a2249015c2f0..b2bda21cb0db 100644 --- a/yarn-project/p2p/src/service/reqresp/reqresp.ts +++ b/yarn-project/p2p/src/service/reqresp/reqresp.ts @@ -1,5 +1,5 @@ // @attribution: lodestar impl for inspiration -import { type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { executeTimeoutWithCustomError } from '@aztec/foundation/timer'; import { type IncomingStreamData, type PeerId, type Stream } from '@libp2p/interface'; @@ -46,7 +46,7 @@ export class ReqResp { private rateLimiter: RequestResponseRateLimiter; constructor(config: P2PReqRespConfig, protected readonly libp2p: Libp2p, private peerManager: PeerManager) { - this.logger = createDebugLogger('aztec:p2p:reqresp'); + this.logger = createLogger('p2p:reqresp'); this.overallRequestTimeoutMs = config.overallRequestTimeoutMs; this.individualRequestTimeoutMs = config.individualRequestTimeoutMs; diff --git a/yarn-project/p2p/src/tx_validator/data_validator.ts b/yarn-project/p2p/src/tx_validator/data_validator.ts index f284f4638cea..143713cc2801 100644 --- a/yarn-project/p2p/src/tx_validator/data_validator.ts +++ b/yarn-project/p2p/src/tx_validator/data_validator.ts @@ -1,8 +1,8 @@ import { Tx, type TxValidator } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; export class DataTxValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:tx_data'); + #log = createLogger('p2p:tx_validator:tx_data'); validateTxs(txs: Tx[]): Promise<[validTxs: Tx[], invalidTxs: Tx[]]> { const validTxs: Tx[] = []; diff --git a/yarn-project/p2p/src/tx_validator/double_spend_validator.ts b/yarn-project/p2p/src/tx_validator/double_spend_validator.ts index 8556359150ab..5bb06bf1fa9d 100644 --- a/yarn-project/p2p/src/tx_validator/double_spend_validator.ts +++ b/yarn-project/p2p/src/tx_validator/double_spend_validator.ts @@ -1,13 +1,13 @@ import { type AnyTx, Tx, type TxValidator } from '@aztec/circuit-types'; import { Fr } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; export interface NullifierSource { getNullifierIndex: (nullifier: Fr) => Promise; } export class DoubleSpendTxValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:tx_double_spend'); + #log = createLogger('p2p:tx_validator:tx_double_spend'); #nullifierSource: NullifierSource; constructor(nullifierSource: NullifierSource, private readonly isValidatingBlock: boolean = true) { diff --git a/yarn-project/p2p/src/tx_validator/metadata_validator.ts b/yarn-project/p2p/src/tx_validator/metadata_validator.ts index 3629e400c919..fe3194a454ed 100644 --- a/yarn-project/p2p/src/tx_validator/metadata_validator.ts +++ b/yarn-project/p2p/src/tx_validator/metadata_validator.ts @@ -1,9 +1,9 @@ import { type AnyTx, Tx, type TxValidator } from '@aztec/circuit-types'; import { type Fr } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; export class MetadataTxValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:tx_metadata'); + #log = createLogger('p2p:tx_validator:tx_metadata'); constructor(private chainId: Fr, private blockNumber: Fr) {} diff --git a/yarn-project/p2p/src/tx_validator/tx_proof_validator.ts b/yarn-project/p2p/src/tx_validator/tx_proof_validator.ts index 030743256cf9..172234ce3bc8 100644 --- a/yarn-project/p2p/src/tx_validator/tx_proof_validator.ts +++ b/yarn-project/p2p/src/tx_validator/tx_proof_validator.ts @@ -1,8 +1,8 @@ import { type ClientProtocolCircuitVerifier, Tx, type TxValidator } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; export class TxProofValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:private_proof'); + #log = createLogger('p2p:tx_validator:private_proof'); constructor(private verifier: ClientProtocolCircuitVerifier) {} diff --git a/yarn-project/proof-verifier/src/proof_verifier.ts b/yarn-project/proof-verifier/src/proof_verifier.ts index 2a1bc06267fd..f87f50612a0a 100644 --- a/yarn-project/proof-verifier/src/proof_verifier.ts +++ b/yarn-project/proof-verifier/src/proof_verifier.ts @@ -1,7 +1,7 @@ import { retrieveL2ProofsFromRollup } from '@aztec/archiver/data-retrieval'; import { BBCircuitVerifier } from '@aztec/bb-prover'; import { createEthereumChain } from '@aztec/ethereum'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { Attributes, Metrics, type TelemetryClient, type UpDownCounter, ValueType } from '@aztec/telemetry-client'; @@ -22,7 +22,7 @@ export class ProofVerifier { private client: PublicClient, private verifier: BBCircuitVerifier, telemetryClient: TelemetryClient, - private logger: DebugLogger, + private logger: Logger, ) { this.runningPromise = new RunningPromise(this.work.bind(this), config.pollIntervalMs); this.proofVerified = telemetryClient.getMeter('ProofVerifier').createUpDownCounter(Metrics.PROOF_VERIFIER_COUNT, { @@ -33,7 +33,7 @@ export class ProofVerifier { } static async new(config: ProofVerifierConfig, telemetryClient: TelemetryClient): Promise { - const logger = createDebugLogger('aztec:block-verifier-bot'); + const logger = createLogger('proof-verifier:block-verifier-bot'); const verifier = await BBCircuitVerifier.new(config, [], logger); const client = createPublicClient({ chain: createEthereumChain(config.l1Url, config.l1ChainId).chainInfo, diff --git a/yarn-project/prover-client/package.json b/yarn-project/prover-client/package.json index b87665420836..08b6b59a46d8 100644 --- a/yarn-project/prover-client/package.json +++ b/yarn-project/prover-client/package.json @@ -28,8 +28,8 @@ "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "bb": "node --no-warnings ./dest/bb/index.js", - "test": "DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit", - "test:debug": "LOG_LEVEL=debug DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit --testNamePattern prover/bb_prover/parity" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit", + "test:debug": "LOG_LEVEL=debug NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit --testNamePattern prover/bb_prover/parity" }, "jest": { "moduleNameMapper": { @@ -104,4 +104,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/prover-client/package.local.json b/yarn-project/prover-client/package.local.json index bc11a5330d00..754bb34cec94 100644 --- a/yarn-project/prover-client/package.local.json +++ b/yarn-project/prover-client/package.local.json @@ -1,5 +1,5 @@ { "scripts": { - "test": "DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit" } -} +} \ No newline at end of file diff --git a/yarn-project/prover-client/src/block_builder/light.test.ts b/yarn-project/prover-client/src/block_builder/light.test.ts index de35c68e72f3..337492e5ff44 100644 --- a/yarn-project/prover-client/src/block_builder/light.test.ts +++ b/yarn-project/prover-client/src/block_builder/light.test.ts @@ -37,7 +37,7 @@ import { } from '@aztec/circuits.js'; import { makeGlobalVariables } from '@aztec/circuits.js/testing'; import { padArrayEnd, times } from '@aztec/foundation/collection'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type Tuple, assertLength } from '@aztec/foundation/serialize'; import { ProtocolCircuitVks, @@ -65,7 +65,7 @@ jest.setTimeout(50_000); describe('LightBlockBuilder', () => { let simulator: ServerCircuitProver; - let logger: DebugLogger; + let logger: Logger; let globalVariables: GlobalVariables; let l1ToL2Messages: Fr[]; let vkTreeRoot: Fr; @@ -78,7 +78,7 @@ describe('LightBlockBuilder', () => { let emptyProof: RecursiveProof; beforeAll(async () => { - logger = createDebugLogger('aztec:sequencer-client:test:block-builder'); + logger = createLogger('prover-client:test:block-builder'); simulator = new TestCircuitProver(new NoopTelemetryClient()); vkTreeRoot = getVKTreeRoot(); emptyProof = makeEmptyRecursiveProof(NESTED_RECURSIVE_PROOF_LENGTH); diff --git a/yarn-project/prover-client/src/block_builder/light.ts b/yarn-project/prover-client/src/block_builder/light.ts index 3bc5d4a299d9..efda5e61dd17 100644 --- a/yarn-project/prover-client/src/block_builder/light.ts +++ b/yarn-project/prover-client/src/block_builder/light.ts @@ -8,7 +8,7 @@ import { } from '@aztec/circuit-types'; import { Fr, type GlobalVariables, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js'; import { padArrayEnd } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -32,7 +32,7 @@ export class LightweightBlockBuilder implements BlockBuilder { private readonly txs: ProcessedTx[] = []; - private readonly logger = createDebugLogger('aztec:sequencer-client:block_builder_light'); + private readonly logger = createLogger('prover-client:block_builder'); constructor(private db: MerkleTreeWriteOperations, private telemetry: TelemetryClient) {} diff --git a/yarn-project/prover-client/src/mocks/fixtures.ts b/yarn-project/prover-client/src/mocks/fixtures.ts index c6f54f98d413..6d256dc042b6 100644 --- a/yarn-project/prover-client/src/mocks/fixtures.ts +++ b/yarn-project/prover-client/src/mocks/fixtures.ts @@ -11,7 +11,7 @@ import { } from '@aztec/circuits.js'; import { padArrayEnd } from '@aztec/foundation/collection'; import { randomBytes } from '@aztec/foundation/crypto'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { fileURLToPath } from '@aztec/foundation/url'; import { NativeACVMSimulator, type SimulationProvider, WASMSimulator } from '@aztec/simulator'; @@ -30,7 +30,7 @@ const { } = process.env; // Determines if we have access to the bb binary and a tmp folder for temp files -export const getEnvironmentConfig = async (logger: DebugLogger) => { +export const getEnvironmentConfig = async (logger: Logger) => { try { const expectedBBPath = BB_BINARY_PATH ? BB_BINARY_PATH @@ -68,7 +68,7 @@ export const getEnvironmentConfig = async (logger: DebugLogger) => { export async function getSimulationProvider( config: { acvmWorkingDirectory: string | undefined; acvmBinaryPath: string | undefined }, - logger?: DebugLogger, + logger?: Logger, ): Promise { if (config.acvmBinaryPath && config.acvmWorkingDirectory) { try { diff --git a/yarn-project/prover-client/src/mocks/test_context.ts b/yarn-project/prover-client/src/mocks/test_context.ts index e2df1346c11f..6c624c3ca39c 100644 --- a/yarn-project/prover-client/src/mocks/test_context.ts +++ b/yarn-project/prover-client/src/mocks/test_context.ts @@ -12,7 +12,7 @@ import { makeBloatedProcessedTx } from '@aztec/circuit-types/test'; import { type AppendOnlyTreeSnapshot, type Gas, type GlobalVariables, Header } from '@aztec/circuits.js'; import { times } from '@aztec/foundation/collection'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { @@ -53,7 +53,7 @@ export class TestContext { public orchestrator: TestProvingOrchestrator, public blockNumber: number, public directoriesToCleanup: string[], - public logger: DebugLogger, + public logger: Logger, ) {} public get epochProver() { @@ -61,7 +61,7 @@ export class TestContext { } static async new( - logger: DebugLogger, + logger: Logger, proverCount = 4, createProver: (bbConfig: BBProverConfig) => Promise = _ => Promise.resolve(new TestCircuitProver(new NoopTelemetryClient(), new WASMSimulator())), diff --git a/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts b/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts index 9dc700689b62..56e712ee8c71 100644 --- a/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts +++ b/yarn-project/prover-client/src/orchestrator/block-building-helpers.ts @@ -52,7 +52,7 @@ import { import { makeTuple } from '@aztec/foundation/array'; import { padArrayEnd } from '@aztec/foundation/collection'; import { sha256Trunc } from '@aztec/foundation/crypto'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { type Tuple, assertLength, toFriendlyJSON } from '@aztec/foundation/serialize'; import { computeUnbalancedMerkleRoot } from '@aztec/foundation/trees'; import { getVKIndex, getVKSiblingPath, getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; @@ -299,7 +299,7 @@ export function buildHeaderFromCircuitOutputs( parityPublicInputs: ParityPublicInputs, rootRollupOutputs: BlockRootOrBlockMergePublicInputs, updatedL1ToL2TreeSnapshot: AppendOnlyTreeSnapshot, - logger?: DebugLogger, + logger?: Logger, ) { const contentCommitment = new ContentCommitment( new Fr(previousMergeData[0].numTxs + previousMergeData[1].numTxs), diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator.ts b/yarn-project/prover-client/src/orchestrator/orchestrator.ts index 713e6350c6bd..c5991ff67d79 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator.ts @@ -42,7 +42,7 @@ import { import { makeTuple } from '@aztec/foundation/array'; import { maxBy, padArrayEnd } from '@aztec/foundation/collection'; import { AbortError } from '@aztec/foundation/error'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { type Tuple } from '@aztec/foundation/serialize'; import { pushTestData } from '@aztec/foundation/testing'; @@ -77,7 +77,7 @@ import { import { ProvingOrchestratorMetrics } from './orchestrator_metrics.js'; import { TxProvingState } from './tx-proving-state.js'; -const logger = createDebugLogger('aztec:prover:proving-orchestrator'); +const logger = createLogger('prover-client:orchestrator'); /** * Implements an event driven proving scheduler to build the recursive proof tree. The idea being: diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts index e17135ccfb70..a96915847435 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_errors.test.ts @@ -1,11 +1,11 @@ import { Fr } from '@aztec/circuits.js'; import { times } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TestContext } from '../mocks/test_context.js'; import { type ProvingOrchestrator } from './orchestrator.js'; -const logger = createDebugLogger('aztec:orchestrator-errors'); +const logger = createLogger('prover-client:test:orchestrator-errors'); describe('prover/orchestrator/errors', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts index ea610a11f568..5b6f59c1f0d8 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_failures.test.ts @@ -1,7 +1,7 @@ import { TestCircuitProver } from '@aztec/bb-prover'; import { type ServerCircuitProver } from '@aztec/circuit-types'; import { timesAsync } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { WASMSimulator } from '@aztec/simulator'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -10,7 +10,7 @@ import { jest } from '@jest/globals'; import { TestContext } from '../mocks/test_context.js'; import { ProvingOrchestrator } from './orchestrator.js'; -const logger = createDebugLogger('aztec:orchestrator-failures'); +const logger = createLogger('prover-client:test:orchestrator-failures'); describe('prover/orchestrator/failures', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts index d24a62d50e38..89b0e58fdd07 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_lifecycle.test.ts @@ -1,6 +1,6 @@ import { type ServerCircuitProver } from '@aztec/circuit-types'; import { NUM_BASE_PARITY_PER_ROOT_PARITY } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type PromiseWithResolvers, promiseWithResolvers } from '@aztec/foundation/promise'; import { sleep } from '@aztec/foundation/sleep'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -11,7 +11,7 @@ import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prov import { TestContext } from '../mocks/test_context.js'; import { ProvingOrchestrator } from './orchestrator.js'; -const logger = createDebugLogger('aztec:orchestrator-lifecycle'); +const logger = createLogger('prover-client:test:orchestrator-lifecycle'); describe('prover/orchestrator/lifecycle', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts index 8a8924b92af5..c22e9ce1df6d 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_mixed_blocks.test.ts @@ -2,11 +2,11 @@ import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js'; import { fr } from '@aztec/circuits.js/testing'; import { range } from '@aztec/foundation/array'; import { times } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:orchestrator-mixed-blocks'); +const logger = createLogger('prover-client:test:orchestrator-mixed-blocks'); describe('prover/orchestrator/mixed-blocks', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts index 26997fca8d55..48a62caa227b 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_multi_public_functions.test.ts @@ -1,12 +1,12 @@ import { EmptyTxValidator, mockTx } from '@aztec/circuit-types'; import { times } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:orchestrator-multi-public-functions'); +const logger = createLogger('prover-client:test:orchestrator-multi-public-functions'); describe('prover/orchestrator/public-functions', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts index c6fc35c1d00d..4b20b74480f0 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_multiple_blocks.test.ts @@ -1,9 +1,9 @@ import { timesAsync } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:orchestrator-multi-blocks'); +const logger = createLogger('prover-client:test:orchestrator-multi-blocks'); describe('prover/orchestrator/multi-block', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts index 393329094f18..c41e85a4800f 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_public_functions.test.ts @@ -1,11 +1,11 @@ import { mockTx } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:orchestrator-public-functions'); +const logger = createLogger('prover-client:test:orchestrator-public-functions'); describe('prover/orchestrator/public-functions', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts index 293ff2777590..daf63d327573 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_single_blocks.test.ts @@ -2,12 +2,12 @@ import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js'; import { fr } from '@aztec/circuits.js/testing'; import { range } from '@aztec/foundation/array'; import { times } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:orchestrator-single-blocks'); +const logger = createLogger('prover-client:test:orchestrator-single-blocks'); describe('prover/orchestrator/blocks', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/orchestrator/orchestrator_workflow.test.ts b/yarn-project/prover-client/src/orchestrator/orchestrator_workflow.test.ts index ea1dd3b49f4c..e5a1ed7d5917 100644 --- a/yarn-project/prover-client/src/orchestrator/orchestrator_workflow.test.ts +++ b/yarn-project/prover-client/src/orchestrator/orchestrator_workflow.test.ts @@ -13,7 +13,7 @@ import { makeRecursiveProof, } from '@aztec/circuits.js'; import { makeParityPublicInputs } from '@aztec/circuits.js/testing'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { sleep } from '@aztec/foundation/sleep'; import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types'; @@ -23,7 +23,7 @@ import { type MockProxy, mock } from 'jest-mock-extended'; import { TestContext } from '../mocks/test_context.js'; import { type ProvingOrchestrator } from './orchestrator.js'; -const logger = createDebugLogger('aztec:orchestrator-workflow'); +const logger = createLogger('prover-client:test:orchestrator-workflow'); describe('prover/orchestrator', () => { describe('workflow', () => { diff --git a/yarn-project/prover-client/src/prover-agent/memory-proving-queue.ts b/yarn-project/prover-client/src/prover-agent/memory-proving-queue.ts index a6175f37e95f..c98aed86da35 100644 --- a/yarn-project/prover-client/src/prover-agent/memory-proving-queue.ts +++ b/yarn-project/prover-client/src/prover-agent/memory-proving-queue.ts @@ -32,7 +32,7 @@ import type { } from '@aztec/circuits.js'; import { randomBytes } from '@aztec/foundation/crypto'; import { AbortError, TimeoutError } from '@aztec/foundation/error'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise'; import { PriorityMemoryQueue } from '@aztec/foundation/queue'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -57,7 +57,7 @@ const defaultTimeSource = () => Date.now(); * The queue accumulates jobs and provides them to agents prioritized by block number. */ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource { - private log = createDebugLogger('aztec:prover-client:prover-pool:queue'); + private log = createLogger('prover-client:prover-pool:queue'); private queue = new PriorityMemoryQueue( (a, b) => (a.epochNumber ?? 0) - (b.epochNumber ?? 0), ); diff --git a/yarn-project/prover-client/src/prover-agent/prover-agent.ts b/yarn-project/prover-client/src/prover-agent/prover-agent.ts index 2b86450afbf9..b2c6aebbf27f 100644 --- a/yarn-project/prover-client/src/prover-agent/prover-agent.ts +++ b/yarn-project/prover-client/src/prover-agent/prover-agent.ts @@ -8,7 +8,7 @@ import { type ServerCircuitProver, makeProvingRequestResult, } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { elapsed } from '@aztec/foundation/timer'; @@ -38,7 +38,7 @@ export class ProverAgent implements ProverAgentApi { private maxConcurrency = 1, /** How long to wait between jobs */ private pollIntervalMs = 100, - private log = createDebugLogger('aztec:prover-client:prover-agent'), + private log = createLogger('prover-client:prover-agent'), ) {} setMaxConcurrency(maxConcurrency: number): Promise { diff --git a/yarn-project/prover-client/src/prover-client/prover-client.ts b/yarn-project/prover-client/src/prover-client/prover-client.ts index 3cc5b9aa32b0..037343950dda 100644 --- a/yarn-project/prover-client/src/prover-client/prover-client.ts +++ b/yarn-project/prover-client/src/prover-client/prover-client.ts @@ -12,7 +12,7 @@ import { } from '@aztec/circuit-types/interfaces'; import { Fr } from '@aztec/circuits.js'; import { times } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { NativeACVMSimulator } from '@aztec/simulator'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -38,7 +38,7 @@ export class ProverClient implements EpochProverManager { private telemetry: TelemetryClient, private orchestratorClient: ProvingJobProducer, private agentClient?: ProvingJobConsumer, - private log = createDebugLogger('aztec:prover-client:tx-prover'), + private log = createLogger('prover-client:tx-prover'), ) { // TODO(palla/prover-node): Cache the paddingTx here, and not in each proving orchestrator, // so it can be reused across multiple ones and not recomputed every time. diff --git a/yarn-project/prover-client/src/proving_broker/caching_broker_facade.ts b/yarn-project/prover-client/src/proving_broker/caching_broker_facade.ts index 2885350d958c..a2ead87ecaa4 100644 --- a/yarn-project/prover-client/src/proving_broker/caching_broker_facade.ts +++ b/yarn-project/prover-client/src/proving_broker/caching_broker_facade.ts @@ -33,7 +33,7 @@ import { type TubeInputs, } from '@aztec/circuits.js'; import { sha256 } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { retryUntil } from '@aztec/foundation/retry'; import { InlineProofStore, type ProofStore } from './proof_store.js'; @@ -52,7 +52,7 @@ export class CachingBrokerFacade implements ServerCircuitProver { private proofStore: ProofStore = new InlineProofStore(), private waitTimeoutMs = MAX_WAIT_MS, private pollIntervalMs = 1000, - private log = createDebugLogger('aztec:prover-client:caching-prover-broker'), + private log = createLogger('prover-client:caching-prover-broker'), ) {} private async enqueueAndWaitForJob( diff --git a/yarn-project/prover-client/src/proving_broker/proving_agent.ts b/yarn-project/prover-client/src/proving_broker/proving_agent.ts index 6d17c8176b5d..ec9a2dcc85eb 100644 --- a/yarn-project/prover-client/src/proving_broker/proving_agent.ts +++ b/yarn-project/prover-client/src/proving_broker/proving_agent.ts @@ -8,7 +8,7 @@ import { ProvingRequestType, type ServerCircuitProver, } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { type ProofStore } from './proof_store.js'; @@ -32,7 +32,7 @@ export class ProvingAgent { private proofAllowList: Array = [], /** How long to wait between jobs */ private pollIntervalMs = 1000, - private log = createDebugLogger('aztec:prover-client:proving-agent'), + private log = createLogger('prover-client:proving-agent'), ) { this.runningPromise = new RunningPromise(this.safeWork, this.pollIntervalMs); } diff --git a/yarn-project/prover-client/src/proving_broker/proving_broker.ts b/yarn-project/prover-client/src/proving_broker/proving_broker.ts index 62667821ec7d..8c10ce424eff 100644 --- a/yarn-project/prover-client/src/proving_broker/proving_broker.ts +++ b/yarn-project/prover-client/src/proving_broker/proving_broker.ts @@ -9,7 +9,7 @@ import { type ProvingJobStatus, ProvingRequestType, } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise'; import { PriorityMemoryQueue } from '@aztec/foundation/queue'; @@ -78,7 +78,7 @@ export class ProvingBroker implements ProvingJobProducer, ProvingJobConsumer { public constructor( private database: ProvingBrokerDatabase, { jobTimeoutMs = 30, timeoutIntervalMs = 10, maxRetries = 3 }: ProofRequestBrokerConfig = {}, - private logger = createDebugLogger('aztec:prover-client:proving-broker'), + private logger = createLogger('prover-client:proving-broker'), ) { this.timeoutPromise = new RunningPromise(this.timeoutCheck, timeoutIntervalMs); this.jobTimeoutMs = jobTimeoutMs; diff --git a/yarn-project/prover-client/src/test/bb_prover_base_rollup.test.ts b/yarn-project/prover-client/src/test/bb_prover_base_rollup.test.ts index 154ac6c71dd9..915606e65dd4 100644 --- a/yarn-project/prover-client/src/test/bb_prover_base_rollup.test.ts +++ b/yarn-project/prover-client/src/test/bb_prover_base_rollup.test.ts @@ -8,7 +8,7 @@ import { PrivateTubeData, VkWitnessData, } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getVKSiblingPath, getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { protocolContractTreeRoot } from '@aztec/protocol-contracts'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -16,7 +16,7 @@ import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import { TestContext } from '../mocks/test_context.js'; import { buildBaseRollupHints } from '../orchestrator/block-building-helpers.js'; -const logger = createDebugLogger('aztec:bb-prover-base-rollup'); +const logger = createLogger('prover-client:test:bb-prover-base-rollup'); describe('prover/bb_prover/base-rollup', () => { let context: TestContext; diff --git a/yarn-project/prover-client/src/test/bb_prover_full_rollup.test.ts b/yarn-project/prover-client/src/test/bb_prover_full_rollup.test.ts index 43684e6f1a9d..6c1b4f4dceb9 100644 --- a/yarn-project/prover-client/src/test/bb_prover_full_rollup.test.ts +++ b/yarn-project/prover-client/src/test/bb_prover_full_rollup.test.ts @@ -3,7 +3,7 @@ import { mockTx } from '@aztec/circuit-types'; import { Fr, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js'; import { makeTuple } from '@aztec/foundation/array'; import { times } from '@aztec/foundation/collection'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { getTestData, isGenerateTestDataEnabled, writeTestData } from '@aztec/foundation/testing'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -15,14 +15,14 @@ import { TestContext } from '../mocks/test_context.js'; describe('prover/bb_prover/full-rollup', () => { let context: TestContext; let prover: BBNativeRollupProver; - let log: DebugLogger; + let log: Logger; beforeEach(async () => { const buildProver = async (bbConfig: BBProverConfig) => { prover = await BBNativeRollupProver.new(bbConfig, new NoopTelemetryClient()); return prover; }; - log = createDebugLogger('aztec:bb-prover-full-rollup'); + log = createLogger('prover-client:test:bb-prover-full-rollup'); context = await TestContext.new(log, 1, buildProver); }); diff --git a/yarn-project/prover-client/src/test/bb_prover_parity.test.ts b/yarn-project/prover-client/src/test/bb_prover_parity.test.ts index 1763fd1b4000..12a3b16e0005 100644 --- a/yarn-project/prover-client/src/test/bb_prover_parity.test.ts +++ b/yarn-project/prover-client/src/test/bb_prover_parity.test.ts @@ -13,7 +13,7 @@ import { } from '@aztec/circuits.js'; import { makeTuple } from '@aztec/foundation/array'; import { randomBytes } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { ProtocolCircuitVkIndexes, ServerCircuitVks, @@ -24,7 +24,7 @@ import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import { TestContext } from '../mocks/test_context.js'; -const logger = createDebugLogger('aztec:bb-prover-parity'); +const logger = createLogger('prover-client:test:bb-prover-parity'); describe('prover/bb_prover/parity', () => { let context: TestContext; diff --git a/yarn-project/prover-node/src/bond/bond-manager.ts b/yarn-project/prover-node/src/bond/bond-manager.ts index e6701ba59674..ca9067ea1938 100644 --- a/yarn-project/prover-node/src/bond/bond-manager.ts +++ b/yarn-project/prover-node/src/bond/bond-manager.ts @@ -1,10 +1,10 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type EscrowContract } from './escrow-contract.js'; import { type TokenContract } from './token-contract.js'; export class BondManager { - private readonly logger = createDebugLogger('aztec:prover-node:bond-manager'); + private readonly logger = createLogger('prover-node:bond-manager'); constructor( private readonly tokenContract: TokenContract, diff --git a/yarn-project/prover-node/src/bond/token-contract.ts b/yarn-project/prover-node/src/bond/token-contract.ts index 6368282138a0..55f68f833480 100644 --- a/yarn-project/prover-node/src/bond/token-contract.ts +++ b/yarn-project/prover-node/src/bond/token-contract.ts @@ -1,5 +1,5 @@ import { EthAddress } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { IERC20Abi, TestERC20Abi } from '@aztec/l1-artifacts'; import { @@ -21,7 +21,7 @@ const MIN_ALLOWANCE = 1n << 255n; export class TokenContract { private token: GetContractReturnType>; - private logger = createDebugLogger('aztec:prover-node:token-contract'); + private logger = createLogger('prover-node:token-contract'); constructor( private readonly client: Client< diff --git a/yarn-project/prover-node/src/factory.ts b/yarn-project/prover-node/src/factory.ts index 7190d81ee66a..a2ac17191de7 100644 --- a/yarn-project/prover-node/src/factory.ts +++ b/yarn-project/prover-node/src/factory.ts @@ -2,7 +2,7 @@ import { type Archiver, createArchiver } from '@aztec/archiver'; import { type ProverCoordination, type ProvingJobBroker } from '@aztec/circuit-types'; import { createEthereumChain } from '@aztec/ethereum'; import { Buffer32 } from '@aztec/foundation/buffer'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { RollupAbi } from '@aztec/l1-artifacts'; import { createProverClient } from '@aztec/prover-client'; @@ -31,7 +31,7 @@ export async function createProverNode( config: ProverNodeConfig & DataStoreConfig, deps: { telemetry?: TelemetryClient; - log?: DebugLogger; + log?: Logger; aztecNodeTxProvider?: ProverCoordination; archiver?: Archiver; publisher?: L1Publisher; @@ -39,7 +39,7 @@ export async function createProverNode( } = {}, ) { const telemetry = deps.telemetry ?? new NoopTelemetryClient(); - const log = deps.log ?? createDebugLogger('aztec:prover'); + const log = deps.log ?? createLogger('prover-node'); const archiver = deps.archiver ?? (await createArchiver(config, telemetry, { blockUntilSync: true })); log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`); diff --git a/yarn-project/prover-node/src/job/epoch-proving-job.ts b/yarn-project/prover-node/src/job/epoch-proving-job.ts index 02952266b2cf..ba48a49bde36 100644 --- a/yarn-project/prover-node/src/job/epoch-proving-job.ts +++ b/yarn-project/prover-node/src/job/epoch-proving-job.ts @@ -12,7 +12,7 @@ import { type TxHash, } from '@aztec/circuit-types'; import { asyncPool } from '@aztec/foundation/async-pool'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { Timer } from '@aztec/foundation/timer'; import { type L1Publisher } from '@aztec/sequencer-client'; @@ -29,7 +29,7 @@ import { type ProverNodeMetrics } from '../metrics.js'; */ export class EpochProvingJob { private state: EpochProvingJobState = 'initialized'; - private log = createDebugLogger('aztec:epoch-proving-job'); + private log = createLogger('prover-node:epoch-proving-job'); private uuid: string; private runPromise: Promise | undefined; diff --git a/yarn-project/prover-node/src/monitors/claims-monitor.ts b/yarn-project/prover-node/src/monitors/claims-monitor.ts index abce274866b6..8e2781f86c02 100644 --- a/yarn-project/prover-node/src/monitors/claims-monitor.ts +++ b/yarn-project/prover-node/src/monitors/claims-monitor.ts @@ -1,6 +1,6 @@ import { type EpochProofClaim } from '@aztec/circuit-types'; import { type EthAddress } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; import { type L1Publisher } from '@aztec/sequencer-client'; @@ -10,7 +10,7 @@ export interface ClaimsMonitorHandler { export class ClaimsMonitor { private runningPromise: RunningPromise; - private log = createDebugLogger('aztec:prover-node:claims-monitor'); + private log = createLogger('prover-node:claims-monitor'); private handler: ClaimsMonitorHandler | undefined; private lastClaimEpochNumber: bigint | undefined; diff --git a/yarn-project/prover-node/src/monitors/epoch-monitor.ts b/yarn-project/prover-node/src/monitors/epoch-monitor.ts index 0f106e385220..332923ddbaba 100644 --- a/yarn-project/prover-node/src/monitors/epoch-monitor.ts +++ b/yarn-project/prover-node/src/monitors/epoch-monitor.ts @@ -1,5 +1,5 @@ import { type L2BlockSource } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; export interface EpochMonitorHandler { @@ -9,7 +9,7 @@ export interface EpochMonitorHandler { export class EpochMonitor { private runningPromise: RunningPromise; - private log = createDebugLogger('aztec:prover-node:epoch-monitor'); + private log = createLogger('prover-node:epoch-monitor'); private handler: EpochMonitorHandler | undefined; diff --git a/yarn-project/prover-node/src/prover-cache/cache_manager.ts b/yarn-project/prover-node/src/prover-cache/cache_manager.ts index b15693ecffe0..497300d1e424 100644 --- a/yarn-project/prover-node/src/prover-cache/cache_manager.ts +++ b/yarn-project/prover-node/src/prover-cache/cache_manager.ts @@ -1,5 +1,5 @@ import { type ProverCache } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { AztecLmdbStore } from '@aztec/kv-store/lmdb'; import { InMemoryProverCache } from '@aztec/prover-client'; @@ -14,7 +14,7 @@ const EPOCH_DIR_SEPARATOR = '_'; const EPOCH_HASH_FILENAME = 'epoch_hash.txt'; export class ProverCacheManager { - constructor(private cacheDir?: string, private log = createDebugLogger('aztec:prover-node:cache-manager')) {} + constructor(private cacheDir?: string, private log = createLogger('prover-node:cache-manager')) {} public async openCache(epochNumber: bigint, epochHash: Buffer): Promise { if (!this.cacheDir) { diff --git a/yarn-project/prover-node/src/prover-coordination/factory.ts b/yarn-project/prover-node/src/prover-coordination/factory.ts index a6353294dc25..e8e94f1153a1 100644 --- a/yarn-project/prover-node/src/prover-coordination/factory.ts +++ b/yarn-project/prover-node/src/prover-coordination/factory.ts @@ -1,7 +1,7 @@ import { type ArchiveSource, type Archiver } from '@aztec/archiver'; import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover'; import { type ProverCoordination, type WorldStateSynchronizer, createAztecNodeClient } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { createP2PClient } from '@aztec/p2p'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -26,7 +26,7 @@ export async function createProverCoordination( config: ProverNodeConfig & DataStoreConfig, deps: ProverCoordinationDeps, ): Promise { - const log = createDebugLogger('aztec:createProverCoordination'); + const log = createLogger('prover-node:prover-coordination'); if (deps.aztecNodeTxProvider) { log.info('Using prover coordination via aztec node'); diff --git a/yarn-project/prover-node/src/prover-node.ts b/yarn-project/prover-node/src/prover-node.ts index d4ea397d245a..51cad0f12275 100644 --- a/yarn-project/prover-node/src/prover-node.ts +++ b/yarn-project/prover-node/src/prover-node.ts @@ -16,7 +16,7 @@ import { import { type ContractDataSource } from '@aztec/circuits.js'; import { compact } from '@aztec/foundation/collection'; import { sha256 } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type Maybe } from '@aztec/foundation/types'; import { type L1Publisher } from '@aztec/sequencer-client'; import { PublicProcessorFactory } from '@aztec/simulator'; @@ -44,7 +44,7 @@ export type ProverNodeOptions = { * proof for the epoch, and submits it to L1. */ export class ProverNode implements ClaimsMonitorHandler, EpochMonitorHandler, ProverNodeApi { - private log = createDebugLogger('aztec:prover-node'); + private log = createLogger('prover-node'); private latestEpochWeAreProving: bigint | undefined; private jobs: Map = new Map(); diff --git a/yarn-project/pxe/src/bin/index.ts b/yarn-project/pxe/src/bin/index.ts index ac3f0d6f84e8..e80a9d99eebf 100644 --- a/yarn-project/pxe/src/bin/index.ts +++ b/yarn-project/pxe/src/bin/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env -S node --no-warnings import { createAztecNodeClient } from '@aztec/circuit-types'; import { init } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { getPXEServiceConfig } from '../config/index.js'; import { startPXEHttpServer } from '../pxe_http/index.js'; @@ -9,7 +9,7 @@ import { createPXEService } from '../pxe_service/index.js'; const { PXE_PORT = 8080, AZTEC_NODE_URL = 'http://localhost:8079' } = process.env; -const logger = createDebugLogger('aztec:pxe_service'); +const logger = createLogger('pxe:service'); /** * Create and start a new PXE HTTP Server diff --git a/yarn-project/pxe/src/kernel_oracle/index.ts b/yarn-project/pxe/src/kernel_oracle/index.ts index a66ec8db465e..7a5648ed7c34 100644 --- a/yarn-project/pxe/src/kernel_oracle/index.ts +++ b/yarn-project/pxe/src/kernel_oracle/index.ts @@ -12,7 +12,7 @@ import { computeContractClassIdPreimage, computeSaltedInitializationHash, } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type Tuple } from '@aztec/foundation/serialize'; import { type KeyStore } from '@aztec/key-store'; import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types'; @@ -31,7 +31,7 @@ export class KernelOracle implements ProvingDataOracle { private keyStore: KeyStore, private node: AztecNode, private blockNumber: L2BlockNumber = 'latest', - private log = createDebugLogger('aztec:pxe:kernel_oracle'), + private log = createLogger('pxe:kernel_oracle'), ) {} public async getContractAddressPreimage(address: AztecAddress) { diff --git a/yarn-project/pxe/src/kernel_prover/kernel_prover.ts b/yarn-project/pxe/src/kernel_prover/kernel_prover.ts index 0a9490264145..4bb018a75b3b 100644 --- a/yarn-project/pxe/src/kernel_prover/kernel_prover.ts +++ b/yarn-project/pxe/src/kernel_prover/kernel_prover.ts @@ -26,7 +26,7 @@ import { import { hashVK } from '@aztec/circuits.js/hash'; import { makeTuple } from '@aztec/foundation/array'; import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { assertLength } from '@aztec/foundation/serialize'; import { pushTestData } from '@aztec/foundation/testing'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types'; @@ -55,7 +55,7 @@ const NULL_PROVE_OUTPUT: PrivateKernelSimulateOutput { return Promise.resolve(ClientIvcProof.empty()); diff --git a/yarn-project/pxe/src/pxe_service/create_pxe_service.ts b/yarn-project/pxe/src/pxe_service/create_pxe_service.ts index a3bdd43b105d..b477aa84e52b 100644 --- a/yarn-project/pxe/src/pxe_service/create_pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/create_pxe_service.ts @@ -1,7 +1,7 @@ import { BBNativePrivateKernelProver } from '@aztec/bb-prover'; import { type AztecNode, type PrivateKernelProver } from '@aztec/circuit-types'; import { randomBytes } from '@aztec/foundation/crypto'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { KeyStore } from '@aztec/key-store'; import { L2TipsStore } from '@aztec/kv-store/stores'; import { createStore } from '@aztec/kv-store/utils'; @@ -38,10 +38,10 @@ export async function createPXEService( } as PXEServiceConfig; const keyStore = new KeyStore( - await createStore('pxe_key_store', configWithContracts, createDebugLogger('aztec:pxe:keystore:lmdb')), + await createStore('pxe_key_store', configWithContracts, createLogger('pxe:keystore:lmdb')), ); - const store = await createStore('pxe_data', configWithContracts, createDebugLogger('aztec:pxe:data:lmdb')); + const store = await createStore('pxe_data', configWithContracts, createLogger('pxe:data:lmdb')); const db = new KVPxeDatabase(store); const tips = new L2TipsStore(store, 'pxe'); @@ -62,6 +62,6 @@ function createProver(config: PXEServiceConfig, logSuffix?: string) { throw new Error(`Prover must be configured with binary path and working directory`); } const bbConfig = config as Required> & PXEServiceConfig; - const log = createDebugLogger('aztec:pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : '')); + const log = createLogger('pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : '')); return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, log); } diff --git a/yarn-project/pxe/src/pxe_service/error_enriching.ts b/yarn-project/pxe/src/pxe_service/error_enriching.ts index 938d391ada77..45e07fcb8641 100644 --- a/yarn-project/pxe/src/pxe_service/error_enriching.ts +++ b/yarn-project/pxe/src/pxe_service/error_enriching.ts @@ -1,6 +1,6 @@ import { type SimulationError, isNoirCallStackUnresolved } from '@aztec/circuit-types'; import { AztecAddress, Fr, FunctionSelector, PUBLIC_DISPATCH_SELECTOR } from '@aztec/circuits.js'; -import { type DebugLogger } from '@aztec/foundation/log'; +import { type Logger } from '@aztec/foundation/log'; import { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '@aztec/simulator'; import { type ContractDataOracle, type PxeDatabase } from '../index.js'; @@ -10,7 +10,7 @@ import { type ContractDataOracle, type PxeDatabase } from '../index.js'; * can be found in the PXE database * @param err - The error to enrich. */ -export async function enrichSimulationError(err: SimulationError, db: PxeDatabase, logger: DebugLogger) { +export async function enrichSimulationError(err: SimulationError, db: PxeDatabase, logger: Logger) { // Maps contract addresses to the set of functions selectors that were in error. // Map and Set do reference equality for their keys instead of value equality, so we store the string // representation to get e.g. different contract address objects with the same address value to match. @@ -56,7 +56,7 @@ export async function enrichPublicSimulationError( err: SimulationError, contractDataOracle: ContractDataOracle, db: PxeDatabase, - logger: DebugLogger, + logger: Logger, ) { const callStack = err.getCallStack(); const originalFailingFunction = callStack[callStack.length - 1]; diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index eadab26de2d7..1bc6a9cd047e 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -56,7 +56,7 @@ import { encodeArguments, } from '@aztec/foundation/abi'; import { Fr, type Point } from '@aztec/foundation/fields'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { type KeyStore } from '@aztec/key-store'; import { type L2TipsStore } from '@aztec/kv-store/stores'; @@ -87,7 +87,7 @@ export class PXEService implements PXE { private synchronizer: Synchronizer; private contractDataOracle: ContractDataOracle; private simulator: AcirSimulator; - private log: DebugLogger; + private log: Logger; private packageVersion: string; // serialize synchronizer and calls to proveTx. // ensures that state is not changed while simulating @@ -102,7 +102,7 @@ export class PXEService implements PXE { config: PXEServiceConfig, logSuffix?: string, ) { - this.log = createDebugLogger(logSuffix ? `aztec:pxe_service_${logSuffix}` : `aztec:pxe_service`); + this.log = createLogger(logSuffix ? `pxe:service:${logSuffix}` : `pxe:service`); this.synchronizer = new Synchronizer(node, db, tipsStore, config, logSuffix); this.contractDataOracle = new ContractDataOracle(db); this.simulator = getAcirSimulator(db, node, keyStore, this.contractDataOracle); diff --git a/yarn-project/pxe/src/simulator_oracle/index.ts b/yarn-project/pxe/src/simulator_oracle/index.ts index 4a18b6bf7581..ff7df0b2d237 100644 --- a/yarn-project/pxe/src/simulator_oracle/index.ts +++ b/yarn-project/pxe/src/simulator_oracle/index.ts @@ -29,7 +29,7 @@ import { import { type FunctionArtifact, getFunctionArtifact } from '@aztec/foundation/abi'; import { poseidon2Hash } from '@aztec/foundation/crypto'; import { tryJsonStringify } from '@aztec/foundation/json-rpc'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type KeyStore } from '@aztec/key-store'; import { type AcirSimulator, type DBOracle, MessageLoadOracleInputs } from '@aztec/simulator'; @@ -49,7 +49,7 @@ export class SimulatorOracle implements DBOracle { private db: PxeDatabase, private keyStore: KeyStore, private aztecNode: AztecNode, - private log = createDebugLogger('aztec:pxe:simulator_oracle'), + private log = createLogger('pxe:simulator_oracle'), ) {} getKeyValidationRequest(pkMHash: Fr, contractAddress: AztecAddress): Promise { diff --git a/yarn-project/pxe/src/synchronizer/synchronizer.ts b/yarn-project/pxe/src/synchronizer/synchronizer.ts index d527a38b5357..e85b3eba8b89 100644 --- a/yarn-project/pxe/src/synchronizer/synchronizer.ts +++ b/yarn-project/pxe/src/synchronizer/synchronizer.ts @@ -5,7 +5,7 @@ import { type L2BlockStreamEventHandler, } from '@aztec/circuit-types'; import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type L2TipsStore } from '@aztec/kv-store/stores'; import { type PXEConfig } from '../config/index.js'; @@ -21,7 +21,7 @@ import { type PxeDatabase } from '../database/index.js'; export class Synchronizer implements L2BlockStreamEventHandler { private running = false; private initialSyncBlockNumber = INITIAL_L2_BLOCK_NUM - 1; - private log: DebugLogger; + private log: Logger; protected readonly blockStream: L2BlockStream; constructor( @@ -31,7 +31,7 @@ export class Synchronizer implements L2BlockStreamEventHandler { config: Partial> = {}, logSuffix?: string, ) { - this.log = createDebugLogger(logSuffix ? `aztec:pxe_synchronizer_${logSuffix}` : 'aztec:pxe_synchronizer'); + this.log = createLogger(logSuffix ? `pxe:synchronizer:${logSuffix}` : 'pxe:synchronizer'); this.blockStream = this.createBlockStream(config); } diff --git a/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts b/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts index ecd911cc97f5..47548a285260 100644 --- a/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts +++ b/yarn-project/sequencer-client/src/global_variable_builder/global_builder.ts @@ -2,7 +2,7 @@ import { type GlobalVariableBuilder as GlobalVariableBuilderInterface } from '@a import { type AztecAddress, type EthAddress, GasFees, GlobalVariables } from '@aztec/circuits.js'; import { type L1ContractsConfig, type L1ReaderConfig, createEthereumChain } from '@aztec/ethereum'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RollupAbi } from '@aztec/l1-artifacts'; import { @@ -20,7 +20,7 @@ import type * as chains from 'viem/chains'; * Simple global variables builder. */ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface { - private log = createDebugLogger('aztec:sequencer:global_variable_builder'); + private log = createLogger('sequencer:global_variable_builder'); private rollupContract: GetContractReturnType>; private publicClient: PublicClient; @@ -103,7 +103,7 @@ export class GlobalVariableBuilder implements GlobalVariableBuilderInterface { feeRecipient, gasFees, ); - this.log.debug(`Built global variables for block ${blockNumber}`, globalVariables.toFriendlyJSON()); + return globalVariables; } } diff --git a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts index d7e139d4dde1..b2ab42bfcba1 100644 --- a/yarn-project/sequencer-client/src/publisher/l1-publisher.ts +++ b/yarn-project/sequencer-client/src/publisher/l1-publisher.ts @@ -28,7 +28,7 @@ import { makeTuple } from '@aztec/foundation/array'; import { areArraysEqual, compactArray, times } from '@aztec/foundation/collection'; import { type Signature } from '@aztec/foundation/eth-signature'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type Tuple, serializeToBuffer } from '@aztec/foundation/serialize'; import { InterruptibleSleep } from '@aztec/foundation/sleep'; import { Timer } from '@aztec/foundation/timer'; @@ -149,7 +149,8 @@ export class L1Publisher { private payload: EthAddress = EthAddress.ZERO; private myLastVote: bigint = 0n; - protected log = createDebugLogger('aztec:sequencer:publisher'); + protected log = createLogger('sequencer:publisher'); + protected governanceLog = createLogger('sequencer:publisher:governance'); protected rollupContract: GetContractReturnType< typeof RollupAbi, @@ -338,7 +339,7 @@ export class L1Publisher { await this.rollupContract.read.validateEpochProofRightClaimAtTime(args, { account: this.account }); } catch (err) { const errorName = tryGetCustomErrorName(err); - this.log.warn(`Proof quote validation failed: ${errorName}`); + this.log.warn(`Proof quote validation failed: ${errorName}`, quote); return undefined; } return quote; @@ -428,7 +429,7 @@ export class L1Publisher { this.governanceProposerContract.read.computeRound([slotNumber]), ]); - if (proposer != this.account.address) { + if (proposer.toLowerCase() !== this.account.address.toLowerCase()) { return false; } @@ -446,14 +447,14 @@ export class L1Publisher { const cachedMyLastVote = this.myLastVote; this.myLastVote = slotNumber; + this.governanceLog.verbose(`Casting vote for ${this.payload}`); + let txHash; try { - txHash = await this.governanceProposerContract.write.vote([this.payload.toString()], { - account: this.account, - }); + txHash = await this.governanceProposerContract.write.vote([this.payload.toString()], { account: this.account }); } catch (err) { const msg = prettyLogViemErrorMsg(err); - this.log.error(`Governance: Failed to vote`, msg); + this.governanceLog.error(`Failed to vote`, msg); this.myLastVote = cachedMyLastVote; return false; } @@ -461,14 +462,13 @@ export class L1Publisher { if (txHash) { const receipt = await this.getTransactionReceipt(txHash); if (!receipt) { - this.log.info(`Failed to get receipt for tx ${txHash}`); + this.governanceLog.warn(`Failed to get receipt for tx ${txHash}`); this.myLastVote = cachedMyLastVote; return false; } } - this.log.info(`Governance: Cast vote for ${this.payload}`); - + this.governanceLog.info(`Cast vote for ${this.payload}`); return true; } @@ -518,7 +518,7 @@ export class L1Publisher { signatures: attestations ?? [], }); - this.log.verbose(`Submitting propose transaction`); + this.log.debug(`Submitting propose transaction`); const result = proofQuote ? await this.sendProposeAndClaimTx(proposeTxArgs, proofQuote) : await this.sendProposeTx(proposeTxArgs); @@ -541,7 +541,7 @@ export class L1Publisher { ...block.getStats(), eventName: 'rollup-published-to-l1', }; - this.log.info(`Published L2 block to L1 rollup contract`, { ...stats, ...ctx }); + this.log.verbose(`Published L2 block to L1 rollup contract`, { ...stats, ...ctx }); this.metrics.recordProcessBlockTx(timer.ms(), stats); return true; } @@ -839,8 +839,7 @@ export class L1Publisher { }; } catch (err) { prettyLogViemError(err, this.log); - const errorMessage = err instanceof Error ? err.message : String(err); - this.log.error(`Rollup publish failed`, errorMessage); + this.log.error(`Rollup publish failed`, err); return undefined; } } diff --git a/yarn-project/sequencer-client/src/publisher/utils.ts b/yarn-project/sequencer-client/src/publisher/utils.ts index ad2177019c11..26f68eebdac6 100644 --- a/yarn-project/sequencer-client/src/publisher/utils.ts +++ b/yarn-project/sequencer-client/src/publisher/utils.ts @@ -14,6 +14,7 @@ export function prettyLogViemErrorMsg(err: any) { } } +// TODO(palla/log): Review this method export function prettyLogViemError(err: any, logger: Logger) { const msg = prettyLogViemErrorMsg(err); if (msg) { diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index 325a2dd2d44a..bd8bbb5e7f59 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -4,6 +4,7 @@ import { type L2Block, type L2BlockSource, type ProcessedTx, + SequencerConfigSchema, Tx, type TxHash, type TxValidator, @@ -20,10 +21,12 @@ import { StateReference, } from '@aztec/circuits.js'; import { AztecAddress } from '@aztec/foundation/aztec-address'; +import { omit } from '@aztec/foundation/collection'; import { EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { RunningPromise } from '@aztec/foundation/running-promise'; +import { pickFromSchema } from '@aztec/foundation/schemas'; import { Timer, elapsed } from '@aztec/foundation/timer'; import { type P2P } from '@aztec/p2p'; import { type BlockBuilderFactory } from '@aztec/prover-client/block-builder'; @@ -31,8 +34,6 @@ import { type PublicProcessorFactory } from '@aztec/simulator'; import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client'; import { type ValidatorClient } from '@aztec/validator-client'; -import { inspect } from 'util'; - import { type GlobalVariableBuilder } from '../global_variable_builder/global_builder.js'; import { type L1Publisher } from '../publisher/l1-publisher.js'; import { prettyLogViemErrorMsg } from '../publisher/utils.js'; @@ -108,11 +109,10 @@ export class Sequencer { private aztecSlotDuration: number, telemetry: TelemetryClient, private config: SequencerConfig = {}, - private log = createDebugLogger('aztec:sequencer'), + private log = createLogger('sequencer'), ) { this.updateConfig(config); this.metrics = new SequencerMetrics(telemetry, () => this.state, 'Sequencer'); - this.log.verbose(`Initialized sequencer with ${this.minTxsPerBLock}-${this.maxTxsPerBlock} txs per block.`); // Register the block builder with the validator client for re-execution this.validatorClient?.registerBlockBuilder(this.buildBlock.bind(this)); @@ -127,6 +127,11 @@ export class Sequencer { * @param config - New parameters. */ public updateConfig(config: SequencerConfig) { + this.log.info( + `Sequencer config set`, + omit(pickFromSchema(this.config, SequencerConfigSchema), 'allowedInSetup', 'allowedInTeardown'), + ); + if (config.transactionPollingIntervalMS !== undefined) { this.pollingIntervalMs = config.transactionPollingIntervalMS; } @@ -188,9 +193,9 @@ export class Sequencer { */ public start() { this.runningPromise = new RunningPromise(this.work.bind(this), this.pollingIntervalMs); - this.runningPromise.start(); this.setState(SequencerState.IDLE, 0n, true /** force */); - this.log.info('Sequencer started'); + this.runningPromise.start(); + this.log.info(`Sequencer started`); return Promise.resolve(); } @@ -237,12 +242,9 @@ export class Sequencer { const prevBlockSynced = await this.isBlockSynced(); // Do not go forward with new block if the previous one has not been mined and processed if (!prevBlockSynced) { - this.log.debug('Previous block has not been mined and processed yet'); return; } - this.log.debug('Previous block has been mined and processed'); - this.setState(SequencerState.PROPOSER_CHECK, 0n); const chainTip = await this.l2BlockSource.getBlock(-1); @@ -278,6 +280,12 @@ export class Sequencer { return; } + this.log.verbose(`Preparing proposal for block ${newBlockNumber} at slot ${slot}`, { + chainTipArchive: new Fr(chainTipArchive), + blockNumber: newBlockNumber, + slot, + }); + this.setState(SequencerState.WAITING_FOR_TXS, slot); // Get txs to build the new block. @@ -286,7 +294,11 @@ export class Sequencer { if (!this.shouldProposeBlock(historicalHeader, { pendingTxsCount: pendingTxs.length })) { return; } - this.log.debug(`Retrieved ${pendingTxs.length} txs from P2P pool`); + + this.log.verbose( + `Retrieved ${pendingTxs.length} txs for block ${newBlockNumber} with global variables`, + newGlobalVariables.toInspect(), + ); // If I created a "partial" header here that should make our job much easier. const proposalHeader = new Header( @@ -322,7 +334,7 @@ export class Sequencer { // be in for a world of pain. await this.buildBlockAndAttemptToPublish(validTxs, proposalHeader, historicalHeader); } catch (err) { - this.log.error(`Error assembling block`, (err as any).stack); + this.log.error(`Error assembling block`, err, { blockNumber: newBlockNumber, slot }); } this.setState(SequencerState.IDLE, 0n); } @@ -357,16 +369,14 @@ export class Sequencer { const [slot, blockNumber] = await this.publisher.canProposeAtNextEthBlock(tipArchive); if (proposalBlockNumber !== blockNumber) { - const msg = `Block number mismatch. Expected ${proposalBlockNumber} but got ${blockNumber}`; - this.log.debug(msg); + const msg = `Sequencer block number mismatch. Expected ${proposalBlockNumber} but got ${blockNumber}.`; + this.log.warn(msg); throw new Error(msg); } - - this.log.verbose(`Can propose block ${proposalBlockNumber} at slot ${slot}`); return slot; } catch (err) { const msg = prettyLogViemErrorMsg(err); - this.log.verbose( + this.log.debug( `Rejected from being able to propose at next block with ${tipArchive.toString('hex')}: ${msg ? `${msg}` : ''}`, ); throw err; @@ -408,15 +418,14 @@ export class Sequencer { */ setState(proposedState: SequencerState, currentSlotNumber: bigint, force: boolean = false) { if (this.state === SequencerState.STOPPED && force !== true) { - this.log.warn( - `Cannot set sequencer from ${this.state} to ${proposedState} as it is stopped. Set force=true to override.`, - ); + this.log.warn(`Cannot set sequencer from ${this.state} to ${proposedState} as it is stopped.`); return; } const secondsIntoSlot = getSecondsIntoSlot(this.l1GenesisTime, this.aztecSlotDuration, Number(currentSlotNumber)); if (!this.doIHaveEnoughTimeLeft(proposedState, secondsIntoSlot)) { throw new SequencerTooSlowError(this.state, proposedState, this.timeTable[proposedState], secondsIntoSlot); } + this.log.debug(`Transitioning from ${this.state} to ${proposedState}`); this.state = proposedState; } @@ -437,7 +446,7 @@ export class Sequencer { // If we haven't hit the maxSecondsBetweenBlocks, we need to have at least minTxsPerBLock txs. // Do not go forward with new block if not enough time has passed since last block if (this.minSecondsBetweenBlocks > 0 && elapsedSinceLastBlock < this.minSecondsBetweenBlocks) { - this.log.debug( + this.log.verbose( `Not creating block because not enough time ${this.minSecondsBetweenBlocks} has passed since last block`, ); return false; @@ -453,7 +462,7 @@ export class Sequencer { `Creating block with only ${args.pendingTxsCount} txs as more than ${this.maxSecondsBetweenBlocks}s have passed since last block`, ); } else { - this.log.debug( + this.log.verbose( `Not creating block because not enough txs in the pool (got ${args.pendingTxsCount} min ${this.minTxsPerBLock})`, ); return false; @@ -465,7 +474,7 @@ export class Sequencer { if (args.validTxsCount != undefined) { // Bail if we don't have enough valid txs if (!skipCheck && args.validTxsCount < this.minTxsPerBLock) { - this.log.debug( + this.log.verbose( `Not creating block because not enough valid txs loaded from the pool (got ${args.validTxsCount} min ${this.minTxsPerBLock})`, ); return false; @@ -478,7 +487,7 @@ export class Sequencer { // we should bail. if (args.processedTxsCount != undefined) { if (args.processedTxsCount === 0 && !skipCheck && this.minTxsPerBLock > 0) { - this.log.verbose('No txs processed correctly to build block. Exiting'); + this.log.verbose('No txs processed correctly to build block.'); return false; } } @@ -502,18 +511,25 @@ export class Sequencer { historicalHeader?: Header, interrupt?: (processedTxs: ProcessedTx[]) => Promise, ) { - this.log.debug('Requesting L1 to L2 messages from contract'); - const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(newGlobalVariables.blockNumber.toBigInt()); - this.log.verbose( - `Retrieved ${l1ToL2Messages.length} L1 to L2 messages for block ${newGlobalVariables.blockNumber.toNumber()}`, - ); + const blockNumber = newGlobalVariables.blockNumber.toBigInt(); + const slot = newGlobalVariables.slotNumber.toBigInt(); + + this.log.debug(`Requesting L1 to L2 messages from contract for block ${blockNumber}`); + const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber); + + this.log.verbose(`Building block ${blockNumber}`, { + msgCount: l1ToL2Messages.length, + txCount: validTxs.length, + slot, + blockNumber, + }); const numRealTxs = validTxs.length; const blockSize = Math.max(2, numRealTxs); // Sync to the previous block at least await this.worldState.syncImmediate(newGlobalVariables.blockNumber.toNumber() - 1); - this.log.verbose(`Synced to previous block ${newGlobalVariables.blockNumber.toNumber() - 1}`); + this.log.debug(`Synced to previous block ${newGlobalVariables.blockNumber.toNumber() - 1}`); // NB: separating the dbs because both should update the state const publicProcessorFork = await this.worldState.fork(); @@ -535,7 +551,7 @@ export class Sequencer { ); if (failedTxs.length > 0) { const failedTxData = failedTxs.map(fail => fail.tx); - this.log.debug(`Dropping failed txs ${Tx.getHashes(failedTxData).join(', ')}`); + this.log.verbose(`Dropping failed txs ${Tx.getHashes(failedTxData).join(', ')}`); await this.p2pClient.deleteTxs(Tx.getHashes(failedTxData)); } @@ -573,15 +589,12 @@ export class Sequencer { await this.publisher.validateBlockForSubmission(proposalHeader); const newGlobalVariables = proposalHeader.globalVariables; + const blockNumber = newGlobalVariables.blockNumber.toNumber(); + const slot = newGlobalVariables.slotNumber.toBigInt(); - this.metrics.recordNewBlock(newGlobalVariables.blockNumber.toNumber(), validTxs.length); + this.metrics.recordNewBlock(blockNumber, validTxs.length); const workTimer = new Timer(); - this.setState(SequencerState.CREATING_BLOCK, newGlobalVariables.slotNumber.toBigInt()); - this.log.info( - `Building blockNumber=${newGlobalVariables.blockNumber.toNumber()} txCount=${ - validTxs.length - } slotNumber=${newGlobalVariables.slotNumber.toNumber()}`, - ); + this.setState(SequencerState.CREATING_BLOCK, slot); /** * BuildBlock is shared between the sequencer and the validator for re-execution @@ -617,43 +630,48 @@ export class Sequencer { await this.publisher.validateBlockForSubmission(block.header); const workDuration = workTimer.ms(); - this.log.info( - `Assembled block ${block.number} (txEffectsHash: ${block.header.contentCommitment.txsEffectsHash.toString( - 'hex', - )})`, - { - eventName: 'l2-block-built', - creator: this.publisher.getSenderAddress().toString(), - duration: workDuration, - publicProcessDuration: publicProcessorDuration, - rollupCircuitsDuration: blockBuildingTimer.ms(), - ...block.getStats(), - } satisfies L2BlockBuiltStats, - ); + const blockStats: L2BlockBuiltStats = { + eventName: 'l2-block-built', + creator: this.publisher.getSenderAddress().toString(), + duration: workDuration, + publicProcessDuration: publicProcessorDuration, + rollupCircuitsDuration: blockBuildingTimer.ms(), + ...block.getStats(), + }; + + this.log.verbose(`Built block ${block.number}`, { + txEffectsHash: block.header.contentCommitment.txsEffectsHash.toString('hex'), + ...blockStats, + }); if (this.isFlushing) { - this.log.info(`Flushing completed`); + this.log.verbose(`Flushing completed`); } const txHashes = validTxs.map(tx => tx.getTxHash()); this.isFlushing = false; - this.log.verbose('Collecting attestations'); + this.log.debug('Collecting attestations'); const stopCollectingAttestationsTimer = this.metrics.startCollectingAttestationsTimer(); const attestations = await this.collectAttestations(block, txHashes); - this.log.verbose('Attestations collected'); + this.log.verbose(`Collected ${attestations?.length ?? 0} attestations`); stopCollectingAttestationsTimer(); - this.log.verbose('Collecting proof quotes'); + this.log.debug('Collecting proof quotes'); const proofQuote = await this.createProofClaimForPreviousEpoch(newGlobalVariables.slotNumber.toBigInt()); - this.log.info(proofQuote ? `Using proof quote ${inspect(proofQuote.payload)}` : 'No proof quote available'); await this.publishL2Block(block, attestations, txHashes, proofQuote); this.metrics.recordPublishedBlock(workDuration); this.log.info( - `Submitted rollup block ${block.number} with ${numProcessedTxs} transactions duration=${Math.ceil( - workDuration, - )}ms (Submitter: ${this.publisher.getSenderAddress()})`, + `Published rollup block ${block.number} with ${numProcessedTxs} transactions in ${Math.ceil(workDuration)}ms`, + { + blockNumber: block.number, + blockHash: block.hash(), + slot, + txCount: numProcessedTxs, + duration: Math.ceil(workDuration), + submitter: this.publisher.getSenderAddress().toString(), + }, ); } catch (err) { this.metrics.recordFailedBlock(); @@ -674,11 +692,12 @@ export class Sequencer { protected async collectAttestations(block: L2Block, txHashes: TxHash[]): Promise { // TODO(https://github.com/AztecProtocol/aztec-packages/issues/7962): inefficient to have a round trip in here - this should be cached const committee = await this.publisher.getCurrentEpochCommittee(); - this.log.debug(`Attesting committee length ${committee.length}`); if (committee.length === 0) { - this.log.verbose(`Attesting committee length is 0, skipping`); + this.log.verbose(`Attesting committee length is 0`); return undefined; + } else { + this.log.debug(`Attesting committee length ${committee.length}`); } if (!this.validatorClient) { @@ -689,18 +708,17 @@ export class Sequencer { const numberOfRequiredAttestations = Math.floor((committee.length * 2) / 3) + 1; - this.log.info('Creating block proposal'); + this.log.debug('Creating block proposal'); const proposal = await this.validatorClient.createBlockProposal(block.header, block.archive.root, txHashes); const slotNumber = block.header.globalVariables.slotNumber.toBigInt(); this.setState(SequencerState.PUBLISHING_BLOCK_TO_PEERS, slotNumber); - this.log.info('Broadcasting block proposal to validators'); + this.log.debug('Broadcasting block proposal to validators'); this.validatorClient.broadcastBlockProposal(proposal); this.setState(SequencerState.WAITING_FOR_ATTESTATIONS, slotNumber); const attestations = await this.validatorClient.collectAttestations(proposal, numberOfRequiredAttestations); - this.log.info(`Collected attestations from validators, number of attestations: ${attestations.length}`); // note: the smart contract requires that the signatures are provided in the order of the committee return orderAttestations(attestations, committee); @@ -711,16 +729,17 @@ export class Sequencer { // Find out which epoch we are currently in const epochToProve = await this.publisher.getClaimableEpoch(); if (epochToProve === undefined) { - this.log.verbose(`No epoch to prove`); + this.log.debug(`No epoch to prove`); return undefined; } // Get quotes for the epoch to be proven const quotes = await this.p2pClient.getEpochProofQuotes(epochToProve); - this.log.info(`Retrieved ${quotes.length} quotes, slot: ${slotNumber}, epoch to prove: ${epochToProve}`); - for (const quote of quotes) { - this.log.verbose(inspect(quote.payload)); - } + this.log.verbose(`Retrieved ${quotes.length} quotes for slot ${slotNumber} epoch ${epochToProve}`, { + epochToProve, + slotNumber, + quotes: quotes.map(q => q.payload), + }); // ensure these quotes are still valid for the slot and have the contract validate them const validQuotesPromise = Promise.all( quotes.filter(x => x.payload.validUntilSlot >= slotNumber).map(x => this.publisher.validateProofQuote(x)), @@ -735,9 +754,11 @@ export class Sequencer { const sortedQuotes = validQuotes.sort( (a: EpochProofQuote, b: EpochProofQuote) => a.payload.basisPointFee - b.payload.basisPointFee, ); - return sortedQuotes[0]; + const quote = sortedQuotes[0]; + this.log.info(`Selected proof quote for proof claim`, quote.payload); + return quote; } catch (err) { - this.log.error(`Failed to create proof claim for previous epoch: ${err}`); + this.log.error(`Failed to create proof claim for previous epoch`, err, { slotNumber }); return undefined; } } @@ -782,7 +803,7 @@ export class Sequencer { for (const tx of txs) { const txSize = tx.getSize() - tx.clientIvcProof.clientIvcProofBuffer.length; if (totalSize + txSize > maxSize) { - this.log.warn( + this.log.debug( `Dropping tx ${tx.getTxHash()} with estimated size ${txSize} due to exceeding ${maxSize} block size limit (currently at ${totalSize})`, ); continue; @@ -819,7 +840,7 @@ export class Sequencer { p2p >= l2BlockSource.number && l1ToL2MessageSource >= l2BlockSource.number; - this.log.verbose(`Sequencer sync check ${result ? 'succeeded' : 'failed'}`, { + this.log.debug(`Sequencer sync check ${result ? 'succeeded' : 'failed'}`, { worldStateNumber: worldState.number, worldStateHash: worldState.hash, l2BlockSourceNumber: l2BlockSource.number, diff --git a/yarn-project/sequencer-client/src/tx_validator/gas_validator.ts b/yarn-project/sequencer-client/src/tx_validator/gas_validator.ts index 58d92c7ce1a7..19ba9c2a79ef 100644 --- a/yarn-project/sequencer-client/src/tx_validator/gas_validator.ts +++ b/yarn-project/sequencer-client/src/tx_validator/gas_validator.ts @@ -1,6 +1,6 @@ import { type Tx, TxExecutionPhase, type TxValidator } from '@aztec/circuit-types'; import { type AztecAddress, type Fr, FunctionSelector } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { computeFeePayerBalanceStorageSlot, getExecutionRequestsByPhase } from '@aztec/simulator'; /** Provides a view into public contract state */ @@ -9,7 +9,7 @@ export interface PublicStateSource { } export class GasTxValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:tx_gas'); + #log = createLogger('sequencer:tx_validator:tx_gas'); #publicDataSource: PublicStateSource; #feeJuiceAddress: AztecAddress; diff --git a/yarn-project/sequencer-client/src/tx_validator/phases_validator.ts b/yarn-project/sequencer-client/src/tx_validator/phases_validator.ts index 4474b198afa2..d21b136a8284 100644 --- a/yarn-project/sequencer-client/src/tx_validator/phases_validator.ts +++ b/yarn-project/sequencer-client/src/tx_validator/phases_validator.ts @@ -6,11 +6,11 @@ import { type TxValidator, } from '@aztec/circuit-types'; import { type ContractDataSource } from '@aztec/circuits.js'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { ContractsDataSourcePublicDB, getExecutionRequestsByPhase } from '@aztec/simulator'; export class PhasesTxValidator implements TxValidator { - #log = createDebugLogger('aztec:sequencer:tx_validator:tx_phases'); + #log = createLogger('sequencer:tx_validator:tx_phases'); private contractDataSource: ContractsDataSourcePublicDB; constructor(contracts: ContractDataSource, private setupAllowList: AllowedElement[]) { diff --git a/yarn-project/simulator/src/acvm/acvm.ts b/yarn-project/simulator/src/acvm/acvm.ts index dce850d220ba..600c4c7a8e54 100644 --- a/yarn-project/simulator/src/acvm/acvm.ts +++ b/yarn-project/simulator/src/acvm/acvm.ts @@ -1,6 +1,6 @@ import { type NoirCallStack } from '@aztec/circuit-types'; import type { FunctionDebugMetadata } from '@aztec/foundation/abi'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type ExecutionError, @@ -42,7 +42,7 @@ export async function acvm( initialWitness: ACVMWitness, callback: ACIRCallback, ): Promise { - const logger = createDebugLogger('aztec:simulator:acvm'); + const logger = createLogger('simulator:acvm'); const solvedAndReturnWitness = await executeCircuitWithReturnWitness( acir, diff --git a/yarn-project/simulator/src/avm/avm_memory_types.ts b/yarn-project/simulator/src/avm/avm_memory_types.ts index 3acd31600830..bc9aa66e4685 100644 --- a/yarn-project/simulator/src/avm/avm_memory_types.ts +++ b/yarn-project/simulator/src/avm/avm_memory_types.ts @@ -10,7 +10,7 @@ import { import { AztecAddress } from '@aztec/foundation/aztec-address'; import { toBufferBE } from '@aztec/foundation/bigint-buffer'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type FunctionsOf } from '@aztec/foundation/types'; import { strict as assert } from 'assert'; @@ -227,7 +227,7 @@ export enum TypeTag { export type TaggedMemoryInterface = FunctionsOf; export class TaggedMemory implements TaggedMemoryInterface { - static readonly log: DebugLogger = createDebugLogger('aztec:avm_simulator:memory'); + static readonly log: Logger = createLogger('simulator:avm:memory'); // Whether to track and validate memory accesses for each instruction. static readonly TRACK_MEMORY_ACCESSES = process.env.NODE_ENV === 'test'; @@ -259,7 +259,7 @@ export class TaggedMemory implements TaggedMemoryInterface { public getAs(offset: number): T { assert(offset < TaggedMemory.MAX_MEMORY_SIZE); const word = this._mem[offset]; - TaggedMemory.log.debug(`get(${offset}) = ${word}`); + TaggedMemory.log.trace(`get(${offset}) = ${word}`); if (word === undefined) { TaggedMemory.log.debug(`WARNING: Memory at offset ${offset} is undefined!`); return new Field(0) as T; @@ -270,7 +270,7 @@ export class TaggedMemory implements TaggedMemoryInterface { public getSlice(offset: number, size: number): MemoryValue[] { assert(offset + size <= TaggedMemory.MAX_MEMORY_SIZE); const value = this._mem.slice(offset, offset + size); - TaggedMemory.log.debug(`getSlice(${offset}, ${size}) = ${value}`); + TaggedMemory.log.trace(`getSlice(${offset}, ${size}) = ${value}`); for (let i = 0; i < value.length; i++) { if (value[i] === undefined) { value[i] = new Field(0); @@ -293,7 +293,7 @@ export class TaggedMemory implements TaggedMemoryInterface { public set(offset: number, v: MemoryValue) { assert(offset < TaggedMemory.MAX_MEMORY_SIZE); this._mem[offset] = v; - TaggedMemory.log.debug(`set(${offset}, ${v})`); + TaggedMemory.log.trace(`set(${offset}, ${v})`); } public setSlice(offset: number, vs: MemoryValue[]) { @@ -303,7 +303,7 @@ export class TaggedMemory implements TaggedMemoryInterface { this._mem.length = offset + vs.length; } this._mem.splice(offset, vs.length, ...vs); - TaggedMemory.log.debug(`setSlice(${offset}, ${vs})`); + TaggedMemory.log.trace(`setSlice(${offset}, ${vs})`); } public getTag(offset: number): TypeTag { diff --git a/yarn-project/simulator/src/avm/avm_simulator.ts b/yarn-project/simulator/src/avm/avm_simulator.ts index 643fae72da0c..528347f6a9a4 100644 --- a/yarn-project/simulator/src/avm/avm_simulator.ts +++ b/yarn-project/simulator/src/avm/avm_simulator.ts @@ -5,7 +5,7 @@ import { type GlobalVariables, MAX_L2_GAS_PER_ENQUEUED_CALL, } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { strict as assert } from 'assert'; @@ -41,7 +41,7 @@ type PcTally = { }; export class AvmSimulator { - private log: DebugLogger; + private log: Logger; private bytecode: Buffer | undefined; private opcodeTallies: Map = new Map(); private pcTallies: Map = new Map(); @@ -54,8 +54,9 @@ export class AvmSimulator { context.machineState.gasLeft.l2Gas <= MAX_L2_GAS_PER_ENQUEUED_CALL, `Cannot allocate more than ${MAX_L2_GAS_PER_ENQUEUED_CALL} to the AVM for execution of an enqueued call`, ); - this.log = createDebugLogger(`aztec:avm_simulator:core(f:${context.environment.functionSelector.toString()})`); - if (process.env.LOG_LEVEL === 'debug') { + this.log = createLogger(`simulator:avm:core(f:${context.environment.functionSelector.toString()})`); + // TODO(palla/log): Should tallies be printed on debug, or only on trace? + if (this.log.isLevelEnabled('debug')) { this.tallyPrintFunction = this.printOpcodeTallies; this.tallyInstructionFunction = this.tallyInstruction; } @@ -144,7 +145,7 @@ export class AvmSimulator { const instrStartGas = machineState.gasLeft; // Save gas before executing instruction (for profiling) const instrPc = machineState.pc; // Save PC before executing instruction (for profiling) - this.log.debug( + this.log.trace( `[PC:${machineState.pc}] [IC:${instrCounter++}] ${instruction.toString()} (gasLeft l2=${ machineState.l2GasLeft } da=${machineState.daGasLeft})`, @@ -185,7 +186,7 @@ export class AvmSimulator { } catch (err: any) { this.log.verbose('Exceptional halt (revert by something other than REVERT opcode)'); if (!(err instanceof AvmExecutionError || err instanceof SideEffectLimitReachedError)) { - this.log.verbose(`Unknown error thrown by AVM: ${err}`); + this.log.error(`Unknown error thrown by AVM: ${err}`); throw err; } diff --git a/yarn-project/simulator/src/avm/journal/journal.ts b/yarn-project/simulator/src/avm/journal/journal.ts index 63dbf59f09e8..b24e39ab050a 100644 --- a/yarn-project/simulator/src/avm/journal/journal.ts +++ b/yarn-project/simulator/src/avm/journal/journal.ts @@ -10,7 +10,7 @@ import { import { computePublicDataTreeLeafSlot, siloNoteHash, siloNullifier } from '@aztec/circuits.js/hash'; import { Fr } from '@aztec/foundation/fields'; import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { strict as assert } from 'assert'; @@ -33,7 +33,7 @@ import { PublicStorage } from './public_storage.js'; * Manages merging of successful/reverted child state into current state. */ export class AvmPersistableStateManager { - private readonly log = createDebugLogger('aztec:avm_simulator:state_manager'); + private readonly log = createLogger('simulator:avm:state_manager'); /** Make sure a forked state is never merged twice. */ private alreadyMergedIntoParent = false; diff --git a/yarn-project/simulator/src/avm/opcodes/misc.ts b/yarn-project/simulator/src/avm/opcodes/misc.ts index 199fa47f9888..13b348588d86 100644 --- a/yarn-project/simulator/src/avm/opcodes/misc.ts +++ b/yarn-project/simulator/src/avm/opcodes/misc.ts @@ -1,4 +1,4 @@ -import { applyStringFormatting, createDebugLogger } from '@aztec/foundation/log'; +import { applyStringFormatting, createLogger } from '@aztec/foundation/log'; import { type AvmContext } from '../avm_context.js'; import { TypeTag } from '../avm_memory_types.js'; @@ -9,7 +9,7 @@ import { Instruction } from './instruction.js'; export class DebugLog extends Instruction { static type: string = 'DEBUGLOG'; static readonly opcode: Opcode = Opcode.DEBUGLOG; - static readonly logger = createDebugLogger('aztec:avm_simulator:debug_log'); + static readonly logger = createLogger('simulator:avm:debug_log'); // Informs (de)serialization. See Instruction.deserialize. static readonly wireFormat: OperandType[] = [ diff --git a/yarn-project/simulator/src/client/client_execution_context.ts b/yarn-project/simulator/src/client/client_execution_context.ts index 0d7b8d4a122f..c4e63ffd1300 100644 --- a/yarn-project/simulator/src/client/client_execution_context.ts +++ b/yarn-project/simulator/src/client/client_execution_context.ts @@ -23,7 +23,7 @@ import { computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash'; import { type FunctionAbi, type FunctionArtifact, type NoteSelector, countArgumentsSize } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; -import { applyStringFormatting, createDebugLogger } from '@aztec/foundation/log'; +import { applyStringFormatting, createLogger } from '@aztec/foundation/log'; import { type NoteData, toACVMWitness } from '../acvm/index.js'; import { type PackedValuesCache } from '../common/packed_values_cache.js'; @@ -74,7 +74,7 @@ export class ClientExecutionContext extends ViewDataOracle { db: DBOracle, private node: AztecNode, protected sideEffectCounter: number = 0, - log = createDebugLogger('aztec:simulator:client_execution_context'), + log = createLogger('simulator:client_execution_context'), scopes?: AztecAddress[], ) { super(callContext.contractAddress, authWitnesses, db, node, log, scopes); diff --git a/yarn-project/simulator/src/client/private_execution.test.ts b/yarn-project/simulator/src/client/private_execution.test.ts index 815f48c36bba..5c4b8af8212b 100644 --- a/yarn-project/simulator/src/client/private_execution.test.ts +++ b/yarn-project/simulator/src/client/private_execution.test.ts @@ -52,7 +52,7 @@ import { times } from '@aztec/foundation/collection'; import { poseidon2Hash, poseidon2HashWithSeparator, randomInt } from '@aztec/foundation/crypto'; import { EthAddress } from '@aztec/foundation/eth-address'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type FieldsOf } from '@aztec/foundation/types'; import { openTmpStore } from '@aztec/kv-store/utils'; import { type AppendOnlyTree, Poseidon, StandardTree, newTree } from '@aztec/merkle-tree'; @@ -83,7 +83,7 @@ describe('Private Execution test suite', () => { let acirSimulator: AcirSimulator; let header = Header.empty(); - let logger: DebugLogger; + let logger: Logger; const defaultContractAddress = AztecAddress.random(); const ownerSk = Fr.fromString('2dcc5485a58316776299be08c78fa3788a1a7961ae30dc747fb1be17692a8d32'); @@ -184,7 +184,7 @@ describe('Private Execution test suite', () => { }; beforeAll(() => { - logger = createDebugLogger('aztec:test:private_execution'); + logger = createLogger('simulator:test:private_execution'); const ownerPartialAddress = Fr.random(); ownerCompleteAddress = CompleteAddress.fromSecretKeyAndPartialAddress(ownerSk, ownerPartialAddress); diff --git a/yarn-project/simulator/src/client/private_execution.ts b/yarn-project/simulator/src/client/private_execution.ts index ed25d5bf4c09..300141672a73 100644 --- a/yarn-project/simulator/src/client/private_execution.ts +++ b/yarn-project/simulator/src/client/private_execution.ts @@ -8,7 +8,7 @@ import { } from '@aztec/circuits.js'; import { type FunctionArtifact, type FunctionSelector, countArgumentsSize } from '@aztec/foundation/abi'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { fromACVMField, witnessMapToFields } from '../acvm/deserialize.js'; @@ -24,7 +24,7 @@ export async function executePrivateFunction( artifact: FunctionArtifact, contractAddress: AztecAddress, functionSelector: FunctionSelector, - log = createDebugLogger('aztec:simulator:private_execution'), + log = createLogger('simulator:private_execution'), ): Promise { const functionName = await context.getDebugFunctionName(); log.verbose(`Executing external function ${functionName}@${contractAddress}`); diff --git a/yarn-project/simulator/src/client/simulator.ts b/yarn-project/simulator/src/client/simulator.ts index d434f75fa287..1d5cc66d1cc9 100644 --- a/yarn-project/simulator/src/client/simulator.ts +++ b/yarn-project/simulator/src/client/simulator.ts @@ -10,7 +10,7 @@ import { } from '@aztec/foundation/abi'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { createSimulationError } from '../common/errors.js'; import { PackedValuesCache } from '../common/packed_values_cache.js'; @@ -25,10 +25,10 @@ import { ViewDataOracle } from './view_data_oracle.js'; * The ACIR simulator. */ export class AcirSimulator { - private log: DebugLogger; + private log: Logger; constructor(private db: DBOracle, private node: AztecNode) { - this.log = createDebugLogger('aztec:simulator'); + this.log = createLogger('simulator'); } /** diff --git a/yarn-project/simulator/src/client/unconstrained_execution.ts b/yarn-project/simulator/src/client/unconstrained_execution.ts index 70e488434db4..b9066fd05002 100644 --- a/yarn-project/simulator/src/client/unconstrained_execution.ts +++ b/yarn-project/simulator/src/client/unconstrained_execution.ts @@ -1,7 +1,7 @@ import { type AbiDecoded, type FunctionArtifact, type FunctionSelector, decodeFromAbi } from '@aztec/foundation/abi'; import { type AztecAddress } from '@aztec/foundation/aztec-address'; import { type Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { witnessMapToFields } from '../acvm/deserialize.js'; import { Oracle, acvm, extractCallStack, toACVMWitness } from '../acvm/index.js'; @@ -18,7 +18,7 @@ export async function executeUnconstrainedFunction( contractAddress: AztecAddress, functionSelector: FunctionSelector, args: Fr[], - log = createDebugLogger('aztec:simulator:unconstrained_execution'), + log = createLogger('simulator:unconstrained_execution'), ): Promise { log.verbose(`Executing unconstrained function ${contractAddress}:${functionSelector}(${artifact.name})`); diff --git a/yarn-project/simulator/src/client/view_data_oracle.ts b/yarn-project/simulator/src/client/view_data_oracle.ts index bd5633f2103e..63b6c5e6ba43 100644 --- a/yarn-project/simulator/src/client/view_data_oracle.ts +++ b/yarn-project/simulator/src/client/view_data_oracle.ts @@ -16,7 +16,7 @@ import { import { siloNullifier } from '@aztec/circuits.js/hash'; import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; -import { applyStringFormatting, createDebugLogger } from '@aztec/foundation/log'; +import { applyStringFormatting, createLogger } from '@aztec/foundation/log'; import { type NoteData, TypedOracle } from '../acvm/index.js'; import { type DBOracle } from './db_oracle.js'; @@ -33,7 +33,7 @@ export class ViewDataOracle extends TypedOracle { protected readonly authWitnesses: AuthWitness[], protected readonly db: DBOracle, protected readonly aztecNode: AztecNode, - protected log = createDebugLogger('aztec:simulator:client_view_context'), + protected log = createLogger('simulator:client_view_context'), protected readonly scopes?: AztecAddress[], ) { super(); diff --git a/yarn-project/simulator/src/providers/acvm_native.ts b/yarn-project/simulator/src/providers/acvm_native.ts index 3bf1bdf01572..0cdfb68769a5 100644 --- a/yarn-project/simulator/src/providers/acvm_native.ts +++ b/yarn-project/simulator/src/providers/acvm_native.ts @@ -1,5 +1,5 @@ import { runInDirectory } from '@aztec/foundation/fs'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { type NoirCompiledCircuit } from '@aztec/types/noir'; @@ -9,7 +9,7 @@ import fs from 'fs/promises'; import { type SimulationProvider } from './simulation_provider.js'; -const logger = createDebugLogger('aztec:acvm-native'); +const logger = createLogger('simulator:acvm-native'); export enum ACVM_RESULT { SUCCESS, diff --git a/yarn-project/simulator/src/providers/factory.ts b/yarn-project/simulator/src/providers/factory.ts index 73f7c70cd550..bb8f003cfee6 100644 --- a/yarn-project/simulator/src/providers/factory.ts +++ b/yarn-project/simulator/src/providers/factory.ts @@ -1,4 +1,4 @@ -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import * as fs from 'fs/promises'; @@ -21,7 +21,7 @@ export function getSimulationProviderConfigFromEnv() { export async function createSimulationProvider( config: SimulationProviderConfig, - logger: DebugLogger = createDebugLogger('aztec:simulator'), + logger: Logger = createLogger('simulator'), ): Promise { if (config.acvmBinaryPath && config.acvmWorkingDirectory) { try { diff --git a/yarn-project/simulator/src/public/enqueued_call_side_effect_trace.ts b/yarn-project/simulator/src/public/enqueued_call_side_effect_trace.ts index 84e85adcd640..5d09d3544e27 100644 --- a/yarn-project/simulator/src/public/enqueued_call_side_effect_trace.ts +++ b/yarn-project/simulator/src/public/enqueued_call_side_effect_trace.ts @@ -49,7 +49,7 @@ import { computePublicDataTreeLeafSlot } from '@aztec/circuits.js/hash'; import { padArrayEnd } from '@aztec/foundation/collection'; import { Fr } from '@aztec/foundation/fields'; import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { assert } from 'console'; @@ -99,7 +99,7 @@ export class SideEffectArrayLengths { * Trace side effects for an entire enqueued call. */ export class PublicEnqueuedCallSideEffectTrace implements PublicSideEffectTraceInterface { - public log = createDebugLogger('aztec:public_enqueued_call_side_effect_trace'); + public log = createLogger('simulator:public_enqueued_call_side_effect_trace'); /** The side effect counter increments with every call to the trace. */ private sideEffectCounter: number; diff --git a/yarn-project/simulator/src/public/public_db_sources.ts b/yarn-project/simulator/src/public/public_db_sources.ts index 27177b3b9193..ab9add3a40bc 100644 --- a/yarn-project/simulator/src/public/public_db_sources.ts +++ b/yarn-project/simulator/src/public/public_db_sources.ts @@ -20,7 +20,7 @@ import { computePublicBytecodeCommitment, } from '@aztec/circuits.js'; import { computeL1ToL2MessageNullifier, computePublicDataTreeLeafSlot } from '@aztec/circuits.js/hash'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { ContractClassRegisteredEvent, ContractInstanceDeployedEvent } from '@aztec/protocol-contracts'; import { @@ -39,7 +39,7 @@ export class ContractsDataSourcePublicDB implements PublicContractsDB { private classCache = new Map(); private bytecodeCommitmentCache = new Map(); - private log = createDebugLogger('aztec:sequencer:contracts-data-source'); + private log = createLogger('simulator:contracts-data-source'); constructor(private dataSource: ContractDataSource) {} /** @@ -152,7 +152,7 @@ export class ContractsDataSourcePublicDB implements PublicContractsDB { * A public state DB that reads and writes to the world state. */ export class WorldStateDB extends ContractsDataSourcePublicDB implements PublicStateDB, CommitmentsDB { - private logger = createDebugLogger('aztec:sequencer:world-state-db'); + private logger = createLogger('simulator:world-state-db'); private publicCommittedWriteCache: Map = new Map(); private publicCheckpointedWriteCache: Map = new Map(); diff --git a/yarn-project/simulator/src/public/public_processor.ts b/yarn-project/simulator/src/public/public_processor.ts index d11ac645e592..a511dc64d195 100644 --- a/yarn-project/simulator/src/public/public_processor.ts +++ b/yarn-project/simulator/src/public/public_processor.ts @@ -23,7 +23,7 @@ import { PublicDataWrite, } from '@aztec/circuits.js'; import { padArrayEnd } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { ContractClassRegisteredEvent, ProtocolContractAddress } from '@aztec/protocol-contracts'; import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client'; @@ -79,7 +79,7 @@ export class PublicProcessor { protected worldStateDB: WorldStateDB, protected publicTxSimulator: PublicTxSimulator, telemetryClient: TelemetryClient, - private log = createDebugLogger('aztec:simulator:public-processor'), + private log = createLogger('simulator:public-processor'), ) { this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor'); } diff --git a/yarn-project/simulator/src/public/public_tx_context.ts b/yarn-project/simulator/src/public/public_tx_context.ts index f6fd8e7c9e19..35c8afc4b4a9 100644 --- a/yarn-project/simulator/src/public/public_tx_context.ts +++ b/yarn-project/simulator/src/public/public_tx_context.ts @@ -21,7 +21,7 @@ import { type StateReference, countAccumulatedItems, } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { strict as assert } from 'assert'; import { inspect } from 'util'; @@ -39,7 +39,7 @@ import { getCallRequestsByPhase, getExecutionRequestsByPhase } from './utils.js' * The transaction-level context for public execution. */ export class PublicTxContext { - private log: DebugLogger; + private log: Logger; /* Gas used including private, teardown gas _limit_, setup and app logic */ private gasUsed: Gas; @@ -72,7 +72,7 @@ export class PublicTxContext { public readonly revertibleAccumulatedDataFromPrivate: PrivateToPublicAccumulatedData, public trace: PublicEnqueuedCallSideEffectTrace, // FIXME(dbanks12): should be private ) { - this.log = createDebugLogger(`aztec:public_tx_context`); + this.log = createLogger(`simulator:public_tx_context`); this.gasUsed = startGasUsed; } @@ -374,12 +374,12 @@ export class PublicTxContext { * transaction level one. */ class PhaseStateManager { - private log: DebugLogger; + private log: Logger; private currentlyActiveStateManager: AvmPersistableStateManager | undefined; constructor(private readonly txStateManager: AvmPersistableStateManager) { - this.log = createDebugLogger(`aztec:public_phase_state_manager`); + this.log = createLogger(`simulator:public_phase_state_manager`); } fork() { diff --git a/yarn-project/simulator/src/public/public_tx_simulator.ts b/yarn-project/simulator/src/public/public_tx_simulator.ts index 7cf250cc1d58..76d4c34b9e39 100644 --- a/yarn-project/simulator/src/public/public_tx_simulator.ts +++ b/yarn-project/simulator/src/public/public_tx_simulator.ts @@ -18,7 +18,7 @@ import { type PublicCallRequest, type RevertCode, } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { Timer } from '@aztec/foundation/timer'; import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client'; @@ -53,7 +53,7 @@ export type PublicTxResult = { export class PublicTxSimulator { metrics: ExecutorMetrics; - private log: DebugLogger; + private log: Logger; constructor( private db: MerkleTreeReadOperations, @@ -63,7 +63,7 @@ export class PublicTxSimulator { private realAvmProvingRequests: boolean = true, private doMerkleOperations: boolean = false, ) { - this.log = createDebugLogger(`aztec:public_tx_simulator`); + this.log = createLogger(`simulator:public_tx_simulator`); this.metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator'); } diff --git a/yarn-project/simulator/src/public/side_effect_trace.ts b/yarn-project/simulator/src/public/side_effect_trace.ts index 474e3ff155dd..94fbd74af005 100644 --- a/yarn-project/simulator/src/public/side_effect_trace.ts +++ b/yarn-project/simulator/src/public/side_effect_trace.ts @@ -46,7 +46,7 @@ import { } from '@aztec/circuits.js'; import { Fr } from '@aztec/foundation/fields'; import { jsonStringify } from '@aztec/foundation/json-rpc'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { assert } from 'console'; @@ -68,7 +68,7 @@ const emptyNullifierPath = () => new Array(NULLIFIER_TREE_HEIGHT).fill(Fr.zero() const emptyL1ToL2MessagePath = () => new Array(L1_TO_L2_MSG_TREE_HEIGHT).fill(Fr.zero()); export class PublicSideEffectTrace implements PublicSideEffectTraceInterface { - public log = createDebugLogger('aztec:public_side_effect_trace'); + public log = createLogger('public_side_effect_trace'); /** The side effect counter increments with every call to the trace. */ private sideEffectCounter: number; // kept as number until finalized for efficiency diff --git a/yarn-project/telemetry-client/package.json b/yarn-project/telemetry-client/package.json index fdd9d252fafb..52702de6db9b 100644 --- a/yarn-project/telemetry-client/package.json +++ b/yarn-project/telemetry-client/package.json @@ -7,7 +7,8 @@ "exports": { ".": "./dest/index.js", "./start": "./dest/start.js", - "./noop": "./dest/noop.js" + "./noop": "./dest/noop.js", + "./otel-pino-stream": "./dest/vendor/otel-pino-stream.js" }, "scripts": { "build": "yarn clean && tsc -b", @@ -28,21 +29,20 @@ "dependencies": { "@aztec/foundation": "workspace:^", "@opentelemetry/api": "^1.9.0", - "@opentelemetry/api-logs": "^0.54.0", - "@opentelemetry/exporter-logs-otlp-http": "^0.54.0", - "@opentelemetry/exporter-metrics-otlp-http": "^0.52.0", - "@opentelemetry/exporter-trace-otlp-http": "^0.54.0", - "@opentelemetry/host-metrics": "^0.35.2", - "@opentelemetry/otlp-exporter-base": "^0.54.0", - "@opentelemetry/resource-detector-aws": "^1.5.2", - "@opentelemetry/resources": "^1.25.0", - "@opentelemetry/sdk-logs": "^0.54.0", - "@opentelemetry/sdk-metrics": "^1.25.0", - "@opentelemetry/sdk-trace-node": "^1.25.0", - "@opentelemetry/semantic-conventions": "^1.25.0", - "@opentelemetry/winston-transport": "^0.7.0", - "prom-client": "^15.1.3", - "winston": "^3.10.0" + "@opentelemetry/api-logs": "^0.55.0", + "@opentelemetry/core": "^1.28.0", + "@opentelemetry/exporter-logs-otlp-http": "^0.55.0", + "@opentelemetry/exporter-metrics-otlp-http": "^0.55.0", + "@opentelemetry/exporter-trace-otlp-http": "^0.55.0", + "@opentelemetry/host-metrics": "^0.35.4", + "@opentelemetry/otlp-exporter-base": "^0.55.0", + "@opentelemetry/resource-detector-aws": "^1.8.0", + "@opentelemetry/resources": "^1.28.0", + "@opentelemetry/sdk-logs": "^0.55.0", + "@opentelemetry/sdk-metrics": "^1.28.0", + "@opentelemetry/sdk-trace-node": "^1.28.0", + "@opentelemetry/semantic-conventions": "^1.28.0", + "prom-client": "^15.1.3" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/yarn-project/telemetry-client/src/otel.ts b/yarn-project/telemetry-client/src/otel.ts index f94d054cb314..c09895697b74 100644 --- a/yarn-project/telemetry-client/src/otel.ts +++ b/yarn-project/telemetry-client/src/otel.ts @@ -1,4 +1,4 @@ -import { type DebugLogger } from '@aztec/foundation/log'; +import { type LogData, type Logger, addLogDataHandler } from '@aztec/foundation/log'; import { DiagConsoleLogger, @@ -6,28 +6,23 @@ import { type Meter, type Tracer, type TracerProvider, + context, diag, + isSpanContextValid, + trace, } from '@opentelemetry/api'; import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; import { HostMetrics } from '@opentelemetry/host-metrics'; -import { awsEc2Detector, awsEcsDetector } from '@opentelemetry/resource-detector-aws'; -import { - type IResource, - detectResourcesSync, - envDetectorSync, - osDetectorSync, - processDetectorSync, - serviceInstanceIdDetectorSync, -} from '@opentelemetry/resources'; +import { type IResource } from '@opentelemetry/resources'; import { type LoggerProvider } from '@opentelemetry/sdk-logs'; import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'; import { BatchSpanProcessor, NodeTracerProvider } from '@opentelemetry/sdk-trace-node'; -import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from '@opentelemetry/semantic-conventions'; +import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions'; -import { aztecDetector } from './aztec_resource_detector.js'; import { type TelemetryClientConfig } from './config.js'; -import { registerOtelLoggerProvider } from './otelLoggerProvider.js'; +import { registerOtelLoggerProvider } from './otel_logger_provider.js'; +import { getOtelResource } from './otel_resource.js'; import { type Gauge, type TelemetryClient } from './telemetry.js'; export class OpenTelemetryClient implements TelemetryClient { @@ -39,23 +34,37 @@ export class OpenTelemetryClient implements TelemetryClient { private meterProvider: MeterProvider, private traceProvider: TracerProvider, private loggerProvider: LoggerProvider, - private log: DebugLogger, + private log: Logger, ) {} getMeter(name: string): Meter { - return this.meterProvider.getMeter(name, this.resource.attributes[SEMRESATTRS_SERVICE_VERSION] as string); + return this.meterProvider.getMeter(name, this.resource.attributes[ATTR_SERVICE_VERSION] as string); } getTracer(name: string): Tracer { - return this.traceProvider.getTracer(name, this.resource.attributes[SEMRESATTRS_SERVICE_VERSION] as string); + return this.traceProvider.getTracer(name, this.resource.attributes[ATTR_SERVICE_VERSION] as string); } public start() { this.log.info('Starting OpenTelemetry client'); diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO); + // Add a callback to the logger to set context data from current trace + // Adapted from open-telemetry/opentelemetry-js-contrib PinoInstrumentation._getMixinFunction + addLogDataHandler((data: LogData) => { + const spanContext = trace.getSpan(context.active())?.spanContext(); + return spanContext && isSpanContextValid(spanContext) + ? { + ...data, + ['trace_id']: spanContext.traceId, + ['span_id']: spanContext.spanId, + ['trace_flags']: `0${spanContext.traceFlags.toString(16)}`, + } + : data; + }); + this.hostMetrics = new HostMetrics({ - name: this.resource.attributes[SEMRESATTRS_SERVICE_NAME] as string, + name: this.resource.attributes[ATTR_SERVICE_NAME] as string, meterProvider: this.meterProvider, }); @@ -87,34 +96,17 @@ export class OpenTelemetryClient implements TelemetryClient { ]); } - public static async createAndStart(config: TelemetryClientConfig, log: DebugLogger): Promise { - const resource = detectResourcesSync({ - detectors: [ - osDetectorSync, - envDetectorSync, - processDetectorSync, - serviceInstanceIdDetectorSync, - awsEc2Detector, - awsEcsDetector, - aztecDetector, - ], - }); - - if (resource.asyncAttributesPending) { - await resource.waitForAsyncAttributes!(); - } + public static async createAndStart(config: TelemetryClientConfig, log: Logger): Promise { + const resource = await getOtelResource(); + // TODO(palla/log): Should we show traces as logs in stdout when otel collection is disabled? const tracerProvider = new NodeTracerProvider({ resource, + spanProcessors: config.tracesCollectorUrl + ? [new BatchSpanProcessor(new OTLPTraceExporter({ url: config.tracesCollectorUrl.href }))] + : [], }); - // optionally push traces to an OTEL collector instance - if (config.tracesCollectorUrl) { - tracerProvider.addSpanProcessor( - new BatchSpanProcessor(new OTLPTraceExporter({ url: config.tracesCollectorUrl.href })), - ); - } - tracerProvider.register(); const meterProvider = new MeterProvider({ @@ -129,7 +121,8 @@ export class OpenTelemetryClient implements TelemetryClient { }), ], }); - const loggerProvider = registerOtelLoggerProvider(resource, config.logsCollectorUrl); + + const loggerProvider = await registerOtelLoggerProvider(resource, config.logsCollectorUrl); const service = new OpenTelemetryClient(resource, meterProvider, tracerProvider, loggerProvider, log); service.start(); diff --git a/yarn-project/telemetry-client/src/otelLoggerProvider.ts b/yarn-project/telemetry-client/src/otel_logger_provider.ts similarity index 85% rename from yarn-project/telemetry-client/src/otelLoggerProvider.ts rename to yarn-project/telemetry-client/src/otel_logger_provider.ts index e5289b606c5a..7566520afbaa 100644 --- a/yarn-project/telemetry-client/src/otelLoggerProvider.ts +++ b/yarn-project/telemetry-client/src/otel_logger_provider.ts @@ -4,7 +4,11 @@ import { CompressionAlgorithm } from '@opentelemetry/otlp-exporter-base'; import { type IResource } from '@opentelemetry/resources'; import { BatchLogRecordProcessor, LoggerProvider } from '@opentelemetry/sdk-logs'; -export function registerOtelLoggerProvider(resource: IResource, otelLogsUrl?: URL) { +import { getOtelResource } from './otel_resource.js'; + +export async function registerOtelLoggerProvider(resource?: IResource, otelLogsUrl?: URL) { + resource ??= await getOtelResource(); + const loggerProvider = new LoggerProvider({ resource }); if (!otelLogsUrl) { // If no URL provided, return it disconnected. @@ -24,7 +28,7 @@ export function registerOtelLoggerProvider(resource: IResource, otelLogsUrl?: UR maxQueueSize: 4096, }), ); - otelLogs.setGlobalLoggerProvider(loggerProvider); + otelLogs.setGlobalLoggerProvider(loggerProvider); return loggerProvider; } diff --git a/yarn-project/telemetry-client/src/otel_resource.ts b/yarn-project/telemetry-client/src/otel_resource.ts new file mode 100644 index 000000000000..3810d3e73be6 --- /dev/null +++ b/yarn-project/telemetry-client/src/otel_resource.ts @@ -0,0 +1,32 @@ +import { awsEc2Detector, awsEcsDetector } from '@opentelemetry/resource-detector-aws'; +import { + type IResource, + detectResourcesSync, + envDetectorSync, + osDetectorSync, + processDetectorSync, + serviceInstanceIdDetectorSync, +} from '@opentelemetry/resources'; + +import { aztecDetector } from './aztec_resource_detector.js'; + +export async function getOtelResource(): Promise { + // TODO(palla/log): Do we really need *all* this info? + const resource = detectResourcesSync({ + detectors: [ + osDetectorSync, + envDetectorSync, + processDetectorSync, + serviceInstanceIdDetectorSync, + awsEc2Detector, + awsEcsDetector, + aztecDetector, + ], + }); + + if (resource.asyncAttributesPending) { + await resource.waitForAsyncAttributes!(); + } + + return resource; +} diff --git a/yarn-project/telemetry-client/src/prom_otel_adapter.ts b/yarn-project/telemetry-client/src/prom_otel_adapter.ts index ffff02bb1ac4..4cd8197a54af 100644 --- a/yarn-project/telemetry-client/src/prom_otel_adapter.ts +++ b/yarn-project/telemetry-client/src/prom_otel_adapter.ts @@ -1,4 +1,4 @@ -import { type Logger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { Registry } from 'prom-client'; @@ -285,7 +285,10 @@ class NoopOtelAvgMinMax implements IAvg export class OtelMetricsAdapter extends Registry implements MetricsRegister { private readonly meter: Meter; - constructor(telemetryClient: TelemetryClient, private logger: Logger = createDebugLogger('otel-metrics-adapter')) { + constructor( + telemetryClient: TelemetryClient, + private logger: Logger = createLogger('telemetry:otel-metrics-adapter'), + ) { super(); this.meter = telemetryClient.getMeter('metrics-adapter'); } diff --git a/yarn-project/telemetry-client/src/start.ts b/yarn-project/telemetry-client/src/start.ts index c765189c82f9..d33866c6c1b5 100644 --- a/yarn-project/telemetry-client/src/start.ts +++ b/yarn-project/telemetry-client/src/start.ts @@ -1,4 +1,4 @@ -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type TelemetryClientConfig } from './config.js'; import { NoopTelemetryClient } from './noop.js'; @@ -8,7 +8,7 @@ import { type TelemetryClient } from './telemetry.js'; export * from './config.js'; export async function createAndStartTelemetryClient(config: TelemetryClientConfig): Promise { - const log = createDebugLogger('aztec:telemetry-client'); + const log = createLogger('telemetry:client'); if (config.metricsCollectorUrl) { log.info('Using OpenTelemetry client'); return await OpenTelemetryClient.createAndStart(config, log); diff --git a/yarn-project/telemetry-client/src/vendor/otel-pino-stream.ts b/yarn-project/telemetry-client/src/vendor/otel-pino-stream.ts new file mode 100644 index 000000000000..5d2c053551a1 --- /dev/null +++ b/yarn-project/telemetry-client/src/vendor/otel-pino-stream.ts @@ -0,0 +1,280 @@ +/* + * Adapted from open-telemetry/opentelemetry-js-contrib + * All changes are prefixed with [aztec] to make them easy to identify + * + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { type Logger, SeverityNumber, logs } from '@opentelemetry/api-logs'; +import { millisToHrTime } from '@opentelemetry/core'; +import { Writable } from 'stream'; + +import { registerOtelLoggerProvider } from '../otel_logger_provider.js'; + +/* eslint-disable @typescript-eslint/ban-types */ +/* eslint-disable camelcase */ + +// This block is a copy (modulo code style and TypeScript types) of the Pino +// code that defines log level value and names. This file is part of +// *instrumenting* Pino, so we want to avoid a dependency on the library. +const DEFAULT_LEVELS = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60, +}; + +const OTEL_SEV_NUM_FROM_PINO_LEVEL: { [level: number]: SeverityNumber } = { + [DEFAULT_LEVELS.trace]: SeverityNumber.TRACE, + [DEFAULT_LEVELS.debug]: SeverityNumber.DEBUG, + [DEFAULT_LEVELS.info]: SeverityNumber.INFO, + [DEFAULT_LEVELS.warn]: SeverityNumber.WARN, + [DEFAULT_LEVELS.error]: SeverityNumber.ERROR, + [DEFAULT_LEVELS.fatal]: SeverityNumber.FATAL, +}; + +const EXTRA_SEV_NUMS = [ + SeverityNumber.TRACE2, + SeverityNumber.TRACE3, + SeverityNumber.TRACE4, + SeverityNumber.DEBUG2, + SeverityNumber.DEBUG3, + SeverityNumber.DEBUG4, + SeverityNumber.INFO2, + SeverityNumber.INFO3, + SeverityNumber.INFO4, + SeverityNumber.WARN2, + SeverityNumber.WARN3, + SeverityNumber.WARN4, + SeverityNumber.ERROR2, + SeverityNumber.ERROR3, + SeverityNumber.ERROR4, + SeverityNumber.FATAL2, + SeverityNumber.FATAL3, + SeverityNumber.FATAL4, +]; + +function severityNumberFromPinoLevel(lvl: number) { + // Fast common case: one of the known levels + const sev = OTEL_SEV_NUM_FROM_PINO_LEVEL[lvl]; + if (sev !== undefined) { + return sev; + } + + // Otherwise, scale the Pino level range -- 10 (trace) to 70 (fatal+10) + // -- onto the extra OTel severity numbers (TRACE2, TRACE3, ..., FATAL4). + // Values below trace (10) map to SeverityNumber.TRACE2, which may be + // considered a bit weird, but it means the unnumbered levels are always + // just for exactly matching values. + const relativeLevelWeight = (lvl - 10) / (70 - 10); + const otelSevIdx = Math.floor(relativeLevelWeight * EXTRA_SEV_NUMS.length); + const cappedOTelIdx = Math.min(EXTRA_SEV_NUMS.length - 1, Math.max(0, otelSevIdx)); + const otelSevValue = EXTRA_SEV_NUMS[cappedOTelIdx]; + return otelSevValue; +} + +// [aztec] Custom function to map Aztec logging levels to OpenTelemetry severity numbers +function severityNumberFromAztecPinoLevel(lvl: number) { + return ( + OTEL_SEV_NUM_FROM_PINO_LEVEL[lvl] ?? + /* verbose */ (lvl === 25 ? SeverityNumber.DEBUG3 : undefined) ?? + severityNumberFromPinoLevel(lvl) + ); +} + +/** + * Return a function that knows how to convert the "time" field value on a + * Pino log record to an OTel LogRecord timestamp value. + * + * How to convert the serialized "time" on a Pino log record + * depends on the Logger's `Symbol(pino.time)` prop, configurable + * via https://getpino.io/#/docs/api?id=timestamp-boolean-function + * + * For example: + * const logger = pino({timestamp: pino.stdTimeFunctions.isoTime}) + * results in log record entries of the form: + * ,"time":"2024-05-17T22:03:25.969Z" + * `otelTimestampFromTime` will be given the value of the "time" field: + * "2024-05-17T22:03:25.969Z" + * which should be parsed to a number of milliseconds since the epoch. + */ +export function getTimeConverter(pinoLogger: any, pinoMod: any) { + const stdTimeFns = pinoMod.stdTimeFunctions; + const loggerTimeFn = pinoLogger[pinoMod.symbols.timeSym]; + if (loggerTimeFn === stdTimeFns.epochTime) { + return (time: number) => time; + } else if (loggerTimeFn === stdTimeFns.unixTime) { + return (time: number) => time * 1e3; + } else if (loggerTimeFn === stdTimeFns.isoTime) { + return (time: string) => new Date(time).getTime(); + } else if (loggerTimeFn === stdTimeFns.nullTime) { + return () => Date.now(); + } else { + // The logger has a custom time function. Don't guess. + return () => NaN; + } +} + +interface OTelPinoStreamOptions { + messageKey: string; + levels: any; // Pino.LevelMapping + otelTimestampFromTime: (time: any) => number; +} + +/** + * A Pino stream for sending records to the OpenTelemetry Logs API. + * + * - This stream emits an 'unknown' event on an unprocessable pino record. + * The event arguments are: `logLine: string`, `err: string | Error`. + */ +export class OTelPinoStream extends Writable { + private _otelLogger: Logger; + private _messageKey: string; + private _levels; + private _otelTimestampFromTime; + + constructor(options: OTelPinoStreamOptions) { + super(); + + // Note: A PINO_CONFIG event was added to pino (2024-04-04) to send config + // to transports. Eventually OTelPinoStream might be able to use this + // for auto-configuration in newer pino versions. The event currently does + // not include the `timeSym` value that is needed here, however. + this._messageKey = options.messageKey; + this._levels = options.levels; + + // [aztec] The following will break if we set up a custom time function in our logger + this._otelTimestampFromTime = options.otelTimestampFromTime ?? ((time: number) => time); + + // Cannot use `instrumentation.logger` until have delegating LoggerProvider: + // https://github.com/open-telemetry/opentelemetry-js/issues/4399 + // [aztec] Use the name of this package + this._otelLogger = logs.getLogger('@aztec/telemetry-client/otel-pino-stream', '0.1.0'); + } + + override _write(s: string, _encoding: string, callback: Function) { + try { + /* istanbul ignore if */ + if (!s) { + return; + } + + // Parse, and handle edge cases similar to how `pino-abtract-transport` does: + // https://github.com/pinojs/pino-abstract-transport/blob/v1.2.0/index.js#L28-L45 + // - Emitting an 'unknown' event on parse error mimicks pino-abstract-transport. + let recObj; + try { + recObj = JSON.parse(s); + } catch (parseErr) { + // Invalid JSON suggests a bug in Pino, or a logger configuration bug + // (a bogus `options.timestamp` or serializer). + this.emit('unknown', s.toString(), parseErr); + callback(); + return; + } + /* istanbul ignore if */ + if (recObj === null) { + this.emit('unknown', s.toString(), 'Null value ignored'); + callback(); + return; + } + /* istanbul ignore if */ + if (typeof recObj !== 'object') { + recObj = { + data: recObj, + }; + } + + const { + time, + [this._messageKey]: body, + level, // eslint-disable-line @typescript-eslint/no-unused-vars + + // The typical Pino `hostname` and `pid` fields are removed because they + // are redundant with the OpenTelemetry `host.name` and `process.pid` + // Resource attributes, respectively. This code cannot change the + // LoggerProvider's `resource`, so getting the OpenTelemetry equivalents + // depends on the user using the OpenTelemetry HostDetector and + // ProcessDetector. + // https://getpino.io/#/docs/api?id=opt-base + hostname, // eslint-disable-line @typescript-eslint/no-unused-vars + pid, // eslint-disable-line @typescript-eslint/no-unused-vars + + // The `trace_id` et al fields that may have been added by the + // "log correlation" feature are stripped, because they are redundant. + // trace_id, // eslint-disable-line @typescript-eslint/no-unused-vars + // span_id, // eslint-disable-line @typescript-eslint/no-unused-vars + // trace_flags, // eslint-disable-line @typescript-eslint/no-unused-vars + + // [aztec] They are not redundant, we depend on them for correlation. + // The instrumentation package seems to be adding these fields via a custom hook. + // We push them from the logger module in foundation, so we don't want to clear them here. + + ...attributes + } = recObj; + + let timestamp = this._otelTimestampFromTime(time); + if (isNaN(timestamp)) { + attributes['time'] = time; // save the unexpected "time" field to attributes + timestamp = Date.now(); + } + + // This avoids a possible subtle bug when a Pino logger uses + // `time: pino.stdTimeFunctions.unixTime` and logs in the first half-second + // since process start. The rounding involved results in: + // timestamp < performance.timeOrigin + // If that is passed to Logger.emit() it will be misinterpreted by + // `timeInputToHrTime` as a `performance.now()` value. + const timestampHrTime = millisToHrTime(timestamp); + + // Prefer using `stream.lastLevel`, because `recObj.level` can be customized + // to anything via `formatters.level` + // (https://getpino.io/#/docs/api?id=formatters-object). + // const lastLevel = (this as any).lastLevel; + + // [aztec] We do not prefer stream.lastLevel since it's undefined here, as we are running + // on a worker thread, so we use recObj.level because we know that we won't customize it. + const lastLevel = recObj.level; + + const otelRec = { + timestamp: timestampHrTime, + observedTimestamp: timestampHrTime, + severityNumber: severityNumberFromAztecPinoLevel(lastLevel), + severityText: this._levels.labels[lastLevel], + body, + attributes, + }; + + this._otelLogger.emit(otelRec); + } catch (err) { + // [aztec] Log errors to stderr + // eslint-disable-next-line no-console + console.error(`Error in OTelPinoStream: ${err}`); + } + callback(); + } +} + +// [aztec] Default export that loads the resource information and creates a new otel pino stream. +// Invoked by pino when creating a transport in a worker thread out of this stream. +// Note that the original open-telemetry/opentelemetry-js-contrib was set up to run on the main +// nodejs loop, as opposed to in a worker as pino recommends. +export default async function (options: OTelPinoStreamOptions) { + const url = process.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT; + // We re-register here because this runs on a worker thread + await registerOtelLoggerProvider(undefined, url ? new URL(url) : undefined); + return new OTelPinoStream(options); +} diff --git a/yarn-project/txe/package.json b/yarn-project/txe/package.json index efa06e6bf574..ebae6269f3c6 100644 --- a/yarn-project/txe/package.json +++ b/yarn-project/txe/package.json @@ -18,7 +18,7 @@ "formatting": "run -T prettier --check ./src && run -T eslint ./src", "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src", "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests", - "dev": "DEBUG='aztec:*,-aztec:avm_simulator:*' LOG_LEVEL=debug node ./dest/bin/index.js", + "dev": "LOG_LEVEL=debug node ./dest/bin/index.js", "start": "node ./dest/bin/index.js" }, "inherits": [ @@ -93,4 +93,4 @@ "engines": { "node": ">=18" } -} +} \ No newline at end of file diff --git a/yarn-project/txe/src/bin/index.ts b/yarn-project/txe/src/bin/index.ts index e15701b11654..43390bb1074f 100644 --- a/yarn-project/txe/src/bin/index.ts +++ b/yarn-project/txe/src/bin/index.ts @@ -1,5 +1,5 @@ #!/usr/bin/env -S node --no-warnings -import { createDebugLogger } from '@aztec/aztec.js'; +import { createLogger } from '@aztec/aztec.js'; import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server'; import { createTXERpcServer } from '../index.js'; @@ -10,7 +10,7 @@ import { createTXERpcServer } from '../index.js'; async function main() { const { TXE_PORT = 8080 } = process.env; - const logger = createDebugLogger('aztec:txe_service'); + const logger = createLogger('txe:service'); logger.info(`Setting up TXE...`); const txeServer = createTXERpcServer(logger); diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index 7ced2639ab1f..d750b9880fb8 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -9,7 +9,7 @@ import { import { type GlobalVariables, 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 { createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type Timer } from '@aztec/foundation/timer'; import { type P2P } from '@aztec/p2p'; @@ -69,7 +69,7 @@ export class ValidatorClient extends WithTracer implements Validator { private p2pClient: P2P, private config: ValidatorClientConfig, telemetry: TelemetryClient = new NoopTelemetryClient(), - private log = createDebugLogger('aztec:validator'), + private log = createLogger('validator'), ) { // Instantiate tracer super(telemetry, 'Validator'); diff --git a/yarn-project/world-state/src/native/native_world_state.ts b/yarn-project/world-state/src/native/native_world_state.ts index 9e0b175ac6c5..f84b3a74ac8c 100644 --- a/yarn-project/world-state/src/native/native_world_state.ts +++ b/yarn-project/world-state/src/native/native_world_state.ts @@ -20,7 +20,7 @@ import { StateReference, } from '@aztec/circuits.js'; import { padArrayEnd } from '@aztec/foundation/collection'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import assert from 'assert/strict'; import { mkdir, mkdtemp, rm } from 'fs/promises'; @@ -58,7 +58,7 @@ export class NativeWorldStateService implements MerkleTreeDatabase { protected constructor( protected readonly instance: NativeWorldState, - protected readonly log = createDebugLogger('aztec:world-state:database'), + protected readonly log = createLogger('world-state:database'), private readonly cleanup = () => Promise.resolve(), ) {} @@ -66,7 +66,7 @@ export class NativeWorldStateService implements MerkleTreeDatabase { rollupAddress: EthAddress, dataDir: string, dbMapSizeKb: number, - log = createDebugLogger('aztec:world-state:database'), + log = createLogger('world-state:database'), cleanup = () => Promise.resolve(), ): Promise { const worldStateDirectory = join(dataDir, 'world_state'); @@ -102,7 +102,7 @@ export class NativeWorldStateService implements MerkleTreeDatabase { } static async tmp(rollupAddress = EthAddress.ZERO, cleanupTmpDir = true): Promise { - const log = createDebugLogger('aztec:world-state:database'); + const log = createLogger('world-state:database'); const dataDir = await mkdtemp(join(tmpdir(), 'aztec-world-state-')); const dbMapSizeKb = 10 * 1024 * 1024; log.debug(`Created temporary world state database at: ${dataDir} with size: ${dbMapSizeKb}`); diff --git a/yarn-project/world-state/src/native/native_world_state_cmp.test.ts b/yarn-project/world-state/src/native/native_world_state_cmp.test.ts index 32f4f71842da..356238204612 100644 --- a/yarn-project/world-state/src/native/native_world_state_cmp.test.ts +++ b/yarn-project/world-state/src/native/native_world_state_cmp.test.ts @@ -6,7 +6,7 @@ import { type MerkleTreeWriteOperations, } from '@aztec/circuit-types'; import { EthAddress, Fr, GENESIS_ARCHIVE_ROOT, NullifierLeaf, PublicDataTreeLeaf } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { elapsed } from '@aztec/foundation/timer'; import { type AztecKVStore } from '@aztec/kv-store'; import { AztecLmdbStore } from '@aztec/kv-store/lmdb'; @@ -30,7 +30,7 @@ describe('NativeWorldState', () => { let nativeWS: NativeWorldStateService; let legacyWS: MerkleTrees; - let log: DebugLogger; + let log: Logger; let legacyStore: AztecKVStore; @@ -42,7 +42,7 @@ describe('NativeWorldState', () => { nativeDataDir = await mkdtemp(join(tmpdir(), 'native_world_state_test-')); legacyDataDir = await mkdtemp(join(tmpdir(), 'js_world_state_test-')); - log = createDebugLogger('aztec:world-state:test:native_world_state_cmp'); + log = createLogger('world-state:test:native_world_state_cmp'); }); afterAll(async () => { diff --git a/yarn-project/world-state/src/native/native_world_state_instance.ts b/yarn-project/world-state/src/native/native_world_state_instance.ts index a1fa6baed48f..d36c39740c74 100644 --- a/yarn-project/world-state/src/native/native_world_state_instance.ts +++ b/yarn-project/world-state/src/native/native_world_state_instance.ts @@ -10,7 +10,7 @@ import { NULLIFIER_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, } from '@aztec/circuits.js'; -import { createDebugLogger, fmtLogData } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { Timer } from '@aztec/foundation/timer'; @@ -82,7 +82,7 @@ export class NativeWorldState implements NativeWorldStateInstance { private queue = new SerialQueue(); /** Creates a new native WorldState instance */ - constructor(dataDir: string, dbMapSizeKb: number, private log = createDebugLogger('aztec:world-state:database')) { + constructor(dataDir: string, dbMapSizeKb: number, private log = createLogger('world-state:database')) { log.info(`Creating world state data store at directory ${dataDir} with map size ${dbMapSizeKb} KB`); this.instance = new NATIVE_MODULE[NATIVE_CLASS_NAME]( dataDir, @@ -203,9 +203,9 @@ export class NativeWorldState implements NativeWorldStateInstance { data['publicDataWritesCount'] = body.publicDataWrites.length; } - this.log.debug(`Calling messageId=${messageId} ${WorldStateMessageType[messageType]} with ${fmtLogData(data)}`); + this.log.trace(`Calling messageId=${messageId} ${WorldStateMessageType[messageType]}`, data); } else { - this.log.debug(`Calling messageId=${messageId} ${WorldStateMessageType[messageType]}`); + this.log.trace(`Calling messageId=${messageId} ${WorldStateMessageType[messageType]}`); } const timer = new Timer(); @@ -248,14 +248,12 @@ export class NativeWorldState implements NativeWorldStateInstance { const response = TypedMessage.fromMessagePack(decodedResponse); const decodingDuration = timer.ms() - callDuration; const totalDuration = timer.ms(); - this.log.debug( - `Call messageId=${messageId} ${WorldStateMessageType[messageType]} took (ms) ${fmtLogData({ - totalDuration, - encodingDuration, - callDuration, - decodingDuration, - })}`, - ); + this.log.trace(`Call messageId=${messageId} ${WorldStateMessageType[messageType]} took (ms)`, { + totalDuration, + encodingDuration, + callDuration, + decodingDuration, + }); if (response.header.requestId !== request.header.messageId) { throw new Error( diff --git a/yarn-project/world-state/src/synchronizer/factory.ts b/yarn-project/world-state/src/synchronizer/factory.ts index 10f174e2d9a1..009fdf895af8 100644 --- a/yarn-project/world-state/src/synchronizer/factory.ts +++ b/yarn-project/world-state/src/synchronizer/factory.ts @@ -1,5 +1,5 @@ import { type L1ToL2MessageSource, type L2BlockSource } from '@aztec/circuit-types'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { createStore } from '@aztec/kv-store/utils'; import { type TelemetryClient } from '@aztec/telemetry-client'; @@ -34,10 +34,7 @@ export async function createWorldState( // If a data directory is provided in config, then create a persistent store. const merkleTrees = ['true', '1'].includes(process.env.USE_LEGACY_WORLD_STATE ?? '') - ? await MerkleTrees.new( - await createStore('world-state', newConfig, createDebugLogger('aztec:world-state:lmdb')), - client, - ) + ? await MerkleTrees.new(await createStore('world-state', newConfig, createLogger('world-state:lmdb')), client) : newConfig.dataDirectory ? await NativeWorldStateService.new( config.l1Contracts.rollupAddress, diff --git a/yarn-project/world-state/src/synchronizer/instrumentation.ts b/yarn-project/world-state/src/synchronizer/instrumentation.ts index 9b4fb6a34805..b4c6ad750f02 100644 --- a/yarn-project/world-state/src/synchronizer/instrumentation.ts +++ b/yarn-project/world-state/src/synchronizer/instrumentation.ts @@ -1,5 +1,5 @@ import { MerkleTreeId } from '@aztec/circuit-types'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { type Gauge, type Meter, type TelemetryClient, ValueType } from '@aztec/telemetry-client'; import { type DBStats, type TreeDBStats, type TreeMeta, type WorldStateStatusFull } from '../native/message.js'; @@ -40,7 +40,7 @@ class TreeInstrumentation { private finalisedHeight: Gauge; private oldestBlock: Gauge; - constructor(meter: Meter, treeName: TreeTypeString, private log: DebugLogger) { + constructor(meter: Meter, treeName: TreeTypeString, private log: Logger) { this.dbMapSize = meter.createGauge(`aztec.world_state.db_map_size.${treeName}`, { description: `The current configured map size for the ${treeName} tree`, valueType: ValueType.INT, @@ -100,7 +100,7 @@ class TreeInstrumentation { export class WorldStateInstrumentation { private treeInstrumentation: Map = new Map(); - constructor(telemetry: TelemetryClient, private log = createDebugLogger('aztec:world-state:instrumentation')) { + constructor(telemetry: TelemetryClient, private log = createLogger('world-state:instrumentation')) { const meter = telemetry.getMeter('World State'); this.treeInstrumentation.set(MerkleTreeId.ARCHIVE, new TreeInstrumentation(meter, 'archive', log)); this.treeInstrumentation.set(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, new TreeInstrumentation(meter, 'message', log)); diff --git a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts index a8840645fc98..af06954bc9aa 100644 --- a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts +++ b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.test.ts @@ -10,7 +10,7 @@ import { Fr, MerkleTreeCalculator } from '@aztec/circuits.js'; import { L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js/constants'; import { times } from '@aztec/foundation/collection'; import { randomInt } from '@aztec/foundation/crypto'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { SHA256Trunc } from '@aztec/merkle-tree'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -24,7 +24,7 @@ import { ServerWorldStateSynchronizer } from './server_world_state_synchronizer. describe('ServerWorldStateSynchronizer', () => { jest.setTimeout(30_000); - let log: DebugLogger; + let log: Logger; let l1ToL2Messages: Fr[]; let inHash: Buffer; @@ -40,7 +40,7 @@ describe('ServerWorldStateSynchronizer', () => { const LATEST_BLOCK_NUMBER = 5; beforeAll(() => { - log = createDebugLogger('aztec:world-state:test:server_world_state_synchronizer'); + log = createLogger('world-state:test:server_world_state_synchronizer'); // Seed l1 to l2 msgs l1ToL2Messages = times(randomInt(2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT), Fr.random); diff --git a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.ts b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.ts index ae344f4144a5..a1cb07c6928d 100644 --- a/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.ts +++ b/yarn-project/world-state/src/synchronizer/server_world_state_synchronizer.ts @@ -19,7 +19,7 @@ import { type L2BlockHandledStats } from '@aztec/circuit-types/stats'; import { MerkleTreeCalculator } from '@aztec/circuits.js'; import { L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js/constants'; import { type Fr } from '@aztec/foundation/fields'; -import { createDebugLogger } from '@aztec/foundation/log'; +import { createLogger } from '@aztec/foundation/log'; import { promiseWithResolvers } from '@aztec/foundation/promise'; import { elapsed } from '@aztec/foundation/timer'; import { SHA256Trunc } from '@aztec/merkle-tree'; @@ -54,7 +54,7 @@ export class ServerWorldStateSynchronizer private readonly l2BlockSource: L2BlockSource & L1ToL2MessageSource, private readonly config: WorldStateConfig, telemetry: TelemetryClient, - private readonly log = createDebugLogger('aztec:world_state'), + private readonly log = createLogger('world_state'), ) { this.instrumentation = new WorldStateInstrumentation(telemetry); this.merkleTreeCommitted = this.merkleTreeDb.getCommitted(); diff --git a/yarn-project/world-state/src/test/integration.test.ts b/yarn-project/world-state/src/test/integration.test.ts index 52fde9a94ae9..9a3d5d0d7ed6 100644 --- a/yarn-project/world-state/src/test/integration.test.ts +++ b/yarn-project/world-state/src/test/integration.test.ts @@ -1,7 +1,7 @@ import { MockPrefilledArchiver } from '@aztec/archiver/test'; import { type L2Block, MerkleTreeId } from '@aztec/circuit-types'; import { EthAddress, type Fr } from '@aztec/circuits.js'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { sleep } from '@aztec/foundation/sleep'; import { type DataStoreConfig } from '@aztec/kv-store/config'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; @@ -22,7 +22,7 @@ describe('world-state integration', () => { let db: NativeWorldStateService; let synchronizer: TestWorldStateSynchronizer; let config: WorldStateConfig & DataStoreConfig; - let log: DebugLogger; + let log: Logger; let blocks: L2Block[]; let messages: Fr[][]; @@ -30,7 +30,7 @@ describe('world-state integration', () => { const MAX_BLOCK_COUNT = 20; beforeAll(async () => { - log = createDebugLogger('aztec:world-state:test:integration'); + log = createLogger('world-state:test:integration'); rollupAddress = EthAddress.random(); const db = await NativeWorldStateService.tmp(rollupAddress); log.info(`Generating ${MAX_BLOCK_COUNT} mock blocks`); diff --git a/yarn-project/world-state/src/world-state-db/merkle_trees.ts b/yarn-project/world-state/src/world-state-db/merkle_trees.ts index 2842eebdae1d..35118425035f 100644 --- a/yarn-project/world-state/src/world-state-db/merkle_trees.ts +++ b/yarn-project/world-state/src/world-state-db/merkle_trees.ts @@ -31,7 +31,7 @@ import { StateReference, } from '@aztec/circuits.js'; import { padArrayEnd } from '@aztec/foundation/collection'; -import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log'; +import { type Logger, createLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { Timer, elapsed } from '@aztec/foundation/timer'; import { type IndexedTreeLeafPreimage } from '@aztec/foundation/trees'; @@ -111,7 +111,7 @@ export class MerkleTrees implements MerkleTreeAdminDatabase { private initialStateReference: AztecSingleton; private metrics: WorldStateMetrics; - private constructor(private store: AztecKVStore, private telemetryClient: TelemetryClient, private log: DebugLogger) { + private constructor(private store: AztecKVStore, private telemetryClient: TelemetryClient, private log: Logger) { this.initialStateReference = store.openSingleton('merkle_trees_initial_state_reference'); this.metrics = new WorldStateMetrics(telemetryClient); } @@ -121,7 +121,11 @@ export class MerkleTrees implements MerkleTreeAdminDatabase { * @param store - The db instance to use for data persistance. * @returns - A fully initialized MerkleTrees instance. */ - public static async new(store: AztecKVStore, client: TelemetryClient, log = createDebugLogger('aztec:merkle_trees')) { + public static async new( + store: AztecKVStore, + client: TelemetryClient, + log = createLogger('world-state:merkle_trees'), + ) { const merkleTrees = new MerkleTrees(store, client, log); await merkleTrees.#init(); return merkleTrees; @@ -239,7 +243,7 @@ export class MerkleTrees implements MerkleTreeAdminDatabase { const forked = new MerkleTrees( this.store, this.telemetryClient, - createDebugLogger('aztec:merkle_trees:ephemeral_fork'), + createLogger('world-state:merkle_trees:ephemeral_fork'), ); await forked.#init(true); return new MerkleTreeReadOperationsFacade(forked, true); diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index c53310ab30d3..28193d0a4ed0 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -260,7 +260,6 @@ __metadata: "@aztec/txe": "workspace:^" "@aztec/types": "workspace:^" "@jest/globals": ^29.5.0 - "@opentelemetry/winston-transport": ^0.7.0 "@types/chalk": ^2.2.0 "@types/jest": ^29.5.0 "@types/koa": ^2.13.6 @@ -273,8 +272,6 @@ __metadata: ts-node: ^10.9.1 typescript: ^5.0.4 viem: ^2.7.15 - winston: ^3.10.0 - winston-daily-rotate-file: ^4.7.1 bin: aztec: ./dest/bin/index.js languageName: unknown @@ -592,7 +589,6 @@ __metadata: viem: ^2.7.15 webpack: ^5.88.2 webpack-cli: ^5.1.4 - winston: ^3.10.0 zod: ^3.23.8 languageName: unknown linkType: soft @@ -666,6 +662,7 @@ __metadata: "@typescript-eslint/eslint-plugin": ^6.2.1 "@typescript-eslint/parser": ^6.2.1 bn.js: ^5.2.1 + colorette: ^2.0.20 comlink: ^4.4.1 debug: ^4.3.4 detect-node: ^2.1.0 @@ -687,6 +684,8 @@ __metadata: lodash.clonedeepwith: ^4.5.0 memdown: ^6.1.1 pako: ^2.1.0 + pino: ^9.5.0 + pino-pretty: ^13.0.0 prettier: ^2.7.1 sha3: ^2.1.4 supertest: ^6.3.3 @@ -1198,25 +1197,24 @@ __metadata: "@aztec/foundation": "workspace:^" "@jest/globals": ^29.5.0 "@opentelemetry/api": ^1.9.0 - "@opentelemetry/api-logs": ^0.54.0 - "@opentelemetry/exporter-logs-otlp-http": ^0.54.0 - "@opentelemetry/exporter-metrics-otlp-http": ^0.52.0 - "@opentelemetry/exporter-trace-otlp-http": ^0.54.0 - "@opentelemetry/host-metrics": ^0.35.2 - "@opentelemetry/otlp-exporter-base": ^0.54.0 - "@opentelemetry/resource-detector-aws": ^1.5.2 - "@opentelemetry/resources": ^1.25.0 - "@opentelemetry/sdk-logs": ^0.54.0 - "@opentelemetry/sdk-metrics": ^1.25.0 - "@opentelemetry/sdk-trace-node": ^1.25.0 - "@opentelemetry/semantic-conventions": ^1.25.0 - "@opentelemetry/winston-transport": ^0.7.0 + "@opentelemetry/api-logs": ^0.55.0 + "@opentelemetry/core": ^1.28.0 + "@opentelemetry/exporter-logs-otlp-http": ^0.55.0 + "@opentelemetry/exporter-metrics-otlp-http": ^0.55.0 + "@opentelemetry/exporter-trace-otlp-http": ^0.55.0 + "@opentelemetry/host-metrics": ^0.35.4 + "@opentelemetry/otlp-exporter-base": ^0.55.0 + "@opentelemetry/resource-detector-aws": ^1.8.0 + "@opentelemetry/resources": ^1.28.0 + "@opentelemetry/sdk-logs": ^0.55.0 + "@opentelemetry/sdk-metrics": ^1.28.0 + "@opentelemetry/sdk-trace-node": ^1.28.0 + "@opentelemetry/semantic-conventions": ^1.28.0 "@types/jest": ^29.5.0 jest: ^29.5.0 prom-client: ^15.1.3 ts-node: ^10.9.1 typescript: ^5.0.4 - winston: ^3.10.0 languageName: unknown linkType: soft @@ -1903,13 +1901,6 @@ __metadata: languageName: node linkType: hard -"@colors/colors@npm:1.6.0, @colors/colors@npm:^1.6.0": - version: 1.6.0 - resolution: "@colors/colors@npm:1.6.0" - checksum: aa209963e0c3218e80a4a20553ba8c0fbb6fa13140540b4e5f97923790be06801fc90172c1114fc8b7e888b3d012b67298cde6b9e81521361becfaee400c662f - languageName: node - linkType: hard - "@cspotcode/source-map-support@npm:^0.8.0": version: 0.8.1 resolution: "@cspotcode/source-map-support@npm:0.8.1" @@ -1919,17 +1910,6 @@ __metadata: languageName: node linkType: hard -"@dabh/diagnostics@npm:^2.0.2": - version: 2.0.3 - resolution: "@dabh/diagnostics@npm:2.0.3" - dependencies: - colorspace: 1.1.x - enabled: 2.0.x - kuler: ^2.0.0 - checksum: 4879600c55c8315a0fb85fbb19057bad1adc08f0a080a8cb4e2b63f723c379bfc4283b68123a2b078d367b327dd8df12fcb27464efe791addc0a48b9df6d79a1 - languageName: node - linkType: hard - "@dependents/detective-less@npm:^3.0.1": version: 3.0.2 resolution: "@dependents/detective-less@npm:3.0.2" @@ -3548,37 +3528,28 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/api-logs@npm:0.52.0": - version: 0.52.0 - resolution: "@opentelemetry/api-logs@npm:0.52.0" - dependencies: - "@opentelemetry/api": ^1.0.0 - checksum: 502f60fd3a4b08fb7e54eaf22d0415e34dcbc9995696945eff8a4a12910e933149900cc470fb476b9411b4bbb98f8b598e3f4d4a37137698fcf0a7ea6ab240d6 - languageName: node - linkType: hard - -"@opentelemetry/api-logs@npm:0.54.0, @opentelemetry/api-logs@npm:^0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/api-logs@npm:0.54.0" +"@opentelemetry/api-logs@npm:0.55.0, @opentelemetry/api-logs@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/api-logs@npm:0.55.0" dependencies: "@opentelemetry/api": ^1.3.0 - checksum: 5fc91054a290663844049cd9eb66419ea06d191b82220f2513147acdbd82579d1d3703a7e09f58a0014118d52b96d8b6340f9b43dd33a2c4469a31f13b3abc62 + checksum: 07833624711b4146ea4450b4ca714ada33e07a3c354feb4df08e4312a69d9fd200726deb910c8aaba17b13c52645252845ca9aa7113b78d277a806a28d0b2b90 languageName: node linkType: hard -"@opentelemetry/api@npm:^1.0.0, @opentelemetry/api@npm:^1.3.0, @opentelemetry/api@npm:^1.4.0, @opentelemetry/api@npm:^1.9.0": +"@opentelemetry/api@npm:^1.3.0, @opentelemetry/api@npm:^1.4.0, @opentelemetry/api@npm:^1.9.0": version: 1.9.0 resolution: "@opentelemetry/api@npm:1.9.0" checksum: 9e88e59d53ced668f3daaecfd721071c5b85a67dd386f1c6f051d1be54375d850016c881f656ffbe9a03bedae85f7e89c2f2b635313f9c9b195ad033cdc31020 languageName: node linkType: hard -"@opentelemetry/context-async-hooks@npm:1.25.0": - version: 1.25.0 - resolution: "@opentelemetry/context-async-hooks@npm:1.25.0" +"@opentelemetry/context-async-hooks@npm:1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/context-async-hooks@npm:1.28.0" peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: f50f6ef621b6cfaa1d0919e4470b7c8326371beaf6be9a635c6f3221677bf9f5429a81a29b5518a41d3c002e35d4a89cb748ae61f650d61aa2ae3cbe123c0301 + checksum: 23288e78e25bb8d3af216825f7108a0380044d3ca3d9d427e6a33c8dbea3c67617e5024371190a9f09e171f13c4b40afc9135a807e40e866d9b98227c6b95a89 languageName: node linkType: hard @@ -3593,179 +3564,150 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/core@npm:1.25.1, @opentelemetry/core@npm:^1.0.0": - version: 1.25.1 - resolution: "@opentelemetry/core@npm:1.25.1" +"@opentelemetry/core@npm:1.28.0, @opentelemetry/core@npm:^1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/core@npm:1.28.0" dependencies: - "@opentelemetry/semantic-conventions": 1.25.1 + "@opentelemetry/semantic-conventions": 1.27.0 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: ba1672fde4a1cfd9b55bf6070db71b808702fe59c4a70cda52a6156b2c813827954a6b4d3c3641283d394ff75a69b6359a0487459b4d26cd7d714ab3d21bc780 + checksum: ed80e0640df8ba8387e6f16ed3242891a08491f93d18106bd02ef0e6e75ad111e5f312ccf412edf8479e5800a6f27101a40d5023bd8f8566213a50a5a83e76ee languageName: node linkType: hard -"@opentelemetry/core@npm:1.27.0": - version: 1.27.0 - resolution: "@opentelemetry/core@npm:1.27.0" +"@opentelemetry/core@npm:^1.0.0": + version: 1.25.1 + resolution: "@opentelemetry/core@npm:1.25.1" dependencies: - "@opentelemetry/semantic-conventions": 1.27.0 + "@opentelemetry/semantic-conventions": 1.25.1 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 33ff551f89f0bb95830c9f9464c43b11adf88882ec1d3a03a5b9afcc89d2aafab33c36cb5047f18667d7929d6ab40ed0121649c42d0105f1cb33ffdca48f8b13 + checksum: ba1672fde4a1cfd9b55bf6070db71b808702fe59c4a70cda52a6156b2c813827954a6b4d3c3641283d394ff75a69b6359a0487459b4d26cd7d714ab3d21bc780 languageName: node linkType: hard -"@opentelemetry/exporter-logs-otlp-http@npm:^0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/exporter-logs-otlp-http@npm:0.54.0" +"@opentelemetry/exporter-logs-otlp-http@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/exporter-logs-otlp-http@npm:0.55.0" dependencies: - "@opentelemetry/api-logs": 0.54.0 - "@opentelemetry/core": 1.27.0 - "@opentelemetry/otlp-exporter-base": 0.54.0 - "@opentelemetry/otlp-transformer": 0.54.0 - "@opentelemetry/sdk-logs": 0.54.0 + "@opentelemetry/api-logs": 0.55.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/otlp-exporter-base": 0.55.0 + "@opentelemetry/otlp-transformer": 0.55.0 + "@opentelemetry/sdk-logs": 0.55.0 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 407cde2dd930aa19c0c826147d15aba84f94a58f1afbf86cfa1c41576be4492b689e1e9c7971a92805b051851cd6fab063bf24f29160b14c2d3b2cf1fded2bec + checksum: f639babc0bc62407577c1e34367a42577d242a43fb82f4c1af1fbb596fa805c6ea1b273bbfd3a49527fecfd51c42b4d43df25c308f592d5fb7dee056920e6297 languageName: node linkType: hard -"@opentelemetry/exporter-metrics-otlp-http@npm:^0.52.0": - version: 0.52.0 - resolution: "@opentelemetry/exporter-metrics-otlp-http@npm:0.52.0" +"@opentelemetry/exporter-metrics-otlp-http@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/exporter-metrics-otlp-http@npm:0.55.0" dependencies: - "@opentelemetry/core": 1.25.0 - "@opentelemetry/otlp-exporter-base": 0.52.0 - "@opentelemetry/otlp-transformer": 0.52.0 - "@opentelemetry/resources": 1.25.0 - "@opentelemetry/sdk-metrics": 1.25.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/otlp-exporter-base": 0.55.0 + "@opentelemetry/otlp-transformer": 0.55.0 + "@opentelemetry/resources": 1.28.0 + "@opentelemetry/sdk-metrics": 1.28.0 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 8438733189879e3162ab4a374d7f22a4f9655257cbcde156f1041954cbc86bfab7299e696df49187684f1c219a76b263e6489c411b7008b81a05d5b0e7dcd92d + checksum: 236713540b5a5d0c6921cf0756ced5ffdd5952a4ec5d15d11363dff8ff4a576857d39007e99da45097b69bd09ae62119b1fa49de65edc1f5fa22037582c43cfe languageName: node linkType: hard -"@opentelemetry/exporter-trace-otlp-http@npm:^0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/exporter-trace-otlp-http@npm:0.54.0" +"@opentelemetry/exporter-trace-otlp-http@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/exporter-trace-otlp-http@npm:0.55.0" dependencies: - "@opentelemetry/core": 1.27.0 - "@opentelemetry/otlp-exporter-base": 0.54.0 - "@opentelemetry/otlp-transformer": 0.54.0 - "@opentelemetry/resources": 1.27.0 - "@opentelemetry/sdk-trace-base": 1.27.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/otlp-exporter-base": 0.55.0 + "@opentelemetry/otlp-transformer": 0.55.0 + "@opentelemetry/resources": 1.28.0 + "@opentelemetry/sdk-trace-base": 1.28.0 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: e53263c3ffcfe62d7d299efac9515a977d284aabc4c89a961cec60853095f24e439abae348c326c7bd88911a85d08dd57833a64769e20254d02df8ac73e9b277 + checksum: e842ea7b24b6db7e0f9adc3ace81f682e7634c3ca25721c63313fea7711cf77085e77111cb113c0b7dad098332aa88a7ae96d7420e371cb1ff1b3116908b750f languageName: node linkType: hard -"@opentelemetry/host-metrics@npm:^0.35.2": - version: 0.35.2 - resolution: "@opentelemetry/host-metrics@npm:0.35.2" +"@opentelemetry/host-metrics@npm:^0.35.4": + version: 0.35.4 + resolution: "@opentelemetry/host-metrics@npm:0.35.4" dependencies: "@opentelemetry/sdk-metrics": ^1.8.0 systeminformation: 5.22.9 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 541df2585f9cbf8b6606f6782a2d351383f7a5b0a92b92ad4011ac46adac513474463d0c2474d6902d9d6d3b633be67c60ea0716ea2de277cebc1cb2538fa7a4 + checksum: d0be6116f5ffb81937820f887721da6a1ae841816d3c98159b94adc6146cf1ad1558527b9ed033b58db5439049bfde076842ac0b8ed57e819664f5a03f9e6c73 languageName: node linkType: hard -"@opentelemetry/otlp-exporter-base@npm:0.52.0": - version: 0.52.0 - resolution: "@opentelemetry/otlp-exporter-base@npm:0.52.0" +"@opentelemetry/otlp-exporter-base@npm:0.55.0, @opentelemetry/otlp-exporter-base@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/otlp-exporter-base@npm:0.55.0" dependencies: - "@opentelemetry/core": 1.25.0 - "@opentelemetry/otlp-transformer": 0.52.0 - peerDependencies: - "@opentelemetry/api": ^1.0.0 - checksum: 5230ba86d274f4d05fa2820a21e8278d796a299299e2af96150085c871427fe5ef4c6fa4954cdc1b8cdd0a87d5d6677ca0e547cc51253968572a6ede51f63ea2 - languageName: node - linkType: hard - -"@opentelemetry/otlp-exporter-base@npm:0.54.0, @opentelemetry/otlp-exporter-base@npm:^0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/otlp-exporter-base@npm:0.54.0" - dependencies: - "@opentelemetry/core": 1.27.0 - "@opentelemetry/otlp-transformer": 0.54.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/otlp-transformer": 0.55.0 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: ded78325f22cd98314971216eb18d8f021a6cf7f3b1f69d08b0d257880deb2d409d598bfc3a6016b0557a1ec3b0c50527ba9acf09d4e3902f48d003f763441c0 - languageName: node - linkType: hard - -"@opentelemetry/otlp-transformer@npm:0.52.0": - version: 0.52.0 - resolution: "@opentelemetry/otlp-transformer@npm:0.52.0" - dependencies: - "@opentelemetry/api-logs": 0.52.0 - "@opentelemetry/core": 1.25.0 - "@opentelemetry/resources": 1.25.0 - "@opentelemetry/sdk-logs": 0.52.0 - "@opentelemetry/sdk-metrics": 1.25.0 - "@opentelemetry/sdk-trace-base": 1.25.0 - protobufjs: ^7.3.0 - peerDependencies: - "@opentelemetry/api": ">=1.3.0 <1.10.0" - checksum: 5f75f41a710e5e536faecdec7b1687352e450d185d12613bbcbb206570d96ca2833db15e1d7945cb27040a04c017135b07df2f607ccf9ca9a061f86ad87e8c35 + checksum: 1d4806bd7d36565c5165699b98f99cf00a7aaed23938bf039082550b5b2f973cfb056f71a6ec0317b5113647434d17dd48d9ab0b5fd4c7103beef97c8aa3bec6 languageName: node linkType: hard -"@opentelemetry/otlp-transformer@npm:0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/otlp-transformer@npm:0.54.0" +"@opentelemetry/otlp-transformer@npm:0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/otlp-transformer@npm:0.55.0" dependencies: - "@opentelemetry/api-logs": 0.54.0 - "@opentelemetry/core": 1.27.0 - "@opentelemetry/resources": 1.27.0 - "@opentelemetry/sdk-logs": 0.54.0 - "@opentelemetry/sdk-metrics": 1.27.0 - "@opentelemetry/sdk-trace-base": 1.27.0 + "@opentelemetry/api-logs": 0.55.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/resources": 1.28.0 + "@opentelemetry/sdk-logs": 0.55.0 + "@opentelemetry/sdk-metrics": 1.28.0 + "@opentelemetry/sdk-trace-base": 1.28.0 protobufjs: ^7.3.0 peerDependencies: "@opentelemetry/api": ^1.3.0 - checksum: 69451290ec2c65ee27f35b29d41a1b961d169ff928d231805c2694cbc4b4bda788027cf8149a6a1325da7c3bc2ca20dc939ef91a4f3e2af481ed187653386610 + checksum: eaca0c0a428e4b5fb24a770d89767d278f1fbfbafcec7e126d5f06fc090ef74af8b5feadc031682749bb9231862c412a7452029d16c281f7a9a3f791130c2ec5 languageName: node linkType: hard -"@opentelemetry/propagator-b3@npm:1.25.0": - version: 1.25.0 - resolution: "@opentelemetry/propagator-b3@npm:1.25.0" +"@opentelemetry/propagator-b3@npm:1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/propagator-b3@npm:1.28.0" dependencies: - "@opentelemetry/core": 1.25.0 + "@opentelemetry/core": 1.28.0 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 5e8a0feec400ebb20644ee217f904ec8894ccad49b753e80c5e131a4f3390504ca3fd17de58ff546313dedc6498dbd198ff83acc3d8084a205e1d901cfc0bb2d + checksum: 793812d47fde1cd55239ebc941b2439e18c226c4d29eb92168cce89c9305865a7058f397ff2f7d9ef5dc3d9cd7ac29c52bcb6c7d25947269d3d02c05643e371b languageName: node linkType: hard -"@opentelemetry/propagator-jaeger@npm:1.25.0": - version: 1.25.0 - resolution: "@opentelemetry/propagator-jaeger@npm:1.25.0" +"@opentelemetry/propagator-jaeger@npm:1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/propagator-jaeger@npm:1.28.0" dependencies: - "@opentelemetry/core": 1.25.0 + "@opentelemetry/core": 1.28.0 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: c652b4285e254041654a5153649f822b8e2eaa526b67e0a8c56c4eb173d9d0d0efa41ffed3f7dcdd1c2c2b85365cd05e001ee145e8701e4af9d7eef79488ca18 + checksum: 887589595a906a309e9962efcbc7940f37b85b6934d4910141de73b034c155d1309d336e259743a23684a7aa4669d6eeee89639ed33f97d1a0e8d8394251857f languageName: node linkType: hard -"@opentelemetry/resource-detector-aws@npm:^1.5.2": - version: 1.5.2 - resolution: "@opentelemetry/resource-detector-aws@npm:1.5.2" +"@opentelemetry/resource-detector-aws@npm:^1.8.0": + version: 1.8.0 + resolution: "@opentelemetry/resource-detector-aws@npm:1.8.0" dependencies: "@opentelemetry/core": ^1.0.0 - "@opentelemetry/resources": ^1.0.0 - "@opentelemetry/semantic-conventions": ^1.22.0 + "@opentelemetry/resources": ^1.10.0 + "@opentelemetry/semantic-conventions": ^1.27.0 peerDependencies: "@opentelemetry/api": ^1.0.0 - checksum: c58274117fb6a44593aab1135f11d39770a69a1a14108a826086a36a7108de13d0d9df333cf5533e98d40f751b20d8a3284426bfcd5dcc941157458bbba7fe1c + checksum: 7f393a3b3a9e1c015db188ea4b7ee651c0d7dc196bd574eb6bebec0a7ff93cbd652afcf1cdd02e97e56c0c53b3987487483f73ddd3323f2ba427af5f752ff806 languageName: node linkType: hard -"@opentelemetry/resources@npm:1.25.0, @opentelemetry/resources@npm:^1.25.0": +"@opentelemetry/resources@npm:1.25.0": version: 1.25.0 resolution: "@opentelemetry/resources@npm:1.25.0" dependencies: @@ -3777,57 +3719,44 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/resources@npm:1.27.0": - version: 1.27.0 - resolution: "@opentelemetry/resources@npm:1.27.0" +"@opentelemetry/resources@npm:1.28.0, @opentelemetry/resources@npm:^1.10.0, @opentelemetry/resources@npm:^1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/resources@npm:1.28.0" dependencies: - "@opentelemetry/core": 1.27.0 + "@opentelemetry/core": 1.28.0 "@opentelemetry/semantic-conventions": 1.27.0 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 43d298afea7daf7524e6b98c1441bcce9fa73b76aecf17e36cabb1a4cfaae6818acf9759d3e42706b1fd91243644076d2291e78c3ed81641d3b351fcff6cb9a9 - languageName: node - linkType: hard - -"@opentelemetry/resources@npm:^1.0.0": - version: 1.25.1 - resolution: "@opentelemetry/resources@npm:1.25.1" - dependencies: - "@opentelemetry/core": 1.25.1 - "@opentelemetry/semantic-conventions": 1.25.1 - peerDependencies: - "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 806e5aabbc93afcab767dc84707f702ca51bbc93e4565eb69a8591ed2fe78439aca19c5ca0d9f044c85ed97b9efb35936fdb65bef01f5f3e68504002c8a07220 + checksum: b5cb13b75e5da1ef306885cef06e68dc41197c0a25f37fc3029941de8912b0efac089b084fd38c2819a70d01c3b70bc781a60f776bb68ec901b9dfd24eb3a834 languageName: node linkType: hard -"@opentelemetry/sdk-logs@npm:0.52.0": - version: 0.52.0 - resolution: "@opentelemetry/sdk-logs@npm:0.52.0" +"@opentelemetry/sdk-logs@npm:0.55.0, @opentelemetry/sdk-logs@npm:^0.55.0": + version: 0.55.0 + resolution: "@opentelemetry/sdk-logs@npm:0.55.0" dependencies: - "@opentelemetry/api-logs": 0.52.0 - "@opentelemetry/core": 1.25.0 - "@opentelemetry/resources": 1.25.0 + "@opentelemetry/api-logs": 0.55.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/resources": 1.28.0 peerDependencies: "@opentelemetry/api": ">=1.4.0 <1.10.0" - checksum: 7bf7aed40a168866d76e2260237f6cec9c82acaebcc02a3597985b2be644e4aebf69e0f57739e7fd7cc8e75ecd0bdc98b0429ea985d7de6064148477ffd6432e + checksum: 7e8d05d302759341f10d2c853378a0556bea295660419103b2be906b933ca660704bf1cdac30fc803a4bd7ed852f0a626e8774a6307e57aafcf08e67d3fcd737 languageName: node linkType: hard -"@opentelemetry/sdk-logs@npm:0.54.0, @opentelemetry/sdk-logs@npm:^0.54.0": - version: 0.54.0 - resolution: "@opentelemetry/sdk-logs@npm:0.54.0" +"@opentelemetry/sdk-metrics@npm:1.28.0, @opentelemetry/sdk-metrics@npm:^1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/sdk-metrics@npm:1.28.0" dependencies: - "@opentelemetry/api-logs": 0.54.0 - "@opentelemetry/core": 1.27.0 - "@opentelemetry/resources": 1.27.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/resources": 1.28.0 peerDependencies: - "@opentelemetry/api": ">=1.4.0 <1.10.0" - checksum: fd6db65af6d7afdb454eac1df8a4029d3d287d37e9289a4d128bea07995e8843b7b1e5d1f39aa39538397ce1b6bf624cc2548f40dc18324ba3bbaec86dd845b9 + "@opentelemetry/api": ">=1.3.0 <1.10.0" + checksum: b1a42fbad2046f21e384185b1559e198bb23bdfcd5970fc7f3a3cc4cfe5fb37ab8a6f29deef1b6753eb6a68e2c3b19c6d8a4957be4024af0ac0165eea24c051f languageName: node linkType: hard -"@opentelemetry/sdk-metrics@npm:1.25.0, @opentelemetry/sdk-metrics@npm:^1.25.0, @opentelemetry/sdk-metrics@npm:^1.8.0": +"@opentelemetry/sdk-metrics@npm:^1.8.0": version: 1.25.0 resolution: "@opentelemetry/sdk-metrics@npm:1.25.0" dependencies: @@ -3840,68 +3769,43 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/sdk-metrics@npm:1.27.0": - version: 1.27.0 - resolution: "@opentelemetry/sdk-metrics@npm:1.27.0" - dependencies: - "@opentelemetry/core": 1.27.0 - "@opentelemetry/resources": 1.27.0 - peerDependencies: - "@opentelemetry/api": ">=1.3.0 <1.10.0" - checksum: c8776577063a3a5199d5717247270daf5820ce6636530b5ea4b5a8d6b40170cec9bb6b56dacb5c118d2e90588af83d0ebbb13f4d370c7efe50f69d22e5d13463 - languageName: node - linkType: hard - -"@opentelemetry/sdk-trace-base@npm:1.25.0": - version: 1.25.0 - resolution: "@opentelemetry/sdk-trace-base@npm:1.25.0" - dependencies: - "@opentelemetry/core": 1.25.0 - "@opentelemetry/resources": 1.25.0 - "@opentelemetry/semantic-conventions": 1.25.0 - peerDependencies: - "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 4c0ce40dbe9dcf5e5f79c60c44ffadb6806f1a8cf45c13d901ea6a2345f6cf26a83a1dad4358859fcf941e01f8bd8654f907f88137d5051e023211f8d645e959 - languageName: node - linkType: hard - -"@opentelemetry/sdk-trace-base@npm:1.27.0": - version: 1.27.0 - resolution: "@opentelemetry/sdk-trace-base@npm:1.27.0" +"@opentelemetry/sdk-trace-base@npm:1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/sdk-trace-base@npm:1.28.0" dependencies: - "@opentelemetry/core": 1.27.0 - "@opentelemetry/resources": 1.27.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/resources": 1.28.0 "@opentelemetry/semantic-conventions": 1.27.0 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: d28c36724aeaf4884f7957e2ab138d9a0ca715a68b2ad23e2935ff0e39cd438c57fd0c8cc85fd5e280464857ede1ae8f9c8e40a37088a1e34d2e625e77276fee + checksum: 13828679153d1690384a57e17709c18a76dcee680e92c7f64c85bf6dc5771cc05f1eb70f64c726859718fe494428aab049511d26bd39fa4d9ebd5270ca39eca0 languageName: node linkType: hard -"@opentelemetry/sdk-trace-node@npm:^1.25.0": - version: 1.25.0 - resolution: "@opentelemetry/sdk-trace-node@npm:1.25.0" +"@opentelemetry/sdk-trace-node@npm:^1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/sdk-trace-node@npm:1.28.0" dependencies: - "@opentelemetry/context-async-hooks": 1.25.0 - "@opentelemetry/core": 1.25.0 - "@opentelemetry/propagator-b3": 1.25.0 - "@opentelemetry/propagator-jaeger": 1.25.0 - "@opentelemetry/sdk-trace-base": 1.25.0 + "@opentelemetry/context-async-hooks": 1.28.0 + "@opentelemetry/core": 1.28.0 + "@opentelemetry/propagator-b3": 1.28.0 + "@opentelemetry/propagator-jaeger": 1.28.0 + "@opentelemetry/sdk-trace-base": 1.28.0 semver: ^7.5.2 peerDependencies: "@opentelemetry/api": ">=1.0.0 <1.10.0" - checksum: 22a0a61a6c092841ef4438f914edd259d3025078cc9331aaac340c624c2963aa6fdc4970ade5a0e6647c64e92e893ebde0b8ecdd021abac5358ea3c814a5c01c + checksum: 60868374d1eda9de8835b819a3fab2db2dae640a6253c0d12affe254dcdb02a7e79e7f151e2e09773bbf167e428c5582b810884870b8497dbd28886eb144241d languageName: node linkType: hard -"@opentelemetry/semantic-conventions@npm:1.25.0, @opentelemetry/semantic-conventions@npm:^1.25.0": +"@opentelemetry/semantic-conventions@npm:1.25.0": version: 1.25.0 resolution: "@opentelemetry/semantic-conventions@npm:1.25.0" checksum: 8c9d36f57f0d3d1d4945effe626894ffea860b4be4d5257666ee28b90843ce22694c5b01f9b25ed47a08043958b7e89a65b7ae8e4128f5ed72dcdfe71ac7a19a languageName: node linkType: hard -"@opentelemetry/semantic-conventions@npm:1.25.1, @opentelemetry/semantic-conventions@npm:^1.22.0": +"@opentelemetry/semantic-conventions@npm:1.25.1": version: 1.25.1 resolution: "@opentelemetry/semantic-conventions@npm:1.25.1" checksum: fea418a4b09c55121c6da11c49dd2105116533838c484aead17e8acf8029dad711e145849812f9c61f9e48fad8e2b6cf103d2c18847ca993032ce9b27c2f863d @@ -3915,13 +3819,10 @@ __metadata: languageName: node linkType: hard -"@opentelemetry/winston-transport@npm:^0.7.0": - version: 0.7.0 - resolution: "@opentelemetry/winston-transport@npm:0.7.0" - dependencies: - "@opentelemetry/api-logs": ^0.54.0 - winston-transport: 4.* - checksum: a75d1915e90ab9beaec842fe2f2ce053ea2b43001d8be7cfd47945fa6e1dee6e1d1b5850becb72c9553edb6904844b685df838a1a2cbea0f2f6edf6ce85dc3bb +"@opentelemetry/semantic-conventions@npm:^1.27.0, @opentelemetry/semantic-conventions@npm:^1.28.0": + version: 1.28.0 + resolution: "@opentelemetry/semantic-conventions@npm:1.28.0" + checksum: 1d708afa654990236cdb6b5da84f7ab899b70bff9f753bc49d93616a5c7f7f339ba1eba6a9fbb57dee596995334f4e7effa57a4624741882ab5b3c419c3511e2 languageName: node linkType: hard @@ -5195,13 +5096,6 @@ __metadata: languageName: node linkType: hard -"@types/triple-beam@npm:^1.3.2": - version: 1.3.5 - resolution: "@types/triple-beam@npm:1.3.5" - checksum: 519b6a1b30d4571965c9706ad5400a200b94e4050feca3e7856e3ea7ac00ec9903e32e9a10e2762d0f7e472d5d03e5f4b29c16c0bd8c1f77c8876c683b2231f1 - languageName: node - linkType: hard - "@types/wrap-ansi@npm:^3.0.0": version: 3.0.0 resolution: "@types/wrap-ansi@npm:3.0.0" @@ -5728,15 +5622,6 @@ __metadata: languageName: node linkType: hard -"abort-controller@npm:^3.0.0": - version: 3.0.0 - resolution: "abort-controller@npm:3.0.0" - dependencies: - event-target-shim: ^5.0.0 - checksum: 170bdba9b47b7e65906a28c8ce4f38a7a369d78e2271706f020849c1bfe0ee2067d4261df8bbb66eb84f79208fd5b710df759d64191db58cfba7ce8ef9c54b75 - languageName: node - linkType: hard - "abortable-iterator@npm:^5.0.1": version: 5.0.1 resolution: "abortable-iterator@npm:5.0.1" @@ -6274,13 +6159,6 @@ __metadata: languageName: node linkType: hard -"async@npm:^3.2.3": - version: 3.2.5 - resolution: "async@npm:3.2.5" - checksum: 5ec77f1312301dee02d62140a6b1f7ee0edd2a0f983b6fd2b0849b969f245225b990b47b8243e7b9ad16451a53e7f68e753700385b706198ced888beedba3af4 - languageName: node - linkType: hard - "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -6288,6 +6166,13 @@ __metadata: languageName: node linkType: hard +"atomic-sleep@npm:^1.0.0": + version: 1.0.0 + resolution: "atomic-sleep@npm:1.0.0" + checksum: b95275afb2f80732f22f43a60178430c468906a415a7ff18bcd0feeebc8eec3930b51250aeda91a476062a90e07132b43a1794e8d8ffcf9b650e8139be75fa36 + languageName: node + linkType: hard + "available-typed-arrays@npm:^1.0.7": version: 1.0.7 resolution: "available-typed-arrays@npm:1.0.7" @@ -7336,7 +7221,7 @@ __metadata: languageName: node linkType: hard -"color-convert@npm:^1.9.0, color-convert@npm:^1.9.3": +"color-convert@npm:^1.9.0": version: 1.9.3 resolution: "color-convert@npm:1.9.3" dependencies: @@ -7361,50 +7246,20 @@ __metadata: languageName: node linkType: hard -"color-name@npm:^1.0.0, color-name@npm:^1.1.4, color-name@npm:~1.1.4": +"color-name@npm:^1.1.4, color-name@npm:~1.1.4": version: 1.1.4 resolution: "color-name@npm:1.1.4" checksum: b0445859521eb4021cd0fb0cc1a75cecf67fceecae89b63f62b201cca8d345baf8b952c966862a9d9a2632987d4f6581f0ec8d957dfacece86f0a7919316f610 languageName: node linkType: hard -"color-string@npm:^1.6.0": - version: 1.9.1 - resolution: "color-string@npm:1.9.1" - dependencies: - color-name: ^1.0.0 - simple-swizzle: ^0.2.2 - checksum: c13fe7cff7885f603f49105827d621ce87f4571d78ba28ef4a3f1a104304748f620615e6bf065ecd2145d0d9dad83a3553f52bb25ede7239d18e9f81622f1cc5 - languageName: node - linkType: hard - -"color@npm:^3.1.3": - version: 3.2.1 - resolution: "color@npm:3.2.1" - dependencies: - color-convert: ^1.9.3 - color-string: ^1.6.0 - checksum: f81220e8b774d35865c2561be921f5652117638dcda7ca4029262046e37fc2444ac7bbfdd110cf1fd9c074a4ee5eda8f85944ffbdda26186b602dd9bb05f6400 - languageName: node - linkType: hard - -"colorette@npm:^2.0.10, colorette@npm:^2.0.14": +"colorette@npm:^2.0.10, colorette@npm:^2.0.14, colorette@npm:^2.0.20, colorette@npm:^2.0.7": version: 2.0.20 resolution: "colorette@npm:2.0.20" checksum: 0c016fea2b91b733eb9f4bcdb580018f52c0bc0979443dad930e5037a968237ac53d9beb98e218d2e9235834f8eebce7f8e080422d6194e957454255bde71d3d languageName: node linkType: hard -"colorspace@npm:1.1.x": - version: 1.1.4 - resolution: "colorspace@npm:1.1.4" - dependencies: - color: ^3.1.3 - text-hex: 1.0.x - checksum: bb3934ef3c417e961e6d03d7ca60ea6e175947029bfadfcdb65109b01881a1c0ecf9c2b0b59abcd0ee4a0d7c1eae93beed01b0e65848936472270a0b341ebce8 - languageName: node - linkType: hard - "combine-source-map@npm:^0.8.0, combine-source-map@npm:~0.8.0": version: 0.8.0 resolution: "combine-source-map@npm:0.8.0" @@ -8161,6 +8016,13 @@ __metadata: languageName: node linkType: hard +"dateformat@npm:^4.6.3": + version: 4.6.3 + resolution: "dateformat@npm:4.6.3" + checksum: c3aa0617c0a5b30595122bc8d1bee6276a9221e4d392087b41cbbdf175d9662ae0e50d0d6dcdf45caeac5153c4b5b0844265f8cd2b2245451e3da19e39e3b65d + languageName: node + linkType: hard + "debounce@npm:^1.2.0": version: 1.2.1 resolution: "debounce@npm:1.2.1" @@ -8915,13 +8777,6 @@ __metadata: languageName: node linkType: hard -"enabled@npm:2.0.x": - version: 2.0.0 - resolution: "enabled@npm:2.0.0" - checksum: 9d256d89f4e8a46ff988c6a79b22fa814b4ffd82826c4fdacd9b42e9b9465709d3b748866d0ab4d442dfc6002d81de7f7b384146ccd1681f6a7f868d2acca063 - languageName: node - linkType: hard - "encodeurl@npm:^1.0.2, encodeurl@npm:~1.0.2": version: 1.0.2 resolution: "encodeurl@npm:1.0.2" @@ -9577,13 +9432,6 @@ __metadata: languageName: node linkType: hard -"event-target-shim@npm:^5.0.0": - version: 5.0.1 - resolution: "event-target-shim@npm:5.0.1" - checksum: 1ffe3bb22a6d51bdeb6bf6f7cf97d2ff4a74b017ad12284cc9e6a279e727dc30a5de6bb613e5596ff4dc3e517841339ad09a7eec44266eccb1aa201a30448166 - languageName: node - linkType: hard - "eventemitter3@npm:^4.0.0": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" @@ -9753,6 +9601,13 @@ __metadata: languageName: node linkType: hard +"fast-copy@npm:^3.0.2": + version: 3.0.2 + resolution: "fast-copy@npm:3.0.2" + checksum: 47f584bcede08ab3198559d3e0e093a547d567715b86be2198da6e3366c3c73eed550d97b86f9fb90dae179982b89c15d68187def960f522cdce14bacdfc6184 + languageName: node + linkType: hard + "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -9794,6 +9649,13 @@ __metadata: languageName: node linkType: hard +"fast-redact@npm:^3.1.1": + version: 3.5.0 + resolution: "fast-redact@npm:3.5.0" + checksum: ef03f0d1849da074a520a531ad299bf346417b790a643931ab4e01cb72275c8d55b60dc8512fb1f1818647b696790edefaa96704228db9f012da935faa1940af + languageName: node + linkType: hard + "fast-safe-stringify@npm:^2.0.7, fast-safe-stringify@npm:^2.1.1": version: 2.1.1 resolution: "fast-safe-stringify@npm:2.1.1" @@ -9851,13 +9713,6 @@ __metadata: languageName: node linkType: hard -"fecha@npm:^4.2.0": - version: 4.2.3 - resolution: "fecha@npm:4.2.3" - checksum: f94e2fb3acf5a7754165d04549460d3ae6c34830394d20c552197e3e000035d69732d74af04b9bed3283bf29fe2a9ebdcc0085e640b0be3cc3658b9726265e31 - languageName: node - linkType: hard - "fflate@npm:^0.8.0": version: 0.8.2 resolution: "fflate@npm:0.8.2" @@ -9874,15 +9729,6 @@ __metadata: languageName: node linkType: hard -"file-stream-rotator@npm:^0.6.1": - version: 0.6.1 - resolution: "file-stream-rotator@npm:0.6.1" - dependencies: - moment: ^2.29.1 - checksum: ebdf6a9e7ca886a50f4dafb2284d4569cefd5bdf4e4451ead25f4d68b7f9776b2620a3d110d534edd40935d1e17f37d818e2129303201870ff89c71b19b49ac1 - languageName: node - linkType: hard - "file-uri-to-path@npm:1.0.0": version: 1.0.0 resolution: "file-uri-to-path@npm:1.0.0" @@ -10009,13 +9855,6 @@ __metadata: languageName: node linkType: hard -"fn.name@npm:1.x.x": - version: 1.1.0 - resolution: "fn.name@npm:1.1.0" - checksum: e357144f48cfc9a7f52a82bbc6c23df7c8de639fce049cac41d41d62cabb740cdb9f14eddc6485e29c933104455bdd7a69bb14a9012cef9cd4fa252a4d0cf293 - languageName: node - linkType: hard - "follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.12.1, follow-redirects@npm:^1.15.6": version: 1.15.6 resolution: "follow-redirects@npm:1.15.6" @@ -10639,6 +10478,13 @@ __metadata: languageName: node linkType: hard +"help-me@npm:^5.0.0": + version: 5.0.0 + resolution: "help-me@npm:5.0.0" + checksum: 474436627b6c7d2f406a2768453895889eb2712c8ded4c47658d5c6dd46c2ff3f742be4e4e8dedd57b7f1ac6b28803896a2e026a32a977f507222c16f23ab2e1 + languageName: node + linkType: hard + "hexoid@npm:^1.0.0": version: 1.0.0 resolution: "hexoid@npm:1.0.0" @@ -11173,13 +11019,6 @@ __metadata: languageName: node linkType: hard -"is-arrayish@npm:^0.3.1": - version: 0.3.2 - resolution: "is-arrayish@npm:0.3.2" - checksum: 977e64f54d91c8f169b59afcd80ff19227e9f5c791fa28fa2e5bce355cbaf6c2c356711b734656e80c9dd4a854dd7efcf7894402f1031dfc5de5d620775b4d5f - languageName: node - linkType: hard - "is-bigint@npm:^1.0.1": version: 1.0.4 resolution: "is-bigint@npm:1.0.4" @@ -12434,6 +12273,13 @@ __metadata: languageName: node linkType: hard +"joycon@npm:^3.1.1": + version: 3.1.1 + resolution: "joycon@npm:3.1.1" + checksum: 8003c9c3fc79c5c7602b1c7e9f7a2df2e9916f046b0dbad862aa589be78c15734d11beb9fe846f5e06138df22cb2ad29961b6a986ba81c4920ce2b15a7f11067 + languageName: node + linkType: hard + "js-sha3@npm:0.8.0": version: 0.8.0 resolution: "js-sha3@npm:0.8.0" @@ -12740,13 +12586,6 @@ __metadata: languageName: node linkType: hard -"kuler@npm:^2.0.0": - version: 2.0.0 - resolution: "kuler@npm:2.0.0" - checksum: 9e10b5a1659f9ed8761d38df3c35effabffbd19fc6107324095238e4ef0ff044392cae9ac64a1c2dda26e532426485342226b93806bd97504b174b0dcf04ed81 - languageName: node - linkType: hard - "labeled-stream-splicer@npm:^2.0.0": version: 2.0.2 resolution: "labeled-stream-splicer@npm:2.0.2" @@ -13076,34 +12915,6 @@ __metadata: languageName: node linkType: hard -"logform@npm:^2.3.2, logform@npm:^2.4.0": - version: 2.6.0 - resolution: "logform@npm:2.6.0" - dependencies: - "@colors/colors": 1.6.0 - "@types/triple-beam": ^1.3.2 - fecha: ^4.2.0 - ms: ^2.1.1 - safe-stable-stringify: ^2.3.1 - triple-beam: ^1.3.0 - checksum: b9ea74bb75e55379ad0eb3e4d65ae6e8d02bc45b431c218162878bf663997ab9258a73104c2b30e09dd2db288bb83c8bf8748e46689d75f5e7e34cf69378d6df - languageName: node - linkType: hard - -"logform@npm:^2.6.1": - version: 2.6.1 - resolution: "logform@npm:2.6.1" - dependencies: - "@colors/colors": 1.6.0 - "@types/triple-beam": ^1.3.2 - fecha: ^4.2.0 - ms: ^2.1.1 - safe-stable-stringify: ^2.3.1 - triple-beam: ^1.3.0 - checksum: 0c6b95fa8350ccc33c7c33d77de2a9920205399706fc1b125151c857b61eb90873f4670d9e0e58e58c165b68a363206ae670d6da8b714527c838da3c84449605 - languageName: node - linkType: hard - "long@npm:^5.0.0": version: 5.2.3 resolution: "long@npm:5.2.3" @@ -13751,13 +13562,6 @@ __metadata: languageName: node linkType: hard -"moment@npm:^2.29.1": - version: 2.30.1 - resolution: "moment@npm:2.30.1" - checksum: 859236bab1e88c3e5802afcf797fc801acdbd0ee509d34ea3df6eea21eb6bcc2abd4ae4e4e64aa7c986aa6cba563c6e62806218e6412a765010712e5fa121ba6 - languageName: node - linkType: hard - "morphdom@npm:^2.3.3": version: 2.7.4 resolution: "morphdom@npm:2.7.4" @@ -14200,13 +14004,6 @@ __metadata: languageName: node linkType: hard -"object-hash@npm:^2.0.1": - version: 2.2.0 - resolution: "object-hash@npm:2.2.0" - checksum: 55ba841e3adce9c4f1b9b46b41983eda40f854e0d01af2802d3ae18a7085a17168d6b81731d43fdf1d6bcbb3c9f9c56d22c8fea992203ad90a38d7d919bc28f1 - languageName: node - linkType: hard - "object-inspect@npm:^1.13.1": version: 1.13.1 resolution: "object-inspect@npm:1.13.1" @@ -14281,6 +14078,13 @@ __metadata: languageName: node linkType: hard +"on-exit-leak-free@npm:^2.1.0": + version: 2.1.2 + resolution: "on-exit-leak-free@npm:2.1.2" + checksum: 6ce7acdc7b9ceb51cf029b5239cbf41937ee4c8dcd9d4e475e1777b41702564d46caa1150a744e00da0ac6d923ab83471646a39a4470f97481cf6e2d8d253c3f + languageName: node + linkType: hard + "on-finished@npm:2.4.1, on-finished@npm:^2.3.0, on-finished@npm:^2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -14313,15 +14117,6 @@ __metadata: languageName: node linkType: hard -"one-time@npm:^1.0.0": - version: 1.0.0 - resolution: "one-time@npm:1.0.0" - dependencies: - fn.name: 1.x.x - checksum: fd008d7e992bdec1c67f53a2f9b46381ee12a9b8c309f88b21f0223546003fb47e8ad7c1fd5843751920a8d276c63bd4b45670ef80c61fb3e07dbccc962b5c7d - languageName: node - linkType: hard - "onetime@npm:^5.1.0, onetime@npm:^5.1.2": version: 5.1.2 resolution: "onetime@npm:5.1.2" @@ -14802,6 +14597,66 @@ __metadata: languageName: node linkType: hard +"pino-abstract-transport@npm:^2.0.0": + version: 2.0.0 + resolution: "pino-abstract-transport@npm:2.0.0" + dependencies: + split2: ^4.0.0 + checksum: 4db0cd8a1a7b6d13e76dbb58e6adc057c39e4591c70f601f4a427c030d57dff748ab53954e1ecd3aa6e21c1a22dd38de96432606c6d906a7b9f610543bf1d6e2 + languageName: node + linkType: hard + +"pino-pretty@npm:^13.0.0": + version: 13.0.0 + resolution: "pino-pretty@npm:13.0.0" + dependencies: + colorette: ^2.0.7 + dateformat: ^4.6.3 + fast-copy: ^3.0.2 + fast-safe-stringify: ^2.1.1 + help-me: ^5.0.0 + joycon: ^3.1.1 + minimist: ^1.2.6 + on-exit-leak-free: ^2.1.0 + pino-abstract-transport: ^2.0.0 + pump: ^3.0.0 + secure-json-parse: ^2.4.0 + sonic-boom: ^4.0.1 + strip-json-comments: ^3.1.1 + bin: + pino-pretty: bin.js + checksum: a529219b3ccc99ed6a3e2de00ae6a8d4003344614bce39f836352317c962db8c3f4e9ee45843edc218cb9be618a7318b06fa6fab366d4314b9297d0130bc06f5 + languageName: node + linkType: hard + +"pino-std-serializers@npm:^7.0.0": + version: 7.0.0 + resolution: "pino-std-serializers@npm:7.0.0" + checksum: 08cd1d7b7adc4cfca39e42c2d5fd21bcf4513153734e7b8fa278b0e9e9f62df78c4c202886343fe882a462539c931cb8110b661775ad7f7217c96856795b5a86 + languageName: node + linkType: hard + +"pino@npm:^9.5.0": + version: 9.5.0 + resolution: "pino@npm:9.5.0" + dependencies: + atomic-sleep: ^1.0.0 + fast-redact: ^3.1.1 + on-exit-leak-free: ^2.1.0 + pino-abstract-transport: ^2.0.0 + pino-std-serializers: ^7.0.0 + process-warning: ^4.0.0 + quick-format-unescaped: ^4.0.3 + real-require: ^0.2.0 + safe-stable-stringify: ^2.3.1 + sonic-boom: ^4.0.1 + thread-stream: ^3.0.0 + bin: + pino: bin.js + checksum: 650c3087619a619e92948641f0d9acc60cca594175b02fe1ce9c0923a8d07a8d120866f50b0848c26a5898837b8c1ae086adf67066180f686ea21e6e515a8558 + languageName: node + linkType: hard + "pirates@npm:^4.0.4": version: 4.0.6 resolution: "pirates@npm:4.0.6" @@ -15022,6 +14877,13 @@ __metadata: languageName: node linkType: hard +"process-warning@npm:^4.0.0": + version: 4.0.0 + resolution: "process-warning@npm:4.0.0" + checksum: 39d5cee53649132f12479965857cb01793d62ee1a702f06d079ee8aceee935cd0f79c250faab60e86705d8a5226856a61c419778d48ac67f72e160cceb60a1e5 + languageName: node + linkType: hard + "process@npm:^0.11.10, process@npm:~0.11.0": version: 0.11.10 resolution: "process@npm:0.11.10" @@ -15313,6 +15175,13 @@ __metadata: languageName: node linkType: hard +"quick-format-unescaped@npm:^4.0.3": + version: 4.0.4 + resolution: "quick-format-unescaped@npm:4.0.4" + checksum: 7bc32b99354a1aa46c089d2a82b63489961002bb1d654cee3e6d2d8778197b68c2d854fd23d8422436ee1fdfd0abaddc4d4da120afe700ade68bd357815b26fd + languageName: node + linkType: hard + "quick-lru@npm:^4.0.1": version: 4.0.1 resolution: "quick-lru@npm:4.0.1" @@ -15465,19 +15334,6 @@ __metadata: languageName: node linkType: hard -"readable-stream@npm:^4.5.2": - version: 4.5.2 - resolution: "readable-stream@npm:4.5.2" - dependencies: - abort-controller: ^3.0.0 - buffer: ^6.0.3 - events: ^3.3.0 - process: ^0.11.10 - string_decoder: ^1.3.0 - checksum: c4030ccff010b83e4f33289c535f7830190773e274b3fcb6e2541475070bdfd69c98001c3b0cb78763fc00c8b62f514d96c2b10a8bd35d5ce45203a25fa1d33a - languageName: node - linkType: hard - "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -15487,6 +15343,13 @@ __metadata: languageName: node linkType: hard +"real-require@npm:^0.2.0": + version: 0.2.0 + resolution: "real-require@npm:0.2.0" + checksum: fa060f19f2f447adf678d1376928c76379dce5f72bd334da301685ca6cdcb7b11356813332cc243c88470796bc2e2b1e2917fc10df9143dd93c2ea608694971d + languageName: node + linkType: hard + "receptacle@npm:^1.3.2": version: 1.3.2 resolution: "receptacle@npm:1.3.2" @@ -15933,6 +15796,13 @@ __metadata: languageName: node linkType: hard +"secure-json-parse@npm:^2.4.0": + version: 2.7.0 + resolution: "secure-json-parse@npm:2.7.0" + checksum: d9d7d5a01fc6db6115744ba23cf9e67ecfe8c524d771537c062ee05ad5c11b64c730bc58c7f33f60bd6877f96b86f0ceb9ea29644e4040cb757f6912d4dd6737 + languageName: node + linkType: hard + "select-hose@npm:^2.0.0": version: 2.0.0 resolution: "select-hose@npm:2.0.0" @@ -16265,15 +16135,6 @@ __metadata: languageName: node linkType: hard -"simple-swizzle@npm:^0.2.2": - version: 0.2.2 - resolution: "simple-swizzle@npm:0.2.2" - dependencies: - is-arrayish: ^0.3.1 - checksum: a7f3f2ab5c76c4472d5c578df892e857323e452d9f392e1b5cf74b74db66e6294a1e1b8b390b519fa1b96b5b613f2a37db6cffef52c3f1f8f3c5ea64eb2d54c0 - languageName: node - linkType: hard - "single-line-log@npm:^1.0.1": version: 1.1.2 resolution: "single-line-log@npm:1.1.2" @@ -16360,6 +16221,15 @@ __metadata: languageName: node linkType: hard +"sonic-boom@npm:^4.0.1": + version: 4.2.0 + resolution: "sonic-boom@npm:4.2.0" + dependencies: + atomic-sleep: ^1.0.0 + checksum: e5e1ffdd3bcb0dee3bf6f7b2ff50dd3ffa2df864dc9d53463f33e225021a28601e91d0ec7e932739824bafd6f4ff3b7090939ac3e34ab1022e01692b41f7e8a3 + languageName: node + linkType: hard + "source-map-js@npm:^1.2.0": version: 1.2.0 resolution: "source-map-js@npm:1.2.0" @@ -16522,13 +16392,6 @@ __metadata: languageName: node linkType: hard -"stack-trace@npm:0.0.x": - version: 0.0.10 - resolution: "stack-trace@npm:0.0.10" - checksum: 473036ad32f8c00e889613153d6454f9be0536d430eb2358ca51cad6b95cea08a3cc33cc0e34de66b0dad221582b08ed2e61ef8e13f4087ab690f388362d6610 - languageName: node - linkType: hard - "stack-utils@npm:^2.0.3": version: 2.0.6 resolution: "stack-utils@npm:2.0.6" @@ -16740,7 +16603,7 @@ __metadata: languageName: node linkType: hard -"string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0": +"string_decoder@npm:^1.1.1": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" dependencies: @@ -17111,13 +16974,6 @@ __metadata: languageName: node linkType: hard -"text-hex@npm:1.0.x": - version: 1.0.0 - resolution: "text-hex@npm:1.0.0" - checksum: 1138f68adc97bf4381a302a24e2352f04992b7b1316c5003767e9b0d3367ffd0dc73d65001ea02b07cd0ecc2a9d186de0cf02f3c2d880b8a522d4ccb9342244a - languageName: node - linkType: hard - "text-table@npm:^0.2.0": version: 0.2.0 resolution: "text-table@npm:0.2.0" @@ -17134,6 +16990,15 @@ __metadata: languageName: node linkType: hard +"thread-stream@npm:^3.0.0": + version: 3.1.0 + resolution: "thread-stream@npm:3.1.0" + dependencies: + real-require: ^0.2.0 + checksum: 3c5b494ce776f832dfd696792cc865f78c1e850db93e07979349bbc1a5845857cd447aea95808892906cc0178a2fd3233907329f3376e7fc9951e2833f5b7896 + languageName: node + linkType: hard + "through2@npm:^2.0.0, through2@npm:^2.0.3": version: 2.0.5 resolution: "through2@npm:2.0.5" @@ -17265,13 +17130,6 @@ __metadata: languageName: node linkType: hard -"triple-beam@npm:^1.3.0": - version: 1.4.1 - resolution: "triple-beam@npm:1.4.1" - checksum: 2e881a3e8e076b6f2b85b9ec9dd4a900d3f5016e6d21183ed98e78f9abcc0149e7d54d79a3f432b23afde46b0885bdcdcbff789f39bc75de796316961ec07f61 - languageName: node - linkType: hard - "ts-api-utils@npm:^1.0.1": version: 1.3.0 resolution: "ts-api-utils@npm:1.3.0" @@ -18454,61 +18312,6 @@ __metadata: languageName: node linkType: hard -"winston-daily-rotate-file@npm:^4.7.1": - version: 4.7.1 - resolution: "winston-daily-rotate-file@npm:4.7.1" - dependencies: - file-stream-rotator: ^0.6.1 - object-hash: ^2.0.1 - triple-beam: ^1.3.0 - winston-transport: ^4.4.0 - peerDependencies: - winston: ^3 - checksum: 227daea41f722caa017fc7d6f1f80d0e6c428491e57693e6bebc8312b85bcf3aace53cb3a925bda72fab59a6898fa127411d29348ec4b295e2263a7544cda611 - languageName: node - linkType: hard - -"winston-transport@npm:4.*": - version: 4.8.0 - resolution: "winston-transport@npm:4.8.0" - dependencies: - logform: ^2.6.1 - readable-stream: ^4.5.2 - triple-beam: ^1.3.0 - checksum: f84092188176d49a6f4f75321ba3e50107ac0942a51a6d7e36b80af19dafb22b57258aaa6d8220763044ea23e30bffd597d3280d2a2298e6a491fe424896bac7 - languageName: node - linkType: hard - -"winston-transport@npm:^4.4.0, winston-transport@npm:^4.7.0": - version: 4.7.0 - resolution: "winston-transport@npm:4.7.0" - dependencies: - logform: ^2.3.2 - readable-stream: ^3.6.0 - triple-beam: ^1.3.0 - checksum: ce074b5c76a99bee5236cf2b4d30fadfaf1e551d566f654f1eba303dc5b5f77169c21545ff5c5e4fdad9f8e815fc6d91b989f1db34161ecca6e860e62fd3a862 - languageName: node - linkType: hard - -"winston@npm:^3.10.0": - version: 3.13.0 - resolution: "winston@npm:3.13.0" - dependencies: - "@colors/colors": ^1.6.0 - "@dabh/diagnostics": ^2.0.2 - async: ^3.2.3 - is-stream: ^2.0.0 - logform: ^2.4.0 - one-time: ^1.0.0 - readable-stream: ^3.4.0 - safe-stable-stringify: ^2.3.1 - stack-trace: 0.0.x - triple-beam: ^1.3.0 - winston-transport: ^4.7.0 - checksum: 66f9fbbadb58e1632701e9c89391f217310c9455462148e163e060dcd25aed21351b0413bdbbf90e5c5fe9bc945fc5de6f53875ac7c7ef3061133a354fc678c0 - languageName: node - linkType: hard - "word-wrap@npm:^1.2.5": version: 1.2.5 resolution: "word-wrap@npm:1.2.5"