@aztec/pxe 4.0.0-devnet.1-patch.0 → 4.0.0-devnet.2-patch.0

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 (108) 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/contract_function_simulator/contract_function_simulator.d.ts +53 -29
  5. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/contract_function_simulator.js +169 -65
  7. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  8. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  9. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  10. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  11. package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -2
  12. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
  14. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/oracle/oracle.js +2 -2
  16. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +35 -36
  17. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +71 -18
  19. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +30 -12
  20. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +32 -29
  22. package/dest/contract_sync/contract_sync_service.d.ts +4 -2
  23. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  24. package/dest/contract_sync/contract_sync_service.js +34 -19
  25. package/dest/contract_sync/helpers.d.ts +3 -2
  26. package/dest/contract_sync/helpers.d.ts.map +1 -1
  27. package/dest/contract_sync/helpers.js +3 -3
  28. package/dest/debug/pxe_debug_utils.d.ts +5 -4
  29. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  30. package/dest/debug/pxe_debug_utils.js +1 -1
  31. package/dest/entrypoints/client/bundle/index.d.ts +3 -1
  32. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  33. package/dest/entrypoints/client/bundle/index.js +2 -0
  34. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  35. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  36. package/dest/entrypoints/client/bundle/utils.js +9 -1
  37. package/dest/entrypoints/client/lazy/index.d.ts +3 -1
  38. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  39. package/dest/entrypoints/client/lazy/index.js +2 -0
  40. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  41. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  42. package/dest/entrypoints/client/lazy/utils.js +9 -1
  43. package/dest/entrypoints/server/index.d.ts +3 -1
  44. package/dest/entrypoints/server/index.d.ts.map +1 -1
  45. package/dest/entrypoints/server/index.js +2 -0
  46. package/dest/entrypoints/server/utils.js +9 -1
  47. package/dest/logs/log_service.d.ts +3 -2
  48. package/dest/logs/log_service.d.ts.map +1 -1
  49. package/dest/logs/log_service.js +5 -10
  50. package/dest/notes/note_service.d.ts +4 -3
  51. package/dest/notes/note_service.d.ts.map +1 -1
  52. package/dest/notes/note_service.js +3 -2
  53. package/dest/notes_filter.d.ts +25 -0
  54. package/dest/notes_filter.d.ts.map +1 -0
  55. package/dest/notes_filter.js +4 -0
  56. package/dest/oracle_version.d.ts +2 -2
  57. package/dest/oracle_version.js +2 -2
  58. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  59. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  60. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  61. package/dest/private_kernel/hints/index.d.ts +1 -1
  62. package/dest/private_kernel/hints/index.js +1 -1
  63. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
  64. package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
  65. package/dest/pxe.d.ts +57 -22
  66. package/dest/pxe.d.ts.map +1 -1
  67. package/dest/pxe.js +42 -35
  68. package/dest/storage/note_store/note_store.d.ts +3 -3
  69. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  70. package/dest/storage/note_store/note_store.js +3 -4
  71. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  72. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  73. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  74. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
  75. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  76. package/package.json +16 -16
  77. package/src/access_scopes.ts +9 -0
  78. package/src/contract_function_simulator/contract_function_simulator.ts +317 -124
  79. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  80. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  81. package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
  82. package/src/contract_function_simulator/oracle/oracle.ts +2 -2
  83. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +92 -93
  84. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +69 -26
  85. package/src/contract_sync/contract_sync_service.ts +49 -26
  86. package/src/contract_sync/helpers.ts +7 -2
  87. package/src/debug/pxe_debug_utils.ts +8 -6
  88. package/src/entrypoints/client/bundle/index.ts +2 -0
  89. package/src/entrypoints/client/bundle/utils.ts +9 -1
  90. package/src/entrypoints/client/lazy/index.ts +2 -0
  91. package/src/entrypoints/client/lazy/utils.ts +9 -1
  92. package/src/entrypoints/server/index.ts +2 -0
  93. package/src/entrypoints/server/utils.ts +7 -7
  94. package/src/logs/log_service.ts +7 -19
  95. package/src/notes/note_service.ts +4 -3
  96. package/src/notes_filter.ts +26 -0
  97. package/src/oracle_version.ts +2 -2
  98. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  99. package/src/private_kernel/hints/index.ts +1 -1
  100. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
  101. package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
  102. package/src/pxe.ts +104 -74
  103. package/src/storage/note_store/note_store.ts +8 -5
  104. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  105. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
  106. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  107. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  108. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
