@aztec/pxe 0.0.1-commit.d1f2d6c → 0.0.1-commit.d431d1c

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 (100) hide show
  1. package/dest/block_synchronizer/block_synchronizer.d.ts +4 -6
  2. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_synchronizer.js +11 -51
  4. package/dest/config/index.d.ts +1 -3
  5. package/dest/config/index.d.ts.map +1 -1
  6. package/dest/config/index.js +0 -17
  7. package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/contract_function_simulator.js +4 -1
  10. package/dest/contract_function_simulator/oracle/interfaces.d.ts +4 -7
  11. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -4
  13. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/oracle/oracle.js +9 -19
  15. package/dest/contract_function_simulator/oracle/private_execution.d.ts +6 -5
  16. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/private_execution.js +1 -10
  18. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -9
  19. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +5 -17
  21. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +6 -14
  22. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -31
  24. package/dest/debug/pxe_debug_utils.d.ts +1 -1
  25. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  26. package/dest/debug/pxe_debug_utils.js +1 -2
  27. package/dest/logs/log_service.d.ts +1 -1
  28. package/dest/logs/log_service.d.ts.map +1 -1
  29. package/dest/logs/log_service.js +11 -18
  30. package/dest/notes/note_service.d.ts +2 -3
  31. package/dest/notes/note_service.d.ts.map +1 -1
  32. package/dest/notes/note_service.js +6 -8
  33. package/dest/oracle_version.d.ts +3 -3
  34. package/dest/oracle_version.d.ts.map +1 -1
  35. package/dest/oracle_version.js +3 -4
  36. package/dest/pxe.d.ts +1 -1
  37. package/dest/pxe.d.ts.map +1 -1
  38. package/dest/pxe.js +7 -10
  39. package/dest/storage/note_store/note_store.d.ts +55 -43
  40. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  41. package/dest/storage/note_store/note_store.js +252 -238
  42. package/dest/storage/private_event_store/private_event_store.d.ts +4 -17
  43. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  44. package/dest/storage/private_event_store/private_event_store.js +135 -163
  45. package/dest/tagging/index.d.ts +1 -2
  46. package/dest/tagging/index.d.ts.map +1 -1
  47. package/dest/tagging/index.js +0 -1
  48. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -3
  49. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  50. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +2 -2
  51. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +2 -3
  52. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  53. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +2 -5
  54. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +2 -3
  55. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  56. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +2 -2
  57. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
  58. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  59. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +8 -5
  60. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +2 -3
  61. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  62. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +4 -7
  63. package/dest/tree_membership/tree_membership_service.d.ts +50 -0
  64. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
  65. package/dest/tree_membership/tree_membership_service.js +75 -0
  66. package/package.json +16 -16
  67. package/src/block_synchronizer/block_synchronizer.ts +14 -53
  68. package/src/config/index.ts +0 -14
  69. package/src/contract_function_simulator/contract_function_simulator.ts +9 -1
  70. package/src/contract_function_simulator/oracle/interfaces.ts +3 -12
  71. package/src/contract_function_simulator/oracle/oracle.ts +13 -26
  72. package/src/contract_function_simulator/oracle/private_execution.ts +1 -20
  73. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +6 -33
  74. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +38 -46
  75. package/src/debug/pxe_debug_utils.ts +1 -2
  76. package/src/logs/log_service.ts +8 -25
  77. package/src/notes/note_service.ts +11 -15
  78. package/src/oracle_version.ts +3 -4
  79. package/src/pxe.ts +8 -32
  80. package/src/storage/note_store/note_store.ts +313 -279
  81. package/src/storage/private_event_store/private_event_store.ts +175 -214
  82. package/src/tagging/index.ts +0 -1
  83. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +1 -11
  84. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +1 -7
  85. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +1 -3
  86. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +17 -5
  87. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +3 -12
  88. package/src/tree_membership/tree_membership_service.ts +97 -0
  89. package/dest/storage/note_store/stored_note.d.ts +0 -16
  90. package/dest/storage/note_store/stored_note.d.ts.map +0 -1
  91. package/dest/storage/note_store/stored_note.js +0 -43
  92. package/dest/storage/private_event_store/stored_private_event.d.ts +0 -23
  93. package/dest/storage/private_event_store/stored_private_event.d.ts.map +0 -1
  94. package/dest/storage/private_event_store/stored_private_event.js +0 -56
  95. package/dest/tagging/get_all_logs_by_tags.d.ts +0 -24
  96. package/dest/tagging/get_all_logs_by_tags.d.ts.map +0 -1
  97. package/dest/tagging/get_all_logs_by_tags.js +0 -46
  98. package/src/storage/note_store/stored_note.ts +0 -48
  99. package/src/storage/private_event_store/stored_private_event.ts +0 -73
  100. package/src/tagging/get_all_logs_by_tags.ts +0 -68
