@aztec/pxe 0.41.0 → 0.42.0

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 (56) hide show
  1. package/dest/config/index.d.ts.map +1 -1
  2. package/dest/config/index.js +5 -2
  3. package/dest/contract_data_oracle/index.d.ts +1 -0
  4. package/dest/contract_data_oracle/index.d.ts.map +1 -1
  5. package/dest/contract_data_oracle/index.js +7 -1
  6. package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -1
  7. package/dest/contract_data_oracle/private_functions_tree.js +2 -2
  8. package/dest/kernel_oracle/index.d.ts +3 -3
  9. package/dest/kernel_oracle/index.d.ts.map +1 -1
  10. package/dest/kernel_oracle/index.js +6 -17
  11. package/dest/kernel_prover/kernel_prover.d.ts +3 -0
  12. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  13. package/dest/kernel_prover/kernel_prover.js +44 -8
  14. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.d.ts +2 -1
  15. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.d.ts.map +1 -1
  16. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.js +32 -12
  17. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.d.ts +1 -1
  18. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.d.ts.map +1 -1
  19. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.js +9 -7
  20. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.d.ts.map +1 -1
  21. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.js +7 -3
  22. package/dest/kernel_prover/proving_data_oracle.d.ts +6 -6
  23. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
  24. package/dest/note_processor/note_processor.d.ts +2 -2
  25. package/dest/note_processor/note_processor.d.ts.map +1 -1
  26. package/dest/note_processor/note_processor.js +1 -1
  27. package/dest/pxe_http/pxe_http_server.js +3 -3
  28. package/dest/pxe_service/create_pxe_service.js +2 -2
  29. package/dest/pxe_service/pxe_service.d.ts +6 -3
  30. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  31. package/dest/pxe_service/pxe_service.js +37 -63
  32. package/dest/pxe_service/test/pxe_test_suite.d.ts.map +1 -1
  33. package/dest/pxe_service/test/pxe_test_suite.js +3 -16
  34. package/dest/simulator_oracle/index.d.ts +1 -0
  35. package/dest/simulator_oracle/index.d.ts.map +1 -1
  36. package/dest/simulator_oracle/index.js +4 -1
  37. package/dest/synchronizer/synchronizer.d.ts +7 -0
  38. package/dest/synchronizer/synchronizer.d.ts.map +1 -1
  39. package/dest/synchronizer/synchronizer.js +9 -1
  40. package/package.json +14 -14
  41. package/src/config/index.ts +11 -1
  42. package/src/contract_data_oracle/index.ts +7 -0
  43. package/src/contract_data_oracle/private_functions_tree.ts +3 -1
  44. package/src/kernel_oracle/index.ts +4 -17
  45. package/src/kernel_prover/kernel_prover.ts +76 -16
  46. package/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_hints.ts +79 -8
  47. package/src/kernel_prover/private_inputs_builders/build_private_kernel_reset_outputs.ts +9 -5
  48. package/src/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.ts +13 -1
  49. package/src/kernel_prover/proving_data_oracle.ts +5 -6
  50. package/src/note_processor/note_processor.ts +2 -2
  51. package/src/pxe_http/pxe_http_server.ts +2 -2
  52. package/src/pxe_service/create_pxe_service.ts +1 -1
  53. package/src/pxe_service/pxe_service.ts +42 -109
  54. package/src/pxe_service/test/pxe_test_suite.ts +0 -20
  55. package/src/simulator_oracle/index.ts +4 -0
  56. package/src/synchronizer/synchronizer.ts +9 -0
@@ -3,13 +3,14 @@ import {
3
3
  MAX_NEW_NOTE_HASHES_PER_TX,
4
4
  MAX_NEW_NULLIFIERS_PER_TX,
5
5
  MAX_NOTE_ENCRYPTED_LOGS_PER_TX,
6
+ MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
6
7
  MAX_UNENCRYPTED_LOGS_PER_TX,
7
8
  type PrivateKernelCircuitPublicInputs,
8
9
  PrivateKernelTailHints,
9
10
  sortByCounterGetSortedHints,
10
11
  } from '@aztec/circuits.js';
11
12
 
