@aztec/pxe 0.0.1-commit.d431d1c → 0.0.1-commit.e3c1de76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +7 -5
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +56 -16
- package/dest/config/index.d.ts +3 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +17 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +2 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +8 -13
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +13 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +5 -3
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +27 -17
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -22
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +0 -37
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +19 -8
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +21 -15
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +39 -43
- package/dest/contract_sync/index.d.ts +23 -0
- package/dest/contract_sync/index.d.ts.map +1 -0
- package/dest/contract_sync/index.js +54 -0
- package/dest/debug/pxe_debug_utils.d.ts +16 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +20 -10
- 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 +12 -6
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +13 -7
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +19 -8
- package/dest/events/event_service.d.ts +5 -6
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +6 -7
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +5 -4
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +18 -15
- package/dest/notes/note_service.d.ts +6 -6
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +4 -3
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +2 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -3
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/pxe.d.ts +1 -1
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +19 -15
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.js +6 -8
- package/dest/storage/contract_store/contract_store.d.ts +1 -2
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +22 -25
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +48 -50
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +276 -252
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +17 -4
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +198 -147
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +183 -113
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +46 -0
- package/dest/tagging/index.d.ts +2 -1
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +3 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +5 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +3 -2
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +2 -2
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +5 -8
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +3 -2
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +7 -4
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +70 -33
- package/src/config/index.ts +14 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +7 -15
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +18 -9
- package/src/contract_function_simulator/oracle/oracle.ts +34 -21
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -60
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +32 -10
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +59 -51
- package/src/contract_sync/index.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +26 -11
- package/src/entrypoints/client/bundle/utils.ts +7 -14
- package/src/entrypoints/client/lazy/utils.ts +8 -14
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +1 -0
- package/src/entrypoints/server/utils.ts +15 -19
- package/src/events/event_service.ts +5 -7
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +29 -13
- package/src/notes/note_service.ts +21 -20
- package/src/oracle_version.ts +4 -3
- package/src/private_kernel/private_kernel_execution_prover.ts +6 -3
- package/src/private_kernel/private_kernel_oracle.ts +2 -2
- package/src/pxe.ts +48 -17
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +8 -8
- package/src/storage/contract_store/contract_store.ts +22 -31
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +314 -318
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +250 -190
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +31 -21
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +210 -126
- package/src/tagging/get_all_logs_by_tags.ts +68 -0
- package/src/tagging/index.ts +1 -0
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -1
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +7 -1
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +3 -1
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -17
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +12 -3
- package/dest/tree_membership/tree_membership_service.d.ts +0 -50
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -75
- package/src/tree_membership/tree_membership_service.ts +0 -97
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
2
1
|
import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
3
2
|
import { MAX_RPC_LEN } from '@aztec/stdlib/interfaces/client';
|
|
4
3
|
import { Note, NoteDao } from '@aztec/stdlib/note';
|
|
@@ -6,11 +5,13 @@ import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
|
6
5
|
export class NoteService {
|
|
7
6
|
noteStore;
|
|
8
7
|
aztecNode;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
anchorBlockHeader;
|
|
9
|
+
jobId;
|
|
10
|
+
constructor(noteStore, aztecNode, anchorBlockHeader, jobId){
|
|
11
11
|
this.noteStore = noteStore;
|
|
12
12
|
this.aztecNode = aztecNode;
|
|
13
|
-
this.
|
|
13
|
+
this.anchorBlockHeader = anchorBlockHeader;
|
|
14
|
+
this.jobId = jobId;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Retrieves a set of notes stored in the database for a given contract address and storage slot.
|
|
@@ -27,7 +28,7 @@ export class NoteService {
|
|
|
27
28
|
storageSlot,
|
|
28
29
|
status,
|
|
29
30
|
scopes
|
|
30
|
-
});
|
|
31
|
+
}, this.jobId);
|
|
31
32
|
return noteDaos.map(({ contractAddress, owner, storageSlot, randomness, noteNonce, note, noteHash, siloedNullifier })=>({
|
|
32
33
|
contractAddress,
|
|
33
34
|
owner,
|
|
@@ -52,10 +53,10 @@ export class NoteService {
|
|
|
52
53
|
*
|
|
53
54
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
54
55
|
*/ async syncNoteNullifiers(contractAddress) {
|
|
55
|
-
const anchorBlockHash =
|
|
56
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
56
57
|
const contractNotes = await this.noteStore.getNotes({
|
|
57
58
|
contractAddress
|
|
58
|
-
});
|
|
59
|
+
}, this.jobId);
|
|
59
60
|
if (contractNotes.length === 0) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
@@ -83,9 +84,9 @@ export class NoteService {
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
}).filter((nullifier)=>nullifier !== undefined);
|
|
86
|
-
await this.noteStore.applyNullifiers(foundNullifiers);
|
|
87
|
+
await this.noteStore.applyNullifiers(foundNullifiers, this.jobId);
|
|
87
88
|
}
|
|
88
|
-
async
|
|
89
|
+
async validateAndStoreNote(contractAddress, owner, storageSlot, randomness, noteNonce, content, noteHash, nullifier, txHash, recipient) {
|
|
89
90
|
// We are going to store the new note in the NoteStore, which will let us later return it via `getNotes`.
|
|
90
91
|
// There's two things we need to check before we do this however:
|
|
91
92
|
// - we must make sure the note does actually exist in the note hash tree
|
|
@@ -104,9 +105,8 @@ export class NoteService {
|
|
|
104
105
|
// number which *should* be recent enough to be available, even for non-archive nodes.
|
|
105
106
|
// Also note that the note should never be ahead of the synced block here since `fetchTaggedLogs` only processes
|
|
106
107
|
// logs up to the synced block making this only an additional safety check.
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const anchorBlockHash = L2BlockHash.fromField(await anchorBlockHeader.hash());
|
|
108
|
+
const anchorBlockNumber = this.anchorBlockHeader.getBlockNumber();
|
|
109
|
+
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
110
110
|
// By computing siloed and unique note hashes ourselves we prevent contracts from interfering with the note storage
|
|
111
111
|
// of other contracts, which would constitute a security breach.
|
|
112
112
|
const uniqueNoteHash = await computeUniqueNoteHash(noteNonce, await siloNoteHash(contractAddress, noteHash));
|
|
@@ -132,7 +132,7 @@ export class NoteService {
|
|
|
132
132
|
// The note was found by `recipient`, so we use that as the scope when storing the note.
|
|
133
133
|
await this.noteStore.addNotes([
|
|
134
134
|
noteDao
|
|
135
|
-
], recipient);
|
|
135
|
+
], recipient, this.jobId);
|
|
136
136
|
if (nullifierIndex !== undefined) {
|
|
137
137
|
// We found nullifier index which implies that the note has already been nullified.
|
|
138
138
|
const { data: _, ...blockHashAndNum } = nullifierIndex;
|
|
@@ -141,7 +141,7 @@ export class NoteService {
|
|
|
141
141
|
data: siloedNullifier,
|
|
142
142
|
...blockHashAndNum
|
|
143
143
|
}
|
|
144
|
-
]);
|
|
144
|
+
], this.jobId);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
package/dest/oracle_version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const ORACLE_VERSION =
|
|
2
|
-
export declare const ORACLE_INTERFACE_HASH = "
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export declare const ORACLE_VERSION = 9;
|
|
2
|
+
export declare const ORACLE_INTERFACE_HASH = "9866cc52510acaef75a3d47a0ed501fd9ff92b9d53b2c8a88c8a3ffd04ced81f";
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JhY2xlX3ZlcnNpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9vcmFjbGVfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxlQUFPLE1BQU0sY0FBYyxJQUFJLENBQUM7QUFLaEMsZUFBTyxNQUFNLHFCQUFxQixxRUFBcUUsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle_version.d.ts","sourceRoot":"","sources":["../src/oracle_version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"oracle_version.d.ts","sourceRoot":"","sources":["../src/oracle_version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,IAAI,CAAC;AAKhC,eAAO,MAAM,qBAAqB,qEAAqE,CAAC"}
|
package/dest/oracle_version.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 9;
|
|
8
8
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
9
|
-
/// which in turn implies that you need to update the ORACLE_VERSION constant
|
|
10
|
-
|
|
9
|
+
/// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
|
|
10
|
+
/// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
11
|
+
export const ORACLE_INTERFACE_HASH = '9866cc52510acaef75a3d47a0ed501fd9ff92b9d53b2c8a88c8a3ffd04ced81f';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
1
2
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
2
3
|
import { type PrivateKernelExecutionProofOutput, type PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
3
4
|
import { type PrivateExecutionResult, TxRequest } from '@aztec/stdlib/tx';
|
|
@@ -18,7 +19,7 @@ export declare class PrivateKernelExecutionProver {
|
|
|
18
19
|
private proofCreator;
|
|
19
20
|
private fakeProofs;
|
|
20
21
|
private log;
|
|
21
|
-
constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean);
|
|
22
|
+
constructor(oracle: PrivateKernelOracle, proofCreator: PrivateKernelProver, fakeProofs?: boolean, bindings?: LoggerBindings);
|
|
22
23
|
/**
|
|
23
24
|
* Generate a proof for a given transaction request and execution result.
|
|
24
25
|
* The function iterates through the nested executions in the execution result, creates private call data,
|
|
@@ -41,4 +42,4 @@ export declare class PrivateKernelExecutionProver {
|
|
|
41
42
|
private getVkData;
|
|
42
43
|
private createPrivateCallData;
|
|
43
44
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBTXZGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDM0UsT0FBTyxFQVFMLEtBQUssaUNBQWlDLEVBS3RDLEtBQUssb0NBQW9DLEVBRTFDLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIsT0FBTyxFQUVMLEtBQUssc0JBQXNCLEVBQzNCLFNBQVMsRUFHVixNQUFNLGtCQUFrQixDQUFDO0FBSTFCLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFTdEUsTUFBTSxXQUFXLGtDQUFrQztJQUNqRCxRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLGtCQUFrQixFQUFFLE9BQU8sQ0FBQztJQUM1QixXQUFXLEVBQUUsT0FBTyxHQUFHLGlCQUFpQixHQUFHLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDNUQ7QUFFRDs7Ozs7R0FLRztBQUNILHFCQUFhLDRCQUE0QjtJQUlyQyxPQUFPLENBQUMsTUFBTTtJQUNkLE9BQU8sQ0FBQyxZQUFZO0lBQ3BCLE9BQU8sQ0FBQyxVQUFVO0lBTHBCLE9BQU8sQ0FBQyxHQUFHLENBQVM7SUFFcEIsWUFDVSxNQUFNLEVBQUUsbUJBQW1CLEVBQzNCLFlBQVksRUFBRSxtQkFBbUIsRUFDakMsVUFBVSxVQUFRLEVBQzFCLFFBQVEsQ0FBQyxFQUFFLGNBQWMsRUFHMUI7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0csZ0JBQWdCLENBQ3BCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLGVBQWUsRUFBRSxzQkFBc0IsRUFDdkMsRUFBRSxRQUFRLEVBQUUsa0JBQWtCLEVBQUUsV0FBVyxFQUFFLEdBQUUsa0NBSTlDLEdBQ0EsT0FBTyxDQUFDLGlDQUFpQyxDQUFDLG9DQUFvQyxDQUFDLENBQUMsQ0FvUmxGO0lBRUQ7Ozs7O09BS0c7SUFDSCxPQUFPLENBQUMsdUJBQXVCO1lBb0JqQixTQUFTO1lBU1QscUJBQXFCO0NBK0JwQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAoRlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
|
|
@@ -27,11 +27,11 @@ const NULL_SIMULATE_OUTPUT = {
|
|
|
27
27
|
proofCreator;
|
|
28
28
|
fakeProofs;
|
|
29
29
|
log;
|
|
30
|
-
constructor(oracle, proofCreator, fakeProofs = false){
|
|
30
|
+
constructor(oracle, proofCreator, fakeProofs = false, bindings){
|
|
31
31
|
this.oracle = oracle;
|
|
32
32
|
this.proofCreator = proofCreator;
|
|
33
33
|
this.fakeProofs = fakeProofs;
|
|
34
|
-
this.log = createLogger('pxe:private-kernel-execution-prover');
|
|
34
|
+
this.log = createLogger('pxe:private-kernel-execution-prover', bindings);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Generate a proof for a given transaction request and execution result.
|
|
@@ -5,7 +5,7 @@ import { MembershipWitness } from '@aztec/foundation/trees';
|
|
|
5
5
|
import type { KeyStore } from '@aztec/key-store';
|
|
6
6
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import {
|
|
8
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
9
9
|
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
10
10
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
@@ -20,7 +20,7 @@ export declare class PrivateKernelOracle {
|
|
|
20
20
|
private keyStore;
|
|
21
21
|
private node;
|
|
22
22
|
private blockHash;
|
|
23
|
-
constructor(contractStore: ContractStore, keyStore: KeyStore, node: AztecNode, blockHash:
|
|
23
|
+
constructor(contractStore: ContractStore, keyStore: KeyStore, node: AztecNode, blockHash: BlockHash);
|
|
24
24
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
25
25
|
getContractAddressPreimage(address: AztecAddress): Promise<ContractInstanceWithAddress & {
|
|
26
26
|
saltedInitializationHash: Fr;
|
|
@@ -56,4 +56,4 @@ export declare class PrivateKernelOracle {
|
|
|
56
56
|
*/
|
|
57
57
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJpdmF0ZV9rZXJuZWwvcHJpdmF0ZV9rZXJuZWxfb3JhY2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBL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HO0lBQ0ksa0JBQWtCLENBQUMsZUFBZSxFQUFFLEtBQUssR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBRXpFO0lBRUQsMkVBQTJFO0lBQ3BFLG9CQUFvQixDQUFDLGVBQWUsRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLGdCQUFnQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRWxIO0lBRUQ7OztPQUdHO0lBQ1Usc0JBQXNCLENBQUMsZUFBZSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsbUJBQW1CLENBQUMsQ0E4Qi9GO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_kernel_oracle.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAA2B,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"private_kernel_oracle.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAA2B,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,O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BAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAQzD;IAED;;;OAGG;IACI,sBAAsB,CAAC,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,cAAc,CAAC,CAAC,CAG5G;IAED,+FAA+F;IAC/F,4BAA4B,CAAC,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,OAAO,qBAAqB,CAAC,GAAG,SAAS,CAAC,CAE/G;IAED,8GAA8G;IAC9G,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAE5F;IAED,qDAAqD;IAC/C,mBAAmB,IAAI,OAAO,CAAC,EAAE,CAAC,CAMvC;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,eAAe,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAEzE;IAED,2EAA2E;IACpE,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAElH;IAED;;;OAGG;IACU,sBAAsB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8B/F;CACF"}
|
package/dest/pxe.d.ts
CHANGED
|
@@ -201,4 +201,4 @@ export declare class PXE {
|
|
|
201
201
|
*/
|
|
202
202
|
stop(): Promise<void>;
|
|
203
203
|
}
|
|
204
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
204
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakUsT0FBTyxFQUFFLEVBQUU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sT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0E4Qi9CO0lBRUQ7O09BRUc7SUFDSSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtDQUNGIn0=
|
package/dest/pxe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAqC,MAAM,uBAAuB,CAAC;AAIvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,yBAAyB,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,aAAa,EACb,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,eAAe,EACf,KAAK,2BAA2B,EAChC,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAMtF,OAAO,EAEL,KAAK,IAAI,EAK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;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,cAAc,EAAE,OAAO,EACvB,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,EACnC,SAAS,CAAC,EAAE,mBAAmB,EAC/B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAwH7B;IAED;;;;;;;;OAQG;IACI,eAAe,CACpB,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,uBAAuB,CAAC,CAuDlC;IAED;;;;;;;;;;;;OAYG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA8B/B;IAED;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
|
package/dest/pxe.js
CHANGED
|
@@ -5,7 +5,6 @@ import { KeyStore } from '@aztec/key-store';
|
|
|
5
5
|
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
6
6
|
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
7
7
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
8
|
-
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
9
8
|
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
9
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
10
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
@@ -13,8 +12,8 @@ import { inspect } from 'util';
|
|
|
13
12
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
14
13
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
15
14
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
16
|
-
import { readCurrentClassId } from './contract_function_simulator/oracle/private_execution.js';
|
|
17
15
|
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
16
|
+
import { ensureContractSynced, readCurrentClassId } from './contract_sync/index.js';
|
|
18
17
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
19
18
|
import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
|
|
20
19
|
import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
|
|
@@ -83,12 +82,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
83
82
|
*
|
|
84
83
|
* @returns A promise that resolves PXE is ready to be used.
|
|
85
84
|
*/ static async create(node, store, proofCreator, simulator, protocolContractsProvider, config, loggerOrSuffix) {
|
|
85
|
+
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
86
|
+
const bindings = loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
86
87
|
const log = !loggerOrSuffix || typeof loggerOrSuffix === 'string' ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`) : loggerOrSuffix;
|
|
87
88
|
const proverEnabled = !!config.proverEnabled;
|
|
88
89
|
const addressStore = new AddressStore(store);
|
|
89
90
|
const privateEventStore = new PrivateEventStore(store);
|
|
90
91
|
const contractStore = new ContractStore(store);
|
|
91
|
-
const noteStore =
|
|
92
|
+
const noteStore = new NoteStore(store);
|
|
92
93
|
const anchorBlockStore = new AnchorBlockStore(store);
|
|
93
94
|
const senderTaggingStore = new SenderTaggingStore(store);
|
|
94
95
|
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
@@ -96,18 +97,19 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
96
97
|
const capsuleStore = new CapsuleStore(store);
|
|
97
98
|
const keyStore = new KeyStore(store);
|
|
98
99
|
const tipsStore = new L2TipsKVStore(store, 'pxe');
|
|
99
|
-
const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, config,
|
|
100
|
-
const jobCoordinator = new JobCoordinator(store);
|
|
100
|
+
const synchronizer = new BlockSynchronizer(node, store, anchorBlockStore, noteStore, privateEventStore, tipsStore, config, bindings);
|
|
101
|
+
const jobCoordinator = new JobCoordinator(store, bindings);
|
|
101
102
|
jobCoordinator.registerStores([
|
|
102
103
|
capsuleStore,
|
|
103
104
|
senderTaggingStore,
|
|
104
105
|
recipientTaggingStore,
|
|
105
|
-
privateEventStore
|
|
106
|
+
privateEventStore,
|
|
107
|
+
noteStore
|
|
106
108
|
]);
|
|
107
|
-
const debugUtils = new PXEDebugUtils(contractStore, noteStore);
|
|
109
|
+
const debugUtils = new PXEDebugUtils(contractStore, noteStore, synchronizer, anchorBlockStore);
|
|
108
110
|
const jobQueue = new SerialQueue();
|
|
109
111
|
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
110
|
-
debugUtils.setPXE(pxe);
|
|
112
|
+
debugUtils.setPXE(pxe, pxe.#putInJobQueue.bind(pxe));
|
|
111
113
|
pxe.jobQueue.start();
|
|
112
114
|
await pxe.#registerProtocolContracts();
|
|
113
115
|
const info = await node.getNodeInfo();
|
|
@@ -117,7 +119,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
117
119
|
// Internal methods
|
|
118
120
|
#getSimulatorForTx(overrides) {
|
|
119
121
|
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
120
|
-
return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, BenchmarkedNodeFactory.create(this.node), this.
|
|
122
|
+
return new ContractFunctionSimulator(proxyContractStore, this.noteStore, this.keyStore, this.addressStore, BenchmarkedNodeFactory.create(this.node), this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.simulator);
|
|
121
123
|
}
|
|
122
124
|
#contextualizeError(err, ...context) {
|
|
123
125
|
let contextStr = '';
|
|
@@ -173,6 +175,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
173
175
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
174
176
|
try {
|
|
175
177
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
178
|
+
await ensureContractSynced(contractAddress, functionSelector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
176
179
|
const result = await contractFunctionSimulator.run(txRequest, contractAddress, functionSelector, undefined, anchorBlockHeader, // The sender for tags is set by contracts, typically by an account
|
|
177
180
|
// contract entrypoint
|
|
178
181
|
undefined, scopes, jobId);
|
|
@@ -242,9 +245,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
242
245
|
* @returns An object that contains the output of the kernel execution, including the ChonkProof if proving is enabled.
|
|
243
246
|
*/ async #prove(txExecutionRequest, proofCreator, privateExecutionResult, config) {
|
|
244
247
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
245
|
-
const anchorBlockHash =
|
|
248
|
+
const anchorBlockHash = await anchorBlockHeader.hash();
|
|
246
249
|
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHash);
|
|
247
|
-
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled);
|
|
250
|
+
const kernelTraceProver = new PrivateKernelExecutionProver(kernelOracle, proofCreator, !this.proverEnabled, this.log.getBindings());
|
|
248
251
|
this.log.debug(`Executing kernel trace prover (${JSON.stringify(config)})...`);
|
|
249
252
|
return await kernelTraceProver.proveWithKernels(txExecutionRequest.toTxRequest(), privateExecutionResult, config);
|
|
250
253
|
}
|
|
@@ -279,7 +282,6 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
279
282
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
280
283
|
}
|
|
281
284
|
await this.addressStore.addCompleteAddress(accountCompleteAddress);
|
|
282
|
-
await this.noteStore.addScope(accountCompleteAddress.address);
|
|
283
285
|
return accountCompleteAddress;
|
|
284
286
|
}
|
|
285
287
|
/**
|
|
@@ -674,7 +676,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
674
676
|
const syncTime = syncTimer.ms();
|
|
675
677
|
const functionTimer = new Timer();
|
|
676
678
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
677
|
-
await this.
|
|
679
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
680
|
+
await ensureContractSynced(call.to, call.selector, (privateSyncCall)=>this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
678
681
|
const executionResult = await this.#simulateUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
679
682
|
const functionTime = functionTimer.ms();
|
|
680
683
|
const totalTime = totalTimer.ms();
|
|
@@ -721,9 +724,10 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
721
724
|
let anchorBlockNumber;
|
|
722
725
|
await this.#putInJobQueue(async (jobId)=>{
|
|
723
726
|
await this.blockStateSynchronizer.sync();
|
|
724
|
-
|
|
727
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
728
|
+
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
725
729
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
726
|
-
await
|
|
730
|
+
await ensureContractSynced(filter.contractAddress, null, async (privateSyncCall)=>await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId), this.node, this.contractStore, anchorBlockHeader);
|
|
727
731
|
});
|
|
728
732
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
729
733
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|
|
@@ -8,4 +8,4 @@ export declare class AddressStore {
|
|
|
8
8
|
getCompleteAddress(account: AztecAddress): Promise<CompleteAddress | undefined>;
|
|
9
9
|
getCompleteAddresses(): Promise<CompleteAddress[]>;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc19zdG9yZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0b3JhZ2UvYWRkcmVzc19zdG9yZS9hZGRyZXNzX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFtQixpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN6RixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsWUFBWTs7SUFLdkIsWUFBWSxLQUFLLEVBQUUsaUJBQWlCLEVBS25DO0lBRUQsa0JBQWtCLENBQUMsZUFBZSxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBMEJyRTtJQUVELGtCQUFrQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLGVBQWUsR0FBRyxTQUFTLENBQUMsQ0FVOUU7SUFFRCxvQkFBb0IsSUFBSSxPQUFPLENBQUMsZUFBZSxFQUFFLENBQUMsQ0FNakQ7Q0FDRiJ9
|
|
@@ -1 +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;
|
|
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;IAED,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAU9E;IAED,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAMjD;CACF"}
|
|
@@ -30,18 +30,19 @@ export class AddressStore {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
async #getCompleteAddress(address) {
|
|
34
|
-
const index = await this.#completeAddressIndex.getAsync(address.toString());
|
|
35
|
-
if (index === undefined) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const value = await this.#completeAddresses.atAsync(index);
|
|
39
|
-
return value ? await CompleteAddress.fromBuffer(value) : undefined;
|
|
40
|
-
}
|
|
41
33
|
getCompleteAddress(account) {
|
|
42
|
-
return this.#
|
|
34
|
+
return this.#store.transactionAsync(async ()=>{
|
|
35
|
+
const index = await this.#completeAddressIndex.getAsync(account.toString());
|
|
36
|
+
if (index === undefined) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const value = await this.#completeAddresses.atAsync(index);
|
|
40
|
+
return value ? await CompleteAddress.fromBuffer(value) : undefined;
|
|
41
|
+
});
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
return
|
|
43
|
+
getCompleteAddresses() {
|
|
44
|
+
return this.#store.transactionAsync(async ()=>{
|
|
45
|
+
return await Promise.all((await toArray(this.#completeAddresses.valuesAsync())).map((v)=>CompleteAddress.fromBuffer(v)));
|
|
46
|
+
});
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -3,7 +3,15 @@ import { BlockHeader } from '@aztec/stdlib/tx';
|
|
|
3
3
|
export declare class AnchorBlockStore {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(store: AztecAsyncKVStore);
|
|
6
|
+
/**
|
|
7
|
+
* Sets the currently synchronized block
|
|
8
|
+
*
|
|
9
|
+
* Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
|
|
10
|
+
* stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
|
|
11
|
+
* deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
6
14
|
setHeader(header: BlockHeader): Promise<void>;
|
|
7
15
|
getBlockHeader(): Promise<BlockHeader>;
|
|
8
16
|
}
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5jaG9yX2Jsb2NrX3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RvcmFnZS9hbmNob3JfYmxvY2tfc3RvcmUvYW5jaG9yX2Jsb2NrX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUUvQyxxQkFBYSxnQkFBZ0I7O0lBSTNCLFlBQVksS0FBSyxFQUFFLGlCQUFpQixFQUduQztJQUVEOzs7Ozs7O09BT0c7SUFDRyxTQUFTLENBQUMsTUFBTSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRWxEO0lBRUssY0FBYyxJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FPM0M7Q0FDRiJ9
|
|
@@ -1 +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;
|
|
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;IAED;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;IAEK,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAO3C;CACF"}
|
|
@@ -6,7 +6,14 @@ export class AnchorBlockStore {
|
|
|
6
6
|
this.#store = store;
|
|
7
7
|
this.#synchronizedHeader = this.#store.openSingleton('header');
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Sets the currently synchronized block
|
|
11
|
+
*
|
|
12
|
+
* Important: this method is only called from BlockSynchronizer, and since we need it to run atomically with other
|
|
13
|
+
* stores in the case of a reorg, it MUST NOT be wrapped in a `transactionAsync` call. Doing so would result in a
|
|
14
|
+
* deadlock when the backend is IndexedDB, because `transactionAsync` is not designed to support reentrancy.
|
|
15
|
+
*
|
|
16
|
+
*/ async setHeader(header) {
|
|
10
17
|
await this.#synchronizedHeader.set(header.toBuffer());
|
|
11
18
|
}
|
|
12
19
|
async getBlockHeader() {
|
|
@@ -40,14 +40,12 @@ export class CapsuleStore {
|
|
|
40
40
|
* If it is not there, it reads it from the KV store.
|
|
41
41
|
*/ async #getFromStage(jobId, dbSlotKey) {
|
|
42
42
|
const jobStagedCapsules = this.#getJobStagedCapsules(jobId);
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
return staged;
|
|
43
|
+
const staged = jobStagedCapsules.get(dbSlotKey);
|
|
44
|
+
// Always issue DB read to keep IndexedDB transaction alive, even if the value is in the job staged data. This
|
|
45
|
+
// keeps IndexedDB transactions alive (they auto-commit when a new micro-task starts and there are no pending read
|
|
46
|
+
// requests). The staged value still takes precedence if it exists (including null for deletions).
|
|
47
|
+
const dbValue = await this.#loadCapsuleFromDb(dbSlotKey);
|
|
48
|
+
return staged !== undefined ? staged : dbValue;
|
|
51
49
|
}
|
|
52
50
|
/**
|
|
53
51
|
* Writes a capsule to the stage of a job.
|
|
@@ -62,6 +62,5 @@ export declare class ContractStore {
|
|
|
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>;
|
|
66
65
|
}
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdG9yYWdlL2NvbnRyYWN0X3N0b3JlL2NvbnRyYWN0X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFekQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxXQUFXLEVBRWhCLEtBQUssZ0NBQWdDLEVBQ3JDLFlBQVksRUFDWixLQUFLLHFCQUFxQixFQUMxQixnQkFBZ0IsRUFNakIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBT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xZQUFZLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQXVCdkc7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_store.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_store/contract_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"contract_store.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_store/contract_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,KAAK,gCAAgC,EACrC,YAAY,EACZ,KAAK,qBAAqB,EAC1B,gBAAgB,EAMjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAGjC,MAAM,wBAAwB,CAAC;AAIhC;;;;;;GAMG;AACH,qBAAa,aAAa;;IAYxB,YAAY,KAAK,EAAE,iBAAiB,EAInC;IAIY,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBlF;IAEK,mBAAmB,CAAC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U,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,GAAG,SAAS,CAAC,CAGrE;IAEY,oBAAoB,CAAC,eAAe,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;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { toArray } from '@aztec/foundation/iterable';
|
|
2
|
-
import { isProtocolContract } from '@aztec/protocol-contracts';
|
|
3
2
|
import { FunctionSelector, FunctionType, contractArtifactFromBuffer, contractArtifactToBuffer, encodeArguments, getFunctionDebugMetadata } from '@aztec/stdlib/abi';
|
|
4
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
4
|
import { SerializableContractInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
@@ -14,20 +13,23 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
14
13
|
/** 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.
|
|
15
14
|
#privateFunctionTrees = new Map();
|
|
16
15
|
/** Map from contract address to contract class id */ #contractClassIdMap = new Map();
|
|
16
|
+
#store;
|
|
17
17
|
#contractArtifacts;
|
|
18
18
|
#contractInstances;
|
|
19
19
|
constructor(store){
|
|
20
|
+
this.#store = store;
|
|
20
21
|
this.#contractArtifacts = store.openMap('contract_artifacts');
|
|
21
22
|
this.#contractInstances = store.openMap('contracts_instances');
|
|
22
23
|
}
|
|
23
24
|
// Setters
|
|
24
25
|
async addContractArtifact(id, contract) {
|
|
26
|
+
// Validation outside transactionAsync - these are not DB operations
|
|
25
27
|
const privateFunctions = contract.functions.filter((functionArtifact)=>functionArtifact.functionType === FunctionType.PRIVATE);
|
|
26
28
|
const privateSelectors = await Promise.all(privateFunctions.map(async (privateFunctionArtifact)=>(await FunctionSelector.fromNameAndParameters(privateFunctionArtifact.name, privateFunctionArtifact.parameters)).toString()));
|
|
27
29
|
if (privateSelectors.length !== new Set(privateSelectors).size) {
|
|
28
30
|
throw new Error('Repeated function selectors of private functions');
|
|
29
31
|
}
|
|
30
|
-
await this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract));
|
|
32
|
+
await this.#store.transactionAsync(()=>this.#contractArtifacts.set(id.toString(), contractArtifactToBuffer(contract)));
|
|
31
33
|
}
|
|
32
34
|
async addContractInstance(contract) {
|
|
33
35
|
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
@@ -69,18 +71,24 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
69
71
|
return contractClassId && this.getContractArtifact(contractClassId);
|
|
70
72
|
}
|
|
71
73
|
// Public getters
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
getContractsAddresses() {
|
|
75
|
+
return this.#store.transactionAsync(async ()=>{
|
|
76
|
+
const keys = await toArray(this.#contractInstances.keysAsync());
|
|
77
|
+
return keys.map(AztecAddress.fromString);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** Returns a contract instance for a given address. Throws if not found. */ getContractInstance(contractAddress) {
|
|
81
|
+
return this.#store.transactionAsync(async ()=>{
|
|
82
|
+
const contract = await this.#contractInstances.getAsync(contractAddress.toString());
|
|
83
|
+
return contract && SerializableContractInstance.fromBuffer(contract).withAddress(contractAddress);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getContractArtifact(contractClassId) {
|
|
87
|
+
return this.#store.transactionAsync(async ()=>{
|
|
88
|
+
const contract = await this.#contractArtifacts.getAsync(contractClassId.toString());
|
|
89
|
+
// TODO(@spalladino): AztecAsyncMap lies and returns Uint8Arrays instead of Buffers, hence the extra Buffer.from.
|
|
90
|
+
return contract && contractArtifactFromBuffer(Buffer.from(contract));
|
|
91
|
+
});
|
|
84
92
|
}
|
|
85
93
|
/** Returns a contract class for a given class id. Throws if not found. */ async getContractClass(contractClassId) {
|
|
86
94
|
const artifact = await this.getContractArtifact(contractClassId);
|
|
@@ -222,15 +230,4 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
222
230
|
returnTypes: functionDao.returnTypes
|
|
223
231
|
};
|
|
224
232
|
}
|
|
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
|
-
}
|
|
236
233
|
}
|