@aztec/pxe 3.0.0-nightly.20251209 → 3.0.0-nightly.20251211

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 (116) hide show
  1. package/dest/bin/check_oracle_version.js +1 -1
  2. package/dest/contract_function_simulator/contract_function_simulator.d.ts +2 -2
  3. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  4. package/dest/contract_function_simulator/contract_function_simulator.js +2 -2
  5. package/dest/contract_function_simulator/execution_data_provider.d.ts +5 -4
  6. package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
  7. package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -4
  8. package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/execution_note_cache.js +3 -3
  10. package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
  11. package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
  13. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
  15. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
  17. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  19. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  20. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
  22. package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
  23. package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
  24. package/dest/contract_function_simulator/oracle/interfaces.d.ts +4 -3
  25. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  26. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -2
  27. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
  29. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +5 -3
  30. package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/oracle/note_packing_utils.js +5 -3
  32. package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
  33. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/oracle/oracle.js +6 -3
  35. package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -2
  36. package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
  37. package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
  38. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +4 -4
  39. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  40. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +2 -2
  41. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +5 -4
  42. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +3 -3
  44. package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
  45. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/pick_notes.js +1 -1
  47. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +4 -3
  48. package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
  49. package/dest/contract_function_simulator/pxe_oracle_interface.js +12 -1
  50. package/dest/entrypoints/client/bundle/utils.js +1 -1
  51. package/dest/entrypoints/client/lazy/utils.js +1 -1
  52. package/dest/entrypoints/server/utils.js +1 -1
  53. package/dest/oracle_version.d.ts +1 -1
  54. package/dest/oracle_version.js +1 -1
  55. package/dest/private_kernel/private_kernel_execution_prover.js +2 -2
  56. package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
  57. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  58. package/dest/private_kernel/private_kernel_oracle_impl.d.ts +3 -2
  59. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
  60. package/dest/pxe.d.ts +2 -2
  61. package/dest/pxe.d.ts.map +1 -1
  62. package/dest/pxe.js +1 -1
  63. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +2 -2
  64. package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
  65. package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -1
  66. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -2
  67. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  68. package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
  69. package/dest/storage/note_data_provider/note_data_provider.d.ts +4 -3
  70. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  71. package/dest/storage/note_data_provider/note_data_provider.js +10 -2
  72. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +2 -2
  73. package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
  74. package/dest/storage/private_event_data_provider/private_event_data_provider.js +1 -1
  75. package/dest/tagging/siloed_tag.d.ts +2 -2
  76. package/dest/tagging/siloed_tag.d.ts.map +1 -1
  77. package/dest/tagging/siloed_tag.js +1 -1
  78. package/dest/tagging/tag.d.ts +2 -2
  79. package/dest/tagging/tag.d.ts.map +1 -1
  80. package/dest/tagging/tag.js +1 -1
  81. package/package.json +16 -16
  82. package/src/bin/check_oracle_version.ts +1 -1
  83. package/src/contract_function_simulator/contract_function_simulator.ts +2 -2
  84. package/src/contract_function_simulator/execution_data_provider.ts +4 -3
  85. package/src/contract_function_simulator/execution_note_cache.ts +7 -4
  86. package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
  87. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  88. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
  89. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  90. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  91. package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
  92. package/src/contract_function_simulator/oracle/interfaces.ts +3 -2
  93. package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
  94. package/src/contract_function_simulator/oracle/note_packing_utils.ts +6 -3
  95. package/src/contract_function_simulator/oracle/oracle.ts +7 -3
  96. package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
  97. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +3 -3
  98. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +5 -4
  99. package/src/contract_function_simulator/pick_notes.ts +1 -1
  100. package/src/contract_function_simulator/pxe_oracle_interface.ts +18 -3
  101. package/src/entrypoints/client/bundle/utils.ts +1 -1
  102. package/src/entrypoints/client/lazy/utils.ts +1 -1
  103. package/src/entrypoints/server/utils.ts +1 -1
  104. package/src/oracle_version.ts +1 -1
  105. package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -1
  106. package/src/private_kernel/private_kernel_execution_prover.ts +2 -2
  107. package/src/private_kernel/private_kernel_oracle.ts +2 -1
  108. package/src/private_kernel/private_kernel_oracle_impl.ts +2 -1
  109. package/src/pxe.ts +1 -1
  110. package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -1
  111. package/src/storage/contract_data_provider/contract_data_provider.ts +1 -1
  112. package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
  113. package/src/storage/note_data_provider/note_data_provider.ts +12 -3
  114. package/src/storage/private_event_data_provider/private_event_data_provider.ts +1 -1
  115. package/src/tagging/siloed_tag.ts +2 -2
  116. package/src/tagging/tag.ts +2 -2
