Skip to content

Commit

Permalink
Rename modules scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Dec 5, 2024
1 parent 00bd460 commit d3e12cd
Show file tree
Hide file tree
Showing 77 changed files with 99 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type SendMethodOptions = {
* Implements the sequence create/simulate/send.
*/
export abstract class BaseContractInteraction {
protected log = createLogger('js:contract_interaction');
protected log = createLogger('aztecjs:contract_interaction');

constructor(protected wallet: Wallet) {}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/contract/deploy_sent_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('js:deploy_sent_tx');
private log = createLogger('aztecjs:deploy_sent_tx');

constructor(
wallet: PXE | Wallet,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec.js/src/utils/cheat_codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class RollupCheatCodes {
private client: WalletClient & PublicClient;
private rollup: GetContractReturnType<typeof RollupAbi, WalletClient>;

private logger = createLogger('js:cheat_codes');
private logger = createLogger('aztecjs:cheat_codes');

constructor(private ethCheatCodes: EthCheatCodes, addresses: Pick<L1ContractAddresses, 'rollupAddress'>) {
this.client = createWalletClient({ chain: foundry, transport: http(ethCheatCodes.rpcUrl) }).extend(publicActions);
Expand Down Expand Up @@ -197,7 +197,7 @@ export class AztecCheatCodes {
/**
* The logger to use for the aztec cheatcodes
*/
public logger = createLogger('cheat_codes:aztec'),
public logger = createLogger('aztecjs:cheat_codes'),
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/examples/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type AccountWallet, Fr, createPXEClient } from '@aztec/aztec.js';
import { createLogger } from '@aztec/foundation/log';
import { TokenContract } from '@aztec/noir-contracts.js/Token';

const logger = createLogger('http-rpc-client');
const logger = createLogger('example:token');

export const alicePrivateKey = Fr.random();
export const bobPrivateKey = Fr.random();
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/avm_proving.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class BBNativePrivateKernelProver implements PrivateKernelProver {
private bbBinaryPath: string,
private bbWorkingDirectory: string,
private skipCleanup: boolean,
private log = createLogger('bb-native-prover'),
private log = createLogger('bb-prover:native'),
) {}

public static async new(config: BBConfig, log?: Logger) {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/test/test_circuit_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
export class TestCircuitProver implements ServerCircuitProver {
private wasmSimulator = new WASMSimulator();
private instrumentation: ProverInstrumentation;
private logger = createLogger('test-prover');
private logger = createLogger('bb-prover:test-prover');

constructor(
telemetry: TelemetryClient,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bb-prover/src/verifier/bb_verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
public static async new(
config: BBConfig,
initialCircuits: ProtocolArtifact[] = [],
logger = createLogger('bb-verifier'),
logger = createLogger('bb-prover:verifier'),
) {
await fs.mkdir(config.bbWorkingDirectory, { recursive: true });
const keys = new Map<ProtocolArtifact, Promise<VerificationKeyData>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export interface MerkleTreeWriteOperations extends MerkleTreeReadOperations {
export async function inspectTree(
db: MerkleTreeReadOperations,
treeId: MerkleTreeId,
log = createLogger('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')}`];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { InterruptibleSleep } from '@aztec/foundation/sleep';
import { type L2Block } from '../l2_block.js';
import { type L2BlockSource } from '../l2_block_source.js';

const log = createLogger('l2_block_downloader');
const log = createLogger('types:l2_block_downloader');

/**
* Downloads L2 blocks from a L2BlockSource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('l2_block_stream');
private readonly log = createLogger('types:l2_block_stream');

constructor(
private l2BlockSource: Pick<L2BlockSource, 'getBlocks' | 'getBlockHeader' | 'getL2Tips'>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createLogger } from '@aztec/foundation/log';
import { GrumpkinScalar, type Point } from '../../../index.js';
import { Grumpkin } from './index.js';

const log = createLogger('bb:grumpkin_test');
const log = createLogger('circuits:grumpkin_test');

describe('grumpkin', () => {
let grumpkin!: Grumpkin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const __dirname = dirname(__filename);
const PORT = 4000;
const PXE_PORT = 4001;

const logger = createLogger('e2e_aztec_browser.js:web');
const pageLogger = createLogger('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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('token');
const logger = createLogger('e2e:token');

// We create PXE client connected to the sandbox URL
const pxe = createPXEClient(PXE_URL);
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('e2e_sandbox_example', () => {
});

it('can create accounts on the sandbox', async () => {
const logger = createLogger('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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('deploy_l1_contracts', () => {
let logger: Logger;

beforeAll(async () => {
logger = createLogger('setup_l1_contracts');
logger = createLogger('e2e:setup_l1_contracts');
privateKey = privateKeyToAccount('0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba');

({ anvil, rpcUrl } = await startAnvil());
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 createLogger('' + name);
return createLogger('e2e:' + name);
}
return createLogger('' + describeBlockName);
return createLogger('e2e:' + describeBlockName);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ describe('e2e_prover_coordination', () => {
let snapshotManager: ISnapshotManager;

beforeEach(async () => {
logger = createLogger('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 },
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/sample-dapp/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('token', () => {
recipient = await createAccount(pxe);

const initialBalance = 69;
token = await deployToken(owner, initialBalance, createLogger('sample_dapp'));
token = await deployToken(owner, initialBalance, createLogger('e2e:sample_dapp'));
}, 120_000);
// docs:end:setup

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/spartan/gating-passive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const {
SPARTAN_DIR,
INSTANCE_NAME,
} = config;
const debugLogger = createLogger('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
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/spartan/proving.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('spartan-test:proving');
const debugLogger = createLogger('e2e:spartan-test:proving');
const SLEEP_MS = 1000;

describe('proving test', () => {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/spartan/reorg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('spartan-test:reorg');
const debugLogger = createLogger('e2e:spartan-test:reorg');

async function checkBalances(testWallets: TestWallets, mintAmount: bigint, totalAmountTransferred: bigint) {
testWallets.wallets.forEach(async w => {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/spartan/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { isK8sConfig, runAlertCheck, setupEnvironment, startPortForward } from '

const config = setupEnvironment(process.env);

const debugLogger = createLogger('spartan-test:smoke');
const debugLogger = createLogger('e2e:spartan-test:smoke');

// QoS alerts for when we are running in k8s
const qosAlerts: AlertConfig[] = [
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/spartan/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AlertChecker, type AlertConfig } from '../quality_of_service/alert_chec

const execAsync = promisify(exec);

const logger = createLogger('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'),
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/eth_cheat_codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class EthCheatCodes {
/**
* The logger to use for the eth cheatcodes
*/
public logger = createLogger('cheat_codes:eth'),
public logger = createLogger('ethereum:cheat_codes'),
) {}

async rpcCall(method: string, params: any[]) {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/l1_tx_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('GasUtils', () => {
let anvil: Anvil;
let cheatCodes: EthCheatCodes;
const initialBaseFee = WEI_CONST; // 1 gwei
const logger = createLogger('l1_gas_test');
const logger = createLogger('ethereum:test:l1_gas_test');

beforeAll(async () => {
const { anvil: anvilInstance, rpcUrl } = await startAnvil(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export class RandomnessSingleton {

private counter = 0;

private constructor(private readonly seed?: number, private readonly log = createLogger('randomness_singleton')) {
private constructor(
private readonly seed?: number,
private readonly log = createLogger('foundation:randomness_singleton'),
) {
if (seed !== undefined) {
this.log.debug(`Using pseudo-randomness with seed: ${seed}`);
this.counter = seed;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/transport/transport_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type EventMessage, type ResponseMessage, isEventMessage } from './dispa
import { type Connector } from './interface/connector.js';
import { type Socket } from './interface/socket.js';

const log = createLogger('transport_client');
const log = createLogger('foundation:transport_client');

/**
* Represents a pending request in the TransportClient.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/worker/worker_pool.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLogger } from '../log/index.js';
import { type WasmWorker } from './wasm_worker.js';

const log = createLogger('bb:worker_pool');
const log = createLogger('foundation:worker_pool');

/**
* Type of a worker factory.
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/ivc-integration/src/avm_integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { MockPublicBaseCircuit, witnessGenMockPublicBaseCircuit } from './index.

// Auto-generated types from noir are not in camel case.
/* eslint-disable camelcase */
const logger = createLogger('avm-integration');
const logger = createLogger('ivc-integration:test:avm-integration');

describe('AVM Integration', () => {
let bbWorkingDirectory: string;
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('AVM Integration', () => {
async function proveAvmTestContract(functionName: string, calldata: Fr[] = []): Promise<BBSuccess> {
const avmCircuitInputs = await simulateAvmTestContractGenerateCircuitInputs(functionName, calldata);

const internalLogger = createLogger('avm-proving-test');
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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { generate3FunctionTestingIVCStack, generate6FunctionTestingIVCStack } fr

/* eslint-disable camelcase */

const logger = createLogger('clientivc-integration');
const logger = createLogger('ivc-integration:test:native');

jest.setTimeout(120_000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {

/* eslint-disable camelcase */

const logger = createLogger('clientivc-integration');
const logger = createLogger('ivc-integration:test:wasm');

jest.setTimeout(120_000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('sparse_tree_test');
const log = createLogger('merkle-tree:test:sparse_tree');

const createDb = async (
db: AztecKVStore,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p-bootstrap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
import Koa from 'koa';
import Router from 'koa-router';

const debugLogger = createLogger('bootstrap_node');
const debugLogger = createLogger('p2p-bootstrap:bootstrap_node');

const { HTTP_PORT } = process.env;

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/bootstrap/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class BootstrapNode {
constructor(
private store: AztecKVStore,
private telemetry: TelemetryClient,
private logger = createLogger('p2p_bootstrap'),
private logger = createLogger('p2p:bootstrap'),
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class InMemoryAttestationPool implements AttestationPool {

private attestations: Map</*slot=*/ bigint, Map</*proposalId*/ string, Map</*address=*/ string, BlockAttestation>>>;

constructor(telemetry: TelemetryClient, private log = createLogger('attestation_pool')) {
constructor(telemetry: TelemetryClient, private log = createLogger('p2p:attestation_pool')) {
this.attestations = new Map();
this.metrics = new PoolInstrumentation(telemetry, PoolName.ATTESTATION_POOL);
}
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AztecKVTxPool implements TxPool {
* @param store - A KV store.
* @param log - A logger.
*/
constructor(store: AztecKVStore, telemetry: TelemetryClient, log = createLogger('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');
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('tx_pool')) {
constructor(telemetry: TelemetryClient, private log = createLogger('p2p:tx_pool')) {
this.txs = new Map<bigint, Tx>();
this.minedTxs = new Map();
this.pendingTxs = new Set();
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/service/discV5_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DiscV5Service extends EventEmitter implements PeerDiscoveryService
private peerId: PeerId,
config: P2PConfig,
telemetry: TelemetryClient,
private logger = createLogger('discv5_service'),
private logger = createLogger('p2p:discv5_service'),
) {
super();
const { tcpAnnounceAddress, udpAnnounceAddress, udpListenAddress, bootstrapNodes } = config;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/service/libp2p_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = createLogger('libp2p_service'),
private logger = createLogger('p2p:libp2p_service'),
) {
super(telemetry, 'LibP2PService');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Req Resp p2p client integration', () => {
let kvStore: AztecKVStore;
let worldState: WorldStateSynchronizer;
let proofVerifier: ClientProtocolCircuitVerifier;
const logger = createLogger('p2p-client-integration-test');
const logger = createLogger('p2p:test:client-integration');

beforeEach(() => {
({ txPool, attestationPool, epochProofQuotePool } = makeMockPools());
Expand Down
Loading

0 comments on commit d3e12cd

Please sign in to comment.