12
- export function buildPrivateKernelTailHints(publicInputs: PrivateKernelCircuitPublicInputs) {
13
+ export function buildPrivateKernelTailHints(publicInputs: PrivateKernelCircuitPublicInputs): PrivateKernelTailHints {
13
14
  const [sortedNoteHashes, sortedNoteHashesIndexes] = sortByCounterGetSortedHints(
14
15
  publicInputs.end.newNoteHashes,
15
16
  MAX_NEW_NOTE_HASHES_PER_TX,
@@ -35,6 +36,15 @@ export function buildPrivateKernelTailHints(publicInputs: PrivateKernelCircuitPu
35
36
  MAX_UNENCRYPTED_LOGS_PER_TX,
36
37
  );
37
38
 
39
+ const [sortedCallRequests, sortedCallRequestsIndexes] = sortByCounterGetSortedHints(
40
+ publicInputs.end.publicCallStack,
41
+ MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
42
+ {
43
+ ascending: false,
44
+ hintIndexesBy: 'sorted',
45
+ },
46
+ );
47
+
38
48
  return new PrivateKernelTailHints(
39
49
  sortedNoteHashes,
40
50
  sortedNoteHashesIndexes,
@@ -46,5 +56,7 @@ export function buildPrivateKernelTailHints(publicInputs: PrivateKernelCircuitPu
46
56
  sortedEncryptedLogHashesIndexes,
47
57
  sortedUnencryptedLogHashes,
48
58
  sortedUnencryptedLogHashesIndexes,
59
+ sortedCallRequests,
60
+ sortedCallRequestsIndexes,
49
61
  );
50
62
  }
@@ -4,7 +4,6 @@ import {
4
4
  type Fr,
5
5
  type FunctionSelector,
6
6
  type GrumpkinPrivateKey,
7
- type KeyGenerator,
8
7
  type MembershipWitness,
9
8
  type NOTE_HASH_TREE_HEIGHT,
10
9
  type Point,
@@ -71,13 +70,13 @@ export interface ProvingDataOracle {
71
70
  getNoteHashTreeRoot(): Promise<Fr>;
72
71
 
73
72
  /**
74
- * Retrieves the sk_m for the pk_m and a generator index of the key type.
73
+ * Retrieves the sk_m corresponding to the pk_m.
75
74
  * @throws If the provided public key is not associated with any of the registered accounts.
76
- * @param masterPublicKey - The master public key to get secret key for.
77
- * @returns A Promise that resolves to sk_m and the corresponding app key generator.
75
+ * @param pkM - The master public key to get secret key for.
76
+ * @returns A Promise that resolves to sk_m.
78
77
  * @dev Used when feeding the sk_m to the kernel circuit for keys verification.
79
78
  */
80
- getMasterSecretKeyAndAppKeyGenerator(masterPublicKey: Point): Promise<[GrumpkinPrivateKey, KeyGenerator]>;
79
+ getMasterSecretKey(masterPublicKey: Point): Promise<GrumpkinPrivateKey>;
81
80
 
82
- getFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
81
+ getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
83
82
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  type AztecNode,
3
- type EncryptedL2BlockL2Logs,
3
+ type EncryptedNoteL2BlockL2Logs,
4
4
  L1NotePayload,
5
5
  type L2Block,
6
6
  TaggedNote,
@@ -88,7 +88,7 @@ export class NoteProcessor {
88
88
  * @param encryptedL2BlockLogs - Encrypted logs associated with the L2 blocks.
89
89
  * @returns A promise that resolves once the processing is completed.
90
90
  */
91
- public async process(l2Blocks: L2Block[], encryptedL2BlockLogs: EncryptedL2BlockL2Logs[]): Promise<void> {
91
+ public async process(l2Blocks: L2Block[], encryptedL2BlockLogs: EncryptedNoteL2BlockL2Logs[]): Promise<void> {
92
92
  if (l2Blocks.length !== encryptedL2BlockLogs.length) {
93
93
  throw new Error(
94
94
  `Number of blocks and EncryptedLogs is not equal. Received ${l2Blocks.length} blocks, ${encryptedL2BlockLogs.length} encrypted logs.`,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AuthWitness,
3
3
  CompleteAddress,
4
- EncryptedL2BlockL2Logs,
4
+ EncryptedNoteL2BlockL2Logs,
5
5
  ExtendedNote,
6
6
  ExtendedUnencryptedL2Log,
7
7
  L2Block,
@@ -50,7 +50,7 @@ export function createPXERpcServer(pxeService: PXE): JsonRpcServer {
50
50
  TxEffect,
51
51
  LogId,
52
52
  },
53
- { SimulatedTx, Tx, TxReceipt, EncryptedL2BlockL2Logs, UnencryptedL2BlockL2Logs, NullifierMembershipWitness },
53
+ { SimulatedTx, Tx, TxReceipt, EncryptedNoteL2BlockL2Logs, UnencryptedL2BlockL2Logs, NullifierMembershipWitness },
54
54
  ['start', 'stop'],
55
55
  );
56
56
  }
@@ -65,7 +65,7 @@ export async function createPXEService(
65
65
  getCanonicalClassRegisterer(),
66
66
  getCanonicalInstanceDeployer(),
67
67
  getCanonicalMultiCallEntrypointContract(),
68
- getCanonicalGasToken(l1Contracts.gasPortalAddress),
68
+ getCanonicalGasToken(),
69
69
  getCanonicalKeyRegistry(),
70
70
  ]) {
71
71
  await server.registerContract(contract);
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type AuthWitness,
3
3
  type AztecNode,
4
+ EncryptedNoteTxL2Logs,
4
5
  EncryptedTxL2Logs,
5
6
  ExtendedNote,
6
7
  type FunctionCall,
@@ -10,6 +11,7 @@ import {
10
11
  MerkleTreeId,
11
12
  type NoteFilter,
12
13
  type PXE,
14
+ type PXEInfo,
13
15
  type ProofCreator,
14
16
  SimulatedTx,
15
17
  SimulationError,
@@ -21,27 +23,24 @@ import {
21
23
  UnencryptedTxL2Logs,
22
24
  isNoirCallStackUnresolved,
23
25
  } from '@aztec/circuit-types';
24
- import { type TxPXEProcessingStats } from '@aztec/circuit-types/stats';
25
26
  import {
26
27
  AztecAddress,
27
- CallRequest,
28
28
  type CompleteAddress,
29
- FunctionData,
30
- MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
31
29
  type PartialAddress,
32
- type PrivateKernelTailCircuitPublicInputs,
33
- type PublicCallRequest,
34
30
  computeContractClassId,
35
31
  getContractClassFromArtifact,
36
32
  } from '@aztec/circuits.js';
37
33
  import { computeNoteHashNonce, siloNullifier } from '@aztec/circuits.js/hash';
38
34
  import { type ContractArtifact, type DecodedReturn, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
39
- import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
40
35
  import { type Fq, Fr } from '@aztec/foundation/fields';
41
36
  import { SerialQueue } from '@aztec/foundation/fifo';
42
37
  import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
43
- import { Timer } from '@aztec/foundation/timer';
44
38
  import { type KeyStore } from '@aztec/key-store';
39
+ import { getCanonicalClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
40
+ import { getCanonicalGasToken } from '@aztec/protocol-contracts/gas-token';
41
+ import { getCanonicalInstanceDeployer } from '@aztec/protocol-contracts/instance-deployer';
42
+ import { getCanonicalKeyRegistryAddress } from '@aztec/protocol-contracts/key-registry';
43
+ import { getCanonicalMultiCallEntrypointAddress } from '@aztec/protocol-contracts/multi-call-entrypoint';
45
44
  import {
46
45
  type AcirSimulator,
47
46
  type ExecutionResult,
@@ -73,7 +72,7 @@ export class PXEService implements PXE {
73
72
  private contractDataOracle: ContractDataOracle;
74
73
  private simulator: AcirSimulator;
75
74
  private log: DebugLogger;
76
- private nodeVersion: string;
75
+ private packageVersion: string;
77
76
  // serialize synchronizer and calls to proveTx.
78
77
  // ensures that state is not changed while simulating
79
78
  private jobQueue = new SerialQueue();
@@ -90,7 +89,7 @@ export class PXEService implements PXE {
90
89
  this.synchronizer = new Synchronizer(node, db, this.jobQueue, logSuffix);
91
90
  this.contractDataOracle = new ContractDataOracle(db);
92
91
  this.simulator = getAcirSimulator(db, node, keyStore, this.contractDataOracle);
93
- this.nodeVersion = getPackageInfo().version;
92
+ this.packageVersion = getPackageInfo().version;
94
93
 
95
94
  this.jobQueue.start();
96
95
  }
@@ -426,25 +425,13 @@ export class PXEService implements PXE {
426
425
  simulatePublic: boolean,
427
426
  msgSender: AztecAddress | undefined = undefined,
428
427
  ): Promise<SimulatedTx> {
429
- if (!txRequest.functionData.isPrivate) {
430
- throw new Error(`Public entrypoints are not allowed`);
431
- }
432
428
  return await this.jobQueue.put(async () => {
433
- const timer = new Timer();
434
429
  const simulatedTx = await this.#simulateAndProve(txRequest, msgSender);
435
430
  // We log only if the msgSender is undefined, as simulating with a different msgSender
436
431
  // is unlikely to be a real transaction, and likely to be only used to read data.
437
432
  // Meaning that it will not necessarily have produced a nullifier (and thus have no TxHash)
438
433
  // If we log, the `getTxHash` function will throw.
439
434
 
440
- if (!msgSender) {
441
- this.log.debug(`Processed private part of ${simulatedTx.tx.getTxHash()}`, {
442
- eventName: 'tx-pxe-processing',
443
- duration: timer.ms(),
444
- ...simulatedTx.tx.getStats(),
445
- } satisfies TxPXEProcessingStats);
446
- }
447
-
448
435
  if (simulatePublic) {
449
436
  simulatedTx.publicOutput = await this.#simulatePublicCalls(simulatedTx.tx);
450
437
  }
@@ -518,29 +505,49 @@ export class PXEService implements PXE {
518
505
  }
519
506
 
520
507
  return {
508
+ name: functionDao.name,
521
509
  args: encodeArguments(functionDao, args),
522
- functionData: FunctionData.fromAbi(functionDao),
510
+ selector: FunctionSelector.fromNameAndParameters(functionDao.name, functionDao.parameters),
511
+ type: functionDao.functionType,
523
512
  to,
524
513
  isStatic: functionDao.isStatic,
514
+ returnTypes: functionDao.returnTypes,
525
515
  };
526
516
  }
527
517
 
528
518
  public async getNodeInfo(): Promise<NodeInfo> {
529
- const [version, chainId, contractAddresses] = await Promise.all([
519
+ const [nodeVersion, protocolVersion, chainId, contractAddresses, protocolContractAddresses] = await Promise.all([
520
+ this.node.getNodeVersion(),
530
521
  this.node.getVersion(),
531
522
  this.node.getChainId(),
532
523
  this.node.getL1ContractAddresses(),
524
+ this.node.getProtocolContractAddresses(),
533
525
  ]);
534
526
 
535
527
  const nodeInfo: NodeInfo = {
536
- nodeVersion: this.nodeVersion,
528
+ nodeVersion,
537
529
  chainId,
538
- protocolVersion: version,
530
+ protocolVersion,
539
531
  l1ContractAddresses: contractAddresses,
532
+ protocolContractAddresses: protocolContractAddresses,
540
533
  };
534
+
541
535
  return nodeInfo;
542
536
  }
543
537
 
538
+ public getPXEInfo(): Promise<PXEInfo> {
539
+ return Promise.resolve({
540
+ pxeVersion: this.packageVersion,
541
+ protocolContractAddresses: {
542
+ classRegisterer: getCanonicalClassRegistererAddress(),
543
+ gasToken: getCanonicalGasToken().address,
544
+ instanceDeployer: getCanonicalInstanceDeployer().address,
545
+ keyRegistry: getCanonicalKeyRegistryAddress(),
546
+ multiCallEntrypoint: getCanonicalMultiCallEntrypointAddress(),
547
+ },
548
+ });
549
+ }
550
+
544
551
  /**
545
552
  * Retrieves the simulation parameters required to run an ACIR simulation.
546
553
  * This includes the contract address, function artifact, and historical tree roots.
@@ -550,14 +557,10 @@ export class PXEService implements PXE {
550
557
  */
551
558
  async #getSimulationParameters(execRequest: FunctionCall | TxExecutionRequest) {
552
559
  const contractAddress = (execRequest as FunctionCall).to ?? (execRequest as TxExecutionRequest).origin;
553
- const functionArtifact = await this.contractDataOracle.getFunctionArtifact(
554
- contractAddress,
555
- execRequest.functionData.selector,
556
- );
557
- const debug = await this.contractDataOracle.getFunctionDebugMetadata(
558
- contractAddress,
559
- execRequest.functionData.selector,
560
- );
560
+ const functionSelector =
561
+ (execRequest as FunctionCall).selector ?? (execRequest as TxExecutionRequest).functionSelector;
562
+ const functionArtifact = await this.contractDataOracle.getFunctionArtifact(contractAddress, functionSelector);
563
+ const debug = await this.contractDataOracle.getFunctionDebugMetadata(contractAddress, functionSelector);
561
564
 
562
565
  return {
563
566
  contractAddress,
@@ -664,16 +667,12 @@ export class PXEService implements PXE {
664
667
  this.log.debug(`Executing kernel prover...`);
665
668
  const { proof, publicInputs } = await kernelProver.prove(txExecutionRequest.toTxRequest(), executionResult);
666
669
 
667
- const noteEncryptedLogs = new EncryptedTxL2Logs([collectSortedNoteEncryptedLogs(executionResult)]);
670
+ const noteEncryptedLogs = new EncryptedNoteTxL2Logs([collectSortedNoteEncryptedLogs(executionResult)]);
668
671
  const unencryptedLogs = new UnencryptedTxL2Logs([collectSortedUnencryptedLogs(executionResult)]);
669
672
  const encryptedLogs = new EncryptedTxL2Logs([collectSortedEncryptedLogs(executionResult)]);
670
673
  const enqueuedPublicFunctions = collectEnqueuedPublicFunctionCalls(executionResult);
671
674
  const teardownPublicFunction = collectPublicTeardownFunctionCall(executionResult);
672
675
 
673
- // HACK(#1639): Manually patches the ordering of the public call stack
674
- // TODO(#757): Enforce proper ordering of enqueued public calls
675
- await this.patchPublicCallStackOrdering(publicInputs, enqueuedPublicFunctions);
676
-
677
676
  const tx = new Tx(
678
677
  publicInputs,
679
678
  proof.binaryProof,
@@ -724,76 +723,6 @@ export class PXEService implements PXE {
724
723
  );
725
724
  }
726
725
 
727
- // HACK(#1639): this is a hack to fix ordering of public calls enqueued in the call stack. Since the private kernel
728
- // cannot keep track of side effects that happen after or before a nested call, we override the public call stack
729
- // it emits with whatever we got from the simulator collected enqueued calls. As a sanity check, we at least verify
730
- // that the elements are the same, so we are only tweaking their ordering.
731
- // See yarn-project/end-to-end/src/e2e_ordering.test.ts
732
- // See https://github.com/AztecProtocol/aztec-packages/issues/1615
733
- // TODO(#757): Enforce proper ordering of enqueued public calls
734
- private async patchPublicCallStackOrdering(
735
- publicInputs: PrivateKernelTailCircuitPublicInputs,
736
- enqueuedPublicCalls: PublicCallRequest[],
737
- ) {
738
- if (!publicInputs.forPublic) {
739
- return;
740
- }
741
-
742
- const enqueuedPublicCallStackItems = await Promise.all(enqueuedPublicCalls.map(c => c.toCallRequest()));
743
-
744
- // Validate all items in enqueued public calls are in the kernel emitted stack
745
- const enqueuedRevertiblePublicCallStackItems = enqueuedPublicCallStackItems.filter(enqueued =>
746
- publicInputs.forPublic!.end.publicCallStack.find(item => item.equals(enqueued)),
747
- );
748
-
749
- const revertibleStackSize = arrayNonEmptyLength(publicInputs.forPublic.end.publicCallStack, item => item.isEmpty());
750
-
751
- if (enqueuedRevertiblePublicCallStackItems.length !== revertibleStackSize) {
752
- throw new Error(
753
- `Enqueued revertible public function calls and revertible public call stack do not match.\nEnqueued calls: ${enqueuedRevertiblePublicCallStackItems
754
- .map(h => h.hash.toString())
755
- .join(', ')}\nPublic call stack: ${publicInputs.forPublic.end.publicCallStack
756
- .map(i => i.toString())
757
- .join(', ')}`,
758
- );
759
- }
760
-
761
- // Override kernel output
762
- publicInputs.forPublic.end.publicCallStack = padArrayEnd(
763
- enqueuedRevertiblePublicCallStackItems,
764
- CallRequest.empty(),
765
- MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
766
- );
767
-
768
- // Do the same for non-revertible
769
-
770
- const enqueuedNonRevertiblePublicCallStackItems = enqueuedPublicCallStackItems.filter(enqueued =>
771
- publicInputs.forPublic!.endNonRevertibleData.publicCallStack.find(item => item.equals(enqueued)),
772
- );
773
-
774
- const nonRevertibleStackSize = arrayNonEmptyLength(
775
- publicInputs.forPublic.endNonRevertibleData.publicCallStack,
776
- item => item.isEmpty(),
777
- );
778
-
779
- if (enqueuedNonRevertiblePublicCallStackItems.length !== nonRevertibleStackSize) {
780
- throw new Error(
781
- `Enqueued non-revertible public function calls and non-revertible public call stack do not match.\nEnqueued calls: ${enqueuedNonRevertiblePublicCallStackItems
782
- .map(h => h.hash.toString())
783
- .join(', ')}\nPublic call stack: ${publicInputs.forPublic.endNonRevertibleData.publicCallStack
784
- .map(i => i.toString())
785
- .join(', ')}`,
786
- );
787
- }
788
-
789
- // Override kernel output
790
- publicInputs.forPublic.endNonRevertibleData.publicCallStack = padArrayEnd(
791
- enqueuedNonRevertiblePublicCallStackItems,
792
- CallRequest.empty(),
793
- MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX,
794
- );
795
- }
796
-
797
726
  public async isGlobalStateSynchronized() {
798
727
  return await this.synchronizer.isGlobalStateSynchronized();
799
728
  }
@@ -806,6 +735,10 @@ export class PXEService implements PXE {
806
735
  return Promise.resolve(this.synchronizer.getSyncStatus());
807
736
  }
808
737
 
738
+ public getSyncStats() {
739
+ return Promise.resolve(this.synchronizer.getSyncStats());
740
+ }
741
+
809
742
  public async isContractClassPubliclyRegistered(id: Fr): Promise<boolean> {
810
743
  return !!(await this.node.getContractClass(id));
811
744
  }
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  type PXE,
3
- TxExecutionRequest,
4
3
  randomContractArtifact,
5
4
  randomContractInstanceWithAddress,
6
5
  randomDeployedContract,
@@ -9,11 +8,9 @@ import {
9
8
  AztecAddress,
10
9
  CompleteAddress,
11
10
  Fr,
12
- FunctionData,
13
11
  INITIAL_L2_BLOCK_NUM,
14
12
  Point,
15
13
  PublicKeys,
16
- TxContext,
17
14
  getContractClassFromArtifact,
18
15
  } from '@aztec/circuits.js';
19
16
 
@@ -126,23 +123,6 @@ export const pxeTestSuite = (testName: string, pxeSetup: () => Promise<PXE>) =>
126
123
  await expect(pxe.registerContract({ instance, artifact })).rejects.toThrow(/Artifact does not match/i);
127
124
  });
128
125
 
129
- it('throws when simulating a tx targeting public entrypoint', async () => {
130
- const functionData = FunctionData.empty();
131
- functionData.isPrivate = false;
132
- const txExecutionRequest = TxExecutionRequest.from({
133
- origin: AztecAddress.random(),
134
- firstCallArgsHash: new Fr(0),
135
- functionData,
136
- txContext: TxContext.empty(),
137
- argsOfCalls: [],
138
- authWitnesses: [],
139
- });
140
-
141
- await expect(async () => await pxe.proveTx(txExecutionRequest, false)).rejects.toThrow(
142
- 'Public entrypoints are not allowed',
143
- );
144
- });
145
-
146
126
  // Note: Not testing a successful run of `proveTx`, `sendTx`, `getTxReceipt` and `simulateUnconstrained` here as it requires
147
127
  // a larger setup and it's sufficiently tested in the e2e tests.
148
128
 
@@ -230,4 +230,8 @@ export class SimulatorOracle implements DBOracle {
230
230
  public async getBlockNumber(): Promise<number> {
231
231
  return await this.aztecNode.getBlockNumber();
232
232
  }
233
+
234
+ public getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string> {
235
+ return this.contractDataOracle.getDebugFunctionName(contractAddress, selector);
236
+ }
233
237
  }
@@ -110,6 +110,7 @@ export class Synchronizer {
110
110
  `Forwarding ${logCount} encrypted logs and blocks to ${this.noteProcessors.length} note processors`,
111
111
  );
112
112
  for (const noteProcessor of this.noteProcessors) {
113
+ // TODO(#6830): pass in only the blocks
113
114
  await noteProcessor.process(blocks, noteEncryptedLogs);
114
115
  }
115
116
  return true;
@@ -319,6 +320,14 @@ export class Synchronizer {
319
320
  };
320
321
  }
321
322
 
323
+ /**
324
+ * Returns the note processor stats.
325
+ * @returns The note processor stats for notes for each public key being tracked.
326
+ */
327
+ public getSyncStats() {
328
+ return Object.fromEntries(this.noteProcessors.map(n => [n.masterIncomingViewingPublicKey.toString(), n.stats]));
329
+ }
330
+
322
331
  /**
323
332
  * Retry decoding any deferred notes for the specified contract address.
324
333
  * @param contractAddress - the contract address that has just been added