@aztec/pxe 4.0.0-nightly.20260112 → 4.0.0-nightly.20260114

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 (78) hide show
  1. package/dest/block_synchronizer/block_synchronizer.d.ts +4 -2
  2. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_synchronizer.js +19 -13
  4. package/dest/contract_function_simulator/oracle/interfaces.d.ts +3 -3
  5. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +4 -4
  7. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  8. package/dest/contract_function_simulator/oracle/note_packing_utils.js +5 -5
  9. package/dest/contract_function_simulator/oracle/oracle.js +1 -1
  10. package/dest/contract_function_simulator/oracle/private_execution.d.ts +1 -1
  11. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/oracle/private_execution.js +1 -2
  13. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -16
  14. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +4 -31
  16. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +1 -1
  17. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +15 -13
  19. package/dest/events/event_service.d.ts +1 -1
  20. package/dest/events/event_service.d.ts.map +1 -1
  21. package/dest/events/event_service.js +8 -12
  22. package/dest/logs/log_service.d.ts +3 -2
  23. package/dest/logs/log_service.d.ts.map +1 -1
  24. package/dest/logs/log_service.js +4 -2
  25. package/dest/notes/note_service.d.ts +2 -2
  26. package/dest/notes/note_service.d.ts.map +1 -1
  27. package/dest/notes/note_service.js +14 -22
  28. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
  29. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
  30. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
  31. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  32. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  33. package/dest/private_kernel/private_kernel_execution_prover.js +3 -4
  34. package/dest/private_kernel/private_kernel_oracle.d.ts +24 -28
  35. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  36. package/dest/private_kernel/private_kernel_oracle.js +92 -2
  37. package/dest/pxe.d.ts +7 -36
  38. package/dest/pxe.d.ts.map +1 -1
  39. package/dest/pxe.js +12 -59
  40. package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
  41. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  42. package/dest/storage/capsule_store/capsule_store.js +132 -23
  43. package/dest/storage/note_store/note_store.d.ts +6 -5
  44. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  45. package/dest/storage/note_store/note_store.js +89 -94
  46. package/dest/storage/private_event_store/private_event_store.d.ts +13 -6
  47. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  48. package/dest/storage/private_event_store/private_event_store.js +70 -56
  49. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +1 -1
  50. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  51. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +1 -1
  52. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
  53. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  54. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +2 -2
  55. package/package.json +16 -16
  56. package/src/block_synchronizer/block_synchronizer.ts +23 -12
  57. package/src/contract_function_simulator/oracle/interfaces.ts +2 -2
  58. package/src/contract_function_simulator/oracle/note_packing_utils.ts +6 -6
  59. package/src/contract_function_simulator/oracle/oracle.ts +1 -1
  60. package/src/contract_function_simulator/oracle/private_execution.ts +0 -2
  61. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +2 -36
  62. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +15 -10
  63. package/src/events/event_service.ts +12 -26
  64. package/src/logs/log_service.ts +2 -1
  65. package/src/notes/note_service.ts +14 -23
  66. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
  67. package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
  68. package/src/private_kernel/private_kernel_oracle.ts +119 -36
  69. package/src/pxe.ts +10 -81
  70. package/src/storage/capsule_store/capsule_store.ts +159 -23
  71. package/src/storage/note_store/note_store.ts +98 -95
  72. package/src/storage/private_event_store/private_event_store.ts +92 -65
  73. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -1
  74. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +6 -2
  75. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
  76. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
  77. package/dest/private_kernel/private_kernel_oracle_impl.js +0 -86
  78. package/src/private_kernel/private_kernel_oracle_impl.ts +0 -133