@@ -1,6 +1,5 @@
1
1
  import { SiloedTag, Tag } from '@aztec/stdlib/logs';
2
2
  import { TxHash } from '@aztec/stdlib/tx';
3
- import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
4
3
  /**
5
4
  * Loads tagging indexes from the Aztec node and stores them in the tagging data provider.
6
5
  * @remarks This function is one of two places by which a pending index can get to the tagging data provider. The other
@@ -14,14 +13,14 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
14
13
  * @param taggingStore - The data provider to store pending indexes.
15
14
  * @param jobId - Job identifier, used to keep writes in-memory until they can be persisted in a data integrity
16
15
  * preserving way.
17
- */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, anchorBlockHash, jobId) {
16
+ */ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore, jobId) {
18
17
  // We compute the tags for the current window of indexes
19
18
  const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
20
19
  secret,
21
20
  index: start + i
22
21
  }));
23
22
  const siloedTagsForWindow = await Promise.all(preTagsForWindow.map(async (preTag)=>SiloedTag.compute(await Tag.compute(preTag), app)));
24
- const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode, anchorBlockHash);
23
+ const txsForTags = await getTxsContainingTags(siloedTagsForWindow, aztecNode);
25
24
  const highestIndexMap = getTxHighestIndexMap(txsForTags, preTagsForWindow);
26
25
  // Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
27
26
  for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
@@ -36,10 +35,8 @@ import { getAllPrivateLogsByTags } from '../../get_all_logs_by_tags.js';
36
35
  }
37
36
  // Returns txs that used the given tags. A tag might have been used in multiple txs and for this reason we return
38
37
  // an array for each tag.
39
- async function getTxsContainingTags(tags, aztecNode, anchorBlockHash) {
40
- // We use the utility function below to retrieve all logs for the tags across all pages, so we don't need to handle
41
- // pagination here.
42
- const allLogs = await getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash);
38
+ async function getTxsContainingTags(tags, aztecNode) {
39
+ const allLogs = await aztecNode.getPrivateLogsByTags(tags);
43
40
  return allLogs.map((logs)=>logs.map((log)=>log.txHash));
44
41
  }
45
42
  // Returns a map of txHash to the highest index for that txHash.
