@aztec/pxe 0.0.1-commit.e6bd8901 → 0.0.1-commit.ec5f612

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 (205) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +11 -5
  7. package/dest/config/package_info.js +1 -1
  8. package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -30
  9. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/contract_function_simulator.js +174 -70
  11. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  12. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  15. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  16. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  18. package/dest/contract_function_simulator/oracle/interfaces.d.ts +10 -10
  19. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  20. package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -5
  21. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/oracle.js +38 -26
  23. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +36 -36
  24. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +74 -31
  26. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +53 -29
  27. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +84 -63
  29. package/dest/contract_logging.d.ts +22 -0
  30. package/dest/contract_logging.d.ts.map +1 -0
  31. package/dest/contract_logging.js +23 -0
  32. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  33. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  34. package/dest/contract_sync/contract_sync_service.js +97 -0
  35. package/dest/contract_sync/helpers.d.ts +29 -0
  36. package/dest/contract_sync/helpers.d.ts.map +1 -0
  37. package/dest/contract_sync/{index.js → helpers.js} +14 -15
  38. package/dest/debug/pxe_debug_utils.d.ts +24 -10
  39. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  40. package/dest/debug/pxe_debug_utils.js +28 -18
  41. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  42. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  43. package/dest/entrypoints/client/bundle/index.js +3 -0
  44. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  45. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  46. package/dest/entrypoints/client/bundle/utils.js +21 -7
  47. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  48. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  49. package/dest/entrypoints/client/lazy/index.js +3 -0
  50. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  51. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  52. package/dest/entrypoints/client/lazy/utils.js +22 -8
  53. package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
  54. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  55. package/dest/entrypoints/server/index.d.ts +4 -2
  56. package/dest/entrypoints/server/index.d.ts.map +1 -1
  57. package/dest/entrypoints/server/index.js +3 -1
  58. package/dest/entrypoints/server/utils.d.ts +1 -1
  59. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  60. package/dest/entrypoints/server/utils.js +28 -9
  61. package/dest/events/event_service.d.ts +4 -5
  62. package/dest/events/event_service.d.ts.map +1 -1
  63. package/dest/events/event_service.js +5 -6
  64. package/dest/job_coordinator/job_coordinator.d.ts +3 -2
  65. package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
  66. package/dest/job_coordinator/job_coordinator.js +3 -2
  67. package/dest/logs/log_service.d.ts +7 -5
  68. package/dest/logs/log_service.d.ts.map +1 -1
  69. package/dest/logs/log_service.js +19 -30
  70. package/dest/notes/note_service.d.ts +7 -7
  71. package/dest/notes/note_service.d.ts.map +1 -1
  72. package/dest/notes/note_service.js +9 -10
  73. package/dest/notes_filter.d.ts +25 -0
  74. package/dest/notes_filter.d.ts.map +1 -0
  75. package/dest/notes_filter.js +4 -0
  76. package/dest/oracle_version.d.ts +3 -3
  77. package/dest/oracle_version.d.ts.map +1 -1
  78. package/dest/oracle_version.js +2 -2
  79. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  80. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  81. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  82. package/dest/private_kernel/hints/index.d.ts +1 -1
  83. package/dest/private_kernel/hints/index.js +1 -1
  84. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  85. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  86. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
  87. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  88. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  89. package/dest/private_kernel/hints/test_utils.js +203 -0
  90. package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
  91. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  92. package/dest/private_kernel/private_kernel_execution_prover.js +21 -13
  93. package/dest/private_kernel/private_kernel_oracle.d.ts +8 -4
  94. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  95. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  96. package/dest/pxe.d.ts +69 -23
  97. package/dest/pxe.d.ts.map +1 -1
  98. package/dest/pxe.js +99 -65
  99. package/dest/storage/address_store/address_store.d.ts +1 -1
  100. package/dest/storage/address_store/address_store.d.ts.map +1 -1
  101. package/dest/storage/address_store/address_store.js +12 -11
  102. package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
  103. package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
  104. package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
  105. package/dest/storage/capsule_store/capsule_store.js +6 -8
  106. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  107. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  108. package/dest/storage/contract_store/contract_store.js +157 -72
  109. package/dest/storage/metadata.d.ts +1 -1
  110. package/dest/storage/metadata.js +1 -1
  111. package/dest/storage/note_store/note_store.d.ts +13 -3
  112. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  113. package/dest/storage/note_store/note_store.js +147 -107
  114. package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
  115. package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
  116. package/dest/storage/private_event_store/private_event_store.js +84 -61
  117. package/dest/storage/private_event_store/stored_private_event.d.ts +4 -4
  118. package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -1
  119. package/dest/storage/private_event_store/stored_private_event.js +2 -2
  120. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  121. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  122. package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
  123. package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
  124. package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
  125. package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
  126. package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
  127. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  128. package/dest/storage/tagging_store/sender_tagging_store.js +184 -114
  129. package/dest/tagging/get_all_logs_by_tags.d.ts +4 -4
  130. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  131. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  132. package/dest/tagging/index.d.ts +2 -2
  133. package/dest/tagging/index.d.ts.map +1 -1
  134. package/dest/tagging/index.js +1 -1
  135. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +5 -6
  136. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  137. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  138. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  139. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -8
  140. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  141. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  142. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -9
  143. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  144. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
  145. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -8
  146. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  147. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
  148. package/package.json +25 -16
  149. package/src/access_scopes.ts +9 -0
  150. package/src/block_synchronizer/block_synchronizer.ts +23 -19
  151. package/src/config/package_info.ts +1 -1
  152. package/src/contract_function_simulator/contract_function_simulator.ts +323 -128
  153. package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
  154. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  155. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  156. package/src/contract_function_simulator/oracle/interfaces.ts +12 -12
  157. package/src/contract_function_simulator/oracle/oracle.ts +41 -24
  158. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +101 -113
  159. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +139 -70
  160. package/src/contract_logging.ts +39 -0
  161. package/src/contract_sync/contract_sync_service.ts +152 -0
  162. package/src/contract_sync/{index.ts → helpers.ts} +22 -24
  163. package/src/debug/pxe_debug_utils.ts +63 -19
  164. package/src/entrypoints/client/bundle/index.ts +3 -0
  165. package/src/entrypoints/client/bundle/utils.ts +16 -15
  166. package/src/entrypoints/client/lazy/index.ts +3 -0
  167. package/src/entrypoints/client/lazy/utils.ts +17 -15
  168. package/src/entrypoints/pxe_creation_options.ts +2 -1
  169. package/src/entrypoints/server/index.ts +3 -1
  170. package/src/entrypoints/server/utils.ts +22 -26
  171. package/src/events/event_service.ts +4 -6
  172. package/src/job_coordinator/job_coordinator.ts +4 -3
  173. package/src/logs/log_service.ts +31 -39
  174. package/src/notes/note_service.ts +9 -11
  175. package/src/notes_filter.ts +26 -0
  176. package/src/oracle_version.ts +2 -2
  177. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  178. package/src/private_kernel/hints/index.ts +1 -1
  179. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
  180. package/src/private_kernel/hints/test_utils.ts +325 -0
  181. package/src/private_kernel/private_kernel_execution_prover.ts +25 -15
  182. package/src/private_kernel/private_kernel_oracle.ts +9 -9
  183. package/src/pxe.ts +192 -117
  184. package/src/storage/address_store/address_store.ts +15 -15
  185. package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
  186. package/src/storage/capsule_store/capsule_store.ts +8 -8
  187. package/src/storage/contract_store/contract_store.ts +186 -76
  188. package/src/storage/metadata.ts +1 -1
  189. package/src/storage/note_store/note_store.ts +169 -132
  190. package/src/storage/private_event_store/private_event_store.ts +102 -81
  191. package/src/storage/private_event_store/stored_private_event.ts +3 -3
  192. package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
  193. package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
  194. package/src/storage/tagging_store/sender_tagging_store.ts +214 -130
  195. package/src/tagging/get_all_logs_by_tags.ts +31 -7
  196. package/src/tagging/index.ts +1 -1
  197. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +9 -12
  198. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  199. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +12 -17
  200. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +6 -11
  201. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +14 -23
  202. package/dest/contract_sync/index.d.ts +0 -23
  203. package/dest/contract_sync/index.d.ts.map +0 -1
  204. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  205. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
