@aztec/pxe 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c

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 (218) hide show
  1. package/dest/bin/check_oracle_version.js +1 -1
  2. package/dest/block_synchronizer/block_synchronizer.d.ts +10 -4
  3. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  4. package/dest/block_synchronizer/block_synchronizer.js +66 -18
  5. package/dest/config/index.d.ts +3 -1
  6. package/dest/config/index.d.ts.map +1 -1
  7. package/dest/config/index.js +17 -0
  8. package/dest/config/package_info.js +1 -1
  9. package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
  10. package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
  11. package/dest/contract_function_simulator/benchmarked_node.js +77 -0
  12. package/dest/contract_function_simulator/contract_function_simulator.d.ts +8 -9
  13. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/contract_function_simulator.js +32 -21
  15. package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
  16. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/execution_note_cache.js +45 -28
  18. package/dest/contract_function_simulator/index.d.ts +2 -2
  19. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/index.js +1 -1
  21. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -3
  22. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +6 -3
  24. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
  25. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  26. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
  27. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
  29. package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -11
  30. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
  32. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
  34. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  35. package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
  36. package/dest/contract_function_simulator/oracle/oracle.d.ts +10 -8
  37. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  38. package/dest/contract_function_simulator/oracle/oracle.js +43 -32
  39. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
  40. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  41. package/dest/contract_function_simulator/oracle/private_execution.js +1 -37
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +11 -17
  43. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  44. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +23 -39
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +27 -17
  46. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  47. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +72 -72
  48. package/dest/contract_sync/index.d.ts +23 -0
  49. package/dest/contract_sync/index.d.ts.map +1 -0
  50. package/dest/contract_sync/index.js +54 -0
  51. package/dest/debug/pxe_debug_utils.d.ts +1 -1
  52. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  53. package/dest/debug/pxe_debug_utils.js +3 -2
  54. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  55. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  56. package/dest/entrypoints/client/bundle/utils.js +10 -1
  57. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  58. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  59. package/dest/entrypoints/client/lazy/utils.js +10 -1
  60. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  61. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  62. package/dest/entrypoints/server/index.d.ts +3 -1
  63. package/dest/entrypoints/server/index.d.ts.map +1 -1
  64. package/dest/entrypoints/server/index.js +2 -0
  65. package/dest/entrypoints/server/utils.d.ts +1 -1
  66. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  67. package/dest/entrypoints/server/utils.js +11 -7
  68. package/dest/events/event_service.d.ts +4 -3
  69. package/dest/events/event_service.d.ts.map +1 -1
  70. package/dest/events/event_service.js +17 -19
  71. package/dest/events/private_event_filter_validator.d.ts +5 -5
  72. package/dest/events/private_event_filter_validator.d.ts.map +1 -1
  73. package/dest/events/private_event_filter_validator.js +5 -6
  74. package/dest/job_coordinator/job_coordinator.d.ts +74 -0
  75. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
  76. package/dest/job_coordinator/job_coordinator.js +93 -0
  77. package/dest/logs/log_service.d.ts +3 -2
  78. package/dest/logs/log_service.d.ts.map +1 -1
  79. package/dest/logs/log_service.js +21 -13
  80. package/dest/notes/note_service.d.ts +5 -4
  81. package/dest/notes/note_service.d.ts.map +1 -1
  82. package/dest/notes/note_service.js +30 -34
  83. package/dest/oracle_version.d.ts +3 -3
  84. package/dest/oracle_version.d.ts.map +1 -1
  85. package/dest/oracle_version.js +4 -3
  86. package/dest/private_kernel/hints/index.d.ts +2 -2
  87. package/dest/private_kernel/hints/index.d.ts.map +1 -1
  88. package/dest/private_kernel/hints/index.js +1 -1
  89. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +28 -0
  90. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
  91. package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +13 -7
  92. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  93. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  94. package/dest/private_kernel/private_kernel_execution_prover.js +4 -5
  95. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
  96. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  97. package/dest/private_kernel/private_kernel_oracle.js +90 -2
  98. package/dest/pxe.d.ts +8 -36
  99. package/dest/pxe.d.ts.map +1 -1
  100. package/dest/pxe.js +70 -93
  101. package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
  102. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  103. package/dest/storage/capsule_store/capsule_store.js +132 -23
  104. package/dest/storage/contract_store/contract_store.d.ts +1 -2
  105. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  106. package/dest/storage/contract_store/contract_store.js +0 -12
  107. package/dest/storage/note_store/note_store.d.ts +45 -56
  108. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  109. package/dest/storage/note_store/note_store.js +244 -263
  110. package/dest/storage/note_store/stored_note.d.ts +16 -0
  111. package/dest/storage/note_store/stored_note.d.ts.map +1 -0
  112. package/dest/storage/note_store/stored_note.js +43 -0
  113. package/dest/storage/private_event_store/private_event_store.d.ts +47 -7
  114. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  115. package/dest/storage/private_event_store/private_event_store.js +203 -68
  116. package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
  117. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
  118. package/dest/storage/private_event_store/stored_private_event.js +56 -0
  119. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +15 -8
  120. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  121. package/dest/storage/tagging_store/recipient_tagging_store.js +69 -12
  122. package/dest/storage/tagging_store/sender_tagging_store.d.ts +19 -9
  123. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  124. package/dest/storage/tagging_store/sender_tagging_store.js +110 -28
  125. package/dest/tagging/constants.d.ts +2 -0
  126. package/dest/tagging/constants.d.ts.map +1 -0
  127. package/dest/tagging/constants.js +10 -0
  128. package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
  129. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
  130. package/dest/tagging/get_all_logs_by_tags.js +46 -0
  131. package/dest/tagging/index.d.ts +3 -2
  132. package/dest/tagging/index.d.ts.map +1 -1
  133. package/dest/tagging/index.js +2 -10
  134. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -2
  135. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  136. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +8 -8
  137. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
  138. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  139. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
  140. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -2
  141. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  142. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +8 -8
  143. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
  144. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  145. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +5 -8
  146. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -2
  147. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  148. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +10 -5
  149. package/package.json +18 -18
  150. package/src/bin/check_oracle_version.ts +1 -0
  151. package/src/block_synchronizer/block_synchronizer.ts +77 -20
  152. package/src/config/index.ts +14 -0
  153. package/src/config/package_info.ts +1 -1
  154. package/src/contract_function_simulator/benchmarked_node.ts +103 -0
  155. package/src/contract_function_simulator/contract_function_simulator.ts +37 -26
  156. package/src/contract_function_simulator/execution_note_cache.ts +44 -25
  157. package/src/contract_function_simulator/index.ts +1 -1
  158. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +5 -1
  159. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  160. package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
  161. package/src/contract_function_simulator/oracle/interfaces.ts +20 -10
  162. package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
  163. package/src/contract_function_simulator/oracle/oracle.ts +56 -41
  164. package/src/contract_function_simulator/oracle/private_execution.ts +1 -69
  165. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +39 -44
  166. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +90 -76
  167. package/src/contract_sync/index.ts +98 -0
  168. package/src/debug/pxe_debug_utils.ts +3 -2
  169. package/src/entrypoints/client/bundle/utils.ts +7 -1
  170. package/src/entrypoints/client/lazy/utils.ts +7 -2
  171. package/src/entrypoints/pxe_creation_options.ts +2 -1
  172. package/src/entrypoints/server/index.ts +2 -0
  173. package/src/entrypoints/server/utils.ts +11 -15
  174. package/src/events/event_service.ts +17 -21
  175. package/src/events/private_event_filter_validator.ts +3 -5
  176. package/src/job_coordinator/job_coordinator.ts +149 -0
  177. package/src/logs/log_service.ts +27 -9
  178. package/src/notes/note_service.ts +37 -40
  179. package/src/oracle_version.ts +4 -3
  180. package/src/private_kernel/hints/index.ts +1 -1
  181. package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +33 -22
  182. package/src/private_kernel/private_kernel_execution_prover.ts +3 -5
  183. package/src/private_kernel/private_kernel_oracle.ts +116 -36
  184. package/src/pxe.ts +123 -127
  185. package/src/storage/capsule_store/capsule_store.ts +159 -23
  186. package/src/storage/contract_store/contract_store.ts +0 -20
  187. package/src/storage/note_store/note_store.ts +286 -317
  188. package/src/storage/note_store/stored_note.ts +48 -0
  189. package/src/storage/private_event_store/private_event_store.ts +277 -76
  190. package/src/storage/private_event_store/stored_private_event.ts +73 -0
  191. package/src/storage/tagging_store/recipient_tagging_store.ts +89 -13
  192. package/src/storage/tagging_store/sender_tagging_store.ts +129 -28
  193. package/src/tagging/constants.ts +10 -0
  194. package/src/tagging/get_all_logs_by_tags.ts +68 -0
  195. package/src/tagging/index.ts +2 -11
  196. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +21 -7
  197. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
  198. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +10 -7
  199. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -13
  200. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +16 -4
  201. package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
  202. package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
  203. package/dest/contract_function_simulator/proxied_node.js +0 -27
  204. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
  205. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  206. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  207. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  208. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  209. package/dest/public_storage/public_storage_service.d.ts +0 -24
  210. package/dest/public_storage/public_storage_service.d.ts.map +0 -1
  211. package/dest/public_storage/public_storage_service.js +0 -26
  212. package/dest/tree_membership/tree_membership_service.d.ts +0 -52
  213. package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
  214. package/dest/tree_membership/tree_membership_service.js +0 -84
  215. package/src/contract_function_simulator/proxied_node.ts +0 -33
  216. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
  217. package/src/public_storage/public_storage_service.ts +0 -33
  218. package/src/tree_membership/tree_membership_service.ts +0 -112
