@aztec/pxe 0.0.1-commit.f5d02921e → 0.0.1-commit.f650c0a5c
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.js +4 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +3 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +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 +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +13 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +10 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +13 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +98 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +2 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +9 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +25 -12
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +102 -34
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +9 -2
- package/dest/contract_sync/contract_sync_service.d.ts +4 -6
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +7 -27
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.d.ts +3 -3
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +2 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -2
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -2
- package/dest/logs/log_service.d.ts +4 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +11 -20
- package/dest/notes/note_service.d.ts +3 -4
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/pxe.d.ts +4 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +4 -4
- package/dest/storage/capsule_store/capsule_service.d.ts +2 -3
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/contract_function_simulator/contract_function_simulator.ts +2 -3
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- 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 +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -1
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +7 -1
- package/src/contract_function_simulator/oracle/oracle.ts +143 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +12 -3
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +164 -63
- package/src/contract_function_simulator/pick_notes.ts +9 -2
- package/src/contract_sync/contract_sync_service.ts +15 -37
- package/src/contract_sync/helpers.ts +2 -3
- package/src/debug/pxe_debug_utils.ts +3 -3
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +2 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +2 -3
- package/src/entrypoints/pxe_creation_options.ts +7 -0
- package/src/entrypoints/server/index.ts +1 -2
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/logs/log_service.ts +19 -50
- package/src/notes/note_service.ts +2 -3
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/pxe.ts +8 -10
- package/src/storage/capsule_store/capsule_service.ts +5 -6
- package/src/storage/note_store/note_store.ts +2 -5
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/src/access_scopes.ts +0 -9
|
@@ -11,7 +11,8 @@ import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from
|
|
|
11
11
|
import { EventService } from '../../events/event_service.js';
|
|
12
12
|
import { LogService } from '../../logs/log_service.js';
|
|
13
13
|
import { NoteService } from '../../notes/note_service.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
|
|
15
|
+
import { EphemeralArrayService } from '../ephemeral_array_service.js';
|
|
15
16
|
import { EventValidationRequest } from '../noir-structs/event_validation_request.js';
|
|
16
17
|
import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
|
|
17
18
|
import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
@@ -27,6 +28,9 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
27
28
|
contractLogger;
|
|
28
29
|
aztecnrLogger;
|
|
29
30
|
offchainEffects = [];
|
|
31
|
+
ephemeralArrayService = new EphemeralArrayService();
|
|
32
|
+
// We store oracle version to be able to show a nice error message when an oracle handler is missing.
|
|
33
|
+
contractOracleVersion;
|
|
30
34
|
contractAddress;
|
|
31
35
|
authWitnesses;
|
|
32
36
|
capsules;
|
|
@@ -65,7 +69,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
65
69
|
this.logger = args.log ?? createLogger('simulator:client_view_context');
|
|
66
70
|
this.scopes = args.scopes;
|
|
67
71
|
}
|
|
68
|
-
assertCompatibleOracleVersion(
|
|
72
|
+
assertCompatibleOracleVersion(major, minor) {
|
|
69
73
|
// TODO(F-416): Remove this hack on v5 when protocol contracts are redeployed.
|
|
70
74
|
// Protocol contracts/canonical contracts shipped with committed bytecode that cannot be changed. Assert they use
|
|
71
75
|
// the expected pinned version or the current one. We want to allow for both the pinned and the current versions
|
|
@@ -73,16 +77,29 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
73
77
|
// pinned contracts (like e.g. next)
|
|
74
78
|
const LEGACY_ORACLE_VERSION = 12;
|
|
75
79
|
if (isProtocolContract(this.contractAddress)) {
|
|
76
|
-
if (
|
|
77
|
-
const hint =
|
|
78
|
-
throw new Error(`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${LEGACY_ORACLE_VERSION} or ${
|
|
80
|
+
if (major !== LEGACY_ORACLE_VERSION && major !== ORACLE_VERSION_MAJOR) {
|
|
81
|
+
const hint = major > ORACLE_VERSION_MAJOR ? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.' : 'The contract was compiled with an older version of Aztec.nr than your private environment supports. Recompile the contract with a compatible version of Aztec.nr.';
|
|
82
|
+
throw new Error(`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${LEGACY_ORACLE_VERSION} or ${ORACLE_VERSION_MAJOR}, got ${major})`);
|
|
79
83
|
}
|
|
84
|
+
this.contractOracleVersion = {
|
|
85
|
+
major,
|
|
86
|
+
minor
|
|
87
|
+
};
|
|
80
88
|
return;
|
|
81
89
|
}
|
|
82
|
-
if (
|
|
83
|
-
const hint =
|
|
84
|
-
throw new Error(`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${
|
|
90
|
+
if (major !== ORACLE_VERSION_MAJOR) {
|
|
91
|
+
const hint = major > ORACLE_VERSION_MAJOR ? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.' : 'The contract was compiled with an older version of Aztec.nr than your private environment supports. Recompile the contract with a compatible version of Aztec.nr.';
|
|
92
|
+
throw new Error(`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${ORACLE_VERSION_MAJOR}, got ${major})`);
|
|
85
93
|
}
|
|
94
|
+
// Major matches - store both major and minor for later diagnostics (e.g. when an oracle is not found)
|
|
95
|
+
this.contractOracleVersion = {
|
|
96
|
+
major,
|
|
97
|
+
minor
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
|
|
101
|
+
nonOracleFunctionGetContractOracleVersion() {
|
|
102
|
+
return this.contractOracleVersion;
|
|
86
103
|
}
|
|
87
104
|
getRandomField() {
|
|
88
105
|
return Fr.random();
|
|
@@ -97,18 +114,15 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
97
114
|
* @throws If the keys are not registered in the key store.
|
|
98
115
|
* @throws If scopes are defined and the account is not in the scopes.
|
|
99
116
|
*/ async getKeyValidationRequest(pkMHash) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
|
|
105
|
-
hasAccess = true;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (!hasAccess) {
|
|
109
|
-
throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
|
|
117
|
+
let hasAccess = false;
|
|
118
|
+
for(let i = 0; i < this.scopes.length && !hasAccess; i++){
|
|
119
|
+
if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
|
|
120
|
+
hasAccess = true;
|
|
110
121
|
}
|
|
111
122
|
}
|
|
123
|
+
if (!hasAccess) {
|
|
124
|
+
throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
|
|
125
|
+
}
|
|
112
126
|
return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
113
127
|
}
|
|
114
128
|
/**
|
|
@@ -333,28 +347,46 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
333
347
|
const logger = kind == 'aztecnr' ? await this.#getAztecnrLogger() : await this.#getContractLogger();
|
|
334
348
|
logContractMessage(logger, LogLevels[level], strippedMessage, fields);
|
|
335
349
|
}
|
|
350
|
+
// Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
336
351
|
async getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot, scope) {
|
|
337
|
-
const logService =
|
|
338
|
-
await logService.fetchTaggedLogs(this.contractAddress,
|
|
352
|
+
const logService = this.#createLogService();
|
|
353
|
+
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope);
|
|
354
|
+
await this.capsuleService.appendToCapsuleArray(this.contractAddress, pendingTaggedLogArrayBaseSlot, logs.map((log)=>log.toFields()), this.jobId, scope);
|
|
355
|
+
}
|
|
356
|
+
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns its base slot. */ async getPendingTaggedLogsV2(scope) {
|
|
357
|
+
const logService = this.#createLogService();
|
|
358
|
+
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope);
|
|
359
|
+
return this.ephemeralArrayService.newArray(logs.map((log)=>log.toFields()));
|
|
360
|
+
}
|
|
361
|
+
#createLogService() {
|
|
362
|
+
return new LogService(this.aztecNode, this.anchorBlockHeader, this.keyStore, this.recipientTaggingStore, this.senderAddressBookStore, this.addressStore, this.jobId, this.logger.getBindings());
|
|
339
363
|
}
|
|
340
364
|
/**
|
|
341
|
-
*
|
|
342
|
-
* `enqueue_event_for_validation`, inserting them into the note database and event store respectively, making them
|
|
343
|
-
* queryable via `get_notes` and `getPrivateEvents`.
|
|
365
|
+
* Legacy: validates note/event requests stored in capsule arrays.
|
|
344
366
|
*
|
|
345
|
-
*
|
|
346
|
-
* @param contractAddress - The address of the contract that the logs are tagged for.
|
|
347
|
-
* @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
|
|
348
|
-
* @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
|
|
367
|
+
* Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
349
368
|
*/ async validateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot, maxNotePackedLen, maxEventSerializedLen, scope) {
|
|
350
369
|
// TODO(#10727): allow other contracts to store notes
|
|
351
370
|
if (!this.contractAddress.equals(contractAddress)) {
|
|
352
371
|
throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
353
372
|
}
|
|
354
|
-
// We read all note and event validation requests and process them all concurrently. This makes the process much
|
|
355
|
-
// faster as we don't need to wait for the network round-trip.
|
|
356
373
|
const noteValidationRequests = (await this.capsuleService.readCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, this.jobId, scope)).map((fields)=>NoteValidationRequest.fromFields(fields, maxNotePackedLen));
|
|
357
374
|
const eventValidationRequests = (await this.capsuleService.readCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, this.jobId, scope)).map((fields)=>EventValidationRequest.fromFields(fields, maxEventSerializedLen));
|
|
375
|
+
await this.#processValidationRequests(noteValidationRequests, eventValidationRequests, scope);
|
|
376
|
+
await this.capsuleService.setCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
377
|
+
await this.capsuleService.setCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
378
|
+
}
|
|
379
|
+
async validateAndStoreEnqueuedNotesAndEventsV2(noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot, maxNotePackedLen, maxEventSerializedLen, scope) {
|
|
380
|
+
const noteValidationRequests = this.ephemeralArrayService.readArrayAt(noteValidationRequestsArrayBaseSlot).map((fields)=>NoteValidationRequest.fromFields(fields, maxNotePackedLen));
|
|
381
|
+
const eventValidationRequests = this.ephemeralArrayService.readArrayAt(eventValidationRequestsArrayBaseSlot).map((fields)=>EventValidationRequest.fromFields(fields, maxEventSerializedLen));
|
|
382
|
+
await this.#processValidationRequests(noteValidationRequests, eventValidationRequests, scope);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Dispatches note and event validation requests to the service layer.
|
|
386
|
+
*
|
|
387
|
+
* This function is an auxiliary to support legacy (capsule backed) and new (ephemeral array backed) versions of the
|
|
388
|
+
* `validateAndStoreEnqueuedNotesAndEvents` oracle.
|
|
389
|
+
*/ async #processValidationRequests(noteValidationRequests, eventValidationRequests, scope) {
|
|
358
390
|
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
359
391
|
const noteStorePromises = noteValidationRequests.map((request)=>noteService.validateAndStoreNote(request.contractAddress, request.owner, request.storageSlot, request.randomness, request.noteNonce, request.content, request.noteHash, request.nullifier, request.txHash, scope));
|
|
360
392
|
const eventService = new EventService(this.anchorBlockHeader, this.aztecNode, this.privateEventStore, this.jobId);
|
|
@@ -363,9 +395,6 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
363
395
|
...noteStorePromises,
|
|
364
396
|
...eventStorePromises
|
|
365
397
|
]);
|
|
366
|
-
// Requests are cleared once we're done.
|
|
367
|
-
await this.capsuleService.setCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
368
|
-
await this.capsuleService.setCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
369
398
|
}
|
|
370
399
|
async getLogsByTag(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot, scope) {
|
|
371
400
|
// TODO(#10727): allow other contracts to process partial notes
|
|
@@ -375,19 +404,26 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
375
404
|
// We read all log retrieval requests and process them all concurrently. This makes the process much faster as we
|
|
376
405
|
// don't need to wait for the network round-trip.
|
|
377
406
|
const logRetrievalRequests = (await this.capsuleService.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId, scope)).map(LogRetrievalRequest.fromFields);
|
|
378
|
-
const logService =
|
|
407
|
+
const logService = this.#createLogService();
|
|
379
408
|
const maybeLogRetrievalResponses = await logService.fetchLogsByTag(contractAddress, logRetrievalRequests);
|
|
380
409
|
// Requests are cleared once we're done.
|
|
381
410
|
await this.capsuleService.setCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
382
411
|
// The responses are stored as Option<LogRetrievalResponse> in a second CapsuleArray.
|
|
383
412
|
await this.capsuleService.setCapsuleArray(contractAddress, logRetrievalResponsesArrayBaseSlot, maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption), this.jobId, scope);
|
|
384
413
|
}
|
|
414
|
+
async getLogsByTagV2(requestArrayBaseSlot) {
|
|
415
|
+
const logRetrievalRequests = this.ephemeralArrayService.readArrayAt(requestArrayBaseSlot).map(LogRetrievalRequest.fromFields);
|
|
416
|
+
const logService = this.#createLogService();
|
|
417
|
+
const maybeLogRetrievalResponses = await logService.fetchLogsByTag(this.contractAddress, logRetrievalRequests);
|
|
418
|
+
return this.ephemeralArrayService.newArray(maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption));
|
|
419
|
+
}
|
|
420
|
+
// Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
385
421
|
async getMessageContextsByTxHash(contractAddress, messageContextRequestsArrayBaseSlot, messageContextResponsesArrayBaseSlot, scope) {
|
|
386
422
|
try {
|
|
387
423
|
if (!this.contractAddress.equals(contractAddress)) {
|
|
388
424
|
throw new Error(`Got a message context request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
389
425
|
}
|
|
390
|
-
// TODO(@mverzilli): this is a prime example of where using
|
|
426
|
+
// TODO(@mverzilli): this is a prime example of where using an ephemeral array would make much more sense, we don't
|
|
391
427
|
// need scopes here, we just need a bit of shared memory to cross boundaries between Noir and TS.
|
|
392
428
|
// At the same time, we don't want to allow any global scope access other than where backwards compatibility
|
|
393
429
|
// forces us to. Hence we need the scope here to be artificial.
|
|
@@ -405,6 +441,17 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
405
441
|
await this.capsuleService.setCapsuleArray(contractAddress, messageContextRequestsArrayBaseSlot, [], this.jobId, scope);
|
|
406
442
|
}
|
|
407
443
|
}
|
|
444
|
+
/** Reads tx hash requests from an ephemeral array, resolves their contexts, and returns the response slot. */ async getMessageContextsByTxHashV2(requestArrayBaseSlot) {
|
|
445
|
+
const requestFields = this.ephemeralArrayService.readArrayAt(requestArrayBaseSlot);
|
|
446
|
+
const txHashes = requestFields.map((fields, i)=>{
|
|
447
|
+
if (fields.length !== 1) {
|
|
448
|
+
throw new Error(`Malformed message context request at index ${i}: expected 1 field (tx hash), got ${fields.length}`);
|
|
449
|
+
}
|
|
450
|
+
return fields[0];
|
|
451
|
+
});
|
|
452
|
+
const maybeMessageContexts = await this.messageContextService.getMessageContextsByTxHash(txHashes, this.anchorBlockHeader.getBlockNumber());
|
|
453
|
+
return this.ephemeralArrayService.newArray(maybeMessageContexts.map(MessageContext.toSerializedOption));
|
|
454
|
+
}
|
|
408
455
|
setCapsule(contractAddress, slot, capsule, scope) {
|
|
409
456
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
410
457
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
@@ -462,6 +509,27 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
462
509
|
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
463
510
|
return deriveAppSiloedSharedSecret(addressSecret, ephPk, this.contractAddress);
|
|
464
511
|
}
|
|
512
|
+
pushEphemeral(slot, elements) {
|
|
513
|
+
return this.ephemeralArrayService.push(slot, elements);
|
|
514
|
+
}
|
|
515
|
+
popEphemeral(slot) {
|
|
516
|
+
return this.ephemeralArrayService.pop(slot);
|
|
517
|
+
}
|
|
518
|
+
getEphemeral(slot, index) {
|
|
519
|
+
return this.ephemeralArrayService.get(slot, index);
|
|
520
|
+
}
|
|
521
|
+
setEphemeral(slot, index, elements) {
|
|
522
|
+
this.ephemeralArrayService.set(slot, index, elements);
|
|
523
|
+
}
|
|
524
|
+
getEphemeralLen(slot) {
|
|
525
|
+
return this.ephemeralArrayService.len(slot);
|
|
526
|
+
}
|
|
527
|
+
removeEphemeral(slot, index) {
|
|
528
|
+
this.ephemeralArrayService.remove(slot, index);
|
|
529
|
+
}
|
|
530
|
+
clearEphemeral(slot) {
|
|
531
|
+
this.ephemeralArrayService.clear(slot);
|
|
532
|
+
}
|
|
465
533
|
emitOffchainEffect(data) {
|
|
466
534
|
this.offchainEffects.push({
|
|
467
535
|
data,
|
|
@@ -82,4 +82,4 @@ interface ContainsNote {
|
|
|
82
82
|
*/
|
|
83
83
|
export declare function pickNotes<T extends ContainsNote>(noteDatas: T[], { selects, sorts, limit, offset }: GetOptions): T[];
|
|
84
84
|
export {};
|
|
85
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlja19ub3Rlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X2Z1bmN0aW9uX3NpbXVsYXRvci9waWNrX25vdGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssSUFBSSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFM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sRUFBRSxFQUNkLEVBQUUsT0FBWSxFQUFFLEtBQVUsRUFBRSxLQUFTLEVBQUUsTUFBVSxFQUFFLEVBQUUsVUFBVSxHQUM5RCxDQUFDLEVBQUUsQ0FJTCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick_notes.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/pick_notes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,EAAE,CAAC;IACV;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,UAAU,UAAU;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;CACZ;
|
|
1
|
+
{"version":3,"file":"pick_notes.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/pick_notes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,EAAE,CAAC;IACV;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,UAAU,UAAU;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;CACZ;AAqDD;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,YAAY,EAC9C,SAAS,EAAE,CAAC,EAAE,EACd,EAAE,OAAY,EAAE,KAAU,EAAE,KAAS,EAAE,MAAU,EAAE,EAAE,UAAU,GAC9D,CAAC,EAAE,CAIL"}
|
|
@@ -10,8 +10,15 @@ import { Comparator } from '@aztec/stdlib/note';
|
|
|
10
10
|
}({});
|
|
11
11
|
const selectPropertyFromPackedNoteContent = (noteData, selector)=>{
|
|
12
12
|
const noteValueBuffer = noteData[selector.index].toBuffer();
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Noir's PropertySelector counts offset from the LSB (last byte of the big-endian buffer),
|
|
14
|
+
// so offset=0,length=Fr.SIZE_IN_BYTES reads the entire field, and offset=0,length=1 reads the last byte.
|
|
15
|
+
const start = Fr.SIZE_IN_BYTES - selector.offset - selector.length;
|
|
16
|
+
const end = Fr.SIZE_IN_BYTES - selector.offset;
|
|
17
|
+
const noteValue = noteValueBuffer.subarray(start, end);
|
|
18
|
+
// Left-pad to Fr.SIZE_IN_BYTES so Fr.fromBuffer interprets the value correctly.
|
|
19
|
+
const padded = Buffer.alloc(Fr.SIZE_IN_BYTES);
|
|
20
|
+
noteValue.copy(padded, Fr.SIZE_IN_BYTES - noteValue.length);
|
|
21
|
+
return Fr.fromBuffer(padded);
|
|
15
22
|
};
|
|
16
23
|
const selectNotes = (noteDatas, selects)=>noteDatas.filter((noteData)=>selects.every(({ selector, value, comparator })=>{
|
|
17
24
|
const noteValueFr = selectPropertyFromPackedNoteContent(noteData.note.items, selector);
|
|
@@ -3,7 +3,6 @@ import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
7
6
|
import type { StagedStore } from '../job_coordinator/job_coordinator.js';
|
|
8
7
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
9
8
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -18,12 +17,11 @@ export declare class ContractSyncService implements StagedStore {
|
|
|
18
17
|
private aztecNode;
|
|
19
18
|
private contractStore;
|
|
20
19
|
private noteStore;
|
|
21
|
-
private getRegisteredAccounts;
|
|
22
20
|
private log;
|
|
23
21
|
readonly storeName = "contract_sync";
|
|
24
22
|
private syncedContracts;
|
|
25
23
|
private excludedFromSync;
|
|
26
|
-
constructor(aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore,
|
|
24
|
+
constructor(aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore, log: Logger);
|
|
27
25
|
/** Sets contracts that should be skipped during sync for a specific job. */
|
|
28
26
|
setExcludedFromSync(jobId: string, addresses: Set<string>): void;
|
|
29
27
|
/**
|
|
@@ -35,12 +33,12 @@ export declare class ContractSyncService implements StagedStore {
|
|
|
35
33
|
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
36
34
|
* @param scopes - Access scopes to pass through to the utility executor (affects whose account's private state is discovered).
|
|
37
35
|
*/
|
|
38
|
-
ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall, scopes:
|
|
39
|
-
/** Clears sync cache entries for the given scopes of a contract.
|
|
36
|
+
ensureContractSynced(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<any>, anchorBlockHeader: BlockHeader, jobId: string, scopes: AztecAddress[]): Promise<void>;
|
|
37
|
+
/** Clears sync cache entries for the given scopes of a contract. */
|
|
40
38
|
invalidateContractForScopes(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
41
39
|
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */
|
|
42
40
|
wipe(): void;
|
|
43
41
|
commit(jobId: string): Promise<void>;
|
|
44
42
|
discardStaged(jobId: string): Promise<void>;
|
|
45
43
|
}
|
|
46
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3luY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C,MAAM,CAAC,GAAG,IAAI,CAE/D;IAED;;;;;;;;OAQG;IACG,oBAAoB,CACxB,eAAe,EAAE,YAAY,EAC7B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EAC7E,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC,CAiBf;IAED,oEAAoE;IACpE,2BAA2B,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAKvF;IAmCD,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAGX;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAInC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1C;CA+BF"}
|
|
@@ -8,7 +8,6 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
8
8
|
aztecNode;
|
|
9
9
|
contractStore;
|
|
10
10
|
noteStore;
|
|
11
|
-
getRegisteredAccounts;
|
|
12
11
|
log;
|
|
13
12
|
storeName;
|
|
14
13
|
// Tracks contracts synced since last wipe. The cache is keyed per individual scope address
|
|
@@ -17,11 +16,10 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
17
16
|
syncedContracts;
|
|
18
17
|
// Per-job excluded contract addresses - these contracts should not be synced.
|
|
19
18
|
excludedFromSync;
|
|
20
|
-
constructor(aztecNode, contractStore, noteStore,
|
|
19
|
+
constructor(aztecNode, contractStore, noteStore, log){
|
|
21
20
|
this.aztecNode = aztecNode;
|
|
22
21
|
this.contractStore = contractStore;
|
|
23
22
|
this.noteStore = noteStore;
|
|
24
|
-
this.getRegisteredAccounts = getRegisteredAccounts;
|
|
25
23
|
this.log = log;
|
|
26
24
|
this.storeName = 'contract_sync';
|
|
27
25
|
this.syncedContracts = new Map();
|
|
@@ -45,22 +43,19 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
45
43
|
this.#startSyncIfNeeded(contractAddress, scopes, (scopesToSync)=>this.#syncContract(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopesToSync));
|
|
46
44
|
await this.#awaitSync(contractAddress, scopes);
|
|
47
45
|
}
|
|
48
|
-
/** Clears sync cache entries for the given scopes of a contract.
|
|
46
|
+
/** Clears sync cache entries for the given scopes of a contract. */ invalidateContractForScopes(contractAddress, scopes) {
|
|
49
47
|
if (scopes.length === 0) {
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
52
50
|
scopes.forEach((scope)=>this.syncedContracts.delete(toKey(contractAddress, scope)));
|
|
53
|
-
this.syncedContracts.delete(toKey(contractAddress, 'ALL_SCOPES'));
|
|
54
51
|
}
|
|
55
52
|
async #syncContract(contractAddress, functionToInvokeAfterSync, utilityExecutor, anchorBlockHeader, jobId, scopes) {
|
|
56
53
|
this.log.debug(`Syncing contract ${contractAddress}`);
|
|
57
|
-
// Resolve ALL_SCOPES to actual registered accounts, since sync_state must be called once per account.
|
|
58
|
-
const scopeAddresses = scopes === 'ALL_SCOPES' ? await this.getRegisteredAccounts() : scopes;
|
|
59
54
|
await Promise.all([
|
|
60
55
|
// Call sync_state sequentially for each scope address — each invocation synchronizes one account's private
|
|
61
56
|
// state using scoped capsule arrays.
|
|
62
57
|
(async ()=>{
|
|
63
|
-
for (const scope of
|
|
58
|
+
for (const scope of scopes){
|
|
64
59
|
await syncState(contractAddress, this.contractStore, functionToInvokeAfterSync, utilityExecutor, this.noteStore, this.aztecNode, anchorBlockHeader, jobId, scope);
|
|
65
60
|
}
|
|
66
61
|
})(),
|
|
@@ -88,8 +83,8 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
88
83
|
return !!this.excludedFromSync.get(jobId)?.has(contractAddress.toString());
|
|
89
84
|
}
|
|
90
85
|
/** If there are unsynced scopes, starts sync and stores the promise in cache with error cleanup. */ #startSyncIfNeeded(contractAddress, scopes, syncFn) {
|
|
91
|
-
const scopesToSync = this
|
|
92
|
-
const keys =
|
|
86
|
+
const scopesToSync = scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
87
|
+
const keys = scopesToSync.map((scope)=>toKey(contractAddress, scope));
|
|
93
88
|
if (keys.length === 0) {
|
|
94
89
|
return;
|
|
95
90
|
}
|
|
@@ -99,26 +94,11 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
99
94
|
});
|
|
100
95
|
keys.forEach((key)=>this.syncedContracts.set(key, promise));
|
|
101
96
|
}
|
|
102
|
-
/** Filters out scopes that are already cached, returning only those that still need syncing. */ #getScopesToSync(contractAddress, scopes) {
|
|
103
|
-
if (this.syncedContracts.has(toKey(contractAddress, 'ALL_SCOPES'))) {
|
|
104
|
-
// If we are already syncing all scopes, then return an empty list
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
if (scopes === 'ALL_SCOPES') {
|
|
108
|
-
return 'ALL_SCOPES';
|
|
109
|
-
}
|
|
110
|
-
return scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
111
|
-
}
|
|
112
97
|
/** Collects all relevant scope promises (including in-flight ones from concurrent calls) and awaits them. */ async #awaitSync(contractAddress, scopes) {
|
|
113
|
-
const promises =
|
|
98
|
+
const promises = scopes.map((scope)=>this.syncedContracts.get(toKey(contractAddress, scope))).filter((p)=>p !== undefined);
|
|
114
99
|
await Promise.all(promises);
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
|
-
function toKeys(contract, scopes) {
|
|
118
|
-
return scopes === 'ALL_SCOPES' ? [
|
|
119
|
-
toKey(contract, scopes)
|
|
120
|
-
] : scopes.map((scope)=>toKey(contract, scope));
|
|
121
|
-
}
|
|
122
102
|
function toKey(contract, scope) {
|
|
123
|
-
return
|
|
103
|
+
return `${contract.toString()}:${scope.toString()}`;
|
|
124
104
|
}
|
|
@@ -3,7 +3,6 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
3
3
|
import type { ContractInstance } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
7
6
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
8
7
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
9
8
|
/**
|
|
@@ -16,7 +15,7 @@ import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
|
16
15
|
* @returns The current class id.
|
|
17
16
|
*/
|
|
18
17
|
export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
|
|
19
|
-
export declare function syncState(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes:
|
|
18
|
+
export declare function syncState(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes: AztecAddress[]) => Promise<any>, noteStore: NoteStore, aztecNode: AztecNode, anchorBlockHeader: BlockHeader, jobId: string, scope: AztecAddress): Promise<void>;
|
|
20
19
|
/**
|
|
21
20
|
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
22
21
|
* provider (i.e. PXE's own storage).
|
|
@@ -26,4 +25,4 @@ export declare function syncState(contractAddress: AztecAddress, contractStore:
|
|
|
26
25
|
* @param header - The header of the block at which to verify the current class id.
|
|
27
26
|
*/
|
|
28
27
|
export declare function verifyCurrentClassId(contractAddress: AztecAddress, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader):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VksRUFBRSxNQUFNLEVBQUUsWUFBWSxFQUFFLEtBQUssT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUN4RixTQUFTLEVBQUUsU0FBUyxFQUNwQixTQUFTLEVBQUUsU0FBUyxFQUNwQixpQkFBaUIsRUFBRSxXQUFXLEVBQzlCLEtBQUssRUFBRSxNQUFNLEVBQ2IsS0FBSyxFQUFFLFlBQVksaUJBcUJwQjtBQUVEOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0Isb0JBQW9CLENBQ3hDLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLE1BQU0sRUFBRSxXQUFXLGlCQWFwQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/contract_sync/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/contract_sync/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,WAAW,mDAapB;AAED,wBAAsB,SAAS,CAC7B,eAAe,EAAE,YAAY,EAC7B,aAAa,EAAE,aAAa,EAC5B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACxF,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,WAAW,EAC9B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,iBAqBpB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,WAAW,iBAapB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
import type { NoteDao } from '@aztec/stdlib/note';
|
|
4
5
|
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
5
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
6
6
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
7
7
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
8
8
|
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
@@ -23,7 +23,7 @@ export declare class PXEDebugUtils {
|
|
|
23
23
|
/** Not injected through constructor since they're are co-dependant */
|
|
24
24
|
setPXEHelpers(putJobInQueue: <T>(job: (jobId: string) => Promise<T>) => Promise<T>, getSimulatorForTx: (overrides?: {
|
|
25
25
|
contracts?: ContractOverrides;
|
|
26
|
-
}) => ContractFunctionSimulator, executeUtility: (contractFunctionSimulator: ContractFunctionSimulator, call: FunctionCall, authWitnesses: AuthWitness[] | undefined, scopes:
|
|
26
|
+
}) => ContractFunctionSimulator, executeUtility: (contractFunctionSimulator: ContractFunctionSimulator, call: FunctionCall, authWitnesses: AuthWitness[] | undefined, scopes: AztecAddress[], jobId: string) => Promise<any>): void;
|
|
27
27
|
/**
|
|
28
28
|
* A debugging utility to get notes based on the provided filter.
|
|
29
29
|
*
|
|
@@ -42,4 +42,4 @@ export declare class PXEDebugUtils {
|
|
|
42
42
|
*/
|
|
43
43
|
sync(): Promise<void>;
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlX2RlYnVnX3V0aWxzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGVidWcvcHhlX2RlYnVnX3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLE9BQU8sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBQ2xELE9BQU8sS0FBSyxFQUFFLGlCQUF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FBYyxFQUFFLENBQ2QseUJBQXlCLEVBQUUseUJBQXlCLEVBQ3BELElBQUksRUFBRSxZQUFZLEVBQ2xCLGFBQWEsRUFBRSxXQUFXLEVBQUUsR0FBRyxTQUFTLEVBQ3hDLE1BQU0sRUFBRSxZQUFZLEVBQUUsRUFDdEIsS0FBSyxFQUFFLE1BQU0sS0FDVixPQUFPLENBQUMsR0FBRyxDQUFDLFFBS2xCO0lBRUQ7Ozs7Ozs7Ozs7T0FVRztJQUNJLFFBQVEsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQW9CdkQ7SUFFRDs7O09BR0c7SUFDSSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_debug_utils.d.ts","sourceRoot":"","sources":["../../src/debug/pxe_debug_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pxe_debug_utils.d.ts","sourceRoot":"","sources":["../../src/debug/pxe_debug_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,yBAA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1
|
export * from '../../../notes_filter.js';
|
|
3
2
|
export * from '../../../pxe.js';
|
|
4
3
|
export * from '../../../config/index.js';
|
|
@@ -7,4 +6,4 @@ export * from '../../../contract_logging.js';
|
|
|
7
6
|
export * from '../../../storage/index.js';
|
|
8
7
|
export * from './utils.js';
|
|
9
8
|
export type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvYnVuZGxlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsWUFBWSxDQUFDO0FBQzNCLFlBQVksRUFBRSxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
2
2
|
import type { PXEConfig } from '../../../config/index.js';
|
|
3
3
|
import { PXE } from '../../../pxe.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type PXECreationOptions } from '../../pxe_creation_options.js';
|
|
5
5
|
/**
|
|
6
6
|
* Create and start an PXE instance with the given AztecNode.
|
|
7
7
|
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
@@ -13,4 +13,4 @@ import type { PXECreationOptions } from '../../pxe_creation_options.js';
|
|
|
13
13
|
* @returns A Promise that resolves to the started PXE instance.
|
|
14
14
|
*/
|
|
15
15
|
export declare function createPXE(aztecNode: AztecNode, config: PXEConfig, options?: PXECreationOptions): Promise<PXE>;
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvYnVuZGxlL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzFELE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUV0QyxPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBeUIsTUFBTSwrQkFBK0IsQ0FBQztBQUUvRjs7Ozs7Ozs7O0dBU0c7QUFDSCx3QkFBc0IsU0FBUyxDQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixNQUFNLEVBQUUsU0FBUyxFQUNqQixPQUFPLEdBQUUsa0JBQW9DLGdCQXNDOUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,+BAA+B,CAAC;AAE/F;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBAsC9C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
1
|
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
3
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
3
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
@@ -6,6 +5,7 @@ import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/prov
|
|
|
6
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
7
6
|
import { PXE } from '../../../pxe.js';
|
|
8
7
|
import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
8
|
+
import { isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
9
9
|
/**
|
|
10
10
|
* Create and start an PXE instance with the given AztecNode.
|
|
11
11
|
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
@@ -34,7 +34,7 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
|
34
34
|
actor
|
|
35
35
|
});
|
|
36
36
|
let prover;
|
|
37
|
-
if (options.proverOrOptions
|
|
37
|
+
if (isPrivateKernelProver(options.proverOrOptions)) {
|
|
38
38
|
prover = options.proverOrOptions;
|
|
39
39
|
} else {
|
|
40
40
|
prover = new BBBundlePrivateKernelProver(simulator, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from '../../../access_scopes.js';
|
|
2
1
|
export * from '../../../notes_filter.js';
|
|
3
2
|
export * from '../../../pxe.js';
|
|
4
3
|
export * from '../../../config/index.js';
|
|
@@ -7,4 +6,4 @@ export * from '../../../error_enriching.js';
|
|
|
7
6
|
export * from '../../../contract_logging.js';
|
|
8
7
|
export * from './utils.js';
|
|
9
8
|
export { type PXECreationOptions } from '../../pxe_creation_options.js';
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0FBYyw4QkFBOEIsQ0FBQztBQUM3QyxjQUFjLFlBQVksQ0FBQztBQUMzQixPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBRSxNQUFNLCtCQUErQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|