@aztec/pxe 0.87.2 → 0.87.3-nightly.20250529

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dest/config/package_info.js +1 -1
  2. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  3. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  4. package/dest/entrypoints/client/bundle/utils.js +9 -3
  5. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  6. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  7. package/dest/entrypoints/client/lazy/utils.js +9 -3
  8. package/dest/entrypoints/{client/pxe_creation_options.d.ts → pxe_creation_options.d.ts} +4 -1
  9. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -0
  10. package/dest/entrypoints/server/utils.d.ts +3 -3
  11. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  12. package/dest/entrypoints/server/utils.js +23 -15
  13. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  14. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +30 -30
  15. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  16. package/dest/private_kernel/private_kernel_execution_prover.js +11 -8
  17. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +4 -4
  18. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
  19. package/dest/pxe_oracle_interface/pxe_oracle_interface.js +26 -21
  20. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  21. package/dest/pxe_service/pxe_service.js +12 -7
  22. package/package.json +15 -15
  23. package/src/config/package_info.ts +1 -1
  24. package/src/entrypoints/client/bundle/utils.ts +22 -14
  25. package/src/entrypoints/client/lazy/utils.ts +23 -10
  26. package/src/entrypoints/{client/pxe_creation_options.ts → pxe_creation_options.ts} +4 -1
  27. package/src/entrypoints/server/utils.ts +38 -20
  28. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +35 -34
  29. package/src/private_kernel/private_kernel_execution_prover.ts +12 -10
  30. package/src/pxe_oracle_interface/pxe_oracle_interface.ts +33 -21
  31. package/src/pxe_service/pxe_service.ts +11 -6
  32. package/dest/entrypoints/client/pxe_creation_options.d.ts.map +0 -1
  33. /package/dest/entrypoints/{client/pxe_creation_options.js → pxe_creation_options.js} +0 -0
@@ -5,7 +5,7 @@ import { MessageLoadOracleInputs } from '@aztec/simulator/client';
5
5
  import { getFunctionArtifact } from '@aztec/stdlib/abi';
6
6
  import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
7
7
  import { computeAddressSecret, computeAppTaggingSecret } from '@aztec/stdlib/keys';
8
- import { IndexedTaggingSecret, LogWithTxData, PendingTaggedLog, deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
8
+ import { IndexedTaggingSecret, PendingTaggedLog, PublicLogWithTxData, deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
9
9
  import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
10
10
  import { Note } from '@aztec/stdlib/note';
11
11
  import { MerkleTreeId } from '@aztec/stdlib/trees';
@@ -292,7 +292,7 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
292
292
  return indexedAppTaggingSecret.computeSiloedTag(recipient, contractAddress);
293
293
  });
294
294
  // We fetch the logs for the tags
295
- const possibleLogs = await this.aztecNode.getLogsByTags(currentTags);
295
+ const possibleLogs = await this.#getPrivateLogsByTags(currentTags);
296
296
  // We find the index of the last log in the window that is not empty
297
297
  const indexOfLastLog = possibleLogs.findLastIndex((possibleLog)=>possibleLog.length !== 0);
298
298
  if (indexOfLastLog === -1) {
@@ -320,8 +320,8 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
320
320
  }
321
321
  }