@@ -1,8 +1,14 @@
1
- import { randomBytes } from '@aztec/foundation/crypto/random';
2
- import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
1
+ import type { FunctionCall } from '@aztec/stdlib/abi';
2
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
+ import type { NoteDao } from '@aztec/stdlib/note';
4
+ import type { ContractOverrides } from '@aztec/stdlib/tx';
3
5
 
4
- import type { PXE } from '../pxe.js';
5
- import type { ContractStore } from '../storage/contract_store/contract_store.js';
6
+ import type { AccessScopes } from '../access_scopes.js';
7
+ import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
8
+ import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
9
+ import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
10
+ import type { NotesFilter } from '../notes_filter.js';
11
+ import type { AnchorBlockStore } from '../storage/index.js';
6
12
  import type { NoteStore } from '../storage/note_store/note_store.js';
7
13
 
8
14
  /**
@@ -10,18 +16,38 @@ import type { NoteStore } from '../storage/note_store/note_store.js';
10
16
  * No backwards compatibility or API stability should be expected. Use at your own risk.
11
17
  */
12
18
  export class PXEDebugUtils {
13
- #pxe: PXE | undefined = undefined;
19
+ #putJobInQueue!: <T>(job: (jobId: string) => Promise<T>) => Promise<T>;
20
+ #getSimulatorForTx!: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator;
21
+ #executeUtility!: (
22
+ contractFunctionSimulator: ContractFunctionSimulator,
23
+ call: FunctionCall,
24
+ authWitnesses: AuthWitness[] | undefined,
25
+ scopes: AccessScopes,
26
+ jobId: string,
27
+ ) => Promise<any>;
14
28
 