@@ -3,7 +3,6 @@ import type { EventSelector } from '@aztec/stdlib/abi';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { siloNullifier } from '@aztec/stdlib/hash';
5
5
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
6
- import { MerkleTreeId } from '@aztec/stdlib/trees';
7
6
  import type { TxHash } from '@aztec/stdlib/tx';
8
7
 
9
8
  import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
@@ -14,11 +13,13 @@ export class EventService {
14
13
  private readonly anchorBlockStore: AnchorBlockStore,
15
14
  private readonly aztecNode: AztecNode,
16
15
  private readonly privateEventStore: PrivateEventStore,
16
+ private readonly jobId: string,
17
17
  ) {}
18
18
 
19
- public async deliverEvent(
19
+ public async validateAndStoreEvent(
20
20
  contractAddress: AztecAddress,
21
21
  selector: EventSelector,
22
+ randomness: Fr,
22
23
  content: Fr[],
23
24
  eventCommitment: Fr,
24
25
  txHash: TxHash,
@@ -28,50 +29,45 @@ export class EventService {
28
29
  // (and thus we're less concerned about being ahead of the synced block), we use the synced block number to
29
30
  // maintain consistent behavior in the PXE. Additionally, events should never be ahead of the synced block here
30
31
  // since `fetchTaggedLogs` only processes logs up to the synced block.
31
- const [syncedBlockHeader, siloedEventCommitment, txEffect] = await Promise.all([
32
+ const [anchorBlockHeader, siloedEventCommitment, txEffect] = await Promise.all([
32
33
  this.anchorBlockStore.getBlockHeader(),
33
34
  siloNullifier(contractAddress, eventCommitment),
34
35
  this.aztecNode.getTxEffect(txHash),
35
36
  ]);
36
37
 
37
- const syncedBlockNumber = syncedBlockHeader.getBlockNumber();
38
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
38
39
 
39
40
  if (!txEffect) {
40
41
  throw new Error(`Could not find tx effect for tx hash ${txHash}`);
41
42
  }
42
43
 
43
- if (txEffect.l2BlockNumber > syncedBlockNumber) {
44
- throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
44
+ if (txEffect.l2BlockNumber > anchorBlockNumber) {
45
+ throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
45
46
  }
46
47
 
47
- const eventInTx = txEffect.data.nullifiers.some(n => n.equals(siloedEventCommitment));
48
- if (!eventInTx) {
48
+ // Find the index of the event commitment in the nullifiers array to determine event ordering within the tx
49
+ const eventIndexInTx = txEffect.data.nullifiers.findIndex(n => n.equals(siloedEventCommitment));
50
+ if (eventIndexInTx === -1) {
49
51
  throw new Error(
50
52
  `Event commitment ${eventCommitment} (siloed as ${siloedEventCommitment}) is not present in tx ${txHash}`,
51
53
  );
52
54
  }
53
55
 
54
- const [nullifierIndex] = await this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [
55
- siloedEventCommitment,
56
- ]);
57
-
58
- if (nullifierIndex === undefined) {
59
- throw new Error(
60
- `Event commitment ${eventCommitment} (siloed as ${siloedEventCommitment}) is not present on the nullifier tree at block ${syncedBlockNumber} (from tx ${txHash})`,
61
- );
62
- }
63
-
64
56
  return this.privateEventStore.storePrivateEventLog(
65
57
  selector,
58
+ randomness,
66
59
  content,
67
- Number(nullifierIndex.data), // Index of the event commitment in the nullifier tree
60
+ siloedEventCommitment,
68
61
  {
69
62
  contractAddress,
70
63
  scope,
71
64
  txHash,
72
- l2BlockNumber: nullifierIndex.l2BlockNumber, // Block number in which the event was emitted
73
- l2BlockHash: nullifierIndex.l2BlockHash, // Block hash in which the event was emitted
65
+ l2BlockNumber: txEffect.l2BlockNumber,
66
+ l2BlockHash: txEffect.l2BlockHash,
67
+ txIndexInBlock: txEffect.txIndexInBlock,
68
+ eventIndexInTx,
74
69
  },
70
+ this.jobId,
75
71
  );
76
72
  }
77
73
  }
@@ -2,13 +2,12 @@ import type { PrivateEventFilter } from '@aztec/aztec.js/wallet';
2
2
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
3
3
  import { BlockNumber } from '@aztec/foundation/branded-types';
4
4
 
5
- import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
6
5
  import type { PrivateEventStoreFilter } from '../storage/private_event_store/private_event_store.js';
7
6
 
8
7
  export class PrivateEventFilterValidator {
9
- constructor(private anchorBlockStore: AnchorBlockStore) {}
8
+ constructor(private lastBlock: BlockNumber) {}
10
9
 
11
- async validate(filter: PrivateEventFilter): Promise<PrivateEventStoreFilter> {
10
+ validate(filter: PrivateEventFilter): PrivateEventStoreFilter {
12
11
  let { fromBlock, toBlock } = filter;
13
12
 
14
13
  // Block range filters in Aztec Node are defined as closed-open intervals [fromBlock, toBlock), so
@@ -16,9 +15,8 @@ export class PrivateEventFilterValidator {
16
15
  // We then default to [INITIAL_L2_BLOCK_NUM, latestKnownBlock + 1), ie: by default return events from
17
16
  // the first block to the latest known block.
18
17
  if (!fromBlock || !toBlock) {
19
- const lastKnownBlock = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
20
18
  fromBlock = fromBlock ?? BlockNumber(INITIAL_L2_BLOCK_NUM);
21
- toBlock = toBlock ?? BlockNumber(lastKnownBlock + 1);
19
+ toBlock = toBlock ?? BlockNumber(this.lastBlock + 1);
22
20
  }
23
21
 
24
22
  if (filter.scopes.length === 0) {
@@ -0,0 +1,149 @@
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import { createLogger } from '@aztec/foundation/log';
3
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
+
5
+ /**
6
+ * Interface that stores must implement to support staged writes.
7
+ */
8
+ export interface StagedStore {
9
+ /** Unique name identifying this store (used for tracking staged stores from JobCoordinator) */
10
+ readonly storeName: string;
11
+
12
+ /**
13
+ * Commits staged data to main storage.
14
+ * Should be called within a transaction for atomicity.
15
+ *
16
+ * @param jobId - The job identifier
17
+ */
18
+ commit(jobId: string): Promise<void>;
19
+
20
+ /**
21
+ * Discards staged data without committing.
22
+ * Called on abort.
23
+ *
24
+ * @param jobId - The job identifier
25
+ */
26
+ discardStaged(jobId: string): Promise<void>;
27
+ }
28
+
29
+ /**
30
+ * JobCoordinator manages job lifecycle and provides crash resilience for PXE operations.
31
+ *
32
+ * It uses a staged writes pattern:
33
+ * 1. When a job begins, a unique job ID is created
34
+ * 2. During the job, all writes go to staging (keyed by job ID)
35
+ * 3. On commit, staging is promoted to main storage
36
+ * 4. On abort, staged data is discarded
37
+ *
38
+ * Note: PXE should only rely on a single JobCoordinator instance, so it can eventually
39
+ * orchestrate concurrent jobs. Right now it doesn't make a difference because we're
40
+ * using a job queue with concurrency=1.
41
+ */
42
+ export class JobCoordinator {
43
+ private readonly log = createLogger('pxe:job_coordinator');
44
+
45
+ /** The underlying KV store */
46
+ kvStore: AztecAsyncKVStore;
47
+
48
+ #currentJobId: string | undefined;
49
+ #stores: Map<string, StagedStore> = new Map();
50
+
51
+ constructor(kvStore: AztecAsyncKVStore) {
52
+ this.kvStore = kvStore;
53
+ }
54
+
55
+ /**
56
+ * Registers a staged store.
57
+ * Must be called during initialization for all stores that need staging support.
58
+ */
59
+ registerStore(store: StagedStore): void {
60
+ if (this.#stores.has(store.storeName)) {
61
+ throw new Error(`Store "${store.storeName}" is already registered`);
62
+ }
63
+ this.#stores.set(store.storeName, store);
64
+ this.log.debug(`Registered staged store: ${store.storeName}`);
65
+ }
66
+
67
+ /**
68
+ * Registers multiple staged stores.
69
+ */
70
+ registerStores(stores: StagedStore[]): void {
71
+ for (const store of stores) {
72
+ this.registerStore(store);
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Begins a new job and returns a job ID for staged writes.
78
+ *
79
+ * @returns Job ID to pass to store operations
80
+ */
81
+ beginJob(): string {
82
+ if (this.#currentJobId) {
83
+ throw new Error(
84
+ `Cannot begin job: job ${this.#currentJobId} is already in progress. ` +
85
+ `This should not happen - ensure jobs are properly committed or aborted.`,
86
+ );
87
+ }
88
+
89
+ const jobId = randomBytes(8).toString('hex');
90
+ this.#currentJobId = jobId;
91
+
92
+ this.log.debug(`Started job ${jobId}`);
93
+ return jobId;
94
+ }
95
+
96
+ /**
97
+ * Commits a job by promoting all staged data to main storage.
98
+ *
99
+ * @param jobId - The job ID returned from beginJob
100
+ */
101
+ async commitJob(jobId: string): Promise<void> {
102
+ if (!this.#currentJobId || this.#currentJobId !== jobId) {
103
+ throw new Error(
104
+ `Cannot commit job ${jobId}: no matching job in progress. ` + `Current job: ${this.#currentJobId ?? 'none'}`,
105
+ );
106
+ }
107
+
108
+ this.log.debug(`Committing job ${jobId}`);
109
+
110
+ // Commit all stores atomically in a single transaction.
111
+ // Each store's commit is a no-op if it has no staged data (but that's up to each store to handle).
112
+ await this.kvStore.transactionAsync(async () => {
113
+ for (const store of this.#stores.values()) {
114
+ await store.commit(jobId);
115
+ }
116
+ });
117
+
118
+ this.#currentJobId = undefined;
119
+ this.log.debug(`Job ${jobId} committed successfully`);
120
+ }
121
+
122
+ /**
123
+ * Aborts a job by discarding all staged data.
124
+ *
125
+ * @param jobId - The job ID returned from beginJob
126
+ */
127
+ async abortJob(jobId: string): Promise<void> {
128
+ if (!this.#currentJobId || this.#currentJobId !== jobId) {
129
+ // Job may have already been aborted or never started properly
130
+ this.log.warn(`Abort called for job ${jobId} but current job is ${this.#currentJobId ?? 'none'}`);
131
+ }
132
+
133
+ this.log.debug(`Aborting job ${jobId}`);
134
+
135
+ for (const store of this.#stores.values()) {
136
+ await store.discardStaged(jobId);
137
+ }
138
+
139
+ this.#currentJobId = undefined;
140
+ this.log.debug(`Job ${jobId} aborted`);
141
+ }
142
+
143
+ /**
144
+ * Checks if there's a job currently in progress.
145
+ */
146
+ hasJobInProgress(): boolean {
147
+ return this.#currentJobId !== undefined;
148
+ }
149
+ }
@@ -13,7 +13,11 @@ import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_sto
13
13
  import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
14
14
  import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
15
15
  import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
16
- import { loadPrivateLogsForSenderRecipientPair } from '../tagging/index.js';
16
+ import {
17
+ getAllPrivateLogsByTags,
18
+ getAllPublicLogsByTagsFromContract,
19
+ loadPrivateLogsForSenderRecipientPair,
20
+ } from '../tagging/index.js';
17
21
 
18
22
  export class LogService {
19
23
  private log = createLogger('log_service');
@@ -26,6 +30,7 @@ export class LogService {
26
30
  private readonly recipientTaggingStore: RecipientTaggingStore,
27
31
  private readonly senderAddressBookStore: SenderAddressBookStore,
28
32
  private readonly addressStore: AddressStore,
33
+ private readonly jobId: string,
29
34
  ) {}
30
35
 
31
36
  public async bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]> {
@@ -48,10 +53,17 @@ export class LogService {
48
53
  }
49
54
 
50
55
  async #getPublicLogByTag(tag: Tag, contractAddress: AztecAddress): Promise<LogRetrievalResponse | null> {
51
- const logs = await this.aztecNode.getPublicLogsByTagsFromContract(contractAddress, [tag]);
52
- const logsForTag = logs[0];
56
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
57
+ const anchorBlockHash = await anchorBlockHeader.hash();
58
+ const allLogsPerTag = await getAllPublicLogsByTagsFromContract(
59
+ this.aztecNode,
60
+ contractAddress,
61
+ [tag],
62
+ anchorBlockHash,
63
+ );
64
+ const logsForTag = allLogsPerTag[0];
53
65
 
54
- if (logsForTag.length == 0) {
66
+ if (logsForTag.length === 0) {
55
67
  return null;
56
68
  } else if (logsForTag.length > 1) {
57
69
  // TODO(#11627): handle this case
@@ -71,10 +83,12 @@ export class LogService {
71
83
  }
72
84
 
73
85
  async #getPrivateLogByTag(siloedTag: SiloedTag): Promise<LogRetrievalResponse | null> {
74
- const logs = await this.aztecNode.getPrivateLogsByTags([siloedTag]);
75
- const logsForTag = logs[0];
86
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
87
+ const anchorBlockHash = await anchorBlockHeader.hash();
88
+ const allLogsPerTag = await getAllPrivateLogsByTags(this.aztecNode, [siloedTag], anchorBlockHash);
89
+ const logsForTag = allLogsPerTag[0];
76
90
 
77
- if (logsForTag.length == 0) {
91
+ if (logsForTag.length === 0) {
78
92
  return null;
79
93
  } else if (logsForTag.length > 1) {
80
94
  // TODO(#11627): handle this case
@@ -101,7 +115,9 @@ export class LogService {
101
115
  this.log.verbose('Searching for tagged logs', { contract: contractAddress });
102
116
 
103
117
  // We only load logs from block up to and including the anchor block number
104
- const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
118
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
119
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
120
+ const anchorBlockHash = await anchorBlockHeader.hash();
105
121
 
106
122
  // Determine recipients: use scopes if provided, otherwise get all accounts
107
123
  const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
@@ -122,6 +138,8 @@ export class LogService {
122
138
  this.aztecNode,
123
139
  this.recipientTaggingStore,
124
140
  anchorBlockNumber,
141
+ anchorBlockHash,
142
+ this.jobId,
125
143
  ),
126
144
  ),
127
145
  );
@@ -186,7 +204,7 @@ export class LogService {
186
204
  });
187
205
 
188
206
  // TODO: This looks like it could belong more at the oracle interface level
189
- return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs);
207
+ return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
190
208
  }
191
209
 
192
210
  async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
@@ -15,6 +15,7 @@ export class NoteService {
15
15
  private readonly noteStore: NoteStore,
16
16
  private readonly aztecNode: AztecNode,
17
17
  private readonly anchorBlockStore: AnchorBlockStore,
18
+ private readonly jobId: string,
18
19
  ) {}
19
20
 
20
21
  /**
@@ -33,15 +34,18 @@ export class NoteService {
33
34
  status: NoteStatus,
34
35
  scopes?: AztecAddress[],
35
36
  ) {
36
- const noteDaos = await this.noteStore.getNotes({
37
- contractAddress,
38
- owner,
39
- storageSlot,
40
- status,
41
- scopes,
42
- });
37
+ const noteDaos = await this.noteStore.getNotes(
38
+ {
39
+ contractAddress,
40
+ owner,
41
+ storageSlot,
42
+ status,
43
+ scopes,
44
+ },
45
+ this.jobId,
46
+ );
43
47
  return noteDaos.map(
44
- ({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier, index }) => ({
48
+ ({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier }) => ({
45
49
  contractAddress,
46
50
  owner,
47
51
  storageSlot,
@@ -49,9 +53,8 @@ export class NoteService {
49
53
  noteNonce,
50
54
  note,
51
55
  noteHash,
56
+ isPending: false, // Note service deals only with settled notes
52
57
  siloedNullifier,
53
- // PXE can use this index to get full MembershipWitness
54
- index,
55
58
  }),
56
59
  );
57
60
  }
@@ -69,9 +72,9 @@ export class NoteService {
69
72
  * @param contractAddress - The contract whose notes should be checked and nullified.
70
73
  */
71
74
  public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
72
- const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
75
+ const anchorBlockHash = await (await this.anchorBlockStore.getBlockHeader()).hash();
73
76
 
74
- const contractNotes = await this.noteStore.getNotes({ contractAddress });
77
+ const contractNotes = await this.noteStore.getNotes({ contractAddress }, this.jobId);
75
78
 
76
79
  if (contractNotes.length === 0) {
77
80
  return;
@@ -92,7 +95,7 @@ export class NoteService {
92
95
  const nullifierIndexes = (
93
96
  await Promise.all(
94
97
  nullifierBatches.map(batch =>
95
- this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, batch),
98
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, batch),
96
99
  ),
97
100
  )
98
101
  ).flat();
@@ -105,10 +108,10 @@ export class NoteService {
105
108
  })
106
109
  .filter(nullifier => nullifier !== undefined) as DataInBlock<Fr>[];
107
110
 
108
- await this.noteStore.applyNullifiers(foundNullifiers);
111
+ await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
109
112
  }
110
113
 
111
- public async deliverNote(
114
+ public async validateAndStoreNote(
112
115
  contractAddress: AztecAddress,
113
116
  owner: AztecAddress,
114
117
  storageSlot: Fr,
@@ -139,41 +142,33 @@ export class NoteService {
139
142
  // number which *should* be recent enough to be available, even for non-archive nodes.
140
143
  // Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
141
144
  // logs up to the synced block making this only an additional safety check.
142
- const syncedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
145
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
146
+ const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
147
+ const anchorBlockHash = await anchorBlockHeader.hash();
143
148
 
144
149
  // By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
145
150
  // of other contracts, which would constitute a security breach.
146
151
  const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
147
152
  const siloedNullifier = await siloNullifier(contractAddress, nullifier);
148
153
 
149
- const txEffect = await this.aztecNode.getTxEffect(txHash);
154
+ const [txEffect, [nullifierIndex]] = await Promise.all([
155
+ this.aztecNode.getTxEffect(txHash),
156
+ this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
157
+ ]);
150
158
  if (!txEffect) {
151
159
  throw new Error(`Could not find tx effect for tx hash ${txHash}`);
152
160
  }
153
161
 
154
- if (txEffect.l2BlockNumber > syncedBlockNumber) {
155
- throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
162
+ if (txEffect.l2BlockNumber > anchorBlockNumber) {
163
+ throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${anchorBlockNumber}`);
156
164
  }
157
165
 
158
- const noteInTx = txEffect.data.noteHashes.some(nh => nh.equals(uniqueNoteHash));
159
- if (!noteInTx) {
166
+ // Find the index of the note hash in the noteHashes array to determine note ordering within the tx
167
+ const noteIndexInTx = txEffect.data.noteHashes.findIndex(nh => nh.equals(uniqueNoteHash));
168
+ if (noteIndexInTx === -1) {
160
169
  throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
161
170
  }
162
171
 
163
- // We store notes by their index in the global note hash tree, which has the convenient side effect of validating
164
- // note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
165
- // queries in a single round-trip.
166
- const [[uniqueNoteHashTreeIndexInBlock], [nullifierIndex]] = await Promise.all([
167
- this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NOTE_HASH_TREE, [uniqueNoteHash]),
168
- this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, [siloedNullifier]),
169
- ]);
170
-
171
- if (uniqueNoteHashTreeIndexInBlock === undefined) {
172
- throw new Error(
173
- `Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present on the tree at block ${syncedBlockNumber} (from tx ${txHash})`,
174
- );
175
- }
176
-
177
172
  const noteDao = new NoteDao(
178
173
  new Note(content),
179
174
  contractAddress,
@@ -184,17 +179,19 @@ export class NoteService {
184
179
  noteHash,
185
180
  siloedNullifier,
186
181
  txHash,
187
- uniqueNoteHashTreeIndexInBlock.l2BlockNumber,
188
- uniqueNoteHashTreeIndexInBlock.l2BlockHash.toString(),
189
- uniqueNoteHashTreeIndexInBlock.data,
182
+ txEffect.l2BlockNumber,
183
+ txEffect.l2BlockHash.toString(),
184
+ txEffect.txIndexInBlock,
185
+ noteIndexInTx,
190
186
  );
191
187
 
192
188
  // The note was found by `recipient`, so we use that as the scope when storing the note.
193
- await this.noteStore.addNotes([noteDao], recipient);
189
+ await this.noteStore.addNotes([noteDao], recipient, this.jobId);
194
190
 
195
191
  if (nullifierIndex !== undefined) {
192
+ // We found nullifier index which implies that the note has already been nullified.
196
193
  const { data: _, ...blockHashAndNum } = nullifierIndex;
197
- await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }]);
194
+ await this.noteStore.applyNullifiers([{ data: siloedNullifier, ...blockHashAndNum }], this.jobId);
198
195
  }
199
196
  }
200
197
  }
@@ -4,8 +4,9 @@
4
4
  ///
5
5
  /// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
6
6
  /// and if the oracle version is incompatible an error is thrown.
7
- export const ORACLE_VERSION = 5;
7
+ export const ORACLE_VERSION = 9;
8
8
 
9
9
  /// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
10
- /// which in turn implies that you need to update the ORACLE_VERSION constant.
11
- export const ORACLE_INTERFACE_HASH = 'd603c17a97034d978ca453d2bce3aacae139539dee28bbc46e8f8c7177a348ec';
10
+ /// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
11
+ /// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
12
+ export const ORACLE_INTERFACE_HASH = '9866cc52510acaef75a3d47a0ed501fd9ff92b9d53b2c8a88c8a3ffd04ced81f';
@@ -1,2 +1,2 @@
1
- export * from './build_private_kernel_reset_private_inputs.js';
1
+ export * from './private_kernel_reset_private_inputs_builder.js';
2
2
  export * from './compute_tx_include_by_timestamp.js';
@@ -138,7 +138,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
138
138
  }
139
139
  }
140
140
 
141
- async build(oracle: PrivateKernelOracle, noteHashLeafIndexMap: Map<bigint, bigint>) {
141
+ async build(oracle: PrivateKernelOracle) {
142
142
  if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
143
143
  throw new Error('Reset is not required.');
144
144
  }
@@ -157,16 +157,6 @@ export class PrivateKernelResetPrivateInputsBuilder {
157
157
  allowRemainder,
158
158
  );
159
159
 
160
- const previousVkMembershipWitness = await oracle.getVkMembershipWitness(
161
- this.previousKernelOutput.verificationKey.keyAsFields,
162
- );
163
- const vkData = new VkData(
164
- this.previousKernelOutput.verificationKey,
165
- Number(previousVkMembershipWitness.leafIndex),
166
- previousVkMembershipWitness.siblingPath,
167
- );
168
- const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
169
-
170
160
  this.reduceReadRequestActions(
171
161
  this.noteHashResetActions,
172
162
  dimensions.NOTE_HASH_PENDING_READ,
@@ -178,30 +168,51 @@ export class PrivateKernelResetPrivateInputsBuilder {
178
168
  dimensions.NULLIFIER_SETTLED_READ,
179
169
  );
180
170
 
181
- // TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
182
- const paddedSideEffects = PaddedSideEffects.empty();
183
-
184
- return new PrivateKernelResetCircuitPrivateInputs(
185
- previousKernelData,
186
- paddedSideEffects,
187
- new PrivateKernelResetHints(
188
- await buildNoteHashReadRequestHintsFromResetActions(
171
+ // Execute all the expensive node querying operations in parallel.
172
+ const [previousVkMembershipWitness, noteHashReadRequestHints, nullifierReadRequestHints, keyValidationHints] =
173
+ await Promise.all([
174
+ oracle.getVkMembershipWitness(this.previousKernelOutput.verificationKey.keyAsFields),
175
+ buildNoteHashReadRequestHintsFromResetActions<
176
+ typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
177
+ typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX
178
+ >(
189
179
  oracle,
190
180
  this.previousKernel.validationRequests.noteHashReadRequests,
191
181
  this.previousKernel.end.noteHashes,
192
182
  this.noteHashResetActions,
193
- noteHashLeafIndexMap,
194
183
  ),
195
- await buildNullifierReadRequestHintsFromResetActions(
184
+ buildNullifierReadRequestHintsFromResetActions<
185
+ typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX,
186
+ typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX
187
+ >(
196
188
  { getNullifierMembershipWitness: getNullifierMembershipWitnessResolver(oracle) },
197
189
  this.previousKernel.validationRequests.nullifierReadRequests,
198
190
  this.nullifierResetActions,
199
191
  ),
200
- await getMasterSecretKeysAndAppKeyGenerators(
192
+ getMasterSecretKeysAndAppKeyGenerators(
201
193
  this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
202
194
  dimensions.KEY_VALIDATION,
203
195
  oracle,
204
196
  ),
197
+ ]);
198
+
199
+ const vkData = new VkData(
200
+ this.previousKernelOutput.verificationKey,
201
+ Number(previousVkMembershipWitness.leafIndex),
202
+ previousVkMembershipWitness.siblingPath,
203
+ );
204
+ const previousKernelData = new PrivateKernelData(this.previousKernelOutput.publicInputs, vkData);
205
+
206
+ // TODO: Enable padding when we have a better idea what are the final amounts we should pad to.
207
+ const paddedSideEffects = PaddedSideEffects.empty();
208
+
209
+ return new PrivateKernelResetCircuitPrivateInputs(
210
+ previousKernelData,
211
+ paddedSideEffects,
212
+ new PrivateKernelResetHints(
213
+ noteHashReadRequestHints,
214
+ nullifierReadRequestHints,
215
+ keyValidationHints,
205
216
  this.transientDataSquashingHints,
206
217
  ),
207
218
  dimensions,
@@ -28,13 +28,12 @@ import {
28
28
  type PrivateCallExecutionResult,
29
29
  type PrivateExecutionResult,
30
30
  TxRequest,
31
- collectNoteHashLeafIndexMap,
32
31
  collectNoteHashNullifierCounterMap,
33
32
  getFinalMinRevertibleSideEffectCounter,
34
33
  } from '@aztec/stdlib/tx';
35
34
  import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
36
35
 
37
- import { PrivateKernelResetPrivateInputsBuilder } from './hints/build_private_kernel_reset_private_inputs.js';
36
+ import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
38
37
  import type { PrivateKernelOracle } from './private_kernel_oracle.js';
39
38
 
40
39
  const NULL_SIMULATE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
@@ -101,7 +100,6 @@ export class PrivateKernelExecutionProver {
101
100
 
102
101
  const executionSteps: PrivateExecutionStep[] = [];
103
102
 
104
- const noteHashLeafIndexMap = collectNoteHashLeafIndexMap(executionResult);
105
103
  const noteHashNullifierCounterMap = collectNoteHashNullifierCounterMap(executionResult);
106
104
  const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(executionResult);
107
105
  const splitCounter = isPrivateOnlyTx ? 0 : minRevertibleSideEffectCounter;
@@ -116,7 +114,7 @@ export class PrivateKernelExecutionProver {
116
114
  );
117
115
  while (resetBuilder.needsReset()) {
118
116
  const witgenTimer = new Timer();
119
- const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
117
+ const privateInputs = await resetBuilder.build(this.oracle);
120
118
  output = generateWitnesses
121
119
  ? await this.proofCreator.generateResetOutput(privateInputs)
122
120
  : await this.proofCreator.simulateReset(privateInputs);
@@ -224,7 +222,7 @@ export class PrivateKernelExecutionProver {
224
222
  );
225
223
  while (resetBuilder.needsReset()) {
226
224
  const witgenTimer = new Timer();
227
- const privateInputs = await resetBuilder.build(this.oracle, noteHashLeafIndexMap);
225
+ const privateInputs = await resetBuilder.build(this.oracle);
228
226
  output = generateWitnesses
229
227
  ? await this.proofCreator.generateResetOutput(privateInputs)
230
228
  : await this.proofCreator.simulateReset(privateInputs);