@aztec/pxe 0.0.1-commit.2d9cb6034 → 0.0.1-commit.2e20a94
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/config/index.d.ts +1 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +5 -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 +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +3 -2
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +26 -10
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +97 -24
- 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_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_contract_data_source.js +3 -0
- package/dest/contract_sync/contract_sync_service.d.ts +1 -1
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +35 -23
- 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/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 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -1
- 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/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/logs/log_service.d.ts +6 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +8 -20
- 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/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +4 -7
- package/dest/pxe.d.ts +2 -1
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +8 -2
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +1 -15
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/config/index.ts +2 -8
- package/src/contract_function_simulator/contract_function_simulator.ts +6 -1
- 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 +2 -1
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +160 -51
- package/src/contract_function_simulator/pick_notes.ts +9 -2
- package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
- package/src/contract_sync/contract_sync_service.ts +57 -51
- package/src/entrypoints/client/bundle/utils.ts +2 -3
- 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 -1
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/logs/log_service.ts +14 -50
- package/src/oracle_version.ts +20 -10
- package/src/private_kernel/private_kernel_execution_prover.ts +4 -9
- package/src/pxe.ts +10 -0
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +2 -14
|
@@ -9,7 +9,7 @@ import type { KeyStore } from '@aztec/key-store';
|
|
|
9
9
|
import { isProtocolContract } from '@aztec/protocol-contracts';
|
|
10
10
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
|
-
import { BlockHash } from '@aztec/stdlib/block';
|
|
12
|
+
import { BlockHash, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
13
13
|
import type { CompleteAddress, ContractInstance, PartialAddress } from '@aztec/stdlib/contract';
|
|
14
14
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
15
15
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
@@ -27,7 +27,7 @@ import { EventService } from '../../events/event_service.js';
|
|
|
27
27
|
import { LogService } from '../../logs/log_service.js';
|
|
28
28
|
import { MessageContextService } from '../../messages/message_context_service.js';
|
|
29
29
|
import { NoteService } from '../../notes/note_service.js';
|
|
30
|
-
import {
|
|
30
|
+
import { ORACLE_VERSION_MAJOR } from '../../oracle_version.js';
|
|
31
31
|
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
32
32
|
import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
|
|
33
33
|
import type { ContractStore } from '../../storage/contract_store/contract_store.js';
|
|
@@ -35,6 +35,7 @@ import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
|
35
35
|
import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
|
|
36
36
|
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
37
37
|
import type { SenderAddressBookStore } from '../../storage/tagging_store/sender_address_book_store.js';
|
|
38
|
+
import { EphemeralArrayService } from '../ephemeral_array_service.js';
|
|
38
39
|
import { EventValidationRequest } from '../noir-structs/event_validation_request.js';
|
|
39
40
|
import { LogRetrievalRequest } from '../noir-structs/log_retrieval_request.js';
|
|
40
41
|
import { LogRetrievalResponse } from '../noir-structs/log_retrieval_response.js';
|
|
@@ -62,6 +63,7 @@ export type UtilityExecutionOracleArgs = {
|
|
|
62
63
|
privateEventStore: PrivateEventStore;
|
|
63
64
|
messageContextService: MessageContextService;
|
|
64
65
|
contractSyncService: ContractSyncService;
|
|
66
|
+
l2TipsStore: L2TipsProvider;
|
|
65
67
|
jobId: string;
|
|
66
68
|
log?: ReturnType<typeof createLogger>;
|
|
67
69
|
scopes: AztecAddress[];
|
|
@@ -77,6 +79,10 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
77
79
|
private contractLogger: Logger | undefined;
|
|
78
80
|
private aztecnrLogger: Logger | undefined;
|
|
79
81
|
private offchainEffects: OffchainEffect[] = [];
|
|
82
|
+
private readonly ephemeralArrayService = new EphemeralArrayService();
|
|
83
|
+
|
|
84
|
+
// We store oracle version to be able to show a nice error message when an oracle handler is missing.
|
|
85
|
+
private contractOracleVersion: { major: number; minor: number } | undefined;
|
|
80
86
|
|
|
81
87
|
protected readonly contractAddress: AztecAddress;
|
|
82
88
|
protected readonly authWitnesses: AuthWitness[];
|
|
@@ -93,6 +99,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
93
99
|
protected readonly privateEventStore: PrivateEventStore;
|
|
94
100
|
protected readonly messageContextService: MessageContextService;
|
|
95
101
|
protected readonly contractSyncService: ContractSyncService;
|
|
102
|
+
protected readonly l2TipsStore: L2TipsProvider;
|
|
96
103
|
protected readonly jobId: string;
|
|
97
104
|
protected logger: ReturnType<typeof createLogger>;
|
|
98
105
|
protected readonly scopes: AztecAddress[];
|
|
@@ -113,12 +120,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
113
120
|
this.privateEventStore = args.privateEventStore;
|
|
114
121
|
this.messageContextService = args.messageContextService;
|
|
115
122
|
this.contractSyncService = args.contractSyncService;
|
|
123
|
+
this.l2TipsStore = args.l2TipsStore;
|
|
116
124
|
this.jobId = args.jobId;
|
|
117
125
|
this.logger = args.log ?? createLogger('simulator:client_view_context');
|
|
118
126
|
this.scopes = args.scopes;
|
|
119
127
|
}
|
|
120
128
|
|
|
121
|
-
public assertCompatibleOracleVersion(
|
|
129
|
+
public assertCompatibleOracleVersion(major: number, minor: number): void {
|
|
122
130
|
// TODO(F-416): Remove this hack on v5 when protocol contracts are redeployed.
|
|
123
131
|
// Protocol contracts/canonical contracts shipped with committed bytecode that cannot be changed. Assert they use
|
|
124
132
|
// the expected pinned version or the current one. We want to allow for both the pinned and the current versions
|
|
@@ -126,27 +134,36 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
126
134
|
// pinned contracts (like e.g. next)
|
|
127
135
|
const LEGACY_ORACLE_VERSION = 12;
|
|
128
136
|
if (isProtocolContract(this.contractAddress)) {
|
|
129
|
-
if (
|
|
137
|
+
if (major !== LEGACY_ORACLE_VERSION && major !== ORACLE_VERSION_MAJOR) {
|
|
130
138
|
const hint =
|
|
131
|
-
|
|
139
|
+
major > ORACLE_VERSION_MAJOR
|
|
132
140
|
? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.'
|
|
133
141
|
: '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.';
|
|
134
142
|
throw new Error(
|
|
135
|
-
`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${LEGACY_ORACLE_VERSION} or ${
|
|
143
|
+
`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})`,
|
|
136
144
|
);
|
|
137
145
|
}
|
|
146
|
+
this.contractOracleVersion = { major, minor };
|
|
138
147
|
return;
|
|
139
148
|
}
|
|
140
149
|
|
|
141
|
-
if (
|
|
150
|
+
if (major !== ORACLE_VERSION_MAJOR) {
|
|
142
151
|
const hint =
|
|
143
|
-
|
|
152
|
+
major > ORACLE_VERSION_MAJOR
|
|
144
153
|
? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.'
|
|
145
154
|
: '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.';
|
|
146
155
|
throw new Error(
|
|
147
|
-
`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${
|
|
156
|
+
`Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${ORACLE_VERSION_MAJOR}, got ${major})`,
|
|
148
157
|
);
|
|
149
158
|
}
|
|
159
|
+
|
|
160
|
+
// Major matches - store both major and minor for later diagnostics (e.g. when an oracle is not found)
|
|
161
|
+
this.contractOracleVersion = { major, minor };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
|
|
165
|
+
public nonOracleFunctionGetContractOracleVersion(): { major: number; minor: number } | undefined {
|
|
166
|
+
return this.contractOracleVersion;
|
|
150
167
|
}
|
|
151
168
|
|
|
152
169
|
public getRandomField(): Fr {
|
|
@@ -493,31 +510,44 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
493
510
|
logContractMessage(logger, LogLevels[level], strippedMessage, fields);
|
|
494
511
|
}
|
|
495
512
|
|
|
513
|
+
// Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
496
514
|
public async getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr, scope: AztecAddress) {
|
|
497
|
-
const logService =
|
|
515
|
+
const logService = this.#createLogService();
|
|
516
|
+
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope);
|
|
517
|
+
await this.capsuleService.appendToCapsuleArray(
|
|
518
|
+
this.contractAddress,
|
|
519
|
+
pendingTaggedLogArrayBaseSlot,
|
|
520
|
+
logs.map(log => log.toFields()),
|
|
521
|
+
this.jobId,
|
|
522
|
+
scope,
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** Fetches pending tagged logs into a freshly allocated ephemeral array and returns its base slot. */
|
|
527
|
+
public async getPendingTaggedLogsV2(scope: AztecAddress): Promise<Fr> {
|
|
528
|
+
const logService = this.#createLogService();
|
|
529
|
+
const logs = await logService.fetchTaggedLogs(this.contractAddress, scope);
|
|
530
|
+
return this.ephemeralArrayService.newArray(logs.map(log => log.toFields()));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
#createLogService(): LogService {
|
|
534
|
+
return new LogService(
|
|
498
535
|
this.aztecNode,
|
|
499
536
|
this.anchorBlockHeader,
|
|
537
|
+
this.l2TipsStore,
|
|
500
538
|
this.keyStore,
|
|
501
|
-
this.capsuleService,
|
|
502
539
|
this.recipientTaggingStore,
|
|
503
540
|
this.senderAddressBookStore,
|
|
504
541
|
this.addressStore,
|
|
505
542
|
this.jobId,
|
|
506
543
|
this.logger.getBindings(),
|
|
507
544
|
);
|
|
508
|
-
|
|
509
|
-
await logService.fetchTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, scope);
|
|
510
545
|
}
|
|
511
546
|
|
|
512
547
|
/**
|
|
513
|
-
*
|
|
514
|
-
* `enqueue_event_for_validation`, inserting them into the note database and event store respectively, making them
|
|
515
|
-
* queryable via `get_notes` and `getPrivateEvents`.
|
|
548
|
+
* Legacy: validates note/event requests stored in capsule arrays.
|
|
516
549
|
*
|
|
517
|
-
*
|
|
518
|
-
* @param contractAddress - The address of the contract that the logs are tagged for.
|
|
519
|
-
* @param noteValidationRequestsArrayBaseSlot - The base slot of capsule array containing note validation requests.
|
|
520
|
-
* @param eventValidationRequestsArrayBaseSlot - The base slot of capsule array containing event validation requests.
|
|
550
|
+
* Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
521
551
|
*/
|
|
522
552
|
public async validateAndStoreEnqueuedNotesAndEvents(
|
|
523
553
|
contractAddress: AztecAddress,
|
|
@@ -532,8 +562,6 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
532
562
|
throw new Error(`Got a note validation request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
533
563
|
}
|
|
534
564
|
|
|
535
|
-
// We read all note and event validation requests and process them all concurrently. This makes the process much
|
|
536
|
-
// faster as we don't need to wait for the network round-trip.
|
|
537
565
|
const noteValidationRequests = (
|
|
538
566
|
await this.capsuleService.readCapsuleArray(
|
|
539
567
|
contractAddress,
|
|
@@ -552,6 +580,53 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
552
580
|
)
|
|
553
581
|
).map(fields => EventValidationRequest.fromFields(fields, maxEventSerializedLen));
|
|
554
582
|
|
|
583
|
+
await this.#processValidationRequests(noteValidationRequests, eventValidationRequests, scope);
|
|
584
|
+
|
|
585
|
+
await this.capsuleService.setCapsuleArray(
|
|
586
|
+
contractAddress,
|
|
587
|
+
noteValidationRequestsArrayBaseSlot,
|
|
588
|
+
[],
|
|
589
|
+
this.jobId,
|
|
590
|
+
scope,
|
|
591
|
+
);
|
|
592
|
+
await this.capsuleService.setCapsuleArray(
|
|
593
|
+
contractAddress,
|
|
594
|
+
eventValidationRequestsArrayBaseSlot,
|
|
595
|
+
[],
|
|
596
|
+
this.jobId,
|
|
597
|
+
scope,
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
public async validateAndStoreEnqueuedNotesAndEventsV2(
|
|
602
|
+
noteValidationRequestsArrayBaseSlot: Fr,
|
|
603
|
+
eventValidationRequestsArrayBaseSlot: Fr,
|
|
604
|
+
maxNotePackedLen: number,
|
|
605
|
+
maxEventSerializedLen: number,
|
|
606
|
+
scope: AztecAddress,
|
|
607
|
+
) {
|
|
608
|
+
const noteValidationRequests = this.ephemeralArrayService
|
|
609
|
+
.readArrayAt(noteValidationRequestsArrayBaseSlot)
|
|
610
|
+
.map(fields => NoteValidationRequest.fromFields(fields, maxNotePackedLen));
|
|
611
|
+
|
|
612
|
+
const eventValidationRequests = this.ephemeralArrayService
|
|
613
|
+
.readArrayAt(eventValidationRequestsArrayBaseSlot)
|
|
614
|
+
.map(fields => EventValidationRequest.fromFields(fields, maxEventSerializedLen));
|
|
615
|
+
|
|
616
|
+
await this.#processValidationRequests(noteValidationRequests, eventValidationRequests, scope);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Dispatches note and event validation requests to the service layer.
|
|
621
|
+
*
|
|
622
|
+
* This function is an auxiliary to support legacy (capsule backed) and new (ephemeral array backed) versions of the
|
|
623
|
+
* `validateAndStoreEnqueuedNotesAndEvents` oracle.
|
|
624
|
+
*/
|
|
625
|
+
async #processValidationRequests(
|
|
626
|
+
noteValidationRequests: NoteValidationRequest[],
|
|
627
|
+
eventValidationRequests: EventValidationRequest[],
|
|
628
|
+
scope: AztecAddress,
|
|
629
|
+
) {
|
|
555
630
|
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
556
631
|
const noteStorePromises = noteValidationRequests.map(request =>
|
|
557
632
|
noteService.validateAndStoreNote(
|
|
@@ -582,22 +657,6 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
582
657
|
);
|
|
583
658
|
|
|
584
659
|
await Promise.all([...noteStorePromises, ...eventStorePromises]);
|
|
585
|
-
|
|
586
|
-
// Requests are cleared once we're done.
|
|
587
|
-
await this.capsuleService.setCapsuleArray(
|
|
588
|
-
contractAddress,
|
|
589
|
-
noteValidationRequestsArrayBaseSlot,
|
|
590
|
-
[],
|
|
591
|
-
this.jobId,
|
|
592
|
-
scope,
|
|
593
|
-
);
|
|
594
|
-
await this.capsuleService.setCapsuleArray(
|
|
595
|
-
contractAddress,
|
|
596
|
-
eventValidationRequestsArrayBaseSlot,
|
|
597
|
-
[],
|
|
598
|
-
this.jobId,
|
|
599
|
-
scope,
|
|
600
|
-
);
|
|
601
660
|
}
|
|
602
661
|
|
|
603
662
|
public async getLogsByTag(
|
|
@@ -617,18 +676,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
617
676
|
await this.capsuleService.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId, scope)
|
|
618
677
|
).map(LogRetrievalRequest.fromFields);
|
|
619
678
|
|
|
620
|
-
const logService =
|
|
621
|
-
this.aztecNode,
|
|
622
|
-
this.anchorBlockHeader,
|
|
623
|
-
this.keyStore,
|
|
624
|
-
this.capsuleService,
|
|
625
|
-
this.recipientTaggingStore,
|
|
626
|
-
this.senderAddressBookStore,
|
|
627
|
-
this.addressStore,
|
|
628
|
-
this.jobId,
|
|
629
|
-
this.logger.getBindings(),
|
|
630
|
-
);
|
|
631
|
-
|
|
679
|
+
const logService = this.#createLogService();
|
|
632
680
|
const maybeLogRetrievalResponses = await logService.fetchLogsByTag(contractAddress, logRetrievalRequests);
|
|
633
681
|
|
|
634
682
|
// Requests are cleared once we're done.
|
|
@@ -650,6 +698,18 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
650
698
|
);
|
|
651
699
|
}
|
|
652
700
|
|
|
701
|
+
public async getLogsByTagV2(requestArrayBaseSlot: Fr): Promise<Fr> {
|
|
702
|
+
const logRetrievalRequests = this.ephemeralArrayService
|
|
703
|
+
.readArrayAt(requestArrayBaseSlot)
|
|
704
|
+
.map(LogRetrievalRequest.fromFields);
|
|
705
|
+
const logService = this.#createLogService();
|
|
706
|
+
|
|
707
|
+
const maybeLogRetrievalResponses = await logService.fetchLogsByTag(this.contractAddress, logRetrievalRequests);
|
|
708
|
+
|
|
709
|
+
return this.ephemeralArrayService.newArray(maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// Deprecated, only kept for backwards compatibility until Alpha v5 rolls out.
|
|
653
713
|
public async getMessageContextsByTxHash(
|
|
654
714
|
contractAddress: AztecAddress,
|
|
655
715
|
messageContextRequestsArrayBaseSlot: Fr,
|
|
@@ -661,7 +721,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
661
721
|
throw new Error(`Got a message context request from ${contractAddress}, expected ${this.contractAddress}`);
|
|
662
722
|
}
|
|
663
723
|
|
|
664
|
-
// TODO(@mverzilli): this is a prime example of where using
|
|
724
|
+
// TODO(@mverzilli): this is a prime example of where using an ephemeral array would make much more sense, we don't
|
|
665
725
|
// need scopes here, we just need a bit of shared memory to cross boundaries between Noir and TS.
|
|
666
726
|
// At the same time, we don't want to allow any global scope access other than where backwards compatibility
|
|
667
727
|
// forces us to. Hence we need the scope here to be artificial.
|
|
@@ -705,6 +765,27 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
705
765
|
}
|
|
706
766
|
}
|
|
707
767
|
|
|
768
|
+
/** Reads tx hash requests from an ephemeral array, resolves their contexts, and returns the response slot. */
|
|
769
|
+
public async getMessageContextsByTxHashV2(requestArrayBaseSlot: Fr): Promise<Fr> {
|
|
770
|
+
const requestFields = this.ephemeralArrayService.readArrayAt(requestArrayBaseSlot);
|
|
771
|
+
|
|
772
|
+
const txHashes = requestFields.map((fields, i) => {
|
|
773
|
+
if (fields.length !== 1) {
|
|
774
|
+
throw new Error(
|
|
775
|
+
`Malformed message context request at index ${i}: expected 1 field (tx hash), got ${fields.length}`,
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
return fields[0];
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
const maybeMessageContexts = await this.messageContextService.getMessageContextsByTxHash(
|
|
782
|
+
txHashes,
|
|
783
|
+
this.anchorBlockHeader.getBlockNumber(),
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
return this.ephemeralArrayService.newArray(maybeMessageContexts.map(MessageContext.toSerializedOption));
|
|
787
|
+
}
|
|
788
|
+
|
|
708
789
|
public setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], scope: AztecAddress): void {
|
|
709
790
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
710
791
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
@@ -781,6 +862,34 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
781
862
|
return deriveAppSiloedSharedSecret(addressSecret, ephPk, this.contractAddress);
|
|
782
863
|
}
|
|
783
864
|
|
|
865
|
+
public pushEphemeral(slot: Fr, elements: Fr[]): number {
|
|
866
|
+
return this.ephemeralArrayService.push(slot, elements);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
public popEphemeral(slot: Fr): Fr[] {
|
|
870
|
+
return this.ephemeralArrayService.pop(slot);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
public getEphemeral(slot: Fr, index: number): Fr[] {
|
|
874
|
+
return this.ephemeralArrayService.get(slot, index);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
public setEphemeral(slot: Fr, index: number, elements: Fr[]): void {
|
|
878
|
+
this.ephemeralArrayService.set(slot, index, elements);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
public getEphemeralLen(slot: Fr): number {
|
|
882
|
+
return this.ephemeralArrayService.len(slot);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
public removeEphemeral(slot: Fr, index: number): void {
|
|
886
|
+
this.ephemeralArrayService.remove(slot, index);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
public clearEphemeral(slot: Fr): void {
|
|
890
|
+
this.ephemeralArrayService.clear(slot);
|
|
891
|
+
}
|
|
892
|
+
|
|
784
893
|
public emitOffchainEffect(data: Fr[]): Promise<void> {
|
|
785
894
|
this.offchainEffects.push({ data, contractAddress: this.contractAddress });
|
|
786
895
|
return Promise.resolve();
|
|
@@ -86,8 +86,15 @@ interface ContainsNote {
|
|
|
86
86
|
|
|
87
87
|
const selectPropertyFromPackedNoteContent = (noteData: Fr[], selector: PropertySelector): Fr => {
|
|
88
88
|
const noteValueBuffer = noteData[selector.index].toBuffer();
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
// Noir's PropertySelector counts offset from the LSB (last byte of the big-endian buffer),
|
|
90
|
+
// so offset=0,length=Fr.SIZE_IN_BYTES reads the entire field, and offset=0,length=1 reads the last byte.
|
|
91
|
+
const start = Fr.SIZE_IN_BYTES - selector.offset - selector.length;
|
|
92
|
+
const end = Fr.SIZE_IN_BYTES - selector.offset;
|
|
93
|
+
const noteValue = noteValueBuffer.subarray(start, end);
|
|
94
|
+
// Left-pad to Fr.SIZE_IN_BYTES so Fr.fromBuffer interprets the value correctly.
|
|
95
|
+
const padded = Buffer.alloc(Fr.SIZE_IN_BYTES);
|
|
96
|
+
noteValue.copy(padded, Fr.SIZE_IN_BYTES - noteValue.length);
|
|
97
|
+
return Fr.fromBuffer(padded);
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
const selectNotes = <T extends ContainsNote>(noteDatas: T[], selects: Select[]): T[] =>
|
|
@@ -29,6 +29,7 @@ export class ProxiedContractStoreFactory {
|
|
|
29
29
|
}
|
|
30
30
|
instance.currentContractClassId = realInstance.currentContractClassId;
|
|
31
31
|
instance.originalContractClassId = realInstance.originalContractClassId;
|
|
32
|
+
instance.initializationHash = realInstance.initializationHash;
|
|
32
33
|
return instance;
|
|
33
34
|
} else {
|
|
34
35
|
return target.getContractInstance(address);
|
|
@@ -47,6 +48,9 @@ export class ProxiedContractStoreFactory {
|
|
|
47
48
|
return fn;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Function with selector ${selector} not found in stub artifact for overridden contract at ${contractAddress}. The stub does not implement this function.`,
|
|
53
|
+
);
|
|
50
54
|
} else {
|
|
51
55
|
return target.getFunctionArtifact(contractAddress, selector);
|
|
52
56
|
}
|
|
@@ -64,6 +68,9 @@ export class ProxiedContractStoreFactory {
|
|
|
64
68
|
return fn;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
71
|
+
throw new Error(
|
|
72
|
+
`Function with selector ${selector} not found in stub artifact for overridden contract at ${contractAddress}. The stub does not implement this function.`,
|
|
73
|
+
);
|
|
67
74
|
} else {
|
|
68
75
|
return target.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
69
76
|
}
|
|
@@ -78,6 +85,6 @@ export class ProxiedContractStoreFactory {
|
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
},
|
|
81
|
-
});
|
|
88
|
+
}) satisfies ContractStore;
|
|
82
89
|
}
|
|
83
90
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { Semaphore } from '@aztec/foundation/queue';
|
|
2
3
|
import type { FunctionCall, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -9,6 +10,9 @@ import type { ContractStore } from '../storage/contract_store/contract_store.js'
|
|
|
9
10
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
11
|
import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
11
12
|
|
|
13
|
+
/** Maximum number of scope syncs running concurrently across the PXE. */
|
|
14
|
+
const MAX_CONCURRENT_SCOPE_SYNCS = 5;
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
14
18
|
* It uses a cache to avoid redundant sync operations - the cache is wiped when the anchor block changes.
|
|
@@ -26,6 +30,11 @@ export class ContractSyncService implements StagedStore {
|
|
|
26
30
|
// Per-job excluded contract addresses - these contracts should not be synced.
|
|
27
31
|
private excludedFromSync: Map<string, Set<string>> = new Map();
|
|
28
32
|
|
|
33
|
+
// Bounds the number of scope syncs running concurrently. Scopes beyond this limit queue here. Sized to trade off
|
|
34
|
+
// parallelism on non-ACIR work (node RPC, note store reads) against memory pressure from concurrent circuit
|
|
35
|
+
// execution.
|
|
36
|
+
#syncSlot = new Semaphore(MAX_CONCURRENT_SCOPE_SYNCS);
|
|
37
|
+
|
|
29
38
|
constructor(
|
|
30
39
|
private aztecNode: AztecNode,
|
|
31
40
|
private contractStore: ContractStore,
|
|
@@ -59,15 +68,22 @@ export class ContractSyncService implements StagedStore {
|
|
|
59
68
|
return;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
|
-
this.#startSyncIfNeeded(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
this.#startSyncIfNeeded(
|
|
72
|
+
contractAddress,
|
|
73
|
+
scopes,
|
|
74
|
+
() => verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader),
|
|
75
|
+
scope =>
|
|
76
|
+
syncState(
|
|
77
|
+
contractAddress,
|
|
78
|
+
this.contractStore,
|
|
79
|
+
functionToInvokeAfterSync,
|
|
80
|
+
utilityExecutor,
|
|
81
|
+
this.noteStore,
|
|
82
|
+
this.aztecNode,
|
|
83
|
+
anchorBlockHeader,
|
|
84
|
+
jobId,
|
|
85
|
+
scope,
|
|
86
|
+
),
|
|
71
87
|
);
|
|
72
88
|
|
|
73
89
|
await this.#awaitSync(contractAddress, scopes);
|
|
@@ -81,39 +97,6 @@ export class ContractSyncService implements StagedStore {
|
|
|
81
97
|
scopes.forEach(scope => this.syncedContracts.delete(toKey(contractAddress, scope)));
|
|
82
98
|
}
|
|
83
99
|
|
|
84
|
-
async #syncContract(
|
|
85
|
-
contractAddress: AztecAddress,
|
|
86
|
-
functionToInvokeAfterSync: FunctionSelector | null,
|
|
87
|
-
utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<any>,
|
|
88
|
-
anchorBlockHeader: BlockHeader,
|
|
89
|
-
jobId: string,
|
|
90
|
-
scopes: AztecAddress[],
|
|
91
|
-
): Promise<void> {
|
|
92
|
-
this.log.debug(`Syncing contract ${contractAddress}`);
|
|
93
|
-
|
|
94
|
-
await Promise.all([
|
|
95
|
-
// Call sync_state sequentially for each scope address — each invocation synchronizes one account's private
|
|
96
|
-
// state using scoped capsule arrays.
|
|
97
|
-
(async () => {
|
|
98
|
-
for (const scope of scopes) {
|
|
99
|
-
await syncState(
|
|
100
|
-
contractAddress,
|
|
101
|
-
this.contractStore,
|
|
102
|
-
functionToInvokeAfterSync,
|
|
103
|
-
utilityExecutor,
|
|
104
|
-
this.noteStore,
|
|
105
|
-
this.aztecNode,
|
|
106
|
-
anchorBlockHeader,
|
|
107
|
-
jobId,
|
|
108
|
-
scope,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
})(),
|
|
112
|
-
verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader),
|
|
113
|
-
]);
|
|
114
|
-
this.log.debug(`Contract ${contractAddress} synced`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
100
|
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */
|
|
118
101
|
wipe(): void {
|
|
119
102
|
this.log.debug(`Wiping contract sync cache (${this.syncedContracts.size} entries)`);
|
|
@@ -138,22 +121,45 @@ export class ContractSyncService implements StagedStore {
|
|
|
138
121
|
return !!this.excludedFromSync.get(jobId)?.has(contractAddress.toString());
|
|
139
122
|
}
|
|
140
123
|
|
|
141
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* If there are unsynced scopes, starts one sync per scope (bounded by #syncSlot) and stores each promise in the
|
|
126
|
+
* cache with per-scope error cleanup. The verifyFn runs once for the whole fan-out and is awaited by every new
|
|
127
|
+
* scope's promise, matching the pre-parallelization invariant that a cache-miss batch re-verifies the class id.
|
|
128
|
+
*/
|
|
142
129
|
#startSyncIfNeeded(
|
|
143
130
|
contractAddress: AztecAddress,
|
|
144
131
|
scopes: AztecAddress[],
|
|
145
|
-
|
|
132
|
+
verifyFn: () => Promise<void>,
|
|
133
|
+
syncScopeFn: (scope: AztecAddress) => Promise<void>,
|
|
146
134
|
): void {
|
|
147
135
|
const scopesToSync = scopes.filter(scope => !this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
148
|
-
|
|
149
|
-
if (keys.length === 0) {
|
|
136
|
+
if (scopesToSync.length === 0) {
|
|
150
137
|
return;
|
|
151
138
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
139
|
+
|
|
140
|
+
this.log.debug(`Syncing contract ${contractAddress} for ${scopesToSync.length} scope(s)`);
|
|
141
|
+
const verifyPromise = verifyFn();
|
|
142
|
+
|
|
143
|
+
for (const scope of scopesToSync) {
|
|
144
|
+
const key = toKey(contractAddress, scope);
|
|
145
|
+
const promise = Promise.all([verifyPromise, this.#runBounded(() => syncScopeFn(scope))])
|
|
146
|
+
.then(() => {})
|
|
147
|
+
.catch(err => {
|
|
148
|
+
this.syncedContracts.delete(key);
|
|
149
|
+
throw err;
|
|
150
|
+
});
|
|
151
|
+
this.syncedContracts.set(key, promise);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Runs fn while holding a slot in #syncSlot, bounding total concurrent scope syncs. */
|
|
156
|
+
async #runBounded<T>(fn: () => Promise<T>): Promise<T> {
|
|
157
|
+
await this.#syncSlot.acquire();
|
|
158
|
+
try {
|
|
159
|
+
return await fn();
|
|
160
|
+
} finally {
|
|
161
|
+
this.#syncSlot.release();
|
|
162
|
+
}
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
/** Collects all relevant scope promises (including in-flight ones from concurrent calls) and awaits them. */
|
|
@@ -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';
|
|
@@ -9,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
9
8
|
import type { PXEConfig } from '../../../config/index.js';
|
|
10
9
|
import { PXE } from '../../../pxe.js';
|
|
11
10
|
import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
12
|
-
import type
|
|
11
|
+
import { type PXECreationOptions, isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Create and start an PXE instance with the given AztecNode.
|
|
@@ -44,7 +43,7 @@ export async function createPXE(
|
|
|
44
43
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
|
|
45
44
|
|
|
46
45
|
let prover;
|
|
47
|
-
if (options.proverOrOptions
|
|
46
|
+
if (isPrivateKernelProver(options.proverOrOptions)) {
|
|
48
47
|
prover = options.proverOrOptions;
|
|
49
48
|
} else {
|
|
50
49
|
prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
1
|
import { BBLazyPrivateKernelProver } from '@aztec/bb-prover/client/lazy';
|
|
3
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
3
|
import { createStore } from '@aztec/kv-store/indexeddb';
|
|
@@ -9,7 +8,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
9
8
|
import type { PXEConfig } from '../../../config/index.js';
|
|
10
9
|
import { PXE } from '../../../pxe.js';
|
|
11
10
|
import { PXE_DATA_SCHEMA_VERSION } from '../../../storage/metadata.js';
|
|
12
|
-
import type
|
|
11
|
+
import { type PXECreationOptions, isPrivateKernelProver } from '../../pxe_creation_options.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Create and start an PXE instance with the given AztecNode.
|
|
@@ -44,7 +43,7 @@ export async function createPXE(
|
|
|
44
43
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:wasm:bundle', { actor });
|
|
45
44
|
|
|
46
45
|
let prover;
|
|
47
|
-
if (options.proverOrOptions
|
|
46
|
+
if (isPrivateKernelProver(options.proverOrOptions)) {
|
|
48
47
|
prover = options.proverOrOptions;
|
|
49
48
|
} else {
|
|
50
49
|
prover = new BBLazyPrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
|
@@ -12,3 +12,10 @@ export type PXECreationOptions = {
|
|
|
12
12
|
store?: AztecAsyncKVStore;
|
|
13
13
|
simulator?: CircuitSimulator;
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
/** Checks if the given value implements the PrivateKernelProver interface via duck-typing. */
|
|
17
|
+
export function isPrivateKernelProver(value: unknown): value is PrivateKernelProver {
|
|
18
|
+
return (
|
|
19
|
+
typeof value === 'object' && value !== null && typeof (value as PrivateKernelProver).createChonkProof === 'function'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -5,7 +5,7 @@ export * from '../../error_enriching.js';
|
|
|
5
5
|
export * from '../../storage/index.js';
|
|
6
6
|
export * from './utils.js';
|
|
7
7
|
export { NoteService } from '../../notes/note_service.js';
|
|
8
|
-
export {
|
|
8
|
+
export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
9
9
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
10
10
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
11
11
|
export { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
@@ -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/lmdb-v2';
|
|
@@ -10,7 +9,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
10
9
|
import type { PXEConfig } from '../../config/index.js';
|
|
11
10
|
import { PXE } from '../../pxe.js';
|
|
12
11
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
13
|
-
import type
|
|
12
|
+
import { type PXECreationOptions, isPrivateKernelProver } from '../pxe_creation_options.js';
|
|
14
13
|
|
|
15
14
|
type PXEConfigWithoutDefaults = Omit<PXEConfig, 'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'>;
|
|
16
15
|
|
|
@@ -49,7 +48,7 @@ export async function createPXE(
|
|
|
49
48
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:native', { actor });
|
|
50
49
|
|
|
51
50
|
let prover;
|
|
52
|
-
if (options.proverOrOptions
|
|
51
|
+
if (isPrivateKernelProver(options.proverOrOptions)) {
|
|
53
52
|
prover = options.proverOrOptions;
|
|
54
53
|
} else {
|
|
55
54
|
prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|