Skip to content

Commit

Permalink
feat: track block building helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Jan 14, 2025
1 parent 837e905 commit b64d50c
Show file tree
Hide file tree
Showing 33 changed files with 434 additions and 452 deletions.
1 change: 0 additions & 1 deletion yarn-project/aztec-node/src/aztec-node/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from '@aztec/circuits.js';
import { type P2P } from '@aztec/p2p';
import { type GlobalVariableBuilder } from '@aztec/sequencer-client';
import { getTelemetryClient } from '@aztec/telemetry-client';

import { type MockProxy, mock } from 'jest-mock-extended';

Expand Down
6 changes: 0 additions & 6 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ import {
createValidatorForAcceptingTxs,
getDefaultAllowedSetupFunctions,
} from '@aztec/sequencer-client';
<<<<<<< HEAD
import { PublicProcessorFactory } from '@aztec/simulator/server';
import { Attributes, type TelemetryClient, type Traceable, type Tracer, trackSpan } from '@aztec/telemetry-client';
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
=======
import { PublicProcessorFactory } from '@aztec/simulator';
import {
Attributes,
type TelemetryClient,
Expand All @@ -87,7 +82,6 @@ import {
getTelemetryClient,
trackSpan,
} from '@aztec/telemetry-client';
>>>>>>> ebdf383f12 (refactor: global telemetry client)
import { createValidatorClient } from '@aztec/validator-client';
import { createWorldStateSynchronizer } from '@aztec/world-state';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function startArchiver(
const store = await createStore('archiver', archiverConfig, storeLog);
const archiverStore = new KVArchiverDataStore(store, archiverConfig.maxLogs);

const telemetry = await initTelemetryClient(getTelemetryClientConfig());
const telemetry = initTelemetryClient(getTelemetryClientConfig());
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/10056): place CL url in config here
const blobSinkClient = createBlobSinkClient();
const archiver = await Archiver.createAndSync(archiverConfig, archiverStore, { telemetry, blobSinkClient }, true);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function startBot(
pxe = await addPXE(options, signalHandlers, services, userLog);
}

const telemetry = await initTelemetryClient(getTelemetryClientConfig());
const telemetry = initTelemetryClient(getTelemetryClientConfig());
await addBot(options, signalHandlers, services, { pxe, telemetry });
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function startNode(
}

const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
const telemetry = await initTelemetryClient(telemetryConfig);
const telemetry = initTelemetryClient(telemetryConfig);

// Create and start Aztec Node
const node = await createAztecNode(nodeConfig, { telemetry });
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_p2p_bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function startP2PBootstrap(
) {
// Start a P2P bootstrap node.
const config = extractRelevantOptions<BootnodeConfig>(options, bootnodeConfigMappings, 'p2p');
const telemetryClient = await initTelemetryClient(getTelemetryClientConfig());
const telemetryClient = initTelemetryClient(getTelemetryClientConfig());
const store = await createStore('p2p-bootstrap', config, createLogger('p2p:bootstrap:store'));
const node = new BootstrapNode(store, telemetryClient);
await node.start(config);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_proof_verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function startProofVerifier(options: any, signalHandlers: (() => Pr
const config = extractRelevantOptions(options, proofVerifierConfigMappings, 'proofVerifier');

const telemetryConfig = extractRelevantOptions(options, telemetryClientConfigMappings, 'tel');
const telemetry = await initTelemetryClient(telemetryConfig);
const telemetry = initTelemetryClient(telemetryConfig);
const proofVerifier = await ProofVerifier.new(config, telemetry);

userLog('Starting proof verifier');
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_prover_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function startProverAgent(

const broker = createProvingJobBrokerClient(config.proverBrokerUrl);

const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
const prover = await buildServerCircuitProver(config, telemetry);
const proofStore = new InlineProofStore();
const agents = times(
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_prover_broker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function startProverBroker(
...extractRelevantOptions<ProverBrokerConfig>(options, proverBrokerConfigMappings, 'proverBroker'), // override with command line options
};

const client = await initTelemetryClient(getTelemetryClientConfig());
const client = initTelemetryClient(getTelemetryClientConfig());
const broker = await createAndStartProvingBroker(config, client);
services.proverBroker = [broker, ProvingJobBrokerSchema];
signalHandlers.push(() => broker.stop());
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/cli/cmds/start_prover_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function startProverNode(
proverConfig.l1Contracts = await createAztecNodeClient(nodeUrl).getL1ContractAddresses();
}

const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));

let broker: ProvingJobBroker;
if (proverConfig.proverBrokerUrl) {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export async function createSandbox(config: Partial<SandboxConfig> = {}) {
await watcher.start();
}

const telemetry = await initTelemetryClient(getTelemetryClientConfig());
const telemetry = initTelemetryClient(getTelemetryClientConfig());
// Create a local blob sink client inside the sandbox, no http connectivity
const blobSinkClient = createBlobSinkClient();
const node = await createAztecNode(aztecNodeConfig, { telemetry, blobSinkClient });
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/bb-prover/src/prover/bb_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,8 @@ import {
convertSingleTxBlockRootRollupInputsToWitnessMap,
convertSingleTxBlockRootRollupOutputsFromWitnessMap,
} from '@aztec/noir-protocol-circuits-types/server';
<<<<<<< HEAD
import { NativeACVMSimulator } from '@aztec/simulator/server';
import { Attributes, type TelemetryClient, trackSpan } from '@aztec/telemetry-client';
=======
import { NativeACVMSimulator } from '@aztec/simulator';
import { Attributes, type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
>>>>>>> ebdf383f12 (refactor: global telemetry client)

import { type WitnessMap } from '@noir-lang/types';
import { assert } from 'console';
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/bb-prover/src/test/test_circuit_prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,8 @@ import {
convertSimulatedSingleTxBlockRootRollupOutputsFromWitnessMap,
} from '@aztec/noir-protocol-circuits-types/server';
import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types/vks';
<<<<<<< HEAD
import { type SimulationProvider, WASMSimulatorWithBlobs, emitCircuitSimulationStats } from '@aztec/simulator/server';
import { type TelemetryClient, trackSpan } from '@aztec/telemetry-client';
=======
import { type SimulationProvider, WASMSimulatorWithBlobs, emitCircuitSimulationStats } from '@aztec/simulator';
import { type TelemetryClient, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
>>>>>>> ebdf383f12 (refactor: global telemetry client)

import { type WitnessMap } from '@noir-lang/types';

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class P2PNetworkTest {
}) {
const port = basePort || (await getPort());

const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
const bootstrapNode = await createBootstrapNodeFromPrivateKey(BOOTSTRAP_NODE_PRIVATE_KEY, port, telemetry);
const bootstrapNodeEnr = bootstrapNode.getENR().encodeTxt();

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/fixtures/setup_p2p_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function createNode(
) {
const createNode = async () => {
const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, accountIndex, dataDirectory);
const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
const telemetry = getEndToEndTestTelemetryClient(metricsPort);
return await AztecNodeService.createAndSync(validatorConfig, { telemetry, dateProvider });
};
return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/src/fixtures/snapshot_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ async function setupFromFresh(
aztecNodeConfig.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
}

const telemetry = await getEndToEndTestTelemetryClient(opts.metricsPort);
const telemetry = getEndToEndTestTelemetryClient(opts.metricsPort);

logger.verbose('Creating and synching an aztec node...');
const dateProvider = new TestDateProvider();
Expand Down Expand Up @@ -492,7 +492,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
await watcher.start();

logger.verbose('Creating aztec node...');
const telemetry = await initTelemetryClient(getTelemetryConfig());
const telemetry = initTelemetryClient(getTelemetryConfig());
const dateProvider = new TestDateProvider();
const aztecNode = await AztecNodeService.createAndSync(aztecNodeConfig, { telemetry, dateProvider });

Expand Down
21 changes: 9 additions & 12 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec
import { type PXEService, type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { type SequencerClient } from '@aztec/sequencer-client';
import { TestL1Publisher } from '@aztec/sequencer-client/test';
import { type TelemetryClient,
type TelemetryClientConfig
initTelemetryClient,
import {
type TelemetryClient,
type TelemetryClientConfig,
getConfigEnvVars as getTelemetryConfig,
initTelemetryClient,
} from '@aztec/telemetry-client';
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';

Expand Down Expand Up @@ -87,19 +88,17 @@ export { startAnvil };
const { PXE_URL = '' } = process.env;
const getAztecUrl = () => PXE_URL;

let telemetryPromise: TelemetryClient | undefined = undefined;
let telemetry: TelemetryClient | undefined = undefined;
function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
if (!telemetryPromise) {
if (!telemetry) {
const config = { ...getTelemetryConfig(), ...partialConfig };
telemetryPromise = config.benchmark
? new BenchmarkTelemetryClient()
: initTelemetryClient(config);
telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
}
return telemetryPromise;
return telemetry;
}
if (typeof afterAll === 'function') {
afterAll(() => {
await telemetryPromise?.stop();
telemetry?.stop();
});
}

Expand Down Expand Up @@ -472,8 +471,6 @@ export async function setup(

const telemetry = await getTelemetryClient(opts.telemetryConfig);

=======
>>>>>>> ebdf383f12 (refactor: global telemetry client)
const blobSinkClient = createBlobSinkClient(config.blobSinkUrl);
const publisher = new TestL1Publisher(config, { blobSinkClient });
const aztecNode = await AztecNodeService.createAndSync(config, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@aztec/telemetry-client';
import { OTelPinoStream } from '@aztec/telemetry-client/otel-pino-stream';

export function getEndToEndTestTelemetryClient(metricsPort?: number): Promise<TelemetryClient> {
export function getEndToEndTestTelemetryClient(metricsPort?: number): TelemetryClient {
if (metricsPort) {
const otelStream = new OTelPinoStream({ levels });
registerLoggingStream(otelStream);
Expand Down
5 changes: 0 additions & 5 deletions yarn-project/prover-client/src/mocks/test_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ import {
type SimulationProvider,
WASMSimulatorWithBlobs,
type WorldStateDB,
<<<<<<< HEAD
} from '@aztec/simulator/server';
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
=======
} from '@aztec/simulator';
import { getTelemetryClient } from '@aztec/telemetry-client';
>>>>>>> ebdf383f12 (refactor: global telemetry client)
import { type MerkleTreeAdminDatabase } from '@aztec/world-state';
import { NativeWorldStateService } from '@aztec/world-state/native';

Expand Down
Loading

0 comments on commit b64d50c

Please sign in to comment.