@@ -1 +1 @@
1
- {"version":3,"file":"private_event_store.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_store/private_event_store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,YAAY,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAaF,KAAK,oBAAoB,GAAG,IAAI,GAAG;IACjC,eAAe,EAAE,YAAY,CAAC;IAC9B,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAiB;;IAW5B,MAAM,yCAAuC;IAE7C,YAAY,KAAK,EAAE,iBAAiB,EAMnC;IAMD;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EACd,UAAU,EAAE,EAAE,EAAE,EAChB,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAkCf;IAED;;;;;;;;;;OAUG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwC/B;IAED;;;OAGG;IACU,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCpG;CACF"}
1
+ {"version":3,"file":"private_event_store.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_store/private_event_store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,YAAY,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAgBF,KAAK,oBAAoB,GAAG,IAAI,GAAG;IACjC,eAAe,EAAE,YAAY,CAAC;IAC9B,KAAK,EAAE,YAAY,CAAC;IACpB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAiB;;IAW5B,MAAM,yCAAuC;IAE7C,YAAY,KAAK,EAAE,iBAAiB,EAMnC;IAMD;;;;;;;;;;;OAWG;IACH,oBAAoB,CAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EACd,UAAU,EAAE,EAAE,EAAE,EAChB,qBAAqB,EAAE,EAAE,EACzB,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAsCf;IAED;;;;;;;;;;OAUG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuD/B;IAED;;;;;OAKG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCpF;CACF"}
@@ -8,10 +8,10 @@ import { TxHash } from '@aztec/stdlib/tx';
8
8
  * Stores decrypted private event logs.
9
9
  */ export class PrivateEventStore {
10
10
  #store;
11
- /** Map storing the actual private event log entries, keyed by eventCommitmentIndex */ #eventLogs;
12
- /** Map from contractAddress_scope_eventSelector to eventCommitmentIndex[] for efficient lookup */ #eventsByContractScopeSelector;
13
- /** Map from block number to eventCommitmentIndex[] for rollback support */ #eventsByBlockNumber;
14
- /** Map from eventCommitmentIndex to boolean indicating if log has been seen. */ #seenLogs;
11
+ /** Map storing the actual private event log entries, keyed by siloedEventCommitment */ #eventLogs;
12
+ /** Map from contractAddress_scope_eventSelector to siloedEventCommitment[] for efficient lookup */ #eventsByContractScopeSelector;
13
+ /** Map from block number to siloedEventCommitment[] for rollback support */ #eventsByBlockNumber;
14
+ /** Map from siloedEventCommitment to boolean indicating if log has been seen. */ #seenLogs;
15
15
  logger = createLogger('private_event_store');
16
16
  constructor(store){
17
17
  this.#store = store;
@@ -26,23 +26,26 @@ import { TxHash } from '@aztec/stdlib/tx';
26
26
  /**
27
27
  * Store a private event log.
28
28
  * @param eventSelector - The event selector of the event.
29
+ * @param randomness - The randomness used for the event commitment.
29
30
  * @param msgContent - The content of the event.
30
- * @param eventCommitmentIndex - The index of the event commitment in the nullifier tree.
31
+ * @param siloedEventCommitment - The siloed event commitment (used as unique identifier).
31
32
  * @param metadata
32
33
  * contractAddress - The address of the contract that emitted the event.
33
34
  * scope - The address to which the event is scoped.
34
35
  * txHash - The transaction hash of the event log.
35
36
  * blockNumber - The block number in which the event was emitted.
36
- */ storePrivateEventLog(eventSelector, randomness, msgContent, eventCommitmentIndex, metadata) {
37
- const { contractAddress, scope, txHash, l2BlockNumber, l2BlockHash } = metadata;
37
+ */ storePrivateEventLog(eventSelector, randomness, msgContent, siloedEventCommitment, metadata) {
38
+ const { contractAddress, scope, txHash, l2BlockNumber, l2BlockHash, txIndexInBlock, eventIndexInTx } = metadata;
38
39
  return this.#store.transactionAsync(async ()=>{
39
40
  const key = this.#keyFor(contractAddress, scope, eventSelector);
40
- // Check if this exact log has already been stored using eventCommitmentIndex as unique identifier
41
- const hasBeenSeen = await this.#seenLogs.getAsync(eventCommitmentIndex);
41
+ // The siloed event commitment is guaranteed to be unique as it's inserted into the nullifier tree. For this
42
+ // reason we use it as id.
43
+ const eventId = siloedEventCommitment.toString();
44
+ const hasBeenSeen = await this.#seenLogs.getAsync(eventId);
42
45
  if (hasBeenSeen) {
43
46
  this.logger.verbose('Ignoring duplicate event log', {
44
47
  txHash: txHash.toString(),
45
- eventCommitmentIndex
48
+ siloedEventCommitment
46
49
  });
47
50
  return;
48
51
  }
@@ -52,27 +55,28 @@ import { TxHash } from '@aztec/stdlib/tx';
52
55
  msgContent,
53
56
  l2BlockNumber
54
57
  });
55
- await this.#eventLogs.set(eventCommitmentIndex, {
58
+ await this.#eventLogs.set(eventId, {
56
59
  randomness,
57
60
  msgContent: serializeToBuffer(msgContent),
58
61
  l2BlockNumber,
59
62
  l2BlockHash: l2BlockHash.toBuffer(),
60
- eventCommitmentIndex,
61
63
  txHash: txHash.toBuffer(),
64
+ txIndexInBlock,
65
+ eventIndexInTx,
62
66
  lookupKey: key
63
67
  });