15
29
  constructor(
16
- private contractStore: ContractStore,
30
+ private contractSyncService: ContractSyncService,
17
31
  private noteStore: NoteStore,
32
+ private blockStateSynchronizer: BlockSynchronizer,
33
+ private anchorBlockStore: AnchorBlockStore,
18
34
  ) {}
19
35
 
20
- /**
21
- * Not injected through constructor since they're are co-dependant.
22
- */
23
- public setPXE(pxe: PXE) {
24
- this.#pxe = pxe;
36
+ /** Not injected through constructor since they're are co-dependant */
37
+ public setPXEHelpers(
38
+ putJobInQueue: <T>(job: (jobId: string) => Promise<T>) => Promise<T>,
39
+ getSimulatorForTx: (overrides?: { contracts?: ContractOverrides }) => ContractFunctionSimulator,
40
+ executeUtility: (
41
+ contractFunctionSimulator: ContractFunctionSimulator,
42
+ call: FunctionCall,
43
+ authWitnesses: AuthWitness[] | undefined,
44
+ scopes: AccessScopes,
45
+ jobId: string,
46
+ ) => Promise<any>,
47
+ ) {
48
+ this.#putJobInQueue = putJobInQueue;
49
+ this.#getSimulatorForTx = getSimulatorForTx;
50
+ this.#executeUtility = executeUtility;
25
51
  }
26
52
 
27
53
  /**
@@ -35,15 +61,33 @@ export class PXEDebugUtils {
35
61
  * @param filter - The filter to apply to the notes.
36
62
  * @returns The requested notes.
37
63
  */
38
- public async getNotes(filter: NotesFilter): Promise<NoteDao[]> {
39
- if (!this.#pxe) {
40
- throw new Error('Cannot getNotes because no PXE is set');
41
- }
64
+ public getNotes(filter: NotesFilter): Promise<NoteDao[]> {
65
+ return this.#putJobInQueue(async (jobId: string) => {
66
+ await this.blockStateSynchronizer.sync();
67
+
68
+ const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
69
+
70
+ const contractFunctionSimulator = this.#getSimulatorForTx();
42
71
 
43
- // We need to manually trigger private state sync to have a guarantee that all the notes are available.
44
- const call = await this.contractStore.getFunctionCall('sync_state', [], filter.contractAddress);
45
- await this.#pxe.simulateUtility(call);
72
+ await this.contractSyncService.ensureContractSynced(
73
+ filter.contractAddress,
74
+ null,
75
+ async (privateSyncCall, execScopes) =>
76
+ await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
77
+ anchorBlockHeader,
78
+ jobId,
79
+ filter.scopes,
80
+ );
46
81
 
47
- return this.noteStore.getNotes(filter, randomBytes(8).toString('hex'));
82
+ return this.noteStore.getNotes(filter, jobId);
83
+ });
84
+ }
85
+
86
+ /**
87
+ * Triggers a sync of the PXE with the node.
88
+ * Blocks until the sync is complete.
89
+ */
90
+ public sync(): Promise<void> {
91
+ return this.#putJobInQueue(() => this.blockStateSynchronizer.sync());
48
92
  }
49
93
  }
@@ -1,6 +1,9 @@
1
+ export * from '../../../access_scopes.js';
2
+ export * from '../../../notes_filter.js';
1
3
  export * from '../../../pxe.js';
2
4
  export * from '../../../config/index.js';
3
5
  export * from '../../../error_enriching.js';
6
+ export * from '../../../contract_logging.js';
4
7
  export * from '../../../storage/index.js';
5
8
  export * from './utils.js';
6
9
  export type { PXECreationOptions } from '../../pxe_creation_options.js';
@@ -1,6 +1,5 @@
1
1
  import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
