@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
|
@@ -4,9 +4,10 @@ import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
|
4
4
|
import { arrayOfArraysToBoundedVecOfArrays, bufferToBoundedVec, fromUintArray, fromUintBoundedVec, toACVMField } from '@aztec/simulator/client';
|
|
5
5
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
7
8
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
9
|
+
import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
|
|
10
|
+
import { packAsHintedNote } from './note_packing_utils.js';
|
|
10
11
|
export class UnavailableOracleError extends Error {
|
|
11
12
|
constructor(oracleName){
|
|
12
13
|
super(`${oracleName} oracles not available with the current handler`);
|
|
@@ -48,11 +49,11 @@ export class UnavailableOracleError extends Error {
|
|
|
48
49
|
];
|
|
49
50
|
// Get all the oracle function names
|
|
50
51
|
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
51
|
-
// Validate oracle names - these must be prefixed with either "
|
|
52
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
52
53
|
// and must correspond to a function on the Oracle class.
|
|
53
54
|
oracleNames.forEach((name)=>{
|
|
54
|
-
if (!name.startsWith('
|
|
55
|
-
throw new Error(`Oracle function "${name}" must be prefixed with either "
|
|
55
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
56
|
+
throw new Error(`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`);
|
|
56
57
|
}
|
|
57
58
|
const method = this[name];
|
|
58
59
|
if (typeof method !== 'function') {
|
|
@@ -60,42 +61,53 @@ export class UnavailableOracleError extends Error {
|
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
// Build callback object and return it
|
|
63
|
-
|
|
64
|
+
const callback = oracleNames.reduce((acc, name)=>{
|
|
64
65
|
const method = this[name];
|
|
65
66
|
acc[name] = method.bind(this);
|
|
66
67
|
return acc;
|
|
67
68
|
}, {});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
return {
|
|
70
|
+
...callback,
|
|
71
|
+
...buildLegacyOracleCallbacks(this)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// eslint-disable-next-line camelcase
|
|
75
|
+
aztec_utl_assertCompatibleOracleVersion([version]) {
|
|
76
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
71
77
|
return Promise.resolve([]);
|
|
72
78
|
}
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
// eslint-disable-next-line camelcase
|
|
80
|
+
aztec_utl_getRandomField() {
|
|
81
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
75
82
|
return Promise.resolve([
|
|
76
83
|
toACVMField(val)
|
|
77
84
|
]);
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
// eslint-disable-next-line camelcase
|
|
87
|
+
aztec_prv_storeInExecutionCache(values, [hash]) {
|
|
88
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
81
89
|
return Promise.resolve([]);
|
|
82
90
|
}
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
// eslint-disable-next-line camelcase
|
|
92
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]) {
|
|
93
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
85
94
|
return [
|
|
86
95
|
values.map(toACVMField)
|
|
87
96
|
];
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
// eslint-disable-next-line camelcase
|
|
99
|
+
aztec_utl_getUtilityContext() {
|
|
100
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
91
101
|
return Promise.resolve(context.toNoirRepresentation());
|
|
92
102
|
}
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
// eslint-disable-next-line camelcase
|
|
104
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]) {
|
|
105
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
95
106
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
96
107
|
}
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
// eslint-disable-next-line camelcase
|
|
109
|
+
async aztec_utl_getContractInstance([address]) {
|
|
110
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
99
111
|
return [
|
|
100
112
|
instance.salt,
|
|
101
113
|
instance.deployer,
|
|
@@ -104,57 +116,69 @@ export class UnavailableOracleError extends Error {
|
|
|
104
116
|
...instance.publicKeys.toFields()
|
|
105
117
|
].map(toACVMField);
|
|
106
118
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const witness = await this.handlerAsUtility().
|
|
119
|
+
// eslint-disable-next-line camelcase
|
|
120
|
+
async aztec_utl_getNoteHashMembershipWitness([anchorBlockHash], [noteHash]) {
|
|
121
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
122
|
+
const parsedNoteHash = Fr.fromString(noteHash);
|
|
123
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
112
124
|
if (!witness) {
|
|
113
|
-
throw new Error(`
|
|
125
|
+
throw new Error(`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`);
|
|
114
126
|
}
|
|
115
|
-
return
|
|
116
|
-
toACVMField(witness[0]),
|
|
117
|
-
witness.slice(1).map(toACVMField)
|
|
118
|
-
];
|
|
127
|
+
return witness.toNoirRepresentation();
|
|
119
128
|
}
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
// eslint-disable-next-line camelcase
|
|
130
|
+
async aztec_utl_getBlockHashMembershipWitness([anchorBlockHash], [blockHash]) {
|
|
131
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
132
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
133
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
134
|
+
if (!witness) {
|
|
135
|
+
throw new Error(`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`);
|
|
136
|
+
}
|
|
137
|
+
return witness.toNoirRepresentation();
|
|
138
|
+
}
|
|
139
|
+
// eslint-disable-next-line camelcase
|
|
140
|
+
async aztec_utl_getNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
141
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
122
142
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
123
|
-
const witness = await this.handlerAsUtility().
|
|
143
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
124
144
|
if (!witness) {
|
|
125
|
-
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block ${
|
|
145
|
+
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
126
146
|
}
|
|
127
147
|
return witness.toNoirRepresentation();
|
|
128
148
|
}
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
// eslint-disable-next-line camelcase
|
|
150
|
+
async aztec_utl_getLowNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
151
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
131
152
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
132
|
-
const witness = await this.handlerAsUtility().
|
|
153
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
133
154
|
if (!witness) {
|
|
134
|
-
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block ${
|
|
155
|
+
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
135
156
|
}
|
|
136
157
|
return witness.toNoirRepresentation();
|
|
137
158
|
}
|
|
138
|
-
|
|
139
|
-
|
|
159
|
+
// eslint-disable-next-line camelcase
|
|
160
|
+
async aztec_utl_getPublicDataWitness([blockHash], [leafSlot]) {
|
|
161
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
140
162
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
141
|
-
const witness = await this.handlerAsUtility().
|
|
163
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
142
164
|
if (!witness) {
|
|
143
|
-
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${
|
|
165
|
+
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`);
|
|
144
166
|
}
|
|
145
167
|
return witness.toNoirRepresentation();
|
|
146
168
|
}
|
|
147
|
-
|
|
169
|
+
// eslint-disable-next-line camelcase
|
|
170
|
+
async aztec_utl_getBlockHeader([blockNumber]) {
|
|
148
171
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
149
|
-
const header = await this.handlerAsUtility().
|
|
172
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
150
173
|
if (!header) {
|
|
151
174
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
152
175
|
}
|
|
153
176
|
return header.toFields().map(toACVMField);
|
|
154
177
|
}
|
|
155
|
-
|
|
178
|
+
// eslint-disable-next-line camelcase
|
|
179
|
+
async aztec_utl_getAuthWitness([messageHash]) {
|
|
156
180
|
const messageHashField = Fr.fromString(messageHash);
|
|
157
|
-
const witness = await this.handlerAsUtility().
|
|
181
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
158
182
|
if (!witness) {
|
|
159
183
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
160
184
|
}
|
|
@@ -162,79 +186,109 @@ export class UnavailableOracleError extends Error {
|
|
|
162
186
|
witness.map(toACVMField)
|
|
163
187
|
];
|
|
164
188
|
}
|
|
165
|
-
|
|
189
|
+
// eslint-disable-next-line camelcase
|
|
190
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]) {
|
|
166
191
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
167
|
-
const
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
192
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
193
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
194
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
195
|
+
if (result === undefined) {
|
|
196
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
197
|
+
return [
|
|
198
|
+
toACVMField(0),
|
|
199
|
+
Array(13).fill(toACVMField(0))
|
|
200
|
+
];
|
|
201
|
+
} else {
|
|
202
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
203
|
+
return [
|
|
204
|
+
toACVMField(1),
|
|
205
|
+
[
|
|
206
|
+
...result.publicKeys.toFields(),
|
|
207
|
+
result.partialAddress
|
|
208
|
+
].map(toACVMField)
|
|
209
|
+
];
|
|
210
|
+
}
|
|
174
211
|
}
|
|
175
|
-
|
|
212
|
+
// eslint-disable-next-line camelcase
|
|
213
|
+
async aztec_utl_getNotes([ownerSome], [ownerValue], [storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedHintedNoteLength]) {
|
|
176
214
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
177
215
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
178
|
-
const noteDatas = await this.handlerAsUtility().
|
|
179
|
-
const
|
|
216
|
+
const noteDatas = await this.handlerAsUtility().getNotes(owner, Fr.fromString(storageSlot), +numSelects, selectByIndexes.map((s)=>+s), selectByOffsets.map((s)=>+s), selectByLengths.map((s)=>+s), selectValues.map(Fr.fromString), selectComparators.map((s)=>+s), sortByIndexes.map((s)=>+s), sortByOffsets.map((s)=>+s), sortByLengths.map((s)=>+s), sortOrder.map((s)=>+s), +limit, +offset, +status);
|
|
217
|
+
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map((noteData)=>packAsHintedNote({
|
|
180
218
|
contractAddress: noteData.contractAddress,
|
|
181
219
|
owner: noteData.owner,
|
|
182
220
|
randomness: noteData.randomness,
|
|
183
221
|
storageSlot: noteData.storageSlot,
|
|
184
222
|
noteNonce: noteData.noteNonce,
|
|
185
|
-
|
|
223
|
+
isPending: noteData.isPending,
|
|
186
224
|
note: noteData.note
|
|
187
225
|
}));
|
|
188
226
|
// Now we convert each sub-array to an array of ACVMField
|
|
189
|
-
const returnDataAsArrayOfACVMFieldArrays =
|
|
227
|
+
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedHintedNotes.map((subArray)=>subArray.map(toACVMField));
|
|
190
228
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
191
|
-
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +
|
|
229
|
+
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
192
230
|
}
|
|
193
|
-
|
|
194
|
-
|
|
231
|
+
// eslint-disable-next-line camelcase
|
|
232
|
+
aztec_prv_notifyCreatedNote([owner], [storageSlot], [randomness], [noteTypeId], note, [noteHash], [counter]) {
|
|
233
|
+
this.handlerAsPrivate().notifyCreatedNote(AztecAddress.fromString(owner), Fr.fromString(storageSlot), Fr.fromString(randomness), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
195
234
|
return Promise.resolve([]);
|
|
196
235
|
}
|
|
197
|
-
|
|
198
|
-
|
|
236
|
+
// eslint-disable-next-line camelcase
|
|
237
|
+
async aztec_prv_notifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
238
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
199
239
|
return [];
|
|
200
240
|
}
|
|
201
|
-
|
|
202
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]) {
|
|
243
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
203
244
|
return [];
|
|
204
245
|
}
|
|
205
|
-
|
|
206
|
-
|
|
246
|
+
// eslint-disable-next-line camelcase
|
|
247
|
+
async aztec_prv_isNullifierPending([innerNullifier], [contractAddress]) {
|
|
248
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(Fr.fromString(innerNullifier), AztecAddress.fromString(contractAddress));
|
|
249
|
+
return [
|
|
250
|
+
toACVMField(isPending)
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
// eslint-disable-next-line camelcase
|
|
254
|
+
async aztec_utl_checkNullifierExists([innerNullifier]) {
|
|
255
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
207
256
|
return [
|
|
208
257
|
toACVMField(exists)
|
|
209
258
|
];
|
|
210
259
|
}
|
|
211
|
-
|
|
212
|
-
|
|
260
|
+
// eslint-disable-next-line camelcase
|
|
261
|
+
async aztec_utl_getL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
262
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
213
263
|
return message.toNoirRepresentation();
|
|
214
264
|
}
|
|
215
|
-
|
|
216
|
-
|
|
265
|
+
// eslint-disable-next-line camelcase
|
|
266
|
+
async aztec_utl_storageRead([blockHash], [contractAddress], [startStorageSlot], [numberOfElements]) {
|
|
267
|
+
const values = await this.handlerAsUtility().storageRead(BlockHash.fromString(blockHash), new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +numberOfElements);
|
|
217
268
|
return [
|
|
218
269
|
values.map(toACVMField)
|
|
219
270
|
];
|
|
220
271
|
}
|
|
221
|
-
|
|
272
|
+
// eslint-disable-next-line camelcase
|
|
273
|
+
aztec_prv_notifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
222
274
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
223
275
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
224
|
-
this.handlerAsPrivate().
|
|
276
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
225
277
|
return Promise.resolve([]);
|
|
226
278
|
}
|
|
227
|
-
|
|
279
|
+
// eslint-disable-next-line camelcase
|
|
280
|
+
async aztec_utl_log(level, message, _ignoredFieldsSize, fields) {
|
|
228
281
|
const levelFr = Fr.fromString(level[0]);
|
|
229
282
|
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
230
283
|
const fieldsFr = fields.map(Fr.fromString);
|
|
231
|
-
this.handlerAsMisc().
|
|
232
|
-
return
|
|
284
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
285
|
+
return [];
|
|
233
286
|
}
|
|
234
287
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
235
288
|
// change the name here.
|
|
236
|
-
|
|
237
|
-
|
|
289
|
+
// eslint-disable-next-line camelcase
|
|
290
|
+
async aztec_prv_callPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
291
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
238
292
|
return [
|
|
239
293
|
[
|
|
240
294
|
endSideEffectCounter,
|
|
@@ -242,48 +296,58 @@ export class UnavailableOracleError extends Error {
|
|
|
242
296
|
].map(toACVMField)
|
|
243
297
|
];
|
|
244
298
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
async privateNotifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
250
|
-
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
299
|
+
// eslint-disable-next-line camelcase
|
|
300
|
+
async aztec_prv_validatePublicCalldata([calldataHash]) {
|
|
301
|
+
await this.handlerAsPrivate().validatePublicCalldata(Fr.fromString(calldataHash));
|
|
251
302
|
return [];
|
|
252
303
|
}
|
|
253
|
-
|
|
254
|
-
|
|
304
|
+
// eslint-disable-next-line camelcase
|
|
305
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]) {
|
|
306
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
255
307
|
return Promise.resolve([]);
|
|
256
308
|
}
|
|
257
|
-
|
|
258
|
-
|
|
309
|
+
// eslint-disable-next-line camelcase
|
|
310
|
+
async aztec_prv_inRevertiblePhase([sideEffectCounter]) {
|
|
311
|
+
const isRevertible = await this.handlerAsPrivate().inRevertiblePhase(Fr.fromString(sideEffectCounter).toNumber());
|
|
259
312
|
return Promise.resolve([
|
|
260
313
|
toACVMField(isRevertible)
|
|
261
314
|
]);
|
|
262
315
|
}
|
|
263
|
-
|
|
264
|
-
|
|
316
|
+
// eslint-disable-next-line camelcase
|
|
317
|
+
async aztec_prv_getNextAppTagAsSender([sender], [recipient]) {
|
|
318
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
265
319
|
return [
|
|
266
320
|
toACVMField(tag.value)
|
|
267
321
|
];
|
|
268
322
|
}
|
|
269
|
-
|
|
270
|
-
|
|
323
|
+
// eslint-disable-next-line camelcase
|
|
324
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
325
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
271
326
|
return [];
|
|
272
327
|
}
|
|
273
|
-
|
|
274
|
-
|
|
328
|
+
// eslint-disable-next-line camelcase
|
|
329
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot], [maxNotePackedLen], [maxEventSerializedLen]) {
|
|
330
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot), Fr.fromString(maxNotePackedLen).toNumber(), Fr.fromString(maxEventSerializedLen).toNumber());
|
|
275
331
|
return [];
|
|
276
332
|
}
|
|
277
|
-
|
|
278
|
-
|
|
333
|
+
// eslint-disable-next-line camelcase
|
|
334
|
+
async aztec_utl_bulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
335
|
+
await this.handlerAsUtility().bulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
279
336
|
return [];
|
|
280
337
|
}
|
|
281
|
-
|
|
282
|
-
|
|
338
|
+
// eslint-disable-next-line camelcase
|
|
339
|
+
async aztec_utl_utilityResolveMessageContexts([contractAddress], [messageContextRequestsArrayBaseSlot], [messageContextResponsesArrayBaseSlot]) {
|
|
340
|
+
await this.handlerAsUtility().utilityResolveMessageContexts(AztecAddress.fromString(contractAddress), Fr.fromString(messageContextRequestsArrayBaseSlot), Fr.fromString(messageContextResponsesArrayBaseSlot));
|
|
283
341
|
return [];
|
|
284
342
|
}
|
|
285
|
-
|
|
286
|
-
|
|
343
|
+
// eslint-disable-next-line camelcase
|
|
344
|
+
async aztec_utl_storeCapsule([contractAddress], [slot], capsule) {
|
|
345
|
+
await this.handlerAsUtility().storeCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
346
|
+
return [];
|
|
347
|
+
}
|
|
348
|
+
// eslint-disable-next-line camelcase
|
|
349
|
+
async aztec_utl_loadCapsule([contractAddress], [slot], [tSize]) {
|
|
350
|
+
const values = await this.handlerAsUtility().loadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
287
351
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
288
352
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
289
353
|
if (values === null) {
|
|
@@ -300,35 +364,62 @@ export class UnavailableOracleError extends Error {
|
|
|
300
364
|
];
|
|
301
365
|
}
|
|
302
366
|
}
|
|
303
|
-
|
|
304
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_utl_deleteCapsule([contractAddress], [slot]) {
|
|
369
|
+
await this.handlerAsUtility().deleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
305
370
|
return [];
|
|
306
371
|
}
|
|
307
|
-
|
|
308
|
-
|
|
372
|
+
// eslint-disable-next-line camelcase
|
|
373
|
+
async aztec_utl_copyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
374
|
+
await this.handlerAsUtility().copyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
309
375
|
return [];
|
|
310
376
|
}
|
|
311
|
-
|
|
377
|
+
// eslint-disable-next-line camelcase
|
|
378
|
+
async aztec_utl_tryAes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
312
379
|
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
313
380
|
const ivBuffer = fromUintArray(iv, 8);
|
|
314
381
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
315
|
-
|
|
316
|
-
|
|
382
|
+
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
383
|
+
try {
|
|
384
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
385
|
+
const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
386
|
+
return [
|
|
387
|
+
toACVMField(1),
|
|
388
|
+
storage,
|
|
389
|
+
length
|
|
390
|
+
];
|
|
391
|
+
} catch {
|
|
392
|
+
const zeroStorage = Array(ciphertextBVecStorage.length).fill(toACVMField(0));
|
|
393
|
+
return [
|
|
394
|
+
toACVMField(0),
|
|
395
|
+
zeroStorage,
|
|
396
|
+
toACVMField(0)
|
|
397
|
+
];
|
|
398
|
+
}
|
|
317
399
|
}
|
|
318
|
-
|
|
319
|
-
|
|
400
|
+
// eslint-disable-next-line camelcase
|
|
401
|
+
async aztec_utl_getSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
402
|
+
const secret = await this.handlerAsUtility().getSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
320
403
|
ephPKField0,
|
|
321
404
|
ephPKField1,
|
|
322
405
|
ephPKField2
|
|
323
406
|
].map(Fr.fromString)));
|
|
324
407
|
return secret.toFields().map(toACVMField);
|
|
325
408
|
}
|
|
326
|
-
|
|
327
|
-
|
|
409
|
+
// eslint-disable-next-line camelcase
|
|
410
|
+
aztec_utl_invalidateContractSyncCache([contractAddress], scopes, [scopeCount]) {
|
|
411
|
+
const scopeAddresses = scopes.slice(0, +scopeCount).map((s)=>AztecAddress.fromField(Fr.fromString(s)));
|
|
412
|
+
this.handlerAsUtility().invalidateContractSyncCache(AztecAddress.fromField(Fr.fromString(contractAddress)), scopeAddresses);
|
|
413
|
+
return Promise.resolve([]);
|
|
414
|
+
}
|
|
415
|
+
// eslint-disable-next-line camelcase
|
|
416
|
+
async aztec_utl_emitOffchainEffect(data) {
|
|
417
|
+
await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
|
|
328
418
|
return [];
|
|
329
419
|
}
|
|
330
|
-
|
|
331
|
-
|
|
420
|
+
// eslint-disable-next-line camelcase
|
|
421
|
+
async aztec_prv_getSenderForTags() {
|
|
422
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
332
423
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
333
424
|
return sender ? [
|
|
334
425
|
toACVMField(1n),
|
|
@@ -338,8 +429,9 @@ export class UnavailableOracleError extends Error {
|
|
|
338
429
|
toACVMField(0n)
|
|
339
430
|
];
|
|
340
431
|
}
|
|
341
|
-
|
|
342
|
-
|
|
432
|
+
// eslint-disable-next-line camelcase
|
|
433
|
+
async aztec_prv_setSenderForTags([senderForTags]) {
|
|
434
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
343
435
|
return [];
|
|
344
436
|
}
|
|
345
437
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
1
|
import { type ACVMWitness, type CircuitSimulator } from '@aztec/simulator/client';
|
|
4
2
|
import { type FunctionArtifact, type FunctionArtifactWithContractName, type FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { ContractInstance } from '@aztec/stdlib/contract';
|
|
7
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
8
4
|
import { PrivateCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
9
|
-
import {
|
|
10
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
11
|
-
import { ContractStore } from '../../storage/contract_store/index.js';
|
|
5
|
+
import { PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
12
6
|
import type { PrivateExecutionOracle } from './private_execution_oracle.js';
|
|
13
7
|
/**
|
|
14
8
|
* Execute a private function and return the execution result.
|
|
@@ -26,22 +20,4 @@ export declare function executePrivateFunction(simulator: CircuitSimulator, priv
|
|
|
26
20
|
* @returns - The public inputs.
|
|
27
21
|
*/
|
|
28
22
|
export declare function extractPrivateCircuitPublicInputs(artifact: FunctionArtifact, partialWitness: ACVMWitness): PrivateCircuitPublicInputs;
|
|
29
|
-
|
|
30
|
-
* Read the current class id of a contract from the execution data provider or AztecNode. If not found, class id
|
|
31
|
-
* from the instance is used.
|
|
32
|
-
* @param contractAddress - The address of the contract to read the class id for.
|
|
33
|
-
* @param instance - The instance of the contract.
|
|
34
|
-
* @param executionStore - The execution data provider.
|
|
35
|
-
* @param blockNumber - The block number at which to load the DelayedPublicMutable storing the class id.
|
|
36
|
-
* @param timestamp - The timestamp at which to obtain the class id from the DelayedPublicMutable.
|
|
37
|
-
* @returns The current class id.
|
|
38
|
-
*/
|
|
39
|
-
export declare function readCurrentClassId(contractAddress: AztecAddress, instance: ContractInstance, aztecNode: AztecNode, blockNumber: BlockNumber, timestamp: UInt64): Promise<Fr>;
|
|
40
|
-
/**
|
|
41
|
-
* Verify that the current class id of a contract obtained from AztecNode is the same as the one in contract data
|
|
42
|
-
* provider (i.e. PXE's own storage).
|
|
43
|
-
* @param header - The header of the block at which to verify the current class id. If not provided, the anchor block
|
|
44
|
-
* header of the execution data provider is used.
|
|
45
|
-
*/
|
|
46
|
-
export declare function verifyCurrentClassId(contractAddress: AztecAddress, aztecNode: AztecNode, contractStore: ContractStore, header: BlockHeader): Promise<void>;
|
|
47
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9leGVjdXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3Ivb3JhY2xlL3ByaXZhdGVfZXhlY3V0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFJcEQsT0FBTyxFQUNMLEtBQUssV0FBVyxFQUNoQixLQUFLLGdCQUFnQixFQUt0QixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQUNyQixLQUFLLGdDQUFnQyxFQUNyQyxLQUFLLGdCQUFnQixFQUV0QixNQUFNLG1CQUFtQixDQUFDO0FBQzNCLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDakUsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFFbEUsT0FBTyxFQUFFLFdBQVcsRUFBRSwwQkFBMEIsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQzNFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWxELE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx1Q0FBdUMsQ0FBQztBQUV0RSxPQUFPLEtBQUssRUFBRSxzQkFBc0IsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRTVFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0Isc0JBQXNCLENBQzFDLFNBQVMsRUFBRSxnQkFBZ0IsRUFDM0Isc0JBQXNCLEVBQUUsc0JBQXNCLEVBQzlDLFFBQVEsRUFBRSxnQ0FBZ0MsRUFDMUMsZUFBZSxFQUFFLFlBQVksRUFDN0IsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ2xDLEdBQUcseUNBQThDLEdBQ2hELE9BQU8sQ0FBQywwQkFBMEIsQ0FBQyxDQTJFckM7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFnQixpQ0FBaUMsQ0FDL0MsUUFBUSxFQUFFLGdCQUFnQixFQUMxQixjQUFjLEVBQUUsV0FBVyxHQUMxQiwwQkFBMEIsQ0FhNUI7QUFFRDs7Ozs7Ozs7O0dBU0c7QUFDSCx3QkFBc0Isa0JBQWtCLENBQ3RDLGVBQWUsRUFBRSxZQUFZLEVBQzdCLFFBQVEsRUFBRSxnQkFBZ0IsRUFDMUIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsV0FBVyxFQUFFLFdBQVcsRUFDeEIsU0FBUyxFQUFFLE1BQU0sZUFXbEI7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFzQixvQkFBb0IsQ0FDeEMsZUFBZSxFQUFFLFlBQVksRUFDN0IsU0FBUyxFQUFFLFNBQVMsRUFDcEIsYUFBYSxFQUFFLGFBQWEsRUFDNUIsTUFBTSxFQUFFLFdBQVcsaUJBbUJwQiJ9
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9leGVjdXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb250cmFjdF9mdW5jdGlvbl9zaW11bGF0b3Ivb3JhY2xlL3ByaXZhdGVfZXhlY3V0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sRUFDTCxLQUFLLFdBQVcsRUFDaEIsS0FBSyxnQkFBZ0IsRUFLdEIsTUFBTSx5QkFBeUIsQ0FBQztBQUNqQyxPQUFPLEVBQ0wsS0FBSyxnQkFBZ0IsRUFDckIsS0FBSyxnQ0FBZ0MsRUFDckMsS0FBSyxnQkFBZ0IsRUFFdEIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUVsRSxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUc5RCxPQUFPLEtBQUssRUFBRSxzQkFBc0IsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRTVFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0Isc0JBQXNCLENBQzFDLFNBQVMsRUFBRSxnQkFBZ0IsRUFDM0Isc0JBQXNCLEVBQUUsc0JBQXNCLEVBQzlDLFFBQVEsRUFBRSxnQ0FBZ0MsRUFDMUMsZUFBZSxFQUFFLFlBQVksRUFDN0IsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQ2xDLEdBQUcseUNBQThDLEdBQ2hELE9BQU8sQ0FBQywwQkFBMEIsQ0FBQyxDQTJFckM7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFnQixpQ0FBaUMsQ0FDL0MsUUFBUSxFQUFFLGdCQUFnQixFQUMxQixjQUFjLEVBQUUsV0FBVyxHQUMxQiwwQkFBMEIsQ0FhNUIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private_execution.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAKtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gCAAgC,EACrC,KAAK,gBAAgB,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,gBAAgB,EAC3B,sBAAsB,EAAE,sBAAsB,EAC9C,QAAQ,EAAE,gCAAgC,EAC1C,eAAe,EAAE,YAAY,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,yCAA8C,GAChD,OAAO,CAAC,0BAA0B,CAAC,CA2ErC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,gBAAgB,EAC1B,cAAc,EAAE,WAAW,GAC1B,0BAA0B,CAa5B"}
|