@aztec/pxe 0.0.1-commit.358457c → 0.0.1-commit.3895657bc
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.
- package/dest/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +3 -3
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +132 -89
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +20 -20
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +36 -36
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +29 -31
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +32 -38
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -4
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- package/dest/pxe.d.ts +3 -2
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +10 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +3 -3
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
- package/package.json +16 -16
- package/src/config/index.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +3 -3
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +43 -43
- package/src/contract_function_simulator/oracle/oracle.ts +135 -107
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +40 -37
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +32 -45
- package/src/logs/log_service.ts +10 -5
- package/src/oracle_version.ts +3 -3
- package/src/pxe.ts +8 -4
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +3 -6
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
|
@@ -69,12 +69,12 @@ export class Oracle {
|
|
|
69
69
|
name => !excludedProps.includes(name as (typeof excludedProps)[number]),
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
// Validate oracle names - these must be prefixed with either "
|
|
72
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
73
73
|
// and must correspond to a function on the Oracle class.
|
|
74
74
|
oracleNames.forEach(name => {
|
|
75
|
-
if (!name.startsWith('
|
|
75
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
76
76
|
throw new Error(
|
|
77
|
-
`Oracle function "${name}" must be prefixed with either "
|
|
77
|
+
`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -92,41 +92,46 @@ export class Oracle {
|
|
|
92
92
|
}, {} as ACIRCallback);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
// eslint-disable-next-line camelcase
|
|
96
|
+
aztec_utl_assertCompatibleOracleVersion([version]: ACVMField[]) {
|
|
97
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
97
98
|
return Promise.resolve([]);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
// eslint-disable-next-line camelcase
|
|
102
|
+
aztec_utl_getRandomField(): Promise<ACVMField[]> {
|
|
103
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
102
104
|
return Promise.resolve([toACVMField(val)]);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
// eslint-disable-next-line camelcase
|
|
108
|
+
aztec_prv_storeInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
109
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
107
110
|
return Promise.resolve([]);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
// eslint-disable-next-line camelcase
|
|
114
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
115
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
112
116
|
return [values.map(toACVMField)];
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
// eslint-disable-next-line camelcase
|
|
120
|
+
aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
121
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
117
122
|
return Promise.resolve(context.toNoirRepresentation());
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
// eslint-disable-next-line camelcase
|
|
126
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
127
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
122
128
|
|
|
123
129
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
);
|
|
132
|
+
// eslint-disable-next-line camelcase
|
|
133
|
+
async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
|
|
134
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
130
135
|
|
|
131
136
|
return [
|
|
132
137
|
instance.salt,
|
|
@@ -137,17 +142,15 @@ export class Oracle {
|
|
|
137
142
|
].map(toACVMField);
|
|
138
143
|
}
|
|
139
144
|
|
|
140
|
-
|
|
145
|
+
// eslint-disable-next-line camelcase
|
|
146
|
+
async aztec_utl_getNoteHashMembershipWitness(
|
|
141
147
|
[anchorBlockHash]: ACVMField[],
|
|
142
148
|
[noteHash]: ACVMField[],
|
|
143
149
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
144
150
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
145
151
|
const parsedNoteHash = Fr.fromString(noteHash);
|
|
146
152
|
|
|
147
|
-
const witness = await this.handlerAsUtility().
|
|
148
|
-
parsedAnchorBlockHash,
|
|
149
|
-
parsedNoteHash,
|
|
150
|
-
);
|
|
153
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
151
154
|
if (!witness) {
|
|
152
155
|
throw new Error(
|
|
153
156
|
`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
|
|
@@ -156,17 +159,15 @@ export class Oracle {
|
|
|
156
159
|
return witness.toNoirRepresentation();
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
|
|
162
|
+
// eslint-disable-next-line camelcase
|
|
163
|
+
async aztec_utl_getBlockHashMembershipWitness(
|
|
160
164
|
[anchorBlockHash]: ACVMField[],
|
|
161
165
|
[blockHash]: ACVMField[],
|
|
162
166
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
163
167
|
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
164
168
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
165
169
|
|
|
166
|
-
const witness = await this.handlerAsUtility().
|
|
167
|
-
parsedAnchorBlockHash,
|
|
168
|
-
parsedBlockHash,
|
|
169
|
-
);
|
|
170
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
170
171
|
if (!witness) {
|
|
171
172
|
throw new Error(
|
|
172
173
|
`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
|
|
@@ -175,17 +176,15 @@ export class Oracle {
|
|
|
175
176
|
return witness.toNoirRepresentation();
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
// eslint-disable-next-line camelcase
|
|
180
|
+
async aztec_utl_getNullifierMembershipWitness(
|
|
179
181
|
[blockHash]: ACVMField[],
|
|
180
182
|
[nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
|
|
181
183
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
182
184
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
183
185
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
184
186
|
|
|
185
|
-
const witness = await this.handlerAsUtility().
|
|
186
|
-
parsedBlockHash,
|
|
187
|
-
parsedNullifier,
|
|
188
|
-
);
|
|
187
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
189
188
|
if (!witness) {
|
|
190
189
|
throw new Error(
|
|
191
190
|
`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -194,17 +193,15 @@ export class Oracle {
|
|
|
194
193
|
return witness.toNoirRepresentation();
|
|
195
194
|
}
|
|
196
195
|
|
|
197
|
-
|
|
196
|
+
// eslint-disable-next-line camelcase
|
|
197
|
+
async aztec_utl_getLowNullifierMembershipWitness(
|
|
198
198
|
[blockHash]: ACVMField[],
|
|
199
199
|
[nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
|
|
200
200
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
201
201
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
202
202
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
203
203
|
|
|
204
|
-
const witness = await this.handlerAsUtility().
|
|
205
|
-
parsedBlockHash,
|
|
206
|
-
parsedNullifier,
|
|
207
|
-
);
|
|
204
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
208
205
|
if (!witness) {
|
|
209
206
|
throw new Error(
|
|
210
207
|
`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -213,14 +210,15 @@ export class Oracle {
|
|
|
213
210
|
return witness.toNoirRepresentation();
|
|
214
211
|
}
|
|
215
212
|
|
|
216
|
-
|
|
213
|
+
// eslint-disable-next-line camelcase
|
|
214
|
+
async aztec_utl_getPublicDataWitness(
|
|
217
215
|
[blockHash]: ACVMField[],
|
|
218
216
|
[leafSlot]: ACVMField[],
|
|
219
217
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
220
218
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
221
219
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
222
220
|
|
|
223
|
-
const witness = await this.handlerAsUtility().
|
|
221
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
224
222
|
if (!witness) {
|
|
225
223
|
throw new Error(
|
|
226
224
|
`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -229,28 +227,31 @@ export class Oracle {
|
|
|
229
227
|
return witness.toNoirRepresentation();
|
|
230
228
|
}
|
|
231
229
|
|
|
232
|
-
|
|
230
|
+
// eslint-disable-next-line camelcase
|
|
231
|
+
async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
233
232
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
234
233
|
|
|
235
|
-
const header = await this.handlerAsUtility().
|
|
234
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
236
235
|
if (!header) {
|
|
237
236
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
238
237
|
}
|
|
239
238
|
return header.toFields().map(toACVMField);
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
243
243
|
const messageHashField = Fr.fromString(messageHash);
|
|
244
|
-
const witness = await this.handlerAsUtility().
|
|
244
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
245
245
|
if (!witness) {
|
|
246
246
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
247
247
|
}
|
|
248
248
|
return [witness.map(toACVMField)];
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
// eslint-disable-next-line camelcase
|
|
252
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
252
253
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
253
|
-
const result = await this.handlerAsUtility().
|
|
254
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
254
255
|
|
|
255
256
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
256
257
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
@@ -263,7 +264,8 @@ export class Oracle {
|
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
|
|
267
|
+
// eslint-disable-next-line camelcase
|
|
268
|
+
async aztec_utl_getNotes(
|
|
267
269
|
[ownerSome]: ACVMField[],
|
|
268
270
|
[ownerValue]: ACVMField[],
|
|
269
271
|
[storageSlot]: ACVMField[],
|
|
@@ -285,7 +287,7 @@ export class Oracle {
|
|
|
285
287
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
286
288
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
287
289
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
288
|
-
const noteDatas = await this.handlerAsUtility().
|
|
290
|
+
const noteDatas = await this.handlerAsUtility().getNotes(
|
|
289
291
|
owner,
|
|
290
292
|
Fr.fromString(storageSlot),
|
|
291
293
|
+numSelects,
|
|
@@ -324,7 +326,8 @@ export class Oracle {
|
|
|
324
326
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
325
327
|
}
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
// eslint-disable-next-line camelcase
|
|
330
|
+
aztec_prv_notifyCreatedNote(
|
|
328
331
|
[owner]: ACVMField[],
|
|
329
332
|
[storageSlot]: ACVMField[],
|
|
330
333
|
[randomness]: ACVMField[],
|
|
@@ -333,7 +336,7 @@ export class Oracle {
|
|
|
333
336
|
[noteHash]: ACVMField[],
|
|
334
337
|
[counter]: ACVMField[],
|
|
335
338
|
): Promise<ACVMField[]> {
|
|
336
|
-
this.handlerAsPrivate().
|
|
339
|
+
this.handlerAsPrivate().notifyCreatedNote(
|
|
337
340
|
AztecAddress.fromString(owner),
|
|
338
341
|
Fr.fromString(storageSlot),
|
|
339
342
|
Fr.fromString(randomness),
|
|
@@ -345,43 +348,47 @@ export class Oracle {
|
|
|
345
348
|
return Promise.resolve([]);
|
|
346
349
|
}
|
|
347
350
|
|
|
348
|
-
|
|
351
|
+
// eslint-disable-next-line camelcase
|
|
352
|
+
async aztec_prv_notifyNullifiedNote(
|
|
349
353
|
[innerNullifier]: ACVMField[],
|
|
350
354
|
[noteHash]: ACVMField[],
|
|
351
355
|
[counter]: ACVMField[],
|
|
352
356
|
): Promise<ACVMField[]> {
|
|
353
|
-
await this.handlerAsPrivate().
|
|
354
|
-
Fr.fromString(innerNullifier),
|
|
355
|
-
Fr.fromString(noteHash),
|
|
356
|
-
+counter,
|
|
357
|
-
);
|
|
357
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
358
358
|
return [];
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
// eslint-disable-next-line camelcase
|
|
362
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
363
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
363
364
|
return [];
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
|
|
367
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_prv_isNullifierPending(
|
|
369
|
+
[innerNullifier]: ACVMField[],
|
|
370
|
+
[contractAddress]: ACVMField[],
|
|
371
|
+
): Promise<ACVMField[]> {
|
|
372
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(
|
|
368
373
|
Fr.fromString(innerNullifier),
|
|
369
374
|
AztecAddress.fromString(contractAddress),
|
|
370
375
|
);
|
|
371
376
|
return [toACVMField(isPending)];
|
|
372
377
|
}
|
|
373
378
|
|
|
374
|
-
|
|
375
|
-
|
|
379
|
+
// eslint-disable-next-line camelcase
|
|
380
|
+
async aztec_utl_checkNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
381
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
376
382
|
return [toACVMField(exists)];
|
|
377
383
|
}
|
|
378
384
|
|
|
379
|
-
|
|
385
|
+
// eslint-disable-next-line camelcase
|
|
386
|
+
async aztec_utl_getL1ToL2MembershipWitness(
|
|
380
387
|
[contractAddress]: ACVMField[],
|
|
381
388
|
[messageHash]: ACVMField[],
|
|
382
389
|
[secret]: ACVMField[],
|
|
383
390
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
384
|
-
const message = await this.handlerAsUtility().
|
|
391
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
|
|
385
392
|
AztecAddress.fromString(contractAddress),
|
|
386
393
|
Fr.fromString(messageHash),
|
|
387
394
|
Fr.fromString(secret),
|
|
@@ -389,13 +396,14 @@ export class Oracle {
|
|
|
389
396
|
return message.toNoirRepresentation();
|
|
390
397
|
}
|
|
391
398
|
|
|
392
|
-
|
|
399
|
+
// eslint-disable-next-line camelcase
|
|
400
|
+
async aztec_utl_storageRead(
|
|
393
401
|
[blockHash]: ACVMField[],
|
|
394
402
|
[contractAddress]: ACVMField[],
|
|
395
403
|
[startStorageSlot]: ACVMField[],
|
|
396
404
|
[numberOfElements]: ACVMField[],
|
|
397
405
|
): Promise<ACVMField[][]> {
|
|
398
|
-
const values = await this.handlerAsUtility().
|
|
406
|
+
const values = await this.handlerAsUtility().storageRead(
|
|
399
407
|
BlockHash.fromString(blockHash),
|
|
400
408
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
401
409
|
Fr.fromString(startStorageSlot),
|
|
@@ -404,7 +412,8 @@ export class Oracle {
|
|
|
404
412
|
return [values.map(toACVMField)];
|
|
405
413
|
}
|
|
406
414
|
|
|
407
|
-
|
|
415
|
+
// eslint-disable-next-line camelcase
|
|
416
|
+
aztec_prv_notifyCreatedContractClassLog(
|
|
408
417
|
[contractAddress]: ACVMField[],
|
|
409
418
|
message: ACVMField[],
|
|
410
419
|
[length]: ACVMField[],
|
|
@@ -413,11 +422,12 @@ export class Oracle {
|
|
|
413
422
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
414
423
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
415
424
|
|
|
416
|
-
this.handlerAsPrivate().
|
|
425
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
417
426
|
return Promise.resolve([]);
|
|
418
427
|
}
|
|
419
428
|
|
|
420
|
-
|
|
429
|
+
// eslint-disable-next-line camelcase
|
|
430
|
+
async aztec_utl_log(
|
|
421
431
|
level: ACVMField[],
|
|
422
432
|
message: ACVMField[],
|
|
423
433
|
_ignoredFieldsSize: ACVMField[],
|
|
@@ -426,20 +436,21 @@ export class Oracle {
|
|
|
426
436
|
const levelFr = Fr.fromString(level[0]);
|
|
427
437
|
const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
428
438
|
const fieldsFr = fields.map(Fr.fromString);
|
|
429
|
-
await this.handlerAsMisc().
|
|
439
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
430
440
|
return [];
|
|
431
441
|
}
|
|
432
442
|
|
|
433
443
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
434
444
|
// change the name here.
|
|
435
|
-
|
|
445
|
+
// eslint-disable-next-line camelcase
|
|
446
|
+
async aztec_prv_callPrivateFunction(
|
|
436
447
|
[contractAddress]: ACVMField[],
|
|
437
448
|
[functionSelector]: ACVMField[],
|
|
438
449
|
[argsHash]: ACVMField[],
|
|
439
450
|
[sideEffectCounter]: ACVMField[],
|
|
440
451
|
[isStaticCall]: ACVMField[],
|
|
441
452
|
): Promise<ACVMField[][]> {
|
|
442
|
-
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().
|
|
453
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
|
|
443
454
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
444
455
|
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
445
456
|
Fr.fromString(argsHash),
|
|
@@ -449,13 +460,14 @@ export class Oracle {
|
|
|
449
460
|
return [[endSideEffectCounter, returnsHash].map(toACVMField)];
|
|
450
461
|
}
|
|
451
462
|
|
|
452
|
-
|
|
463
|
+
// eslint-disable-next-line camelcase
|
|
464
|
+
async aztec_prv_notifyEnqueuedPublicFunctionCall(
|
|
453
465
|
[contractAddress]: ACVMField[],
|
|
454
466
|
[calldataHash]: ACVMField[],
|
|
455
467
|
[sideEffectCounter]: ACVMField[],
|
|
456
468
|
[isStaticCall]: ACVMField[],
|
|
457
469
|
): Promise<ACVMField[]> {
|
|
458
|
-
await this.handlerAsPrivate().
|
|
470
|
+
await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(
|
|
459
471
|
AztecAddress.fromString(contractAddress),
|
|
460
472
|
Fr.fromString(calldataHash),
|
|
461
473
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
@@ -464,13 +476,14 @@ export class Oracle {
|
|
|
464
476
|
return [];
|
|
465
477
|
}
|
|
466
478
|
|
|
467
|
-
|
|
479
|
+
// eslint-disable-next-line camelcase
|
|
480
|
+
async aztec_prv_notifySetPublicTeardownFunctionCall(
|
|
468
481
|
[contractAddress]: ACVMField[],
|
|
469
482
|
[calldataHash]: ACVMField[],
|
|
470
483
|
[sideEffectCounter]: ACVMField[],
|
|
471
484
|
[isStaticCall]: ACVMField[],
|
|
472
485
|
): Promise<ACVMField[]> {
|
|
473
|
-
await this.handlerAsPrivate().
|
|
486
|
+
await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(
|
|
474
487
|
AztecAddress.fromString(contractAddress),
|
|
475
488
|
Fr.fromString(calldataHash),
|
|
476
489
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
@@ -479,41 +492,46 @@ export class Oracle {
|
|
|
479
492
|
return [];
|
|
480
493
|
}
|
|
481
494
|
|
|
482
|
-
|
|
495
|
+
// eslint-disable-next-line camelcase
|
|
496
|
+
async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
|
|
483
497
|
ACVMField[]
|
|
484
498
|
> {
|
|
485
|
-
await this.handlerAsPrivate().
|
|
499
|
+
await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(
|
|
486
500
|
Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
|
|
487
501
|
);
|
|
488
502
|
return Promise.resolve([]);
|
|
489
503
|
}
|
|
490
504
|
|
|
491
|
-
|
|
492
|
-
|
|
505
|
+
// eslint-disable-next-line camelcase
|
|
506
|
+
async aztec_prv_isSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
507
|
+
const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(
|
|
493
508
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
494
509
|
);
|
|
495
510
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
496
511
|
}
|
|
497
512
|
|
|
498
|
-
|
|
499
|
-
|
|
513
|
+
// eslint-disable-next-line camelcase
|
|
514
|
+
async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
515
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
|
|
500
516
|
AztecAddress.fromString(sender),
|
|
501
517
|
AztecAddress.fromString(recipient),
|
|
502
518
|
);
|
|
503
519
|
return [toACVMField(tag.value)];
|
|
504
520
|
}
|
|
505
521
|
|
|
506
|
-
|
|
507
|
-
|
|
522
|
+
// eslint-disable-next-line camelcase
|
|
523
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
524
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
508
525
|
return [];
|
|
509
526
|
}
|
|
510
527
|
|
|
511
|
-
|
|
528
|
+
// eslint-disable-next-line camelcase
|
|
529
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
512
530
|
[contractAddress]: ACVMField[],
|
|
513
531
|
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
514
532
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
515
533
|
): Promise<ACVMField[]> {
|
|
516
|
-
await this.handlerAsUtility().
|
|
534
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
517
535
|
AztecAddress.fromString(contractAddress),
|
|
518
536
|
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
519
537
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
@@ -522,12 +540,13 @@ export class Oracle {
|
|
|
522
540
|
return [];
|
|
523
541
|
}
|
|
524
542
|
|
|
525
|
-
|
|
543
|
+
// eslint-disable-next-line camelcase
|
|
544
|
+
async aztec_utl_bulkRetrieveLogs(
|
|
526
545
|
[contractAddress]: ACVMField[],
|
|
527
546
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
528
547
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
529
548
|
): Promise<ACVMField[]> {
|
|
530
|
-
await this.handlerAsUtility().
|
|
549
|
+
await this.handlerAsUtility().bulkRetrieveLogs(
|
|
531
550
|
AztecAddress.fromString(contractAddress),
|
|
532
551
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
533
552
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
@@ -535,12 +554,13 @@ export class Oracle {
|
|
|
535
554
|
return [];
|
|
536
555
|
}
|
|
537
556
|
|
|
538
|
-
|
|
557
|
+
// eslint-disable-next-line camelcase
|
|
558
|
+
async aztec_utl_storeCapsule(
|
|
539
559
|
[contractAddress]: ACVMField[],
|
|
540
560
|
[slot]: ACVMField[],
|
|
541
561
|
capsule: ACVMField[],
|
|
542
562
|
): Promise<ACVMField[]> {
|
|
543
|
-
await this.handlerAsUtility().
|
|
563
|
+
await this.handlerAsUtility().storeCapsule(
|
|
544
564
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
545
565
|
Fr.fromString(slot),
|
|
546
566
|
capsule.map(Fr.fromString),
|
|
@@ -548,12 +568,13 @@ export class Oracle {
|
|
|
548
568
|
return [];
|
|
549
569
|
}
|
|
550
570
|
|
|
551
|
-
|
|
571
|
+
// eslint-disable-next-line camelcase
|
|
572
|
+
async aztec_utl_loadCapsule(
|
|
552
573
|
[contractAddress]: ACVMField[],
|
|
553
574
|
[slot]: ACVMField[],
|
|
554
575
|
[tSize]: ACVMField[],
|
|
555
576
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
556
|
-
const values = await this.handlerAsUtility().
|
|
577
|
+
const values = await this.handlerAsUtility().loadCapsule(
|
|
557
578
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
558
579
|
Fr.fromString(slot),
|
|
559
580
|
);
|
|
@@ -569,21 +590,23 @@ export class Oracle {
|
|
|
569
590
|
}
|
|
570
591
|
}
|
|
571
592
|
|
|
572
|
-
|
|
573
|
-
|
|
593
|
+
// eslint-disable-next-line camelcase
|
|
594
|
+
async aztec_utl_deleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
595
|
+
await this.handlerAsUtility().deleteCapsule(
|
|
574
596
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
575
597
|
Fr.fromString(slot),
|
|
576
598
|
);
|
|
577
599
|
return [];
|
|
578
600
|
}
|
|
579
601
|
|
|
580
|
-
|
|
602
|
+
// eslint-disable-next-line camelcase
|
|
603
|
+
async aztec_utl_copyCapsule(
|
|
581
604
|
[contractAddress]: ACVMField[],
|
|
582
605
|
[srcSlot]: ACVMField[],
|
|
583
606
|
[dstSlot]: ACVMField[],
|
|
584
607
|
[numEntries]: ACVMField[],
|
|
585
608
|
): Promise<ACVMField[]> {
|
|
586
|
-
await this.handlerAsUtility().
|
|
609
|
+
await this.handlerAsUtility().copyCapsule(
|
|
587
610
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
588
611
|
Fr.fromString(srcSlot),
|
|
589
612
|
Fr.fromString(dstSlot),
|
|
@@ -592,7 +615,8 @@ export class Oracle {
|
|
|
592
615
|
return [];
|
|
593
616
|
}
|
|
594
617
|
|
|
595
|
-
|
|
618
|
+
// eslint-disable-next-line camelcase
|
|
619
|
+
async aztec_utl_aes128Decrypt(
|
|
596
620
|
ciphertextBVecStorage: ACVMField[],
|
|
597
621
|
[ciphertextLength]: ACVMField[],
|
|
598
622
|
iv: ACVMField[],
|
|
@@ -602,36 +626,40 @@ export class Oracle {
|
|
|
602
626
|
const ivBuffer = fromUintArray(iv, 8);
|
|
603
627
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
604
628
|
|
|
605
|
-
const plaintext = await this.handlerAsUtility().
|
|
629
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
606
630
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
607
631
|
}
|
|
608
632
|
|
|
609
|
-
|
|
633
|
+
// eslint-disable-next-line camelcase
|
|
634
|
+
async aztec_utl_getSharedSecret(
|
|
610
635
|
[address]: ACVMField[],
|
|
611
636
|
[ephPKField0]: ACVMField[],
|
|
612
637
|
[ephPKField1]: ACVMField[],
|
|
613
638
|
[ephPKField2]: ACVMField[],
|
|
614
639
|
): Promise<ACVMField[]> {
|
|
615
|
-
const secret = await this.handlerAsUtility().
|
|
640
|
+
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
616
641
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
617
642
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
618
643
|
);
|
|
619
644
|
return secret.toFields().map(toACVMField);
|
|
620
645
|
}
|
|
621
646
|
|
|
622
|
-
|
|
623
|
-
|
|
647
|
+
// eslint-disable-next-line camelcase
|
|
648
|
+
async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
|
|
649
|
+
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
624
650
|
return [];
|
|
625
651
|
}
|
|
626
652
|
|
|
627
|
-
|
|
628
|
-
|
|
653
|
+
// eslint-disable-next-line camelcase
|
|
654
|
+
async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
|
|
655
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
629
656
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
630
657
|
return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
|
|
631
658
|
}
|
|
632
659
|
|
|
633
|
-
|
|
634
|
-
|
|
660
|
+
// eslint-disable-next-line camelcase
|
|
661
|
+
async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
|
|
662
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
635
663
|
return [];
|
|
636
664
|
}
|
|
637
665
|
}
|
|
@@ -76,7 +76,7 @@ export async function executePrivateFunction(
|
|
|
76
76
|
|
|
77
77
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
78
78
|
|
|
79
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
79
|
+
const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
|
|
80
80
|
|
|
81
81
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
82
82
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|