2
2
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
3
- import { randomBytes } from '@aztec/foundation/crypto/random';
4
3
  import { createLogger } from '@aztec/foundation/log';
5
4
  import { createStore } from '@aztec/kv-store/indexeddb';
6
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
@@ -9,6 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
9
8
 
10
9
  import type { PXEConfig } from '../../../config/index.js';
11
10
  import { PXE } from '../../../pxe.js';
11
+ import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
12
12
  import type { PXECreationOptions } from '../../pxe_creation_options.js';
13
13
 
14
14
  /**
@@ -26,13 +26,7 @@ export async function createPXE(
26
26
  config: PXEConfig,
27
27
  options: PXECreationOptions = { loggers: {} },
28
28
  ) {
29
- const logSuffix =
30
- typeof options.useLogSuffix === 'boolean'
31
- ? options.useLogSuffix
32
- ? randomBytes(3).toString('hex')
33
- : undefined
34
- : options.useLogSuffix;
35
-
29
+ const actor = options.loggerActorLabel;
36
30
  const loggers = options.loggers ?? {};
37
31
 
38
32
  const l1Contracts = await aztecNode.getL1ContractAddresses();
@@ -41,14 +35,13 @@ export async function createPXE(
41
35
  l1Contracts,
42
36
  } as PXEConfig;
43
37
 
44
- const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
38
+ const storeLogger = loggers.store ?? createLogger('pxe:data:idb', { actor });
45
39
 
46
- const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
40
+ const store =
41
+ options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
47
42
 
48
43
  const simulator = options.simulator ?? new WASMSimulator();
49
- const proverLogger = loggers.prover
50
- ? loggers.prover
51
- : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
44
+ const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
52
45
 
53
46
  let prover;
54
47
  if (options.proverOrOptions instanceof BBPrivateKernelProver) {
@@ -58,7 +51,15 @@ export async function createPXE(
58
51
  }
59
52
  const protocolContractsProvider = new BundledProtocolContractsProvider();
60
53
 
61
- const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
62
- const pxe = await PXE.create(aztecNode, store, prover, simulator, protocolContractsProvider, config, pxeLogger);
54
+ const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
55
+ const pxe = await PXE.create({
56
+ node: aztecNode,
57
+ store,
58
+ proofCreator: prover,
59
+ simulator,
60
+ protocolContractsProvider,
61
+ config,
62
+ loggerOrSuffix: pxeLogger,
63
+ });
63
64
  return pxe;
64
65
  }
@@ -1,6 +1,9 @@
1
+ export * from '../../../access_scopes.js';
2
+ export * from '../../../notes_filter.js';
1
3
  export * from '../../../pxe.js';
2
4
  export * from '../../../config/index.js';
3
5
  export * from '../../../storage/index.js';
4
6
  export * from '../../../error_enriching.js';
7
+ export * from '../../../contract_logging.js';
5
8
  export * from './utils.js';
6
9
  export { type PXECreationOptions } from '../../pxe_creation_options.js';
@@ -1,6 +1,5 @@
1
1
  import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
2
2
  import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
3
- import { randomBytes } from '@aztec/foundation/crypto/random';
4
3
  import { createLogger } from '@aztec/foundation/log';
5
4
  import { createStore } from '@aztec/kv-store/indexeddb';
6
5
  import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
@@ -9,6 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
9
8
 
10
9
  import type { PXEConfig } from '../../../config/index.js';
11
10
  import { PXE } from '../../../pxe.js';
11
+ import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
12
12
  import type { PXECreationOptions } from '../../pxe_creation_options.js';
13
13
 
14
14
  /**
@@ -17,7 +17,7 @@ import type { PXECreationOptions } from '../../pxe_creation_options.js';
17
17
  *
18
18
  * @param aztecNode - The AztecNode instance to be used by the server.
19
19
  * @param config - The PXE Config to use
20
- * @param
20
+ * @param options - (Optional) Optional information for creating an PXE.
21
21
  * @returns A Promise that resolves to the started PXE instance.
22
22
  */
