@aztec/pxe 0.80.0 → 0.82.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 (86) hide show
  1. package/dest/config/package_info.js +1 -1
  2. package/dest/entrypoints/server/utils.d.ts +15 -7
  3. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  4. package/dest/entrypoints/server/utils.js +17 -9
  5. package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
  6. package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
  7. package/dest/private_kernel/hints/index.d.ts.map +1 -0
  8. package/dest/private_kernel/index.d.ts +3 -0
  9. package/dest/private_kernel/index.d.ts.map +1 -0
  10. package/dest/private_kernel/index.js +2 -0
  11. package/dest/{kernel_prover/kernel_prover.d.ts → private_kernel/private_kernel_execution_prover.d.ts} +13 -14
  12. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
  13. package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js} +64 -64
  14. package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
  15. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
  16. package/dest/private_kernel/private_kernel_oracle.js +4 -0
  17. package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +5 -5
  18. package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
  19. package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +2 -2
  20. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +14 -22
  21. package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
  22. package/dest/pxe_oracle_interface/pxe_oracle_interface.js +51 -107
  23. package/dest/pxe_service/pxe_service.d.ts +13 -27
  24. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  25. package/dest/pxe_service/pxe_service.js +213 -241
  26. package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -2
  27. package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
  28. package/dest/storage/contract_data_provider/contract_data_provider.js +6 -1
  29. package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -2
  30. package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
  31. package/dest/storage/index.d.ts +1 -2
  32. package/dest/storage/index.d.ts.map +1 -1
  33. package/dest/storage/index.js +1 -2
  34. package/dest/storage/metadata.d.ts +2 -0
  35. package/dest/storage/metadata.d.ts.map +1 -0
  36. package/dest/storage/metadata.js +1 -0
  37. package/dest/storage/note_data_provider/note_dao.d.ts +9 -13
  38. package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
  39. package/dest/storage/note_data_provider/note_dao.js +11 -15
  40. package/dest/storage/note_data_provider/note_data_provider.d.ts +2 -2
  41. package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
  42. package/dest/storage/note_data_provider/note_data_provider.js +18 -19
  43. package/dest/synchronizer/synchronizer.js +1 -1
  44. package/package.json +15 -15
  45. package/src/config/package_info.ts +1 -1
  46. package/src/entrypoints/server/utils.ts +25 -11
  47. package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +4 -4
  48. package/src/private_kernel/index.ts +2 -0
  49. package/src/{kernel_prover/kernel_prover.ts → private_kernel/private_kernel_execution_prover.ts} +76 -71
  50. package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
  51. package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +6 -5
  52. package/src/pxe_oracle_interface/pxe_oracle_interface.ts +77 -153
  53. package/src/pxe_service/pxe_service.ts +289 -310
  54. package/src/storage/contract_data_provider/contract_data_provider.ts +11 -2
  55. package/src/storage/contract_data_provider/private_functions_tree.ts +2 -2
  56. package/src/storage/index.ts +1 -3
  57. package/src/storage/metadata.ts +1 -0
  58. package/src/storage/note_data_provider/note_dao.ts +9 -18
  59. package/src/storage/note_data_provider/note_data_provider.ts +22 -28
  60. package/src/synchronizer/synchronizer.ts +1 -1
  61. package/dest/kernel_oracle/index.d.ts.map +0 -1
  62. package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
  63. package/dest/kernel_prover/hints/index.d.ts.map +0 -1
  64. package/dest/kernel_prover/index.d.ts +0 -3
  65. package/dest/kernel_prover/index.d.ts.map +0 -1
  66. package/dest/kernel_prover/index.js +0 -2
  67. package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
  68. package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
  69. package/dest/kernel_prover/proving_data_oracle.js +0 -4
  70. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
  71. package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
  72. package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
  73. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
  74. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
  75. package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
  76. package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
  77. package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
  78. package/dest/storage/auth_witness_data_provider/index.js +0 -1
  79. package/src/kernel_prover/index.ts +0 -2
  80. package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
  81. package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
  82. package/src/storage/auth_witness_data_provider/index.ts +0 -1
  83. /package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.js +0 -0
  84. /package/dest/{kernel_prover → private_kernel}/hints/index.d.ts +0 -0
  85. /package/dest/{kernel_prover → private_kernel}/hints/index.js +0 -0
  86. /package/src/{kernel_prover → private_kernel}/hints/index.ts +0 -0
