@aztec/pxe 3.0.0-rc.5 → 4.0.0-nightly.20260107
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 +39 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -0
- package/dest/{synchronizer/synchronizer.js → block_synchronizer/block_synchronizer.js} +22 -22
- package/dest/block_synchronizer/index.d.ts +2 -0
- package/dest/block_synchronizer/index.d.ts.map +1 -0
- package/dest/block_synchronizer/index.js +1 -0
- package/dest/config/index.d.ts +4 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +40 -11
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +47 -17
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +4 -3
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +7 -6
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +3 -4
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +3 -3
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +7 -9
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +11 -11
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +22 -8
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +24 -12
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +47 -8
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +143 -37
- 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 +23 -5
- package/dest/debug/pxe_debug_utils.d.ts +31 -0
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -0
- package/dest/debug/pxe_debug_utils.js +37 -0
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- 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/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -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/index.d.ts +2 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +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 +15 -0
- package/dest/events/event_service.d.ts.map +1 -0
- package/dest/events/event_service.js +47 -0
- package/dest/events/private_event_filter_validator.d.ts +6 -5
- 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 +26 -0
- package/dest/logs/log_service.d.ts.map +1 -0
- package/dest/logs/log_service.js +120 -0
- package/dest/notes/index.d.ts +2 -0
- package/dest/notes/index.d.ts.map +1 -0
- package/dest/notes/index.js +1 -0
- package/dest/notes/note_service.d.ts +48 -0
- package/dest/notes/note_service.d.ts.map +1 -0
- package/dest/notes/note_service.js +152 -0
- 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 +24 -0
- package/dest/public_storage/public_storage_service.d.ts.map +1 -0
- package/dest/public_storage/public_storage_service.js +26 -0
- package/dest/pxe.d.ts +25 -33
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +125 -136
- 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/{sync_data_provider/sync_data_provider.d.ts → anchor_block_store/anchor_block_store.d.ts} +2 -4
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{sync_data_provider/sync_data_provider.js → anchor_block_store/anchor_block_store.js} +2 -9
- package/dest/storage/{sync_data_provider → anchor_block_store}/index.d.ts +2 -2
- 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_store/capsule_store.d.ts +57 -0
- 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} +33 -5
- 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} +7 -4
- 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} +46 -3
- 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} +9 -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} +57 -15
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/recipient_tagging_store.js +42 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +67 -0
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_tagging_store.js +196 -0
- package/dest/tagging/index.d.ts +15 -6
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +23 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +14 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +99 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts +12 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +20 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +14 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +29 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +20 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +74 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +32 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +18 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +55 -0
- package/dest/tree_membership/tree_membership_service.d.ts +52 -0
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -0
- package/dest/tree_membership/tree_membership_service.js +84 -0
- package/package.json +16 -16
- package/src/{synchronizer/synchronizer.ts → block_synchronizer/block_synchronizer.ts} +21 -22
- package/src/block_synchronizer/index.ts +1 -0
- package/src/config/index.ts +3 -3
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +84 -15
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +5 -4
- package/src/contract_function_simulator/oracle/interfaces.ts +2 -3
- package/src/contract_function_simulator/oracle/oracle.ts +3 -3
- package/src/contract_function_simulator/oracle/private_execution.ts +14 -13
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +89 -19
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +208 -45
- package/src/contract_function_simulator/proxied_contract_data_source.ts +24 -7
- package/src/debug/pxe_debug_utils.ts +48 -0
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +1 -1
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +77 -0
- package/src/events/private_event_filter_validator.ts +5 -4
- package/src/logs/log_service.ts +202 -0
- package/src/notes/index.ts +1 -0
- package/src/notes/note_service.ts +200 -0
- package/src/private_kernel/private_kernel_oracle_impl.ts +6 -6
- package/src/public_storage/public_storage_service.ts +33 -0
- package/src/pxe.ts +153 -162
- 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/{sync_data_provider/sync_data_provider.ts → anchor_block_store/anchor_block_store.ts} +2 -12
- 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} +33 -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} +64 -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} +69 -18
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +53 -0
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/tagging_store/sender_tagging_store.ts +244 -0
- package/src/tagging/index.ts +27 -5
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +129 -0
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +34 -0
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +43 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +96 -0
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +44 -0
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +72 -0
- package/src/tree_membership/tree_membership_service.ts +112 -0
- package/dest/contract_function_simulator/execution_data_provider.d.ts +0 -268
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +0 -1
- package/dest/contract_function_simulator/execution_data_provider.js +0 -14
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +0 -124
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +0 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +0 -713
- 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/capsule_data_provider/capsule_data_provider.d.ts +0 -25
- 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/sync_data_provider/index.d.ts.map +0 -1
- package/dest/storage/sync_data_provider/index.js +0 -1
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -2
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +0 -40
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +0 -89
- package/dest/synchronizer/index.d.ts +0 -2
- package/dest/synchronizer/index.d.ts.map +0 -1
- package/dest/synchronizer/index.js +0 -1
- package/dest/synchronizer/synchronizer.d.ts +0 -36
- package/dest/synchronizer/synchronizer.d.ts.map +0 -1
- package/dest/tagging/constants.d.ts +0 -2
- package/dest/tagging/constants.d.ts.map +0 -1
- package/dest/tagging/constants.js +0 -2
- package/dest/tagging/siloed_tag.d.ts +0 -14
- package/dest/tagging/siloed_tag.d.ts.map +0 -1
- package/dest/tagging/siloed_tag.js +0 -20
- package/dest/tagging/tag.d.ts +0 -12
- package/dest/tagging/tag.d.ts.map +0 -1
- package/dest/tagging/tag.js +0 -17
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -24
- package/src/contract_function_simulator/execution_data_provider.ts +0 -343
- package/src/contract_function_simulator/pxe_oracle_interface.ts +0 -1040
- package/src/storage/address_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/sync_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/index.ts +0 -1
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +0 -120
- package/src/synchronizer/index.ts +0 -1
- package/src/tagging/constants.ts +0 -2
- package/src/tagging/siloed_tag.ts +0 -22
- package/src/tagging/tag.ts +0 -16
- package/src/tagging/utils.ts +0 -31
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
|
@@ -21,6 +21,7 @@ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
|
21
21
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
22
22
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
23
23
|
import { Timer } from '@aztec/foundation/timer';
|
|
24
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
24
25
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
25
26
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
26
27
|
import {
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
siloNoteHash,
|
|
45
46
|
siloNullifier,
|
|
46
47
|
} from '@aztec/stdlib/hash';
|
|
48
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
47
49
|
import {
|
|
48
50
|
PartialPrivateTailPublicInputsForPublic,
|
|
49
51
|
PartialPrivateTailPublicInputsForRollup,
|
|
@@ -59,6 +61,7 @@ import { PrivateLog } from '@aztec/stdlib/logs';
|
|
|
59
61
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
60
62
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
61
63
|
import {
|
|
64
|
+
BlockHeader,
|
|
62
65
|
CallContext,
|
|
63
66
|
HashedValues,
|
|
64
67
|
PrivateExecutionResult,
|
|
@@ -68,8 +71,15 @@ import {
|
|
|
68
71
|
getFinalMinRevertibleSideEffectCounter,
|
|
69
72
|
} from '@aztec/stdlib/tx';
|
|
70
73
|
|
|
71
|
-
import type {
|
|
72
|
-
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';
|
|
73
83
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
74
84
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
75
85
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
@@ -77,6 +87,7 @@ import { Oracle } from './oracle/oracle.js';
|
|
|
77
87
|
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
78
88
|
import { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
79
89
|
import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
90
|
+
import type { ProxiedNode } from './proxied_node.js';
|
|
80
91
|
|
|
81
92
|
/**
|
|
82
93
|
* The contract function simulator.
|
|
@@ -85,7 +96,17 @@ export class ContractFunctionSimulator {
|
|
|
85
96
|
private log: Logger;
|
|
86
97
|
|
|
87
98
|
constructor(
|
|
88
|
-
private
|
|
99
|
+
private contractStore: ContractStore,
|
|
100
|
+
private noteStore: NoteStore,
|
|
101
|
+
private keyStore: KeyStore,
|
|
102
|
+
private addressStore: AddressStore,
|
|
103
|
+
private aztecNode: AztecNode,
|
|
104
|
+
private anchorBlockStore: AnchorBlockStore,
|
|
105
|
+
private senderTaggingStore: SenderTaggingStore,
|
|
106
|
+
private recipientTaggingStore: RecipientTaggingStore,
|
|
107
|
+
private senderAddressBookStore: SenderAddressBookStore,
|
|
108
|
+
private capsuleStore: CapsuleStore,
|
|
109
|
+
private privateEventStore: PrivateEventStore,
|
|
89
110
|
private simulator: CircuitSimulator,
|
|
90
111
|
) {
|
|
91
112
|
this.log = createLogger('simulator');
|
|
@@ -98,6 +119,7 @@ export class ContractFunctionSimulator {
|
|
|
98
119
|
* @param contractAddress - The address of the contract (should match request.origin)
|
|
99
120
|
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract
|
|
100
121
|
* or a specific account.
|
|
122
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
101
123
|
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
102
124
|
* the `privateGetSenderForTags` oracle.
|
|
103
125
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
@@ -108,15 +130,19 @@ export class ContractFunctionSimulator {
|
|
|
108
130
|
contractAddress: AztecAddress,
|
|
109
131
|
selector: FunctionSelector,
|
|
110
132
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
133
|
+
anchorBlockHeader: BlockHeader,
|
|
111
134
|
senderForTags?: AztecAddress,
|
|
112
135
|
scopes?: AztecAddress[],
|
|
113
136
|
): Promise<PrivateExecutionResult> {
|
|
114
137
|
const simulatorSetupTimer = new Timer();
|
|
115
|
-
const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
116
138
|
|
|
117
|
-
await
|
|
139
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
|
|
140
|
+
this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes),
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
118
144
|
|
|
119
|
-
const entryPointArtifact = await this.
|
|
145
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
120
146
|
|
|
121
147
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
122
148
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
@@ -147,12 +173,25 @@ export class ContractFunctionSimulator {
|
|
|
147
173
|
request.txContext,
|
|
148
174
|
callContext,
|
|
149
175
|
anchorBlockHeader,
|
|
176
|
+
async call => {
|
|
177
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes);
|
|
178
|
+
},
|
|
150
179
|
request.authWitnesses,
|
|
151
180
|
request.capsules,
|
|
152
181
|
HashedValuesCache.create(request.argsOfCalls),
|
|
153
182
|
noteCache,
|
|
154
183
|
taggingIndexCache,
|
|
155
|
-
this.
|
|
184
|
+
this.contractStore,
|
|
185
|
+
this.noteStore,
|
|
186
|
+
this.keyStore,
|
|
187
|
+
this.addressStore,
|
|
188
|
+
this.aztecNode,
|
|
189
|
+
this.anchorBlockStore,
|
|
190
|
+
this.senderTaggingStore,
|
|
191
|
+
this.recipientTaggingStore,
|
|
192
|
+
this.senderAddressBookStore,
|
|
193
|
+
this.capsuleStore,
|
|
194
|
+
this.privateEventStore,
|
|
156
195
|
0, // totalPublicArgsCount
|
|
157
196
|
startSideEffectCounter,
|
|
158
197
|
undefined, // log
|
|
@@ -213,20 +252,43 @@ export class ContractFunctionSimulator {
|
|
|
213
252
|
* Runs a utility function.
|
|
214
253
|
* @param call - The function call to execute.
|
|
215
254
|
* @param authwits - Authentication witnesses required for the function call.
|
|
255
|
+
* @param anchorBlockHeader - The block header to use as base state for this run.
|
|
216
256
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
217
257
|
* accounts if not specified.
|
|
218
258
|
* @returns A return value of the utility function in a form as returned by the simulator (Noir fields)
|
|
219
259
|
*/
|
|
220
|
-
public async runUtility(
|
|
221
|
-
|
|
260
|
+
public async runUtility(
|
|
261
|
+
call: FunctionCall,
|
|
262
|
+
authwits: AuthWitness[],
|
|
263
|
+
anchorBlockHeader: BlockHeader,
|
|
264
|
+
scopes?: AztecAddress[],
|
|
265
|
+
): Promise<Fr[]> {
|
|
266
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
222
267
|
|
|
223
|
-
const entryPointArtifact = await this.
|
|
268
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
224
269
|
|
|
225
270
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
226
271
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
227
272
|
}
|
|
228
273
|
|
|
229
|
-
const oracle = new UtilityExecutionOracle(
|
|
274
|
+
const oracle = new UtilityExecutionOracle(
|
|
275
|
+
call.to,
|
|
276
|
+
authwits,
|
|
277
|
+
[],
|
|
278
|
+
anchorBlockHeader,
|
|
279
|
+
this.contractStore,
|
|
280
|
+
this.noteStore,
|
|
281
|
+
this.keyStore,
|
|
282
|
+
this.addressStore,
|
|
283
|
+
this.aztecNode,
|
|
284
|
+
this.anchorBlockStore,
|
|
285
|
+
this.recipientTaggingStore,
|
|
286
|
+
this.senderAddressBookStore,
|
|
287
|
+
this.capsuleStore,
|
|
288
|
+
this.privateEventStore,
|
|
289
|
+
undefined,
|
|
290
|
+
scopes,
|
|
291
|
+
);
|
|
230
292
|
|
|
231
293
|
try {
|
|
232
294
|
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
@@ -258,8 +320,15 @@ export class ContractFunctionSimulator {
|
|
|
258
320
|
}
|
|
259
321
|
// docs:end:execute_utility_function
|
|
260
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Returns the execution statistics collected during the simulator run.
|
|
325
|
+
* @returns The execution statistics.
|
|
326
|
+
*/
|
|
261
327
|
getStats() {
|
|
262
|
-
|
|
328
|
+
const nodeRPCCalls =
|
|
329
|
+
typeof (this.aztecNode as ProxiedNode).getStats === 'function' ? (this.aztecNode as ProxiedNode).getStats() : {};
|
|
330
|
+
|
|
331
|
+
return { nodeRPCCalls };
|
|
263
332
|
}
|
|
264
333
|
}
|
|
265
334
|
|
|
@@ -282,13 +351,13 @@ class OrderedSideEffect<T> {
|
|
|
282
351
|
* @param privateExecutionResult - The result of the private execution.
|
|
283
352
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
284
353
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
285
|
-
* @param
|
|
354
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
286
355
|
* @returns The simulated proving result.
|
|
287
356
|
*/
|
|
288
357
|
export async function generateSimulatedProvingResult(
|
|
289
358
|
privateExecutionResult: PrivateExecutionResult,
|
|
290
359
|
nonceGenerator: Fr,
|
|
291
|
-
|
|
360
|
+
contractStore: ContractStore,
|
|
292
361
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
293
362
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
294
363
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -365,7 +434,7 @@ export async function generateSimulatedProvingResult(
|
|
|
365
434
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
366
435
|
|
|
367
436
|
executionSteps.push({
|
|
368
|
-
functionName: await
|
|
437
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
369
438
|
execution.publicInputs.callContext.contractAddress,
|
|
370
439
|
execution.publicInputs.callContext.functionSelector,
|
|
371
440
|
),
|
|
@@ -21,7 +21,7 @@ export class ExecutionTaggingIndexCache {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Returns the pre
|
|
24
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
25
25
|
*/
|
|
26
26
|
public getUsedPreTags(): PreTag[] {
|
|
27
27
|
return Array.from(this.taggingIndexMap.entries()).map(([secret, index]) => ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Tag } from '@aztec/stdlib/logs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Intermediate struct used to perform batch log retrieval by PXE. The `utilityBulkRetrieveLogs` oracle expects values of this
|
|
@@ -9,19 +10,19 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
9
10
|
export class LogRetrievalRequest {
|
|
10
11
|
constructor(
|
|
11
12
|
public contractAddress: AztecAddress,
|
|
12
|
-
public
|
|
13
|
+
public tag: Tag,
|
|
13
14
|
) {}
|
|
14
15
|
|
|
15
16
|
toFields(): Fr[] {
|
|
16
|
-
return [this.contractAddress.toField(), this.
|
|
17
|
+
return [this.contractAddress.toField(), this.tag.value];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
static fromFields(fields: Fr[] | FieldReader): LogRetrievalRequest {
|
|
20
21
|
const reader = FieldReader.asReader(fields);
|
|
21
22
|
|
|
22
23
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
23
|
-
const
|
|
24
|
+
const tag = new Tag(reader.readField());
|
|
24
25
|
|
|
25
|
-
return new LogRetrievalRequest(contractAddress,
|
|
26
|
+
return new LogRetrievalRequest(contractAddress, tag);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -6,12 +6,11 @@ import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
8
8
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
9
|
-
import type { ContractClassLog } from '@aztec/stdlib/logs';
|
|
9
|
+
import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
|
|
10
10
|
import type { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
11
11
|
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
12
12
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
13
13
|
|
|
14
|
-
import type { Tag } from '../../tagging/tag.js';
|
|
15
14
|
import type { UtilityContext } from '../noir-structs/utility_context.js';
|
|
16
15
|
import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
17
16
|
|
|
@@ -63,7 +62,7 @@ export interface IMiscOracle {
|
|
|
63
62
|
export interface IUtilityExecutionOracle {
|
|
64
63
|
isUtility: true;
|
|
65
64
|
|
|
66
|
-
utilityGetUtilityContext():
|
|
65
|
+
utilityGetUtilityContext(): UtilityContext;
|
|
67
66
|
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
68
67
|
utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
|
|
69
68
|
utilityGetMembershipWitness(blockNumber: BlockNumber, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[] | undefined>;
|
|
@@ -112,9 +112,9 @@ export class Oracle {
|
|
|
112
112
|
return [values.map(toACVMField)];
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
const context =
|
|
117
|
-
return context.toNoirRepresentation();
|
|
115
|
+
utilityGetUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
116
|
+
const context = this.handlerAsUtility().utilityGetUtilityContext();
|
|
117
|
+
return Promise.resolve(context.toNoirRepresentation());
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
async utilityGetKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
@@ -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.
|
|
@@ -162,13 +162,13 @@ export function extractPrivateCircuitPublicInputs(
|
|
|
162
162
|
export async function readCurrentClassId(
|
|
163
163
|
contractAddress: AztecAddress,
|
|
164
164
|
instance: ContractInstance,
|
|
165
|
-
|
|
165
|
+
aztecNode: AztecNode,
|
|
166
166
|
blockNumber: BlockNumber,
|
|
167
167
|
timestamp: UInt64,
|
|
168
168
|
) {
|
|
169
169
|
const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
170
170
|
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, slot =>
|
|
171
|
-
|
|
171
|
+
aztecNode.getPublicStorageAt(blockNumber, ProtocolContractAddress.ContractInstanceRegistry, slot),
|
|
172
172
|
);
|
|
173
173
|
let currentClassId = delayedPublicMutableValues.svc.getCurrentAt(timestamp)[0];
|
|
174
174
|
if (currentClassId.isZero()) {
|
|
@@ -178,25 +178,26 @@ export async function readCurrentClassId(
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in
|
|
182
|
-
* provider (i.e. PXE).
|
|
183
|
-
* @param contractAddress - The address of the contract to verify class id for.
|
|
184
|
-
* @param executionDataProvider - The execution data provider.
|
|
181
|
+
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
182
|
+
* provider (i.e. PXE's own storage).
|
|
185
183
|
* @param header - The header of the block at which to verify the current class id. If not provided, the anchor block
|
|
186
184
|
* header of the execution data provider is used.
|
|
187
185
|
*/
|
|
188
186
|
export async function verifyCurrentClassId(
|
|
189
187
|
contractAddress: AztecAddress,
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
aztecNode: AztecNode,
|
|
189
|
+
contractStore: ContractStore,
|
|
190
|
+
header: BlockHeader,
|
|
192
191
|
) {
|
|
193
|
-
|
|
192
|
+
const instance = await contractStore.getContractInstance(contractAddress);
|
|
193
|
+
if (!instance) {
|
|
194
|
+
throw new Error(`No contract instance found for address ${contractAddress.toString()}`);
|
|
195
|
+
}
|
|
194
196
|
|
|
195
|
-
const instance = await executionDataProvider.getContractInstance(contractAddress);
|
|
196
197
|
const currentClassId = await readCurrentClassId(
|
|
197
198
|
contractAddress,
|
|
198
199
|
instance,
|
|
199
|
-
|
|
200
|
+
aztecNode,
|
|
200
201
|
header.globalVariables.blockNumber,
|
|
201
202
|
header.globalVariables.timestamp,
|
|
202
203
|
);
|
|
@@ -2,10 +2,12 @@ import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, PRIVATE_CONTEXT_INPUTS_LENGTH }
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
5
6
|
import { type CircuitSimulator, toACVMWitness } from '@aztec/simulator/client';
|
|
6
7
|
import {
|
|
7
8
|
type FunctionAbi,
|
|
8
9
|
type FunctionArtifact,
|
|
10
|
+
type FunctionCall,
|
|
9
11
|
FunctionSelector,
|
|
10
12
|
type NoteSelector,
|
|
11
13
|
countArgumentsSize,
|
|
@@ -13,8 +15,10 @@ import {
|
|
|
13
15
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
14
16
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
17
|
import { computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
18
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
16
19
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
17
|
-
import type
|
|
20
|
+
import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
21
|
+
import { Tag } from '@aztec/stdlib/logs';
|
|
18
22
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
19
23
|
import {
|
|
20
24
|
type BlockHeader,
|
|
@@ -26,8 +30,17 @@ import {
|
|
|
26
30
|
type TxContext,
|
|
27
31
|
} from '@aztec/stdlib/tx';
|
|
28
32
|
|
|
29
|
-
import {
|
|
30
|
-
import type {
|
|
33
|
+
import { NoteService } from '../../notes/note_service.js';
|
|
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';
|
|
31
44
|
import type { ExecutionNoteCache } from '../execution_note_cache.js';
|
|
32
45
|
import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js';
|
|
33
46
|
import type { HashedValuesCache } from '../hashed_values_cache.js';
|
|
@@ -71,14 +84,26 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
71
84
|
private readonly txContext: TxContext,
|
|
72
85
|
private readonly callContext: CallContext,
|
|
73
86
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
74
|
-
protected readonly anchorBlockHeader: BlockHeader,
|
|
87
|
+
protected override readonly anchorBlockHeader: BlockHeader,
|
|
88
|
+
/** Needed to trigger contract synchronization before nested calls */
|
|
89
|
+
private readonly utilityExecutor: (call: FunctionCall) => Promise<void>,
|
|
75
90
|
/** List of transient auth witnesses to be used during this simulation */
|
|
76
91
|
authWitnesses: AuthWitness[],
|
|
77
92
|
capsules: Capsule[],
|
|
78
93
|
private readonly executionCache: HashedValuesCache,
|
|
79
94
|
private readonly noteCache: ExecutionNoteCache,
|
|
80
95
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache,
|
|
81
|
-
|
|
96
|
+
contractStore: ContractStore,
|
|
97
|
+
noteStore: NoteStore,
|
|
98
|
+
keyStore: KeyStore,
|
|
99
|
+
addressStore: AddressStore,
|
|
100
|
+
aztecNode: AztecNode,
|
|
101
|
+
anchorBlockStore: AnchorBlockStore,
|
|
102
|
+
private readonly senderTaggingStore: SenderTaggingStore,
|
|
103
|
+
recipientTaggingStore: RecipientTaggingStore,
|
|
104
|
+
senderAddressBookStore: SenderAddressBookStore,
|
|
105
|
+
capsuleStore: CapsuleStore,
|
|
106
|
+
privateEventStore: PrivateEventStore,
|
|
82
107
|
private totalPublicCalldataCount: number = 0,
|
|
83
108
|
protected sideEffectCounter: number = 0,
|
|
84
109
|
log = createLogger('simulator:client_execution_context'),
|
|
@@ -86,7 +111,24 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
86
111
|
private senderForTags?: AztecAddress,
|
|
87
112
|
private simulator?: CircuitSimulator,
|
|
88
113
|
) {
|
|
89
|
-
super(
|
|
114
|
+
super(
|
|
115
|
+
callContext.contractAddress,
|
|
116
|
+
authWitnesses,
|
|
117
|
+
capsules,
|
|
118
|
+
anchorBlockHeader,
|
|
119
|
+
contractStore,
|
|
120
|
+
noteStore,
|
|
121
|
+
keyStore,
|
|
122
|
+
addressStore,
|
|
123
|
+
aztecNode,
|
|
124
|
+
anchorBlockStore,
|
|
125
|
+
recipientTaggingStore,
|
|
126
|
+
senderAddressBookStore,
|
|
127
|
+
capsuleStore,
|
|
128
|
+
privateEventStore,
|
|
129
|
+
log,
|
|
130
|
+
scopes,
|
|
131
|
+
);
|
|
90
132
|
}
|
|
91
133
|
|
|
92
134
|
public getPrivateContextInputs(): PrivateContextInputs {
|
|
@@ -152,7 +194,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
152
194
|
}
|
|
153
195
|
|
|
154
196
|
/**
|
|
155
|
-
* Returns the pre
|
|
197
|
+
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
156
198
|
*/
|
|
157
199
|
public getUsedPreTags(): PreTag[] {
|
|
158
200
|
return this.taggingIndexCache.getUsedPreTags();
|
|
@@ -202,11 +244,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
202
244
|
* @returns An app tag to be used in a log.
|
|
203
245
|
*/
|
|
204
246
|
public async privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
|
|
205
|
-
const secret = await this
|
|
206
|
-
this.contractAddress,
|
|
207
|
-
sender,
|
|
208
|
-
recipient,
|
|
209
|
-
);
|
|
247
|
+
const secret = await this.#calculateDirectionalAppTaggingSecret(this.contractAddress, sender, recipient);
|
|
210
248
|
|
|
211
249
|
const index = await this.#getIndexToUseForSecret(secret);
|
|
212
250
|
this.log.debug(
|
|
@@ -217,6 +255,22 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
217
255
|
return Tag.compute({ secret, index });
|
|
218
256
|
}
|
|
219
257
|
|
|
258
|
+
async #calculateDirectionalAppTaggingSecret(
|
|
259
|
+
contractAddress: AztecAddress,
|
|
260
|
+
sender: AztecAddress,
|
|
261
|
+
recipient: AztecAddress,
|
|
262
|
+
) {
|
|
263
|
+
const senderCompleteAddress = await this.getCompleteAddress(sender);
|
|
264
|
+
const senderIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(sender);
|
|
265
|
+
return DirectionalAppTaggingSecret.compute(
|
|
266
|
+
senderCompleteAddress,
|
|
267
|
+
senderIvsk,
|
|
268
|
+
recipient,
|
|
269
|
+
contractAddress,
|
|
270
|
+
recipient,
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
220
274
|
async #getIndexToUseForSecret(secret: DirectionalAppTaggingSecret): Promise<number> {
|
|
221
275
|
// If we have the tagging index in the cache, we use it. If not we obtain it from the execution data provider.
|
|
222
276
|
const lastUsedIndexInTx = this.taggingIndexCache.getLastUsedIndex(secret);
|
|
@@ -227,8 +281,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
227
281
|
// This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
|
|
228
282
|
// are up to date. We do this here because this store is not synced as part of the global sync because
|
|
229
283
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
230
|
-
await this.
|
|
231
|
-
|
|
284
|
+
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore);
|
|
285
|
+
|
|
286
|
+
const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret);
|
|
232
287
|
// If lastUsedIndex is undefined, we've never used this secret, so start from 0
|
|
233
288
|
// Otherwise, the next index to use is one past the last used index
|
|
234
289
|
return lastUsedIndex === undefined ? 0 : lastUsedIndex + 1;
|
|
@@ -316,7 +371,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
316
371
|
const pendingNotes = this.noteCache.getNotes(this.callContext.contractAddress, owner, storageSlot);
|
|
317
372
|
|
|
318
373
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
319
|
-
|
|
374
|
+
|
|
375
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
376
|
+
const dbNotes = await noteService.getNotes(
|
|
320
377
|
this.callContext.contractAddress,
|
|
321
378
|
owner,
|
|
322
379
|
storageSlot,
|
|
@@ -494,9 +551,11 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
494
551
|
|
|
495
552
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
496
553
|
|
|
497
|
-
await verifyCurrentClassId(targetContractAddress, this.
|
|
554
|
+
await verifyCurrentClassId(targetContractAddress, this.aztecNode, this.contractStore, this.anchorBlockHeader);
|
|
555
|
+
|
|
556
|
+
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, this.utilityExecutor);
|
|
498
557
|
|
|
499
|
-
const targetArtifact = await this.
|
|
558
|
+
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
|
|
500
559
|
targetContractAddress,
|
|
501
560
|
functionSelector,
|
|
502
561
|
);
|
|
@@ -510,12 +569,23 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
510
569
|
derivedTxContext,
|
|
511
570
|
derivedCallContext,
|
|
512
571
|
this.anchorBlockHeader,
|
|
572
|
+
this.utilityExecutor,
|
|
513
573
|
this.authWitnesses,
|
|
514
574
|
this.capsules,
|
|
515
575
|
this.executionCache,
|
|
516
576
|
this.noteCache,
|
|
517
577
|
this.taggingIndexCache,
|
|
518
|
-
this.
|
|
578
|
+
this.contractStore,
|
|
579
|
+
this.noteStore,
|
|
580
|
+
this.keyStore,
|
|
581
|
+
this.addressStore,
|
|
582
|
+
this.aztecNode,
|
|
583
|
+
this.anchorBlockStore,
|
|
584
|
+
this.senderTaggingStore,
|
|
585
|
+
this.recipientTaggingStore,
|
|
586
|
+
this.senderAddressBookStore,
|
|
587
|
+
this.capsuleStore,
|
|
588
|
+
this.privateEventStore,
|
|
519
589
|
this.totalPublicCalldataCount,
|
|
520
590
|
sideEffectCounter,
|
|
521
591
|
this.log,
|
|
@@ -628,7 +698,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
628
698
|
}
|
|
629
699
|
|
|
630
700
|
public getDebugFunctionName() {
|
|
631
|
-
return this.
|
|
701
|
+
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
632
702
|
}
|
|
633
703
|
|
|
634
704
|
public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
|