@aztec/pxe 0.0.1-commit.d431d1c → 0.0.1-commit.dbf9cec
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +9 -5
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +62 -16
- package/dest/config/index.d.ts +3 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -30
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +175 -74
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- 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 +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +2 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +15 -12
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +7 -5
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +51 -29
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -22
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +0 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +44 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +86 -30
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +62 -30
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +107 -88
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +24 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +28 -17
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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 +21 -7
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- 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 +22 -8
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +4 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -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 +28 -9
- package/dest/events/event_service.d.ts +5 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +6 -7
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +7 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +28 -32
- package/dest/notes/note_service.d.ts +9 -8
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +17 -16
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +21 -13
- package/dest/private_kernel/private_kernel_oracle.d.ts +8 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +69 -23
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +104 -67
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.js +6 -8
- package/dest/storage/contract_store/contract_store.d.ts +42 -16
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +157 -84
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +47 -49
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +278 -252
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +17 -4
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +198 -147
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +184 -114
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +3 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +2 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +5 -5
- 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 +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +16 -12
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
- 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 +5 -8
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +20 -18
- package/package.json +25 -16
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +76 -33
- package/src/config/index.ts +14 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +324 -137
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +2 -2
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +2 -2
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -11
- package/src/contract_function_simulator/oracle/oracle.ts +56 -26
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -60
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +126 -110
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +172 -95
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +63 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +16 -15
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +17 -15
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +3 -0
- package/src/entrypoints/server/utils.ts +22 -26
- package/src/events/event_service.ts +5 -7
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +48 -39
- package/src/notes/note_service.ts +24 -22
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +25 -15
- package/src/private_kernel/private_kernel_oracle.ts +9 -9
- package/src/pxe.ts +211 -112
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +8 -8
- package/src/storage/contract_store/contract_store.ts +186 -96
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +321 -318
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +250 -190
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +214 -130
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +2 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +17 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +17 -16
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +6 -9
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -17
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +23 -23
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.d.ts +0 -50
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -75
- package/src/tree_membership/tree_membership_service.ts +0 -97
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
/**
|
|
3
|
+
* Controls which accounts' private state and keys are accessible during execution.
|
|
4
|
+
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
5
|
+
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
6
|
+
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
7
|
+
*/
|
|
8
|
+
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzX3Njb3Blcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FjY2Vzc19zY29wZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sWUFBWSxHQUFHLFlBQVksR0FBRyxZQUFZLEVBQUUsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access_scopes.d.ts","sourceRoot":"","sources":["../src/access_scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Controls which accounts' private state and keys are accessible during execution.
|
|
3
|
+
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
4
|
+
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
5
|
+
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
6
|
+
*/ export { };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
1
|
+
/* eslint-disable import-x/no-named-as-default-member */ import { keccak256String } from '@aztec/foundation/crypto/keccak';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
import ts from 'typescript';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
4
4
|
import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
5
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
|
-
import type {
|
|
6
|
+
import type { BlockSynchronizerConfig } from '../config/index.js';
|
|
7
|
+
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
7
8
|
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
8
9
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
9
10
|
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
@@ -19,13 +20,16 @@ export declare class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
19
20
|
private noteStore;
|
|
20
21
|
private privateEventStore;
|
|
21
22
|
private l2TipsStore;
|
|
23
|
+
private contractSyncService;
|
|
24
|
+
private config;
|
|
22
25
|
private log;
|
|
23
26
|
private isSyncing;
|
|
24
27
|
protected readonly blockStream: L2BlockStream;
|
|
25
|
-
constructor(node: AztecNode, store: AztecAsyncKVStore, anchorBlockStore: AnchorBlockStore, noteStore: NoteStore, privateEventStore: PrivateEventStore, l2TipsStore: L2TipsKVStore, config?: Partial<
|
|
26
|
-
protected createBlockStream(config: Partial<
|
|
28
|
+
constructor(node: AztecNode, store: AztecAsyncKVStore, anchorBlockStore: AnchorBlockStore, noteStore: NoteStore, privateEventStore: PrivateEventStore, l2TipsStore: L2TipsKVStore, contractSyncService: ContractSyncService, config?: Partial<BlockSynchronizerConfig>, bindings?: LoggerBindings);
|
|
29
|
+
protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream;
|
|
27
30
|
/** Handle events emitted by the block stream. */
|
|
28
31
|
handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
|
|
32
|
+
private updateAnchorBlockHeader;
|
|
29
33
|
/**
|
|
30
34
|
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
31
35
|
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
|
@@ -38,4 +42,4 @@ export declare class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
38
42
|
sync(): Promise<void>;
|
|
39
43
|
private doSync;
|
|
40
44
|
}
|
|
41
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfc3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmxvY2tfc3luY2hyb25pemVyL2Jsb2NrX3N5bmNocm9uaXplci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQWUsS0FBSyxjQUFjLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDdkYsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM1RCxPQUFPLEVBQWEsYUFBYSxFQUFFLEtBQUssa0JBQWtCLEVBQUUsS0FBSyx5QkFBeUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3hILE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR2pFLE9BQU8sS0FBSyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUNyRixPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHFE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sR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBc0U1RTtZQUdhLHVCQUF1QjtJQVNyQzs7Ozs7Ozs7T0FRRztJQUNVLElBQUksa0JBZWhCO1lBRWEsTUFBTTtDQWNyQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_synchronizer.d.ts","sourceRoot":"","sources":["../../src/block_synchronizer/block_synchronizer.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"block_synchronizer.d.ts","sourceRoot":"","sources":["../../src/block_synchronizer/block_synchronizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAa,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACxH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE/F;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,yBAAyB;IAM/D,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,iBAAiB;IACzB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,MAAM;IAZhB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,SAAS,CAA4B;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAE9C,YACU,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,iBAAiB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,aAAa,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,GAAE,OAAO,CAAC,uBAAuB,CAAM,EACrD,QAAQ,CAAC,EAAE,cAAc,EAI1B;IAED,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,aAAa,CAanF;IAED,iDAAiD;IACpC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsE5E;YAGa,uBAAuB;IASrC;;;;;;;;OAQG;IACU,IAAI,kBAehB;YAEa,MAAM;CAcrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
3
|
+
import { BlockHash, L2BlockStream } from '@aztec/stdlib/block';
|
|
4
4
|
/**
|
|
5
5
|
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
6
6
|
* view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
|
|
@@ -12,21 +12,25 @@ import { L2BlockHash, L2BlockStream } from '@aztec/stdlib/block';
|
|
|
12
12
|
noteStore;
|
|
13
13
|
privateEventStore;
|
|
14
14
|
l2TipsStore;
|
|
15
|
+
contractSyncService;
|
|
16
|
+
config;
|
|
15
17
|
log;
|
|
16
18
|
isSyncing;
|
|
17
19
|
blockStream;
|
|
18
|
-
constructor(node, store, anchorBlockStore, noteStore, privateEventStore, l2TipsStore, config = {},
|
|
20
|
+
constructor(node, store, anchorBlockStore, noteStore, privateEventStore, l2TipsStore, contractSyncService, config = {}, bindings){
|
|
19
21
|
this.node = node;
|
|
20
22
|
this.store = store;
|
|
21
23
|
this.anchorBlockStore = anchorBlockStore;
|
|
22
24
|
this.noteStore = noteStore;
|
|
23
25
|
this.privateEventStore = privateEventStore;
|
|
24
26
|
this.l2TipsStore = l2TipsStore;
|
|
25
|
-
this.
|
|
27
|
+
this.contractSyncService = contractSyncService;
|
|
28
|
+
this.config = config;
|
|
29
|
+
this.log = createLogger('pxe:block_synchronizer', bindings);
|
|
26
30
|
this.blockStream = this.createBlockStream(config);
|
|
27
31
|
}
|
|
28
32
|
createBlockStream(config) {
|
|
29
|
-
return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
|
|
33
|
+
return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream', this.log.getBindings()), {
|
|
30
34
|
batchSize: config.l2BlockBatchSize,
|
|
31
35
|
// Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
|
|
32
36
|
// in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
|
|
@@ -38,36 +42,78 @@ import { L2BlockHash, L2BlockStream } from '@aztec/stdlib/block';
|
|
|
38
42
|
switch(event.type){
|
|
39
43
|
case 'blocks-added':
|
|
40
44
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if (this.config.syncChainTip === undefined || this.config.syncChainTip === 'proposed') {
|
|
46
|
+
const lastBlock = event.blocks.at(-1);
|
|
47
|
+
await this.updateAnchorBlockHeader(lastBlock.header);
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'chain-checkpointed':
|
|
52
|
+
{
|
|
53
|
+
if (this.config.syncChainTip === 'checkpointed') {
|
|
54
|
+
// Get the last block header from the checkpoint
|
|
55
|
+
const lastBlock = event.checkpoint.checkpoint.blocks.at(-1);
|
|
56
|
+
await this.updateAnchorBlockHeader(lastBlock.header);
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 'chain-proven':
|
|
61
|
+
{
|
|
62
|
+
if (this.config.syncChainTip === 'proven') {
|
|
63
|
+
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
64
|
+
if (blockHeader) {
|
|
65
|
+
await this.updateAnchorBlockHeader(blockHeader);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'chain-finalized':
|
|
71
|
+
{
|
|
72
|
+
if (this.config.syncChainTip === 'finalized') {
|
|
73
|
+
const blockHeader = await this.node.getBlockHeader(BlockNumber(event.block.number));
|
|
74
|
+
if (blockHeader) {
|
|
75
|
+
await this.updateAnchorBlockHeader(blockHeader);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
48
78
|
break;
|
|
49
79
|
}
|
|
50
80
|
case 'chain-pruned':
|
|
51
81
|
{
|
|
82
|
+
const currentAnchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
83
|
+
const currentAnchorBlockNumber = currentAnchorBlockHeader.getBlockNumber();
|
|
84
|
+
if (currentAnchorBlockNumber <= event.block.number) {
|
|
85
|
+
this.log.verbose(`Ignoring prune event to block ${event.block.number} greater than current anchor block ${currentAnchorBlockNumber}`, {
|
|
86
|
+
pruneEvent: event,
|
|
87
|
+
currentAnchorBlockHeader: currentAnchorBlockHeader.toInspect()
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
52
91
|
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
53
|
-
const oldAnchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
54
92
|
// Note that the following is not necessarily the anchor block that will be used in the transaction - if
|
|
55
93
|
// the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
|
|
56
94
|
// forward.
|
|
57
|
-
const newAnchorBlockHeader = await this.node.getBlockHeader(
|
|
95
|
+
const newAnchorBlockHeader = await this.node.getBlockHeader(BlockHash.fromString(event.block.hash));
|
|
58
96
|
if (!newAnchorBlockHeader) {
|
|
59
97
|
throw new Error(`Block header for block number ${event.block.number} and hash ${event.block.hash} not found during chain prune. This likely indicates a bug in the node, as we receive block stream events and fetch block headers from the same node.`);
|
|
60
98
|
}
|
|
61
99
|
// Operations are wrapped in a single transaction to ensure atomicity.
|
|
62
100
|
await this.store.transactionAsync(async ()=>{
|
|
63
|
-
await this.noteStore.rollback(event.block.number,
|
|
64
|
-
await this.privateEventStore.rollback(event.block.number,
|
|
65
|
-
await this.
|
|
101
|
+
await this.noteStore.rollback(event.block.number, currentAnchorBlockNumber);
|
|
102
|
+
await this.privateEventStore.rollback(event.block.number, currentAnchorBlockNumber);
|
|
103
|
+
await this.updateAnchorBlockHeader(newAnchorBlockHeader);
|
|
66
104
|
});
|
|
67
105
|
break;
|
|
68
106
|
}
|
|
69
107
|
}
|
|
70
108
|
}
|
|
109
|
+
/** Updates the anchor block header to the target block */ async updateAnchorBlockHeader(blockHeader) {
|
|
110
|
+
// Whenever the anchor block header is updated, we need to synchronize the private state of contracts again.
|
|
111
|
+
// Therefore, we clear the contract synchronization cache here such that the sync is re-triggered upon new
|
|
112
|
+
// execution.
|
|
113
|
+
this.contractSyncService.wipe();
|
|
114
|
+
this.log.verbose(`Updated pxe last block to ${blockHeader.getBlockNumber()}`, blockHeader.toInspect());
|
|
115
|
+
await this.anchorBlockStore.setHeader(blockHeader);
|
|
116
|
+
}
|
|
71
117
|
/**
|
|
72
118
|
* Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
|
|
73
119
|
* recent data (e.g. notes), and handling any reorgs that might have occurred.
|
package/dest/config/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface KernelProverConfig {
|
|
|
15
15
|
export interface BlockSynchronizerConfig {
|
|
16
16
|
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
17
17
|
l2BlockBatchSize: number;
|
|
18
|
+
/** Which chain tip to sync to (proposed, checkpointed, proven, finalized) */
|
|
19
|
+
syncChainTip?: 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
18
20
|
}
|
|
19
21
|
export type PXEConfig = KernelProverConfig & DataStoreConfig & ChainConfig & BlockSynchronizerConfig;
|
|
20
22
|
export type CliPXEOptions = {
|
|
@@ -32,4 +34,4 @@ export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PX
|
|
|
32
34
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
33
35
|
*/
|
|
34
36
|
export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLEtBQUssa0JBQWtCLEVBS3hCLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFzQixNQUFNLHdCQUF3QixDQUFDO0FBQ2xGLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBdUIsTUFBTSxzQkFBc0IsQ0FBQztBQUU3RSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsa0JBQWtCO0lBQ2pDLDhDQUE4QztJQUM5QyxhQUFhLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDekI7QUFFRDs7R0FFRztBQUNILE1BQU0sV0FBVyx1QkFBdUI7SUFDdEMseUZBQXlGO0lBQ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,6 +21,23 @@ export const pxeConfigMappings = {
|
|
|
21
21
|
env: 'PXE_PROVER_ENABLED',
|
|
22
22
|
description: 'Enable real proofs',
|
|
23
23
|
...booleanConfigHelper(true)
|
|
24
|
+
},
|
|
25
|
+
syncChainTip: {
|
|
26
|
+
env: 'PXE_SYNC_CHAIN_TIP',
|
|
27
|
+
description: 'Which chain tip to sync to (proposed, checkpointed, proven, finalized)',
|
|
28
|
+
defaultValue: 'proposed',
|
|
29
|
+
parseEnv: (val)=>{
|
|
30
|
+
const allowedValues = [
|
|
31
|
+
'proposed',
|
|
32
|
+
'checkpointed',
|
|
33
|
+
'proven',
|
|
34
|
+
'finalized'
|
|
35
|
+
];
|
|
36
|
+
if (allowedValues.includes(val)) {
|
|
37
|
+
return val;
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Invalid value for PXE_SYNC_CHAIN_TIP: ${val}. Allowed values are: ${allowedValues.join(', ')}`);
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
42
|
};
|
|
26
43
|
/**
|
|
@@ -8,8 +8,9 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
8
8
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
9
9
|
import { type PrivateKernelExecutionProofOutput, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
10
10
|
import { BlockHeader, PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
11
|
+
import type { AccessScopes } from '../access_scopes.js';
|
|
12
|
+
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
11
13
|
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
12
|
-
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
13
14
|
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
14
15
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
15
16
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
@@ -17,39 +18,61 @@ import type { PrivateEventStore } from '../storage/private_event_store/private_e
|
|
|
17
18
|
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
18
19
|
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
19
20
|
import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
|
|
21
|
+
/** Options for ContractFunctionSimulator.run. */
|
|
22
|
+
export type ContractSimulatorRunOpts = {
|
|
23
|
+
/** The address of the contract (should match request.origin). */
|
|
24
|
+
contractAddress: AztecAddress;
|
|
25
|
+
/** The function selector of the entry point. */
|
|
26
|
+
selector: FunctionSelector;
|
|
27
|
+
/** The address calling the function. Can be replaced to simulate a call from another contract or account. */
|
|
28
|
+
msgSender?: AztecAddress;
|
|
29
|
+
/** The block header to use as base state for this run. */
|
|
30
|
+
anchorBlockHeader: BlockHeader;
|
|
31
|
+
/** The address used as a tagging sender when emitting private logs. */
|
|
32
|
+
senderForTags?: AztecAddress;
|
|
33
|
+
/** The accounts whose notes we can access in this call. */
|
|
34
|
+
scopes: AccessScopes;
|
|
35
|
+
/** The job ID for staged writes. */
|
|
36
|
+
jobId: string;
|
|
37
|
+
};
|
|
38
|
+
/** Args for ContractFunctionSimulator constructor. */
|
|
39
|
+
export type ContractFunctionSimulatorArgs = {
|
|
40
|
+
contractStore: ContractStore;
|
|
41
|
+
noteStore: NoteStore;
|
|
42
|
+
keyStore: KeyStore;
|
|
43
|
+
addressStore: AddressStore;
|
|
44
|
+
aztecNode: AztecNode;
|
|
45
|
+
senderTaggingStore: SenderTaggingStore;
|
|
46
|
+
recipientTaggingStore: RecipientTaggingStore;
|
|
47
|
+
senderAddressBookStore: SenderAddressBookStore;
|
|
48
|
+
capsuleStore: CapsuleStore;
|
|
49
|
+
privateEventStore: PrivateEventStore;
|
|
50
|
+
simulator: CircuitSimulator;
|
|
51
|
+
contractSyncService: ContractSyncService;
|
|
52
|
+
};
|
|
20
53
|
/**
|
|
21
54
|
* The contract function simulator.
|
|
22
55
|
*/
|
|
23
56
|
export declare class ContractFunctionSimulator {
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private senderTaggingStore;
|
|
31
|
-
private recipientTaggingStore;
|
|
32
|
-
private senderAddressBookStore;
|
|
33
|
-
private capsuleStore;
|
|
34
|
-
private privateEventStore;
|
|
35
|
-
private simulator;
|
|
36
|
-
private
|
|
37
|
-
constructor(
|
|
57
|
+
private readonly log;
|
|
58
|
+
private readonly contractStore;
|
|
59
|
+
private readonly noteStore;
|
|
60
|
+
private readonly keyStore;
|
|
61
|
+
private readonly addressStore;
|
|
62
|
+
private readonly aztecNode;
|
|
63
|
+
private readonly senderTaggingStore;
|
|
64
|
+
private readonly recipientTaggingStore;
|
|
65
|
+
private readonly senderAddressBookStore;
|
|
66
|
+
private readonly capsuleStore;
|
|
67
|
+
private readonly privateEventStore;
|
|
68
|
+
private readonly simulator;
|
|
69
|
+
private readonly contractSyncService;
|
|
70
|
+
constructor(args: ContractFunctionSimulatorArgs);
|
|
38
71
|
/**
|
|
39
72
|
* Runs a private function.
|
|
40
73
|
* @param request - The transaction request.
|
|
41
|
-
* @param entryPointArtifact - The artifact of the entry point function.
|
|
42
|
-
* @param contractAddress - The address of the contract (should match request.origin)
|
|
43
|
-
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
44
|
-
* or a specific account.
|
|
45
|
-
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
46
|
-
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
47
|
-
* the `privateGetSenderForTags` oracle.
|
|
48
|
-
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
49
|
-
* @param jobId - The job ID for staged writes.
|
|
50
|
-
* @returns The result of the execution.
|
|
51
74
|
*/
|
|
52
|
-
run(request: TxExecutionRequest, contractAddress
|
|
75
|
+
run(request: TxExecutionRequest, { contractAddress, selector, msgSender, anchorBlockHeader, senderForTags, scopes, jobId }: ContractSimulatorRunOpts): Promise<PrivateExecutionResult>;
|
|
53
76
|
/**
|
|
54
77
|
* Runs a utility function.
|
|
55
78
|
* @param call - The function call to execute.
|
|
@@ -59,7 +82,7 @@ export declare class ContractFunctionSimulator {
|
|
|
59
82
|
* accounts if not specified.
|
|
60
83
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
61
84
|
*/
|
|
62
|
-
runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes:
|
|
85
|
+
runUtility(call: FunctionCall, authwits: AuthWitness[], anchorBlockHeader: BlockHeader, scopes: AccessScopes, jobId: string): Promise<Fr[]>;
|
|
63
86
|
/**
|
|
64
87
|
* Returns the execution statistics collected during the simulator run.
|
|
65
88
|
* @returns The execution statistics.
|
|
@@ -75,10 +98,11 @@ export declare class ContractFunctionSimulator {
|
|
|
75
98
|
* (allowing state overrides) and is much faster, while still generating a valid
|
|
76
99
|
* output that can be sent to the node for public simulation
|
|
77
100
|
* @param privateExecutionResult - The result of the private execution.
|
|
78
|
-
* @param
|
|
101
|
+
* @param debugFunctionNameGetter - A provider for contract data in order to get function names and debug info.
|
|
102
|
+
* @param node - AztecNode for verifying settled read requests against the note hash and nullifier trees.
|
|
79
103
|
* @param minRevertibleSideEffectCounterOverride - Optional override for the min revertible side effect counter.
|
|
80
104
|
* Used by TXE to simulate account contract behavior (setting the counter before app execution).
|
|
81
105
|
* @returns The simulated proving result.
|
|
82
106
|
*/
|
|
83
|
-
export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult,
|
|
84
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
107
|
+
export declare function generateSimulatedProvingResult(privateExecutionResult: PrivateExecutionResult, debugFunctionNameGetter: (contractAddress: AztecAddress, functionSelector: FunctionSelector) => Promise<string>, node: AztecNode, minRevertibleSideEffectCounterOverride?: number): Promise<PrivateKernelExecutionProof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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAW3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAKL,KAAK,iCAAiC,EACtC,oCAAoC,EAarC,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,WAAW,EAGX,sBAAsB,EAEtB,kBAAkB,EAInB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,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