@@ -0,0 +1,50 @@
1
+ import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { SiblingPath } from '@aztec/foundation/trees';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import { L2BlockHash } from '@aztec/stdlib/block';
6
+ import type { AztecNode } from '@aztec/stdlib/interfaces/server';
7
+ import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
8
+ export declare class TreeMembershipService {
9
+ #private;
10
+ private readonly aztecNode;
11
+ constructor(aztecNode: AztecNode);
12
+ /**
13
+ * Gets the index of a nullifier in the nullifier tree.
14
+ * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
15
+ */
16
+ getNullifierIndex(nullifier: Fr): Promise<bigint | undefined>;
17
+ /**
18
+ * Fetches the index and sibling path of a leaf at a given block from a given tree.
19
+ * @param blockHash - The block hash at which to get the membership witness.
20
+ * @param treeId - Id of the tree to get the sibling path from.
21
+ * @param leafValue - The leaf value
22
+ * @returns The index and sibling path concatenated [index, sibling_path]
23
+ */
24
+ getMembershipWitness(blockHash: L2BlockHash, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
25
+ /**
26
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
27
+ * @param blockHash - The block hash at which to get the index.
28
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
29
+ * @returns The low nullifier membership witness (if found).
30
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
31
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
32
+ * we are trying to prove non-inclusion for.
33
+ */
34
+ getLowNullifierMembershipWitness(blockHash: L2BlockHash, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
35
+ /**
36
+ * Returns a witness for a given slot of the public data tree at a given block.
37
+ * @param blockHash - The block hash at which to get the witness.
38
+ * @param leafSlot - The slot of the public data in the public data tree.
39
+ */
40
+ getPublicDataWitness(blockHash: L2BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
41
+ /**
42
+ * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
43
+ * @param contractAddress - Address of a contract by which the message was emitted.
44
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
45
+ * The message nullifier is computed locally, so the secret is not sent to the node.
46
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
47
+ */
48
+ getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
49
+ }
50
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDbEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxFQUFFLFlBQVksRUFBRSwwQkFBMEIsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBTWxHLHFCQUFhLHFCQUFxQjs7SUFDcEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBQXRDLFlBQTZCLFNBQVMsRUFBRSxTQUFTLEVBQUk7SUFFckQ7OztPQUdHO0lBQ1UsaUJBQWlCLENBQUMsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxDQUd6RTtJQUVEOzs7Ozs7T0FNRztJQUNVLG9CQUFvQixDQUFDLFNBQVMsRUFBRSxXQUFXLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxTQUFTLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQVE1RztJQUVEOzs7Ozs7OztPQVFHO0lBQ0ksZ0NBQWdDLENBQ3JDLFNBQVMsRUFBRSxXQUFXLEVBQ3RCLFNBQVMsRUFBRSxFQUFFLEdBQ1osT0FBTyxDQUFDLDBCQUEwQixHQUFHLFNBQVMsQ0FBQyxDQUVqRDtJQUVEOzs7O09BSUc7SUFDSSxvQkFBb0IsQ0FBQyxTQUFTLEVBQUUsV0FBVyxFQUFFLFFBQVEsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixHQUFHLFNBQVMsQ0FBQyxDQUV4RztJQUVEOzs7Ozs7T0FNRztJQUNJLDBCQUEwQixDQUMvQixlQUFlLEVBQUUsWUFBWSxFQUM3QixXQUFXLEVBQUUsRUFBRSxFQUNmLE1BQU0sRUFBRSxFQUFFLEdBQ1QsT0FBTyxDQUFDLENBQUMsTUFBTSxFQUFFLFdBQVcsQ0FBQyxPQUFPLHdCQUF3QixDQUFDLENBQUMsQ0FBQyxDQUVqRTtDQWdCRiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAMlG,qBAAa,qBAAqB;;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,SAAS,EAAI;IAErD;;;OAGG;IACU,iBAAiB,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAGzE;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAQ5G;IAED;;;;;;;;OAQG;IACI,gCAAgC,CACrC,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAEjD;IAED;;;;OAIG;IACI,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAExG;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAgBF"}
@@ -0,0 +1,75 @@
1
+ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
2
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
3
+ // TODO: REmove this class as it no longer seems valuable. The only somewhat real functionality in this class is in
4
+ // the `getMembershipWitness` method that is used by `utilityGetMembershipWitness` oracle by then in Aztec.nr we
5
+ // have helper functions around that oracle for archive and note hash tree and the generic method itself is not used
6
+ // anywhere else - make sense to just have simple specific handlers for the archive and note hash trees and drop this.
7
+ export class TreeMembershipService {
8
+ aztecNode;
9
+ constructor(aztecNode){
10
+ this.aztecNode = aztecNode;
11
+ }
12
+ /**
13
+ * Gets the index of a nullifier in the nullifier tree.
14
+ * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
15
+ */ async getNullifierIndex(nullifier) {
16
+ const [leafIndex] = await this.aztecNode.findLeavesIndexes('latest', MerkleTreeId.NULLIFIER_TREE, [
17
+ nullifier
18
+ ]);
19
+ return leafIndex?.data;
20
+ }
21
+ /**
22
+ * Fetches the index and sibling path of a leaf at a given block from a given tree.
23
+ * @param blockHash - The block hash at which to get the membership witness.
24
+ * @param treeId - Id of the tree to get the sibling path from.
25
+ * @param leafValue - The leaf value
26
+ * @returns The index and sibling path concatenated [index, sibling_path]
27
+ */ async getMembershipWitness(blockHash, treeId, leafValue) {
28
+ const witness = await this.#tryGetMembershipWitness(blockHash, treeId, leafValue);
29
+ if (!witness) {
30
+ throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block hash ${blockHash.toString()}`);
31
+ }
32
+ return witness;
33
+ }
34
+ /**
35
+ * Returns a low nullifier membership witness for a given nullifier at a given block.
36
+ * @param blockHash - The block hash at which to get the index.
37
+ * @param nullifier - Nullifier we try to find the low nullifier witness for.
38
+ * @returns The low nullifier membership witness (if found).
39
+ * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
40
+ * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
41
+ * we are trying to prove non-inclusion for.
42
+ */ getLowNullifierMembershipWitness(blockHash, nullifier) {
43
+ return this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier);
44
+ }
45
+ /**
46
+ * Returns a witness for a given slot of the public data tree at a given block.
47
+ * @param blockHash - The block hash at which to get the witness.
48
+ * @param leafSlot - The slot of the public data in the public data tree.
49
+ */ getPublicDataWitness(blockHash, leafSlot) {
50
+ return this.aztecNode.getPublicDataWitness(blockHash, leafSlot);
51
+ }
52
+ /**
53
+ * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
54
+ * @param contractAddress - Address of a contract by which the message was emitted.
55
+ * @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages.
56
+ * The message nullifier is computed locally, so the secret is not sent to the node.
57
+ * @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
58
+ */ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
59
+ return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
60
+ }
61
+ async #tryGetMembershipWitness(blockHash, treeId, value) {
62
+ switch(treeId){
63
+ case MerkleTreeId.NULLIFIER_TREE:
64
+ return (await this.aztecNode.getNullifierMembershipWitness(blockHash, value))?.withoutPreimage().toFields();
65
+ case MerkleTreeId.NOTE_HASH_TREE:
66
+ return (await this.aztecNode.getNoteHashMembershipWitness(blockHash, value))?.toFields();
67
+ case MerkleTreeId.PUBLIC_DATA_TREE:
68
+ return (await this.aztecNode.getPublicDataWitness(blockHash, value))?.withoutPreimage().toFields();
69
+ case MerkleTreeId.ARCHIVE:
70
+ return (await this.aztecNode.getArchiveMembershipWitness(blockHash, value))?.toFields();
71
+ default:
72
+ throw new Error('Not implemented');
73
+ }
74
+ }
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.d1f2d6c",
3
+ "version": "0.0.1-commit.d431d1c",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -61,19 +61,19 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.d1f2d6c",
65
- "@aztec/bb.js": "0.0.1-commit.d1f2d6c",
66
- "@aztec/builder": "0.0.1-commit.d1f2d6c",
67
- "@aztec/constants": "0.0.1-commit.d1f2d6c",
68
- "@aztec/ethereum": "0.0.1-commit.d1f2d6c",
69
- "@aztec/foundation": "0.0.1-commit.d1f2d6c",
70
- "@aztec/key-store": "0.0.1-commit.d1f2d6c",
71
- "@aztec/kv-store": "0.0.1-commit.d1f2d6c",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.d1f2d6c",
73
- "@aztec/noir-types": "0.0.1-commit.d1f2d6c",
74
- "@aztec/protocol-contracts": "0.0.1-commit.d1f2d6c",
75
- "@aztec/simulator": "0.0.1-commit.d1f2d6c",
76
- "@aztec/stdlib": "0.0.1-commit.d1f2d6c",
64
+ "@aztec/bb-prover": "0.0.1-commit.d431d1c",
65
+ "@aztec/bb.js": "0.0.1-commit.d431d1c",
66
+ "@aztec/builder": "0.0.1-commit.d431d1c",
67
+ "@aztec/constants": "0.0.1-commit.d431d1c",
68
+ "@aztec/ethereum": "0.0.1-commit.d431d1c",
69
+ "@aztec/foundation": "0.0.1-commit.d431d1c",
70
+ "@aztec/key-store": "0.0.1-commit.d431d1c",
71
+ "@aztec/kv-store": "0.0.1-commit.d431d1c",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.d431d1c",
73
+ "@aztec/noir-types": "0.0.1-commit.d431d1c",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.d431d1c",
75
+ "@aztec/simulator": "0.0.1-commit.d431d1c",
76
+ "@aztec/stdlib": "0.0.1-commit.d431d1c",
77
77
  "koa": "^2.16.1",
78
78
  "koa-router": "^13.1.1",
79
79
  "lodash.omit": "^4.5.0",
@@ -82,8 +82,8 @@
82
82
  "viem": "npm:@aztec/viem@2.38.2"
83
83
  },
84
84
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.d1f2d6c",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.d1f2d6c",
85
+ "@aztec/merkle-tree": "0.0.1-commit.d431d1c",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.d431d1c",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/lodash.omit": "^4.5.7",
@@ -9,9 +9,8 @@ import {
9
9
  type L2BlockStreamEventHandler,
10
10
  } from '@aztec/stdlib/block';
11
11
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
12
- import type { BlockHeader } from '@aztec/stdlib/tx';
13
12
 
14
- import type { BlockSynchronizerConfig } from '../config/index.js';
13
+ import type { PXEConfig } from '../config/index.js';
15
14
  import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
16
15
  import type { NoteStore } from '../storage/note_store/note_store.js';
17
16
  import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
@@ -33,7 +32,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
33
32
  private noteStore: NoteStore,
34
33
  private privateEventStore: PrivateEventStore,
35
34
  private l2TipsStore: L2TipsKVStore,
36
- private config: Partial<BlockSynchronizerConfig> = {},
35
+ config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
37
36
  loggerOrSuffix?: string | Logger,
38
37
  ) {
39
38
  this.log =
@@ -43,7 +42,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
43
42
  this.blockStream = this.createBlockStream(config);
44
43
  }
45
44
 
46
- protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
45
+ protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>) {
47
46
  return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
48
47
  batchSize: config.l2BlockBatchSize,
49
48
  // Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
@@ -58,51 +57,19 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
58
57
 
59
58
  switch (event.type) {
60
59
  case 'blocks-added': {
61
- if (this.config.syncChainTip === undefined || this.config.syncChainTip === 'proposed') {
62
- const lastBlock = event.blocks.at(-1)!;
63
- await this.updateAnchorBlockHeader(lastBlock.header);
64
- }
65
- break;
66
- }
67
- case 'chain-checkpointed': {
68
- if (this.config.syncChainTip === 'checkpointed') {
69
- // Get the last block header from the checkpoint
70
- const lastBlock = event.checkpoint.checkpoint.blocks.at(-1)!;
71
- await this.updateAnchorBlockHeader(lastBlock.header);
72
- }
73
- break;
74
- }
75
- case 'chain-proven': {
76
- if (this.config.syncChainTip === 'proven') {
77
- const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
78
- if (blockHeader) {
79
- await this.updateAnchorBlockHeader(blockHeader);
80
- }
81
- }
82
- break;
83
- }
84
- case 'chain-finalized': {
85
- if (this.config.syncChainTip === 'finalized') {
86
- const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
87
- if (blockHeader) {
88
- await this.updateAnchorBlockHeader(blockHeader);
89
- }
90
- }
60
+ const lastBlock = event.blocks.at(-1)!;
61
+ this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
62
+ blockHash: lastBlock.hash(),
63
+ archive: lastBlock.archive.root.toString(),
64
+ header: lastBlock.header.toInspect(),
65
+ });
66
+ await this.anchorBlockStore.setHeader(lastBlock.header);
91
67
  break;
92
68
  }
93
69
  case 'chain-pruned': {
94
- const currentAnchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
95
- const currentAnchorBlockNumber = currentAnchorBlockHeader.getBlockNumber();
96
- if (currentAnchorBlockNumber <= event.block.number) {
97
- this.log.verbose(
98
- `Ignoring prune event to block ${event.block.number} greater than current anchor block ${currentAnchorBlockNumber}`,
99
- { pruneEvent: event, currentAnchorBlockHeader: currentAnchorBlockHeader.toInspect() },
100
- );
101
- return;
102
- }
103
-
104
70
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
105
71
 
72
+ const oldAnchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
106
73
  // Note that the following is not necessarily the anchor block that will be used in the transaction - if
107
74
  // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
108
75
  // forward.
@@ -116,21 +83,15 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
116
83
 
117
84
  // Operations are wrapped in a single transaction to ensure atomicity.
118
85
  await this.store.transactionAsync(async () => {
119
- await this.noteStore.rollback(event.block.number, currentAnchorBlockNumber);
120
- await this.privateEventStore.rollback(event.block.number, currentAnchorBlockNumber);
121
- await this.updateAnchorBlockHeader(newAnchorBlockHeader);
86
+ await this.noteStore.rollback(event.block.number, oldAnchorBlockNumber);
87
+ await this.privateEventStore.rollback(event.block.number, oldAnchorBlockNumber);
88
+ await this.anchorBlockStore.setHeader(newAnchorBlockHeader);
122
89
  });
123
90
  break;
124
91
  }
125
92
  }
126
93
  }
127
94
 
128
- /** Updates the anchor block header to the target block */
129
- private async updateAnchorBlockHeader(blockHeader: BlockHeader) {
130
- this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
131
- await this.anchorBlockStore.setHeader(blockHeader);
132
- }
133
-
134
95
  /**
135
96
  * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
136
97
  * recent data (e.g. notes), and handling any reorgs that might have occurred.
@@ -24,8 +24,6 @@ export interface KernelProverConfig {
24
24
  export interface BlockSynchronizerConfig {
25
25
  /** Maximum amount of blocks to pull from the stream in one request when synchronizing */
26
26
  l2BlockBatchSize: number;
27
- /** Which chain tip to sync to (proposed, checkpointed, proven, finalized) */
28
- syncChainTip?: 'proposed' | 'checkpointed' | 'proven' | 'finalized';
29
27
  }
30
28
 
31
29
  export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
@@ -55,18 +53,6 @@ export const pxeConfigMappings: ConfigMappingsType<PXEConfig> = {
55
53
  description: 'Enable real proofs',
56
54
  ...booleanConfigHelper(true),
57
55
  },
58
- syncChainTip: {
59
- env: 'PXE_SYNC_CHAIN_TIP',
60
- description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
61
- defaultValue: 'proposed',
62
- parseEnv: (val: string) => {
63
- const allowedValues = ['proposed', 'checkpointed', 'proven', 'finalized'];
64
- if (allowedValues.includes(val)) {
65
- return val;
66
- }
67
- throw new Error(`Invalid value for PXE_SYNC_CHAIN_TIP: ${val}. Allowed values are: ${allowedValues.join(', ')}`);
68
- },
69
- },
70
56
  };
71
57
 
72
58
  /**
@@ -85,7 +85,7 @@ import { ExecutionNoteCache } from './execution_note_cache.js';
85
85
  import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
86
86
  import { HashedValuesCache } from './hashed_values_cache.js';
87
87
  import { Oracle } from './oracle/oracle.js';
88
- import { executePrivateFunction } from './oracle/private_execution.js';
88
+ import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
89
89
  import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
90
90
  import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
91
91
 
@@ -138,6 +138,12 @@ export class ContractFunctionSimulator {
138
138
  ): Promise<PrivateExecutionResult> {
139
139
  const simulatorSetupTimer = new Timer();
140
140
 
141
+ await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
142
+ this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes, jobId),
143
+ );
144
+
145
+ await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
146
+
141
147
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
142
148
 
143
149
  if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
@@ -262,6 +268,8 @@ export class ContractFunctionSimulator {
262
268
  scopes: AztecAddress[] | undefined,
263
269
  jobId: string,
264
270
  ): Promise<Fr[]> {
271
+ await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
272
+
265
273
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
266
274
 
267
275
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
@@ -1,8 +1,7 @@
1
- import type { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
1
+ import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
2
  import type { BlockNumber } from '@aztec/foundation/branded-types';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { Point } from '@aztec/foundation/curves/grumpkin';
5
- import { MembershipWitness } from '@aztec/foundation/trees';
6
5
  import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
7
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
7
  import { L2BlockHash } from '@aztec/stdlib/block';
@@ -10,7 +9,7 @@ import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
10
9
  import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
11
10
  import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
12
11
  import type { Note, NoteStatus } from '@aztec/stdlib/note';
13
- import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
12
+ import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
14
13
  import type { BlockHeader } from '@aztec/stdlib/tx';
15
14
 
16
15
  import type { UtilityContext } from '../noir-structs/utility_context.js';
@@ -67,14 +66,7 @@ export interface IUtilityExecutionOracle {
67
66
  utilityGetUtilityContext(): UtilityContext;
68
67
  utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
69
68
  utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
70
- utilityGetNoteHashMembershipWitness(
71
- blockHash: L2BlockHash,
72
- leafValue: Fr,
73
- ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
74
- utilityGetArchiveMembershipWitness(
75
- blockHash: L2BlockHash,
76
- leafValue: Fr,
77
- ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
69
+ utilityGetMembershipWitness(blockHash: L2BlockHash, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
78
70
  utilityGetNullifierMembershipWitness(
79
71
  blockHash: L2BlockHash,
80
72
  nullifier: Fr,
@@ -155,7 +147,6 @@ export interface IPrivateExecutionOracle {
155
147
  ): void;
156
148
  privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number): Promise<void>;
157
149
  privateNotifyCreatedNullifier(innerNullifier: Fr): Promise<void>;
158
- privateIsNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean>;
159
150
  privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number): void;
160
151
  privateCallPrivateFunction(
161
152
  targetContractAddress: AztecAddress,
@@ -14,6 +14,7 @@ import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
15
  import { L2BlockHash } from '@aztec/stdlib/block';
16
16
  import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
17
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
17
18
 
18
19
  import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
19
20
  import { packAsHintedNote } from './note_packing_utils.js';
@@ -137,32 +138,26 @@ export class Oracle {
137
138
  ].map(toACVMField);
138
139
  }
139
140
 
140
- async utilityGetNoteHashMembershipWitness(
141
+ async utilityGetMembershipWitness(
141
142
  [blockHash]: ACVMField[],
143
+ [treeId]: ACVMField[],
142
144
  [leafValue]: ACVMField[],
143
145
  ): Promise<(ACVMField | ACVMField[])[]> {
144
146
  const parsedBlockHash = L2BlockHash.fromString(blockHash);
147
+ const parsedTreeId = Fr.fromString(treeId).toNumber();
145
148
  const parsedLeafValue = Fr.fromString(leafValue);
146
149
 
147
- const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(parsedBlockHash, parsedLeafValue);
148
- if (!witness) {
149
- throw new Error(`Leaf ${leafValue} not found in the note hash tree at block hash ${parsedBlockHash.toString()}.`);
150
- }
151
- return witness.toNoirRepresentation();
152
- }
153
-
154
- async utilityGetArchiveMembershipWitness(
155
- [blockHash]: ACVMField[],
156
- [leafValue]: ACVMField[],
157
- ): Promise<(ACVMField | ACVMField[])[]> {
158
- const parsedBlockHash = L2BlockHash.fromString(blockHash);
159
- const parsedLeafValue = Fr.fromString(leafValue);
160
-
161
- const witness = await this.handlerAsUtility().utilityGetArchiveMembershipWitness(parsedBlockHash, parsedLeafValue);
150
+ const witness = await this.handlerAsUtility().utilityGetMembershipWitness(
151
+ parsedBlockHash,
152
+ parsedTreeId,
153
+ parsedLeafValue,
154
+ );
162
155
  if (!witness) {
163
- throw new Error(`Leaf ${leafValue} not found in the archive tree at block hash ${parsedBlockHash.toString()}.`);
156
+ throw new Error(
157
+ `Leaf ${leafValue} not found in the tree ${MerkleTreeId[parsedTreeId]} at block hash ${parsedBlockHash.toString()}.`,
158
+ );
164
159
  }
165
- return witness.toNoirRepresentation();
160
+ return [toACVMField(witness[0]), witness.slice(1).map(toACVMField)];
166
161
  }
167
162
 
168
163
  async utilityGetNullifierMembershipWitness(
@@ -346,14 +341,6 @@ export class Oracle {
346
341
  return [];
347
342
  }
348
343
 
349
- async privateIsNullifierPending([innerNullifier]: ACVMField[], [contractAddress]: ACVMField[]): Promise<ACVMField[]> {
350
- const isPending = await this.handlerAsPrivate().privateIsNullifierPending(
351
- Fr.fromString(innerNullifier),
352
- AztecAddress.fromString(contractAddress),
353
- );
354
- return [toACVMField(isPending)];
355
- }
356
-
357
344
  async utilityCheckNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
358
345
  const exists = await this.handlerAsUtility().utilityCheckNullifierExists(Fr.fromString(innerNullifier));
359
346
  return [toACVMField(exists)];
@@ -14,7 +14,6 @@ import {
14
14
  import {
15
15
  type FunctionArtifact,
16
16
  type FunctionArtifactWithContractName,
17
- type FunctionCall,
18
17
  type FunctionSelector,
19
18
  countArgumentsSize,
20
19
  } from '@aztec/stdlib/abi';
@@ -181,7 +180,7 @@ export async function readCurrentClassId(
181
180
  * provider (i.e. PXE's own storage).
182
181
  * @param header - The header of the block at which to verify the current class id.
183
182
  */
184
- async function verifyCurrentClassId(
183
+ export async function verifyCurrentClassId(
185
184
  contractAddress: AztecAddress,
186
185
  aztecNode: AztecNode,
187
186
  contractStore: ContractStore,
@@ -199,21 +198,3 @@ async function verifyCurrentClassId(
199
198
  );
200
199
  }
201
200
  }
202
-
203
- /**
204
- * Ensures the contract's private state is synchronized and that the PXE holds the current class artifact for
205
- * the contract.
206
- */
207
- export async function ensureContractSynced(
208
- contractAddress: AztecAddress,
209
- functionToInvokeAfterSync: FunctionSelector | null,
210
- utilityExecutor: (call: FunctionCall) => Promise<any>,
211
- aztecNode: AztecNode,
212
- contractStore: ContractStore,
213
- header: BlockHeader,
214
- ): Promise<void> {
215
- await Promise.all([
216
- contractStore.syncPrivateState(contractAddress, functionToInvokeAfterSync, utilityExecutor),
217
- verifyCurrentClassId(contractAddress, aztecNode, contractStore, header),
218
- ]);
219
- }
@@ -14,7 +14,6 @@ import {
14
14
  } from '@aztec/stdlib/abi';
15
15
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
16
16
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
17
- import { L2BlockHash } from '@aztec/stdlib/block';
18
17
  import { siloNullifier } from '@aztec/stdlib/hash';
19
18
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
20
19
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
@@ -47,7 +46,7 @@ import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js'
47
46
  import type { HashedValuesCache } from '../hashed_values_cache.js';
48
47
  import { pickNotes } from '../pick_notes.js';
49
48
  import type { IPrivateExecutionOracle, NoteData } from './interfaces.js';
50
- import { ensureContractSynced, executePrivateFunction } from './private_execution.js';
49
+ import { executePrivateFunction, verifyCurrentClassId } from './private_execution.js';
51
50
  import { UtilityExecutionOracle } from './utility_execution_oracle.js';
52
51
 
53
52
  /**
@@ -266,15 +265,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
266
265
  // This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
267
266
  // are up to date. We do this here because this store is not synced as part of the global sync because
268
267
  // that'd be wasteful as most tagging secrets are not used in each tx.
269
- const anchorBlockHash = L2BlockHash.fromField(await this.anchorBlockHeader.hash());
270
- await syncSenderTaggingIndexes(
271
- secret,
272
- this.contractAddress,
273
- this.aztecNode,
274
- this.senderTaggingStore,
275
- anchorBlockHash,
276
- this.jobId,
277
- );
268
+ await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore, this.jobId);
278
269
 
279
270
  const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret, this.jobId);
280
271
  // If lastUsedIndex is undefined, we've never used this secret, so start from 0
@@ -365,7 +356,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
365
356
 
366
357
  const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
367
358
 
368
- const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore, this.jobId);
359
+ const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
369
360
  const dbNotes = await noteService.getNotes(
370
361
  this.callContext.contractAddress,
371
362
  owner,
@@ -472,19 +463,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
472
463
  return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
473
464
  }
474
465
 
475
- /**
476
- * Check if a nullifier has been emitted in the same transaction, i.e. if privateNotifyCreatedNullifier has been
477
- * called for this inner nullifier from the contract with the specified address.
478
- * @param innerNullifier - The inner nullifier to check.
479
- * @param contractAddress - Address of the contract that emitted the nullifier.
480
- * @returns A boolean indicating whether the nullifier is pending or not.
481
- */
482
- public async privateIsNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
483
- const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
484
- const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
485
- return Promise.resolve(isNullifierPending);
486
- }
487
-
488
466
  /**
489
467
  * Emit a contract class log.
490
468
  * This fn exists because we only carry a poseidon hash through the kernels, and need to
@@ -541,14 +519,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
541
519
 
542
520
  isStaticCall = isStaticCall || this.callContext.isStaticCall;
543
521
 
544
- await ensureContractSynced(
545
- targetContractAddress,
546
- functionSelector,
547
- this.utilityExecutor,
548
- this.aztecNode,
549
- this.contractStore,
550
- this.anchorBlockHeader,
551
- );
522
+ await verifyCurrentClassId(targetContractAddress, this.aztecNode, this.contractStore, this.anchorBlockHeader);
523
+
524
+ await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, this.utilityExecutor);
552
525
 
553
526
  const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
554
527
  targetContractAddress,