64
- const existingIndices = await this.#eventsByContractScopeSelector.getAsync(key) || [];
68
+ const existingIds = await this.#eventsByContractScopeSelector.getAsync(key) || [];
65
69
  await this.#eventsByContractScopeSelector.set(key, [
66
- ...existingIndices,
67
- eventCommitmentIndex
70
+ ...existingIds,
71
+ eventId
68
72
  ]);
69
- const existingBlockIndices = await this.#eventsByBlockNumber.getAsync(l2BlockNumber) || [];
73
+ const existingBlockIds = await this.#eventsByBlockNumber.getAsync(l2BlockNumber) || [];
70
74
  await this.#eventsByBlockNumber.set(l2BlockNumber, [
71
- ...existingBlockIndices,
72
- eventCommitmentIndex
75
+ ...existingBlockIds,
76
+ eventId
73
77
  ]);
74
- // Mark this log as seen using eventCommitmentIndex
75
- await this.#seenLogs.set(eventCommitmentIndex, true);
78
+ // Mark this log as seen
79
+ await this.#seenLogs.set(eventId, true);
76
80
  });
77
81
  }
78
82
  /**
@@ -83,15 +87,15 @@ import { TxHash } from '@aztec/stdlib/tx';
83
87
  * fromBlock: The block number to search from (inclusive).
84
88
  * toBlock: The block number to search upto (exclusive).
85
89
  * scope: - The addresses that decrypted the logs.
86
- * @returns - The event log contents, augmented with metadata about
87
- * the transaction and block it the event was included in .
90
+ * @returns - The event log contents, augmented with metadata about the transaction and block in which the event was
91
+ * included.
88
92
  */ async getPrivateEvents(eventSelector, filter) {
89
93
  const events = [];
90
94
  for (const scope of filter.scopes){
91
95
  const key = this.#keyFor(filter.contractAddress, scope, eventSelector);
92
- const eventCommitmentIndices = await this.#eventsByContractScopeSelector.getAsync(key) || [];
93
- for (const eventCommitmentIndex of eventCommitmentIndices){
94
- const entry = await this.#eventLogs.getAsync(eventCommitmentIndex);
96
+ const eventIds = await this.#eventsByContractScopeSelector.getAsync(key) || [];
97
+ for (const eventId of eventIds){
98
+ const entry = await this.#eventLogs.getAsync(eventId);
95
99
  if (!entry || entry.l2BlockNumber < filter.fromBlock || entry.l2BlockNumber >= filter.toBlock) {
96
100
  continue;
97
101
  }
@@ -105,7 +109,9 @@ import { TxHash } from '@aztec/stdlib/tx';
105
109
  continue;
106
110
  }
107
111
  events.push({
108
- eventCommitmentIndex: entry.eventCommitmentIndex,
112
+ l2BlockNumber: entry.l2BlockNumber,
113
+ txIndexInBlock: entry.txIndexInBlock,
114
+ eventIndexInTx: entry.eventIndexInTx,
109
115
  event: {
110
116
  packedEvent: msgContent,
111
117
  l2BlockNumber: BlockNumber(entry.l2BlockNumber),
@@ -116,43 +122,51 @@ import { TxHash } from '@aztec/stdlib/tx';
116
122
  });
117
123
  }
118
124
  }
119
- // Sort by eventCommitmentIndex only
120
- events.sort((a, b)=>a.eventCommitmentIndex - b.eventCommitmentIndex);
125
+ // Sort by block number, then by tx index within block, then by event index within tx
126
+ events.sort((a, b)=>{
127
+ if (a.l2BlockNumber !== b.l2BlockNumber) {
128
+ return a.l2BlockNumber - b.l2BlockNumber;
129
+ }
130
+ if (a.txIndexInBlock !== b.txIndexInBlock) {
131
+ return a.txIndexInBlock - b.txIndexInBlock;
132
+ }
133
+ return a.eventIndexInTx - b.eventIndexInTx;
134
+ });
121
135
  return events.map((ev)=>ev.event);
122
136
  }
123
137
  /**
124
138
  * Rolls back private events that were stored after a given `blockNumber` and up to `synchedBlockNumber` (the block
125
139
  * number up to which PXE managed to sync before the reorg happened).
126
- */ async rollbackEventsAfterBlock(blockNumber, synchedBlockNumber) {
127
- await this.#store.transactionAsync(async ()=>{
128
- let removedCount = 0;
129
- for(let block = blockNumber + 1; block <= synchedBlockNumber; block++){
130
- const indices = await this.#eventsByBlockNumber.getAsync(block);
131
- if (indices) {
132
- await this.#eventsByBlockNumber.delete(block);
133
- for (const eventCommitmentIndex of indices){
134
- const entry = await this.#eventLogs.getAsync(eventCommitmentIndex);
135
- if (!entry) {
136
- throw new Error(`Event log not found for eventCommitmentIndex ${eventCommitmentIndex}`);
137
- }
138
- await this.#eventLogs.delete(eventCommitmentIndex);
139
- await this.#seenLogs.delete(eventCommitmentIndex);
140
- // Update #eventsByContractScopeSelector using the stored lookupKey
141
- const existingIndices = await this.#eventsByContractScopeSelector.getAsync(entry.lookupKey);
142
- if (!existingIndices || existingIndices.length === 0) {
143
- throw new Error(`No indices found in #eventsByContractScopeSelector for key ${entry.lookupKey}`);
144
- }
145
- const filteredIndices = existingIndices.filter((idx)=>idx !== eventCommitmentIndex);
146
- if (filteredIndices.length === 0) {
147
- await this.#eventsByContractScopeSelector.delete(entry.lookupKey);
148
- } else {
149
- await this.#eventsByContractScopeSelector.set(entry.lookupKey, filteredIndices);
150
- }
151
- removedCount++;
140
+ *
141
+ * IMPORTANT: This method must be called within a transaction to ensure atomicity.
142
+ */ async rollback(blockNumber, synchedBlockNumber) {
143
+ let removedCount = 0;
144
+ for(let block = blockNumber + 1; block <= synchedBlockNumber; block++){
145
+ const eventIds = await this.#eventsByBlockNumber.getAsync(block);
146
+ if (eventIds) {
147
+ await this.#eventsByBlockNumber.delete(block);
148
+ for (const eventId of eventIds){
149
+ const entry = await this.#eventLogs.getAsync(eventId);
150
+ if (!entry) {
151
+ throw new Error(`Event log not found for eventId ${eventId}`);
152
+ }
153
+ await this.#eventLogs.delete(eventId);
154
+ await this.#seenLogs.delete(eventId);
155
+ // Update #eventsByContractScopeSelector using the stored lookupKey
156
+ const existingIds = await this.#eventsByContractScopeSelector.getAsync(entry.lookupKey);
157
+ if (!existingIds || existingIds.length === 0) {
158
+ throw new Error(`No ids found in #eventsByContractScopeSelector for key ${entry.lookupKey}`);
152
159
  }
160
+ const filteredIds = existingIds.filter((id)=>id !== eventId);
161
+ if (filteredIds.length === 0) {
162
+ await this.#eventsByContractScopeSelector.delete(entry.lookupKey);
163
+ } else {
164
+ await this.#eventsByContractScopeSelector.set(entry.lookupKey, filteredIds);
165
+ }
166
+ removedCount++;
153
167
  }
154
168
  }
155
- this.logger.verbose(`Rolled back ${removedCount} private events after block ${blockNumber}`);
156
- });
169
+ }
170
+ this.logger.verbose(`Rolled back ${removedCount} private events after block ${blockNumber}`);
157
171
  }
158
172
  }
@@ -11,4 +11,4 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
11
11
  * in the tagging data provider is indexed by the secret and hence completely disjoint.
12
12
  */
13
13
  export declare function loadPrivateLogsForSenderRecipientPair(secret: DirectionalAppTaggingSecret, app: AztecAddress, aztecNode: AztecNode, taggingStore: RecipientTaggingStore, anchorBlockNumber: BlockNumber): Promise<TxScopedL2Log[]>;
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVyRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsR0FDN0IsT0FBTyxDQUFDLGFBQWEsRUFBRSxDQUFDLENBeUcxQiJ9
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3RhZ2dpbmcvcmVjaXBpZW50X3N5bmMvbG9hZF9wcml2YXRlX2xvZ3NfZm9yX3NlbmRlcl9yZWNpcGllbnRfcGFpci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSwyQkFBMkIsRUFBRSxhQUFhLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVyRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHdEQUF3RCxDQUFDO0FBS3BHOzs7Ozs7R0FNRztBQUNILHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLDJCQUEyQixFQUNuQyxHQUFHLEVBQUUsWUFBWSxFQUNqQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUscUJBQXFCLEVBQ25DLGlCQUFpQixFQUFFLFdBQVcsR0FDN0IsT0FBTyxDQUFDLGFBQWEsRUFBRSxDQUFDLENBNEcxQiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CAyG1B"}
1
+ {"version":3,"file":"load_private_logs_for_sender_recipient_pair.d.ts","sourceRoot":"","sources":["../../../src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAKpG;;;;;;GAMG;AACH,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,2BAA2B,EACnC,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,qBAAqB,EACnC,iBAAiB,EAAE,WAAW,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC,CA4G1B"}
@@ -55,7 +55,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
55
55
  throw new Error('Node failed to return latest block header when syncing logs');
56
56
  }
57
57
  [finalizedBlockNumber, currentTimestamp] = [
58
- l2Tips.finalized.number,
58
+ l2Tips.finalized.block.number,
59
59
  latestBlockHeader.globalVariables.timestamp
60
60
  ];
61
61
  }
@@ -8,4 +8,4 @@ export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: A
8
8
  txHashesToFinalize: TxHash[];
9
9
  txHashesToDrop: TxHash[];
10
10
  }>;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUFFLGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFBO0NBQUUsQ0FBQyxDQWlDckUifQ==
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUFFLGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQUMsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFBO0NBQUUsQ0FBQyxDQXFDckUifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiCrE"}
1
+ {"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC;IAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAqCrE"}
@@ -4,7 +4,7 @@ import { TxStatus } from '@aztec/stdlib/tx';
4
4
  * dropped.