322
322
  /**
323
- * Synchronizes the logs tagged with scoped addresses and all the senders in the address book. Stores the found logs
324
- * in CapsuleArray ready for a later retrieval in Aztec.nr.
323
+ * Synchronizes the private logs tagged with scoped addresses and all the senders in the address book. Stores the found
324
+ * logs in CapsuleArray ready for a later retrieval in Aztec.nr.
325
325
  * @param contractAddress - The address of the contract that the logs are tagged for.
326
326
  * @param pendingTaggedLogArrayBaseSlot - The base slot of the pending tagged logs capsule array in which
327
327
  * found logs will be stored.
@@ -367,25 +367,20 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
367
367
  // We store the new largest indexes we find in the iteration in the following map to later on construct
368
368
  // a new set of secrets and windows to fetch logs for.
369
369
  const newLargestIndexMapForIteration = {};
370
- // Fetch the logs for the tags and iterate over them
371
- const logsByTags = await this.aztecNode.getLogsByTags(tagsForTheWholeWindow);
370
+ // Fetch the private logs for the tags and iterate over them
371
+ const logsByTags = await this.#getPrivateLogsByTags(tagsForTheWholeWindow);
372
372
  for(let logIndex = 0; logIndex < logsByTags.length; logIndex++){
373
373
  const logsByTag = logsByTags[logIndex];
374
374
  if (logsByTag.length > 0) {
375
- // Discard public logs
376
- const filteredLogsByTag = logsByTag.filter((l)=>!l.isFromPublic);
377
- if (filteredLogsByTag.length < logsByTag.length) {
378
- this.log.warn(`Discarded ${logsByTag.filter((l)=>l.isFromPublic).length} public logs with matching tags`);
379
- }
380
375
  // We filter out the logs that are newer than the historical block number of the tx currently being constructed
381
- const filteredLogsByBlockNumber = filteredLogsByTag.filter((l)=>l.blockNumber <= maxBlockNumber);
376
+ const filteredLogsByBlockNumber = logsByTag.filter((l)=>l.blockNumber <= maxBlockNumber);
382
377
  // We store the logs in capsules (to later be obtained in Noir)
383
378
  await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, filteredLogsByBlockNumber);
384
379
  // We retrieve the indexed tagging secret corresponding to the log as I need that to evaluate whether
385
380
  // a new largest index have been found.
386
381
  const secretCorrespondingToLog = secretsForTheWholeWindow[logIndex];
387
382
  const initialIndex = initialIndexesMap[secretCorrespondingToLog.appTaggingSecret.toString()];
388
- this.log.debug(`Found ${filteredLogsByTag.length} logs as recipient ${recipient}`, {
383
+ this.log.debug(`Found ${logsByTags.length} logs as recipient ${recipient}`, {
389
384
  recipient,
390
385
  secret: secretCorrespondingToLog.appTaggingSecret,
391
386
  contractName,
@@ -498,17 +493,17 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
498
493
  });
499
494
  }
500
495
  }
501
- async getLogByTag(tag) {
502
- const logs = await this.aztecNode.getLogsByTags([
496
+ async getPublicLogByTag(tag, contractAddress) {
497
+ const logs = await this.#getPublicLogsByTagsFromContract([
503
498
  tag
504
- ]);
499
+ ], contractAddress);
505
500
  const logsForTag = logs[0];
506
501
  this.log.debug(`Got ${logsForTag.length} logs for tag ${tag}`);
507
502
  if (logsForTag.length == 0) {
508
503
  return null;
509
504
  } else if (logsForTag.length > 1) {
510
505
  // TODO(#11627): handle this case
511
- throw new Error(`Got ${logsForTag.length} logs for tag ${tag}. getLogByTag currently only supports a single log per tag`);
506
+ throw new Error(`Got ${logsForTag.length} logs for tag ${tag} and contract ${contractAddress.toString()}. getPublicLogByTag currently only supports a single log per tag`);
512
507
  }
513
508
  const scopedLog = logsForTag[0];
514
509
  // getLogsByTag doesn't have all of the information that we need (notably note hashes and the first nullifier), so
@@ -518,10 +513,7 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
518
513
  if (txEffect == undefined) {
519
514
  throw new Error(`Unexpected: failed to retrieve tx effects for tx ${scopedLog.txHash} which is known to exist`);
520
515
  }
521
- const logContent = (scopedLog.isFromPublic ? [
522
- scopedLog.log.contractAddress.toField()
523
- ] : []).concat(scopedLog.log.getEmittedFields());
524
- return new LogWithTxData(logContent, scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
516
+ return new PublicLogWithTxData(scopedLog.log.getEmittedFieldsWithoutTag(), scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
525
517
  }
526
518
  async removeNullifiedNotes(contractAddress) {
527
519
  this.log.verbose('Searching for nullifiers of known notes', {
@@ -593,4 +585,17 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
593
585
  }
594
586
  return this.privateEventDataProvider.storePrivateEventLog(contractAddress, recipient, eventSelector, msgContent, txHash, logIndexInTx, txIndexInBlock, blockNumber);
595
587
  }
588
+ // TODO(#12656): Make this a public function on the AztecNode interface and remove the original getLogsByTags. This
589
+ // was not done yet as we were unsure about the API and we didn't want to introduce a breaking change.
590
+ async #getPrivateLogsByTags(tags) {
591
+ const allLogs = await this.aztecNode.getLogsByTags(tags);
592
+ return allLogs.map((logs)=>logs.filter((log)=>!log.isFromPublic));
593
+ }
594
+ // TODO(#12656): Make this a public function on the AztecNode interface and remove the original getLogsByTags. This
595
+ // was not done yet as we were unsure about the API and we didn't want to introduce a breaking change.
596
+ async #getPublicLogsByTagsFromContract(tags, contractAddress) {
597
+ const allLogs = await this.aztecNode.getLogsByTags(tags);
598
+ const allPublicLogs = allLogs.map((logs)=>logs.filter((log)=>log.isFromPublic));
599
+ return allPublicLogs.map((logs)=>logs.filter((log)=>log.log.contractAddress.equals(contractAddress)));
600
+ }
596
601
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pxe_service.d.ts","sourceRoot":"","sources":["../../src/pxe_service/pxe_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,2BAA2B,CAAC;AACnC,O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YAAY,GAAG,SAAqB,EAC/C,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,EACnC,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,kBAAkB,CAAC;IAgHjB,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAarC,eAAe,CACpB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,GAAG,EAAE,EACX,EAAE,EAAE,YAAY,EAChB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,KAAK,CAAC,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,uBAAuB,CAAC;IAuCtB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IA4BtC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAYxB,gBAAgB,CAAC,CAAC,EAC7B,eAAe,EAAE,YAAY,EAC7B,gBAAgB,EAAE,uBAAuB,EACzC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC;IAuBT,eAAe,CAAC,CAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IA6BxG,iBAAiB;CAGxB"}
@@ -459,9 +459,10 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
459
459
  profileMode: 'none'
460
460
  });
461
461
  const totalTime = totalTimer.ms();
462
- const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>({
462
+ const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>({
463
463
  functionName,
464
- time: witgen
464
+ time: witgen,
465
+ oracles
465
466
  }));
466
467
  const timings = {
467
468
  total: totalTime,
@@ -504,10 +505,13 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
504
505
  profileMode
505
506
  });
506
507
  const totalTime = totalTimer.ms();
507
- const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>({
508
+ const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>{
509
+ return {
508
510
  functionName,
509
- time: witgen
510
- }));
511
+ time: witgen,
512
+ oracles
513
+ };
514
+ });
511
515
  // Gate computation is time is not relevant for profiling, so we subtract it from the total time.
512
516
  const gateCountComputationTime = executionSteps.reduce((acc, { timings })=>acc + (timings.gateCount ?? 0), 0) ?? 0;
513
517
  const timings = {
@@ -573,9 +577,10 @@ import { enrichPublicSimulationError, enrichSimulationError } from './error_enri
573
577
  }
574
578
  const txHash = await simulatedTx.getTxHash();
575
579
  const totalTime = totalTimer.ms();
576
- const perFunction = executionSteps.map(({ functionName, timings: { witgen } })=>({
580
+ const perFunction = executionSteps.map(({ functionName, timings: { witgen, oracles } })=>({
577
581
  functionName,
578
- time: witgen
582
+ time: witgen,
583
+ oracles
579
584
  }));
580
585
  const timings = {
581
586
  total: totalTime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.87.2",
3
+ "version": "0.87.3-nightly.20250529",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -57,19 +57,19 @@
57
57
  ]
58
58
  },
59
59
  "dependencies": {
60
- "@aztec/bb-prover": "0.87.2",
61
- "@aztec/bb.js": "0.87.2",
62
- "@aztec/builder": "0.87.2",
63
- "@aztec/constants": "0.87.2",
64
- "@aztec/ethereum": "0.87.2",
65
- "@aztec/foundation": "0.87.2",
66
- "@aztec/key-store": "0.87.2",
67
- "@aztec/kv-store": "0.87.2",
68
- "@aztec/noir-protocol-circuits-types": "0.87.2",
69
- "@aztec/noir-types": "0.87.2",
70
- "@aztec/protocol-contracts": "0.87.2",
71
- "@aztec/simulator": "0.87.2",
72
- "@aztec/stdlib": "0.87.2",
60
+ "@aztec/bb-prover": "0.87.3-nightly.20250529",
61
+ "@aztec/bb.js": "0.87.3-nightly.20250529",
62
+ "@aztec/builder": "0.87.3-nightly.20250529",
63
+ "@aztec/constants": "0.87.3-nightly.20250529",
64
+ "@aztec/ethereum": "0.87.3-nightly.20250529",
65
+ "@aztec/foundation": "0.87.3-nightly.20250529",
66
+ "@aztec/key-store": "0.87.3-nightly.20250529",
67
+ "@aztec/kv-store": "0.87.3-nightly.20250529",
68
+ "@aztec/noir-protocol-circuits-types": "0.87.3-nightly.20250529",
69
+ "@aztec/noir-types": "0.87.3-nightly.20250529",
70
+ "@aztec/protocol-contracts": "0.87.3-nightly.20250529",
71
+ "@aztec/simulator": "0.87.3-nightly.20250529",
72
+ "@aztec/stdlib": "0.87.3-nightly.20250529",
73
73
  "koa": "^2.16.1",
74
74
  "koa-router": "^12.0.0",
75
75
  "lodash.omit": "^4.5.0",
@@ -78,7 +78,7 @@
78
78
  "viem": "2.23.7"
79
79
  },
80
80
  "devDependencies": {
81
- "@aztec/noir-test-contracts.js": "0.87.2",
81
+ "@aztec/noir-test-contracts.js": "0.87.3-nightly.20250529",
82
82
  "@jest/globals": "^29.5.0",
83
83
  "@types/jest": "^29.5.0",
84
84
  "@types/lodash.omit": "^4.5.7",
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '0.87.1', name: '@aztec/pxe' };
2
+ return { version: '0.87.3', name: '@aztec/pxe' };
3
3
  }
@@ -1,4 +1,5 @@
1
1
  import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
2
+ import { randomBytes } from '@aztec/foundation/crypto';
2
3
  import { createLogger } from '@aztec/foundation/log';
3
4
  import { createStore } from '@aztec/kv-store/indexeddb';
4
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
@@ -7,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
7
8
 
8
9
  import type { PXEServiceConfig } from '../../../config/index.js';
9
10
  import { PXEService } from '../../../pxe_service/pxe_service.js';
10
- import type { PXECreationOptions } from '../pxe_creation_options.js';
11
+ import type { PXECreationOptions } from '../../pxe_creation_options.js';
11
12
 
12
13
  /**
13
14
  * Create and start an PXEService instance with the given AztecNode.
@@ -24,6 +25,15 @@ export async function createPXEService(
24
25
  config: PXEServiceConfig,
25
26
  options: PXECreationOptions = { loggers: {} },
26
27
  ) {
28
+ const logSuffix =
29
+ typeof options.useLogSuffix === 'boolean'
30
+ ? options.useLogSuffix
31
+ ? randomBytes(3).toString('hex')
32
+ : undefined
33
+ : options.useLogSuffix;
34
+
35
+ const loggers = options.loggers ?? {};
36
+
27
37
  const l1Contracts = await aztecNode.getL1ContractAddresses();
28
38
  const configWithContracts = {
29
39
  ...config,
@@ -31,21 +41,19 @@ export async function createPXEService(
31
41
  l2BlockBatchSize: 200,
32
42
  } as PXEServiceConfig;
33
43
 
34
- const store = await createStore(
35
- 'pxe_data',
36
- configWithContracts,
37
- options.loggers.store ?? createLogger('pxe:data:indexeddb'),
38
- );
44
+ const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
45
+
46
+ const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
39
47
 
40
48
  const simulationProvider = new WASMSimulator();
41
- const prover =
42
- options.prover ??
43
- new BBWASMBundlePrivateKernelProver(
44
- simulationProvider,
45
- 16,
46
- options.loggers.prover ?? createLogger('bb:wasm:bundle'),
47
- );
49
+ const proverLogger = loggers.prover
50
+ ? loggers.prover
51
+ : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
52
+
53
+ const prover = options.prover ?? new BBWASMBundlePrivateKernelProver(simulationProvider, 16, proverLogger);
48
54
  const protocolContractsProvider = new BundledProtocolContractsProvider();
55
+
56
+ const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
49
57
  const pxe = await PXEService.create(
50
58
  aztecNode,
51
59
  store,
@@ -53,7 +61,7 @@ export async function createPXEService(
53
61
  simulationProvider,
54
62
  protocolContractsProvider,
55
63
  config,
56
- options.loggers.pxe ?? createLogger('pxe:service'),
64
+ pxeLogger,
57
65
  );
58
66
  return pxe;
59
67
  }
@@ -1,4 +1,5 @@
1
1
  import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/client/wasm/lazy';
2
+ import { randomBytes } from '@aztec/foundation/crypto';
2
3
  import { createLogger } from '@aztec/foundation/log';
3
4
  import { createStore } from '@aztec/kv-store/indexeddb';
4
5
  import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
@@ -7,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
7
8
 
8
9
  import type { PXEServiceConfig } from '../../../config/index.js';
9
10
  import { PXEService } from '../../../pxe_service/pxe_service.js';
10
- import type { PXECreationOptions } from '../pxe_creation_options.js';
11
+ import type { PXECreationOptions } from '../../pxe_creation_options.js';
11
12
 
12
13
  /**
13
14
  * Create and start an PXEService instance with the given AztecNode.
@@ -23,6 +24,13 @@ export async function createPXEService(
23
24
  config: PXEServiceConfig,
24
25
  options: PXECreationOptions = { loggers: {} },
25
26
  ) {
27
+ const logSuffix =
28
+ typeof options.useLogSuffix === 'boolean'
29
+ ? options.useLogSuffix
30
+ ? randomBytes(3).toString('hex')
31
+ : undefined
32
+ : options.useLogSuffix;
33
+
26
34
  const l1Contracts = await aztecNode.getL1ContractAddresses();
27
35
  const configWithContracts = {
28
36
  ...config,
@@ -30,17 +38,22 @@ export async function createPXEService(
30
38
  l1Contracts,
31
39
  } as PXEServiceConfig;
32
40
 
33
- const store = await createStore(
34
- 'pxe_data',
35
- configWithContracts,
36
- options.loggers.store ?? createLogger('pxe:data:indexeddb'),
37
- );
41
+ const loggers = options.loggers ?? {};
42
+
43
+ const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
44
+
45
+ const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
38
46
 
39
47
  const simulationProvider = new WASMSimulator();
40
- const prover =
41
- options.prover ??
42
- new BBWASMLazyPrivateKernelProver(simulationProvider, 16, options.loggers.prover ?? createLogger('bb:wasm:lazy'));
48
+ const proverLogger = loggers.prover
49
+ ? loggers.prover
50
+ : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
51
+
52
+ const prover = options.prover ?? new BBWASMLazyPrivateKernelProver(simulationProvider, 16, proverLogger);
53
+
43
54
  const protocolContractsProvider = new LazyProtocolContractsProvider();
55
+
56
+ const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
44
57
  const pxe = await PXEService.create(
45
58
  aztecNode,
46
59
  store,
@@ -48,7 +61,7 @@ export async function createPXEService(
48
61
  simulationProvider,
49
62
  protocolContractsProvider,
50
63
  config,
51
- options.loggers.pxe ?? createLogger('pxe:service'),
64
+ pxeLogger,
52
65
  );
53
66
  return pxe;
54
67
  }
@@ -1,7 +1,10 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
3
  import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
3
4
 
4
5
  export type PXECreationOptions = {
5
- loggers: { store?: Logger; pxe?: Logger; prover?: Logger };
6
+ loggers?: { store?: Logger; pxe?: Logger; prover?: Logger };
7
+ useLogSuffix?: boolean | string;
6
8
  prover?: PrivateKernelProver;
9
+ store?: AztecAsyncKVStore;
7
10
  };
@@ -1,16 +1,21 @@
1
1
  import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
2
2
  import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
3
3
  import { randomBytes } from '@aztec/foundation/crypto';
4
- import { createLogger } from '@aztec/foundation/log';
5
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
+ import { type Logger, createLogger } from '@aztec/foundation/log';
6
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
7
- import { type SimulationProvider, WASMSimulator } from '@aztec/simulator/client';
8
- import { SimulationProviderRecorderWrapper } from '@aztec/simulator/testing';
6
+ import {
7
+ MemoryCircuitRecorder,
8
+ type SimulationProvider,
9
+ SimulationProviderRecorderWrapper,
10
+ WASMSimulator,
11
+ } from '@aztec/simulator/client';
12
+ import { FileCircuitRecorder } from '@aztec/simulator/testing';
9
13
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
10
14
 
11
15
  import type { PXEServiceConfig } from '../../config/index.js';
12
16
  import { PXEService } from '../../pxe_service/pxe_service.js';
13
17
  import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
18
+ import type { PXECreationOptions } from '../pxe_creation_options.js';
14
19
 
15
20
  /**
16
21
  * Create and start an PXEService instance with the given AztecNode and config.
@@ -23,12 +28,14 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
23
28
  export function createPXEService(
24
29
  aztecNode: AztecNode,
25
30
  config: PXEServiceConfig,
26
- useLogSuffix: string | boolean | undefined = undefined,
27
- store?: AztecAsyncKVStore,
31
+ options: PXECreationOptions = { loggers: {} },
28
32
  ) {
29
33
  const simulationProvider = new WASMSimulator();
30
- const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider);
31
- return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, useLogSuffix, store);
34
+ const recorder = process.env.CIRCUIT_RECORD_DIR
35
+ ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
36
+ : new MemoryCircuitRecorder();
37
+ const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider, recorder);
38
+ return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, options);
32
39
  }
33
40
 
34
41
  /**
@@ -44,11 +51,15 @@ export async function createPXEServiceWithSimulationProvider(
44
51
  aztecNode: AztecNode,
45
52
  simulationProvider: SimulationProvider,
46
53
  config: PXEServiceConfig,
47
- useLogSuffix: string | boolean | undefined = undefined,
48
- store?: AztecAsyncKVStore,
54
+ options: PXECreationOptions = { loggers: {} },
49
55
  ) {
50
56
  const logSuffix =
51
- typeof useLogSuffix === 'boolean' ? (useLogSuffix ? randomBytes(3).toString('hex') : undefined) : useLogSuffix;
57
+ typeof options.useLogSuffix === 'boolean'
58
+ ? options.useLogSuffix
59
+ ? randomBytes(3).toString('hex')
60
+ : undefined
61
+ : options.useLogSuffix;
62
+ const loggers = options.loggers ?? {};
52
63
 
53
64
  const l1Contracts = await aztecNode.getL1ContractAddresses();
54
65
  const configWithContracts = {
@@ -57,34 +68,41 @@ export async function createPXEServiceWithSimulationProvider(
57
68
  l2BlockBatchSize: 200,
58
69
  } as PXEServiceConfig;
59
70
 
60
- if (!store) {
71
+ if (!options.store) {
61
72
  // TODO once https://github.com/AztecProtocol/aztec-packages/issues/13656 is fixed, we can remove this and always
62
73
  // import the lmdb-v2 version
63
74
  const { createStore } = await import('@aztec/kv-store/lmdb-v2');
64
- store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, createLogger('pxe:data:lmdb'));
75
+ const storeLogger = loggers.store
76
+ ? loggers.store
77
+ : createLogger('pxe:data:lmdb' + (logSuffix ? `:${logSuffix}` : ''));
78
+ options.store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, storeLogger);
65
79
  }
80
+ const proverLogger = loggers.prover
81
+ ? loggers.prover
82
+ : createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
66
83
 
67
- const prover = await createProver(config, simulationProvider, logSuffix);
84
+ const prover = await createProver(config, simulationProvider, proverLogger);
68
85
  const protocolContractsProvider = new BundledProtocolContractsProvider();
86
+
87
+ const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
69
88
  const pxe = await PXEService.create(
70
89
  aztecNode,
71
- store,
90
+ options.store,
72
91
  prover,
73
92
  simulationProvider,
74
93
  protocolContractsProvider,
75
94
  config,
76
- logSuffix,
95
+ pxeLogger,
77
96
  );
78
97
  return pxe;
79
98
  }
80
99
 
81
- function createProver(config: PXEServiceConfig, simulationProvider: SimulationProvider, logSuffix?: string) {
100
+ function createProver(config: PXEServiceConfig, simulationProvider: SimulationProvider, logger?: Logger) {
82
101
  if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
83
- return new BBWASMBundlePrivateKernelProver(simulationProvider, 16);
102
+ return new BBWASMBundlePrivateKernelProver(simulationProvider, 16, logger);
84
103
  } else {
85
104
  const bbConfig = config as Required<Pick<PXEServiceConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>> &
86
105
  PXEServiceConfig;
87
- const log = createLogger('pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : ''));
88
- return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, log);
106
+ return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, simulationProvider, logger);
89
107
  }
90
108
  }