@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
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/block_synchronizer/block_synchronizer.d.ts +8 -8
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +15 -20
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +25 -22
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +34 -28
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -4
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +4 -5
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +17 -26
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +14 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +20 -19
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +47 -45
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
- package/dest/debug/pxe_debug_utils.d.ts +6 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +7 -7
- 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 +10 -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 +10 -1
- 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/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +11 -7
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +7 -7
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +8 -8
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +4 -4
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +14 -31
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +61 -180
- package/dest/notes/note_service.d.ts +7 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +3 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +9 -10
- package/dest/public_storage/public_storage_service.d.ts +4 -4
- package/dest/public_storage/public_storage_service.d.ts.map +1 -1
- package/dest/public_storage/public_storage_service.js +4 -4
- package/dest/pxe.d.ts +11 -9
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +113 -87
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.d.ts → capsule_store/capsule_store.d.ts} +2 -2
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +1 -1
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +4 -3
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +14 -2
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +7 -7
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +6 -6
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +59 -16
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/{tagging/recipient_sync/new_recipient_tagging_data_provider.js → storage/tagging_store/recipient_tagging_store.js} +3 -3
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +3 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +3 -3
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -3
- package/dest/tagging/index.d.ts +14 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +13 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -3
- 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/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +3 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → 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 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +2 -2
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +3 -3
- package/dest/tree_membership/tree_membership_service.d.ts +4 -4
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
- package/dest/tree_membership/tree_membership_service.js +5 -5
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +14 -19
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +57 -48
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -6
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +52 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +53 -49
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
- package/src/debug/pxe_debug_utils.ts +6 -6
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +8 -6
- package/src/events/private_event_filter_validator.ts +5 -5
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +92 -254
- package/src/notes/note_service.ts +13 -13
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +8 -14
- package/src/public_storage/public_storage_service.ts +3 -3
- package/src/pxe.ts +154 -106
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +1 -1
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +22 -2
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +7 -7
- package/src/storage/{private_event_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +72 -18
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/{tagging/recipient_sync/new_recipient_tagging_data_provider.ts → storage/tagging_store/recipient_tagging_store.ts} +3 -3
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +3 -3
- package/src/tagging/constants.ts +10 -3
- package/src/tagging/index.ts +16 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -8
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +9 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +6 -2
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +4 -4
- package/src/tree_membership/tree_membership_service.ts +4 -4
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/tagging/utils.ts +0 -32
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
package/dest/pxe.js
CHANGED
|
@@ -14,20 +14,23 @@ import { inspect } from 'util';
|
|
|
14
14
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
15
15
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
16
16
|
import { readCurrentClassId } from './contract_function_simulator/oracle/private_execution.js';
|
|
17
|
-
import {
|
|
17
|
+
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
18
|
+
import { ProxiedNodeFactory } from './contract_function_simulator/proxied_node.js';
|
|
18
19
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
19
20
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
20
21
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
22
|
+
import { JobCoordinator } from './job_coordinator/job_coordinator.js';
|
|
21
23
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
22
24
|
import { PrivateKernelOracleImpl } from './private_kernel/private_kernel_oracle_impl.js';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
25
|
+
import { AddressStore } from './storage/address_store/address_store.js';
|
|
26
|
+
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
27
|
+
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
28
|
+
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
29
|
+
import { NoteStore } from './storage/note_store/note_store.js';
|
|
30
|
+
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
31
|
+
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
32
|
+
import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
|
|
33
|
+
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
31
34
|
/**
|
|
32
35
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
33
36
|
* manage private state of users.
|
|
@@ -35,39 +38,43 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
35
38
|
node;
|
|
36
39
|
blockStateSynchronizer;
|
|
37
40
|
keyStore;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
contractStore;
|
|
42
|
+
noteStore;
|
|
43
|
+
capsuleStore;
|
|
44
|
+
anchorBlockStore;
|
|
45
|
+
senderTaggingStore;
|
|
46
|
+
senderAddressBookStore;
|
|
47
|
+
recipientTaggingStore;
|
|
48
|
+
addressStore;
|
|
49
|
+
privateEventStore;
|
|
46
50
|
simulator;
|
|
47
51
|
proverEnabled;
|
|
48
52
|
proofCreator;
|
|
49
53
|
protocolContractsProvider;
|
|
50
54
|
log;
|
|
51
55
|
jobQueue;
|
|
56
|
+
jobCoordinator;
|
|
52
57
|
debug;
|
|
53
|
-
constructor(node, blockStateSynchronizer, keyStore,
|
|
58
|
+
constructor(node, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debug){
|
|
54
59
|
this.node = node;
|
|
55
60
|
this.blockStateSynchronizer = blockStateSynchronizer;
|
|
56
61
|
this.keyStore = keyStore;
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
62
|
+
this.contractStore = contractStore;
|
|
63
|
+
this.noteStore = noteStore;
|
|
64
|
+
this.capsuleStore = capsuleStore;
|
|
65
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
66
|
+
this.senderTaggingStore = senderTaggingStore;
|
|
67
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
68
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
69
|
+
this.addressStore = addressStore;
|
|
70
|
+
this.privateEventStore = privateEventStore;
|
|
65
71
|
this.simulator = simulator;
|
|
66
72
|
this.proverEnabled = proverEnabled;
|
|
67
73
|
this.proofCreator = proofCreator;
|
|
68
74
|
this.protocolContractsProvider = protocolContractsProvider;
|
|
69
75
|
this.log = log;
|
|
70
76
|
this.jobQueue = jobQueue;
|
|
77
|
+
this.jobCoordinator = jobCoordinator;
|
|
71
78
|
this.debug = debug;
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
@@ -79,20 +86,22 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
79
86
|
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
80
87
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
81
88
|
const proverEnabled = !!config.proverEnabled;
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
89
|
+
const addressStore = new AddressStore(store);
|
|
90
|
+
const privateEventStore = new PrivateEventStore(store);
|
|
91
|
+
const contractStore = new ContractStore(store);
|
|
92
|
+
const noteStore = await NoteStore.create(store);
|
|
93
|
+
const anchorBlockStore = new AnchorBlockStore(store);
|
|
94
|
+
const senderTaggingStore = new SenderTaggingStore(store);
|
|
95
|
+
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
96
|
+
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
97
|
+
const capsuleStore = new CapsuleStore(store);
|
|
90
98
|
const keyStore = new KeyStore(store);
|
|
91
99
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
92
|
-
const synchronizer = new BlockSynchronizer(node,
|
|
93
|
-
const
|
|
100
|
+
const synchronizer = new BlockSynchronizer(node, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, loggerOrSuffix);
|
|
101
|
+
const jobCoordinator = new JobCoordinator(store);
|
|
102
|
+
const debugUtils = new PXEDebugUtils(contractStore, noteStore);
|
|
94
103
|
const jobQueue = new SerialQueue();
|
|
95
|
-
const pxe = new PXE(node, synchronizer, keyStore,
|
|
104
|
+
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
96
105
|
debugUtils.setPXE(pxe);
|
|
97
106
|
pxe.jobQueue.start();
|
|
98
107
|
await pxe.#registerProtocolContracts();
|
|
@@ -102,8 +111,8 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
102
111
|
}
|
|
103
112
|
// Internal methods
|
|
104
113
|
#getSimulatorForTx(overrides) {
|
|
105
|
-
const
|
|
106
|
-
return new ContractFunctionSimulator(
|
|
114
|
+
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
115
|
+
return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, ProxiedNodeFactory.create(this.node), this.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator);
|
|
107
116
|
}
|
|
108
117
|
#contextualizeError(err, ...context) {
|
|
109
118
|
let contextStr = '';
|
|
@@ -128,14 +137,27 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
128
137
|
if (this.jobQueue.length() != 0) {
|
|
129
138
|
this.log.warn(`PXE is already processing ${this.jobQueue.length()} jobs, concurrent execution is not supported. Will run once those are complete.`);
|
|
130
139
|
}
|
|
131
|
-
return this.jobQueue.put(
|
|
140
|
+
return this.jobQueue.put(async ()=>{
|
|
141
|
+
const jobId = this.jobCoordinator.beginJob();
|
|
142
|
+
this.log.verbose(`Beginning job ${jobId}`);
|
|
143
|
+
try {
|
|
144
|
+
const result = await fn(jobId);
|
|
145
|
+
this.log.verbose(`Committing job ${jobId}`);
|
|
146
|
+
await this.jobCoordinator.commitJob(jobId);
|
|
147
|
+
return result;
|
|
148
|
+
} catch (err) {
|
|
149
|
+
this.log.verbose(`Aborting job ${jobId}`);
|
|
150
|
+
await this.jobCoordinator.abortJob(jobId);
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
132
154
|
}
|
|
133
155
|
async #registerProtocolContracts() {
|
|
134
156
|
const registered = {};
|
|
135
157
|
for (const name of protocolContractNames){
|
|
136
158
|
const { address, contractClass, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
137
|
-
await this.
|
|
138
|
-
await this.
|
|
159
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
160
|
+
await this.contractStore.addContractInstance(instance);
|
|
139
161
|
registered[name] = address.toString();
|
|
140
162
|
}
|
|
141
163
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
@@ -152,18 +174,18 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
152
174
|
}
|
|
153
175
|
// Executes the entrypoint private function, as well as all nested private
|
|
154
176
|
// functions that might arise.
|
|
155
|
-
async #executePrivate(contractFunctionSimulator, txRequest, scopes) {
|
|
177
|
+
async #executePrivate(contractFunctionSimulator, txRequest, scopes, jobId) {
|
|
156
178
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
157
179
|
try {
|
|
158
|
-
const anchorBlockHeader = await this.
|
|
180
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
159
181
|
const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
|
|
160
182
|
// contract entrypoint
|
|
161
|
-
undefined, scopes);
|
|
183
|
+
undefined, scopes, jobId);
|
|
162
184
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
163
185
|
return result;
|
|
164
186
|
} catch (err) {
|
|
165
187
|
if (err instanceof SimulationError) {
|
|
166
|
-
await enrichSimulationError(err, this.
|
|
188
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
167
189
|
}
|
|
168
190
|
throw err;
|
|
169
191
|
}
|
|
@@ -175,14 +197,15 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
175
197
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
176
198
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
177
199
|
* accounts if not specified.
|
|
200
|
+
* @param jobId - The job ID for staged writes.
|
|
178
201
|
* @returns The simulation result containing the outputs of the utility function.
|
|
179
|
-
*/ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes) {
|
|
202
|
+
*/ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
|
|
180
203
|
try {
|
|
181
|
-
const anchorBlockHeader = await this.
|
|
182
|
-
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes);
|
|
204
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
205
|
+
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
|
|
183
206
|
} catch (err) {
|
|
184
207
|
if (err instanceof SimulationError) {
|
|
185
|
-
await enrichSimulationError(err, this.
|
|
208
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
186
209
|
}
|
|
187
210
|
throw err;
|
|
188
211
|
}
|
|
@@ -204,7 +227,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
204
227
|
} catch (err) {
|
|
205
228
|
if (err instanceof SimulationError) {
|
|
206
229
|
try {
|
|
207
|
-
await enrichPublicSimulationError(err, this.
|
|
230
|
+
await enrichPublicSimulationError(err, this.contractStore, this.log);
|
|
208
231
|
} catch (enrichErr) {
|
|
209
232
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
210
233
|
}
|
|
@@ -224,14 +247,14 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
224
247
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
225
248
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
226
249
|
const simulationAnchorBlock = privateExecutionResult.getSimulationAnchorBlockNumber();
|
|
227
|
-
const kernelOracle = new PrivateKernelOracleImpl(this.
|
|
250
|
+
const kernelOracle = new PrivateKernelOracleImpl(this.contractStore, this.keyStore, this.node, simulationAnchorBlock);
|
|
228
251
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
229
252
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
230
253
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
231
254
|
}
|
|
232
255
|
// Public API
|
|
233
256
|
getContractInstance(address) {
|
|
234
|
-
return this.
|
|
257
|
+
return this.contractStore.getContractInstance(address);
|
|
235
258
|
}
|
|
236
259
|
/**
|
|
237
260
|
* Returns the contract class metadata given a contract class id.
|
|
@@ -247,7 +270,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
247
270
|
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
248
271
|
* do for the time being.
|
|
249
272
|
*/ async getContractClassMetadata(id, includeArtifact = false) {
|
|
250
|
-
const artifact = await this.
|
|
273
|
+
const artifact = await this.contractStore.getContractArtifact(id);
|
|
251
274
|
if (!artifact) {
|
|
252
275
|
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
253
276
|
}
|
|
@@ -270,7 +293,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
270
293
|
*/ async getContractMetadata(address) {
|
|
271
294
|
let instance;
|
|
272
295
|
try {
|
|
273
|
-
instance = await this.
|
|
296
|
+
instance = await this.contractStore.getContractInstance(address);
|
|
274
297
|
} catch {
|
|
275
298
|
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
276
299
|
}
|
|
@@ -299,8 +322,8 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
299
322
|
this.log.info(`Registered account ${accountCompleteAddress.address.toString()}`);
|
|
300
323
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
301
324
|
}
|
|
302
|
-
await this.
|
|
303
|
-
await this.
|
|
325
|
+
await this.addressStore.addCompleteAddress(accountCompleteAddress);
|
|
326
|
+
await this.noteStore.addScope(accountCompleteAddress.address);
|
|
304
327
|
return accountCompleteAddress;
|
|
305
328
|
}
|
|
306
329
|
/**
|
|
@@ -318,7 +341,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
318
341
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
319
342
|
return sender;
|
|
320
343
|
}
|
|
321
|
-
const wasAdded = await this.
|
|
344
|
+
const wasAdded = await this.senderAddressBookStore.addSender(sender);
|
|
322
345
|
if (wasAdded) {
|
|
323
346
|
this.log.info(`Added sender:\n ${sender.toString()}`);
|
|
324
347
|
} else {
|
|
@@ -330,13 +353,13 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
330
353
|
* Retrieves senders registered in this PXE.
|
|
331
354
|
* @returns Senders registered in this PXE.
|
|
332
355
|
*/ getSenders() {
|
|
333
|
-
return this.
|
|
356
|
+
return this.senderAddressBookStore.getSenders();
|
|
334
357
|
}
|
|
335
358
|
/**
|
|
336
359
|
* Removes a sender registered in this PXE.
|
|
337
360
|
* @param sender - The address of the sender to remove.
|
|
338
361
|
*/ async removeSender(sender) {
|
|
339
|
-
const wasRemoved = await this.
|
|
362
|
+
const wasRemoved = await this.senderAddressBookStore.removeSender(sender);
|
|
340
363
|
if (wasRemoved) {
|
|
341
364
|
this.log.info(`Removed sender:\n ${sender.toString()}`);
|
|
342
365
|
} else {
|
|
@@ -348,7 +371,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
348
371
|
* @returns An array of the accounts registered on this PXE.
|
|
349
372
|
*/ async getRegisteredAccounts() {
|
|
350
373
|
// Get complete addresses of both the recipients and the accounts
|
|
351
|
-
const completeAddresses = await this.
|
|
374
|
+
const completeAddresses = await this.addressStore.getCompleteAddresses();
|
|
352
375
|
// Filter out the addresses not corresponding to accounts
|
|
353
376
|
const accounts = await this.keyStore.getAccounts();
|
|
354
377
|
return completeAddresses.filter((completeAddress)=>accounts.find((address)=>address.equals(completeAddress.address)));
|
|
@@ -359,7 +382,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
359
382
|
* @param artifact - The build artifact for the contract class.
|
|
360
383
|
*/ async registerContractClass(artifact) {
|
|
361
384
|
const { id: contractClassId } = await getContractClassFromArtifact(artifact);
|
|
362
|
-
await this.
|
|
385
|
+
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
363
386
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
364
387
|
}
|
|
365
388
|
/**
|
|
@@ -383,17 +406,17 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
383
406
|
if (!computedAddress.equals(instance.address)) {
|
|
384
407
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
385
408
|
}
|
|
386
|
-
await this.
|
|
409
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
387
410
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
388
411
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
389
412
|
} else {
|
|
390
413
|
// Otherwise, make sure there is an artifact already registered for that class id
|
|
391
|
-
artifact = await this.
|
|
414
|
+
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
392
415
|
if (!artifact) {
|
|
393
416
|
throw new Error(`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`);
|
|
394
417
|
}
|
|
395
418
|
}
|
|
396
|
-
await this.
|
|
419
|
+
await this.contractStore.addContractInstance(instance);
|
|
397
420
|
this.log.info(`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`);
|
|
398
421
|
}
|
|
399
422
|
/**
|
|
@@ -408,22 +431,22 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
408
431
|
// We disable concurrently updating contracts to avoid concurrently syncing with the node, or changing a contract's
|
|
409
432
|
// class while we're simulating it.
|
|
410
433
|
return this.#putInJobQueue(async ()=>{
|
|
411
|
-
const currentInstance = await this.
|
|
434
|
+
const currentInstance = await this.contractStore.getContractInstance(contractAddress);
|
|
412
435
|
if (!currentInstance) {
|
|
413
436
|
throw new Error(`Instance not found when updating a contract. Contract address: ${contractAddress}.`);
|
|
414
437
|
}
|
|
415
438
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
416
439
|
await this.blockStateSynchronizer.sync();
|
|
417
|
-
const header = await this.
|
|
440
|
+
const header = await this.anchorBlockStore.getBlockHeader();
|
|
418
441
|
const currentClassId = await readCurrentClassId(contractAddress, currentInstance, this.node, header.globalVariables.blockNumber, header.globalVariables.timestamp);
|
|
419
442
|
if (!contractClass.id.equals(currentClassId)) {
|
|
420
443
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
421
444
|
}
|
|
422
|
-
await this.
|
|
445
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
423
446
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
424
447
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
425
448
|
currentInstance.currentContractClassId = contractClass.id;
|
|
426
|
-
await this.
|
|
449
|
+
await this.contractStore.addContractInstance(currentInstance);
|
|
427
450
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
428
451
|
});
|
|
429
452
|
}
|
|
@@ -431,7 +454,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
431
454
|
* Retrieves the addresses of contracts added to this PXE.
|
|
432
455
|
* @returns An array of contracts addresses registered on this PXE.
|
|
433
456
|
*/ getContracts() {
|
|
434
|
-
return this.
|
|
457
|
+
return this.contractStore.getContractsAddresses();
|
|
435
458
|
}
|
|
436
459
|
/**
|
|
437
460
|
* Proves the private portion of a simulated transaction, ready to send to the network
|
|
@@ -445,14 +468,14 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
445
468
|
let privateExecutionResult;
|
|
446
469
|
// We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
|
|
447
470
|
// computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
|
|
448
|
-
return this.#putInJobQueue(async ()=>{
|
|
471
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
449
472
|
const totalTimer = new Timer();
|
|
450
473
|
try {
|
|
451
474
|
const syncTimer = new Timer();
|
|
452
475
|
await this.blockStateSynchronizer.sync();
|
|
453
476
|
const syncTime = syncTimer.ms();
|
|
454
477
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
455
|
-
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest);
|
|
478
|
+
privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
|
|
456
479
|
const { publicInputs, chonkProof, executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
457
480
|
simulate: false,
|
|
458
481
|
skipFeeEnforcement: false,
|
|
@@ -487,7 +510,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
487
510
|
if (preTagsUsedInTheTx.length > 0) {
|
|
488
511
|
// TODO(benesjan): The following is an expensive operation. Figure out a way to avoid it.
|
|
489
512
|
const txHash = (await txProvingResult.toTx()).txHash;
|
|
490
|
-
await this.
|
|
513
|
+
await this.senderTaggingStore.storePendingIndexes(preTagsUsedInTheTx, txHash);
|
|
491
514
|
this.log.debug(`Stored used pre-tags as sender for the tx`, {
|
|
492
515
|
preTagsUsedInTheTx
|
|
493
516
|
});
|
|
@@ -510,7 +533,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
510
533
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
511
534
|
*/ profileTx(txRequest, profileMode, skipProofGeneration = true) {
|
|
512
535
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
513
|
-
return this.#putInJobQueue(async ()=>{
|
|
536
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
514
537
|
const totalTimer = new Timer();
|
|
515
538
|
try {
|
|
516
539
|
const txInfo = {
|
|
@@ -526,7 +549,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
526
549
|
await this.blockStateSynchronizer.sync();
|
|
527
550
|
const syncTime = syncTimer.ms();
|
|
528
551
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
529
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest);
|
|
552
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
|
|
530
553
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
531
554
|
simulate: skipProofGeneration,
|
|
532
555
|
skipFeeEnforcement: false,
|
|
@@ -586,7 +609,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
586
609
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
587
610
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
588
611
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
589
|
-
return this.#putInJobQueue(async ()=>{
|
|
612
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
590
613
|
try {
|
|
591
614
|
const totalTimer = new Timer();
|
|
592
615
|
const txInfo = {
|
|
@@ -607,14 +630,14 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
607
630
|
// or not.
|
|
608
631
|
const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
|
|
609
632
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
610
|
-
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes);
|
|
633
|
+
const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
|
|
611
634
|
let publicInputs;
|
|
612
635
|
let executionSteps = [];
|
|
613
636
|
if (skipKernels) {
|
|
614
637
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
615
638
|
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
616
639
|
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await computeProtocolNullifier(await txRequest.toTxRequest().hash()) : privateExecutionResult.firstNullifier;
|
|
617
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.
|
|
640
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.contractStore));
|
|
618
641
|
} else {
|
|
619
642
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
620
643
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -690,7 +713,7 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
690
713
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
691
714
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
692
715
|
// delete the same read value, or reading values that another simulation is currently modifying).
|
|
693
|
-
return this.#putInJobQueue(async ()=>{
|
|
716
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
694
717
|
try {
|
|
695
718
|
const totalTimer = new Timer();
|
|
696
719
|
const syncTimer = new Timer();
|
|
@@ -698,7 +721,8 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
698
721
|
const syncTime = syncTimer.ms();
|
|
699
722
|
const functionTimer = new Timer();
|
|
700
723
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
701
|
-
|
|
724
|
+
await this.contractStore.syncPrivateState(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId));
|
|
725
|
+
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
702
726
|
const functionTime = functionTimer.ms();
|
|
703
727
|
const totalTime = totalTimer.ms();
|
|
704
728
|
const perFunction = [
|
|
@@ -740,13 +764,15 @@ import { SenderTaggingDataProvider } from './storage/tagging_data_provider/sende
|
|
|
740
764
|
* toBlock - The block number to search up to (exclusive). Optional. If provided, it must be > 0.
|
|
741
765
|
* Defaults to the latest known block to PXE + 1.
|
|
742
766
|
* @returns - The packed events with block and tx metadata.
|
|
743
|
-
*/
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
767
|
+
*/ getPrivateEvents(eventSelector, filter) {
|
|
768
|
+
return this.#putInJobQueue(async (jobId)=>{
|
|
769
|
+
await this.blockStateSynchronizer.sync();
|
|
770
|
+
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
771
|
+
await this.contractStore.syncPrivateState(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId));
|
|
772
|
+
const sanitizedFilter = await new PrivateEventFilterValidator(this.anchorBlockStore).validate(filter);
|
|
773
|
+
this.log.debug(`Getting private events for ${sanitizedFilter.contractAddress.toString()} from ${sanitizedFilter.fromBlock} to ${sanitizedFilter.toBlock}`);
|
|
774
|
+
return this.privateEventStore.getPrivateEvents(eventSelector, sanitizedFilter);
|
|
775
|
+
});
|
|
750
776
|
}
|
|
751
777
|
/**
|
|
752
778
|
* Stops the PXE's job queue.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
export declare class AddressStore {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(store: AztecAsyncKVStore);
|
|
7
|
+
addCompleteAddress(completeAddress: CompleteAddress): Promise<boolean>;
|
|
8
|
+
getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
|
|
9
|
+
getCompleteAddresses(): Promise<CompleteAddress[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvYWRkcmVzc19zdG9yZS9hZGRyZXNzX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFtQixpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsWUFBWTs7SUFLdkIsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBS25DO0lBRUQsa0JBQWtCLENBQUMsZUFBZSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBMEJyRTtJQVlELGtCQUFrQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLGVBQWUsR0FBRyxTQUFTLENBQUMsQ0FFOUU7SUFFSyxvQkFBb0IsSUFBSSxPQUFPLENBQUMsZUFBZSxFQUFFLENBQUMsQ0FJdkQ7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address_store.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/address_store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,YAAY;;IAKvB,YAAY,KAAK,EAAE,iBAAiB,EAKnC;IAED,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BrE;IAYD,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAE9E;IAEK,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAIvD;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AddressStore } from './address_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2FkZHJlc3Nfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQixDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/address_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AddressStore } from './address_store.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
+
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
3
|
+
export declare class AnchorBlockStore {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(store: AztecAsyncKVStore);
|
|
6
|
+
setHeader(header: BlockHeader): Promise<void>;
|
|
7
|
+
getBlockHeader(): Promise<BlockHeader>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yX2Jsb2NrX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hbmNob3JfYmxvY2tfc3RvcmUvYW5jaG9yX2Jsb2NrX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVLLFNBQVMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFbEQ7SUFFSyxjQUFjLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQU8zQztDQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor_block_store.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/anchor_block_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB;;IAI3B,YAAY,KAAK,EAAE,iBAAiB,EAGnC;IAEK,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AnchorBlockStore } from './anchor_block_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2FuY2hvcl9ibG9ja19zdG9yZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/anchor_block_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnchorBlockStore } from './anchor_block_store.js';
|
|
@@ -2,7 +2,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { type Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class CapsuleStore {
|
|
6
6
|
#private;
|
|
7
7
|
logger: Logger;
|
|
8
8
|
constructor(store: AztecAsyncKVStore);
|
|
@@ -54,4 +54,4 @@ export declare class CapsuleDataProvider {
|
|
|
54
54
|
readCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr): Promise<Fr[][]>;
|
|
55
55
|
setCapsuleArray(contractAddress: AztecAddress, baseSlot: Fr, content: Fr[][]): Promise<void>;
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
57
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fwc3VsZV9zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY2Fwc3VsZV9zdG9yZS9jYXBzdWxlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEUscUJBQWEsWUFBWTs7SUFNdkIsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUVmLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQU1uQztJQUVEOzs7Ozs7Ozs7T0FTRztJQUNHLFlBQVksQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLElBQUksRUFBRSxFQUFFLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFeEY7SUFFRDs7Ozs7T0FLRztJQUNHLFdBQVcsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLElBQUksRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsRUFBRSxHQUFHLElBQUksQ0FBQyxDQVcvRTtJQUVEOzs7O09BSUc7SUFDRyxhQUFhLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxJQUFJLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFMUU7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0gsV0FBVyxDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLFVBQVUsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQXdCdEc7SUFFRDs7Ozs7OztPQU9HO0lBQ0gsb0JBQW9CLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsRUFBRSxFQUFFLE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FnQmhHO0lBRUQsZ0JBQWdCLENBQUMsZUFBZSxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxFQUFFLEVBQUUsRUFBRSxDQUFDLENBc0I3RTtJQUVELGVBQWUsQ0FBQyxlQUFlLEVBQUUsWUFBWSxFQUFFLFFBQVEsRUFBRSxFQUFFLEVBQUUsT0FBTyxFQUFFLEVBQUUsRUFBRSxFQUFFLGlCQW1CM0U7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capsule_store.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_store/capsule_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,qBAAa,YAAY;;IAMvB,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,KAAK,EAAE,iBAAiB,EAMnC;IAED;;;;;;;;;OASG;IACG,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAExF;IAED;;;;;OAKG;IACG,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAW/E;IAED;;;;OAIG;IACG,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1E;IAED;;;;;;;;;;OAUG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBtG;IAED;;;;;;;OAOG;IACH,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhG;IAED,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAsB7E;IAED,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,iBAmB3E;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
export class
|
|
3
|
+
export class CapsuleStore {
|
|
4
4
|
#store;
|
|
5
5
|
// Arbitrary data stored by contracts. Key is computed as `${contractAddress}:${key}`
|
|
6
6
|
#capsules;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CapsuleStore } from './capsule_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NhcHN1bGVfc3RvcmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG9CQUFvQixDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CapsuleStore } from './capsule_store.js';
|