@@ -6,6 +6,7 @@ import { ContractClassNotFoundError, ContractNotFoundError } from '@aztec/simula
6
6
  import {
7
7
  type ContractArtifact,
8
8
  type FunctionArtifact,
9
+ type FunctionArtifactWithContractName,
9
10
  type FunctionDebugMetadata,
10
11
  FunctionSelector,
11
12
  FunctionType,
@@ -168,9 +169,17 @@ export class ContractDataProvider implements DataProvider {
168
169
  * @param selector - The function selector.
169
170
  * @returns The corresponding function's artifact as an object.
170
171
  */
171
- public async getFunctionArtifact(contractAddress: AztecAddress, selector: FunctionSelector) {
172
+ public async getFunctionArtifact(
173
+ contractAddress: AztecAddress,
174
+ selector: FunctionSelector,
175
+ ): Promise<FunctionArtifactWithContractName> {
172
176
  const tree = await this.getTreeForAddress(contractAddress);
173
- return tree.getFunctionArtifact(selector);
177
+ const contractArtifact = tree.getArtifact();
178
+ const functionArtifact = await tree.getFunctionArtifact(selector);
179
+ return {
180
+ ...functionArtifact,
181
+ contractName: contractArtifact.name,
182
+ };
174
183
  }
175
184
 
176
185
  /**
@@ -2,7 +2,7 @@ import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { assertLength } from '@aztec/foundation/serialize';
4
4
  import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
5
- import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
5
+ import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
6
6
  import {
7
7
  type ContractClassWithId,
8
8
  computePrivateFunctionLeaf,
@@ -34,7 +34,7 @@ export class PrivateFunctionsTree {
34
34
  * @param selector - The function selector.
35
35
  * @returns The artifact object containing relevant information about the targeted function.
36
36
  */
37
- public async getFunctionArtifact(selector: FunctionSelector) {
37
+ public async getFunctionArtifact(selector: FunctionSelector): Promise<FunctionArtifact> {
38
38
  const functionsAndSelectors = await Promise.all(
39
39
  this.artifact.functions.map(async f => ({
40
40
  f,
@@ -1,10 +1,8 @@
1
1
  export * from './address_data_provider/index.js';
2
- export * from './auth_witness_data_provider/index.js';
3
2
  export * from './capsule_data_provider/index.js';
4
3
  export * from './contract_data_provider/index.js';
5
4
  export * from './note_data_provider/index.js';
6
5
  export * from './sync_data_provider/index.js';
7
6
  export * from './tagging_data_provider/index.js';
8
7
  export * from './data_provider.js';
9
-
10
- export const PXE_DATA_SCHEMA_VERSION = 2;
8
+ export * from './metadata.js';
@@ -0,0 +1 @@
1
+ export const PXE_DATA_SCHEMA_VERSION = 2;
@@ -2,9 +2,7 @@ import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
2
2
  import { Fr, Point } from '@aztec/foundation/fields';
3
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
4
  import type { NoteData } from '@aztec/simulator/client';
5
- import { NoteSelector } from '@aztec/stdlib/abi';
6
5
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import type { PublicKey } from '@aztec/stdlib/keys';
8
6
  import { Note } from '@aztec/stdlib/note';
9
7
  import { TxHash } from '@aztec/stdlib/tx';
10
8
 
@@ -53,13 +51,11 @@ export class NoteDao implements NoteData {
53
51
  public l2BlockHash: string,
54
52
  /** The index of the leaf in the global note hash tree the note is stored at */
55
53
  public index: bigint,
56
- /** The public key with which the note log was encrypted during delivery. */
57
- public addressPoint: PublicKey,
58
-
59
- /** The note type identifier for the contract.
60
- * TODO(#12013): remove
54
+ /**
55
+ * The address whose public key was used to encrypt the note log during delivery.
56
+ * (This is the x-coordinate of the public key.)
61
57
  */
62
- public noteTypeId: NoteSelector,
58
+ public recipient: AztecAddress,
63
59
  ) {}
64
60
 
65
61
  toBuffer(): Buffer {
@@ -74,8 +70,7 @@ export class NoteDao implements NoteData {
74
70
  this.l2BlockNumber,
75
71
  Fr.fromHexString(this.l2BlockHash),
76
72
  this.index,
77
- this.addressPoint,
78
- this.noteTypeId,
73
+ this.recipient,
79
74
  ]);
80
75
  }
81
76
 
@@ -92,8 +87,7 @@ export class NoteDao implements NoteData {
92
87
  const l2BlockNumber = reader.readNumber();
93
88
  const l2BlockHash = Fr.fromBuffer(reader).toString();
94
89
  const index = toBigIntBE(reader.readBytes(32));
95
- const publicKey = Point.fromBuffer(reader);
96
- const noteTypeId = reader.readObject(NoteSelector);
90
+ const recipient = AztecAddress.fromBuffer(reader);
97
91
 
98
92
  return new NoteDao(
99
93
  note,
@@ -106,8 +100,7 @@ export class NoteDao implements NoteData {
106
100
  l2BlockNumber,
107
101
  l2BlockHash,
108
102
  index,
109
- publicKey,
110
- noteTypeId,
103
+ recipient,
111
104
  );
112
105
  }
113
106
 
@@ -141,8 +134,7 @@ export class NoteDao implements NoteData {
141
134
  l2BlockNumber = Math.floor(Math.random() * 1000),
142
135
  l2BlockHash = Fr.random().toString(),
143
136
  index = Fr.random().toBigInt(),
144
- addressPoint = undefined,
145
- noteTypeId = NoteSelector.random(),
137
+ recipient = undefined,
146
138
  }: Partial<NoteDao> = {}) {
147
139
  return new NoteDao(
148
140
  note,
@@ -155,8 +147,7 @@ export class NoteDao implements NoteData {
155
147
  l2BlockNumber,
156
148
  l2BlockHash,
157
149
  index,
158
- addressPoint ?? (await Point.random()),
159
- noteTypeId,
150
+ recipient ?? (await AztecAddress.random()),
160
151
  );
161
152
  }
162
153
  }
@@ -1,10 +1,9 @@
1
1
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
2
- import type { Fr, Point } from '@aztec/foundation/fields';
2
+ import type { Fr } from '@aztec/foundation/fields';
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';
6
6
  import type { InBlock } from '@aztec/stdlib/block';
7
- import type { PublicKey } from '@aztec/stdlib/keys';
8
7
  import { NoteStatus, type NotesFilter } from '@aztec/stdlib/note';
9
8
 
10
9
  import type { DataProvider } from '../data_provider.js';
@@ -22,7 +21,7 @@ export class NoteDataProvider implements DataProvider {
22
21
  #nullifiedNotesByContract: AztecAsyncMultiMap<string, string>;
23
22
  #nullifiedNotesByStorageSlot: AztecAsyncMultiMap<string, string>;
24
23
  #nullifiedNotesByTxHash: AztecAsyncMultiMap<string, string>;
25
- #nullifiedNotesByAddressPoint: AztecAsyncMultiMap<string, string>;
24
+ #nullifiedNotesByRecipient: AztecAsyncMultiMap<string, string>;
26
25
  #nullifiedNotesByNullifier: AztecAsyncMap<string, string>;
27
26
 
28
27
  #scopes: AztecAsyncMap<string, true>;
@@ -30,7 +29,7 @@ export class NoteDataProvider implements DataProvider {
30
29
  #notesByContractAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
31
30
  #notesByStorageSlotAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
32
31
  #notesByTxHashAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
33
- #notesByAddressPointAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
32
+ #notesByRecipientAndScope: Map<string, AztecAsyncMultiMap<string, string>>;
34
33
 
35
34
  private constructor(store: AztecAsyncKVStore) {
36
35
  this.#store = store;
@@ -43,7 +42,7 @@ export class NoteDataProvider implements DataProvider {
43
42
  this.#nullifiedNotesByContract = store.openMultiMap('nullified_notes_by_contract');
44
43
  this.#nullifiedNotesByStorageSlot = store.openMultiMap('nullified_notes_by_storage_slot');
45
44
  this.#nullifiedNotesByTxHash = store.openMultiMap('nullified_notes_by_tx_hash');
46
- this.#nullifiedNotesByAddressPoint = store.openMultiMap('nullified_notes_by_address_point');
45
+ this.#nullifiedNotesByRecipient = store.openMultiMap('nullified_notes_by_recipient');
47
46
  this.#nullifiedNotesByNullifier = store.openMap('nullified_notes_by_nullifier');
48
47
 
49
48
  this.#scopes = store.openMap('scopes');
@@ -51,7 +50,7 @@ export class NoteDataProvider implements DataProvider {
51
50
  this.#notesByContractAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
52
51
  this.#notesByStorageSlotAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
53
52
  this.#notesByTxHashAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
54
- this.#notesByAddressPointAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
53
+ this.#notesByRecipientAndScope = new Map<string, AztecAsyncMultiMap<string, string>>();
55
54
  }
56
55
 
57
56
  public static async create(store: AztecAsyncKVStore): Promise<NoteDataProvider> {
@@ -60,7 +59,7 @@ export class NoteDataProvider implements DataProvider {
60
59
  pxeDB.#notesByContractAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_contract`));
61
60
  pxeDB.#notesByStorageSlotAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_storage_slot`));
62
61
  pxeDB.#notesByTxHashAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_tx_hash`));
63
- pxeDB.#notesByAddressPointAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_address_point`));
62
+ pxeDB.#notesByRecipientAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_recipient`));
64
63
  }
65
64
  return pxeDB;
66
65
  }
@@ -76,10 +75,7 @@ export class NoteDataProvider implements DataProvider {
76
75
  this.#notesByContractAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_contract`));
77
76
  this.#notesByStorageSlotAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_storage_slot`));
78
77
  this.#notesByTxHashAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_tx_hash`));
79
- this.#notesByAddressPointAndScope.set(
80
- scopeString,
81
- this.#store.openMultiMap(`${scopeString}:notes_by_address_point`),
82
- );
78
+ this.#notesByRecipientAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_recipient`));
83
79
 
84
80
  return true;
85
81
  }
@@ -103,7 +99,7 @@ export class NoteDataProvider implements DataProvider {
103
99
  await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
104
100
  await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
105
101
  await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
106
- await this.#notesByAddressPointAndScope.get(scope.toString())!.set(dao.addressPoint.toString(), noteIndex);
102
+ await this.#notesByRecipientAndScope.get(scope.toString())!.set(dao.recipient.toString(), noteIndex);
107
103
  }
108
104
  });
109
105
  }
@@ -120,7 +116,7 @@ export class NoteDataProvider implements DataProvider {
120
116
  await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
121
117
  const scopes = await toArray(this.#scopes.keysAsync());
122
118
  for (const scope of scopes) {
123
- await this.#notesByAddressPointAndScope.get(scope)!.deleteValue(noteDao.addressPoint.toString(), noteIndex);
119
+ await this.#notesByRecipientAndScope.get(scope)!.deleteValue(noteDao.recipient.toString(), noteIndex);
124
120
  await this.#notesByTxHashAndScope.get(scope)!.deleteValue(noteDao.txHash.toString(), noteIndex);
125
121
  await this.#notesByContractAndScope.get(scope)!.deleteValue(noteDao.contractAddress.toString(), noteIndex);
126
122
  await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(noteDao.storageSlot.toString(), noteIndex);
@@ -157,14 +153,14 @@ export class NoteDataProvider implements DataProvider {
157
153
  let scopes = (await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex))) ?? [];
158
154
 
159
155
  if (scopes.length === 0) {
160
- scopes = [new AztecAddress(dao.addressPoint.x).toString()];
156
+ scopes = [dao.recipient.toString()];
161
157
  }
162
158
 
163
159
  for (const scope of scopes) {
164
160
  await this.#notesByContractAndScope.get(scope.toString())!.set(dao.contractAddress.toString(), noteIndex);
165
161
  await this.#notesByStorageSlotAndScope.get(scope.toString())!.set(dao.storageSlot.toString(), noteIndex);
166
162
  await this.#notesByTxHashAndScope.get(scope.toString())!.set(dao.txHash.toString(), noteIndex);
167
- await this.#notesByAddressPointAndScope.get(scope.toString())!.set(dao.addressPoint.toString(), noteIndex);
163
+ await this.#notesByRecipientAndScope.get(scope.toString())!.set(dao.recipient.toString(), noteIndex);
168
164
  await this.#notesToScope.set(noteIndex, scope);
169
165
  }
170
166
 
@@ -174,15 +170,13 @@ export class NoteDataProvider implements DataProvider {
174
170
  await this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteIndex);
175
171
  await this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteIndex);
176
172
  await this.#nullifiedNotesByTxHash.deleteValue(dao.txHash.toString(), noteIndex);
177
- await this.#nullifiedNotesByAddressPoint.deleteValue(dao.addressPoint.toString(), noteIndex);
173
+ await this.#nullifiedNotesByRecipient.deleteValue(dao.recipient.toString(), noteIndex);
178
174
  await this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString());
179
175
  }
180
176
  });
181
177
  }
182
178
 
183
179
  async getNotes(filter: NotesFilter): Promise<NoteDao[]> {
184
- const publicKey: PublicKey | undefined = filter.owner ? await filter.owner.toAddressPoint() : undefined;
185
-
186
180
  filter.status = filter.status ?? NoteStatus.ACTIVE;
187
181
 
188
182
  const candidateNoteSources = [];
@@ -200,9 +194,9 @@ export class NoteDataProvider implements DataProvider {
200
194
  }
201
195
 
202
196
  activeNoteIdsPerScope.push(
203
- publicKey
197
+ filter.recipient
204
198
  ? await toArray(
205
- this.#notesByAddressPointAndScope.get(formattedScopeString)!.getValuesAsync(publicKey.toString()),
199
+ this.#notesByRecipientAndScope.get(formattedScopeString)!.getValuesAsync(filter.recipient.toString()),
206
200
  )
207
201
  : filter.txHash
208
202
  ? await toArray(
@@ -218,7 +212,7 @@ export class NoteDataProvider implements DataProvider {
218
212
  ? await toArray(
219
213
  this.#notesByStorageSlotAndScope.get(formattedScopeString)!.getValuesAsync(filter.storageSlot.toString()),
220
214
  )
221
- : await toArray(this.#notesByAddressPointAndScope.get(formattedScopeString)!.valuesAsync()),
215
+ : await toArray(this.#notesByRecipientAndScope.get(formattedScopeString)!.valuesAsync()),
222
216
  );
223
217
  }
224
218
 
@@ -229,8 +223,8 @@ export class NoteDataProvider implements DataProvider {
229
223
 
230
224
  if (filter.status == NoteStatus.ACTIVE_OR_NULLIFIED) {
231
225
  candidateNoteSources.push({
232
- ids: publicKey
233
- ? await toArray(this.#nullifiedNotesByAddressPoint.getValuesAsync(publicKey.toString()))
226
+ ids: filter.recipient
227
+ ? await toArray(this.#nullifiedNotesByRecipient.getValuesAsync(filter.recipient.toString()))
234
228
  : filter.txHash
235
229
  ? await toArray(this.#nullifiedNotesByTxHash.getValuesAsync(filter.txHash.toString()))
236
230
  : filter.contractAddress
@@ -263,7 +257,7 @@ export class NoteDataProvider implements DataProvider {
263
257
  continue;
264
258
  }
265
259
 
266
- if (publicKey && !note.addressPoint.equals(publicKey)) {
260
+ if (filter.recipient && !note.recipient.equals(filter.recipient)) {
267
261
  continue;
268
262
  }
269
263
 
@@ -278,7 +272,7 @@ export class NoteDataProvider implements DataProvider {
278
272
  return result;
279
273
  }
280
274
 
281
- removeNullifiedNotes(nullifiers: InBlock<Fr>[], accountAddressPoint: Point): Promise<NoteDao[]> {
275
+ removeNullifiedNotes(nullifiers: InBlock<Fr>[], recipient: AztecAddress): Promise<NoteDao[]> {
282
276
  if (nullifiers.length === 0) {
283
277
  return Promise.resolve([]);
284
278
  }
@@ -301,7 +295,7 @@ export class NoteDataProvider implements DataProvider {
301
295
  }
302
296
  const noteScopes = (await toArray(this.#notesToScope.getValuesAsync(noteIndex))) ?? [];
303
297
  const note = NoteDao.fromBuffer(noteBuffer);
304
- if (!note.addressPoint.equals(accountAddressPoint)) {
298
+ if (!note.recipient.equals(recipient)) {
305
299
  // tried to nullify someone else's note
306
300
  continue;
307
301
  }
@@ -314,7 +308,7 @@ export class NoteDataProvider implements DataProvider {
314
308
  const scopes = await toArray(this.#scopes.keysAsync());
315
309
 
316
310
  for (const scope of scopes) {
317
- await this.#notesByAddressPointAndScope.get(scope)!.deleteValue(accountAddressPoint.toString(), noteIndex);
311
+ await this.#notesByRecipientAndScope.get(scope)!.deleteValue(note.recipient.toString(), noteIndex);
318
312
  await this.#notesByTxHashAndScope.get(scope)!.deleteValue(note.txHash.toString(), noteIndex);
319
313
  await this.#notesByContractAndScope.get(scope)!.deleteValue(note.contractAddress.toString(), noteIndex);
320
314
  await this.#notesByStorageSlotAndScope.get(scope)!.deleteValue(note.storageSlot.toString(), noteIndex);
@@ -330,7 +324,7 @@ export class NoteDataProvider implements DataProvider {
330
324
  await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
331
325
  await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
332
326
  await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
333
- await this.#nullifiedNotesByAddressPoint.set(note.addressPoint.toString(), noteIndex);
327
+ await this.#nullifiedNotesByRecipient.set(note.recipient.toString(), noteIndex);
334
328
  await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
335
329
 
336
330
  await this.#nullifierToNoteId.delete(nullifier.toString());
@@ -49,7 +49,7 @@ export class Synchronizer implements L2BlockStreamEventHandler {
49
49
 
50
50
  switch (event.type) {
51
51
  case 'blocks-added': {
52
- const lastBlock = event.blocks.at(-1)!;
52
+ const lastBlock = event.blocks.at(-1)!.block;
53
53
  this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
54
54
  blockHash: lastBlock.hash(),
55
55
  archive: lastBlock.archive.root.toString(),
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kernel_oracle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAA2C,MAAM,kBAAkB,CAAC;AACvG,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAInF;;GAEG;AACH,qBAAa,YAAa,YAAW,iBAAiB;IAElD,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,GAAG;gBAJH,oBAAoB,EAAE,oBAAoB,EAC1C,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,EACf,WAAW,GAAE,aAAwB,EACrC,GAAG,yCAAoC;IAGpC,0BAA0B,CAAC,OAAO,EAAE,YAAY;;;;;;;;;;;IAQhD,0BAA0B,CAAC,eAAe,EAAE,EAAE;IAK9C,4BAA4B,CAAC,eAAe,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB;IAIlF,sBAAsB,CAAC,EAAE,EAAE,uBAAuB;IAKnD,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAS/G,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IAIvF,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC;IAQjC,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC;IAInE,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1F,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA6BjG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build_private_kernel_reset_private_inputs.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/hints/build_private_kernel_reset_private_inputs.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,gCAAgC,EAErC,sCAAsC,EAGtC,KAAK,2BAA2B,EAkBjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,kBAAkB,CAAC;AAElF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAiDnE,qBAAa,sCAAsC;IAY/C,OAAO,CAAC,oBAAoB;IAC5B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,2BAA2B;IACnC,OAAO,CAAC,8BAA8B;IAdxC,OAAO,CAAC,cAAc,CAAmC;IAEzD,OAAO,CAAC,aAAa,CAAC,CAA6B;IAEnD,OAAO,CAAC,mBAAmB,CAAoE;IAC/F,OAAO,CAAC,oBAAoB,CAAoE;IAChG,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,CAAC,uBAAuB,CAA8D;IAC7F,OAAO,CAAC,mBAAmB,CAA+B;gBAGhD,oBAAoB,EAAE,2BAA2B,CAAC,gCAAgC,CAAC,EACnF,cAAc,EAAE,0BAA0B,EAAE,EAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,8BAA8B,EAAE,MAAM;IAahD,UAAU,IAAI,OAAO;IAwBf,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAgEhF,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,8BAA8B;IAoDtC,OAAO,CAAC,+BAA+B;IAoDvC,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,uBAAuB;IA6E/B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,oBAAoB;CAmB7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kernel_prover/hints/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './kernel_prover.js';
2
- export * from './proving_data_oracle.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kernel_prover/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './kernel_prover.js';
2
- export * from './proving_data_oracle.js';
@@ -1 +0,0 @@
1
- {"version":3,"file":"kernel_prover.d.ts","sourceRoot":"","sources":["../../src/kernel_prover/kernel_prover.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAML,KAAK,2BAA2B,EAEhC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAMV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AASlE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,YAAY;IAIrB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAqC;gBAGtC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ;IAG5B;;;;;;;;;;;OAWG;IACG,KAAK,CACT,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,GAAE,aAI1C,GACA,OAAO,CAAC,2BAA2B,CAAC,oCAAoC,CAAC,CAAC;YA4M/D,qBAAqB;IA4CnC,OAAO,CAAC,aAAa;CAYtB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"proving_data_oracle.d.ts","sourceRoot":"","sources":["../../src/kernel_prover/proving_data_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,0BAA0B,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;QACzD,wBAAwB,EAAE,EAAE,CAAC;QAC7B,UAAU,EAAE,UAAU,CAAC;QACvB,sBAAsB,EAAE,EAAE,CAAC;QAC3B,uBAAuB,EAAE,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,kFAAkF;IAClF,0BAA0B,CACxB,eAAe,EAAE,EAAE,GAClB,OAAO,CAAC;QAAE,YAAY,EAAE,EAAE,CAAC;QAAC,wBAAwB,EAAE,EAAE,CAAC;QAAC,oBAAoB,EAAE,EAAE,CAAA;KAAE,CAAC,CAAC;IAEzF;;;;;;;;OAQG;IACH,4BAA4B,CAC1B,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;IAE3D;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IAEvG;;;;;OAKG;IACH,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAE1G,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAAC;IAE9F;;;;OAIG;IACH,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC;IAEnC;;;;;;OAMG;IACH,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEpE,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE7G,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACrF"}
@@ -1,4 +0,0 @@
1
- /**
2
- * Provides functionality to fetch membership witnesses for verification keys,
3
- * contract addresses, and function selectors in their respective merkle trees.
4
- */ export { };
@@ -1,11 +0,0 @@
1
- import type { L1NotePayload } from '@aztec/stdlib/logs';
2
- import { Note } from '@aztec/stdlib/note';
3
- import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
4
- /**
5
- * Merges privately and publicly delivered note values.
6
- * @param db - PXE database used to fetch contract instance and artifact.
7
- * @param payload - Payload corresponding to the note.
8
- * @returns Note payload with public fields added.
9
- */
10
- export declare function getOrderedNoteItems(contractDataProvider: ContractDataProvider, { contractAddress, noteTypeId, privateNoteValues, publicNoteValues }: L1NotePayload): Promise<Note>;
11
- //# sourceMappingURL=add_public_values_to_payload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add_public_values_to_payload.d.ts","sourceRoot":"","sources":["../../src/note_decryption_utils/add_public_values_to_payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AAExG;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,oBAAoB,EAAE,oBAAoB,EAC1C,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,aAAa,GAClF,OAAO,CAAC,IAAI,CAAC,CAgDf"}
@@ -1,47 +0,0 @@
1
- import { ContractNotFoundError } from '@aztec/simulator/client';
2
- import { Note } from '@aztec/stdlib/note';
3
- /**
4
- * Merges privately and publicly delivered note values.
5
- * @param db - PXE database used to fetch contract instance and artifact.
6
- * @param payload - Payload corresponding to the note.
7
- * @returns Note payload with public fields added.
8
- */ export async function getOrderedNoteItems(contractDataProvider, { contractAddress, noteTypeId, privateNoteValues, publicNoteValues }) {
9
- if (publicNoteValues.length === 0) {
10
- return new Note(privateNoteValues);
11
- }
12
- const instance = await contractDataProvider.getContractInstance(contractAddress);
13
- if (!instance) {
14
- throw new ContractNotFoundError(`Could not find instance for ${contractAddress.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`);
15
- }
16
- const artifact = await contractDataProvider.getContractArtifact(instance.currentContractClassId);
17
- if (!artifact) {
18
- throw new Error(`Could not find artifact for contract class ${instance.currentContractClassId.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`);
19
- }
20
- const noteFields = Object.values(artifact.notes).find((note)=>note.id.equals(noteTypeId))?.fields;
21
- if (!noteFields) {
22
- throw new Error(`Could not find note fields for note type ${noteTypeId.toString()}.`);
23
- }
24
- // We sort note fields by index so that we can iterate over them in order.
25
- noteFields.sort((a, b)=>a.index - b.index);
26
- // Now we insert the public fields into the note based on its indices defined in the ABI.
27
- const modifiedNoteItems = [
28
- ...privateNoteValues
29
- ];
30
- let indexInPublicValues = 0;
31
- for(let i = 0; i < noteFields.length; i++){
32
- const noteField = noteFields[i];
33
- if (noteField.nullable) {
34
- if (i == noteFields.length - 1) {
35
- // We are processing the last field so we simply insert the rest of the public fields at the end
36
- modifiedNoteItems.push(...publicNoteValues.slice(indexInPublicValues));
37
- } else {
38
- const noteFieldLength = noteFields[i + 1].index - noteField.index;
39
- const publicValuesToInsert = publicNoteValues.slice(indexInPublicValues, indexInPublicValues + noteFieldLength);
40
- indexInPublicValues += noteFieldLength;
41
- // Now we insert the public fields at the note field index
42
- modifiedNoteItems.splice(noteField.index, 0, ...publicValuesToInsert);
43
- }
44
- }
45
- }
46
- return new Note(modifiedNoteItems);
47
- }
@@ -1,11 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
- import type { DataProvider } from '../data_provider.js';
4
- export declare class AuthWitnessDataProvider implements DataProvider {
5
- #private;
6
- constructor(store: AztecAsyncKVStore);
7
- addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void>;
8
- getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
9
- getSize(): Promise<number>;
10
- }
11
- //# sourceMappingURL=auth_witness_data_provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth_witness_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/auth_witness_data_provider/auth_witness_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,uBAAwB,YAAW,YAAY;;gBAI9C,KAAK,EAAE,iBAAiB;IAK9B,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7D,cAAc,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;IAK1D,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAMjC"}
@@ -1,20 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- export class AuthWitnessDataProvider {
4
- #store;
5
- #authWitnesses;
6
- constructor(store){
7
- this.#store = store;
8
- this.#authWitnesses = this.#store.openMap('auth_witnesses');
9
- }
10
- async addAuthWitness(messageHash, witness) {
11
- await this.#authWitnesses.set(messageHash.toString(), witness.map((w)=>w.toBuffer()));
12
- }
13
- async getAuthWitness(messageHash) {
14
- const witness = await this.#authWitnesses.getAsync(messageHash.toString());
15
- return witness?.map((w)=>Fr.fromBuffer(w));
16
- }
17
- async getSize() {
18
- return (await toArray(this.#authWitnesses.valuesAsync())).reduce((sum, value)=>sum + value.length * Fr.SIZE_IN_BYTES, 0);
19
- }
20
- }
@@ -1,2 +0,0 @@
1
- export { AuthWitnessDataProvider } from './auth_witness_data_provider.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/auth_witness_data_provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1 +0,0 @@
1
- export { AuthWitnessDataProvider } from './auth_witness_data_provider.js';
@@ -1,2 +0,0 @@
1
- export * from './kernel_prover.js';
2
- export * from './proving_data_oracle.js';
@@ -1,64 +0,0 @@
1
- import { ContractNotFoundError } from '@aztec/simulator/client';
2
- import type { L1NotePayload } from '@aztec/stdlib/logs';
3
- import { Note } from '@aztec/stdlib/note';
4
-
5
- import type { ContractDataProvider } from '../storage/contract_data_provider/contract_data_provider.js';
6
-
7
- /**
8
- * Merges privately and publicly delivered note values.
9
- * @param db - PXE database used to fetch contract instance and artifact.
10
- * @param payload - Payload corresponding to the note.
11
- * @returns Note payload with public fields added.
12
- */
13
- export async function getOrderedNoteItems(
14
- contractDataProvider: ContractDataProvider,
15
- { contractAddress, noteTypeId, privateNoteValues, publicNoteValues }: L1NotePayload,
16
- ): Promise<Note> {
17
- if (publicNoteValues.length === 0) {
18
- return new Note(privateNoteValues);
19
- }
20
-
21
- const instance = await contractDataProvider.getContractInstance(contractAddress);
22
- if (!instance) {
23
- throw new ContractNotFoundError(
24
- `Could not find instance for ${contractAddress.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`,
25
- );
26
- }
27
-
28
- const artifact = await contractDataProvider.getContractArtifact(instance.currentContractClassId);
29
- if (!artifact) {
30
- throw new Error(
31
- `Could not find artifact for contract class ${instance.currentContractClassId.toString()}. This should never happen here as the partial notes flow should be triggered only for non-deferred notes.`,
32
- );
33
- }
34
-
35
- const noteFields = Object.values(artifact.notes).find(note => note.id.equals(noteTypeId))?.fields;
36
-
37
- if (!noteFields) {
38
- throw new Error(`Could not find note fields for note type ${noteTypeId.toString()}.`);
39
- }
40
-
41
- // We sort note fields by index so that we can iterate over them in order.
42
- noteFields.sort((a, b) => a.index - b.index);
43
-
44
- // Now we insert the public fields into the note based on its indices defined in the ABI.
45
- const modifiedNoteItems = [...privateNoteValues];
46
- let indexInPublicValues = 0;
47
- for (let i = 0; i < noteFields.length; i++) {
48
- const noteField = noteFields[i];
49
- if (noteField.nullable) {
50
- if (i == noteFields.length - 1) {
51
- // We are processing the last field so we simply insert the rest of the public fields at the end
52
- modifiedNoteItems.push(...publicNoteValues.slice(indexInPublicValues));
53
- } else {
54
- const noteFieldLength = noteFields[i + 1].index - noteField.index;
55
- const publicValuesToInsert = publicNoteValues.slice(indexInPublicValues, indexInPublicValues + noteFieldLength);
56
- indexInPublicValues += noteFieldLength;
57
- // Now we insert the public fields at the note field index
58
- modifiedNoteItems.splice(noteField.index, 0, ...publicValuesToInsert);
59
- }
60
- }
61
- }
62
-
63
- return new Note(modifiedNoteItems);
64
- }
@@ -1,34 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { toArray } from '@aztec/foundation/iterable';
3
- import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
-
5
- import type { DataProvider } from '../data_provider.js';
6
-
7
- export class AuthWitnessDataProvider implements DataProvider {
8
- #store: AztecAsyncKVStore;
9
- #authWitnesses: AztecAsyncMap<string, Buffer[]>;
10
-
11
- constructor(store: AztecAsyncKVStore) {
12
- this.#store = store;
13
- this.#authWitnesses = this.#store.openMap('auth_witnesses');
14
- }
15
-
16
- async addAuthWitness(messageHash: Fr, witness: Fr[]): Promise<void> {
17
- await this.#authWitnesses.set(
18
- messageHash.toString(),
19
- witness.map(w => w.toBuffer()),
20
- );
21
- }
22
-
23
- async getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined> {
24
- const witness = await this.#authWitnesses.getAsync(messageHash.toString());
25
- return witness?.map(w => Fr.fromBuffer(w));
26
- }
27
-
28
- async getSize(): Promise<number> {
29
- return (await toArray(this.#authWitnesses.valuesAsync())).reduce(
30
- (sum, value) => sum + value.length * Fr.SIZE_IN_BYTES,
31
- 0,
32
- );
33
- }
34
- }
@@ -1 +0,0 @@
1
- export { AuthWitnessDataProvider } from './auth_witness_data_provider.js';