package/dest/pxe.js CHANGED
@@ -84,11 +84,12 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
84
84
  * can be contacted.
85
85
  *
86
86
  * @returns A promise that resolves PXE is ready to be used.
87
- */ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
87
+ */ static async create({ node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix }) {
88
88
  // Extract bindings from the logger, or use empty bindings if a string suffix is provided.
89
89
  const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
90
90
  const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
91
- const proverEnabled = !!config.proverEnabled;
91
+ const info = await node.getNodeInfo();
92
+ const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
92
93
  const addressStore = new AddressStore(store);
93
94
  const privateEventStore = new PrivateEventStore(store);
94
95
  const contractStore = new ContractStore(store);
@@ -117,14 +118,26 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
117
118
  debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#simulateUtility.bind(pxe));
118
119
  pxe.jobQueue.start();
119
120
  await pxe.#registerProtocolContracts();
120
- const info = await node.getNodeInfo();
121
121
  log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
122
122
  return pxe;
123
123
  }
124
124
  // Internal methods
125
125
  #getSimulatorForTx(overrides) {
126
126
  const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
127
- return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, BenchmarkedNodeFactory.create(this.node), this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator, this.contractSyncService);
127
+ return new ContractFunctionSimulator({
128
+ contractStore: proxyContractStore,
129
+ noteStore: this.noteStore,
130
+ keyStore: this.keyStore,
131
+ addressStore: this.addressStore,
132
+ aztecNode: BenchmarkedNodeFactory.create(this.node),
133
+ senderTaggingStore: this.senderTaggingStore,
134
+ recipientTaggingStore: this.recipientTaggingStore,
135
+ senderAddressBookStore: this.senderAddressBookStore,
136
+ capsuleStore: this.capsuleStore,
137
+ privateEventStore: this.privateEventStore,
138
+ simulator: this.simulator,
139
+ contractSyncService: this.contractSyncService
140
+ });
128
141
  }
129
142
  #contextualizeError(err, ...context) {
130
143
  let contextStr = '';
@@ -180,10 +193,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
180
193
  const { origin: contractAddress, functionSelector } = txRequest;
181
194
  try {
182
195
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
183
- await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), anchorBlockHeader, jobId);
184
- const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
185
- // contract entrypoint
186
- undefined, scopes, jobId);
196
+ await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
197
+ const result = await contractFunctionSimulator.run(txRequest, {
198
+ contractAddress,
199
+ selector: functionSelector,
200
+ anchorBlockHeader,
201
+ scopes,
202
+ jobId
203
+ });
187
204
  this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
188
205
  return result;