23
23
  export async function createPXE(
@@ -25,12 +25,7 @@ export async function createPXE(
25
25
  config: PXEConfig,
26
26
  options: PXECreationOptions = { loggers: {} },
27
27
  ) {
28
- const logSuffix =
29
- typeof options.useLogSuffix === 'boolean'
30
- ? options.useLogSuffix
31
- ? randomBytes(3).toString('hex')
32
- : undefined
33
- : options.useLogSuffix;
28
+ const actor = options.loggerActorLabel;
34
29
 
35
30
  const l1Contracts = await aztecNode.getL1ContractAddresses();
36
31
  const configWithContracts = {
@@ -40,14 +35,13 @@ export async function createPXE(
40
35
 
41
36
  const loggers = options.loggers ?? {};
42
37
 
43
- const storeLogger = loggers.store ? loggers.store : createLogger('pxe:data:idb' + (logSuffix ? `:${logSuffix}` : ''));
38
+ const storeLogger = loggers.store ?? createLogger('pxe:data:idb', { actor });
44
39
 
45
- const store = options.store ?? (await createStore('pxe_data', configWithContracts, storeLogger));
40
+ const store =
41
+ options.store ?? (await createStore('pxe_data', configWithContracts, PXE_DATA_SCHEMA_VERSION, storeLogger));
46
42
 
47
43
  const simulator = options.simulator ?? new WASMSimulator();
48
- const proverLogger = loggers.prover
49
- ? loggers.prover
50
- : createLogger('pxe:bb:wasm:bundle' + (logSuffix ? `:${logSuffix}` : ''));
44
+ const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
51
45
 
52
46
  let prover;
53
47
  if (options.proverOrOptions instanceof BBPrivateKernelProver) {
@@ -57,7 +51,15 @@ export async function createPXE(
57
51
  }
58
52
  const protocolContractsProvider = new LazyProtocolContractsProvider();
59
53
 
60
- const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
61
- const pxe = await PXE.create(aztecNode, store, prover, simulator, protocolContractsProvider, config, pxeLogger);
54
+ const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
55
+ const pxe = await PXE.create({
56
+ node: aztecNode,
57
+ store,
58
+ proofCreator: prover,
59
+ simulator,
60
+ protocolContractsProvider,
61
+ config,
62
+ loggerOrSuffix: pxeLogger,
63
+ });
62
64
  return pxe;
63
65
  }
@@ -6,7 +6,8 @@ import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
6
6
 
7
7
  export type PXECreationOptions = {
8
8
  loggers?: { store?: Logger; pxe?: Logger; prover?: Logger };
9
- useLogSuffix?: boolean | string;
9
+ /** Actor label to include in log output (e.g., 'pxe-0', 'pxe-test'). */
10
+ loggerActorLabel?: string;
10
11
  proverOrOptions?: PrivateKernelProver | BBPrivateKernelProverOptions;
11
12
  store?: AztecAsyncKVStore;
12
13
  simulator?: CircuitSimulator;
@@ -1,3 +1,5 @@
1
+ export * from '../../access_scopes.js';
2
+ export * from '../../notes_filter.js';
1
3
  export * from '../../pxe.js';
2
4
  export * from '../../config/index.js';
3
5
  export * from '../../error_enriching.js';
@@ -7,4 +9,4 @@ export { NoteService } from '../../notes/note_service.js';
7
9
  export { ORACLE_VERSION } from '../../oracle_version.js';
8
10
  export { type PXECreationOptions } from '../pxe_creation_options.js';
9
11
  export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
10
- export { syncState } from '../../contract_sync/index.js';
12
+ export { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
@@ -1,6 +1,5 @@
1
1
  import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
2
2
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
3
- import { randomBytes } from '@aztec/foundation/crypto/random';
4
3
  import { createLogger } from '@aztec/foundation/log';
5
4
  import { createStore } from '@aztec/kv-store/lmdb-v2';
6
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
@@ -20,17 +19,13 @@ export async function createPXE(
20
19
  config: PXEConfigWithoutDefaults,
21
20
  options: PXECreationOptions = { loggers: {} },
22
21
  ) {
22
+ const actor = options.loggerActorLabel;
23
+ const recorderLogger = createLogger('simulator:acvm:recording', { actor });
23
24
  const recorder = process.env.CIRCUIT_RECORD_DIR
24
- ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
25
- : new MemoryCircuitRecorder();
26
- const simulator = new SimulatorRecorderWrapper(new WASMSimulator(), recorder);
27
-
28
- const logSuffix =
29
- typeof options.useLogSuffix === 'boolean'
30
- ? options.useLogSuffix
31
- ? randomBytes(3).toString('hex')
32
- : undefined
33
- : options.useLogSuffix;
25
+ ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR, recorderLogger)
26
+ : new MemoryCircuitRecorder(recorderLogger);
27
+ const simulatorLogger = createLogger('wasm-simulator', { actor });
28
+ const simulator = new SimulatorRecorderWrapper(new WASMSimulator(simulatorLogger), recorder);
34
29
  const loggers = options.loggers ?? {};
35
30
 
36
31
  const { l1ChainId, l1ContractAddresses: l1Contracts, rollupVersion } = await aztecNode.getNodeInfo();
@@ -43,14 +38,15 @@ export async function createPXE(
43
38
  };
44
39
 
45
40
  if (!options.store) {
46
- const storeLogger = loggers.store
47
- ? loggers.store
48
- : createLogger('pxe:data:lmdb' + (logSuffix ? `:${logSuffix}` : ''));
49
- options.store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, storeLogger);
41
+ const storeLogger = loggers.store ?? createLogger('pxe:data:lmdb', { actor });
42
+ options.store = await createStore(
43
+ 'pxe_data',
44
+ PXE_DATA_SCHEMA_VERSION,
45
+ configWithContracts,
46
+ storeLogger.getBindings(),
47
+ );
50
48
  }
51
- const proverLogger = loggers.prover
52
- ? loggers.prover
53
- : createLogger('pxe:bb:native' + (logSuffix ? `:${logSuffix}` : ''));
49
+ const proverLogger = loggers.prover ?? createLogger('pxe:bb:native', { actor });
54
50
 
55
51
  let prover;
56
52
  if (options.proverOrOptions instanceof BBPrivateKernelProver) {
@@ -61,15 +57,15 @@ export async function createPXE(
61
57
 
62
58
  const protocolContractsProvider = new BundledProtocolContractsProvider();
63
59
 
64
- const pxeLogger = loggers.pxe ? loggers.pxe : createLogger('pxe:service' + (logSuffix ? `:${logSuffix}` : ''));
65
- const pxe = await PXE.create(
66
- aztecNode,
67
- options.store,
68
- prover,
60
+ const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
61
+ const pxe = await PXE.create({
62
+ node: aztecNode,
63
+ store: options.store,
64
+ proofCreator: prover,
69
65
  simulator,
70
66
  protocolContractsProvider,
71
- configWithContracts,
72
- pxeLogger,
73
- );
67
+ config: configWithContracts,
68
+ loggerOrSuffix: pxeLogger,
69
+ });
74
70
  return pxe;
75
71
  }
@@ -3,14 +3,13 @@ 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 type { TxHash } from '@aztec/stdlib/tx';
6
+ import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
7
7
 
8
- import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
9
8
  import { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
10
9
 
11
10
  export class EventService {
12
11
  constructor(
13
- private readonly anchorBlockStore: AnchorBlockStore,
12
+ private readonly anchorBlockHeader: BlockHeader,
14
13
  private readonly aztecNode: AztecNode,
15
14
  private readonly privateEventStore: PrivateEventStore,
16
15
  private readonly jobId: string,
@@ -29,13 +28,12 @@ export class EventService {
29
28
  // (and thus we're less concerned about being ahead of the synced block), we use the synced block number to
30
29
  // maintain consistent behavior in the PXE. Additionally, events should never be ahead of the synced block here
31
30
  // since `fetchTaggedLogs` only processes logs up to the synced block.
32
- const [anchorBlockHeader, siloedEventCommitment, txEffect] = await Promise.all([
33
- this.anchorBlockStore.getBlockHeader(),
31
+ const [siloedEventCommitment, txEffect] = await Promise.all([
34
32
  siloNullifier(contractAddress, eventCommitment),
35
33
  this.aztecNode.getTxEffect(txHash),
36
34
  ]);
37
35
 
38
- const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
36
+ const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
39
37
 
40
38
  if (!txEffect) {
41
39
  throw new Error(`Could not find tx effect for tx hash ${txHash}`);
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from '@aztec/foundation/crypto/random';
2
- import { createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
4
4
 
5
5
  /**
@@ -40,7 +40,7 @@ export interface StagedStore {
40
40
  * using a job queue with concurrency=1.
41
41
  */
42
42
  export class JobCoordinator {
43
- private readonly log = createLogger('pxe:job_coordinator');
43
+ private readonly log: Logger;
44
44
 
45
45
  /** The underlying KV store */
46
46
  kvStore: AztecAsyncKVStore;
@@ -48,8 +48,9 @@ export class JobCoordinator {
48
48
  #currentJobId: string | undefined;
49
49
  #stores: Map<string, StagedStore> = new Map();
50
50
 
51
- constructor(kvStore: AztecAsyncKVStore) {
51
+ constructor(kvStore: AztecAsyncKVStore, bindings?: LoggerBindings) {
52
52
  this.kvStore = kvStore;
53
+ this.log = createLogger('pxe:job_coordinator', bindings);
53
54
  }
54
55
 
55
56
  /**
@@ -1,16 +1,21 @@
1
1
  import type { Fr } from '@aztec/foundation/curves/bn254';
2
- import { createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
3
  import type { KeyStore } from '@aztec/key-store';
4
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- import { L2BlockHash } from '@aztec/stdlib/block';
6
- import type { CompleteAddress } from '@aztec/stdlib/contract';
7
5
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
8
- import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
9
-
6
+ import {
7
+ ExtendedDirectionalAppTaggingSecret,
8
+ PendingTaggedLog,
9
+ SiloedTag,
10
+ Tag,
11
+ TxScopedL2Log,
12
+ } from '@aztec/stdlib/logs';
13
+ import type { BlockHeader } from '@aztec/stdlib/tx';
14
+
15
+ import type { AccessScopes } from '../access_scopes.js';
10
16
  import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
11
17
  import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
12
18
  import { AddressStore } from '../storage/address_store/address_store.js';
13
- import { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
14
19
  import { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
15
20
  import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
16
21
  import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
@@ -21,25 +26,28 @@ import {
21
26
  } from '../tagging/index.js';
22
27
 
23
28
  export class LogService {
24
- private log = createLogger('log_service');
29
+ private log: Logger;
25
30
 
26
31
  constructor(
27
32
  private readonly aztecNode: AztecNode,
28
- private readonly anchorBlockStore: AnchorBlockStore,
33
+ private readonly anchorBlockHeader: BlockHeader,
29
34
  private readonly keyStore: KeyStore,
30
35
  private readonly capsuleStore: CapsuleStore,
31
36
  private readonly recipientTaggingStore: RecipientTaggingStore,
32
37
  private readonly senderAddressBookStore: SenderAddressBookStore,
33
38
  private readonly addressStore: AddressStore,
34
39
  private readonly jobId: string,
35
- ) {}
40
+ bindings?: LoggerBindings,
41
+ ) {
42
+ this.log = createLogger('pxe:log_service', bindings);
43
+ }
36
44
 
37
45
  public async bulkRetrieveLogs(logRetrievalRequests: LogRetrievalRequest[]): Promise<(LogRetrievalResponse | null)[]> {
38
46
  return await Promise.all(
39
47
  logRetrievalRequests.map(async request => {
40
48
  const [publicLog, privateLog] = await Promise.all([
41
49
  this.#getPublicLogByTag(request.tag, request.contractAddress),
42
- this.#getPrivateLogByTag(await SiloedTag.compute(request.tag, request.contractAddress)),
50
+ this.#getPrivateLogByTag(await SiloedTag.computeFromTagAndApp(request.tag, request.contractAddress)),
43
51
  ]);
44
52
 
45
53
  if (publicLog !== null && privateLog !== null) {
@@ -54,8 +62,7 @@ export class LogService {
54
62
  }
55
63
 
56
64
  async #getPublicLogByTag(tag: Tag, contractAddress: AztecAddress): Promise<LogRetrievalResponse | null> {
57
- const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
58
- const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
65
+ const anchorBlockHash = await this.anchorBlockHeader.hash();
59
66
  const allLogsPerTag = await getAllPublicLogsByTagsFromContract(
60
67
  this.aztecNode,
61
68
  contractAddress,
@@ -84,8 +91,7 @@ export class LogService {
84
91
  }
85
92
 
86
93
  async #getPrivateLogByTag(siloedTag: SiloedTag): Promise<LogRetrievalResponse | null> {
87
- const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
88
- const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
94
+ const anchorBlockHash = await this.anchorBlockHeader.hash();
89
95
  const allLogsPerTag = await getAllPrivateLogsByTags(this.aztecNode, [siloedTag], anchorBlockHash);
90
96
  const logsForTag = allLogsPerTag[0];
91
97
 
@@ -108,20 +114,15 @@ export class LogService {
108
114
  );
109
115
  }
110
116
 
111
- public async syncTaggedLogs(
112
- contractAddress: AztecAddress,
113
- pendingTaggedLogArrayBaseSlot: Fr,
114
- scopes?: AztecAddress[],
115
- ) {
116
- this.log.verbose('Searching for tagged logs', { contract: contractAddress });
117
+ public async fetchTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes: AccessScopes) {
118
+ this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
117
119
 
118
120
  // We only load logs from block up to and including the anchor block number
119
- const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
120
- const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
121
- const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
121
+ const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
122
+ const anchorBlockHash = await this.anchorBlockHeader.hash();
122
123
 
123
124
  // Determine recipients: use scopes if provided, otherwise get all accounts
124
- const recipients = scopes && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
125
+ const recipients = scopes !== 'ALL_SCOPES' && scopes.length > 0 ? scopes : await this.keyStore.getAccounts();
125
126
 
126
127
  // For each recipient, fetch secrets, load logs, and store them.
127
128
  // We run these per-recipient tasks in parallel so that logs are loaded for all recipients concurrently.
@@ -135,7 +136,6 @@ export class LogService {
135
136
  secrets.map(secret =>
136
137
  loadPrivateLogsForSenderRecipientPair(
137
138
  secret,
138
- contractAddress,
139
139
  this.aztecNode,
140
140
  this.recipientTaggingStore,
141
141
  anchorBlockNumber,
@@ -159,8 +159,11 @@ export class LogService {
159
159
  async #getSecretsForSenders(
160
160
  contractAddress: AztecAddress,
161
161
  recipient: AztecAddress,
162
- ): Promise<DirectionalAppTaggingSecret[]> {
163
- const recipientCompleteAddress = await this.#getCompleteAddress(recipient);
162
+ ): Promise<ExtendedDirectionalAppTaggingSecret[]> {
163
+ const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
164
+ if (!recipientCompleteAddress) {
165
+ return [];
166
+ }
164
167
  const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
165
168
 
166
169
  // We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
@@ -174,7 +177,7 @@ export class LogService {
174
177
 
175
178
  return Promise.all(
176
179
  deduplicatedSenders.map(sender => {
177
- return DirectionalAppTaggingSecret.compute(
180
+ return ExtendedDirectionalAppTaggingSecret.compute(
178
181
  recipientCompleteAddress,
179
182
  recipientIvsk,
180
183
  sender,
@@ -207,15 +210,4 @@ export class LogService {
207
210
  // TODO: This looks like it could belong more at the oracle interface level
208
211
  return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
209
212
  }
210
-
211
- async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
212
- const completeAddress = await this.addressStore.getCompleteAddress(account);
213
- if (!completeAddress) {
214
- throw new Error(
215
- `No public key registered for address ${account}.
216
- Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
217
- );
218
- }
219
- return completeAddress;
220
- }
221
213
  }
@@ -1,21 +1,20 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import type { DataInBlock } from '@aztec/stdlib/block';
4
- import { L2BlockHash } from '@aztec/stdlib/block';
5
4
  import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
6
5
  import { type AztecNode, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
7
6
  import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
8
7
  import { MerkleTreeId } from '@aztec/stdlib/trees';
9
- import type { TxHash } from '@aztec/stdlib/tx';
8
+ import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
10
9
 
11
- import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
10
+ import type { AccessScopes } from '../access_scopes.js';
12
11
  import type { NoteStore } from '../storage/note_store/note_store.js';
13
12
 
14
13
  export class NoteService {
15
14
  constructor(
16
15
  private readonly noteStore: NoteStore,
17
16
  private readonly aztecNode: AztecNode,
18
- private readonly anchorBlockStore: AnchorBlockStore,
17
+ private readonly anchorBlockHeader: BlockHeader,
19
18
  private readonly jobId: string,
20
19
  ) {}
21
20
 
@@ -33,7 +32,7 @@ export class NoteService {
33
32
  owner: AztecAddress | undefined,
34
33
  storageSlot: Fr,
35
34
  status: NoteStatus,
36
- scopes?: AztecAddress[],
35
+ scopes: AccessScopes,
37
36
  ) {
38
37
  const noteDaos = await this.noteStore.getNotes(
39
38
  {
@@ -72,10 +71,10 @@ export class NoteService {
72
71
  *
73
72
  * @param contractAddress - The contract whose notes should be checked and nullified.
74
73
  */
75
- public async syncNoteNullifiers(contractAddress: AztecAddress): Promise<void> {
76
- const anchorBlockHash = L2BlockHash.fromField(await (await this.anchorBlockStore.getBlockHeader()).hash());
74
+ public async syncNoteNullifiers(contractAddress: AztecAddress, scopes: AccessScopes): Promise<void> {
75
+ const anchorBlockHash = await this.anchorBlockHeader.hash();
77
76
 
78
- const contractNotes = await this.noteStore.getNotes({ contractAddress }, this.jobId);
77
+ const contractNotes = await this.noteStore.getNotes({ contractAddress, scopes }, this.jobId);
79
78
 
80
79
  if (contractNotes.length === 0) {
81
80
  return;
@@ -143,9 +142,8 @@ export class NoteService {
143
142
  // number which *should* be recent enough to be available, even for non-archive nodes.
144
143
  // Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
145
144
  // logs up to the synced block making this only an additional safety check.
146
- const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
147
- const anchorBlockNumber = anchorBlockHeader.getBlockNumber();
148
- const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
145
+ const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
146
+ const anchorBlockHash = await this.anchorBlockHeader.hash();
149
147
 
150
148
  // By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
151
149
  // of other contracts, which would constitute a security breach.