@aztec/pxe 0.0.1-commit.7d4e6cd → 0.0.1-commit.7ffbba4
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/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +11 -5
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +72 -21
- package/dest/config/index.d.ts +4 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +18 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/benchmarked_node.d.ts +9 -0
- package/dest/contract_function_simulator/benchmarked_node.d.ts.map +1 -0
- package/dest/contract_function_simulator/benchmarked_node.js +77 -0
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +57 -35
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +201 -87
- package/dest/contract_function_simulator/execution_note_cache.d.ts +18 -9
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +45 -28
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/index.d.ts +2 -2
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -4
- 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 +6 -5
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -5
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +4 -6
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +4 -10
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.js +7 -18
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +54 -47
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts +3 -1
- package/dest/contract_function_simulator/oracle/message_load_oracle_inputs.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +6 -6
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +8 -8
- package/dest/contract_function_simulator/oracle/oracle.d.ts +43 -42
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +175 -114
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -26
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +61 -66
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +113 -75
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +90 -55
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +156 -136
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/helpers.js +55 -0
- package/dest/debug/pxe_debug_utils.d.ts +24 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +28 -17
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- 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 +21 -7
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +22 -8
- 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 +5 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +4 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +28 -9
- 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 +19 -22
- package/dest/events/private_event_filter_validator.d.ts +5 -5
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +5 -6
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +8 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +31 -33
- package/dest/notes/note_service.d.ts +10 -9
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +34 -38
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +5 -4
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +3 -3
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +2 -2
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +29 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -0
- package/dest/private_kernel/hints/{build_private_kernel_reset_private_inputs.js → private_kernel_reset_private_inputs_builder.js} +140 -73
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +22 -14
- package/dest/private_kernel/private_kernel_oracle.d.ts +23 -24
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +94 -2
- package/dest/pxe.d.ts +77 -59
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +132 -136
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.d.ts +24 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +130 -23
- package/dest/storage/contract_store/contract_store.d.ts +42 -16
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +157 -84
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +50 -51
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +284 -263
- package/dest/storage/note_store/stored_note.d.ts +16 -0
- package/dest/storage/note_store/stored_note.d.ts.map +1 -0
- package/dest/storage/note_store/stored_note.js +43 -0
- package/dest/storage/private_event_store/private_event_store.d.ts +43 -8
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +226 -111
- package/dest/storage/private_event_store/stored_private_event.d.ts +23 -0
- package/dest/storage/private_event_store/stored_private_event.d.ts.map +1 -0
- package/dest/storage/private_event_store/stored_private_event.js +56 -0
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +16 -9
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +88 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +20 -10
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +253 -101
- package/dest/tagging/get_all_logs_by_tags.d.ts +24 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -0
- package/dest/tagging/get_all_logs_by_tags.js +60 -0
- package/dest/tagging/index.d.ts +3 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +2 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +5 -5
- 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 +11 -11
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +7 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +16 -12
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +5 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +8 -11
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +5 -8
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +7 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +23 -19
- package/package.json +27 -18
- package/src/access_scopes.ts +9 -0
- package/src/bin/check_oracle_version.ts +1 -0
- package/src/block_synchronizer/block_synchronizer.ts +91 -33
- package/src/config/index.ts +15 -1
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/benchmarked_node.ts +103 -0
- package/src/contract_function_simulator/contract_function_simulator.ts +352 -151
- package/src/contract_function_simulator/execution_note_cache.ts +44 -25
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/index.ts +1 -1
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +9 -6
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -7
- package/src/contract_function_simulator/noir-structs/utility_context.ts +6 -25
- package/src/contract_function_simulator/oracle/interfaces.ts +63 -59
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +10 -10
- package/src/contract_function_simulator/oracle/oracle.ts +195 -163
- package/src/contract_function_simulator/oracle/private_execution.ts +2 -68
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +154 -169
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +229 -153
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/helpers.ts +98 -0
- package/src/debug/pxe_debug_utils.ts +63 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +16 -15
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +17 -15
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +4 -0
- package/src/entrypoints/server/utils.ts +22 -26
- package/src/events/event_service.ts +17 -25
- package/src/events/private_event_filter_validator.ts +3 -5
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +51 -40
- package/src/notes/note_service.ts +41 -45
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +5 -4
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +2 -2
- package/src/private_kernel/hints/{build_private_kernel_reset_private_inputs.ts → private_kernel_reset_private_inputs_builder.ts} +195 -136
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +26 -16
- package/src/private_kernel/private_kernel_oracle.ts +116 -37
- package/src/pxe.ts +243 -213
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +159 -23
- package/src/storage/contract_store/contract_store.ts +186 -96
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +326 -320
- package/src/storage/note_store/stored_note.ts +48 -0
- package/src/storage/private_event_store/private_event_store.ts +292 -124
- package/src/storage/private_event_store/stored_private_event.ts +73 -0
- package/src/storage/tagging_store/recipient_tagging_store.ts +111 -21
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +296 -111
- package/src/tagging/get_all_logs_by_tags.ts +92 -0
- package/src/tagging/index.ts +2 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +22 -14
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +17 -16
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +12 -14
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +5 -17
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +26 -23
- package/dest/contract_function_simulator/proxied_node.d.ts +0 -9
- package/dest/contract_function_simulator/proxied_node.d.ts.map +0 -1
- package/dest/contract_function_simulator/proxied_node.js +0 -27
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +0 -28
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +0 -46
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +0 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +0 -85
- package/dest/public_storage/public_storage_service.d.ts +0 -24
- package/dest/public_storage/public_storage_service.d.ts.map +0 -1
- package/dest/public_storage/public_storage_service.js +0 -26
- package/dest/tree_membership/tree_membership_service.d.ts +0 -52
- package/dest/tree_membership/tree_membership_service.d.ts.map +0 -1
- package/dest/tree_membership/tree_membership_service.js +0 -84
- package/src/contract_function_simulator/proxied_node.ts +0 -33
- package/src/private_kernel/private_kernel_oracle_impl.ts +0 -127
- package/src/public_storage/public_storage_service.ts +0 -33
- package/src/tree_membership/tree_membership_service.ts +0 -112
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
} from '@aztec/simulator/client';
|
|
13
13
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
14
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
15
16
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
16
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
17
17
|
|
|
18
18
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
19
|
-
import {
|
|
19
|
+
import { packAsHintedNote } from './note_packing_utils.js';
|
|
20
20
|
|
|
21
21
|
export class UnavailableOracleError extends Error {
|
|
22
22
|
constructor(oracleName: string) {
|
|
@@ -69,12 +69,12 @@ export class Oracle {
|
|
|
69
69
|
name => !excludedProps.includes(name as (typeof excludedProps)[number]),
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
// Validate oracle names - these must be prefixed with either "
|
|
72
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
73
73
|
// and must correspond to a function on the Oracle class.
|
|
74
74
|
oracleNames.forEach(name => {
|
|
75
|
-
if (!name.startsWith('
|
|
75
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
76
76
|
throw new Error(
|
|
77
|
-
`Oracle function "${name}" must be prefixed with either "
|
|
77
|
+
`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -92,41 +92,46 @@ export class Oracle {
|
|
|
92
92
|
}, {} as ACIRCallback);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
// eslint-disable-next-line camelcase
|
|
96
|
+
aztec_utl_assertCompatibleOracleVersion([version]: ACVMField[]) {
|
|
97
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
97
98
|
return Promise.resolve([]);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
// eslint-disable-next-line camelcase
|
|
102
|
+
aztec_utl_getRandomField(): Promise<ACVMField[]> {
|
|
103
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
102
104
|
return Promise.resolve([toACVMField(val)]);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
// eslint-disable-next-line camelcase
|
|
108
|
+
aztec_prv_storeInExecutionCache(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
109
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
107
110
|
return Promise.resolve([]);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
// eslint-disable-next-line camelcase
|
|
114
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
115
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
112
116
|
return [values.map(toACVMField)];
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
// eslint-disable-next-line camelcase
|
|
120
|
+
aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
121
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
117
122
|
return Promise.resolve(context.toNoirRepresentation());
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
// eslint-disable-next-line camelcase
|
|
126
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
127
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
122
128
|
|
|
123
129
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
);
|
|
132
|
+
// eslint-disable-next-line camelcase
|
|
133
|
+
async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
|
|
134
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
130
135
|
|
|
131
136
|
return [
|
|
132
137
|
instance.salt,
|
|
@@ -137,109 +142,130 @@ export class Oracle {
|
|
|
137
142
|
].map(toACVMField);
|
|
138
143
|
}
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[
|
|
143
|
-
[
|
|
145
|
+
// eslint-disable-next-line camelcase
|
|
146
|
+
async aztec_utl_getNoteHashMembershipWitness(
|
|
147
|
+
[anchorBlockHash]: ACVMField[],
|
|
148
|
+
[noteHash]: ACVMField[],
|
|
144
149
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const parsedLeafValue = Fr.fromString(leafValue);
|
|
150
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
151
|
+
const parsedNoteHash = Fr.fromString(noteHash);
|
|
148
152
|
|
|
149
|
-
const witness = await this.handlerAsUtility().
|
|
150
|
-
BlockNumber(parsedBlockNumber),
|
|
151
|
-
parsedTreeId,
|
|
152
|
-
parsedLeafValue,
|
|
153
|
-
);
|
|
153
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
154
154
|
if (!witness) {
|
|
155
155
|
throw new Error(
|
|
156
|
-
`
|
|
156
|
+
`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
|
-
return
|
|
159
|
+
return witness.toNoirRepresentation();
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
// eslint-disable-next-line camelcase
|
|
163
|
+
async aztec_utl_getBlockHashMembershipWitness(
|
|
164
|
+
[anchorBlockHash]: ACVMField[],
|
|
165
|
+
[blockHash]: ACVMField[],
|
|
166
|
+
): Promise<(ACVMField | ACVMField[])[]> {
|
|
167
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
168
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
169
|
+
|
|
170
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
171
|
+
if (!witness) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return witness.toNoirRepresentation();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// eslint-disable-next-line camelcase
|
|
180
|
+
async aztec_utl_getNullifierMembershipWitness(
|
|
181
|
+
[blockHash]: ACVMField[],
|
|
164
182
|
[nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
|
|
165
183
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
166
|
-
const
|
|
184
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
167
185
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
168
186
|
|
|
169
|
-
const witness = await this.handlerAsUtility().
|
|
170
|
-
BlockNumber(parsedBlockNumber),
|
|
171
|
-
parsedNullifier,
|
|
172
|
-
);
|
|
187
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
173
188
|
if (!witness) {
|
|
174
|
-
throw new Error(
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
191
|
+
);
|
|
175
192
|
}
|
|
176
193
|
return witness.toNoirRepresentation();
|
|
177
194
|
}
|
|
178
195
|
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
// eslint-disable-next-line camelcase
|
|
197
|
+
async aztec_utl_getLowNullifierMembershipWitness(
|
|
198
|
+
[blockHash]: ACVMField[],
|
|
181
199
|
[nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
|
|
182
200
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
183
|
-
const
|
|
201
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
184
202
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
185
203
|
|
|
186
|
-
const witness = await this.handlerAsUtility().
|
|
187
|
-
BlockNumber(parsedBlockNumber),
|
|
188
|
-
parsedNullifier,
|
|
189
|
-
);
|
|
204
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
190
205
|
if (!witness) {
|
|
191
206
|
throw new Error(
|
|
192
|
-
`Low nullifier witness not found for nullifier ${parsedNullifier} at block ${
|
|
207
|
+
`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
193
208
|
);
|
|
194
209
|
}
|
|
195
210
|
return witness.toNoirRepresentation();
|
|
196
211
|
}
|
|
197
212
|
|
|
198
|
-
|
|
199
|
-
|
|
213
|
+
// eslint-disable-next-line camelcase
|
|
214
|
+
async aztec_utl_getPublicDataWitness(
|
|
215
|
+
[blockHash]: ACVMField[],
|
|
200
216
|
[leafSlot]: ACVMField[],
|
|
201
217
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
202
|
-
const
|
|
218
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
203
219
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
204
220
|
|
|
205
|
-
const witness = await this.handlerAsUtility().
|
|
206
|
-
BlockNumber(parsedBlockNumber),
|
|
207
|
-
parsedLeafSlot,
|
|
208
|
-
);
|
|
221
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
209
222
|
if (!witness) {
|
|
210
|
-
throw new Error(
|
|
223
|
+
throw new Error(
|
|
224
|
+
`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
|
|
225
|
+
);
|
|
211
226
|
}
|
|
212
227
|
return witness.toNoirRepresentation();
|
|
213
228
|
}
|
|
214
229
|
|
|
215
|
-
|
|
230
|
+
// eslint-disable-next-line camelcase
|
|
231
|
+
async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
216
232
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
217
233
|
|
|
218
|
-
const header = await this.handlerAsUtility().
|
|
234
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
219
235
|
if (!header) {
|
|
220
236
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
221
237
|
}
|
|
222
238
|
return header.toFields().map(toACVMField);
|
|
223
239
|
}
|
|
224
240
|
|
|
225
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
226
243
|
const messageHashField = Fr.fromString(messageHash);
|
|
227
|
-
const witness = await this.handlerAsUtility().
|
|
244
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
228
245
|
if (!witness) {
|
|
229
246
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
230
247
|
}
|
|
231
248
|
return [witness.map(toACVMField)];
|
|
232
249
|
}
|
|
233
250
|
|
|
234
|
-
|
|
251
|
+
// eslint-disable-next-line camelcase
|
|
252
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
235
253
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
236
|
-
const
|
|
237
|
-
await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(parsedAddress);
|
|
254
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
238
255
|
|
|
239
|
-
return
|
|
256
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
257
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
258
|
+
if (result === undefined) {
|
|
259
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
260
|
+
return [toACVMField(0), Array(13).fill(toACVMField(0))];
|
|
261
|
+
} else {
|
|
262
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
263
|
+
return [toACVMField(1), [...result.publicKeys.toFields(), result.partialAddress].map(toACVMField)];
|
|
264
|
+
}
|
|
240
265
|
}
|
|
241
266
|
|
|
242
|
-
|
|
267
|
+
// eslint-disable-next-line camelcase
|
|
268
|
+
async aztec_utl_getNotes(
|
|
243
269
|
[ownerSome]: ACVMField[],
|
|
244
270
|
[ownerValue]: ACVMField[],
|
|
245
271
|
[storageSlot]: ACVMField[],
|
|
@@ -257,11 +283,11 @@ export class Oracle {
|
|
|
257
283
|
[offset]: ACVMField[],
|
|
258
284
|
[status]: ACVMField[],
|
|
259
285
|
[maxNotes]: ACVMField[],
|
|
260
|
-
[
|
|
286
|
+
[packedHintedNoteLength]: ACVMField[],
|
|
261
287
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
262
288
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
263
289
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
264
|
-
const noteDatas = await this.handlerAsUtility().
|
|
290
|
+
const noteDatas = await this.handlerAsUtility().getNotes(
|
|
265
291
|
owner,
|
|
266
292
|
Fr.fromString(storageSlot),
|
|
267
293
|
+numSelects,
|
|
@@ -279,28 +305,29 @@ export class Oracle {
|
|
|
279
305
|
+status,
|
|
280
306
|
);
|
|
281
307
|
|
|
282
|
-
const
|
|
283
|
-
|
|
308
|
+
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map(noteData =>
|
|
309
|
+
packAsHintedNote({
|
|
284
310
|
contractAddress: noteData.contractAddress,
|
|
285
311
|
owner: noteData.owner,
|
|
286
312
|
randomness: noteData.randomness,
|
|
287
313
|
storageSlot: noteData.storageSlot,
|
|
288
314
|
noteNonce: noteData.noteNonce,
|
|
289
|
-
|
|
315
|
+
isPending: noteData.isPending,
|
|
290
316
|
note: noteData.note,
|
|
291
317
|
}),
|
|
292
318
|
);
|
|
293
319
|
|
|
294
320
|
// Now we convert each sub-array to an array of ACVMField
|
|
295
|
-
const returnDataAsArrayOfACVMFieldArrays =
|
|
321
|
+
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedHintedNotes.map(subArray =>
|
|
296
322
|
subArray.map(toACVMField),
|
|
297
323
|
);
|
|
298
324
|
|
|
299
325
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
300
|
-
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +
|
|
326
|
+
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
301
327
|
}
|
|
302
328
|
|
|
303
|
-
|
|
329
|
+
// eslint-disable-next-line camelcase
|
|
330
|
+
aztec_prv_notifyCreatedNote(
|
|
304
331
|
[owner]: ACVMField[],
|
|
305
332
|
[storageSlot]: ACVMField[],
|
|
306
333
|
[randomness]: ACVMField[],
|
|
@@ -309,7 +336,7 @@ export class Oracle {
|
|
|
309
336
|
[noteHash]: ACVMField[],
|
|
310
337
|
[counter]: ACVMField[],
|
|
311
338
|
): Promise<ACVMField[]> {
|
|
312
|
-
this.handlerAsPrivate().
|
|
339
|
+
this.handlerAsPrivate().notifyCreatedNote(
|
|
313
340
|
AztecAddress.fromString(owner),
|
|
314
341
|
Fr.fromString(storageSlot),
|
|
315
342
|
Fr.fromString(randomness),
|
|
@@ -321,35 +348,47 @@ export class Oracle {
|
|
|
321
348
|
return Promise.resolve([]);
|
|
322
349
|
}
|
|
323
350
|
|
|
324
|
-
|
|
351
|
+
// eslint-disable-next-line camelcase
|
|
352
|
+
async aztec_prv_notifyNullifiedNote(
|
|
325
353
|
[innerNullifier]: ACVMField[],
|
|
326
354
|
[noteHash]: ACVMField[],
|
|
327
355
|
[counter]: ACVMField[],
|
|
328
356
|
): Promise<ACVMField[]> {
|
|
329
|
-
await this.handlerAsPrivate().
|
|
330
|
-
Fr.fromString(innerNullifier),
|
|
331
|
-
Fr.fromString(noteHash),
|
|
332
|
-
+counter,
|
|
333
|
-
);
|
|
357
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
334
358
|
return [];
|
|
335
359
|
}
|
|
336
360
|
|
|
337
|
-
|
|
338
|
-
|
|
361
|
+
// eslint-disable-next-line camelcase
|
|
362
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
363
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
339
364
|
return [];
|
|
340
365
|
}
|
|
341
366
|
|
|
342
|
-
|
|
343
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_prv_isNullifierPending(
|
|
369
|
+
[innerNullifier]: ACVMField[],
|
|
370
|
+
[contractAddress]: ACVMField[],
|
|
371
|
+
): Promise<ACVMField[]> {
|
|
372
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(
|
|
373
|
+
Fr.fromString(innerNullifier),
|
|
374
|
+
AztecAddress.fromString(contractAddress),
|
|
375
|
+
);
|
|
376
|
+
return [toACVMField(isPending)];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// eslint-disable-next-line camelcase
|
|
380
|
+
async aztec_utl_checkNullifierExists([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
381
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
344
382
|
return [toACVMField(exists)];
|
|
345
383
|
}
|
|
346
384
|
|
|
347
|
-
|
|
385
|
+
// eslint-disable-next-line camelcase
|
|
386
|
+
async aztec_utl_getL1ToL2MembershipWitness(
|
|
348
387
|
[contractAddress]: ACVMField[],
|
|
349
388
|
[messageHash]: ACVMField[],
|
|
350
389
|
[secret]: ACVMField[],
|
|
351
390
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
352
|
-
const message = await this.handlerAsUtility().
|
|
391
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
|
|
353
392
|
AztecAddress.fromString(contractAddress),
|
|
354
393
|
Fr.fromString(messageHash),
|
|
355
394
|
Fr.fromString(secret),
|
|
@@ -357,22 +396,24 @@ export class Oracle {
|
|
|
357
396
|
return message.toNoirRepresentation();
|
|
358
397
|
}
|
|
359
398
|
|
|
360
|
-
|
|
399
|
+
// eslint-disable-next-line camelcase
|
|
400
|
+
async aztec_utl_storageRead(
|
|
401
|
+
[blockHash]: ACVMField[],
|
|
361
402
|
[contractAddress]: ACVMField[],
|
|
362
403
|
[startStorageSlot]: ACVMField[],
|
|
363
|
-
[blockNumber]: ACVMField[],
|
|
364
404
|
[numberOfElements]: ACVMField[],
|
|
365
405
|
): Promise<ACVMField[][]> {
|
|
366
|
-
const values = await this.handlerAsUtility().
|
|
406
|
+
const values = await this.handlerAsUtility().storageRead(
|
|
407
|
+
BlockHash.fromString(blockHash),
|
|
367
408
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
368
409
|
Fr.fromString(startStorageSlot),
|
|
369
|
-
BlockNumber(+blockNumber),
|
|
370
410
|
+numberOfElements,
|
|
371
411
|
);
|
|
372
412
|
return [values.map(toACVMField)];
|
|
373
413
|
}
|
|
374
414
|
|
|
375
|
-
|
|
415
|
+
// eslint-disable-next-line camelcase
|
|
416
|
+
aztec_prv_notifyCreatedContractClassLog(
|
|
376
417
|
[contractAddress]: ACVMField[],
|
|
377
418
|
message: ACVMField[],
|
|
378
419
|
[length]: ACVMField[],
|
|
@@ -381,11 +422,12 @@ export class Oracle {
|
|
|
381
422
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
382
423
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
383
424
|
|
|
384
|
-
this.handlerAsPrivate().
|
|
425
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
385
426
|
return Promise.resolve([]);
|
|
386
427
|
}
|
|
387
428
|
|
|
388
|
-
|
|
429
|
+
// eslint-disable-next-line camelcase
|
|
430
|
+
async aztec_utl_log(
|
|
389
431
|
level: ACVMField[],
|
|
390
432
|
message: ACVMField[],
|
|
391
433
|
_ignoredFieldsSize: ACVMField[],
|
|
@@ -394,20 +436,21 @@ export class Oracle {
|
|
|
394
436
|
const levelFr = Fr.fromString(level[0]);
|
|
395
437
|
const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
396
438
|
const fieldsFr = fields.map(Fr.fromString);
|
|
397
|
-
this.handlerAsMisc().
|
|
398
|
-
return
|
|
439
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
440
|
+
return [];
|
|
399
441
|
}
|
|
400
442
|
|
|
401
443
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
402
444
|
// change the name here.
|
|
403
|
-
|
|
445
|
+
// eslint-disable-next-line camelcase
|
|
446
|
+
async aztec_prv_callPrivateFunction(
|
|
404
447
|
[contractAddress]: ACVMField[],
|
|
405
448
|
[functionSelector]: ACVMField[],
|
|
406
449
|
[argsHash]: ACVMField[],
|
|
407
450
|
[sideEffectCounter]: ACVMField[],
|
|
408
451
|
[isStaticCall]: ACVMField[],
|
|
409
452
|
): Promise<ACVMField[][]> {
|
|
410
|
-
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().
|
|
453
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
|
|
411
454
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
412
455
|
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
413
456
|
Fr.fromString(argsHash),
|
|
@@ -417,85 +460,65 @@ export class Oracle {
|
|
|
417
460
|
return [[endSideEffectCounter, returnsHash].map(toACVMField)];
|
|
418
461
|
}
|
|
419
462
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
[sideEffectCounter]: ACVMField[],
|
|
424
|
-
[isStaticCall]: ACVMField[],
|
|
425
|
-
): Promise<ACVMField[]> {
|
|
426
|
-
await this.handlerAsPrivate().privateNotifyEnqueuedPublicFunctionCall(
|
|
427
|
-
AztecAddress.fromString(contractAddress),
|
|
428
|
-
Fr.fromString(calldataHash),
|
|
429
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
430
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
431
|
-
);
|
|
432
|
-
return [];
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
async privateNotifySetPublicTeardownFunctionCall(
|
|
436
|
-
[contractAddress]: ACVMField[],
|
|
437
|
-
[calldataHash]: ACVMField[],
|
|
438
|
-
[sideEffectCounter]: ACVMField[],
|
|
439
|
-
[isStaticCall]: ACVMField[],
|
|
440
|
-
): Promise<ACVMField[]> {
|
|
441
|
-
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(
|
|
442
|
-
AztecAddress.fromString(contractAddress),
|
|
443
|
-
Fr.fromString(calldataHash),
|
|
444
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
445
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
446
|
-
);
|
|
463
|
+
// eslint-disable-next-line camelcase
|
|
464
|
+
async aztec_prv_validatePublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
465
|
+
await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
|
|
447
466
|
return [];
|
|
448
467
|
}
|
|
449
468
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
await this.handlerAsPrivate().privateNotifySetMinRevertibleSideEffectCounter(
|
|
454
|
-
Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
|
|
455
|
-
);
|
|
469
|
+
// eslint-disable-next-line camelcase
|
|
470
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
471
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
456
472
|
return Promise.resolve([]);
|
|
457
473
|
}
|
|
458
474
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
);
|
|
475
|
+
// eslint-disable-next-line camelcase
|
|
476
|
+
async aztec_prv_inRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
477
|
+
const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
|
|
463
478
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
464
479
|
}
|
|
465
480
|
|
|
466
|
-
|
|
467
|
-
|
|
481
|
+
// eslint-disable-next-line camelcase
|
|
482
|
+
async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
483
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
|
|
468
484
|
AztecAddress.fromString(sender),
|
|
469
485
|
AztecAddress.fromString(recipient),
|
|
470
486
|
);
|
|
471
487
|
return [toACVMField(tag.value)];
|
|
472
488
|
}
|
|
473
489
|
|
|
474
|
-
|
|
475
|
-
|
|
490
|
+
// eslint-disable-next-line camelcase
|
|
491
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
492
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
476
493
|
return [];
|
|
477
494
|
}
|
|
478
495
|
|
|
479
|
-
|
|
496
|
+
// eslint-disable-next-line camelcase
|
|
497
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
480
498
|
[contractAddress]: ACVMField[],
|
|
481
499
|
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
482
500
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
501
|
+
[maxNotePackedLen]: ACVMField[],
|
|
502
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
483
503
|
): Promise<ACVMField[]> {
|
|
484
|
-
await this.handlerAsUtility().
|
|
504
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
485
505
|
AztecAddress.fromString(contractAddress),
|
|
486
506
|
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
487
507
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
508
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
509
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
488
510
|
);
|
|
489
511
|
|
|
490
512
|
return [];
|
|
491
513
|
}
|
|
492
514
|
|
|
493
|
-
|
|
515
|
+
// eslint-disable-next-line camelcase
|
|
516
|
+
async aztec_utl_bulkRetrieveLogs(
|
|
494
517
|
[contractAddress]: ACVMField[],
|
|
495
518
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
496
519
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
497
520
|
): Promise<ACVMField[]> {
|
|
498
|
-
await this.handlerAsUtility().
|
|
521
|
+
await this.handlerAsUtility().bulkRetrieveLogs(
|
|
499
522
|
AztecAddress.fromString(contractAddress),
|
|
500
523
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
501
524
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
@@ -503,12 +526,13 @@ export class Oracle {
|
|
|
503
526
|
return [];
|
|
504
527
|
}
|
|
505
528
|
|
|
506
|
-
|
|
529
|
+
// eslint-disable-next-line camelcase
|
|
530
|
+
async aztec_utl_storeCapsule(
|
|
507
531
|
[contractAddress]: ACVMField[],
|
|
508
532
|
[slot]: ACVMField[],
|
|
509
533
|
capsule: ACVMField[],
|
|
510
534
|
): Promise<ACVMField[]> {
|
|
511
|
-
await this.handlerAsUtility().
|
|
535
|
+
await this.handlerAsUtility().storeCapsule(
|
|
512
536
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
513
537
|
Fr.fromString(slot),
|
|
514
538
|
capsule.map(Fr.fromString),
|
|
@@ -516,12 +540,13 @@ export class Oracle {
|
|
|
516
540
|
return [];
|
|
517
541
|
}
|
|
518
542
|
|
|
519
|
-
|
|
543
|
+
// eslint-disable-next-line camelcase
|
|
544
|
+
async aztec_utl_loadCapsule(
|
|
520
545
|
[contractAddress]: ACVMField[],
|
|
521
546
|
[slot]: ACVMField[],
|
|
522
547
|
[tSize]: ACVMField[],
|
|
523
548
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
524
|
-
const values = await this.handlerAsUtility().
|
|
549
|
+
const values = await this.handlerAsUtility().loadCapsule(
|
|
525
550
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
526
551
|
Fr.fromString(slot),
|
|
527
552
|
);
|
|
@@ -537,21 +562,23 @@ export class Oracle {
|
|
|
537
562
|
}
|
|
538
563
|
}
|
|
539
564
|
|
|
540
|
-
|
|
541
|
-
|
|
565
|
+
// eslint-disable-next-line camelcase
|
|
566
|
+
async aztec_utl_deleteCapsule([contractAddress]: ACVMField[], [slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
567
|
+
await this.handlerAsUtility().deleteCapsule(
|
|
542
568
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
543
569
|
Fr.fromString(slot),
|
|
544
570
|
);
|
|
545
571
|
return [];
|
|
546
572
|
}
|
|
547
573
|
|
|
548
|
-
|
|
574
|
+
// eslint-disable-next-line camelcase
|
|
575
|
+
async aztec_utl_copyCapsule(
|
|
549
576
|
[contractAddress]: ACVMField[],
|
|
550
577
|
[srcSlot]: ACVMField[],
|
|
551
578
|
[dstSlot]: ACVMField[],
|
|
552
579
|
[numEntries]: ACVMField[],
|
|
553
580
|
): Promise<ACVMField[]> {
|
|
554
|
-
await this.handlerAsUtility().
|
|
581
|
+
await this.handlerAsUtility().copyCapsule(
|
|
555
582
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
556
583
|
Fr.fromString(srcSlot),
|
|
557
584
|
Fr.fromString(dstSlot),
|
|
@@ -560,7 +587,8 @@ export class Oracle {
|
|
|
560
587
|
return [];
|
|
561
588
|
}
|
|
562
589
|
|
|
563
|
-
|
|
590
|
+
// eslint-disable-next-line camelcase
|
|
591
|
+
async aztec_utl_aes128Decrypt(
|
|
564
592
|
ciphertextBVecStorage: ACVMField[],
|
|
565
593
|
[ciphertextLength]: ACVMField[],
|
|
566
594
|
iv: ACVMField[],
|
|
@@ -570,36 +598,40 @@ export class Oracle {
|
|
|
570
598
|
const ivBuffer = fromUintArray(iv, 8);
|
|
571
599
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
572
600
|
|
|
573
|
-
const plaintext = await this.handlerAsUtility().
|
|
601
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
574
602
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
575
603
|
}
|
|
576
604
|
|
|
577
|
-
|
|
605
|
+
// eslint-disable-next-line camelcase
|
|
606
|
+
async aztec_utl_getSharedSecret(
|
|
578
607
|
[address]: ACVMField[],
|
|
579
608
|
[ephPKField0]: ACVMField[],
|
|
580
609
|
[ephPKField1]: ACVMField[],
|
|
581
610
|
[ephPKField2]: ACVMField[],
|
|
582
611
|
): Promise<ACVMField[]> {
|
|
583
|
-
const secret = await this.handlerAsUtility().
|
|
612
|
+
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
584
613
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
585
614
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
586
615
|
);
|
|
587
616
|
return secret.toFields().map(toACVMField);
|
|
588
617
|
}
|
|
589
618
|
|
|
590
|
-
|
|
591
|
-
|
|
619
|
+
// eslint-disable-next-line camelcase
|
|
620
|
+
async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
|
|
621
|
+
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
592
622
|
return [];
|
|
593
623
|
}
|
|
594
624
|
|
|
595
|
-
|
|
596
|
-
|
|
625
|
+
// eslint-disable-next-line camelcase
|
|
626
|
+
async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
|
|
627
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
597
628
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
598
629
|
return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
|
|
599
630
|
}
|
|
600
631
|
|
|
601
|
-
|
|
602
|
-
|
|
632
|
+
// eslint-disable-next-line camelcase
|
|
633
|
+
async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
|
|
634
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
603
635
|
return [];
|
|
604
636
|
}
|
|
605
637
|
}
|