5
5
  */ export async function getStatusChangeOfPending(pending, aztecNode) {
6
6
  // Get receipts for all pending tx hashes and the finalized block number.
7
- const [receipts, { finalized }] = await Promise.all([
7
+ const [receipts, tips] = await Promise.all([
8
8
  Promise.all(pending.map((pendingTxHash)=>aztecNode.getTxReceipt(pendingTxHash))),
9
9
  aztecNode.getL2Tips()
10
10
  ]);
@@ -13,7 +13,7 @@ import { TxStatus } from '@aztec/stdlib/tx';
13
13
  for(let i = 0; i < receipts.length; i++){
14
14
  const receipt = receipts[i];
15
15
  const txHash = pending[i];
16
- if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= finalized.number) {
16
+ if (receipt.status === TxStatus.SUCCESS && receipt.blockNumber && receipt.blockNumber <= tips.finalized.block.number) {
17
17
  // Tx has been included in a block and the corresponding block is finalized --> we mark the indexes as
18
18
  // finalized.
19
19
  txHashesToFinalize.push(txHash);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "4.0.0-nightly.20260112",
3
+ "version": "4.0.0-nightly.20260114",
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": "4.0.0-nightly.20260112",
65
- "@aztec/bb.js": "4.0.0-nightly.20260112",
66
- "@aztec/builder": "4.0.0-nightly.20260112",
67
- "@aztec/constants": "4.0.0-nightly.20260112",
68
- "@aztec/ethereum": "4.0.0-nightly.20260112",
69
- "@aztec/foundation": "4.0.0-nightly.20260112",
70
- "@aztec/key-store": "4.0.0-nightly.20260112",
71
- "@aztec/kv-store": "4.0.0-nightly.20260112",
72
- "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260112",
73
- "@aztec/noir-types": "4.0.0-nightly.20260112",
74
- "@aztec/protocol-contracts": "4.0.0-nightly.20260112",
75
- "@aztec/simulator": "4.0.0-nightly.20260112",
76
- "@aztec/stdlib": "4.0.0-nightly.20260112",
64
+ "@aztec/bb-prover": "4.0.0-nightly.20260114",
65
+ "@aztec/bb.js": "4.0.0-nightly.20260114",
66
+ "@aztec/builder": "4.0.0-nightly.20260114",
67
+ "@aztec/constants": "4.0.0-nightly.20260114",
68
+ "@aztec/ethereum": "4.0.0-nightly.20260114",
69
+ "@aztec/foundation": "4.0.0-nightly.20260114",
70
+ "@aztec/key-store": "4.0.0-nightly.20260114",
71
+ "@aztec/kv-store": "4.0.0-nightly.20260114",
72
+ "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260114",
73
+ "@aztec/noir-types": "4.0.0-nightly.20260114",
74
+ "@aztec/protocol-contracts": "4.0.0-nightly.20260114",
75
+ "@aztec/simulator": "4.0.0-nightly.20260114",
76
+ "@aztec/stdlib": "4.0.0-nightly.20260114",
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": "4.0.0-nightly.20260112",
86
- "@aztec/noir-test-contracts.js": "4.0.0-nightly.20260112",
85
+ "@aztec/merkle-tree": "4.0.0-nightly.20260114",
86
+ "@aztec/noir-test-contracts.js": "4.0.0-nightly.20260114",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/lodash.omit": "^4.5.7",
@@ -1,5 +1,7 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
+ import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
5
  import type { L2TipsKVStore } from '@aztec/kv-store/stores';
4
6
  import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
5
7
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -21,6 +23,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
21
23
 
22
24
  constructor(
23
25
  private node: AztecNode,
26
+ private store: AztecAsyncKVStore,
24
27
  private anchorBlockStore: AnchorBlockStore,
25
28
  private noteStore: NoteStore,
26
29
  private privateEventStore: PrivateEventStore,
@@ -50,28 +53,36 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
50
53
 
51
54
  switch (event.type) {
52
55
  case 'blocks-added': {
53
- const lastBlock = event.blocks.at(-1)!.block;
56
+ const lastBlock = event.blocks.at(-1)!;
54
57
  this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
55
58
  blockHash: lastBlock.hash(),
56
59
  archive: lastBlock.archive.root.toString(),
57
60
  header: lastBlock.header.toInspect(),
58
61
  });
59
- await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
62
+ await this.anchorBlockStore.setHeader(lastBlock.header);
60
63
  break;
61
64
  }
62
65
  case 'chain-pruned': {
63
66
  this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
64
- // We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
65
- const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
66
- await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
67
- await this.privateEventStore.rollbackEventsAfterBlock(event.block.number, lastSynchedBlockNumber);
68
- // Update the header to the last block.
69
- const newHeader = await this.node.getBlockHeader(event.block.number);
70
- if (!newHeader) {
71
- this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
72
- } else {
73
- await this.anchorBlockStore.setHeader(newHeader);
67
+
68
+ const oldAnchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
69
+ // Note that the following is not necessarily the anchor block that will be used in the transaction - if
70
+ // the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
71
+ // forward.
72
+ const newAnchorBlockHeader = await this.node.getBlockHeaderByHash(Fr.fromString(event.block.hash));
73
+
74
+ if (!newAnchorBlockHeader) {
75
+ throw new Error(
76
+ `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.`,
77
+ );
74
78
  }
79
+
80
+ // Operations are wrapped in a single transaction to ensure atomicity.
81
+ await this.store.transactionAsync(async () => {
82
+ await this.noteStore.rollback(event.block.number, oldAnchorBlockNumber);
83
+ await this.privateEventStore.rollback(event.block.number, oldAnchorBlockNumber);
84
+ await this.anchorBlockStore.setHeader(newAnchorBlockHeader);
85
+ });
75
86
  break;
76
87
  }
77
88
  }
@@ -32,10 +32,10 @@ export interface NoteData {
32
32
  noteNonce: Fr;
33
33
  /** A hash of the note as it gets stored in the note hash tree. */
34
34
  noteHash: Fr;
35
+ /** True if the note is pending, false if settled. */
36
+ isPending: boolean;
35
37
  /** The corresponding nullifier of the note. Undefined for pending notes. */
36
38
  siloedNullifier?: Fr;
37
- /** The note's leaf index in the note hash tree. Undefined for pending notes. */
38
- index?: bigint;
39
39
  }
40
40
 
41
41
  // These interfaces contain the list of oracles required by aztec-nr in order to simulate and execute transactions, i.e.
@@ -28,7 +28,7 @@ function fromRawData(nonzeroNoteHashCounter: boolean, maybeNoteNonce: Fr): { sta
28
28
  * @param randomness - The randomness injected into the note to get the hiding property of commitments
29
29
  * @param storageSlot - The storage slot of the note
30
30
  * @param noteNonce - The nonce injected into the note hash preimage by kernels.
31
- * @param index - Optional index in the note hash tree. If undefined, indicates a transient note
31
+ * @param isPending - True if the note is pending, false if settled
32
32
  * @param note - The note content containing the actual note data
33
33
  * @returns The packed note as an array of field elements
34
34
  */
@@ -38,7 +38,7 @@ export function packAsRetrievedNote({
38
38
  randomness,
39
39
  storageSlot,
40
40
  noteNonce,
41
- index,
41
+ isPending,
42
42
  note,
43
43
  }: {
44
44
  contractAddress: AztecAddress;
@@ -46,14 +46,14 @@ export function packAsRetrievedNote({
46
46
  randomness: Fr;
47
47
  storageSlot: Fr;
48
48
  noteNonce: Fr;
49
- index?: bigint;
49
+ isPending: boolean;
50
50
  note: Note;
51
51
  }) {
52
- // If index is undefined, the note is transient which implies that the nonzero_note_hash_counter has to be true
53
- const nonzeroNoteHashCounter = index === undefined;
52
+ // If the note is pending it means it has a non-zero note hash counter associated with it.
53
+ const nonZeroNoteHashCounter = isPending;
54
54
 
55
55
  // To pack the note as retrieved note we first need to reconstruct the note metadata.
56
- const noteMetadata = fromRawData(nonzeroNoteHashCounter, noteNonce);
56
+ const noteMetadata = fromRawData(nonZeroNoteHashCounter, noteNonce);
57
57
 
58
58
  // Pack in order: note, contract_address, owner, randomness, storage_slot, metadata (stage, maybe_note_nonce)
59
59
  return [
@@ -286,7 +286,7 @@ export class Oracle {
286
286
  randomness: noteData.randomness,
287
287
  storageSlot: noteData.storageSlot,
288
288
  noteNonce: noteData.noteNonce,
289
- index: noteData.index,
289
+ isPending: noteData.isPending,
290
290
  note: noteData.note,
291
291
  }),
292
292
  );
@@ -85,7 +85,6 @@ export async function executePrivateFunction(
85
85
 
86
86
  const rawReturnValues = await privateExecutionOracle.privateLoadFromExecutionCache(publicInputs.returnsHash);
87
87
 
88
- const noteHashLeafIndexMap = privateExecutionOracle.getNoteHashLeafIndexMap();
89
88
  const newNotes = privateExecutionOracle.getNewNotes();
90
89
  const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
91
90
  const offchainEffects = privateExecutionOracle.getOffchainEffects();
@@ -108,7 +107,6 @@ export async function executePrivateFunction(
108
107
  Buffer.from(artifact.verificationKey!, 'base64'),
109
108
  partialWitness,
110
109
  publicInputs,
111
- noteHashLeafIndexMap,
112
110
  newNotes,
113
111
  noteHashNullifierCounterMap,
114
112
  rawReturnValues,
@@ -14,7 +14,7 @@ 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 { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
17
+ import { siloNullifier } from '@aztec/stdlib/hash';
18
18
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
19
19
  import { PrivateContextInputs } from '@aztec/stdlib/kernel';
20
20
  import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
@@ -64,16 +64,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
64
64
  * Users can also use this to get a clearer idea of what's happened during a simulation.
65
65
  */
66
66
  private newNotes: NoteAndSlot[] = [];
67
- /**
68
- * Notes from previous transactions that are returned to the oracle call `getNotes` during this execution.
69
- * The mapping maps from the unique siloed note hash to the index for notes created in private executions.
70
- * It maps from siloed note hash to the index for notes created by public functions.
71
- *
72
- * They are not part of the ExecutionNoteCache and being forwarded to nested contexts via `extend()`
73
- * because these notes are meant to be maintained on a per-call basis
74
- * They should act as references for the read requests output by an app circuit via public inputs.
75
- */
76
- private noteHashLeafIndexMap: Map<bigint, bigint> = new Map();
77
67
  private noteHashNullifierCounterMap: Map<number, number> = new Map();
78
68
  private contractClassLogs: CountedContractClassLog[] = [];
79
69
  private offchainEffects: { data: Fr[] }[] = [];
@@ -162,14 +152,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
162
152
  return toACVMWitness(0, fields);
163
153
  }
164
154
 
165
- /**
166
- * The KernelProver will use this to fully populate witnesses and provide hints to the kernel circuit
167
- * regarding which note hash each settled read request corresponds to.
168
- */
169
- public getNoteHashLeafIndexMap() {
170
- return this.noteHashLeafIndexMap;
171
- }
172
-
173
155
  /**
174
156
  * Get the data for the newly created notes.
175
157
  */
@@ -404,23 +386,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
404
386
  .join(', ')}`,
405
387
  );
406
388
 
407
- const noteHashesAndIndexes = await Promise.all(
408
- notes.map(async n => {
409
- if (n.index !== undefined) {
410
- const siloedNoteHash = await siloNoteHash(n.contractAddress, n.noteHash);
411
- const uniqueNoteHash = await computeUniqueNoteHash(n.noteNonce, siloedNoteHash);
412
-
413
- return { hash: uniqueNoteHash, index: n.index };
414
- }
415
- }),
416
- );
417
-
418
- noteHashesAndIndexes
419
- .filter(n => n !== undefined)
420
- .forEach(n => {
421
- this.noteHashLeafIndexMap.set(n!.hash.toBigInt(), n!.index);
422
- });
423
-
424
389
  return notes;
425
390
  }
426
391
 
@@ -463,6 +428,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
463
428
  note,
464
429
  siloedNullifier: undefined, // Siloed nullifier cannot be known for newly created note.
465
430
  noteHash,
431
+ isPending: true, // This note has just been created and hence is not settled yet.
466
432
  },
467
433
  counter,
468
434
  );