@aztec/pxe 3.0.0-devnet.2 → 3.0.0-devnet.2-patch.1
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/bin/check_oracle_version.d.ts +1 -1
- package/dest/bin/check_oracle_version.js +105 -15
- package/dest/config/index.d.ts +2 -10
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -13
- package/dest/config/package_info.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -6
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +15 -16
- package/dest/contract_function_simulator/execution_data_provider.d.ts +13 -19
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +9 -7
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +21 -13
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/hashed_values_cache.d.ts +2 -2
- package/dest/contract_function_simulator/hashed_values_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +6 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +12 -3
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +17 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +2 -4
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +10 -4
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +10 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -4
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +31 -14
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -3
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +8 -12
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +20 -7
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +13 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +5 -4
- package/dest/contract_function_simulator/pick_notes.d.ts +2 -2
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_node.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +15 -13
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +50 -25
- package/dest/entrypoints/client/bundle/index.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +13 -4
- package/dest/entrypoints/client/lazy/index.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -4
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +13 -20
- package/dest/error_enriching.d.ts +1 -1
- package/dest/events/index.d.ts +2 -0
- package/dest/events/index.d.ts.map +1 -0
- package/dest/events/index.js +1 -0
- package/dest/events/private_event_filter_validator.d.ts +8 -0
- package/dest/events/private_event_filter_validator.d.ts.map +1 -0
- package/dest/events/private_event_filter_validator.js +39 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +3 -3
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +7 -7
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +1 -1
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/index.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +4 -4
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +26 -25
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +6 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/pxe.d.ts +26 -19
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +35 -50
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -1
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/index.d.ts +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +2 -2
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -1
- package/dest/storage/capsule_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -13
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -12
- package/dest/storage/contract_data_provider/index.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/private_functions_tree.js +1 -1
- package/dest/storage/index.d.ts +1 -1
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/note_data_provider/index.d.ts +2 -2
- package/dest/storage/note_data_provider/index.d.ts.map +1 -1
- package/dest/storage/note_data_provider/index.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +8 -7
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +27 -13
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +30 -14
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +47 -25
- package/dest/storage/sync_data_provider/index.d.ts +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +3 -2
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/index.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/synchronizer/index.d.ts +1 -1
- package/dest/synchronizer/synchronizer.d.ts +3 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +2 -1
- package/dest/tagging/constants.d.ts +1 -1
- package/dest/tagging/index.d.ts +1 -1
- package/dest/tagging/siloed_tag.d.ts +2 -2
- package/dest/tagging/siloed_tag.d.ts.map +1 -1
- package/dest/tagging/siloed_tag.js +1 -1
- package/dest/tagging/tag.d.ts +2 -2
- package/dest/tagging/tag.d.ts.map +1 -1
- package/dest/tagging/tag.js +1 -1
- package/dest/tagging/utils.d.ts +1 -1
- package/package.json +20 -19
- package/src/bin/check_oracle_version.ts +130 -20
- package/src/config/index.ts +8 -23
- package/src/contract_function_simulator/contract_function_simulator.ts +23 -18
- package/src/contract_function_simulator/execution_data_provider.ts +18 -18
- package/src/contract_function_simulator/execution_note_cache.ts +22 -11
- package/src/contract_function_simulator/hashed_values_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +14 -2
- package/src/contract_function_simulator/noir-structs/utility_context.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +24 -8
- package/src/contract_function_simulator/oracle/message_load_oracle_inputs.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +21 -5
- package/src/contract_function_simulator/oracle/oracle.ts +40 -10
- package/src/contract_function_simulator/oracle/private_execution.ts +3 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +17 -4
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +22 -9
- package/src/contract_function_simulator/pick_notes.ts +1 -1
- package/src/contract_function_simulator/pxe_oracle_interface.ts +98 -59
- package/src/entrypoints/client/bundle/utils.ts +10 -4
- package/src/entrypoints/client/lazy/utils.ts +10 -5
- package/src/entrypoints/pxe_creation_options.ts +4 -1
- package/src/entrypoints/server/utils.ts +13 -31
- package/src/events/index.ts +1 -0
- package/src/events/private_event_filter_validator.ts +47 -0
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +5 -9
- package/src/private_kernel/private_kernel_execution_prover.ts +27 -31
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +4 -3
- package/src/pxe.ts +50 -75
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -1
- package/src/storage/contract_data_provider/contract_data_provider.ts +1 -18
- package/src/storage/contract_data_provider/private_functions_tree.ts +1 -1
- package/src/storage/note_data_provider/index.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +34 -15
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +69 -35
- package/src/storage/sync_data_provider/sync_data_provider.ts +2 -1
- package/src/synchronizer/synchronizer.ts +2 -1
- package/src/tagging/siloed_tag.ts +2 -2
- package/src/tagging/tag.ts +2 -2
- package/dest/storage/note_data_provider/note_dao.d.ts +0 -100
- package/dest/storage/note_data_provider/note_dao.d.ts.map +0 -1
- package/dest/storage/note_data_provider/note_dao.js +0 -102
- package/src/storage/note_data_provider/note_dao.ts +0 -154
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
2
4
|
import {
|
|
3
5
|
type ACIRCallback,
|
|
4
6
|
type ACVMField,
|
|
@@ -100,8 +102,7 @@ export class Oracle {
|
|
|
100
102
|
return Promise.resolve([toACVMField(val)]);
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
privateStoreInExecutionCache(_length: ACVMField[], values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
105
|
+
privateStoreInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
105
106
|
this.handlerAsPrivate().privateStoreInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
106
107
|
return Promise.resolve([]);
|
|
107
108
|
}
|
|
@@ -146,7 +147,7 @@ export class Oracle {
|
|
|
146
147
|
const parsedLeafValue = Fr.fromString(leafValue);
|
|
147
148
|
|
|
148
149
|
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(
|
|
149
|
-
parsedBlockNumber,
|
|
150
|
+
BlockNumber(parsedBlockNumber),
|
|
150
151
|
parsedTreeId,
|
|
151
152
|
parsedLeafValue,
|
|
152
153
|
);
|
|
@@ -166,7 +167,7 @@ export class Oracle {
|
|
|
166
167
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
167
168
|
|
|
168
169
|
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(
|
|
169
|
-
parsedBlockNumber,
|
|
170
|
+
BlockNumber(parsedBlockNumber),
|
|
170
171
|
parsedNullifier,
|
|
171
172
|
);
|
|
172
173
|
if (!witness) {
|
|
@@ -183,7 +184,7 @@ export class Oracle {
|
|
|
183
184
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
184
185
|
|
|
185
186
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(
|
|
186
|
-
parsedBlockNumber,
|
|
187
|
+
BlockNumber(parsedBlockNumber),
|
|
187
188
|
parsedNullifier,
|
|
188
189
|
);
|
|
189
190
|
if (!witness) {
|
|
@@ -201,7 +202,10 @@ export class Oracle {
|
|
|
201
202
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
202
203
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
203
204
|
|
|
204
|
-
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
205
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
206
|
+
BlockNumber(parsedBlockNumber),
|
|
207
|
+
parsedLeafSlot,
|
|
208
|
+
);
|
|
205
209
|
if (!witness) {
|
|
206
210
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
207
211
|
}
|
|
@@ -211,7 +215,7 @@ export class Oracle {
|
|
|
211
215
|
async utilityGetBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
212
216
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
213
217
|
|
|
214
|
-
const header = await this.handlerAsUtility().utilityGetBlockHeader(parsedBlockNumber);
|
|
218
|
+
const header = await this.handlerAsUtility().utilityGetBlockHeader(BlockNumber(parsedBlockNumber));
|
|
215
219
|
if (!header) {
|
|
216
220
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
217
221
|
}
|
|
@@ -236,6 +240,8 @@ export class Oracle {
|
|
|
236
240
|
}
|
|
237
241
|
|
|
238
242
|
async utilityGetNotes(
|
|
243
|
+
[ownerSome]: ACVMField[],
|
|
244
|
+
[ownerValue]: ACVMField[],
|
|
239
245
|
[storageSlot]: ACVMField[],
|
|
240
246
|
[numSelects]: ACVMField[],
|
|
241
247
|
selectByIndexes: ACVMField[],
|
|
@@ -253,7 +259,10 @@ export class Oracle {
|
|
|
253
259
|
[maxNotes]: ACVMField[],
|
|
254
260
|
[packedRetrievedNoteLength]: ACVMField[],
|
|
255
261
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
262
|
+
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
263
|
+
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
256
264
|
const noteDatas = await this.handlerAsUtility().utilityGetNotes(
|
|
265
|
+
owner,
|
|
257
266
|
Fr.fromString(storageSlot),
|
|
258
267
|
+numSelects,
|
|
259
268
|
selectByIndexes.map(s => +s),
|
|
@@ -270,7 +279,17 @@ export class Oracle {
|
|
|
270
279
|
+status,
|
|
271
280
|
);
|
|
272
281
|
|
|
273
|
-
const returnDataAsArrayOfPackedRetrievedNotes = noteDatas.map(
|
|
282
|
+
const returnDataAsArrayOfPackedRetrievedNotes = noteDatas.map(noteData =>
|
|
283
|
+
packAsRetrievedNote({
|
|
284
|
+
contractAddress: noteData.contractAddress,
|
|
285
|
+
owner: noteData.owner,
|
|
286
|
+
randomness: noteData.randomness,
|
|
287
|
+
storageSlot: noteData.storageSlot,
|
|
288
|
+
noteNonce: noteData.noteNonce,
|
|
289
|
+
index: noteData.index,
|
|
290
|
+
note: noteData.note,
|
|
291
|
+
}),
|
|
292
|
+
);
|
|
274
293
|
|
|
275
294
|
// Now we convert each sub-array to an array of ACVMField
|
|
276
295
|
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedRetrievedNotes.map(subArray =>
|
|
@@ -282,14 +301,18 @@ export class Oracle {
|
|
|
282
301
|
}
|
|
283
302
|
|
|
284
303
|
privateNotifyCreatedNote(
|
|
304
|
+
[owner]: ACVMField[],
|
|
285
305
|
[storageSlot]: ACVMField[],
|
|
306
|
+
[randomness]: ACVMField[],
|
|
286
307
|
[noteTypeId]: ACVMField[],
|
|
287
308
|
note: ACVMField[],
|
|
288
309
|
[noteHash]: ACVMField[],
|
|
289
310
|
[counter]: ACVMField[],
|
|
290
311
|
): Promise<ACVMField[]> {
|
|
291
312
|
this.handlerAsPrivate().privateNotifyCreatedNote(
|
|
313
|
+
AztecAddress.fromString(owner),
|
|
292
314
|
Fr.fromString(storageSlot),
|
|
315
|
+
Fr.fromString(randomness),
|
|
293
316
|
NoteSelector.fromField(Fr.fromString(noteTypeId)),
|
|
294
317
|
note.map(Fr.fromString),
|
|
295
318
|
Fr.fromString(noteHash),
|
|
@@ -343,7 +366,7 @@ export class Oracle {
|
|
|
343
366
|
const values = await this.handlerAsUtility().utilityStorageRead(
|
|
344
367
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
345
368
|
Fr.fromString(startStorageSlot),
|
|
346
|
-
+blockNumber,
|
|
369
|
+
BlockNumber(+blockNumber),
|
|
347
370
|
+numberOfElements,
|
|
348
371
|
);
|
|
349
372
|
return [values.map(toACVMField)];
|
|
@@ -433,6 +456,13 @@ export class Oracle {
|
|
|
433
456
|
return Promise.resolve([]);
|
|
434
457
|
}
|
|
435
458
|
|
|
459
|
+
async privateIsSideEffectCounterRevertible([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
460
|
+
const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(
|
|
461
|
+
Fr.fromString(sideEffectCounter).toNumber(),
|
|
462
|
+
);
|
|
463
|
+
return Promise.resolve([toACVMField(isRevertible)]);
|
|
464
|
+
}
|
|
465
|
+
|
|
436
466
|
async privateGetNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
437
467
|
const tag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(
|
|
438
468
|
AztecAddress.fromString(sender),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH, PRIVATE_CONTEXT_INPUTS_LENGTH } from '@aztec/constants';
|
|
2
|
-
import {
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
6
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
@@ -162,7 +163,7 @@ export async function readCurrentClassId(
|
|
|
162
163
|
contractAddress: AztecAddress,
|
|
163
164
|
instance: ContractInstance,
|
|
164
165
|
executionDataProvider: ExecutionDataProvider | AztecNode,
|
|
165
|
-
blockNumber:
|
|
166
|
+
blockNumber: BlockNumber,
|
|
166
167
|
timestamp: UInt64,
|
|
167
168
|
) {
|
|
168
169
|
const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, PRIVATE_CONTEXT_INPUTS_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
5
|
import { type CircuitSimulator, toACVMWitness } from '@aztec/simulator/client';
|
|
@@ -282,6 +282,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
282
282
|
* Real notes coming from DB will have a leafIndex which
|
|
283
283
|
* represents their index in the note hash tree.
|
|
284
284
|
*
|
|
285
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
285
286
|
* @param storageSlot - The storage slot.
|
|
286
287
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
287
288
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -295,6 +296,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
295
296
|
* @returns Array of note data.
|
|
296
297
|
*/
|
|
297
298
|
public override async utilityGetNotes(
|
|
299
|
+
owner: AztecAddress | undefined,
|
|
298
300
|
storageSlot: Fr,
|
|
299
301
|
numSelects: number,
|
|
300
302
|
selectByIndexes: number[],
|
|
@@ -311,11 +313,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
311
313
|
status: NoteStatus,
|
|
312
314
|
): Promise<NoteData[]> {
|
|
313
315
|
// Nullified pending notes are already removed from the list.
|
|
314
|
-
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, storageSlot);
|
|
316
|
+
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
315
317
|
|
|
316
318
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
317
319
|
const dbNotes = await this.executionDataProvider.getNotes(
|
|
318
320
|
this.callContext.contractAddress,
|
|
321
|
+
owner,
|
|
319
322
|
storageSlot,
|
|
320
323
|
status,
|
|
321
324
|
this.scopes,
|
|
@@ -365,15 +368,18 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
365
368
|
/**
|
|
366
369
|
* Keep track of the new note created during execution.
|
|
367
370
|
* It can be used in subsequent calls (or transactions when chaining txs is possible).
|
|
368
|
-
* @param
|
|
371
|
+
* @param owner - The owner of the note.
|
|
369
372
|
* @param storageSlot - The storage slot.
|
|
373
|
+
* @param randomness - The randomness injected into the note.
|
|
370
374
|
* @param noteTypeId - The type ID of the note.
|
|
371
375
|
* @param noteItems - The items to be included in a Note.
|
|
372
376
|
* @param noteHash - A hash of the new note.
|
|
373
377
|
* @returns
|
|
374
378
|
*/
|
|
375
379
|
public privateNotifyCreatedNote(
|
|
380
|
+
owner: AztecAddress,
|
|
376
381
|
storageSlot: Fr,
|
|
382
|
+
randomness: Fr,
|
|
377
383
|
noteTypeId: NoteSelector,
|
|
378
384
|
noteItems: Fr[],
|
|
379
385
|
noteHash: Fr,
|
|
@@ -382,6 +388,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
382
388
|
this.log.debug(`Notified of new note with inner hash ${noteHash}`, {
|
|
383
389
|
contractAddress: this.callContext.contractAddress,
|
|
384
390
|
storageSlot,
|
|
391
|
+
randomness,
|
|
385
392
|
noteTypeId,
|
|
386
393
|
counter,
|
|
387
394
|
});
|
|
@@ -390,7 +397,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
390
397
|
this.noteCache.addNewNote(
|
|
391
398
|
{
|
|
392
399
|
contractAddress: this.callContext.contractAddress,
|
|
400
|
+
owner,
|
|
393
401
|
storageSlot,
|
|
402
|
+
randomness,
|
|
394
403
|
noteNonce: Fr.ZERO, // Nonce cannot be known during private execution.
|
|
395
404
|
note,
|
|
396
405
|
siloedNullifier: undefined, // Siloed nullifier cannot be known for newly created note.
|
|
@@ -398,7 +407,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
398
407
|
},
|
|
399
408
|
counter,
|
|
400
409
|
);
|
|
401
|
-
this.newNotes.push(
|
|
410
|
+
this.newNotes.push(NoteAndSlot.from({ note, storageSlot, randomness, noteTypeId }));
|
|
402
411
|
}
|
|
403
412
|
|
|
404
413
|
/**
|
|
@@ -594,6 +603,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
594
603
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
595
604
|
}
|
|
596
605
|
|
|
606
|
+
public privateIsSideEffectCounterRevertible(sideEffectCounter: number): Promise<boolean> {
|
|
607
|
+
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
608
|
+
}
|
|
609
|
+
|
|
597
610
|
/**
|
|
598
611
|
* Derives the call context for a nested execution.
|
|
599
612
|
* @param targetContractAddress - The address of the contract being called.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
3
5
|
import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
4
6
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -70,7 +72,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
70
72
|
* @param leafValue - The leaf value
|
|
71
73
|
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
72
74
|
*/
|
|
73
|
-
public utilityGetMembershipWitness(blockNumber:
|
|
75
|
+
public utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]> {
|
|
74
76
|
return this.executionDataProvider.getMembershipWitness(blockNumber, treeId, leafValue);
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -81,7 +83,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
81
83
|
* @returns The nullifier membership witness (if found).
|
|
82
84
|
*/
|
|
83
85
|
public async utilityGetNullifierMembershipWitness(
|
|
84
|
-
blockNumber:
|
|
86
|
+
blockNumber: BlockNumber,
|
|
85
87
|
nullifier: Fr,
|
|
86
88
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
87
89
|
return await this.executionDataProvider.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -97,7 +99,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
97
99
|
* we are trying to prove non-inclusion for.
|
|
98
100
|
*/
|
|
99
101
|
public async utilityGetLowNullifierMembershipWitness(
|
|
100
|
-
blockNumber:
|
|
102
|
+
blockNumber: BlockNumber,
|
|
101
103
|
nullifier: Fr,
|
|
102
104
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
103
105
|
return await this.executionDataProvider.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -109,7 +111,10 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
109
111
|
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
110
112
|
* @returns - The witness
|
|
111
113
|
*/
|
|
112
|
-
public async utilityGetPublicDataWitness(
|
|
114
|
+
public async utilityGetPublicDataWitness(
|
|
115
|
+
blockNumber: BlockNumber,
|
|
116
|
+
leafSlot: Fr,
|
|
117
|
+
): Promise<PublicDataWitness | undefined> {
|
|
113
118
|
return await this.executionDataProvider.getPublicDataWitness(blockNumber, leafSlot);
|
|
114
119
|
}
|
|
115
120
|
|
|
@@ -118,7 +123,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
118
123
|
* @param blockNumber - The number of a block of which to get the block header.
|
|
119
124
|
* @returns Block extracted from a block with block number `blockNumber`.
|
|
120
125
|
*/
|
|
121
|
-
public async utilityGetBlockHeader(blockNumber:
|
|
126
|
+
public async utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined> {
|
|
122
127
|
const block = await this.executionDataProvider.getBlock(blockNumber);
|
|
123
128
|
if (!block) {
|
|
124
129
|
return undefined;
|
|
@@ -164,6 +169,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
164
169
|
* Real notes coming from DB will have a leafIndex which
|
|
165
170
|
* represents their index in the note hash tree.
|
|
166
171
|
*
|
|
172
|
+
* @param owner - The owner of the notes. If undefined, returns notes for all owners.
|
|
167
173
|
* @param storageSlot - The storage slot.
|
|
168
174
|
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
169
175
|
* @param selectBy - An array of indices of the fields to selects.
|
|
@@ -177,6 +183,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
177
183
|
* @returns Array of note data.
|
|
178
184
|
*/
|
|
179
185
|
public async utilityGetNotes(
|
|
186
|
+
owner: AztecAddress | undefined,
|
|
180
187
|
storageSlot: Fr,
|
|
181
188
|
numSelects: number,
|
|
182
189
|
selectByIndexes: number[],
|
|
@@ -192,7 +199,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
192
199
|
offset: number,
|
|
193
200
|
status: NoteStatus,
|
|
194
201
|
): Promise<NoteData[]> {
|
|
195
|
-
const dbNotes = await this.executionDataProvider.getNotes(
|
|
202
|
+
const dbNotes = await this.executionDataProvider.getNotes(
|
|
203
|
+
this.contractAddress,
|
|
204
|
+
owner,
|
|
205
|
+
storageSlot,
|
|
206
|
+
status,
|
|
207
|
+
this.scopes,
|
|
208
|
+
);
|
|
196
209
|
return pickNotes<NoteData>(dbNotes, {
|
|
197
210
|
selects: selectByIndexes.slice(0, numSelects).map((index, i) => ({
|
|
198
211
|
selector: { index, offset: selectByOffsets[i], length: selectByLengths[i] },
|
|
@@ -241,7 +254,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
241
254
|
public async utilityStorageRead(
|
|
242
255
|
contractAddress: AztecAddress,
|
|
243
256
|
startStorageSlot: Fr,
|
|
244
|
-
blockNumber:
|
|
257
|
+
blockNumber: BlockNumber,
|
|
245
258
|
numberOfElements: number,
|
|
246
259
|
) {
|
|
247
260
|
const values = [];
|