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