189
206
  } catch (err) {
@@ -434,10 +451,11 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
434
451
  * (where validators prove the public portion).
435
452
  *
436
453
  * @param txRequest - An authenticated tx request ready for proving
454
+ * @param scopes - Addresses whose private state and keys are accessible during private execution.
437
455
  * @returns A result containing the proof and public inputs of the tail circuit.
438
456
  * @throws If contract code not found, or public simulation reverts.
439
457
  * Also throws if simulatePublic is true and public simulation reverts.
440
- */ proveTx(txRequest) {
458
+ */ proveTx(txRequest, scopes) {
441
459
  let privateExecutionResult;
442
460
  // We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
443
461
  // computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
@@ -448,7 +466,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
448
466
  await this.blockStateSynchronizer.sync();
449
467
  const syncTime = syncTimer.ms();
450
468
  const contractFunctionSimulator = this.#getSimulatorForTx();
451
- privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
469
+ privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
452
470
  const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
453
471
  simulate: false,
454
472
  skipFeeEnforcement: false,
@@ -498,13 +516,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
498
516
  }
499
517
  /**
500
518
  * Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
501
- *
502
- * @param txRequest - An authenticated tx request ready for simulation
503
- * @param msgSender - (Optional) The message sender to use for the simulation.
504
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
519
+ * @param txRequest - An authenticated tx request ready for simulation.
505
520
  * @returns A trace of the program execution with gate counts.
506
521
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
507
- */ profileTx(txRequest, profileMode, skipProofGeneration = true) {
522
+ */ profileTx(txRequest, { profileMode, skipProofGeneration = true, scopes }) {
508
523
  // We disable concurrent profiles for consistency with simulateTx.
509
524
  return this.#putInJobQueue(async (jobId)=>{
510
525
  const totalTimer = new Timer();
@@ -522,7 +537,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
522
537
  await this.blockStateSynchronizer.sync();
523
538
  const syncTime = syncTimer.ms();
524
539
  const contractFunctionSimulator = this.#getSimulatorForTx();
525
- const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
540
+ const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
526
541
  const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
527
542
  simulate: skipProofGeneration,
528
543
  skipFeeEnforcement: false,
@@ -567,18 +582,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
567
582
  * In that case, the transaction returned is only potentially ready to be sent to the network for execution.
568
583
  *
569
584
  *
570
- * @param txRequest - An authenticated tx request ready for simulation
571
- * @param simulatePublic - Whether to simulate the public part of the transaction.
572
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
573
- * @param skipFeeEnforcement - (Optional) If false, fees are enforced.
574
- * @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
575
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
585
+ * @param txRequest - An authenticated tx request ready for simulation.
576
586
  * @returns A simulated transaction result object that includes public and private return values.
577
587
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
578
588
  * Also throws if simulatePublic is true and public simulation reverts.
579
589
  *
580
590
  * TODO(#7456) Prevent msgSender being defined here for the first call
581
- */ simulateTx(txRequest, simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes) {
591
+ */ simulateTx(txRequest, { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }) {
582
592
  // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
583
593
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
584
594
  // delete the same read value, or reading values that another simulation is currently modifying).
@@ -613,7 +623,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
613
623
  let publicInputs;
614
624
  let executionSteps = [];
615
625
  if (skipKernels) {
616
- ({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel)));
626
+ ({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.node));
617
627
  } else {
618
628
  // Kernel logic, plus proving of all private functions and kernels.
619
629
  ({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
@@ -673,19 +683,16 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
673
683
  nodeRPCCalls: simulatorStats.nodeRPCCalls
674
684
  });
675
685
  } catch (err) {
676
- throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes?.map((s)=>s.toString()).join(', ') ?? 'undefined'}`);
686
+ throw this.#contextualizeError(err, inspect(txRequest), `simulatePublic=${simulatePublic}`, `skipTxValidation=${skipTxValidation}`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
677
687
  }
678
688
  });
679
689
  }
680
690
  /**
681
- * Simulate the execution of a contract utility function.
682
- *
691
+ * Simulates the execution of a contract utility function.
683
692
  * @param call - The function call containing the function details, arguments, and target contract address.
684
- * @param authwits - (Optional) The authentication witnesses required for the function call.
685
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
686
- * default to all.
687
- * @returns The result of the utility function call, structured based on the function ABI.
688
- */ simulateUtility(call, authwits, scopes) {
693
+ */ simulateUtility(call, { authwits, scopes } = {
694
+ scopes: 'ALL_SCOPES'
695
+ }) {
689
696
  // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
690
697
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
691
698
  // delete the same read value, or reading values that another simulation is currently modifying).
@@ -698,7 +705,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
698
705
  const functionTimer = new Timer();
699
706
  const contractFunctionSimulator = this.#getSimulatorForTx();
700
707
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
701
- await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), anchorBlockHeader, jobId);
708
+ await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
702
709
  const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
703
710
  const functionTime = functionTimer.ms();
704
711
  const totalTime = totalTimer.ms();
@@ -725,7 +732,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
725
732
  } catch (err) {
726
733
  const { to, name, args } = call;
727
734
  const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
728
- throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes?.map((s)=>s.toString()).join(', ') ?? 'undefined'}`);
735
+ throw this.#contextualizeError(err, `simulateUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
729
736
  }
730
737
  });
731
738
  }
@@ -748,7 +755,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
748
755
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
749
756
  anchorBlockNumber = anchorBlockHeader.getBlockNumber();
750
757
  const contractFunctionSimulator = this.#getSimulatorForTx();
751
- await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), anchorBlockHeader, jobId);
758
+ await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
752
759
  });