@@ -1,5 +1,6 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { Fr, Point } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import {
4
5
  type ACIRCallback,
5
6
  type ACVMField,
@@ -239,7 +240,8 @@ export class Oracle {
239
240
  }
240
241
 
241
242
  async utilityGetNotes(
242
- [owner]: ACVMField[],
243
+ [ownerSome]: ACVMField[],
244
+ [ownerValue]: ACVMField[],
243
245
  [storageSlot]: ACVMField[],
244
246
  [numSelects]: ACVMField[],
245
247
  selectByIndexes: ACVMField[],
@@ -257,8 +259,10 @@ export class Oracle {
257
259
  [maxNotes]: ACVMField[],
258
260
  [packedRetrievedNoteLength]: ACVMField[],
259
261
  ): Promise<(ACVMField | ACVMField[])[]> {
262
+ // Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
263
+ const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
260
264
  const noteDatas = await this.handlerAsUtility().utilityGetNotes(
261
- AztecAddress.fromString(owner),
265
+ owner,
262
266
  Fr.fromString(storageSlot),
263
267
  +numSelects,
264
268
  selectByIndexes.map(s => +s),
@@ -1,6 +1,6 @@
1
1
  import { PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, PRIVATE_CONTEXT_INPUTS_LENGTH } from '@aztec/constants';
2
2
  import { BlockNumber } from '@aztec/foundation/branded-types';
3
- import { Fr } from '@aztec/foundation/fields';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { Timer } from '@aztec/foundation/timer';
6
6
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
@@ -1,5 +1,5 @@
1
1
  import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, PRIVATE_CONTEXT_INPUTS_LENGTH } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { Timer } from '@aztec/foundation/timer';
5
5
  import { type CircuitSimulator, toACVMWitness } from '@aztec/simulator/client';
@@ -282,7 +282,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
282
282
  * Real notes coming from DB will have a leafIndex which
283
283
  * represents their index in the note hash tree.
284
284
  *
285
- * @param owner - The owner of the notes.
285
+ * @param owner - The owner of the notes. If undefined, returns notes for all owners.
286
286
  * @param storageSlot - The storage slot.
287
287
  * @param numSelects - The number of valid selects in selectBy and selectValues.
288
288
  * @param selectBy - An array of indices of the fields to selects.
@@ -296,7 +296,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
296
296
  * @returns Array of note data.
297
297
  */
298
298
  public override async utilityGetNotes(
299
- owner: AztecAddress,
299
+ owner: AztecAddress | undefined,
300
300
  storageSlot: Fr,
301
301
  numSelects: number,
302
302
  selectByIndexes: number[],
@@ -1,6 +1,7 @@
1
1
  import type { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { Aes128 } from '@aztec/foundation/crypto';
3
- import { Fr, Point } from '@aztec/foundation/fields';
2
+ import { Aes128 } from '@aztec/foundation/crypto/aes128';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { Point } from '@aztec/foundation/curves/grumpkin';
4
5
  import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
5
6
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
6
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -168,7 +169,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
168
169
  * Real notes coming from DB will have a leafIndex which
169
170
  * represents their index in the note hash tree.
170
171
  *
171
- * @param owner - The owner of the notes.
172
+ * @param owner - The owner of the notes. If undefined, returns notes for all owners.
172
173
  * @param storageSlot - The storage slot.
173
174
  * @param numSelects - The number of valid selects in selectBy and selectValues.
174
175
  * @param selectBy - An array of indices of the fields to selects.
@@ -182,7 +183,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
182
183
  * @returns Array of note data.
183
184
  */
184
185
  public async utilityGetNotes(
185
- owner: AztecAddress,
186
+ owner: AztecAddress | undefined,
186
187
  storageSlot: Fr,
187
188
  numSelects: number,
188
189
  selectByIndexes: number[],
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { Comparator, type Note } from '@aztec/stdlib/note';
3
3
 
4
4
  export interface PropertySelector {
@@ -1,6 +1,7 @@
1
1
  import type { L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { timesParallel } from '@aztec/foundation/collection';
3
- import { Fr, Point } from '@aztec/foundation/fields';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { Point } from '@aztec/foundation/curves/grumpkin';
4
5
  import { createLogger } from '@aztec/foundation/log';
5
6
  import type { KeyStore } from '@aztec/key-store';
6
7
  import { EventSelector, type FunctionArtifactWithContractName, FunctionSelector } from '@aztec/stdlib/abi';
@@ -92,7 +93,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
92
93
 
93
94
  async getNotes(
94
95
  contractAddress: AztecAddress,
95
- owner: AztecAddress,
96
+ owner: AztecAddress | undefined,
96
97
  storageSlot: Fr,
97
98
  status: NoteStatus,
98
99
  scopes?: AztecAddress[],
@@ -679,6 +680,20 @@ export class PXEOracleInterface implements ExecutionDataProvider {
679
680
  const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
680
681
  const siloedNullifier = await siloNullifier(contractAddress, nullifier);
681
682
 
683
+ const txEffect = await this.aztecNode.getTxEffect(txHash);
684
+ if (!txEffect) {
685
+ throw new Error(`Could not find tx effect for tx hash ${txHash}`);
686
+ }
687
+
688
+ if (txEffect.l2BlockNumber > syncedBlockNumber) {
689
+ throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
690
+ }
691
+
692
+ const noteInTx = txEffect.data.noteHashes.some(nh => nh.equals(uniqueNoteHash));
693
+ if (!noteInTx) {
694
+ throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present in tx ${txHash}`);
695
+ }
696
+
682
697
  // We store notes by their index in the global note hash tree, which has the convenient side effect of validating
683
698
  // note existence in said tree. We concurrently also check if the note's nullifier exists, performing all node
684
699
  // queries in a single round-trip.
@@ -813,7 +828,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
813
828
  throw new Error(`Could not find tx effect for tx hash ${txHash} as of block number ${syncedBlockNumber}`);
814
829
  }
815
830
 
816
- const eventInTx = txEffect.data.nullifiers.some(nullifier => nullifier.equals(siloedEventCommitment));
831
+ const eventInTx = txEffect.data.nullifiers.some(n => n.equals(siloedEventCommitment));
817
832
  if (!eventInTx) {
818
833
  throw new Error(
819
834
  `Event commitment ${eventCommitment} (siloed as ${siloedEventCommitment}) is not present in tx ${txHash}`,
@@ -1,5 +1,5 @@
1
1
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
2
- import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { randomBytes } from '@aztec/foundation/crypto/random';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { createStore } from '@aztec/kv-store/indexeddb';
5
5
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
@@ -1,5 +1,5 @@
1
1
  import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
2
- import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { randomBytes } from '@aztec/foundation/crypto/random';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { createStore } from '@aztec/kv-store/indexeddb';
5
5
  import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
@@ -1,5 +1,5 @@
1
1
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
2
- import { randomBytes } from '@aztec/foundation/crypto';
2
+ import { randomBytes } from '@aztec/foundation/crypto/random';
3
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
4
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
5
5
  import {
@@ -4,7 +4,7 @@
4
4
  ///
5
5
  /// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
6
6
  /// and if the oracle version is incompatible an error is thrown.
7
- export const ORACLE_VERSION = 4;
7
+ export const ORACLE_VERSION = 5;
8
8
 
9
9
  /// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
10
10
  /// which in turn implies that you need to update the ORACLE_VERSION constant.
@@ -9,7 +9,7 @@ import {
9
9
  } from '@aztec/constants';
10
10
  import { makeTuple } from '@aztec/foundation/array';
11
11
  import { padArrayEnd } from '@aztec/foundation/collection';
12
- import type { Fr } from '@aztec/foundation/fields';
12
+ import type { Fr } from '@aztec/foundation/curves/bn254';
13
13
  import { type Tuple, assertLength } from '@aztec/foundation/serialize';
14
14
  import { MembershipWitness } from '@aztec/foundation/trees';
15
15
  import { privateKernelResetDimensionsConfig } from '@aztec/noir-protocol-circuits-types/client';
@@ -1,5 +1,5 @@
1
- import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { pushTestData } from '@aztec/foundation/testing';
5
5
  import { Timer } from '@aztec/foundation/timer';
@@ -1,5 +1,6 @@
1
1
  import { FUNCTION_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import { MembershipWitness } from '@aztec/foundation/trees';
4
5
  import type { FunctionSelector } from '@aztec/stdlib/abi';
5
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -1,5 +1,6 @@
1
1
  import { NOTE_HASH_TREE_HEIGHT, PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr, GrumpkinScalar, Point } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
4
  import { createLogger } from '@aztec/foundation/log';
4
5
  import type { Tuple } from '@aztec/foundation/serialize';
5
6
  import { MembershipWitness } from '@aztec/foundation/trees';
package/src/pxe.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { PrivateEventFilter } from '@aztec/aztec.js/wallet';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
4
  import { SerialQueue } from '@aztec/foundation/queue';
5
5
  import { Timer } from '@aztec/foundation/timer';
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -1,5 +1,5 @@
1
1
  import type { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { toArray } from '@aztec/foundation/iterable';
4
4
  import type { MembershipWitness } from '@aztec/foundation/trees';
5
5
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
@@ -1,5 +1,5 @@
1
1
  import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { assertLength } from '@aztec/foundation/serialize';
4
4
  import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
5
5
  import { type ContractArtifact, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
@@ -1,5 +1,5 @@
1
1
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { toArray } from '@aztec/foundation/iterable';
4
4
  import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncMultiMap } from '@aztec/kv-store';
5
5
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -225,7 +225,8 @@ export class NoteDataProvider {
225
225
  *
226
226
  * @param filter - Filter criteria including contractAddress (required), and optional
227
227
  * owner, storageSlot, status, scopes, and siloedNullifier.
228
- * @returns Promise resolving to array of NoteDao objects matching the filter
228
+ * @returns Filtered and deduplicated notes (a note might be present in multiple scopes - we ensure it is only
229
+ * returned once if this is the case)
229
230
  * @throws If filtering by an empty scopes array. Scopes have to be set to undefined or to a non-empty array.
230
231
  */
231
232
  async getNotes(filter: NotesFilter): Promise<NoteDao[]> {
@@ -323,7 +324,15 @@ export class NoteDataProvider {
323
324
  }
324
325
  }
325
326
 
326
- return result;
327
+ // A note might be present in multiple scopes - we ensure it is only returned once
328
+ const deduplicated: NoteDao[] = [];
329
+ for (const note of result) {
330
+ if (!deduplicated.some(existing => existing.equals(note))) {
331
+ deduplicated.push(note);
332
+ }
333
+ }
334
+
335
+ return deduplicated;
327
336
  }
328
337
 
329
338
  /**
@@ -1,5 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
5
  import type { AztecAsyncArray, AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
@@ -1,5 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
 
5
5
  import type { Tag } from './tag.js';
@@ -1,5 +1,5 @@
1
- import { poseidon2Hash } from '@aztec/foundation/crypto';
2
- import type { Fr } from '@aztec/foundation/fields';
1
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { PreTag } from '@aztec/stdlib/logs';
4
4
 
5
5
  /**