Skip to content

Commit

Permalink
Merge b240d91 into 4fa068c
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino authored Dec 9, 2024
2 parents 4fa068c + b240d91 commit 89e884e
Show file tree
Hide file tree
Showing 278 changed files with 821 additions and 786 deletions.
4 changes: 2 additions & 2 deletions boxes/boxes/react/tests/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AccountWallet, CompleteAddress, Contract, Fr, createDebugLogger } from '@aztec/aztec.js';
import { AccountWallet, CompleteAddress, Contract, Fr, createLogger } from '@aztec/aztec.js';
import { BoxReactContract } from '../artifacts/BoxReact.js';
import { deployerEnv } from '../src/config.js';

const logger = createDebugLogger('aztec:http-pxe-client');
const logger = createLogger('aztec:http-pxe-client');

describe('BoxReact Contract Tests', () => {
let wallet: AccountWallet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Open `cross_chain_messaging.test.ts` and paste the initial description of the te

```typescript
import { beforeAll, describe, beforeEach, expect, jest, it} from '@jest/globals'
import { AccountWallet, AztecAddress, BatchCall, type DebugLogger, EthAddress, Fr, computeAuthWitMessageHash, createDebugLogger, createPXEClient, waitForPXE, L1ToL2Message, L1Actor, L2Actor, type PXE, type Wallet } from '@aztec/aztec.js';
import { AccountWallet, AztecAddress, BatchCall, type DebugLogger, EthAddress, Fr, computeAuthWitMessageHash, createLogger, createPXEClient, waitForPXE, L1ToL2Message, L1Actor, L2Actor, type PXE, type Wallet } from '@aztec/aztec.js';
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing';
import { TokenContract } from '@aztec/noir-contracts.js/Token';
import { sha256ToField } from '@aztec/foundation/crypto';
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('e2e_cross_chain_messaging', () => {
let outbox: any;

beforeAll(async () => {
logger = createDebugLogger('aztec:e2e_uniswap');
logger = createLogger('aztec:e2e_uniswap');
const pxe = createPXEClient(PXE_URL);
await waitForPXE(pxe);
wallets = await getInitialTestAccountsWallets(pxe);
Expand All @@ -102,7 +102,7 @@ describe('e2e_cross_chain_messaging', () => {
})

beforeEach(async () => {
logger = createDebugLogger('aztec:e2e_uniswap');
logger = createLogger('aztec:e2e_uniswap');
const pxe = createPXEClient(PXE_URL);
await waitForPXE(pxe);

Expand Down
6 changes: 3 additions & 3 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 { elapsed } from '@aztec/foundation/timer';
Expand Down Expand Up @@ -116,7 +116,7 @@ export class Archiver implements ArchiveSource {
private readonly config: { pollingIntervalMs: number; batchSize: number },
private readonly instrumentation: ArchiverInstrumentation,
private readonly l1constants: L1RollupConstants,
private readonly log: DebugLogger = createDebugLogger('aztec:archiver'),
private readonly log: Logger = createLogger('archiver'),
) {
this.store = new ArchiverStoreHelper(dataStore);

Expand Down Expand Up @@ -836,7 +836,7 @@ class ArchiverStoreHelper
| 'addFunctions'
>
{
#log = createDebugLogger('aztec:archiver:block-helper');
#log = createLogger('archiver:block-helper');

constructor(private readonly store: ArchiverDataStore) {}

Expand Down
6 changes: 3 additions & 3 deletions yarn-project/archiver/src/archiver/data_retrieval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AppendOnlyTreeSnapshot, BlockHeader, Fr, Proof } from '@aztec/circuits.
import { asyncPool } from '@aztec/foundation/async-pool';
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';

Expand Down Expand Up @@ -36,7 +36,7 @@ export async function retrieveBlocksFromRollup(
publicClient: PublicClient,
searchStartBlock: bigint,
searchEndBlock: bigint,
logger: DebugLogger = createDebugLogger('aztec:archiver'),
logger: Logger = createLogger('archiver'),
): Promise<L1Published<L2Block>[]> {
const retrievedBlocks: L1Published<L2Block>[] = [];
do {
Expand Down Expand Up @@ -78,7 +78,7 @@ export async function processL2BlockProposedLogs(
rollup: GetContractReturnType<typeof RollupAbi, PublicClient<HttpTransport, Chain>>,
publicClient: PublicClient,
logs: GetContractEventsReturnType<typeof RollupAbi, 'L2BlockProposed'>,
logger: DebugLogger,
logger: Logger,
): Promise<L1Published<L2Block>[]> {
const retrievedBlocks: L1Published<L2Block>[] = [];
await asyncPool(10, logs, async log => {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/archiver/src/archiver/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -22,7 +22,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, lmdbStats?: LmdbStatsCallback) {
const meter = telemetry.getMeter('Archiver');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Body, type InBlock, L2Block, L2BlockHash, type TxEffect, type TxHash, TxReceipt } from '@aztec/circuit-types';
import { AppendOnlyTreeSnapshot, type AztecAddress, BlockHeader, 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';
Expand Down Expand Up @@ -38,7 +38,7 @@ export class BlockStore {
/** Index mapping a contract's address (as a string) to its location in a block */
#contractIndex: AztecMap<string, BlockIndexValue>;

#log = createDebugLogger('aztec:archiver:block_store');
#log = createLogger('archiver:block_store');

constructor(private db: AztecKVStore) {
this.#blocks = db.openMap('archiver_blocks');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -46,7 +46,7 @@ export class KVArchiverDataStore implements ArchiverDataStore {
#contractArtifactStore: ContractArtifactsStore;
private functionNames = new Map<string, string>();

#log = createDebugLogger('aztec:archiver:data-store');
#log = createLogger('archiver:data-store');

constructor(private db: AztecKVStore, logsMaxPageSize: number = 1000) {
this.#blockStore = new BlockStore(db);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -27,7 +27,7 @@ export class LogStore {
#unencryptedLogsByBlock: AztecMap<number, Buffer>;
#contractClassLogsByBlock: AztecMap<number, Buffer>;
#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');
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,7 +14,7 @@ export class MessageStore {
#lastSynchedL1Block: AztecSingleton<bigint>;
#totalMessageCount: AztecSingleton<bigint>;

#log = createDebugLogger('aztec:archiver:message_store');
#log = createLogger('archiver:message_store');

#l1ToL2MessagesSubtreeSize = 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT;

Expand Down
Original file line number Diff line number Diff line change
@@ -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<string, number>;
#nullifiersToBlockHash: AztecMap<string, string>;
#nullifiersToIndex: AztecMap<string, number>;
#log = createDebugLogger('aztec:archiver:log_store');
#log = createLogger('archiver:log_store');

constructor(private db: AztecKVStore) {
this.#nullifiersToBlockNumber = db.openMap('archiver_nullifiers_to_block_number');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/archiver/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/lmdb';
Expand All @@ -24,7 +24,7 @@ export async function createArchiver(
opts: { blockUntilSync: boolean } = { blockUntilSync: true },
): Promise<ArchiverApi & Maybe<Service>> {
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);
Expand Down
5 changes: 1 addition & 4 deletions yarn-project/archiver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ export * from './archiver/index.js';
export * from './factory.js';
export * from './rpc/index.js';

export {
retrieveBlocksFromRollup as retrieveBlockFromRollup,
retrieveL2ProofVerifiedEvents,
} from './archiver/data_retrieval.js';
export { retrieveBlocksFromRollup, retrieveL2ProofVerifiedEvents } from './archiver/data_retrieval.js';
4 changes: 2 additions & 2 deletions yarn-project/archiver/src/test/mock_l2_block_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { getSlotRangeForEpoch } from '@aztec/circuit-types';
import { type BlockHeader, EthAddress } from '@aztec/circuits.js';
import { DefaultL1ContractsConfig } from '@aztec/ethereum';
import { createDebugLogger } from '@aztec/foundation/log';
import { createLogger } from '@aztec/foundation/log';

/**
* A mocked implementation of L2BlockSource to be used in tests.
Expand All @@ -21,7 +21,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++) {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-faucet/src/bin/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/lmdb';
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -140,12 +140,12 @@ export class AztecNodeService implements AztecNode {
config: AztecNodeConfig,
deps: {
telemetry?: TelemetryClient;
logger?: DebugLogger;
logger?: Logger;
publisher?: L1Publisher;
} = {},
): Promise<AztecNodeService> {
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) {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-node/src/bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env -S node --no-warnings
import { createDebugLogger } from '@aztec/foundation/log';
import { createLogger } from '@aztec/foundation/log';

import http from 'http';

import { type AztecNodeConfig, AztecNodeService, createAztecNodeRpcServer, getConfigEnvVars } from '../index.js';

const { AZTEC_NODE_PORT = 8081, API_PREFIX = '' } = process.env;

const logger = createDebugLogger('aztec:node');
const logger = createLogger('node');

/**
* Creates the node from provided config
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {}

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/contract/deploy_sent_tx.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -24,7 +24,7 @@ export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsO
* A contract deployment transaction sent to the network, extending SentTx with methods to create a contract instance.
*/
export class DeploySentTx<TContract extends Contract = Contract> extends SentTx {
private log = createDebugLogger('aztec:js:deploy_sent_tx');
private log = createLogger('aztecjs:deploy_sent_tx');

constructor(
wallet: PXE | Wallet,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,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, 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';
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/rpc_clients/node/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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<PXE> {
export function createCompatibleClient(rpcUrl: string, logger: Logger): Promise<PXE> {
// 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(
Expand Down
Loading

0 comments on commit 89e884e

Please sign in to comment.