@aztec/pxe 3.0.0-nightly.20260105 → 3.0.0-nightly.20260106
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 +6 -6
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +11 -11
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +22 -22
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +31 -28
- 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 +3 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +17 -13
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +13 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +19 -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 +44 -44
- 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 +6 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +7 -7
- 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/logs/log_service.d.ts +12 -12
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +17 -17
- 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/private_kernel_oracle_impl.d.ts +4 -4
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +7 -7
- 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 +10 -10
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +81 -78
- 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_data_provider/private_event_data_provider.d.ts → private_event_store/private_event_store.d.ts} +4 -4
- 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} +2 -2
- 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/{tagging/recipient_sync/recipient_tagging_data_provider.d.ts → storage/tagging_store/recipient_tagging_store.d.ts} +4 -4
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/{tagging/recipient_sync/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_data_provider/sender_address_book.js → tagging_store/sender_address_book_store.js} +1 -1
- 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/index.d.ts +14 -1
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +22 -0
- 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 +6 -6
- 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 -17
- 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/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 +10 -10
- package/src/contract_function_simulator/contract_function_simulator.ts +49 -48
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +48 -47
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +51 -51
- 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 +6 -6
- package/src/events/private_event_filter_validator.ts +5 -5
- package/src/logs/log_service.ts +16 -16
- package/src/notes/note_service.ts +13 -13
- package/src/private_kernel/private_kernel_oracle_impl.ts +6 -6
- package/src/public_storage/public_storage_service.ts +3 -3
- package/src/pxe.ts +100 -101
- 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} +4 -4
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/{tagging/recipient_sync/recipient_tagging_data_provider.ts → storage/tagging_store/recipient_tagging_store.ts} +3 -3
- package/src/storage/{tagging_data_provider/sender_address_book.ts → tagging_store/sender_address_book_store.ts} +1 -1
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +3 -3
- package/src/tagging/index.ts +26 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -7
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +9 -19
- 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.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -4
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -3
- package/dest/storage/tagging_data_provider/sender_address_book.d.ts +0 -14
- package/dest/storage/tagging_data_provider/sender_address_book.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/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/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 -3
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
- /package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +0 -0
package/dest/pxe.js
CHANGED
|
@@ -14,21 +14,21 @@ 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
18
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
19
19
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
20
20
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
21
21
|
import { PrivateKernelExecutionProver } from './private_kernel/private_kernel_execution_prover.js';
|
|
22
22
|
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 {
|
|
31
|
-
import {
|
|
23
|
+
import { AddressStore } from './storage/address_store/address_store.js';
|
|
24
|
+
import { AnchorBlockStore } from './storage/anchor_block_store/anchor_block_store.js';
|
|
25
|
+
import { CapsuleStore } from './storage/capsule_store/capsule_store.js';
|
|
26
|
+
import { ContractStore } from './storage/contract_store/contract_store.js';
|
|
27
|
+
import { NoteStore } from './storage/note_store/note_store.js';
|
|
28
|
+
import { PrivateEventStore } from './storage/private_event_store/private_event_store.js';
|
|
29
|
+
import { RecipientTaggingStore } from './storage/tagging_store/recipient_tagging_store.js';
|
|
30
|
+
import { SenderAddressBookStore } from './storage/tagging_store/sender_address_book_store.js';
|
|
31
|
+
import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store.js';
|
|
32
32
|
/**
|
|
33
33
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
34
34
|
* manage private state of users.
|
|
@@ -36,15 +36,15 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
36
36
|
node;
|
|
37
37
|
blockStateSynchronizer;
|
|
38
38
|
keyStore;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
contractStore;
|
|
40
|
+
noteStore;
|
|
41
|
+
capsuleStore;
|
|
42
|
+
anchorBlockStore;
|
|
43
|
+
senderTaggingStore;
|
|
44
|
+
senderAddressBookStore;
|
|
45
|
+
recipientTaggingStore;
|
|
46
|
+
addressStore;
|
|
47
|
+
privateEventStore;
|
|
48
48
|
simulator;
|
|
49
49
|
proverEnabled;
|
|
50
50
|
proofCreator;
|
|
@@ -52,19 +52,19 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
52
52
|
log;
|
|
53
53
|
jobQueue;
|
|
54
54
|
debug;
|
|
55
|
-
constructor(node, blockStateSynchronizer, keyStore,
|
|
55
|
+
constructor(node, blockStateSynchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, debug){
|
|
56
56
|
this.node = node;
|
|
57
57
|
this.blockStateSynchronizer = blockStateSynchronizer;
|
|
58
58
|
this.keyStore = keyStore;
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
59
|
+
this.contractStore = contractStore;
|
|
60
|
+
this.noteStore = noteStore;
|
|
61
|
+
this.capsuleStore = capsuleStore;
|
|
62
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
63
|
+
this.senderTaggingStore = senderTaggingStore;
|
|
64
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
65
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
66
|
+
this.addressStore = addressStore;
|
|
67
|
+
this.privateEventStore = privateEventStore;
|
|
68
68
|
this.simulator = simulator;
|
|
69
69
|
this.proverEnabled = proverEnabled;
|
|
70
70
|
this.proofCreator = proofCreator;
|
|
@@ -82,21 +82,21 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
82
82
|
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
83
83
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
84
84
|
const proverEnabled = !!config.proverEnabled;
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
85
|
+
const addressStore = new AddressStore(store);
|
|
86
|
+
const privateEventStore = new PrivateEventStore(store);
|
|
87
|
+
const contractStore = new ContractStore(store);
|
|
88
|
+
const noteStore = await NoteStore.create(store);
|
|
89
|
+
const anchorBlockStore = new AnchorBlockStore(store);
|
|
90
|
+
const senderTaggingStore = new SenderTaggingStore(store);
|
|
91
|
+
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
92
|
+
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
93
|
+
const capsuleStore = new CapsuleStore(store);
|
|
94
94
|
const keyStore = new KeyStore(store);
|
|
95
95
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
96
|
-
const synchronizer = new BlockSynchronizer(node,
|
|
97
|
-
const debugUtils = new PXEDebugUtils(
|
|
96
|
+
const synchronizer = new BlockSynchronizer(node, anchorBlockStore, noteStore, tipsStore, config, loggerOrSuffix);
|
|
97
|
+
const debugUtils = new PXEDebugUtils(contractStore, noteStore);
|
|
98
98
|
const jobQueue = new SerialQueue();
|
|
99
|
-
const pxe = new PXE(node, synchronizer, keyStore,
|
|
99
|
+
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, debugUtils);
|
|
100
100
|
debugUtils.setPXE(pxe);
|
|
101
101
|
pxe.jobQueue.start();
|
|
102
102
|
await pxe.#registerProtocolContracts();
|
|
@@ -106,8 +106,8 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
106
106
|
}
|
|
107
107
|
// Internal methods
|
|
108
108
|
#getSimulatorForTx(overrides) {
|
|
109
|
-
const
|
|
110
|
-
return new ContractFunctionSimulator(
|
|
109
|
+
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
110
|
+
return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, this.node, this.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator);
|
|
111
111
|
}
|
|
112
112
|
#contextualizeError(err, ...context) {
|
|
113
113
|
let contextStr = '';
|
|
@@ -138,8 +138,8 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
138
138
|
const registered = {};
|
|
139
139
|
for (const name of protocolContractNames){
|
|
140
140
|
const { address, contractClass, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
141
|
-
await this.
|
|
142
|
-
await this.
|
|
141
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
142
|
+
await this.contractStore.addContractInstance(instance);
|
|
143
143
|
registered[name] = address.toString();
|
|
144
144
|
}
|
|
145
145
|
this.log.verbose(`Registered protocol contracts in pxe`, registered);
|
|
@@ -159,7 +159,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
159
159
|
async #executePrivate(contractFunctionSimulator, txRequest, scopes) {
|
|
160
160
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
161
161
|
try {
|
|
162
|
-
const anchorBlockHeader = await this.
|
|
162
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
163
163
|
const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
|
|
164
164
|
// contract entrypoint
|
|
165
165
|
undefined, scopes);
|
|
@@ -167,7 +167,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
167
167
|
return result;
|
|
168
168
|
} catch (err) {
|
|
169
169
|
if (err instanceof SimulationError) {
|
|
170
|
-
await enrichSimulationError(err, this.
|
|
170
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
171
171
|
}
|
|
172
172
|
throw err;
|
|
173
173
|
}
|
|
@@ -182,11 +182,11 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
182
182
|
* @returns The simulation result containing the outputs of the utility function.
|
|
183
183
|
*/ async #simulateUtility(contractFunctionSimulator, call, authWitnesses, scopes) {
|
|
184
184
|
try {
|
|
185
|
-
const anchorBlockHeader = await this.
|
|
185
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
186
186
|
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes);
|
|
187
187
|
} catch (err) {
|
|
188
188
|
if (err instanceof SimulationError) {
|
|
189
|
-
await enrichSimulationError(err, this.
|
|
189
|
+
await enrichSimulationError(err, this.contractStore, this.log);
|
|
190
190
|
}
|
|
191
191
|
throw err;
|
|
192
192
|
}
|
|
@@ -208,7 +208,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
208
208
|
} catch (err) {
|
|
209
209
|
if (err instanceof SimulationError) {
|
|
210
210
|
try {
|
|
211
|
-
await enrichPublicSimulationError(err, this.
|
|
211
|
+
await enrichPublicSimulationError(err, this.contractStore, this.log);
|
|
212
212
|
} catch (enrichErr) {
|
|
213
213
|
this.log.error(`Failed to enrich public simulation error: ${enrichErr}`);
|
|
214
214
|
}
|
|
@@ -228,14 +228,14 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
228
228
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
229
229
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
230
230
|
const simulationAnchorBlock = privateExecutionResult.getSimulationAnchorBlockNumber();
|
|
231
|
-
const kernelOracle = new PrivateKernelOracleImpl(this.
|
|
231
|
+
const kernelOracle = new PrivateKernelOracleImpl(this.contractStore, this.keyStore, this.node, simulationAnchorBlock);
|
|
232
232
|
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
233
233
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
234
234
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
235
235
|
}
|
|
236
236
|
// Public API
|
|
237
237
|
getContractInstance(address) {
|
|
238
|
-
return this.
|
|
238
|
+
return this.contractStore.getContractInstance(address);
|
|
239
239
|
}
|
|
240
240
|
/**
|
|
241
241
|
* Returns the contract class metadata given a contract class id.
|
|
@@ -251,7 +251,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
251
251
|
* during a public deployment. We probably want a nicer and more general API for this, but it'll have to
|
|
252
252
|
* do for the time being.
|
|
253
253
|
*/ async getContractClassMetadata(id, includeArtifact = false) {
|
|
254
|
-
const artifact = await this.
|
|
254
|
+
const artifact = await this.contractStore.getContractArtifact(id);
|
|
255
255
|
if (!artifact) {
|
|
256
256
|
this.log.warn(`No artifact found for contract class ${id.toString()} when looking for its metadata`);
|
|
257
257
|
}
|
|
@@ -274,7 +274,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
274
274
|
*/ async getContractMetadata(address) {
|
|
275
275
|
let instance;
|
|
276
276
|
try {
|
|
277
|
-
instance = await this.
|
|
277
|
+
instance = await this.contractStore.getContractInstance(address);
|
|
278
278
|
} catch {
|
|
279
279
|
this.log.warn(`No instance found for contract ${address.toString()} when looking for its metadata`);
|
|
280
280
|
}
|
|
@@ -303,8 +303,8 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
303
303
|
this.log.info(`Registered account ${accountCompleteAddress.address.toString()}`);
|
|
304
304
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
305
305
|
}
|
|
306
|
-
await this.
|
|
307
|
-
await this.
|
|
306
|
+
await this.addressStore.addCompleteAddress(accountCompleteAddress);
|
|
307
|
+
await this.noteStore.addScope(accountCompleteAddress.address);
|
|
308
308
|
return accountCompleteAddress;
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
@@ -322,7 +322,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
322
322
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
323
323
|
return sender;
|
|
324
324
|
}
|
|
325
|
-
const wasAdded = await this.
|
|
325
|
+
const wasAdded = await this.senderAddressBookStore.addSender(sender);
|
|
326
326
|
if (wasAdded) {
|
|
327
327
|
this.log.info(`Added sender:\n ${sender.toString()}`);
|
|
328
328
|
} else {
|
|
@@ -334,13 +334,13 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
334
334
|
* Retrieves senders registered in this PXE.
|
|
335
335
|
* @returns Senders registered in this PXE.
|
|
336
336
|
*/ getSenders() {
|
|
337
|
-
return this.
|
|
337
|
+
return this.senderAddressBookStore.getSenders();
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
340
|
* Removes a sender registered in this PXE.
|
|
341
341
|
* @param sender - The address of the sender to remove.
|
|
342
342
|
*/ async removeSender(sender) {
|
|
343
|
-
const wasRemoved = await this.
|
|
343
|
+
const wasRemoved = await this.senderAddressBookStore.removeSender(sender);
|
|
344
344
|
if (wasRemoved) {
|
|
345
345
|
this.log.info(`Removed sender:\n ${sender.toString()}`);
|
|
346
346
|
} else {
|
|
@@ -352,7 +352,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
352
352
|
* @returns An array of the accounts registered on this PXE.
|
|
353
353
|
*/ async getRegisteredAccounts() {
|
|
354
354
|
// Get complete addresses of both the recipients and the accounts
|
|
355
|
-
const completeAddresses = await this.
|
|
355
|
+
const completeAddresses = await this.addressStore.getCompleteAddresses();
|
|
356
356
|
// Filter out the addresses not corresponding to accounts
|
|
357
357
|
const accounts = await this.keyStore.getAccounts();
|
|
358
358
|
return completeAddresses.filter((completeAddress)=>accounts.find((address)=>address.equals(completeAddress.address)));
|
|
@@ -363,7 +363,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
363
363
|
* @param artifact - The build artifact for the contract class.
|
|
364
364
|
*/ async registerContractClass(artifact) {
|
|
365
365
|
const { id: contractClassId } = await getContractClassFromArtifact(artifact);
|
|
366
|
-
await this.
|
|
366
|
+
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
367
367
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
@@ -387,17 +387,17 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
387
387
|
if (!computedAddress.equals(instance.address)) {
|
|
388
388
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
389
389
|
}
|
|
390
|
-
await this.
|
|
390
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
391
391
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
392
392
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
393
393
|
} else {
|
|
394
394
|
// Otherwise, make sure there is an artifact already registered for that class id
|
|
395
|
-
artifact = await this.
|
|
395
|
+
artifact = await this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
396
396
|
if (!artifact) {
|
|
397
397
|
throw new Error(`Artifact not found when registering an instance. Contract class: ${instance.currentContractClassId}.`);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
await this.
|
|
400
|
+
await this.contractStore.addContractInstance(instance);
|
|
401
401
|
this.log.info(`Added contract ${artifact.name} at ${instance.address.toString()} with class ${instance.currentContractClassId}`);
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
@@ -412,22 +412,22 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
412
412
|
// We disable concurrently updating contracts to avoid concurrently syncing with the node, or changing a contract's
|
|
413
413
|
// class while we're simulating it.
|
|
414
414
|
return this.#putInJobQueue(async ()=>{
|
|
415
|
-
const currentInstance = await this.
|
|
415
|
+
const currentInstance = await this.contractStore.getContractInstance(contractAddress);
|
|
416
416
|
if (!currentInstance) {
|
|
417
417
|
throw new Error(`Instance not found when updating a contract. Contract address: ${contractAddress}.`);
|
|
418
418
|
}
|
|
419
419
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
420
420
|
await this.blockStateSynchronizer.sync();
|
|
421
|
-
const header = await this.
|
|
421
|
+
const header = await this.anchorBlockStore.getBlockHeader();
|
|
422
422
|
const currentClassId = await readCurrentClassId(contractAddress, currentInstance, this.node, header.globalVariables.blockNumber, header.globalVariables.timestamp);
|
|
423
423
|
if (!contractClass.id.equals(currentClassId)) {
|
|
424
424
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
425
425
|
}
|
|
426
|
-
await this.
|
|
426
|
+
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
427
427
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
428
428
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
429
429
|
currentInstance.currentContractClassId = contractClass.id;
|
|
430
|
-
await this.
|
|
430
|
+
await this.contractStore.addContractInstance(currentInstance);
|
|
431
431
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
432
432
|
});
|
|
433
433
|
}
|
|
@@ -435,7 +435,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
435
435
|
* Retrieves the addresses of contracts added to this PXE.
|
|
436
436
|
* @returns An array of contracts addresses registered on this PXE.
|
|
437
437
|
*/ getContracts() {
|
|
438
|
-
return this.
|
|
438
|
+
return this.contractStore.getContractsAddresses();
|
|
439
439
|
}
|
|
440
440
|
/**
|
|
441
441
|
* Proves the private portion of a simulated transaction, ready to send to the network
|
|
@@ -491,7 +491,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
491
491
|
if (preTagsUsedInTheTx.length > 0) {
|
|
492
492
|
// TODO(benesjan): The following is an expensive operation. Figure out a way to avoid it.
|
|
493
493
|
const txHash = (await txProvingResult.toTx()).txHash;
|
|
494
|
-
await this.
|
|
494
|
+
await this.senderTaggingStore.storePendingIndexes(preTagsUsedInTheTx, txHash);
|
|
495
495
|
this.log.debug(`Stored used pre-tags as sender for the tx`, {
|
|
496
496
|
preTagsUsedInTheTx
|
|
497
497
|
});
|
|
@@ -618,7 +618,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
618
618
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
619
619
|
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
620
620
|
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await computeProtocolNullifier(await txRequest.toTxRequest().hash()) : privateExecutionResult.firstNullifier;
|
|
621
|
-
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.
|
|
621
|
+
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.contractStore));
|
|
622
622
|
} else {
|
|
623
623
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
624
624
|
({ publicInputs, executionSteps } = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
@@ -702,6 +702,7 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
702
702
|
const syncTime = syncTimer.ms();
|
|
703
703
|
const functionTimer = new Timer();
|
|
704
704
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
705
|
+
await this.contractStore.syncPrivateState(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall));
|
|
705
706
|
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes);
|
|
706
707
|
const functionTime = functionTimer.ms();
|
|
707
708
|
const totalTime = totalTimer.ms();
|
|
@@ -744,13 +745,15 @@ import { RecipientTaggingDataProvider } from './tagging/recipient_sync/recipient
|
|
|
744
745
|
* toBlock - The block number to search up to (exclusive). Optional. If provided, it must be > 0.
|
|
745
746
|
* Defaults to the latest known block to PXE + 1.
|
|
746
747
|
* @returns - The packed events with block and tx metadata.
|
|
747
|
-
*/
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
748
|
+
*/ getPrivateEvents(eventSelector, filter) {
|
|
749
|
+
return this.#putInJobQueue(async ()=>{
|
|
750
|
+
await this.blockStateSynchronizer.sync();
|
|
751
|
+
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
752
|
+
await this.contractStore.syncPrivateState(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall));
|
|
753
|
+
const sanitizedFilter = await new PrivateEventFilterValidator(this.anchorBlockStore).validate(filter);
|
|
754
|
+
this.log.debug(`Getting private events for ${sanitizedFilter.contractAddress.toString()} from ${sanitizedFilter.fromBlock} to ${sanitizedFilter.toBlock}`);
|
|
755
|
+
return this.privateEventStore.getPrivateEvents(eventSelector, sanitizedFilter);
|
|
756
|
+
});
|
|
754
757
|
}
|
|
755
758
|
/**
|
|
756
759
|
* 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: Azt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BAAiB,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';
|
|
@@ -6,13 +6,13 @@ import { type ContractArtifact, type FunctionAbi, type FunctionArtifactWithContr
|
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import { type ContractClass, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* ContractStore serves as a data manager and retriever for Aztec.nr contracts.
|
|
10
10
|
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
11
11
|
* from a given contract address and function selector. The class maintains a cache of ContractTree instances
|
|
12
12
|
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
13
13
|
* the required information and facilitate cryptographic proof generation.
|
|
14
14
|
*/
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class ContractStore {
|
|
16
16
|
#private;
|
|
17
17
|
constructor(store: AztecAsyncKVStore);
|
|
18
18
|
addContractArtifact(id: Fr, contract: ContractArtifact): Promise<void>;
|
|
@@ -62,5 +62,6 @@ export declare class ContractDataProvider {
|
|
|
62
62
|
getDebugContractName(contractAddress: AztecAddress): Promise<string | undefined>;
|
|
63
63
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string>;
|
|
64
64
|
getFunctionCall(functionName: string, args: any[], to: AztecAddress): Promise<FunctionCall>;
|
|
65
|
+
syncPrivateState(contractAddress: AztecAddress, functionToInvokeAfterSync: FunctionSelector | null, utilityExecutor: (privateSyncCall: FunctionCall) => Promise<any>): Promise<any>;
|
|
65
66
|
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2NvbnRyYWN0X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUV4RSxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxXQUFXLEVBRWhCLEtBQUssZ0NBQWdDLEVBQ3JDLFlBQVksRUFDWixLQUFLLHFCQUFxQixFQUMxQixnQkFBZ0IsRUFNakIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxFQUNMLEtBQUssYUFBYSxFQUNsQixLQUFLLDJCQUEyQixFQUdqQy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AAe,EAAE,YAAY,+BAG9D;IAEY,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,mBAI1F;IA8BY,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAuBvG;IAGY,gBAAgB,CAC3B,eAAe,EAAE,YAAY,EAC7B,yBAAyB,EAAE,gBAAgB,GAAG,IAAI,EAClD,eAAe,EAAE,CAAC,eAAe,EAAE,YAAY,KAAK,OAAO,CAAC,GAAG,CAAC,gBAajE;CACF"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
+
import { isProtocolContract } from '@aztec/protocol-contracts';
|
|
2
3
|
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
3
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
5
|
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
6
|
import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* ContractStore serves as a data manager and retriever for Aztec.nr contracts.
|
|
8
9
|
* It provides methods to obtain contract addresses, function ABI, bytecode, and membership witnesses
|
|
9
10
|
* from a given contract address and function selector. The class maintains a cache of ContractTree instances
|
|
10
11
|
* to efficiently serve the requested data. It interacts with the ContractDatabase and AztecNode to fetch
|
|
11
12
|
* the required information and facilitate cryptographic proof generation.
|
|
12
|
-
*/ export class
|
|
13
|
+
*/ export class ContractStore {
|
|
13
14
|
/** Map from contract class id to private function tree. */ // TODO: Update it to be LRU cache so that it doesn't keep all the data all the time.
|
|
14
15
|
#privateFunctionTrees = new Map();
|
|
15
16
|
/** Map from contract address to contract class id */ #contractClassIdMap = new Map();
|
|
@@ -221,4 +222,15 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
221
222
|
returnTypes: functionDao.returnTypes
|
|
222
223
|
};
|
|
223
224
|
}
|
|
225
|
+
// Synchronize target contract data
|
|
226
|
+
async syncPrivateState(contractAddress, functionToInvokeAfterSync, utilityExecutor) {
|
|
227
|
+
// Protocol contracts don't have private state to sync
|
|
228
|
+
if (!isProtocolContract(contractAddress)) {
|
|
229
|
+
const syncPrivateStateFunctionCall = await this.getFunctionCall('sync_private_state', [], contractAddress);
|
|
230
|
+
if (functionToInvokeAfterSync && functionToInvokeAfterSync.equals(syncPrivateStateFunctionCall.selector)) {
|
|
231
|
+
throw new Error('Forbidden `sync_private_state` invocation. `sync_private_state` can only be invoked by PXE, manual execution can lead to inconsistencies.');
|
|
232
|
+
}
|
|
233
|
+
return utilityExecutor(syncPrivateStateFunctionCall);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
224
236
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ContractStore } from './contract_store.js';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContractStore } from './contract_store.js';
|
|
@@ -24,4 +24,4 @@ export declare class PrivateFunctionsTree {
|
|
|
24
24
|
getFunctionMembershipWitness(selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
25
25
|
private getTree;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvY29udHJhY3Rfc3RvcmUvcHJpdmF0ZV9mdW5jdGlvbnNfdHJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUd4RCxPQUFPLEVBQUUsaUJBQWlCLEVBQW1CLE1BQU0seUJBQXlCLENBQUM7QUFDN0UsT0FBTyxFQUFFLEtBQUssZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQWdCLE1BQU0sbUJBQW1CLENBQUM7QUFRMUY7Ozs7O0dBS0c7QUFDSCxxQkFBYSxvQkFBb0I7SUFHWCxPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZyRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBQWE7SUFFMUIsT0FBTyxlQUFxRTtJQUU1RSxPQUFhLE1BQU0sQ0FBQyxRQUFRLEVBQUUsZ0JBQWdCLGlDQU83QztJQUVEOzs7Ozs7OztPQVFHO0lBQ1UsNEJBQTRCLENBQ3ZDLFFBQVEsRUFBRSxnQkFBZ0IsR0FDekIsT0FBTyxDQUFDLGlCQUFpQixDQUFDLE9BQU8sb0JBQW9CLENBQUMsQ0FBQyxDQWV6RDtZQUVhLE9BQU87Q0FNdEIifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src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