@aztec/pxe 0.0.1-commit.fff30aa → 0.0.1-dev
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 +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +10 -2
- package/dest/config/package_info.js +1 -1
- 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 +18 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +5 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +4 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +53 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -14
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +16 -14
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +19 -2
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +108 -5
- package/dest/contract_sync/contract_sync_service.d.ts +2 -1
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +41 -7
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +12 -19
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +4 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -1
- package/dest/events/event_service.d.ts +13 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +28 -7
- package/dest/hooks/authorize_utility_call.d.ts +37 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +42 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +4 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -0
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +20 -35
- package/dest/messages/message_context_service.d.ts +1 -1
- package/dest/messages/message_context_service.d.ts.map +1 -1
- package/dest/messages/message_context_service.js +12 -10
- package/dest/notes/note_service.d.ts +25 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +80 -65
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +2 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +18 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +1 -1
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -2
- package/dest/pxe.d.ts +20 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +61 -59
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +588 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/open_pxe_stores.d.ts +31 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +26 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +3 -0
- package/dest/tagging/index.d.ts +4 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +3 -2
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +158 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +19 -8
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
- package/package.json +17 -16
- package/src/bin/check_oracle_version.ts +1 -1
- package/src/block_synchronizer/block_synchronizer.ts +11 -3
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +32 -9
- package/src/contract_function_simulator/oracle/interfaces.ts +12 -1
- package/src/contract_function_simulator/oracle/oracle.ts +73 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +25 -21
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +165 -29
- package/src/contract_sync/contract_sync_service.ts +55 -23
- package/src/contract_sync/helpers.ts +11 -23
- package/src/entrypoints/client/bundle/utils.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +1 -0
- package/src/entrypoints/pxe_creation_options.ts +4 -0
- package/src/entrypoints/server/index.ts +1 -0
- package/src/entrypoints/server/utils.ts +1 -0
- package/src/events/event_service.ts +52 -17
- package/src/hooks/authorize_utility_call.ts +40 -0
- package/src/hooks/execution_hooks.ts +48 -0
- package/src/hooks/index.ts +7 -0
- package/src/logs/log_service.ts +46 -71
- package/src/messages/message_context_service.ts +25 -24
- package/src/notes/note_service.ts +115 -91
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +29 -3
- package/src/private_kernel/private_kernel_oracle.ts +15 -5
- package/src/pxe.ts +116 -53
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +42 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +707 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/open_pxe_stores.ts +47 -0
- package/src/tagging/get_all_logs_by_tags.ts +4 -0
- package/src/tagging/index.ts +3 -2
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +236 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +33 -10
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -85
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -130
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { uniqueBy } from '@aztec/foundation/collection';
|
|
1
2
|
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
2
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { LogLevels, createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { isProtocolContract } from '@aztec/protocol-contracts';
|
|
6
|
+
import { ExecutionError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
5
7
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
6
8
|
import { computeAddressSecret } from '@aztec/stdlib/keys';
|
|
7
9
|
import { MessageContext, deriveAppSiloedSharedSecret } from '@aztec/stdlib/logs';
|
|
@@ -20,6 +22,7 @@ import { NoteValidationRequest } from '../noir-structs/note_validation_request.j
|
|
|
20
22
|
import { UtilityContext } from '../noir-structs/utility_context.js';
|
|
21
23
|
import { pickNotes } from '../pick_notes.js';
|
|
22
24
|
import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
25
|
+
import { Oracle } from './oracle.js';
|
|
23
26
|
/**
|
|
24
27
|
* The oracle for an execution of utility contract functions.
|
|
25
28
|
*/ export class UtilityExecutionOracle {
|
|
@@ -50,6 +53,9 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
50
53
|
jobId;
|
|
51
54
|
logger;
|
|
52
55
|
scopes;
|
|
56
|
+
simulator;
|
|
57
|
+
hooks;
|
|
58
|
+
utilityExecutor;
|
|
53
59
|
constructor(args){
|
|
54
60
|
this.contractAddress = args.contractAddress;
|
|
55
61
|
this.authWitnesses = args.authWitnesses;
|
|
@@ -70,6 +76,9 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
70
76
|
this.jobId = args.jobId;
|
|
71
77
|
this.logger = args.log ?? createLogger('simulator:client_view_context');
|
|
72
78
|
this.scopes = args.scopes;
|
|
79
|
+
this.simulator = args.simulator;
|
|
80
|
+
this.hooks = args.hooks;
|
|
81
|
+
this.utilityExecutor = args.utilityExecutor;
|
|
73
82
|
}
|
|
74
83
|
assertCompatibleOracleVersion(major, minor) {
|
|
75
84
|
// TODO(F-416): Remove this hack on v5 when protocol contracts are redeployed.
|
|
@@ -188,6 +197,10 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
188
197
|
if (blockNumber > anchorBlockNumber) {
|
|
189
198
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
190
199
|
}
|
|
200
|
+
// Most contracts query state at the "current" block, which is the anchor. Skip the RPC when we can.
|
|
201
|
+
if (blockNumber === anchorBlockNumber) {
|
|
202
|
+
return this.anchorBlockHeader;
|
|
203
|
+
}
|
|
191
204
|
const block = await this.aztecNode.getBlock(blockNumber);
|
|
192
205
|
return block?.header;
|
|
193
206
|
}
|
|
@@ -388,13 +401,15 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
388
401
|
* This function is an auxiliary to support legacy (capsule backed) and new (ephemeral array backed) versions of the
|
|
389
402
|
* `validateAndStoreEnqueuedNotesAndEvents` oracle.
|
|
390
403
|
*/ async #processValidationRequests(noteValidationRequests, eventValidationRequests, scope) {
|
|
404
|
+
const txEffects = await this.#fetchTxEffects([
|
|
405
|
+
...noteValidationRequests.map((r)=>r.txHash),
|
|
406
|
+
...eventValidationRequests.map((r)=>r.txHash)
|
|
407
|
+
]);
|
|
391
408
|
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
|
|
392
|
-
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));
|
|
393
409
|
const eventService = new EventService(this.anchorBlockHeader, this.aztecNode, this.privateEventStore, this.jobId);
|
|
394
|
-
const eventStorePromises = eventValidationRequests.map((request)=>eventService.validateAndStoreEvent(request.contractAddress, request.eventTypeId, request.randomness, request.serializedEvent, request.eventCommitment, request.txHash, scope));
|
|
395
410
|
await Promise.all([
|
|
396
|
-
|
|
397
|
-
|
|
411
|
+
noteService.validateAndStoreNotes(noteValidationRequests, scope, txEffects),
|
|
412
|
+
eventService.validateAndStoreEvents(eventValidationRequests, scope, txEffects)
|
|
398
413
|
]);
|
|
399
414
|
}
|
|
400
415
|
async getLogsByTag(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot, scope) {
|
|
@@ -453,6 +468,19 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
453
468
|
const maybeMessageContexts = await this.messageContextService.getMessageContextsByTxHash(txHashes, this.anchorBlockHeader.getBlockNumber());
|
|
454
469
|
return this.ephemeralArrayService.newArray(maybeMessageContexts.map(MessageContext.toSerializedOption));
|
|
455
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Fetches the effects of a transaction by its hash. Returns null if the tx is not found or is beyond the anchor
|
|
473
|
+
* block.
|
|
474
|
+
*/ async getTxEffect(txHash) {
|
|
475
|
+
if (txHash.hash.isZero()) {
|
|
476
|
+
throw new Error('Invalid tx hash passed into aztec_utl_getTxEffect oracle handler');
|
|
477
|
+
}
|
|
478
|
+
const txEffect = await this.aztecNode.getTxEffect(txHash);
|
|
479
|
+
if (!txEffect || txEffect.l2BlockNumber > this.anchorBlockHeader.getBlockNumber()) {
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
return txEffect.data;
|
|
483
|
+
}
|
|
456
484
|
setCapsule(contractAddress, slot, capsule, scope) {
|
|
457
485
|
if (!contractAddress.equals(this.contractAddress)) {
|
|
458
486
|
// TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
|
|
@@ -538,10 +566,85 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
538
566
|
});
|
|
539
567
|
return Promise.resolve();
|
|
540
568
|
}
|
|
569
|
+
/** Executes another utility function from within this one and returns its serialized return values. */ async callUtilityFunction(targetContractAddress, functionSelector, args) {
|
|
570
|
+
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(targetContractAddress, functionSelector);
|
|
571
|
+
if (!targetContractAddress.equals(this.contractAddress)) {
|
|
572
|
+
const request = {
|
|
573
|
+
caller: this.contractAddress,
|
|
574
|
+
target: targetContractAddress,
|
|
575
|
+
functionSelector,
|
|
576
|
+
functionName: targetArtifact.name,
|
|
577
|
+
args,
|
|
578
|
+
callerContext: 'isPrivate' in this ? 'private' : 'utility'
|
|
579
|
+
};
|
|
580
|
+
const response = this.hooks ? await this.hooks.authorizeUtilityCall(request) : {
|
|
581
|
+
authorized: false,
|
|
582
|
+
reason: 'No execution hooks configured'
|
|
583
|
+
};
|
|
584
|
+
if (!response.authorized) {
|
|
585
|
+
const reason = response.reason ? `: ${response.reason}` : '';
|
|
586
|
+
throw new Error(`Cross-contract utility call denied${reason}. ${this.contractAddress} attempted to call ` + `${targetContractAddress}:${functionSelector} (${targetArtifact.name}). ` + `See https://docs.aztec.network/errors/11`);
|
|
587
|
+
}
|
|
588
|
+
await this.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, this.utilityExecutor, this.anchorBlockHeader, this.jobId, this.scopes);
|
|
589
|
+
}
|
|
590
|
+
this.logger.debug(`Calling nested utility function ${targetContractAddress}:${functionSelector} from ${this.contractAddress}`);
|
|
591
|
+
const nestedOracle = new UtilityExecutionOracle({
|
|
592
|
+
contractAddress: targetContractAddress,
|
|
593
|
+
authWitnesses: this.authWitnesses,
|
|
594
|
+
capsules: this.capsules,
|
|
595
|
+
anchorBlockHeader: this.anchorBlockHeader,
|
|
596
|
+
contractStore: this.contractStore,
|
|
597
|
+
noteStore: this.noteStore,
|
|
598
|
+
keyStore: this.keyStore,
|
|
599
|
+
addressStore: this.addressStore,
|
|
600
|
+
aztecNode: this.aztecNode,
|
|
601
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
602
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
603
|
+
capsuleService: this.capsuleService,
|
|
604
|
+
privateEventStore: this.privateEventStore,
|
|
605
|
+
messageContextService: this.messageContextService,
|
|
606
|
+
contractSyncService: this.contractSyncService,
|
|
607
|
+
l2TipsStore: this.l2TipsStore,
|
|
608
|
+
jobId: this.jobId,
|
|
609
|
+
scopes: this.scopes,
|
|
610
|
+
simulator: this.simulator,
|
|
611
|
+
hooks: this.hooks,
|
|
612
|
+
utilityExecutor: this.utilityExecutor,
|
|
613
|
+
log: this.logger
|
|
614
|
+
});
|
|
615
|
+
const initialWitness = toACVMWitness(0, args);
|
|
616
|
+
const acvmCallback = new Oracle(nestedOracle);
|
|
617
|
+
const acirExecutionResult = await this.simulator.executeUserCircuit(initialWitness, targetArtifact, acvmCallback.toACIRCallback()).catch((err)=>{
|
|
618
|
+
err.message = resolveAssertionMessageFromError(err, targetArtifact);
|
|
619
|
+
throw new ExecutionError(err.message, {
|
|
620
|
+
contractAddress: targetContractAddress,
|
|
621
|
+
functionSelector
|
|
622
|
+
}, extractCallStack(err, targetArtifact.debug), {
|
|
623
|
+
cause: err
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
627
|
+
}
|
|
541
628
|
/** Returns offchain effects collected during execution. */ getOffchainEffects() {
|
|
542
629
|
return this.offchainEffects;
|
|
543
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Fetches tx effects for the given hashes in parallel, deduplicating repeated hashes so each tx is only requested
|
|
633
|
+
* once. Returns a map keyed by `TxHash.toString()`; hashes for which the node has no tx effect are omitted.
|
|
634
|
+
*/ async #fetchTxEffects(txHashes) {
|
|
635
|
+
const uniqueTxHashes = uniqueBy(txHashes, (h)=>h.toString());
|
|
636
|
+
const fetched = await Promise.all(uniqueTxHashes.map((h)=>this.aztecNode.getTxEffect(h)));
|
|
637
|
+
return new Map(uniqueTxHashes.map((h, i)=>[
|
|
638
|
+
h.toString(),
|
|
639
|
+
fetched[i]
|
|
640
|
+
]).filter((entry)=>entry[1] !== undefined));
|
|
641
|
+
}
|
|
544
642
|
/** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */ async #queryWithBlockHashNotAfterAnchor(blockHash, query) {
|
|
643
|
+
// Most contracts query state at the "current" block, which is the anchor. Skip the validation when we can.
|
|
644
|
+
const anchorHash = await this.anchorBlockHeader.hash();
|
|
645
|
+
if (blockHash.equals(anchorHash)) {
|
|
646
|
+
return query();
|
|
647
|
+
}
|
|
545
648
|
const [response] = await Promise.all([
|
|
546
649
|
query(),
|
|
547
650
|
(async ()=>{
|
|
@@ -550,7 +653,7 @@ import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
550
653
|
throw new Error(`Could not find block header for block hash ${blockHash}`);
|
|
551
654
|
}
|
|
552
655
|
if (header.getBlockNumber() > this.anchorBlockHeader.getBlockNumber()) {
|
|
553
|
-
throw new Error(`Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${
|
|
656
|
+
throw new Error(`Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${anchorHash}).`);
|
|
554
657
|
}
|
|
555
658
|
})()
|
|
556
659
|
]);
|
|
@@ -20,6 +20,7 @@ export declare class ContractSyncService implements StagedStore {
|
|
|
20
20
|
private log;
|
|
21
21
|
readonly storeName = "contract_sync";
|
|
22
22
|
private syncedContracts;
|
|
23
|
+
private classIdVerificationCache;
|
|
23
24
|
private excludedFromSync;
|
|
24
25
|
constructor(aztecNode: AztecNode, contractStore: ContractStore, noteStore: NoteStore, log: Logger);
|
|
25
26
|
/** Sets contracts that should be skipped during sync for a specific job. */
|
|
@@ -41,4 +42,4 @@ export declare class ContractSyncService implements StagedStore {
|
|
|
41
42
|
commit(jobId: string): Promise<void>;
|
|
42
43
|
discardStaged(jobId: string): Promise<void>;
|
|
43
44
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3luY19zZXJ2aWNlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29udHJhY3Rfc3luYy9jb250cmFjdF9zeW5jX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHcEQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sdUNBQXVDLENBQUM7QUFFekUsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sNkNBQTZDLENBQUM7QUFDakYsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0scUNBQXFDLENBQUM7QUFNckU7Ozs7O0dBS0c7QUFDSCxxQkFBYSxtQkFBb0IsWUFBVyxXQUFXOztJQXFCbkQsT0FBTyxDQUFDLFNBQVM7SUFDakIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLFNBQVM7SUFDakIsT0FBTyxDQUFDLEdBQUc7SUF2QmIsUUFBUSxDQUFDLFNBQVMsbUJBQW1CO0lBS3JDLE9BQU8s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0FBQyxDQU8xQztDQTRGRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_sync_service.d.ts","sourceRoot":"","sources":["../../src/contract_sync/contract_sync_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"contract_sync_service.d.ts","sourceRoot":"","sources":["../../src/contract_sync/contract_sync_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAMrE;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,WAAW;;IAqBnD,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,GAAG;IAvBb,QAAQ,CAAC,SAAS,mBAAmB;IAKrC,OAAO,CAAC,eAAe,CAAyC;IAIhE,OAAO,CAAC,wBAAwB,CAAyC;IAGzE,OAAO,CAAC,gBAAgB,CAAuC;IAO/D,YACU,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACjB;IAEJ,4EAA4E;IAC5E,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,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,CAUf;IAED,oEAAoE;IACpE,2BAA2B,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAKvF;IAED,gFAAgF;IAChF,IAAI,IAAI,IAAI,CAIX;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAInC;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1C;CA4FF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Semaphore } from '@aztec/foundation/queue';
|
|
2
|
-
import {
|
|
2
|
+
import { isProtocolContract } from '@aztec/protocol-contracts';
|
|
3
|
+
import { NoteService } from '../notes/note_service.js';
|
|
4
|
+
import { syncScope, verifyCurrentClassId } from './helpers.js';
|
|
3
5
|
/** Maximum number of scope syncs running concurrently across the PXE. */ const MAX_CONCURRENT_SCOPE_SYNCS = 5;
|
|
4
6
|
/**
|
|
5
7
|
* Service for syncing the private state of contracts and verifying that the PXE holds the current class artifact.
|
|
@@ -16,6 +18,9 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
16
18
|
// (`contractAddress:scopeAddress`), or `contractAddress:*` for all scopes (all accounts).
|
|
17
19
|
// The value is a promise that resolves when the contract is synced.
|
|
18
20
|
syncedContracts;
|
|
21
|
+
// Tracks class ID verification per contract. Keyed by contract address only (no scope), since
|
|
22
|
+
// class ID verification is scope-independent. Cleared on wipe/discard.
|
|
23
|
+
classIdVerificationCache;
|
|
19
24
|
// Per-job excluded contract addresses - these contracts should not be synced.
|
|
20
25
|
excludedFromSync;
|
|
21
26
|
// Bounds the number of scope syncs running concurrently. Scopes beyond this limit queue here. Sized to trade off
|
|
@@ -29,6 +34,7 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
29
34
|
this.log = log;
|
|
30
35
|
this.storeName = 'contract_sync';
|
|
31
36
|
this.syncedContracts = new Map();
|
|
37
|
+
this.classIdVerificationCache = new Map();
|
|
32
38
|
this.excludedFromSync = new Map();
|
|
33
39
|
this.#syncSlot = new Semaphore(MAX_CONCURRENT_SCOPE_SYNCS);
|
|
34
40
|
}
|
|
@@ -47,7 +53,7 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
47
53
|
if (this.#shouldSkipSync(jobId, contractAddress)) {
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
|
-
this.#startSyncIfNeeded(contractAddress, scopes,
|
|
56
|
+
this.#startSyncIfNeeded(contractAddress, scopes, anchorBlockHeader, jobId, (scope)=>syncScope(contractAddress, this.contractStore, functionToInvokeAfterSync, utilityExecutor, scope));
|
|
51
57
|
await this.#awaitSync(contractAddress, scopes);
|
|
52
58
|
}
|
|
53
59
|
/** Clears sync cache entries for the given scopes of a contract. */ invalidateContractForScopes(contractAddress, scopes) {
|
|
@@ -59,6 +65,7 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
59
65
|
/** Clears sync cache. Called by BlockSynchronizer when anchor block changes. */ wipe() {
|
|
60
66
|
this.log.debug(`Wiping contract sync cache (${this.syncedContracts.size} entries)`);
|
|
61
67
|
this.syncedContracts.clear();
|
|
68
|
+
this.classIdVerificationCache.clear();
|
|
62
69
|
}
|
|
63
70
|
commit(jobId) {
|
|
64
71
|
// Clear excluded contracts for this job
|
|
@@ -69,6 +76,7 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
69
76
|
// We clear the synced contracts cache here because, when the job is discarded, any associated database writes from
|
|
70
77
|
// the sync are also undone.
|
|
71
78
|
this.syncedContracts.clear();
|
|
79
|
+
this.classIdVerificationCache.clear();
|
|
72
80
|
this.excludedFromSync.delete(jobId);
|
|
73
81
|
return Promise.resolve();
|
|
74
82
|
}
|
|
@@ -76,20 +84,23 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
76
84
|
return !!this.excludedFromSync.get(jobId)?.has(contractAddress.toString());
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
87
|
+
* For each unsynced scope, creates a promise that waits on:
|
|
88
|
+
* 1. Class ID verification (cached per contract, scope-independent).
|
|
89
|
+
* 2. Note nullifier sync (shared, batched across all unsynced scopes).
|
|
90
|
+
* 3. Per-scope sync (individual, semaphore-bounded).
|
|
91
|
+
*/ #startSyncIfNeeded(contractAddress, scopes, anchorBlockHeader, jobId, syncScopeFn) {
|
|
83
92
|
const scopesToSync = scopes.filter((scope)=>!this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
84
93
|
if (scopesToSync.length === 0) {
|
|
85
94
|
return;
|
|
86
95
|
}
|
|
87
96
|
this.log.debug(`Syncing contract ${contractAddress} for ${scopesToSync.length} scope(s)`);
|
|
88
|
-
const verifyPromise =
|
|
97
|
+
const verifyPromise = this.#verifyClassId(contractAddress, anchorBlockHeader);
|
|
98
|
+
const syncNullifiersPromise = this.#syncNoteNullifiers(contractAddress, anchorBlockHeader, jobId, scopesToSync);
|
|
89
99
|
for (const scope of scopesToSync){
|
|
90
100
|
const key = toKey(contractAddress, scope);
|
|
91
101
|
const promise = Promise.all([
|
|
92
102
|
verifyPromise,
|
|
103
|
+
syncNullifiersPromise,
|
|
93
104
|
this.#runBounded(()=>syncScopeFn(scope))
|
|
94
105
|
]).then(()=>{}).catch((err)=>{
|
|
95
106
|
this.syncedContracts.delete(key);
|
|
@@ -98,6 +109,29 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
98
109
|
this.syncedContracts.set(key, promise);
|
|
99
110
|
}
|
|
100
111
|
}
|
|
112
|
+
/** Verifies the local class ID matches the on-chain value (cached, evicts on failure so retries re-verify). */ #verifyClassId(contractAddress, anchorBlockHeader) {
|
|
113
|
+
const contractKey = contractAddress.toString();
|
|
114
|
+
const cached = this.classIdVerificationCache.get(contractKey);
|
|
115
|
+
if (cached) {
|
|
116
|
+
return cached;
|
|
117
|
+
}
|
|
118
|
+
const promise = verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader).catch((err)=>{
|
|
119
|
+
this.classIdVerificationCache.delete(contractKey);
|
|
120
|
+
throw err;
|
|
121
|
+
});
|
|
122
|
+
this.classIdVerificationCache.set(contractKey, promise);
|
|
123
|
+
return promise;
|
|
124
|
+
}
|
|
125
|
+
/** Syncs note nullifiers across all unsynced scopes in a single batched call. */ async #syncNoteNullifiers(contractAddress, anchorBlockHeader, jobId, scopes) {
|
|
126
|
+
// Protocol contracts don't have private state to sync
|
|
127
|
+
if (isProtocolContract(contractAddress)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// This runs in parallel with per-scope sync (which also writes to the note store). That's safe because
|
|
131
|
+
// the note store handles concurrent operations.
|
|
132
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, anchorBlockHeader, jobId);
|
|
133
|
+
await noteService.syncNoteNullifiers(contractAddress, scopes);
|
|
134
|
+
}
|
|
101
135
|
/** Runs fn while holding a slot in #syncSlot, bounding total concurrent scope syncs. */ async #runBounded(fn) {
|
|
102
136
|
await this.#syncSlot.acquire();
|
|
103
137
|
try {
|
|
@@ -4,7 +4,6 @@ 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
6
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
7
|
-
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
8
7
|
/**
|
|
9
8
|
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
10
9
|
* from the instance is used.
|
|
@@ -15,7 +14,7 @@ import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
|
15
14
|
* @returns The current class id.
|
|
16
15
|
*/
|
|
17
16
|
export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, header: BlockHeader): Promise<import("@aztec/foundation/schemas").Fr>;
|
|
18
|
-
export declare function
|
|
17
|
+
export declare function syncScope(contractAddress: AztecAddress, contractStore: ContractStore, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall, scopes: AztecAddress[]) => Promise<any>, scope: AztecAddress): Promise<void>;
|
|
19
18
|
/**
|
|
20
19
|
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
21
20
|
* provider (i.e. PXE's own storage).
|
|
@@ -25,4 +24,4 @@ export declare function syncState(contractAddress: AztecAddress, contractStore:
|
|
|
25
24
|
* @param header - The header of the block at which to verify the current class id.
|
|
26
25
|
*/
|
|
27
26
|
export declare function verifyCurrentClassId(contractAddress: AztecAddress, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0X3N5bmMvaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFB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,EAAE,WAAW,iBAapB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ProtocolContractAddress, isProtocolContract } from '@aztec/protocol-contracts';
|
|
2
2
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
3
|
-
import { NoteService } from '../notes/note_service.js';
|
|
4
3
|
/**
|
|
5
4
|
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
6
5
|
* from the instance is used.
|
|
@@ -20,26 +19,20 @@ import { NoteService } from '../notes/note_service.js';
|
|
|
20
19
|
}
|
|
21
20
|
return currentClassId;
|
|
22
21
|
}
|
|
23
|
-
export async function
|
|
22
|
+
export async function syncScope(contractAddress, contractStore, functionToInvokeAfterSync, utilityExecutor, scope) {
|
|
24
23
|
// Protocol contracts don't have private state to sync
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
scope
|
|
28
|
-
], contractAddress);
|
|
29
|
-
if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncStateFunctionCall.selector)) {
|
|
30
|
-
throw new Error('Forbidden `sync_state` invocation. `sync_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
|
|
31
|
-
}
|
|
32
|
-
const noteService = new NoteService(noteStore, aztecNode, anchorBlockHeader, jobId);
|
|
33
|
-
const scopes = [
|
|
34
|
-
scope
|
|
35
|
-
];
|
|
36
|
-
// Both sync_state and syncNoteNullifiers interact with the note store, but running them in parallel is safe
|
|
37
|
-
// because note store is designed to handle concurrent operations.
|
|
38
|
-
await Promise.all([
|
|
39
|
-
utilityExecutor(syncStateFunctionCall, scopes),
|
|
40
|
-
noteService.syncNoteNullifiers(contractAddress, scopes)
|
|
41
|
-
]);
|
|
24
|
+
if (isProtocolContract(contractAddress)) {
|
|
25
|
+
return;
|
|
42
26
|
}
|
|
27
|
+
const syncStateFunctionCall = await contractStore.getFunctionCall('sync_state', [
|
|
28
|
+
scope
|
|
29
|
+
], contractAddress);
|
|
30
|
+
if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncStateFunctionCall.selector)) {
|
|
31
|
+
throw new Error('Forbidden `sync_state` invocation. `sync_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
|
|
32
|
+
}
|
|
33
|
+
await utilityExecutor(syncStateFunctionCall, [
|
|
34
|
+
scope
|
|
35
|
+
]);
|
|
43
36
|
}
|
|
44
37
|
/**
|
|
45
38
|
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvYnVuZGxlL3V0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRWpFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzFELE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUV0QyxPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBeUIsTUFBTSwrQkFBK0IsQ0FBQztBQUUvRjs7Ozs7Ozs7O0dBU0c7QUFDSCx3QkFBc0IsU0FBUyxDQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixNQUFNLEVBQUUsU0FBUyxFQUNqQixPQUFPLEdBQUUsa0JBQW9DLGdCQXVDOUMifQ==
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,gBAuC9C"}
|
|
@@ -12,4 +12,4 @@ import { type PXECreationOptions } from '../../pxe_creation_options.js';
|
|
|
12
12
|
* @returns A Promise that resolves to the started PXE instance.
|
|
13
13
|
*/
|
|
14
14
|
export declare function createPXE(aztecNode: AztecNode, config: PXEConfig, options?: PXECreationOptions): Promise<PXE>;
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9jbGllbnQvbGF6eS91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsR0FBRyxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFFdEMsT0FBTyxFQUFFLEtBQUssa0JBQWtCLEVBQXlCLE1BQU0sK0JBQStCLENBQUM7QUFFL0Y7Ozs7Ozs7O0dBUUc7QUFDSCx3QkFBc0IsU0FBUyxDQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixNQUFNLEVBQUUsU0FBUyxFQUNqQixPQUFPLEdBQUUsa0JBQW9DLGdCQXdDOUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/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;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/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;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,EACjB,OAAO,GAAE,kBAAoC,gBAwC9C"}
|
|
@@ -3,6 +3,7 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
5
5
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
6
|
+
import type { ExecutionHooks } from '../hooks/index.js';
|
|
6
7
|
export type PXECreationOptions = {
|
|
7
8
|
loggers?: {
|
|
8
9
|
store?: Logger;
|
|
@@ -14,7 +15,9 @@ export type PXECreationOptions = {
|
|
|
14
15
|
proverOrOptions?: PrivateKernelProver | BBPrivateKernelProverOptions;
|
|
15
16
|
store?: AztecAsyncKVStore;
|
|
16
17
|
simulator?: CircuitSimulator;
|
|
18
|
+
/** Optional hooks to observe and influence contract execution. */
|
|
19
|
+
hooks?: ExecutionHooks;
|
|
17
20
|
};
|
|
18
21
|
/** Checks if the given value implements the PrivateKernelProver interface via duck-typing. */
|
|
19
22
|
export declare function isPrivateKernelProver(value: unknown): value is PrivateKernelProver;
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlX2NyZWF0aW9uX29wdGlvbnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnRyeXBvaW50cy9weGVfY3JlYXRpb25fb3B0aW9ucy50c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
1
|
-
{"version":3,"file":"pxe_creation_options.d.ts","sourceRoot":"","sources":["../../src/entrypoints/pxe_creation_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,mBAAmB,GAAG,4BAA4B,CAAC;IACrE,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"pxe_creation_options.d.ts","sourceRoot":"","sources":["../../src/entrypoints/pxe_creation_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,mBAAmB,GAAG,4BAA4B,CAAC;IACrE,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,kEAAkE;IAClE,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from '../../notes_filter.js';
|
|
2
2
|
export * from '../../pxe.js';
|
|
3
|
+
export * from '../../hooks/index.js';
|
|
3
4
|
export * from '../../config/index.js';
|
|
4
5
|
export * from '../../error_enriching.js';
|
|
5
6
|
export * from '../../storage/index.js';
|
|
@@ -9,4 +10,4 @@ export { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version
|
|
|
9
10
|
export { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
10
11
|
export { JobCoordinator } from '../../job_coordinator/job_coordinator.js';
|
|
11
12
|
export { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9zZXJ2ZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsWUFBWSxDQUFDO0FBQzNCLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNyRixPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQ3JFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSwwQ0FBMEMsQ0FBQztBQUMxRSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw4Q0FBOEMsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC"}
|
|
@@ -5,4 +5,4 @@ import { type PXECreationOptions } from '../pxe_creation_options.js';
|
|
|
5
5
|
type PXEConfigWithoutDefaults = Omit<PXEConfig, 'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'>;
|
|
6
6
|
export declare function createPXE(aztecNode: AztecNode, config: PXEConfigWithoutDefaults, options?: PXECreationOptions): Promise<PXE>;
|
|
7
7
|
export {};
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lbnRyeXBvaW50cy9zZXJ2ZXIvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBTUEsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFakUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDdkQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUVuQyxPQUFPLEVBQUUsS0FBSyxrQkFBa0IsRUFBeUIsTUFBTSw0QkFBNEIsQ0FBQztBQUU1RixLQUFLLHdCQUF3QixHQUFHLElBQUksQ0FBQyxTQUFTLEVBQUUsYUFBYSxHQUFHLFdBQVcsR0FBRyxrQkFBa0IsR0FBRyxlQUFlLENBQUMsQ0FBQztBQUVwSCx3QkFBc0IsU0FBUyxDQUM3QixTQUFTLEVBQUUsU0FBUyxFQUNwQixNQUFNLEVBQUUsd0JBQXdCLEVBQ2hDLE9BQU8sR0FBRSxrQkFBb0MsZ0JBb0Q5QyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,4BAA4B,CAAC;AAE5F,KAAK,wBAAwB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,WAAW,GAAG,kBAAkB,GAAG,eAAe,CAAC,CAAC;AAEpH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,wBAAwB,EAChC,OAAO,GAAE,kBAAoC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,4BAA4B,CAAC;AAE5F,KAAK,wBAAwB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,WAAW,GAAG,kBAAkB,GAAG,eAAe,CAAC,CAAC;AAEpH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,wBAAwB,EAChC,OAAO,GAAE,kBAAoC,gBAoD9C"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
3
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
5
|
-
import type { BlockHeader,
|
|
3
|
+
import type { BlockHeader, IndexedTxEffect } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { EventValidationRequest } from '../contract_function_simulator/noir-structs/event_validation_request.js';
|
|
6
5
|
import { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
7
6
|
export declare class EventService {
|
|
7
|
+
#private;
|
|
8
8
|
private readonly anchorBlockHeader;
|
|
9
9
|
private readonly aztecNode;
|
|
10
10
|
private readonly privateEventStore;
|
|
11
11
|
private readonly jobId;
|
|
12
12
|
private readonly log;
|
|
13
13
|
constructor(anchorBlockHeader: BlockHeader, aztecNode: AztecNode, privateEventStore: PrivateEventStore, jobId: string, log?: import("@aztec/foundation/log").Logger);
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Validates and stores a batch of private events against pre-fetched tx effects.
|
|
16
|
+
*
|
|
17
|
+
* @param requests - The events to validate and store.
|
|
18
|
+
* @param scope - The scope under which the events are being stored.
|
|
19
|
+
* @param txEffects - Pre-fetched tx effects keyed by `TxHash.toString()`. Must contain entries for every request's
|
|
20
|
+
* txHash; missing entries are treated as a node bug and cause an error.
|
|
21
|
+
*/
|
|
22
|
+
validateAndStoreEvents(requests: EventValidationRequest[], scope: AztecAddress, txEffects: Map<string, IndexedTxEffect>): Promise<void>;
|
|
15
23
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FBRSxFQUNsQyxLQUFLLEVBQUUsWUFBWSxFQUNuQixTQUFTLEVBQUUsR0FBRyxDQUFDLE1BQU0sRUFBRSxlQUFlLENBQUMsR0FDdEMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQVFmO0NBZ0ZGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_service.d.ts","sourceRoot":"","sources":["../../src/events/event_service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event_service.d.ts","sourceRoot":"","sources":["../../src/events/event_service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yEAAyE,CAAC;AACtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,qBAAa,YAAY;;IAErB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,YACmB,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,KAAK,EAAE,MAAM,EACb,GAAG,yCAAoC,EACtD;IAEJ;;;;;;;OAOG;IACU,sBAAsB,CACjC,QAAQ,EAAE,sBAAsB,EAAE,EAClC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC,CAQf;CAgFF"}
|