@aztec/pxe 0.0.1-commit.c7c42ec → 0.0.1-commit.f295ac2

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 (180) hide show
  1. package/dest/block_synchronizer/block_synchronizer.d.ts +6 -2
  2. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_synchronizer.js +21 -13
  4. package/dest/config/package_info.js +1 -1
  5. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  6. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  7. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts +8 -9
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +33 -16
  11. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  12. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
  15. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
  17. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  18. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  20. package/dest/contract_function_simulator/oracle/interfaces.d.ts +9 -8
  21. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  23. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +4 -4
  25. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/oracle/note_packing_utils.js +5 -5
  27. package/dest/contract_function_simulator/oracle/oracle.d.ts +6 -6
  28. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/oracle/oracle.js +20 -19
  30. package/dest/contract_function_simulator/oracle/private_execution.d.ts +5 -9
  31. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  32. package/dest/contract_function_simulator/oracle/private_execution.js +11 -10
  33. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -18
  34. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +10 -35
  36. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +14 -12
  37. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +54 -52
  39. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  40. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  41. package/dest/entrypoints/client/bundle/utils.js +10 -1
  42. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  43. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  44. package/dest/entrypoints/client/lazy/utils.js +10 -1
  45. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  46. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  47. package/dest/entrypoints/server/index.d.ts +2 -1
  48. package/dest/entrypoints/server/index.d.ts.map +1 -1
  49. package/dest/entrypoints/server/index.js +1 -0
  50. package/dest/entrypoints/server/utils.d.ts +1 -1
  51. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  52. package/dest/entrypoints/server/utils.js +11 -7
  53. package/dest/events/event_service.d.ts +4 -3
  54. package/dest/events/event_service.d.ts.map +1 -1
  55. package/dest/events/event_service.js +17 -19
  56. package/dest/events/private_event_filter_validator.d.ts +5 -5
  57. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  58. package/dest/events/private_event_filter_validator.js +5 -6
  59. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  60. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  61. package/dest/job_coordinator/job_coordinator.js +93 -0
  62. package/dest/logs/log_service.d.ts +3 -2
  63. package/dest/logs/log_service.d.ts.map +1 -1
  64. package/dest/logs/log_service.js +5 -3
  65. package/dest/notes/note_service.d.ts +3 -3
  66. package/dest/notes/note_service.d.ts.map +1 -1
  67. package/dest/notes/note_service.js +23 -28
  68. package/dest/oracle_version.d.ts +2 -2
  69. package/dest/oracle_version.js +2 -2
  70. package/dest/private_kernel/hints/index.d.ts +2 -2
  71. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  72. package/dest/private_kernel/hints/index.js +1 -1
  73. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  74. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  75. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  76. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  77. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  78. package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
  79. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
  80. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  81. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  82. package/dest/pxe.d.ts +8 -36
  83. package/dest/pxe.d.ts.map +1 -1
  84. package/dest/pxe.js +65 -87
  85. package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
  86. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  87. package/dest/storage/capsule_store/capsule_store.js +132 -23
  88. package/dest/storage/contract_store/contract_store.d.ts +2 -1
  89. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  90. package/dest/storage/contract_store/contract_store.js +12 -0
  91. package/dest/storage/note_store/note_store.d.ts +6 -5
  92. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  93. package/dest/storage/note_store/note_store.js +89 -94
  94. package/dest/storage/private_event_store/private_event_store.d.ts +33 -6
  95. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  96. package/dest/storage/private_event_store/private_event_store.js +139 -32
  97. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +15 -8
  98. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  99. package/dest/storage/tagging_store/recipient_tagging_store.js +69 -12
  100. package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -9
  101. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  102. package/dest/storage/tagging_store/sender_tagging_store.js +110 -28
  103. package/dest/tagging/constants.d.ts +2 -0
  104. package/dest/tagging/constants.d.ts.map +1 -0
  105. package/dest/tagging/constants.js +10 -0
  106. package/dest/tagging/index.d.ts +2 -2
  107. package/dest/tagging/index.d.ts.map +1 -1
  108. package/dest/tagging/index.js +1 -10
  109. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -2
  110. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  111. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  112. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +2 -2
  113. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  114. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +8 -8
  115. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
  116. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  117. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +2 -2
  118. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -2
  119. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  120. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +4 -2
  121. package/dest/tree_membership/tree_membership_service.d.ts +9 -11
  122. package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
  123. package/dest/tree_membership/tree_membership_service.js +25 -34
  124. package/package.json +18 -18
  125. package/src/block_synchronizer/block_synchronizer.ts +30 -12
  126. package/src/config/package_info.ts +1 -1
  127. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  128. package/src/contract_function_simulator/contract_function_simulator.ts +42 -16
  129. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  130. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
  131. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  132. package/src/contract_function_simulator/oracle/interfaces.ts +8 -7
  133. package/src/contract_function_simulator/oracle/note_packing_utils.ts +6 -6
  134. package/src/contract_function_simulator/oracle/oracle.ts +24 -22
  135. package/src/contract_function_simulator/oracle/private_execution.ts +10 -19
  136. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +13 -38
  137. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +56 -50
  138. package/src/entrypoints/client/bundle/utils.ts +7 -1
  139. package/src/entrypoints/client/lazy/utils.ts +7 -2
  140. package/src/entrypoints/pxe_creation_options.ts +2 -1
  141. package/src/entrypoints/server/index.ts +1 -0
  142. package/src/entrypoints/server/utils.ts +11 -15
  143. package/src/events/event_service.ts +17 -21
  144. package/src/events/private_event_filter_validator.ts +3 -5
  145. package/src/job_coordinator/job_coordinator.ts +149 -0
  146. package/src/logs/log_service.ts +3 -1
  147. package/src/notes/note_service.ts +23 -29
  148. package/src/oracle_version.ts +2 -2
  149. package/src/private_kernel/hints/index.ts +1 -1
  150. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
  151. package/src/private_kernel/private_kernel_execution_prover.ts +3 -5
  152. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  153. package/src/pxe.ts +98 -116
  154. package/src/storage/capsule_store/capsule_store.ts +159 -23
  155. package/src/storage/contract_store/contract_store.ts +20 -0
  156. package/src/storage/note_store/note_store.ts +98 -95
  157. package/src/storage/private_event_store/private_event_store.ts +199 -37
  158. package/src/storage/tagging_store/recipient_tagging_store.ts +89 -13
  159. package/src/storage/tagging_store/sender_tagging_store.ts +129 -28
  160. package/src/tagging/constants.ts +10 -0
  161. package/src/tagging/index.ts +1 -11
  162. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +10 -6
  163. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +8 -7
  164. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +6 -2
  165. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +4 -1
  166. package/src/tree_membership/tree_membership_service.ts +27 -42
  167. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  168. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  169. package/dest/contract_function_simulator/proxied_node.js +0 -27
  170. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  171. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  172. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  173. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  174. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  175. package/dest/public_storage/public_storage_service.d.ts +0 -24
  176. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  177. package/dest/public_storage/public_storage_service.js +0 -26
  178. package/src/contract_function_simulator/proxied_node.ts +0 -33
  179. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  180. package/src/public_storage/public_storage_service.ts +0 -33
