@aztec/pxe 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block_synchronizer/block_synchronizer.d.ts +8 -8
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +15 -20
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +25 -22
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +34 -28
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -2
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +4 -4
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +4 -5
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +17 -26
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +14 -39
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +20 -19
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +47 -45
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +4 -4
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +5 -5
- package/dest/debug/pxe_debug_utils.d.ts +6 -6
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +7 -7
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +10 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +10 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +11 -7
- package/dest/error_enriching.d.ts +4 -4
- package/dest/error_enriching.d.ts.map +1 -1
- package/dest/error_enriching.js +6 -6
- package/dest/events/event_service.d.ts +7 -7
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +8 -8
- package/dest/events/private_event_filter_validator.d.ts +6 -6
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +4 -4
- package/dest/job_coordinator/job_coordinator.d.ts +74 -0
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -0
- package/dest/job_coordinator/job_coordinator.js +93 -0
- package/dest/logs/log_service.d.ts +14 -31
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +61 -180
- package/dest/notes/note_service.d.ts +7 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +14 -14
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +3 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +3 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +9 -10
- package/dest/public_storage/public_storage_service.d.ts +4 -4
- package/dest/public_storage/public_storage_service.d.ts.map +1 -1
- package/dest/public_storage/public_storage_service.js +4 -4
- package/dest/pxe.d.ts +11 -9
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +113 -87
- package/dest/storage/address_store/address_store.d.ts +11 -0
- package/dest/storage/address_store/address_store.d.ts.map +1 -0
- package/dest/storage/{address_data_provider/address_data_provider.js → address_store/address_store.js} +1 -1
- package/dest/storage/address_store/index.d.ts +2 -0
- package/dest/storage/address_store/index.d.ts.map +1 -0
- package/dest/storage/address_store/index.js +1 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -0
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -0
- package/dest/storage/{anchor_block_data_provider/anchor_block_data_provider.js → anchor_block_store/anchor_block_store.js} +1 -1
- package/dest/storage/anchor_block_store/index.d.ts +2 -0
- package/dest/storage/anchor_block_store/index.d.ts.map +1 -0
- package/dest/storage/anchor_block_store/index.js +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.d.ts → capsule_store/capsule_store.d.ts} +2 -2
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -0
- package/dest/storage/{capsule_data_provider/capsule_data_provider.js → capsule_store/capsule_store.js} +1 -1
- package/dest/storage/capsule_store/index.d.ts +2 -0
- package/dest/storage/capsule_store/index.d.ts.map +1 -0
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.d.ts → contract_store/contract_store.d.ts} +4 -3
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -0
- package/dest/storage/{contract_data_provider/contract_data_provider.js → contract_store/contract_store.js} +14 -2
- package/dest/storage/contract_store/index.d.ts +2 -0
- package/dest/storage/contract_store/index.d.ts.map +1 -0
- package/dest/storage/contract_store/index.js +1 -0
- package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.d.ts +1 -1
- package/dest/storage/contract_store/private_functions_tree.d.ts.map +1 -0
- package/dest/storage/index.d.ts +8 -8
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +7 -7
- package/dest/storage/note_store/index.d.ts +3 -0
- package/dest/storage/note_store/index.d.ts.map +1 -0
- package/dest/storage/note_store/index.js +2 -0
- package/dest/storage/{note_data_provider/note_data_provider.d.ts → note_store/note_store.d.ts} +7 -7
- package/dest/storage/note_store/note_store.d.ts.map +1 -0
- package/dest/storage/{note_data_provider/note_data_provider.js → note_store/note_store.js} +6 -6
- package/dest/storage/private_event_store/private_event_store.d.ts +56 -0
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -0
- package/dest/storage/{private_event_data_provider/private_event_data_provider.js → private_event_store/private_event_store.js} +59 -16
- package/dest/storage/tagging_store/index.d.ts +4 -0
- package/dest/storage/tagging_store/index.d.ts.map +1 -0
- package/dest/storage/tagging_store/index.js +3 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +21 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -0
- package/dest/{tagging/recipient_sync/new_recipient_tagging_data_provider.js → storage/tagging_store/recipient_tagging_store.js} +3 -3
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +14 -0
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -0
- package/dest/storage/tagging_store/sender_address_book_store.js +30 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.d.ts → tagging_store/sender_tagging_store.d.ts} +3 -3
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -0
- package/dest/storage/{tagging_data_provider/sender_tagging_data_provider.js → tagging_store/sender_tagging_store.js} +3 -3
- package/dest/tagging/constants.d.ts +2 -2
- package/dest/tagging/constants.d.ts.map +1 -1
- package/dest/tagging/constants.js +10 -3
- package/dest/tagging/index.d.ts +14 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +13 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +3 -3
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.d.ts +3 -4
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.js +8 -23
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.js +2 -2
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.d.ts +4 -4
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -0
- package/dest/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.js +3 -3
- package/dest/tree_membership/tree_membership_service.d.ts +4 -4
- package/dest/tree_membership/tree_membership_service.d.ts.map +1 -1
- package/dest/tree_membership/tree_membership_service.js +5 -5
- package/package.json +16 -16
- package/src/block_synchronizer/block_synchronizer.ts +14 -19
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +57 -48
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +4 -0
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -6
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +52 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +53 -49
- package/src/contract_function_simulator/proxied_contract_data_source.ts +7 -7
- package/src/debug/pxe_debug_utils.ts +6 -6
- package/src/entrypoints/client/bundle/utils.ts +7 -1
- package/src/entrypoints/client/lazy/utils.ts +7 -2
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/utils.ts +11 -15
- package/src/error_enriching.ts +7 -15
- package/src/events/event_service.ts +8 -6
- package/src/events/private_event_filter_validator.ts +5 -5
- package/src/job_coordinator/job_coordinator.ts +149 -0
- package/src/logs/log_service.ts +92 -254
- package/src/notes/note_service.ts +13 -13
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +1 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +2 -4
- package/src/private_kernel/private_kernel_oracle.ts +2 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +8 -14
- package/src/public_storage/public_storage_service.ts +3 -3
- package/src/pxe.ts +154 -106
- package/src/storage/{address_data_provider/address_data_provider.ts → address_store/address_store.ts} +1 -1
- package/src/storage/address_store/index.ts +1 -0
- package/src/storage/{anchor_block_data_provider/anchor_block_data_provider.ts → anchor_block_store/anchor_block_store.ts} +1 -1
- package/src/storage/anchor_block_store/index.ts +1 -0
- package/src/storage/{capsule_data_provider/capsule_data_provider.ts → capsule_store/capsule_store.ts} +1 -1
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/{contract_data_provider/contract_data_provider.ts → contract_store/contract_store.ts} +22 -2
- package/src/storage/contract_store/index.ts +1 -0
- package/src/storage/index.ts +7 -7
- package/src/storage/note_store/index.ts +2 -0
- package/src/storage/{note_data_provider/note_data_provider.ts → note_store/note_store.ts} +7 -7
- package/src/storage/{private_event_data_provider/private_event_data_provider.ts → private_event_store/private_event_store.ts} +72 -18
- package/src/storage/tagging_store/index.ts +3 -0
- package/src/{tagging/recipient_sync/new_recipient_tagging_data_provider.ts → storage/tagging_store/recipient_tagging_store.ts} +3 -3
- package/src/storage/tagging_store/sender_address_book_store.ts +42 -0
- package/src/storage/{tagging_data_provider/sender_tagging_data_provider.ts → tagging_store/sender_tagging_store.ts} +3 -3
- package/src/tagging/constants.ts +10 -3
- package/src/tagging/index.ts +16 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +11 -8
- package/src/tagging/{sync → sender_sync}/sync_sender_tagging_indexes.ts +9 -25
- package/src/tagging/{sync → sender_sync}/utils/get_status_change_of_pending.ts +6 -2
- package/src/tagging/{sync → sender_sync}/utils/load_and_store_new_tagging_indexes.ts +4 -4
- package/src/tree_membership/tree_membership_service.ts +4 -4
- package/dest/storage/address_data_provider/address_data_provider.d.ts +0 -11
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.d.ts +0 -2
- package/dest/storage/address_data_provider/index.d.ts.map +0 -1
- package/dest/storage/address_data_provider/index.js +0 -1
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts +0 -9
- package/dest/storage/anchor_block_data_provider/anchor_block_data_provider.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.d.ts +0 -2
- package/dest/storage/anchor_block_data_provider/index.d.ts.map +0 -1
- package/dest/storage/anchor_block_data_provider/index.js +0 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.d.ts +0 -2
- package/dest/storage/capsule_data_provider/index.d.ts.map +0 -1
- package/dest/storage/capsule_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.d.ts +0 -2
- package/dest/storage/contract_data_provider/index.d.ts.map +0 -1
- package/dest/storage/contract_data_provider/index.js +0 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.d.ts +0 -3
- package/dest/storage/note_data_provider/index.d.ts.map +0 -1
- package/dest/storage/note_data_provider/index.js +0 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +0 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +0 -51
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.d.ts +0 -3
- package/dest/storage/tagging_data_provider/index.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/index.js +0 -2
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts +0 -31
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/storage/tagging_data_provider/recipient_tagging_data_provider.js +0 -65
- package/dest/storage/tagging_data_provider/sender_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts +0 -21
- package/dest/tagging/recipient_sync/new_recipient_tagging_data_provider.d.ts.map +0 -1
- package/dest/tagging/sync/sync_sender_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/sync/utils/get_status_change_of_pending.d.ts.map +0 -1
- package/dest/tagging/sync/utils/load_and_store_new_tagging_indexes.d.ts.map +0 -1
- package/dest/tagging/utils.d.ts +0 -18
- package/dest/tagging/utils.d.ts.map +0 -1
- package/dest/tagging/utils.js +0 -25
- package/src/storage/address_data_provider/index.ts +0 -1
- package/src/storage/anchor_block_data_provider/index.ts +0 -1
- package/src/storage/capsule_data_provider/index.ts +0 -1
- package/src/storage/contract_data_provider/index.ts +0 -1
- package/src/storage/note_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/index.ts +0 -2
- package/src/storage/tagging_data_provider/recipient_tagging_data_provider.ts +0 -86
- package/src/tagging/utils.ts +0 -32
- /package/dest/storage/{contract_data_provider → contract_store}/private_functions_tree.js +0 -0
- /package/src/storage/{contract_data_provider → contract_store}/private_functions_tree.ts +0 -0
|
@@ -71,14 +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 {
|
|
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';
|
|
82
83
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
83
84
|
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
84
85
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
@@ -95,16 +96,17 @@ export class ContractFunctionSimulator {
|
|
|
95
96
|
private log: Logger;
|
|
96
97
|
|
|
97
98
|
constructor(
|
|
98
|
-
private
|
|
99
|
-
private
|
|
99
|
+
private contractStore: ContractStore,
|
|
100
|
+
private noteStore: NoteStore,
|
|
100
101
|
private keyStore: KeyStore,
|
|
101
|
-
private
|
|
102
|
+
private addressStore: AddressStore,
|
|
102
103
|
private aztecNode: AztecNode,
|
|
103
|
-
private
|
|
104
|
-
private
|
|
105
|
-
private
|
|
106
|
-
private
|
|
107
|
-
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,
|
|
108
110
|
private simulator: CircuitSimulator,
|
|
109
111
|
) {
|
|
110
112
|
this.log = createLogger('simulator');
|
|
@@ -121,6 +123,7 @@ export class ContractFunctionSimulator {
|
|
|
121
123
|
* @param senderForTags - The address that is used as a tagging sender when emitting private logs. Returned from
|
|
122
124
|
* the `privateGetSenderForTags` oracle.
|
|
123
125
|
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
126
|
+
* @param jobId - The job ID for staged writes.
|
|
124
127
|
* @returns The result of the execution.
|
|
125
128
|
*/
|
|
126
129
|
public async run(
|
|
@@ -129,18 +132,20 @@ export class ContractFunctionSimulator {
|
|
|
129
132
|
selector: FunctionSelector,
|
|
130
133
|
msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE),
|
|
131
134
|
anchorBlockHeader: BlockHeader,
|
|
132
|
-
senderForTags
|
|
133
|
-
scopes
|
|
135
|
+
senderForTags: AztecAddress | undefined,
|
|
136
|
+
scopes: AztecAddress[] | undefined,
|
|
137
|
+
jobId: string,
|
|
134
138
|
): Promise<PrivateExecutionResult> {
|
|
135
139
|
const simulatorSetupTimer = new Timer();
|
|
136
140
|
|
|
137
|
-
await
|
|
138
|
-
|
|
139
|
-
const entryPointArtifact = await this.contractDataProvider.getFunctionArtifactWithDebugMetadata(
|
|
140
|
-
contractAddress,
|
|
141
|
-
selector,
|
|
141
|
+
await this.contractStore.syncPrivateState(contractAddress, selector, privateSyncCall =>
|
|
142
|
+
this.runUtility(privateSyncCall, [], anchorBlockHeader, scopes, jobId),
|
|
142
143
|
);
|
|
143
144
|
|
|
145
|
+
await verifyCurrentClassId(contractAddress, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
146
|
+
|
|
147
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(contractAddress, selector);
|
|
148
|
+
|
|
144
149
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
145
150
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
146
151
|
}
|
|
@@ -170,21 +175,26 @@ export class ContractFunctionSimulator {
|
|
|
170
175
|
request.txContext,
|
|
171
176
|
callContext,
|
|
172
177
|
anchorBlockHeader,
|
|
178
|
+
async call => {
|
|
179
|
+
await this.runUtility(call, [], anchorBlockHeader, scopes, jobId);
|
|
180
|
+
},
|
|
173
181
|
request.authWitnesses,
|
|
174
182
|
request.capsules,
|
|
175
183
|
HashedValuesCache.create(request.argsOfCalls),
|
|
176
184
|
noteCache,
|
|
177
185
|
taggingIndexCache,
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
186
|
+
this.contractStore,
|
|
187
|
+
this.noteStore,
|
|
180
188
|
this.keyStore,
|
|
181
|
-
this.
|
|
189
|
+
this.addressStore,
|
|
182
190
|
this.aztecNode,
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
191
|
+
this.anchorBlockStore,
|
|
192
|
+
this.senderTaggingStore,
|
|
193
|
+
this.recipientTaggingStore,
|
|
194
|
+
this.senderAddressBookStore,
|
|
195
|
+
this.capsuleStore,
|
|
196
|
+
this.privateEventStore,
|
|
197
|
+
jobId,
|
|
188
198
|
0, // totalPublicArgsCount
|
|
189
199
|
startSideEffectCounter,
|
|
190
200
|
undefined, // log
|
|
@@ -254,14 +264,12 @@ export class ContractFunctionSimulator {
|
|
|
254
264
|
call: FunctionCall,
|
|
255
265
|
authwits: AuthWitness[],
|
|
256
266
|
anchorBlockHeader: BlockHeader,
|
|
257
|
-
scopes
|
|
267
|
+
scopes: AztecAddress[] | undefined,
|
|
268
|
+
jobId: string,
|
|
258
269
|
): Promise<Fr[]> {
|
|
259
|
-
await verifyCurrentClassId(call.to, this.aztecNode, this.
|
|
270
|
+
await verifyCurrentClassId(call.to, this.aztecNode, this.contractStore, anchorBlockHeader);
|
|
260
271
|
|
|
261
|
-
const entryPointArtifact = await this.
|
|
262
|
-
call.to,
|
|
263
|
-
call.selector,
|
|
264
|
-
);
|
|
272
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
265
273
|
|
|
266
274
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
267
275
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
@@ -272,16 +280,17 @@ export class ContractFunctionSimulator {
|
|
|
272
280
|
authwits,
|
|
273
281
|
[],
|
|
274
282
|
anchorBlockHeader,
|
|
275
|
-
this.
|
|
276
|
-
this.
|
|
283
|
+
this.contractStore,
|
|
284
|
+
this.noteStore,
|
|
277
285
|
this.keyStore,
|
|
278
|
-
this.
|
|
286
|
+
this.addressStore,
|
|
279
287
|
this.aztecNode,
|
|
280
|
-
this.
|
|
281
|
-
this.
|
|
282
|
-
this.
|
|
283
|
-
this.
|
|
284
|
-
this.
|
|
288
|
+
this.anchorBlockStore,
|
|
289
|
+
this.recipientTaggingStore,
|
|
290
|
+
this.senderAddressBookStore,
|
|
291
|
+
this.capsuleStore,
|
|
292
|
+
this.privateEventStore,
|
|
293
|
+
jobId,
|
|
285
294
|
undefined,
|
|
286
295
|
scopes,
|
|
287
296
|
);
|
|
@@ -347,13 +356,13 @@ class OrderedSideEffect<T> {
|
|
|
347
356
|
* @param privateExecutionResult - The result of the private execution.
|
|
348
357
|
* @param nonceGenerator - A nonce generator for note hashes. According to the protocol rules,
|
|
349
358
|
* it can either be the first nullifier in the tx or the hash of the initial tx request if there are none.
|
|
350
|
-
* @param
|
|
359
|
+
* @param contractStore - A provider for contract data in order to get function names and debug info.
|
|
351
360
|
* @returns The simulated proving result.
|
|
352
361
|
*/
|
|
353
362
|
export async function generateSimulatedProvingResult(
|
|
354
363
|
privateExecutionResult: PrivateExecutionResult,
|
|
355
364
|
nonceGenerator: Fr,
|
|
356
|
-
|
|
365
|
+
contractStore: ContractStore,
|
|
357
366
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
358
367
|
const siloedNoteHashes: OrderedSideEffect<Fr>[] = [];
|
|
359
368
|
const nullifiers: OrderedSideEffect<Fr>[] = [];
|
|
@@ -430,7 +439,7 @@ export async function generateSimulatedProvingResult(
|
|
|
430
439
|
: execution.publicInputs.publicTeardownCallRequest;
|
|
431
440
|
|
|
432
441
|
executionSteps.push({
|
|
433
|
-
functionName: await
|
|
442
|
+
functionName: await contractStore.getDebugFunctionName(
|
|
434
443
|
execution.publicInputs.callContext.contractAddress,
|
|
435
444
|
execution.publicInputs.callContext.functionSelector,
|
|
436
445
|
),
|
|
@@ -15,6 +15,7 @@ export class EventValidationRequest {
|
|
|
15
15
|
constructor(
|
|
16
16
|
public contractAddress: AztecAddress,
|
|
17
17
|
public eventTypeId: EventSelector,
|
|
18
|
+
public randomness: Fr,
|
|
18
19
|
public serializedEvent: Fr[],
|
|
19
20
|
public eventCommitment: Fr,
|
|
20
21
|
public txHash: TxHash,
|
|
@@ -27,6 +28,8 @@ export class EventValidationRequest {
|
|
|
27
28
|
const contractAddress = AztecAddress.fromField(reader.readField());
|
|
28
29
|
const eventTypeId = EventSelector.fromField(reader.readField());
|
|
29
30
|
|
|
31
|
+
const randomness = reader.readField();
|
|
32
|
+
|
|
30
33
|
const eventStorage = reader.readFieldArray(MAX_EVENT_SERIALIZED_LEN);
|
|
31
34
|
const eventLen = reader.readField().toNumber();
|
|
32
35
|
const serializedEvent = eventStorage.slice(0, eventLen);
|
|
@@ -38,6 +41,7 @@ export class EventValidationRequest {
|
|
|
38
41
|
return new EventValidationRequest(
|
|
39
42
|
contractAddress,
|
|
40
43
|
eventTypeId,
|
|
44
|
+
randomness,
|
|
41
45
|
serializedEvent,
|
|
42
46
|
eventCommitment,
|
|
43
47
|
txHash,
|
|
@@ -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
|
|
|
@@ -85,7 +85,6 @@ export async function executePrivateFunction(
|
|
|
85
85
|
|
|
86
86
|
const rawReturnValues = await privateExecutionOracle.privateLoadFromExecutionCache(publicInputs.returnsHash);
|
|
87
87
|
|
|
88
|
-
const noteHashLeafIndexMap = privateExecutionOracle.getNoteHashLeafIndexMap();
|
|
89
88
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
90
89
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
91
90
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|
|
@@ -108,7 +107,6 @@ export async function executePrivateFunction(
|
|
|
108
107
|
Buffer.from(artifact.verificationKey!, 'base64'),
|
|
109
108
|
partialWitness,
|
|
110
109
|
publicInputs,
|
|
111
|
-
noteHashLeafIndexMap,
|
|
112
110
|
newNotes,
|
|
113
111
|
noteHashNullifierCounterMap,
|
|
114
112
|
rawReturnValues,
|
|
@@ -154,7 +152,7 @@ export function extractPrivateCircuitPublicInputs(
|
|
|
154
152
|
* from the instance is used.
|
|
155
153
|
* @param contractAddress - The address of the contract to read the class id for.
|
|
156
154
|
* @param instance - The instance of the contract.
|
|
157
|
-
* @param
|
|
155
|
+
* @param executionStore - The execution data provider.
|
|
158
156
|
* @param blockNumber - The block number at which to load the DelayedPublicMutable storing the class id.
|
|
159
157
|
* @param timestamp - The timestamp at which to obtain the class id from the DelayedPublicMutable.
|
|
160
158
|
* @returns The current class id.
|
|
@@ -186,10 +184,10 @@ export async function readCurrentClassId(
|
|
|
186
184
|
export async function verifyCurrentClassId(
|
|
187
185
|
contractAddress: AztecAddress,
|
|
188
186
|
aztecNode: AztecNode,
|
|
189
|
-
|
|
187
|
+
contractStore: ContractStore,
|
|
190
188
|
header: BlockHeader,
|
|
191
189
|
) {
|
|
192
|
-
const instance = await
|
|
190
|
+
const instance = await contractStore.getContractInstance(contractAddress);
|
|
193
191
|
if (!instance) {
|
|
194
192
|
throw new Error(`No contract instance found for address ${contractAddress.toString()}`);
|
|
195
193
|
}
|
|
@@ -7,13 +7,14 @@ 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,
|
|
13
14
|
} from '@aztec/stdlib/abi';
|
|
14
15
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
15
16
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
16
|
-
import {
|
|
17
|
+
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
17
18
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
18
19
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
19
20
|
import { type ContractClassLog, DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
@@ -30,15 +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 {
|
|
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';
|
|
42
44
|
import type { ExecutionNoteCache } from '../execution_note_cache.js';
|
|
43
45
|
import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js';
|
|
44
46
|
import type { HashedValuesCache } from '../hashed_values_cache.js';
|
|
@@ -62,16 +64,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
62
64
|
* Users can also use this to get a clearer idea of what's happened during a simulation.
|
|
63
65
|
*/
|
|
64
66
|
private newNotes: NoteAndSlot[] = [];
|
|
65
|
-
/**
|
|
66
|
-
* Notes from previous transactions that are returned to the oracle call `getNotes` during this execution.
|
|
67
|
-
* The mapping maps from the unique siloed note hash to the index for notes created in private executions.
|
|
68
|
-
* It maps from siloed note hash to the index for notes created by public functions.
|
|
69
|
-
*
|
|
70
|
-
* They are not part of the ExecutionNoteCache and being forwarded to nested contexts via `extend()`
|
|
71
|
-
* because these notes are meant to be maintained on a per-call basis
|
|
72
|
-
* They should act as references for the read requests output by an app circuit via public inputs.
|
|
73
|
-
*/
|
|
74
|
-
private noteHashLeafIndexMap: Map<bigint, bigint> = new Map();
|
|
75
67
|
private noteHashNullifierCounterMap: Map<number, number> = new Map();
|
|
76
68
|
private contractClassLogs: CountedContractClassLog[] = [];
|
|
77
69
|
private offchainEffects: { data: Fr[] }[] = [];
|
|
@@ -83,22 +75,26 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
83
75
|
private readonly callContext: CallContext,
|
|
84
76
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
85
77
|
protected override readonly anchorBlockHeader: BlockHeader,
|
|
78
|
+
/** Needed to trigger contract synchronization before nested calls */
|
|
79
|
+
private readonly utilityExecutor: (call: FunctionCall) => Promise<void>,
|
|
86
80
|
/** List of transient auth witnesses to be used during this simulation */
|
|
87
81
|
authWitnesses: AuthWitness[],
|
|
88
82
|
capsules: Capsule[],
|
|
89
83
|
private readonly executionCache: HashedValuesCache,
|
|
90
84
|
private readonly noteCache: ExecutionNoteCache,
|
|
91
85
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache,
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
contractStore: ContractStore,
|
|
87
|
+
noteStore: NoteStore,
|
|
94
88
|
keyStore: KeyStore,
|
|
95
|
-
|
|
89
|
+
addressStore: AddressStore,
|
|
96
90
|
aztecNode: AztecNode,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
anchorBlockStore: AnchorBlockStore,
|
|
92
|
+
private readonly senderTaggingStore: SenderTaggingStore,
|
|
93
|
+
recipientTaggingStore: RecipientTaggingStore,
|
|
94
|
+
senderAddressBookStore: SenderAddressBookStore,
|
|
95
|
+
capsuleStore: CapsuleStore,
|
|
96
|
+
privateEventStore: PrivateEventStore,
|
|
97
|
+
jobId: string,
|
|
102
98
|
private totalPublicCalldataCount: number = 0,
|
|
103
99
|
protected sideEffectCounter: number = 0,
|
|
104
100
|
log = createLogger('simulator:client_execution_context'),
|
|
@@ -111,16 +107,17 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
111
107
|
authWitnesses,
|
|
112
108
|
capsules,
|
|
113
109
|
anchorBlockHeader,
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
contractStore,
|
|
111
|
+
noteStore,
|
|
116
112
|
keyStore,
|
|
117
|
-
|
|
113
|
+
addressStore,
|
|
118
114
|
aztecNode,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
anchorBlockStore,
|
|
116
|
+
recipientTaggingStore,
|
|
117
|
+
senderAddressBookStore,
|
|
118
|
+
capsuleStore,
|
|
119
|
+
privateEventStore,
|
|
120
|
+
jobId,
|
|
124
121
|
log,
|
|
125
122
|
scopes,
|
|
126
123
|
);
|
|
@@ -155,14 +152,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
155
152
|
return toACVMWitness(0, fields);
|
|
156
153
|
}
|
|
157
154
|
|
|
158
|
-
/**
|
|
159
|
-
* The KernelProver will use this to fully populate witnesses and provide hints to the kernel circuit
|
|
160
|
-
* regarding which note hash each settled read request corresponds to.
|
|
161
|
-
*/
|
|
162
|
-
public getNoteHashLeafIndexMap() {
|
|
163
|
-
return this.noteHashLeafIndexMap;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
155
|
/**
|
|
167
156
|
* Get the data for the newly created notes.
|
|
168
157
|
*/
|
|
@@ -276,9 +265,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
276
265
|
// This is a tagging secret we've not yet used in this tx, so first sync our store to make sure its indices
|
|
277
266
|
// are up to date. We do this here because this store is not synced as part of the global sync because
|
|
278
267
|
// that'd be wasteful as most tagging secrets are not used in each tx.
|
|
279
|
-
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.
|
|
268
|
+
await syncSenderTaggingIndexes(secret, this.contractAddress, this.aztecNode, this.senderTaggingStore);
|
|
280
269
|
|
|
281
|
-
const lastUsedIndex = await this.
|
|
270
|
+
const lastUsedIndex = await this.senderTaggingStore.getLastUsedIndex(secret);
|
|
282
271
|
// If lastUsedIndex is undefined, we've never used this secret, so start from 0
|
|
283
272
|
// Otherwise, the next index to use is one past the last used index
|
|
284
273
|
return lastUsedIndex === undefined ? 0 : lastUsedIndex + 1;
|
|
@@ -367,7 +356,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
367
356
|
|
|
368
357
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.contractAddress);
|
|
369
358
|
|
|
370
|
-
const noteService = new NoteService(this.
|
|
359
|
+
const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockStore);
|
|
371
360
|
const dbNotes = await noteService.getNotes(
|
|
372
361
|
this.callContext.contractAddress,
|
|
373
362
|
owner,
|
|
@@ -397,23 +386,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
397
386
|
.join(', ')}`,
|
|
398
387
|
);
|
|
399
388
|
|
|
400
|
-
const noteHashesAndIndexes = await Promise.all(
|
|
401
|
-
notes.map(async n => {
|
|
402
|
-
if (n.index !== undefined) {
|
|
403
|
-
const siloedNoteHash = await siloNoteHash(n.contractAddress, n.noteHash);
|
|
404
|
-
const uniqueNoteHash = await computeUniqueNoteHash(n.noteNonce, siloedNoteHash);
|
|
405
|
-
|
|
406
|
-
return { hash: uniqueNoteHash, index: n.index };
|
|
407
|
-
}
|
|
408
|
-
}),
|
|
409
|
-
);
|
|
410
|
-
|
|
411
|
-
noteHashesAndIndexes
|
|
412
|
-
.filter(n => n !== undefined)
|
|
413
|
-
.forEach(n => {
|
|
414
|
-
this.noteHashLeafIndexMap.set(n!.hash.toBigInt(), n!.index);
|
|
415
|
-
});
|
|
416
|
-
|
|
417
389
|
return notes;
|
|
418
390
|
}
|
|
419
391
|
|
|
@@ -546,14 +518,11 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
546
518
|
|
|
547
519
|
isStaticCall = isStaticCall || this.callContext.isStaticCall;
|
|
548
520
|
|
|
549
|
-
await verifyCurrentClassId(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
this.contractDataProvider,
|
|
553
|
-
this.anchorBlockHeader,
|
|
554
|
-
);
|
|
521
|
+
await verifyCurrentClassId(targetContractAddress, this.aztecNode, this.contractStore, this.anchorBlockHeader);
|
|
522
|
+
|
|
523
|
+
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, this.utilityExecutor);
|
|
555
524
|
|
|
556
|
-
const targetArtifact = await this.
|
|
525
|
+
const targetArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(
|
|
557
526
|
targetContractAddress,
|
|
558
527
|
functionSelector,
|
|
559
528
|
);
|
|
@@ -567,21 +536,24 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
567
536
|
derivedTxContext,
|
|
568
537
|
derivedCallContext,
|
|
569
538
|
this.anchorBlockHeader,
|
|
539
|
+
this.utilityExecutor,
|
|
570
540
|
this.authWitnesses,
|
|
571
541
|
this.capsules,
|
|
572
542
|
this.executionCache,
|
|
573
543
|
this.noteCache,
|
|
574
544
|
this.taggingIndexCache,
|
|
575
|
-
this.
|
|
576
|
-
this.
|
|
545
|
+
this.contractStore,
|
|
546
|
+
this.noteStore,
|
|
577
547
|
this.keyStore,
|
|
578
|
-
this.
|
|
548
|
+
this.addressStore,
|
|
579
549
|
this.aztecNode,
|
|
580
|
-
this.
|
|
581
|
-
this.
|
|
582
|
-
this.
|
|
583
|
-
this.
|
|
584
|
-
this.
|
|
550
|
+
this.anchorBlockStore,
|
|
551
|
+
this.senderTaggingStore,
|
|
552
|
+
this.recipientTaggingStore,
|
|
553
|
+
this.senderAddressBookStore,
|
|
554
|
+
this.capsuleStore,
|
|
555
|
+
this.privateEventStore,
|
|
556
|
+
this.jobId,
|
|
585
557
|
this.totalPublicCalldataCount,
|
|
586
558
|
sideEffectCounter,
|
|
587
559
|
this.log,
|
|
@@ -694,7 +666,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
694
666
|
}
|
|
695
667
|
|
|
696
668
|
public getDebugFunctionName() {
|
|
697
|
-
return this.
|
|
669
|
+
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
698
670
|
}
|
|
699
671
|
|
|
700
672
|
public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
|