@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
|
@@ -10,8 +10,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
10
10
|
* @param start - The starting index (inclusive) of the window to process.
|
|
11
11
|
* @param end - The ending index (exclusive) of the window to process.
|
|
12
12
|
* @param aztecNode - The Aztec node instance to query for logs.
|
|
13
|
-
* @param
|
|
14
|
-
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode,
|
|
13
|
+
* @param taggingStore - The data provider to store pending indexes.
|
|
14
|
+
*/ export async function loadAndStoreNewTaggingIndexes(secret, app, start, end, aztecNode, taggingStore) {
|
|
15
15
|
// We compute the tags for the current window of indexes
|
|
16
16
|
const preTagsForWindow = Array(end - start).fill(0).map((_, i)=>({
|
|
17
17
|
secret,
|
|
@@ -23,7 +23,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
23
23
|
// Now we iterate over the map, reconstruct the preTags and tx hash and store them in the db.
|
|
24
24
|
for (const [txHashStr, highestIndex] of highestIndexMap.entries()){
|
|
25
25
|
const txHash = TxHash.fromString(txHashStr);
|
|
26
|
-
await
|
|
26
|
+
await taggingStore.storePendingIndexes([
|
|
27
27
|
{
|
|
28
28
|
secret,
|
|
29
29
|
index: highestIndex
|
|
@@ -5,12 +5,12 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
5
5
|
import type { BlockParameter } from '@aztec/stdlib/block';
|
|
6
6
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
8
|
-
import type {
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
9
|
export declare class TreeMembershipService {
|
|
10
10
|
#private;
|
|
11
11
|
private readonly aztecNode;
|
|
12
|
-
private readonly
|
|
13
|
-
constructor(aztecNode: AztecNode,
|
|
12
|
+
private readonly anchorBlockStore;
|
|
13
|
+
constructor(aztecNode: AztecNode, anchorBlockStore: AnchorBlockStore);
|
|
14
14
|
/**
|
|
15
15
|
* Gets the index of a nullifier in the nullifier tree.
|
|
16
16
|
* @returns - The index of the nullifier. Undefined if it does not exist in the tree.
|
|
@@ -49,4 +49,4 @@ export declare class TreeMembershipService {
|
|
|
49
49
|
*/
|
|
50
50
|
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]>;
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90cmVlX21lbWJlcnNoaXAvdHJlZV9tZW1iZXJzaGlwX3NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRSxPQUFPLEVBQUUsWUFBWSxFQUFFLDBCQUEwQixFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFbEcsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxREFBcUQsQ0FBQztBQUU1RixxQkFBYSxxQkFBcUI7O0lBRTlCLE9BQU8sQ0FBQyxRQUFRLENBQUMsU0FBUztJQUMxQixPQUFPLENBQUMsUUFBUSxDQUFDLGdCQUFnQjtJQUZuQyxZQUNtQixTQUFTLEVBQUUsU0FBUyxFQUNwQixnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFDakQ7SUFFSjs7O09BR0c7SUFDSSxpQkFBaUIsQ0FBQyxTQUFTLEVBQUUsRUFBRSwrQkFFckM7SUFFRDs7Ozs7O09BTUc7SUFDVSxvQkFBb0IsQ0FBQyxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FNakg7SUFFRDs7Ozs7Ozs7T0FRRztJQUNVLGdDQUFnQyxDQUMzQyxXQUFXLEVBQUUsY0FBYyxFQUMzQixTQUFTLEVBQUUsRUFBRSxHQUNaLE9BQU8sQ0FBQywwQkFBMEIsR0FBRyxTQUFTLENBQUMsQ0FNakQ7SUFFRDs7OztPQUlHO0lBQ1Usb0JBQW9CLENBQUMsV0FBVyxFQUFFLGNBQWMsRUFBRSxRQUFRLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsQ0FNbkg7SUFFRDs7Ozs7O09BTUc7SUFDSSwwQkFBMEIsQ0FDL0IsZUFBZSxFQUFFLFlBQVksRUFDN0IsV0FBVyxFQUFFLEVBQUUsRUFDZixNQUFNLEVBQUUsRUFBRSxHQUNULE9BQU8sQ0FBQyxDQUFDLE1BQU0sRUFBRSxXQUFXLENBQUMsT0FBTyx3QkFBd0IsQ0FBQyxDQUFDLENBQUMsQ0FFakU7Q0F5QkYifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"tree_membership_service.d.ts","sourceRoot":"","sources":["../../src/tree_membership/tree_membership_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAElG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAE5F,qBAAa,qBAAqB;;IAE9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAFnC,YACmB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EACjD;IAEJ;;;OAGG;IACI,iBAAiB,CAAC,SAAS,EAAE,EAAE,+BAErC;IAED;;;;;;OAMG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,CAAC,CAMjH;IAED;;;;;;;;OAQG;IACU,gCAAgC,CAC3C,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAMjD;IAED;;;;OAIG;IACU,oBAAoB,CAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAMnH;IAED;;;;;;OAMG;IACI,0BAA0B,CAC/B,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAEjE;CAyBF"}
|
|
@@ -2,10 +2,10 @@ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
|
2
2
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
3
3
|
export class TreeMembershipService {
|
|
4
4
|
aztecNode;
|
|
5
|
-
|
|
6
|
-
constructor(aztecNode,
|
|
5
|
+
anchorBlockStore;
|
|
6
|
+
constructor(aztecNode, anchorBlockStore){
|
|
7
7
|
this.aztecNode = aztecNode;
|
|
8
|
-
this.
|
|
8
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Gets the index of a nullifier in the nullifier tree.
|
|
@@ -35,7 +35,7 @@ export class TreeMembershipService {
|
|
|
35
35
|
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
36
36
|
* we are trying to prove non-inclusion for.
|
|
37
37
|
*/ async getLowNullifierMembershipWitness(blockNumber, nullifier) {
|
|
38
|
-
const anchorBlockNumber = (await this.
|
|
38
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
39
39
|
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
40
40
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ export class TreeMembershipService {
|
|
|
46
46
|
* @param blockNumber - The block number at which to get the witness.
|
|
47
47
|
* @param leafSlot - The slot of the public data in the public data tree.
|
|
48
48
|
*/ async getPublicDataWitness(blockNumber, leafSlot) {
|
|
49
|
-
const anchorBlockNumber = (await this.
|
|
49
|
+
const anchorBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
50
50
|
if (blockNumber !== 'latest' && blockNumber > anchorBlockNumber) {
|
|
51
51
|
throw new Error(`Block number ${blockNumber} is higher than current block ${anchorBlockNumber}`);
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20260106",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
65
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
66
|
-
"@aztec/builder": "3.0.0-nightly.
|
|
67
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
68
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
69
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
70
|
-
"@aztec/key-store": "3.0.0-nightly.
|
|
71
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
73
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
74
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
64
|
+
"@aztec/bb-prover": "3.0.0-nightly.20260106",
|
|
65
|
+
"@aztec/bb.js": "3.0.0-nightly.20260106",
|
|
66
|
+
"@aztec/builder": "3.0.0-nightly.20260106",
|
|
67
|
+
"@aztec/constants": "3.0.0-nightly.20260106",
|
|
68
|
+
"@aztec/ethereum": "3.0.0-nightly.20260106",
|
|
69
|
+
"@aztec/foundation": "3.0.0-nightly.20260106",
|
|
70
|
+
"@aztec/key-store": "3.0.0-nightly.20260106",
|
|
71
|
+
"@aztec/kv-store": "3.0.0-nightly.20260106",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20260106",
|
|
73
|
+
"@aztec/noir-types": "3.0.0-nightly.20260106",
|
|
74
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20260106",
|
|
75
|
+
"@aztec/simulator": "3.0.0-nightly.20260106",
|
|
76
|
+
"@aztec/stdlib": "3.0.0-nightly.20260106",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"lodash.omit": "^4.5.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
85
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20260106",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20260106",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -5,8 +5,8 @@ import { L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler
|
|
|
5
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
6
6
|
|
|
7
7
|
import type { PXEConfig } from '../config/index.js';
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
8
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
9
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The BlockSynchronizer class orchestrates synchronization between PXE and Aztec node, maintaining an up-to-date
|
|
@@ -20,8 +20,8 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
20
20
|
|
|
21
21
|
constructor(
|
|
22
22
|
private node: AztecNode,
|
|
23
|
-
private
|
|
24
|
-
private
|
|
23
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
24
|
+
private noteStore: NoteStore,
|
|
25
25
|
private l2TipsStore: L2TipsKVStore,
|
|
26
26
|
config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
|
|
27
27
|
loggerOrSuffix?: string | Logger,
|
|
@@ -54,20 +54,20 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
54
54
|
archive: lastBlock.archive.root.toString(),
|
|
55
55
|
header: lastBlock.header.toInspect(),
|
|
56
56
|
});
|
|
57
|
-
await this.
|
|
57
|
+
await this.anchorBlockStore.setHeader(lastBlock.getBlockHeader());
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
case 'chain-pruned': {
|
|
61
61
|
this.log.warn(`Pruning data after block ${event.block.number} due to reorg`);
|
|
62
62
|
// We first unnullify and then remove so that unnullified notes that were created after the block number end up deleted.
|
|
63
|
-
const lastSynchedBlockNumber = (await this.
|
|
64
|
-
await this.
|
|
63
|
+
const lastSynchedBlockNumber = (await this.anchorBlockStore.getBlockHeader()).getBlockNumber();
|
|
64
|
+
await this.noteStore.rollbackNotesAndNullifiers(event.block.number, lastSynchedBlockNumber);
|
|
65
65
|
// Update the header to the last block.
|
|
66
66
|
const newHeader = await this.node.getBlockHeader(event.block.number);
|
|
67
67
|
if (!newHeader) {
|
|
68
68
|
this.log.error(`Block header not found for block number ${event.block.number} during chain prune`);
|
|
69
69
|
} else {
|
|
70
|
-
await this.
|
|
70
|
+
await this.anchorBlockStore.setHeader(newHeader);
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
@@ -104,13 +104,13 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
104
104
|
let currentHeader;
|
|
105
105
|
|
|
106
106
|
try {
|
|
107
|
-
currentHeader = await this.
|
|
107
|
+
currentHeader = await this.anchorBlockStore.getBlockHeader();
|
|
108
108
|
} catch {
|
|
109
109
|
this.log.debug('Header is not set, requesting from the node');
|
|
110
110
|
}
|
|
111
111
|
if (!currentHeader) {
|
|
112
112
|
// REFACTOR: We should know the header of the genesis block without having to request it from the node.
|
|
113
|
-
await this.
|
|
113
|
+
await this.anchorBlockStore.setHeader((await this.node.getBlockHeader(BlockNumber.ZERO))!);
|
|
114
114
|
}
|
|
115
115
|
await this.blockStream.sync();
|
|
116
116
|
}
|
|
@@ -71,15 +71,15 @@ import {
|
|
|
71
71
|
getFinalMinRevertibleSideEffectCounter,
|
|
72
72
|
} from '@aztec/stdlib/tx';
|
|
73
73
|
|
|
74
|
-
import type {
|
|
75
|
-
import type {
|
|
76
|
-
import type {
|
|
77
|
-
import type {
|
|
78
|
-
import type {
|
|
79
|
-
import type {
|
|
80
|
-
import type {
|
|
81
|
-
import type {
|
|
82
|
-
import type {
|
|
74
|
+
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
75
|
+
import type { AnchorBlockStore } from '../storage/anchor_block_store/anchor_block_store.js';
|
|
76
|
+
import type { CapsuleStore } from '../storage/capsule_store/capsule_store.js';
|
|
77
|
+
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
78
|
+
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
79
|
+
import type { PrivateEventStore } from '../storage/private_event_store/private_event_store.js';
|
|
80
|
+
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
81
|
+
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
82
|
+
import type { SenderTaggingStore } from '../storage/tagging_store/sender_tagging_store.js';
|
|
83
83
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
84
84
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
85
85
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
@@ -96,17 +96,17 @@ export class ContractFunctionSimulator {
|
|
|
96
96
|
private log: Logger;
|
|
97
97
|
|
|
98
98
|
constructor(
|
|
99
|
-
private
|
|
100
|
-
private
|
|
99
|
+
private contractStore: ContractStore,
|
|
100
|
+
private noteStore: NoteStore,
|
|
101
101
|
private keyStore: KeyStore,
|
|
102
|
-
private
|
|
102
|
+
private addressStore: AddressStore,
|
|
103
103
|
private aztecNode: AztecNode,
|
|
104
|
-
private
|
|
105
|
-
private
|
|
106
|
-
private
|
|
107
|
-
private
|
|
108
|
-
private
|
|
109
|
-
private
|
|
104
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
105
|
+
private senderTaggingStore: SenderTaggingStore,
|
|
106
|
+
private recipientTaggingStore: RecipientTaggingStore,
|
|
107
|
+
private senderAddressBookStore: SenderAddressBookStore,
|
|
108
|
+
private capsuleStore: CapsuleStore,
|
|
109
|
+
private privateEventStore: PrivateEventStore,
|
|
110
110
|
private simulator: CircuitSimulator,
|
|
111
111
|
) {
|
|
112
112
|
this.log = createLogger('simulator');
|
|
@@ -136,13 +136,14 @@ export class ContractFunctionSimulator {
|
|
|
136
136
|
): Promise<PrivateExecutionResult> {
|
|
137
137
|
const simulatorSetupTimer = new Timer();
|
|
138
138
|
|
|
139
|
-
await
|
|
140
|
-
|
|
141
|
-
const entryPointArtifact = await this.contractDataProvider.getFunctionArtifactWithDebugMetadata(
|
|
142
|
-
contractAddress,
|
|
143
|
-
selector,
|
|
139
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
|
|
140
|
+
this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes),
|
|
144
141
|
);
|
|
145
142
|
|
|
143
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
144
|
+
|
|
145
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
146
|
+
|
|
146
147
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
147
148
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
148
149
|
}
|
|
@@ -172,22 +173,25 @@ export class ContractFunctionSimulator {
|
|
|
172
173
|
request.txContext,
|
|
173
174
|
callContext,
|
|
174
175
|
anchorBlockHeader,
|
|
176
|
+
async call => {
|
|
177
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes);
|
|
178
|
+
},
|
|
175
179
|
request.authWitnesses,
|
|
176
180
|
request.capsules,
|
|
177
181
|
HashedValuesCache.create(request.argsOfCalls),
|
|
178
182
|
noteCache,
|
|
179
183
|
taggingIndexCache,
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
184
|
+
this.contractStore,
|
|
185
|
+
this.noteStore,
|
|
182
186
|
this.keyStore,
|
|
183
|
-
this.
|
|
187
|
+
this.addressStore,
|
|
184
188
|
this.aztecNode,
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
189
|
+
this.anchorBlockStore,
|
|
190
|
+
this.senderTaggingStore,
|
|
191
|
+
this.recipientTaggingStore,
|
|
192
|
+
this.senderAddressBookStore,
|
|
193
|
+
this.capsuleStore,
|
|
194
|
+
this.privateEventStore,
|
|
191
195
|
0, // totalPublicArgsCount
|
|
192
196
|
startSideEffectCounter,
|
|
193
197
|
undefined, // log
|
|
@@ -259,12 +263,9 @@ export class ContractFunctionSimulator {
|
|
|
259
263
|
anchorBlockHeader: BlockHeader,
|
|
260
264
|
scopes?: AztecAddress[],
|
|
261
265
|
): Promise<Fr[]> {
|
|
262
|
-
await verifyCurrentClassId(call.to, this.aztecNode, this.
|
|
266
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
263
267
|
|
|
264
|
-
const entryPointArtifact = await this.
|
|
265
|
-
call.to,
|
|
266
|
-
call.selector,
|
|
267
|
-
);
|
|
268
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
268
269
|
|
|
269
270
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
270
271
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
@@ -275,16 +276,16 @@ export class ContractFunctionSimulator {
|
|
|
275
276
|
authwits,
|
|
276
277
|
[],
|
|
277
278
|
anchorBlockHeader,
|
|
278
|
-
this.
|
|
279
|
-
this.
|
|
279
|
+
this.contractStore,
|
|
280
|
+
this.noteStore,
|
|
280
281
|
this.keyStore,
|
|
281
|
-
this.
|
|
282
|
+
this.addressStore,
|
|
282
283
|
this.aztecNode,
|
|
283
|
-
this.
|
|
284
|
-
this.
|
|
285
|
-
this.
|
|
286
|
-
this.
|
|
287
|
-
this.
|
|
284
|
+
this.anchorBlockStore,
|
|
285
|
+
this.recipientTaggingStore,
|
|
286
|
+
this.senderAddressBookStore,
|
|
287
|
+
this.capsuleStore,
|
|
288
|
+
this.privateEventStore,
|
|
288
289
|
undefined,
|
|
289
290
|
scopes,
|
|
290
291
|
);
|
|
@@ -350,13 +351,13 @@ class OrderedSideEffect<T> {
|
|
|
350
351
|
* @param privateExecutionResult - The result of the private execution.
|
|
351
352
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
352
353
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
353
|
-
* @param
|
|
354
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
354
355
|
* @returns The simulated proving result.
|
|
355
356
|
*/
|
|
356
357
|
export async function generateSimulatedProvingResult(
|
|
357
358
|
privateExecutionResult: PrivateExecutionResult,
|
|
358
359
|
nonceGenerator: Fr,
|
|
359
|
-
|
|
360
|
+
contractStore: ContractStore,
|
|
360
361
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
361
362
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
362
363
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -433,7 +434,7 @@ export async function generateSimulatedProvingResult(
|
|
|
433
434
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
434
435
|
|
|
435
436
|
executionSteps.push({
|
|
436
|
-
functionName: await
|
|
437
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
437
438
|
execution.publicInputs.callContext.contractAddress,
|
|
438
439
|
execution.publicInputs.callContext.functionSelector,
|
|
439
440
|
),
|
|
@@ -27,7 +27,7 @@ import type { CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
|
27
27
|
import { BlockHeader, PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
28
28
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { ContractStore } from '../../storage/contract_store/index.js';
|
|
31
31
|
import { Oracle } from './oracle.js';
|
|
32
32
|
import type { PrivateExecutionOracle } from './private_execution_oracle.js';
|
|
33
33
|
|
|
@@ -154,7 +154,7 @@ export function extractPrivateCircuitPublicInputs(
|
|
|
154
154
|
* from the instance is used.
|
|
155
155
|
* @param contractAddress - The address of the contract to read the class id for.
|
|
156
156
|
* @param instance - The instance of the contract.
|
|
157
|
-
* @param
|
|
157
|
+
* @param executionStore - The execution data provider.
|
|
158
158
|
* @param blockNumber - The block number at which to load the DelayedPublicMutable storing the class id.
|
|
159
159
|
* @param timestamp - The timestamp at which to obtain the class id from the DelayedPublicMutable.
|
|
160
160
|
* @returns The current class id.
|
|
@@ -186,10 +186,10 @@ export async function readCurrentClassId(
|
|
|
186
186
|
export async function verifyCurrentClassId(
|
|
187
187
|
contractAddress: AztecAddress,
|
|
188
188
|
aztecNode: AztecNode,
|
|
189
|
-
|
|
189
|
+
contractStore: ContractStore,
|
|
190
190
|
header: BlockHeader,
|
|
191
191
|
) {
|
|
192
|
-
const instance = await
|
|
192
|
+
const instance = await contractStore.getContractInstance(contractAddress);
|
|
193
193
|
if (!instance) {
|
|
194
194
|
throw new Error(`No contract instance found for address ${contractAddress.toString()}`);
|
|
195
195
|
}
|
|
@@ -7,6 +7,7 @@ import { type CircuitSimulator, toACVMWitness } from '@aztec/simulator/client';
|
|
|
7
7
|
import {
|
|
8
8
|
type FunctionAbi,
|
|
9
9
|
type FunctionArtifact,
|
|
10
|
+
type FunctionCall,
|
|
10
11
|
FunctionSelector,
|
|
11
12
|
type NoteSelector,
|
|
12
13
|
countArgumentsSize,
|
|
@@ -30,16 +31,16 @@ import {
|
|
|
30
31
|
} from '@aztec/stdlib/tx';
|
|
31
32
|
|
|
32
33
|
import { NoteService } from '../../notes/note_service.js';
|
|
33
|
-
import type {
|
|
34
|
-
import type {
|
|
35
|
-
import type {
|
|
36
|
-
import type {
|
|
37
|
-
import type {
|
|
38
|
-
import type {
|
|
39
|
-
import type {
|
|
40
|
-
import type {
|
|
41
|
-
import type {
|
|
42
|
-
import { syncSenderTaggingIndexes } from '../../tagging/
|
|
34
|
+
import type { AddressStore } from '../../storage/address_store/address_store.js';
|
|
35
|
+
import type { AnchorBlockStore } from '../../storage/anchor_block_store/anchor_block_store.js';
|
|
36
|
+
import type { CapsuleStore } from '../../storage/capsule_store/capsule_store.js';
|
|
37
|
+
import type { ContractStore } from '../../storage/contract_store/contract_store.js';
|
|
38
|
+
import type { NoteStore } from '../../storage/note_store/note_store.js';
|
|
39
|
+
import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
|
|
40
|
+
import type { RecipientTaggingStore } from '../../storage/tagging_store/recipient_tagging_store.js';
|
|
41
|
+
import type { SenderAddressBookStore } from '../../storage/tagging_store/sender_address_book_store.js';
|
|
42
|
+
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
43
|
+
import { syncSenderTaggingIndexes } from '../../tagging/index.js';
|
|
43
44
|
import type { ExecutionNoteCache } from '../execution_note_cache.js';
|
|
44
45
|
import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js';
|
|
45
46
|
import type { HashedValuesCache } from '../hashed_values_cache.js';
|
|
@@ -84,23 +85,25 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
84
85
|
private readonly callContext: CallContext,
|
|
85
86
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
86
87
|
protected override readonly anchorBlockHeader: BlockHeader,
|
|
88
|
+
/** Needed to trigger contract synchronization before nested calls */
|
|
89
|
+
private readonly utilityExecutor: (call: FunctionCall) => Promise<void>,
|
|
87
90
|
/** List of transient auth witnesses to be used during this simulation */
|
|
88
91
|
authWitnesses: AuthWitness[],
|
|
89
92
|
capsules: Capsule[],
|
|
90
93
|
private readonly executionCache: HashedValuesCache,
|
|
91
94
|
private readonly noteCache: ExecutionNoteCache,
|
|
92
95
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache,
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
contractStore: ContractStore,
|
|
97
|
+
noteStore: NoteStore,
|
|
95
98
|
keyStore: KeyStore,
|
|
96
|
-
|
|
99
|
+
addressStore: AddressStore,
|
|
97
100
|
aztecNode: AztecNode,
|
|
98
|
-
|
|
99
|
-
private readonly
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
anchorBlockStore: AnchorBlockStore,
|
|
102
|
+
private readonly senderTaggingStore: SenderTaggingStore,
|
|
103
|
+
recipientTaggingStore: RecipientTaggingStore,
|
|
104
|
+
senderAddressBookStore: SenderAddressBookStore,
|
|
105
|
+
capsuleStore: CapsuleStore,
|
|
106
|
+
privateEventStore: PrivateEventStore,
|
|
104
107
|
private totalPublicCalldataCount: number = 0,
|
|
105
108
|
protected sideEffectCounter: number = 0,
|
|
106
109
|
log = createLogger('simulator:client_execution_context'),
|
|
@@ -113,16 +116,16 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
113
116
|
authWitnesses,
|
|
114
117
|
capsules,
|
|
115
118
|
anchorBlockHeader,
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
contractStore,
|
|
120
|
+
noteStore,
|
|
118
121
|
keyStore,
|
|
119
|
-
|
|
122
|
+
addressStore,
|
|
120
123
|
aztecNode,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
anchorBlockStore,
|
|
125
|
+
recipientTaggingStore,
|
|
126
|
+
senderAddressBookStore,
|
|
127
|
+
capsuleStore,
|
|
128
|
+
privateEventStore,
|
|
126
129
|
log,
|
|
127
130
|
scopes,
|
|
128
131
|
);
|
|
@@ -278,9 +281,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
278
281
|
// This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
|
|
279
282
|
// are up to date. We do this here because this store is not synced as part of the global sync because
|
|
280
283
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
281
|
-
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.
|
|
284
|
+
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore);
|
|
282
285
|
|
|
283
|
-
const lastUsedIndex = await this.
|
|
286
|
+
const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret);
|
|
284
287
|
// If lastUsedIndex is undefined, we've never used this secret, so start from 0
|
|
285
288
|
// Otherwise, the next index to use is one past the last used index
|
|
286
289
|
return lastUsedIndex === undefined ? 0 : lastUsedIndex + 1;
|
|
@@ -369,7 +372,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
369
372
|
|
|
370
373
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
371
374
|
|
|
372
|
-
const noteService = new NoteService(this.
|
|
375
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
373
376
|
const dbNotes = await noteService.getNotes(
|
|
374
377
|
this.callContext.contractAddress,
|
|
375
378
|
owner,
|
|
@@ -548,14 +551,11 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
548
551
|
|
|
549
552
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
550
553
|
|
|
551
|
-
await verifyCurrentClassId(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
this.contractDataProvider,
|
|
555
|
-
this.anchorBlockHeader,
|
|
556
|
-
);
|
|
554
|
+
await verifyCurrentClassId(targetContractAddress, this.aztecNode, this.contractStore, this.anchorBlockHeader);
|
|
555
|
+
|
|
556
|
+
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, this.utilityExecutor);
|
|
557
557
|
|
|
558
|
-
const targetArtifact = await this.
|
|
558
|
+
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
|
|
559
559
|
targetContractAddress,
|
|
560
560
|
functionSelector,
|
|
561
561
|
);
|
|
@@ -569,22 +569,23 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
569
569
|
derivedTxContext,
|
|
570
570
|
derivedCallContext,
|
|
571
571
|
this.anchorBlockHeader,
|
|
572
|
+
this.utilityExecutor,
|
|
572
573
|
this.authWitnesses,
|
|
573
574
|
this.capsules,
|
|
574
575
|
this.executionCache,
|
|
575
576
|
this.noteCache,
|
|
576
577
|
this.taggingIndexCache,
|
|
577
|
-
this.
|
|
578
|
-
this.
|
|
578
|
+
this.contractStore,
|
|
579
|
+
this.noteStore,
|
|
579
580
|
this.keyStore,
|
|
580
|
-
this.
|
|
581
|
+
this.addressStore,
|
|
581
582
|
this.aztecNode,
|
|
582
|
-
this.
|
|
583
|
-
this.
|
|
584
|
-
this.
|
|
585
|
-
this.
|
|
586
|
-
this.
|
|
587
|
-
this.
|
|
583
|
+
this.anchorBlockStore,
|
|
584
|
+
this.senderTaggingStore,
|
|
585
|
+
this.recipientTaggingStore,
|
|
586
|
+
this.senderAddressBookStore,
|
|
587
|
+
this.capsuleStore,
|
|
588
|
+
this.privateEventStore,
|
|
588
589
|
this.totalPublicCalldataCount,
|
|
589
590
|
sideEffectCounter,
|
|
590
591
|
this.log,
|
|
@@ -697,7 +698,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
697
698
|
}
|
|
698
699
|
|
|
699
700
|
public getDebugFunctionName() {
|
|
700
|
-
return this.
|
|
701
|
+
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
701
702
|
}
|
|
702
703
|
|
|
703
704
|
public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
|