@@ -1 +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,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFnC,YACmB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EACjD;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;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;CAyBF"}
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"}
@@ -1,56 +1,53 @@
1
1
  import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
2
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.
3
7
  export class TreeMembershipService {
4
8
  aztecNode;
5
- anchorBlockStore;
6
- constructor(aztecNode, anchorBlockStore){
9
+ constructor(aztecNode){
7
10
  this.aztecNode = aztecNode;
8
- this.anchorBlockStore = anchorBlockStore;
9
11
  }
10
12
  /**
11
13
  * Gets the index of a nullifier in the nullifier tree.
12
14
  * @returns - The index of the nullifier. Undefined if it does not exist in the tree.
13
- */ getNullifierIndex(nullifier) {
14
- return this.#findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
15
+ */ async getNullifierIndex(nullifier) {
16
+ const [leafIndex] = await this.aztecNode.findLeavesIndexes('latest', MerkleTreeId.NULLIFIER_TREE, [
17
+ nullifier
18
+ ]);
19
+ return leafIndex?.data;
15
20
  }
16
21
  /**
17
22
  * Fetches the index and sibling path of a leaf at a given block from a given tree.
18
- * @param blockNumber - The block number at which to get the membership witness.
23
+ * @param blockHash - The block hash at which to get the membership witness.
19
24
  * @param treeId - Id of the tree to get the sibling path from.
20
25
  * @param leafValue - The leaf value
21
26
  * @returns The index and sibling path concatenated [index, sibling_path]
22
- */ async getMembershipWitness(blockNumber, treeId, leafValue) {
23
- const witness = await this.#tryGetMembershipWitness(blockNumber, treeId, leafValue);
27
+ */ async getMembershipWitness(blockHash, treeId, leafValue) {
28
+ const witness = await this.#tryGetMembershipWitness(blockHash, treeId, leafValue);
24
29
  if (!witness) {
25
- throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block ${blockNumber}`);
30
+ throw new Error(`Leaf value ${leafValue} not found in tree ${MerkleTreeId[treeId]} at block hash ${blockHash.toString()}`);
26
31
  }
27
32
  return witness;
28
33
  }
29
34
  /**
30
35
  * Returns a low nullifier membership witness for a given nullifier at a given block.
31
- * @param blockNumber - The block number at which to get the index.
36
+ * @param blockHash - The block hash at which to get the index.
32
37
  * @param nullifier - Nullifier we try to find the low nullifier witness for.
33
38
  * @returns The low nullifier membership witness (if found).
34
39
  * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
35
40
  * list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
36
41
  * we are trying to prove non-inclusion for.
37
- */ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
38
- const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
39
- if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
40
- throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
41
- }
42
- return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
42
+ */ getLowNullifierMembershipWitness(blockHash, nullifier) {
43
+ return this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier);
43
44
  }
44
45
  /**
45
46
  * Returns a witness for a given slot of the public data tree at a given block.
46
- * @param blockNumber - The block number at which to get the witness.
47
+ * @param blockHash - The block hash at which to get the witness.
47
48
  * @param leafSlot - The slot of the public data in the public data tree.
48
- */ async getPublicDataWitness(blockNumber, leafSlot) {
49
- const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
50
- if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
51
- throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
52
- }
53
- return await this.aztecNode.getPublicDataWitness(blockNumber, leafSlot);
49
+ */ getPublicDataWitness(blockHash, leafSlot) {
50
+ return this.aztecNode.getPublicDataWitness(blockHash, leafSlot);
54
51
  }
55
52
  /**
56
53
  * Looks for the L1 to L2 membership witness of a message at the Aztec node, given its hash.
@@ -61,24 +58,18 @@ export class TreeMembershipService {
61
58
  */ getL1ToL2MembershipWitness(contractAddress, messageHash, secret) {
62
59
  return getNonNullifiedL1ToL2MessageWitness(this.aztecNode, contractAddress, messageHash, secret);
63
60
  }
64
- async #tryGetMembershipWitness(blockNumber, treeId, value) {
61
+ async #tryGetMembershipWitness(blockHash, treeId, value) {
65
62
  switch(treeId){
66
63
  case MerkleTreeId.NULLIFIER_TREE:
67
- return (await this.aztecNode.getNullifierMembershipWitness(blockNumber, value))?.withoutPreimage().toFields();
64
+ return (await this.aztecNode.getNullifierMembershipWitness(blockHash, value))?.withoutPreimage().toFields();
68
65
  case MerkleTreeId.NOTE_HASH_TREE:
69
- return (await this.aztecNode.getNoteHashMembershipWitness(blockNumber, value))?.toFields();
66
+ return (await this.aztecNode.getNoteHashMembershipWitness(blockHash, value))?.toFields();
70
67
  case MerkleTreeId.PUBLIC_DATA_TREE:
71
- return (await this.aztecNode.getPublicDataWitness(blockNumber, value))?.withoutPreimage().toFields();
68
+ return (await this.aztecNode.getPublicDataWitness(blockHash, value))?.withoutPreimage().toFields();
72
69
  case MerkleTreeId.ARCHIVE:
73
- return (await this.aztecNode.getArchiveMembershipWitness(blockNumber, value))?.toFields();
70
+ return (await this.aztecNode.getArchiveMembershipWitness(blockHash, value))?.toFields();
74
71
  default:
75
72
  throw new Error('Not implemented');
76
73
  }
77
74
  }
78
- async #findLeafIndex(blockNumber, treeId, leafValue) {
79
- const [leafIndex] = await this.aztecNode.findLeavesIndexes(blockNumber, treeId, [
80
- leafValue
81
- ]);
82
- return leafIndex?.data;
83
- }
84
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.c7c42ec",
3
+ "version": "0.0.1-commit.f295ac2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./server": "./dest/entrypoints/server/index.js",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "bin": "./dest/bin/index.js",
13
13
  "scripts": {
14
- "build": "yarn clean && yarn generate && tsgo -b",
14
+ "build": "yarn clean && yarn generate && ../scripts/tsc.sh",
15
15
  "build:dev": "../scripts/tsc.sh --watch",
16
16
  "clean": "rm -rf ./dest .tsbuildinfo ./src/config/package_info.ts",
17
17
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
@@ -61,19 +61,19 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/bb-prover": "0.0.1-commit.c7c42ec",
65
- "@aztec/bb.js": "0.0.1-commit.c7c42ec",
66
- "@aztec/builder": "0.0.1-commit.c7c42ec",
67
- "@aztec/constants": "0.0.1-commit.c7c42ec",
68
- "@aztec/ethereum": "0.0.1-commit.c7c42ec",
69
- "@aztec/foundation": "0.0.1-commit.c7c42ec",
70
- "@aztec/key-store": "0.0.1-commit.c7c42ec",
71
- "@aztec/kv-store": "0.0.1-commit.c7c42ec",
72
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.c7c42ec",
73
- "@aztec/noir-types": "0.0.1-commit.c7c42ec",
74
- "@aztec/protocol-contracts": "0.0.1-commit.c7c42ec",
75
- "@aztec/simulator": "0.0.1-commit.c7c42ec",
76
- "@aztec/stdlib": "0.0.1-commit.c7c42ec",
64
+ "@aztec/bb-prover": "0.0.1-commit.f295ac2",
65
+ "@aztec/bb.js": "0.0.1-commit.f295ac2",
66
+ "@aztec/builder": "0.0.1-commit.f295ac2",
67
+ "@aztec/constants": "0.0.1-commit.f295ac2",
68
+ "@aztec/ethereum": "0.0.1-commit.f295ac2",
69
+ "@aztec/foundation": "0.0.1-commit.f295ac2",
70
+ "@aztec/key-store": "0.0.1-commit.f295ac2",
71
+ "@aztec/kv-store": "0.0.1-commit.f295ac2",
72
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f295ac2",
73
+ "@aztec/noir-types": "0.0.1-commit.f295ac2",
74
+ "@aztec/protocol-contracts": "0.0.1-commit.f295ac2",
75
+ "@aztec/simulator": "0.0.1-commit.f295ac2",
76
+ "@aztec/stdlib": "0.0.1-commit.f295ac2",
77
77
  "koa": "^2.16.1",
78
78
  "koa-router": "^13.1.1",
79
79
  "lodash.omit": "^4.5.0",
@@ -82,14 +82,14 @@
82
82
  "viem": "npm:@aztec/viem@2.38.2"
83
83
  },
84
84
  "devDependencies": {
85
- "@aztec/merkle-tree": "0.0.1-commit.c7c42ec",
86
- "@aztec/noir-test-contracts.js": "0.0.1-commit.c7c42ec",
85
+ "@aztec/merkle-tree": "0.0.1-commit.f295ac2",
86
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.f295ac2",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/lodash.omit": "^4.5.7",
90
90
  "@types/lodash.times": "^4.3.9",
91
91
  "@types/node": "^22.15.17",
92
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
92
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
93
93
  "jest": "^30.0.0",
94
94
  "jest-mock-extended": "^4.0.0",
95
95
  "lodash.times": "^4.3.2",
@@ -1,12 +1,19 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
4
  import type { L2TipsKVStore } from '@aztec/kv-store/stores';
4
- import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
5
+ import {
6
+ L2BlockHash,
7
+ L2BlockStream,
8
+ type L2BlockStreamEvent,
9
+ type L2BlockStreamEventHandler,
10
+ } from '@aztec/stdlib/block';
5
11
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
6
12
 
7
13
  import type { PXEConfig } from '../config/index.js';
8
14
  import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
9
15
  import type { NoteStore } from '../storage/note_store/note_store.js';
16
+ import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
10
17
 
11
18
  /**
12
19
  * The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
@@ -20,8 +27,10 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
20
27
 
21
28
  constructor(
22
29
  private node: AztecNode,
30
+ private store: AztecAsyncKVStore,
23
31
  private anchorBlockStore: AnchorBlockStore,
24
32
  private noteStore: NoteStore,
33
+ private privateEventStore: PrivateEventStore,
25
34
  private l2TipsStore: L2TipsKVStore,
26
35
  config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
27
36
  loggerOrSuffix?: string | Logger,
@@ -48,27 +57,36 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
48
57
 
49
58
  switch (event.type) {
50
59
  case 'blocks-added': {
51
- const lastBlock = event.blocks.at(-1)!.block;
60
+ const lastBlock = event.blocks.at(-1)!;
52
61
  this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
53
62
  blockHash: lastBlock.hash(),
54
63
  archive: lastBlock.archive.root.toString(),
55
64
  header: lastBlock.header.toInspect(),
56
65
  });
57
- await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
66
+ await this.anchorBlockStore.setHeader(lastBlock.header);
58
67
  break;
59
68
  }
60
69
  case 'chain-pruned': {
61
70
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
62
- // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
63
- const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
64
- await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
65
- // Update the header to the last block.
66
- const newHeader = await this.node.getBlockHeader(event.block.number);
67
- if (!newHeader) {
68
- this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
69
- } else {
70
- await this.anchorBlockStore.setHeader(newHeader);
71
+
72
+ const oldAnchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
73
+ // Note that the following is not necessarily the anchor block that will be used in the transaction - if
74
+ // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
75
+ // forward.
76
+ const newAnchorBlockHeader = await this.node.getBlockHeader(L2BlockHash.fromString(event.block.hash));
77
+
78
+ if (!newAnchorBlockHeader) {
79
+ throw new Error(
80
+ `Block header for block number ${event.block.number} and hash ${event.block.hash} not found during chain prune. This likely indicates a bug in the node, as we receive block stream events and fetch block headers from the same node.`,
81
+ );
71
82
  }
83
+
84
+ // Operations are wrapped in a single transaction to ensure atomicity.
85
+ await this.store.transactionAsync(async () => {
86
+ await this.noteStore.rollback(event.block.number, oldAnchorBlockNumber);
87
+ await this.privateEventStore.rollback(event.block.number, oldAnchorBlockNumber);
88
+ await this.anchorBlockStore.setHeader(newAnchorBlockHeader);
89
+ });
72
90
  break;
73
91
  }
74
92
  }
@@ -1,3 +1,3 @@
1
1
  export function getPackageInfo() {
2
- return { version: '3.0.0', name: '@aztec/pxe' };
2
+ return { version: '4.0.0', name: '@aztec/pxe' };
3
3
  }
@@ -0,0 +1,103 @@
1
+ import { Timer } from '@aztec/foundation/timer';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { NodeStats, RoundTripStats } from '@aztec/stdlib/tx';
4
+
5
+ /*
6
+ * Proxy generator for an AztecNode that tracks the time taken for each RPC call and the number of round trips (actual
7
+ * blocking waits for node responses).
8
+ *
9
+ * A round trip is counted when we transition from 0 to 1 in-flight calls, and ends when all concurrent calls complete.
10
+ * This means parallel calls in Promise.all count as a single round trip.
11
+ *
12
+ * Note that batching of RPC calls in `safe_json_rpc_client.ts` could affect the round trip counts but in places we
13
+ * currently use this information we do not even use HTTP as we have direct access to the Aztec Node instance in TS
14
+ * (i.e. not running against external node) so this is not a problem for now.
15
+ *
16
+ * If you want to use this against external node and the info gets skewed by batching you can set the `maxBatchSize`
17
+ * value in `safe_json_rpc_client.ts` to 1 (the main motivation for batching was to get around parallel http requests
18
+ * limits in web browsers which is not a problem when debugging in node.js).
19
+ */
20
+ export type BenchmarkedNode = AztecNode & { getStats(): NodeStats };
21
+
22
+ export class BenchmarkedNodeFactory {
23
+ static create(node: AztecNode): BenchmarkedNode {
24
+ // Per-method call stats
25
+ const perMethod: Partial<Record<keyof AztecNode, { times: number[] }>> = {};
26
+
27
+ // Round trip tracking
28
+ let inFlightCount = 0;
29
+ let currentRoundTripTimer: Timer | null = null;
30
+ let currentRoundTripMethods: string[] = [];
31
+ const roundTrips: RoundTripStats = {
32
+ roundTrips: 0,
33
+ totalBlockingTime: 0,
34
+ roundTripDurations: [],
35
+ roundTripMethods: [],
36
+ };
37
+
38
+ return new Proxy(node, {
39
+ get(target, prop: keyof BenchmarkedNode) {
40
+ if (prop === 'getStats') {
41
+ return (): NodeStats => {
42
+ return { perMethod, roundTrips };
43
+ };
44
+ } else {
45
+ return function (...args: any[]) {
46
+ // Track per-method stats
47
+ if (!perMethod[prop]) {
48
+ perMethod[prop] = { times: [] };
49
+ }
50
+
51
+ // Start of a new round trip batch?
52
+ if (inFlightCount === 0) {
53
+ roundTrips.roundTrips++;
54
+ currentRoundTripTimer = new Timer();
55
+ currentRoundTripMethods = [];
56
+ }
57
+ inFlightCount++;
58
+ currentRoundTripMethods.push(prop);
59
+
60
+ const callTimer = new Timer();
61
+ const result = (target[prop] as any).apply(target, args);
62
+
63
+ // Handle completion - called when the call finishes (after Promise resolves)
64
+ const handleCompletion = () => {
65
+ const callTime = callTimer.ms();
66
+ perMethod[prop]!.times.push(callTime);
67
+
68
+ inFlightCount--;
69
+
70
+ // End of round trip batch - all concurrent calls completed
71
+ if (inFlightCount === 0 && currentRoundTripTimer) {
72
+ const roundTripTime = currentRoundTripTimer.ms();
73
+ roundTrips.totalBlockingTime += roundTripTime;
74
+ roundTrips.roundTripDurations.push(roundTripTime);
75
+ roundTrips.roundTripMethods.push(currentRoundTripMethods);
76
+ currentRoundTripTimer = null;
77
+ currentRoundTripMethods = [];
78
+ }
79
+ };
80
+
81
+ // If the result is a Promise, chain the completion handler
82
+ if (result && typeof result.then === 'function') {
83
+ return result.then(
84
+ (value: any) => {
85
+ handleCompletion();
86
+ return value;
87
+ },
88
+ (error: any) => {
89
+ handleCompletion();
90
+ throw error;
91
+ },
92
+ );
93
+ } else {
94
+ // Synchronous method - handle completion immediately
95
+ handleCompletion();
96
+ return result;
97
+ }
98
+ };
99
+ }
100
+ },
101
+ }) as BenchmarkedNode;
102
+ }
103
+ }
@@ -80,6 +80,7 @@ import type { PrivateEventStore } from '../storage/private_event_store/private_e
80
80
  import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
81
81
  import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
82
82
  import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
83
+ import type { BenchmarkedNode } from './benchmarked_node.js';
83
84
  import { ExecutionNoteCache } from './execution_note_cache.js';
84
85
  import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
85
86
  import { HashedValuesCache } from './hashed_values_cache.js';
@@ -87,7 +88,6 @@ import { Oracle } from './oracle/oracle.js';
87
88
  import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
88
89
  import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
89
90
  import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
90
- import type { ProxiedNode } from './proxied_node.js';
91
91
 
92
92
  /**
93
93
  * The contract function simulator.
@@ -123,6 +123,7 @@ export class ContractFunctionSimulator {
123
123
  * @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
124
124
  * the `privateGetSenderForTags` oracle.
125
125
  * @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
126
+ * @param jobId - The job ID for staged writes.
126
127
  * @returns The result of the execution.
127
128
  */
128
129
  public async run(
@@ -131,11 +132,16 @@ export class ContractFunctionSimulator {
131
132
  selector: FunctionSelector,
132
133
  msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
133
134
  anchorBlockHeader: BlockHeader,
134
- senderForTags?: AztecAddress,
135
- scopes?: AztecAddress[],
135
+ senderForTags: AztecAddress | undefined,
136
+ scopes: AztecAddress[] | undefined,
137
+ jobId: string,
136
138
  ): Promise<PrivateExecutionResult> {
137
139
  const simulatorSetupTimer = new Timer();
138
140
 
141
+ await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
142
+ this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes, jobId),
143
+ );
144
+
139
145
  await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
140
146
 
141
147
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
@@ -169,6 +175,9 @@ export class ContractFunctionSimulator {
169
175
  request.txContext,
170
176
  callContext,
171
177
  anchorBlockHeader,
178
+ async call => {
179
+ await this.runUtility(call, [], anchorBlockHeader, scopes, jobId);
180
+ },
172
181
  request.authWitnesses,
173
182
  request.capsules,
174
183
  HashedValuesCache.create(request.argsOfCalls),
@@ -185,6 +194,7 @@ export class ContractFunctionSimulator {
185
194
  this.senderAddressBookStore,
186
195
  this.capsuleStore,
187
196
  this.privateEventStore,
197
+ jobId,
188
198
  0, // totalPublicArgsCount
189
199
  startSideEffectCounter,
190
200
  undefined, // log
@@ -208,8 +218,9 @@ export class ContractFunctionSimulator {
208
218
  request.functionSelector,
209
219
  );
210
220
  const simulatorTeardownTimer = new Timer();
211
- const { usedProtocolNullifierForNonces } = noteCache.finish();
212
- const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
221
+
222
+ noteCache.finish();
223
+ const firstNullifierHint = noteCache.getNonceGenerator();
213
224
 
214
225
  const publicCallRequests = collectNested([executionResult], r =>
215
226
  r.publicInputs.publicCallRequests
@@ -254,7 +265,8 @@ export class ContractFunctionSimulator {
254
265
  call: FunctionCall,
255
266
  authwits: AuthWitness[],
256
267
  anchorBlockHeader: BlockHeader,
257
- scopes?: AztecAddress[],
268
+ scopes: AztecAddress[] | undefined,
269
+ jobId: string,
258
270
  ): Promise<Fr[]> {
259
271
  await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
260
272
 
@@ -279,6 +291,7 @@ export class ContractFunctionSimulator {
279
291
  this.senderAddressBookStore,
280
292
  this.capsuleStore,
281
293
  this.privateEventStore,
294
+ jobId,
282
295
  undefined,
283
296
  scopes,
284
297
  );
@@ -319,7 +332,12 @@ export class ContractFunctionSimulator {
319
332
  */
320
333
  getStats() {
321
334
  const nodeRPCCalls =
322
- typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
335
+ typeof (this.aztecNode as BenchmarkedNode).getStats === 'function'
336
+ ? (this.aztecNode as BenchmarkedNode).getStats()
337
+ : {
338
+ perMethod: {},
339
+ roundTrips: { roundTrips: 0, totalBlockingTime: 0, roundTripDurations: [], roundTripMethods: [] },
340
+ };
323
341
 
324
342
  return { nodeRPCCalls };
325
343
  }
@@ -342,15 +360,15 @@ class OrderedSideEffect<T> {
342
360
  * (allowing state overrides) and is much faster, while still generating a valid
343
361
  * output that can be sent to the node for public simulation
344
362
  * @param privateExecutionResult - The result of the private execution.
345
- * @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
346
- * it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
347
363
  * @param contractStore - A provider for contract data in order to get function names and debug info.
364
+ * @param minRevertibleSideEffectCounterOverride - Optional override for the min revertible side effect counter.
365
+ * Used by TXE to simulate account contract behavior (setting the counter before app execution).
348
366
  * @returns The simulated proving result.
349
367
  */
350
368
  export async function generateSimulatedProvingResult(
351
369
  privateExecutionResult: PrivateExecutionResult,
352
- nonceGenerator: Fr,
353
370
  contractStore: ContractStore,
371
+ minRevertibleSideEffectCounterOverride?: number,
354
372
  ): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
355
373
  const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
356
374
  const nullifiers: OrderedSideEffect<Fr>[] = [];
@@ -454,16 +472,18 @@ export async function generateSimulatedProvingResult(
454
472
  const getEffect = <T>(orderedSideEffect: OrderedSideEffect<T>) => orderedSideEffect.sideEffect;
455
473
 
456
474
  const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
457
- const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
475
+ const minRevertibleSideEffectCounter =
476
+ minRevertibleSideEffectCounterOverride ?? getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
458
477
 
459
478
  const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(
460
479
  nullifiers.sort(sortByCounter),
461
480
  minRevertibleSideEffectCounter,
462
481
  );
463
- if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
482
+ const nonceGenerator = privateExecutionResult.firstNullifier;
483
+ if (nonRevertibleNullifiers.length === 0) {
484
+ nonRevertibleNullifiers.push(nonceGenerator);
485
+ } else if (!nonRevertibleNullifiers[0].equals(nonceGenerator)) {
464
486
  throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
465
- } else {
466
- nonRevertibleNullifiers.unshift(nonceGenerator);
467
487
  }
468
488
 
469
489
  if (isPrivateOnlyTx) {
@@ -499,6 +519,12 @@ export async function generateSimulatedProvingResult(
499
519
  siloedNoteHashes.sort(sortByCounter),
500
520
  minRevertibleSideEffectCounter,
501
521
  );
522
+ const nonRevertibleUniqueNoteHashes = await Promise.all(
523
+ nonRevertibleNoteHashes.map(async (noteHash, i) => {
524
+ const nonce = await computeNoteHashNonce(nonceGenerator, i);
525
+ return await computeUniqueNoteHash(nonce, noteHash);
526
+ }),
527
+ );
502
528
  const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(
503
529
  l2ToL1Messages.sort(sortByCounter),
504
530
  minRevertibleSideEffectCounter,
@@ -517,7 +543,7 @@ export async function generateSimulatedProvingResult(
517
543
  );
518
544
 
519
545
  const nonRevertibleData = new PrivateToPublicAccumulatedData(
520
- padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
546
+ padArrayEnd(nonRevertibleUniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
521
547
  padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
522
548
  padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX),
523
549
  padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
@@ -565,7 +591,7 @@ function splitOrderedSideEffects<T>(effects: OrderedSideEffect<T>[], minRevertib
565
591
  const revertibleSideEffects: T[] = [];
566
592
  const nonRevertibleSideEffects: T[] = [];
567
593
  effects.forEach(effect => {
568
- if (effect.counter < minRevertibleSideEffectCounter) {
594
+ if (minRevertibleSideEffectCounter === 0 || effect.counter < minRevertibleSideEffectCounter) {
569
595
  nonRevertibleSideEffects.push(effect.sideEffect);
570
596
  } else {
571
597
  revertibleSideEffects.push(effect.sideEffect);