753
760
  // anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
754
761
  const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
@@ -2,8 +2,9 @@ import type { Fr } from '@aztec/foundation/schemas';
2
2
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { DataInBlock } from '@aztec/stdlib/block';
5
- import { NoteDao, type NotesFilter } from '@aztec/stdlib/note';
5
+ import { NoteDao } from '@aztec/stdlib/note';
6
6
  import type { StagedStore } from '../../job_coordinator/job_coordinator.js';
7
+ import type { NotesFilter } from '../../notes_filter.js';
7
8
  /**
8
9
  * NoteStore manages the storage and retrieval of notes.
9
10
  *
@@ -35,7 +36,6 @@ export declare class NoteStore implements StagedStore {
35
36
  * @params jobId - the job context to read from.
36
37
  * @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
37
38
  * returned once if this is the case)
38
- * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
39
39
  */
40
40
  getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]>;
41
41
  /**
@@ -80,4 +80,4 @@ export declare class NoteStore implements StagedStore {
80
80
  commit(jobId: string): Promise<void>;
81
81
  discardStaged(jobId: string): Promise<void>;
82
82
  }
83
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm90ZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2Uvbm90ZV9zdG9yZS9ub3RlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFxQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVGLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxPQUFPLEVBQWMsS0FBSyxXQUFXLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUUzRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUc1RTs7Ozs7SUFLSTtBQUNKLHFCQUFhLFNBQVUsWUFBVyxXQUFXOztJQUMzQyxRQUFRLENBQUMsU0FBUyxFQUFFLE1BQU0sQ0FBVTtJQStCcEMsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBUW5DO0lBRUQ7Ozs7Ozs7OztPQVNHO0lBQ0ksUUFBUSxDQUFDLEtBQUssRU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AO,CAAC,IAAI,EAAE,CAAC,CAarF;IAcD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAgG/D;IAED;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAyChF;IAED;;;;;;;;;;;OAWG;IACU,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpF;IA6ED;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1C;CAkCF"}
@@ -74,10 +74,9 @@ import { StoredNote } from './stored_note.js';
74
74
  * @params jobId - the job context to read from.
75
75
  * @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
76
76
  * returned once if this is the case)
77
- * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
78
77
  */ getNotes(filter, jobId) {
79
- if (filter.scopes !== undefined && filter.scopes.length === 0) {
80
- return Promise.reject(new Error('Trying to get notes with an empty scopes array'));
78
+ if (filter.scopes !== 'ALL_SCOPES' && filter.scopes.length === 0) {
79
+ return Promise.resolve([]);
81
80
  }
82
81
  return this.#store.transactionAsync(async ()=>{
83
82
  const targetStatus = filter.status ?? NoteStatus.ACTIVE;
@@ -136,7 +135,7 @@ import { StoredNote } from './stored_note.js';
136
135
  if (filter.siloedNullifier && !note.noteDao.siloedNullifier.equals(filter.siloedNullifier)) {
137
136
  continue;
138
137
  }
139
- if (filter.scopes && note.scopes.intersection(new Set(filter.scopes.map((s)=>s.toString()))).size === 0) {
138
+ if (filter.scopes !== 'ALL_SCOPES' && note.scopes.intersection(new Set(filter.scopes.map((s)=>s.toString()))).size === 0) {
140
139
  continue;
141
140
  }
142
141
  foundNotes.set(note.noteDao.siloedNullifier.toString(), note.noteDao);
@@ -21,4 +21,4 @@ export declare function getAllPrivateLogsByTags(aztecNode: AztecNode, tags: Silo
21
21
  * @returns An array of log arrays, one per tag, containing all logs across all pages.
22
22
  */
23
23
  export declare function getAllPublicLogsByTagsFromContract(aztecNode: AztecNode, contractAddress: AztecAddress, tags: Tag[], anchorBlockHash: BlockHash): Promise<TxScopedL2Log[][]>;
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2FsbF9sb2dzX2J5X3RhZ3MuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90YWdnaW5nL2dldF9hbGxfbG9nc19ieV90YWdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXJELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxHQUFHLEVBQUUsYUFBYSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUE2QnhFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBZ0IsdUJBQXVCLENBQ3JDLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLElBQUksRUFBRSxTQUFTLEVBQUUsRUFDakIsZUFBZSxFQUFFLFNBQVMsR0FDekIsT0FBTyxDQUFDLGFBQWEsRUFBRSxFQUFFLENBQUMsQ0FFNUI7QUFFRDs7Ozs7Ozs7R0FRRztBQUN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NYLGVBQWUsRUFBRSxTQUFTLEdBQ3pCLE9BQU8sQ0FBQyxhQUFhLEVBQUUsRUFBRSxDQUFDLENBTTVCIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"get_all_logs_by_tags.d.ts","sourceRoot":"","sources":["../../src/tagging/get_all_logs_by_tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA6BxE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EAAE,EACjB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAE5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAI5B"}
1
+ {"version":3,"file":"get_all_logs_by_tags.d.ts","sourceRoot":"","sources":["../../src/tagging/get_all_logs_by_tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAiDxE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,EAAE,EACjB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAI5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAM5B"}
@@ -1,4 +1,4 @@
1
- import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
1
+ import { MAX_LOGS_PER_TAG, MAX_RPC_LEN } from '@aztec/stdlib/interfaces/api-limit';
2
2
  /**
3
3
  * Generic pagination helper that fetches all pages of results.
4
4
  * @param numTags - The number of tags being queried (determines result array size).
@@ -23,6 +23,20 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
23
23
  }
24
24
  return allResultsPerTag;
25
25
  }
26
+ /**
27
+ * Splits tags into chunks of MAX_RPC_LEN, fetches logs for each chunk using getAllPages, then stitches the results
28
+ * back into a single array preserving the original tag order.
29
+ */ async function getAllPagesInBatches(tags, fetchAllPagesForBatch) {
30
+ if (tags.length <= MAX_RPC_LEN) {
31
+ return fetchAllPagesForBatch(tags);
32
+ }
33
+ const batches = [];
34
+ for(let i = 0; i < tags.length; i += MAX_RPC_LEN){
35
+ batches.push(tags.slice(i, i + MAX_RPC_LEN));
36
+ }
37
+ const batchResults = await Promise.all(batches.map(fetchAllPagesForBatch));
38
+ return batchResults.flat();
39
+ }
26
40
  /**
27
41
  * Fetches all private logs for the given tags, automatically paginating through all pages.
28
42
  * @param aztecNode - The Aztec node to query.
@@ -31,7 +45,7 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
31
45
  * because of reorgs).
32
46
  * @returns An array of log arrays, one per tag, containing all logs across all pages.
33
47
  */ export function getAllPrivateLogsByTags(aztecNode, tags, anchorBlockHash) {
34
- return getAllPages(tags.length, (page)=>aztecNode.getPrivateLogsByTags(tags, page, anchorBlockHash));
48
+ return getAllPagesInBatches(tags, (batch)=>getAllPages(batch.length, (page)=>aztecNode.getPrivateLogsByTags(batch, page, anchorBlockHash)));
35
49
  }
36
50
  /**
37
51
  * Fetches all public logs for the given tags from a contract, automatically paginating through all pages.
@@ -42,5 +56,5 @@ import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
42
56
  * because of reorgs).
43
57
  * @returns An array of log arrays, one per tag, containing all logs across all pages.
44
58
  */ export function getAllPublicLogsByTagsFromContract(aztecNode, contractAddress, tags, anchorBlockHash) {
45
- return getAllPages(tags.length, (page)=>aztecNode.getPublicLogsByTagsFromContract(contractAddress, tags, page, anchorBlockHash));
59
+ return getAllPagesInBatches(tags, (batch)=>getAllPages(batch.length, (page)=>aztecNode.getPublicLogsByTagsFromContract(contractAddress, batch, page, anchorBlockHash)));
46
60
  }
@@ -13,7 +13,7 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
13
13
  // (highestAgedIndex, highestFinalizedIndex + WINDOW_LEN]
14
14
  //
15
15
  // highestAgedIndex is the highest index that was used in a tx that is included in a block at least
16
- // `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds ago.
16
+ // `MAX_TX_LIFETIME` seconds ago.
17
17
  // highestFinalizedIndex is the highest index that was used in a tx that is included in a finalized block.
18
18
  //
19
19
  // "(" denotes an open end of the range - the index is not included in the range.
@@ -25,19 +25,19 @@ import { loadLogsForRange } from './utils/load_logs_for_range.js';
25
25
  // ever appear.
26
26
  //
27
27
  // This relies on the "maximum inclusion timestamp" rule enforced by the kernel and rollup circuits:
28
- // - a transaction's maximum inclusion timestamp is at most `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds after
28
+ // - a transaction's maximum inclusion timestamp is at most `MAX_TX_LIFETIME` seconds after
29
29
  // the timestamp of its anchor block; and
30
30
  // - a rollup only includes transactions whose inclusion timestamp is >= the L2 block's timestamp.
31
31
  //
32
32
  // Suppose some device used index `I` in a transaction anchored to block `B_N` at time `N`, and that block is now at
33
- // least `MAX_INCLUDE_BY_TIMESTAMP_DURATION` seconds in the past. Then there is no possibility of any *other* device
33
+ // least `MAX_TX_LIFETIME` seconds in the past. Then there is no possibility of any *other* device
34
34
  // trying to use an index <= `I` while anchoring to a *newer* block than `B_N` because if we were anchoring to
35
35
  // a newer block than `B_N` then we would already have seen the log with index `I` and hence the device would have
36
36
  // chosen a larger index.
37
37
  // If that *other* device would anchor to a block older than `B_N` then that tx could never be included in a block
38
38
  // because it would already have been expired.
39
39
  //
40
- // Therefore, once we see that index `I` has been used in a block that is at least `MAX_INCLUDE_BY_TIMESTAMP_DURATION`
40
+ // Therefore, once we see that index `I` has been used in a block that is at least `MAX_TX_LIFETIME`
41
41
  // seconds old, we can safely stop syncing logs for all indexes <= `I` and set highestAgedIndex = `I`.
42
42
  //
43
43
  // ## Explanation of the upper bound `highestFinalizedIndex + WINDOW_LEN`
@@ -1,4 +1,4 @@
1
- import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
1
+ import { MAX_TX_LIFETIME } from '@aztec/constants';
2
2
  /**
3
3
  * Finds the highest aged and the highest finalized tagging indexes.
4
4
  */ export function findHighestIndexes(privateLogsWithIndexes, currentTimestamp, finalizedBlockNumber) {
@@ -6,7 +6,7 @@ import { MAX_INCLUDE_BY_TIMESTAMP_DURATION } from '@aztec/constants';
6
6
  let highestFinalizedIndex = undefined;
7
7
  for (const { log, taggingIndex } of privateLogsWithIndexes){
8
8
  const ageInSeconds = currentTimestamp - log.blockTimestamp;
9
- if (ageInSeconds >= BigInt(MAX_INCLUDE_BY_TIMESTAMP_DURATION) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)) {
9
+ if (ageInSeconds >= BigInt(MAX_TX_LIFETIME) && (highestAgedIndex === undefined || taggingIndex > highestAgedIndex)) {
10
10
  highestAgedIndex = taggingIndex;
11
11
  }
12
12
  if (log.blockNumber <= finalizedBlockNumber && (highestFinalizedIndex === undefined || taggingIndex > highestFinalizedIndex)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "4.0.0-devnet.1-patch.0",
3
+ "version": "4.0.0-devnet.2-patch.0",
4
4
  "type": "module",
5
5
  "typedocOptions": {
6
6
  "entryPoints": [
@@ -70,19 +70,19 @@
70
70
  ]
71
71
  },
72
72
  "dependencies": {
73
- "@aztec/bb-prover": "4.0.0-devnet.1-patch.0",
74
- "@aztec/bb.js": "4.0.0-devnet.1-patch.0",
75
- "@aztec/builder": "4.0.0-devnet.1-patch.0",
76
- "@aztec/constants": "4.0.0-devnet.1-patch.0",
77
- "@aztec/ethereum": "4.0.0-devnet.1-patch.0",
78
- "@aztec/foundation": "4.0.0-devnet.1-patch.0",
79
- "@aztec/key-store": "4.0.0-devnet.1-patch.0",
80
- "@aztec/kv-store": "4.0.0-devnet.1-patch.0",
81
- "@aztec/noir-protocol-circuits-types": "4.0.0-devnet.1-patch.0",
82
- "@aztec/noir-types": "4.0.0-devnet.1-patch.0",
83
- "@aztec/protocol-contracts": "4.0.0-devnet.1-patch.0",
84
- "@aztec/simulator": "4.0.0-devnet.1-patch.0",
85
- "@aztec/stdlib": "4.0.0-devnet.1-patch.0",
73
+ "@aztec/bb-prover": "4.0.0-devnet.2-patch.0",
74
+ "@aztec/bb.js": "4.0.0-devnet.2-patch.0",
75
+ "@aztec/builder": "4.0.0-devnet.2-patch.0",
76
+ "@aztec/constants": "4.0.0-devnet.2-patch.0",
77
+ "@aztec/ethereum": "4.0.0-devnet.2-patch.0",
78
+ "@aztec/foundation": "4.0.0-devnet.2-patch.0",
79
+ "@aztec/key-store": "4.0.0-devnet.2-patch.0",
80
+ "@aztec/kv-store": "4.0.0-devnet.2-patch.0",
81
+ "@aztec/noir-protocol-circuits-types": "4.0.0-devnet.2-patch.0",
82
+ "@aztec/noir-types": "4.0.0-devnet.2-patch.0",
83
+ "@aztec/protocol-contracts": "4.0.0-devnet.2-patch.0",
84
+ "@aztec/simulator": "4.0.0-devnet.2-patch.0",
85
+ "@aztec/stdlib": "4.0.0-devnet.2-patch.0",
86
86
  "koa": "^2.16.1",
87
87
  "koa-router": "^13.1.1",
88
88
  "lodash.omit": "^4.5.0",
@@ -91,8 +91,8 @@
91
91
  "viem": "npm:@aztec/viem@2.38.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@aztec/merkle-tree": "4.0.0-devnet.1-patch.0",
95
- "@aztec/noir-test-contracts.js": "4.0.0-devnet.1-patch.0",
94
+ "@aztec/merkle-tree": "4.0.0-devnet.2-patch.0",
95
+ "@aztec/noir-test-contracts.js": "4.0.0-devnet.2-patch.0",
96
96
  "@jest/globals": "^30.0.0",
97
97
  "@types/jest": "^30.0.0",
98
98
  "@types/lodash.omit": "^4.5.7",
@@ -0,0 +1,9 @@
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+
3
+ /**
4
+ * Controls which accounts' private state and keys are accessible during execution.
5
+ * - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
6
+ * - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
7
+ * - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
8
+ */
9
+ export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];