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