@aztec/pxe 0.0.1-commit.29c6b1a3 → 0.0.1-commit.2c0ee1788
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/bin/check_oracle_version.js +4 -4
- package/dest/block_synchronizer/block_stream_source.d.ts +10 -0
- package/dest/block_synchronizer/block_stream_source.d.ts.map +1 -0
- package/dest/block_synchronizer/block_stream_source.js +37 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +10 -4
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +38 -12
- package/dest/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +8 -15
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +63 -31
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +207 -77
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- 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 +2 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +4 -6
- 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 +8 -10
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +2 -2
- 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 +2 -4
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +4 -7
- 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 +6 -11
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +63 -45
- 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 +47 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +76 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +312 -108
- package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +58 -85
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +123 -97
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +134 -70
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +379 -143
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +3 -0
- package/dest/contract_logging.d.ts +27 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +38 -0
- package/dest/contract_sync/contract_sync_service.d.ts +44 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +116 -0
- package/dest/contract_sync/helpers.d.ts +28 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/{index.js → helpers.js} +19 -13
- package/dest/debug/pxe_debug_utils.d.ts +14 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -15
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +23 -9
- package/dest/entrypoints/client/lazy/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +3 -3
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +24 -10
- package/dest/entrypoints/pxe_creation_options.d.ts +5 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +4 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -2
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +30 -11
- package/dest/events/event_service.d.ts +5 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +30 -10
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- 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 +10 -9
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +41 -61
- 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 +7 -8
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +23 -14
- package/dest/notes_filter.d.ts +24 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- 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 +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- 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 +20 -15
- package/dest/private_kernel/private_kernel_oracle.d.ts +10 -6
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +19 -18
- package/dest/pxe.d.ts +85 -24
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +169 -86
- 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 +9 -2
- package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
- package/dest/storage/capsule_store/capsule_service.js +50 -0
- package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +42 -36
- package/dest/storage/capsule_store/index.d.ts +2 -1
- package/dest/storage/capsule_store/index.d.ts.map +1 -1
- package/dest/storage/capsule_store/index.js +1 -0
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +160 -73
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +13 -3
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +147 -107
- package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +87 -61
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +31 -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 +29 -28
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +233 -137
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/index.d.ts +3 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -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 +8 -22
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -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 +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -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 +13 -7
- 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 +20 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -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 +36 -24
- package/package.json +25 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/block_synchronizer/block_stream_source.ts +52 -0
- package/src/block_synchronizer/block_synchronizer.ts +53 -22
- package/src/config/index.ts +3 -9
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +367 -136
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
- package/src/contract_function_simulator/index.ts +1 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +9 -9
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +2 -5
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +4 -10
- package/src/contract_function_simulator/oracle/interfaces.ts +97 -59
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +104 -0
- package/src/contract_function_simulator/oracle/oracle.ts +399 -144
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +155 -190
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +623 -172
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
- package/src/contract_logging.ts +52 -0
- package/src/contract_sync/contract_sync_service.ts +176 -0
- package/src/contract_sync/{index.ts → helpers.ts} +22 -22
- package/src/debug/pxe_debug_utils.ts +48 -18
- package/src/entrypoints/client/bundle/index.ts +2 -0
- package/src/entrypoints/client/bundle/utils.ts +18 -18
- package/src/entrypoints/client/lazy/index.ts +2 -0
- package/src/entrypoints/client/lazy/utils.ts +19 -18
- package/src/entrypoints/pxe_creation_options.ts +9 -1
- package/src/entrypoints/server/index.ts +3 -2
- package/src/entrypoints/server/utils.ts +24 -29
- package/src/events/event_service.ts +34 -11
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +77 -105
- package/src/messages/message_context_service.ts +44 -0
- package/src/notes/note_service.ts +24 -15
- package/src/notes_filter.ts +24 -0
- package/src/oracle_version.ts +20 -10
- 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 +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +24 -19
- package/src/private_kernel/private_kernel_oracle.ts +21 -21
- package/src/pxe.ts +318 -143
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +9 -1
- package/src/storage/capsule_store/capsule_service.ts +90 -0
- package/src/storage/capsule_store/capsule_store.ts +52 -34
- package/src/storage/capsule_store/index.ts +1 -0
- package/src/storage/contract_store/contract_store.ts +193 -81
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +166 -132
- package/src/storage/private_event_store/private_event_store.ts +106 -81
- package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +287 -156
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +2 -2
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +12 -25
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +23 -10
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +27 -26
- package/dest/contract_sync/index.d.ts +0 -23
- package/dest/contract_sync/index.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
|
@@ -15,7 +15,9 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
15
15
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
16
16
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
17
17
|
|
|
18
|
+
import { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
18
19
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
20
|
+
import { buildLegacyOracleCallbacks } from './legacy_oracle_mappings.js';
|
|
19
21
|
import { packAsHintedNote } from './note_packing_utils.js';
|
|
20
22
|
|
|
21
23
|
export class UnavailableOracleError extends Error {
|
|
@@ -26,6 +28,25 @@ export class UnavailableOracleError extends Error {
|
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* A data source that has all the apis required by Aztec.nr.
|
|
31
|
+
*
|
|
32
|
+
* ## Oracle naming conventions
|
|
33
|
+
*
|
|
34
|
+
* We try to keep oracle naming consistent, please see below the conventions we adhere to.
|
|
35
|
+
*
|
|
36
|
+
* Each oracle method name has the form `aztec_{scope}_{verb}{Object}`, where:
|
|
37
|
+
*
|
|
38
|
+
* - **Scope prefix** indicates the execution context required:
|
|
39
|
+
* - `aztec_prv_` — available only during private function execution.
|
|
40
|
+
* - `aztec_utl_` — available during both utility and private execution.
|
|
41
|
+
*
|
|
42
|
+
* - **Verb** signals the operation's semantics (verb-first, then object):
|
|
43
|
+
* - `get` — read / lookup / get data from oracle into contract.
|
|
44
|
+
* - `does`/`is`/`has` — predicate (returns boolean).
|
|
45
|
+
* - `emit`/`notify` — propagate data from contract to oracle.
|
|
46
|
+
* - `set` — contract driven oracle state mutation (capsules, execution cache, tagging, etc).
|
|
47
|
+
* - `call` — trigger nested execution (control flow).
|
|
48
|
+
* - `assert` — validate a condition, throw on failure.
|
|
49
|
+
* - Standalone verbs (`delete`, `copy`, `decrypt`, `log`, etc) are used when no generic verb fits.
|
|
29
50
|
*/
|
|
30
51
|
export class Oracle {
|
|
31
52
|
constructor(private handler: IMiscOracle | IUtilityExecutionOracle | IPrivateExecutionOracle) {}
|
|
@@ -69,12 +90,12 @@ export class Oracle {
|
|
|
69
90
|
name => !excludedProps.includes(name as (typeof excludedProps)[number]),
|
|
70
91
|
);
|
|
71
92
|
|
|
72
|
-
// Validate oracle names - these must be prefixed with either "
|
|
93
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
73
94
|
// and must correspond to a function on the Oracle class.
|
|
74
95
|
oracleNames.forEach(name => {
|
|
75
|
-
if (!name.startsWith('
|
|
96
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
76
97
|
throw new Error(
|
|
77
|
-
`Oracle function "${name}" must be prefixed with either "
|
|
98
|
+
`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`,
|
|
78
99
|
);
|
|
79
100
|
}
|
|
80
101
|
|
|
@@ -85,48 +106,110 @@ export class Oracle {
|
|
|
85
106
|
});
|
|
86
107
|
|
|
87
108
|
// Build callback object and return it
|
|
88
|
-
|
|
109
|
+
const callback = oracleNames.reduce((acc, name) => {
|
|
89
110
|
const method = this[name as keyof Omit<Oracle, (typeof excludedProps)[number]>];
|
|
90
111
|
acc[name] = method.bind(this);
|
|
91
112
|
return acc;
|
|
92
113
|
}, {} as ACIRCallback);
|
|
114
|
+
|
|
115
|
+
const allCallbacks = { ...callback, ...buildLegacyOracleCallbacks(this) };
|
|
116
|
+
|
|
117
|
+
// Wrap in a Proxy to intercept access to missing oracle names and provide enhanced error messages when the
|
|
118
|
+
// contract's minor version is higher than the PXE's (i.e. the contract expects oracles that were added in a newer
|
|
119
|
+
// minor version).
|
|
120
|
+
const handler = this.handler;
|
|
121
|
+
return new Proxy(allCallbacks, {
|
|
122
|
+
get(target, prop: string) {
|
|
123
|
+
if (prop in target) {
|
|
124
|
+
return target[prop];
|
|
125
|
+
}
|
|
126
|
+
// Return a function that throws with an enhanced error message if applicable
|
|
127
|
+
return () => {
|
|
128
|
+
type NonOracleFunctionGetContractOracleVersion = {
|
|
129
|
+
nonOracleFunctionGetContractOracleVersion(): { major: number; minor: number } | undefined;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let contractVersion = undefined;
|
|
133
|
+
if ('nonOracleFunctionGetContractOracleVersion' in handler) {
|
|
134
|
+
contractVersion = (
|
|
135
|
+
handler as unknown as NonOracleFunctionGetContractOracleVersion
|
|
136
|
+
).nonOracleFunctionGetContractOracleVersion();
|
|
137
|
+
}
|
|
138
|
+
if (!contractVersion) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Oracle '${prop}' not found and the contract's oracle version is unknown (the version check oracle ` +
|
|
141
|
+
`was not called before '${prop}'). This usually means the contract was not compiled with the ` +
|
|
142
|
+
`#[aztec] macro, which injects the version check as the first oracle call in every private/utility ` +
|
|
143
|
+
`external function. If you're using a custom entry point, ensure assert_compatible_oracle_version() ` +
|
|
144
|
+
`is called before any other oracle calls. See https://docs.aztec.network/errors/8`,
|
|
145
|
+
);
|
|
146
|
+
} else if (contractVersion.minor > ORACLE_VERSION_MINOR) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Oracle '${prop}' not found.` +
|
|
149
|
+
` This usually means the contract requires a newer private execution environment than you have.` +
|
|
150
|
+
` Upgrade your private execution environment to a compatible version. The contract was compiled with` +
|
|
151
|
+
` Aztec.nr oracle version ${contractVersion.major}.${contractVersion.minor}, but this private` +
|
|
152
|
+
` execution environment only supports up to ${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}.` +
|
|
153
|
+
` See https://docs.aztec.network/errors/8`,
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
throw new Error(
|
|
157
|
+
`Oracle '${prop}' not found.` +
|
|
158
|
+
` The contract's oracle version (${contractVersion.major}.${contractVersion.minor}) is compatible` +
|
|
159
|
+
` with this private execution environment (${ORACLE_VERSION_MAJOR}.${ORACLE_VERSION_MINOR}), so all` +
|
|
160
|
+
` standard oracles should be available. This could mean the contract was compiled against a modified` +
|
|
161
|
+
` version of Aztec.nr, or that it references an oracle that does not exist.` +
|
|
162
|
+
` See https://docs.aztec.network/errors/8`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
});
|
|
93
168
|
}
|
|
94
169
|
|
|
95
|
-
|
|
96
|
-
|
|
170
|
+
// eslint-disable-next-line camelcase
|
|
171
|
+
aztec_utl_assertCompatibleOracleVersionV2([major]: ACVMField[], [minor]: ACVMField[]) {
|
|
172
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(
|
|
173
|
+
Fr.fromString(major).toNumber(),
|
|
174
|
+
Fr.fromString(minor).toNumber(),
|
|
175
|
+
);
|
|
97
176
|
return Promise.resolve([]);
|
|
98
177
|
}
|
|
99
178
|
|
|
100
|
-
|
|
101
|
-
|
|
179
|
+
// eslint-disable-next-line camelcase
|
|
180
|
+
aztec_utl_getRandomField(): Promise<ACVMField[]> {
|
|
181
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
102
182
|
return Promise.resolve([toACVMField(val)]);
|
|
103
183
|
}
|
|
104
184
|
|
|
105
|
-
|
|
106
|
-
|
|
185
|
+
// eslint-disable-next-line camelcase
|
|
186
|
+
aztec_prv_setHashPreimage(values: ACVMField[], [hash]: ACVMField[]): Promise<ACVMField[]> {
|
|
187
|
+
this.handlerAsPrivate().setHashPreimage(values.map(Fr.fromString), Fr.fromString(hash));
|
|
107
188
|
return Promise.resolve([]);
|
|
108
189
|
}
|
|
109
190
|
|
|
110
|
-
|
|
111
|
-
|
|
191
|
+
// eslint-disable-next-line camelcase
|
|
192
|
+
async aztec_prv_getHashPreimage([returnsHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
193
|
+
const values = await this.handlerAsPrivate().getHashPreimage(Fr.fromString(returnsHash));
|
|
112
194
|
return [values.map(toACVMField)];
|
|
113
195
|
}
|
|
114
196
|
|
|
115
|
-
|
|
116
|
-
|
|
197
|
+
// eslint-disable-next-line camelcase
|
|
198
|
+
aztec_utl_getUtilityContext(): Promise<(ACVMField | ACVMField[])[]> {
|
|
199
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
117
200
|
return Promise.resolve(context.toNoirRepresentation());
|
|
118
201
|
}
|
|
119
202
|
|
|
120
|
-
|
|
121
|
-
|
|
203
|
+
// eslint-disable-next-line camelcase
|
|
204
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
205
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
122
206
|
|
|
123
207
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
124
208
|
}
|
|
125
209
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
);
|
|
210
|
+
// eslint-disable-next-line camelcase
|
|
211
|
+
async aztec_utl_getContractInstance([address]: ACVMField[]): Promise<ACVMField[]> {
|
|
212
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
130
213
|
|
|
131
214
|
return [
|
|
132
215
|
instance.salt,
|
|
@@ -137,45 +220,49 @@ export class Oracle {
|
|
|
137
220
|
].map(toACVMField);
|
|
138
221
|
}
|
|
139
222
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[
|
|
223
|
+
// eslint-disable-next-line camelcase
|
|
224
|
+
async aztec_utl_getNoteHashMembershipWitness(
|
|
225
|
+
[anchorBlockHash]: ACVMField[],
|
|
226
|
+
[noteHash]: ACVMField[],
|
|
143
227
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
144
|
-
const
|
|
145
|
-
const
|
|
228
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
229
|
+
const parsedNoteHash = Fr.fromString(noteHash);
|
|
146
230
|
|
|
147
|
-
const witness = await this.handlerAsUtility().
|
|
231
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
148
232
|
if (!witness) {
|
|
149
|
-
throw new Error(
|
|
233
|
+
throw new Error(
|
|
234
|
+
`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`,
|
|
235
|
+
);
|
|
150
236
|
}
|
|
151
237
|
return witness.toNoirRepresentation();
|
|
152
238
|
}
|
|
153
239
|
|
|
154
|
-
|
|
240
|
+
// eslint-disable-next-line camelcase
|
|
241
|
+
async aztec_utl_getBlockHashMembershipWitness(
|
|
242
|
+
[anchorBlockHash]: ACVMField[],
|
|
155
243
|
[blockHash]: ACVMField[],
|
|
156
|
-
[leafValue]: ACVMField[],
|
|
157
244
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
245
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
158
246
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
159
|
-
const parsedLeafValue = Fr.fromString(leafValue);
|
|
160
247
|
|
|
161
|
-
const witness = await this.handlerAsUtility().
|
|
248
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
162
249
|
if (!witness) {
|
|
163
|
-
throw new Error(
|
|
250
|
+
throw new Error(
|
|
251
|
+
`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`,
|
|
252
|
+
);
|
|
164
253
|
}
|
|
165
254
|
return witness.toNoirRepresentation();
|
|
166
255
|
}
|
|
167
256
|
|
|
168
|
-
|
|
257
|
+
// eslint-disable-next-line camelcase
|
|
258
|
+
async aztec_utl_getNullifierMembershipWitness(
|
|
169
259
|
[blockHash]: ACVMField[],
|
|
170
260
|
[nullifier]: ACVMField[], // nullifier, we try to find the witness for (to prove inclusion)
|
|
171
261
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
172
262
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
173
263
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
174
264
|
|
|
175
|
-
const witness = await this.handlerAsUtility().
|
|
176
|
-
parsedBlockHash,
|
|
177
|
-
parsedNullifier,
|
|
178
|
-
);
|
|
265
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
179
266
|
if (!witness) {
|
|
180
267
|
throw new Error(
|
|
181
268
|
`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -184,17 +271,15 @@ export class Oracle {
|
|
|
184
271
|
return witness.toNoirRepresentation();
|
|
185
272
|
}
|
|
186
273
|
|
|
187
|
-
|
|
274
|
+
// eslint-disable-next-line camelcase
|
|
275
|
+
async aztec_utl_getLowNullifierMembershipWitness(
|
|
188
276
|
[blockHash]: ACVMField[],
|
|
189
277
|
[nullifier]: ACVMField[], // nullifier, we try to find the low nullifier witness for (to prove non-inclusion)
|
|
190
278
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
191
279
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
192
280
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
193
281
|
|
|
194
|
-
const witness = await this.handlerAsUtility().
|
|
195
|
-
parsedBlockHash,
|
|
196
|
-
parsedNullifier,
|
|
197
|
-
);
|
|
282
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
198
283
|
if (!witness) {
|
|
199
284
|
throw new Error(
|
|
200
285
|
`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -203,14 +288,15 @@ export class Oracle {
|
|
|
203
288
|
return witness.toNoirRepresentation();
|
|
204
289
|
}
|
|
205
290
|
|
|
206
|
-
|
|
291
|
+
// eslint-disable-next-line camelcase
|
|
292
|
+
async aztec_utl_getPublicDataWitness(
|
|
207
293
|
[blockHash]: ACVMField[],
|
|
208
294
|
[leafSlot]: ACVMField[],
|
|
209
295
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
210
296
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
211
297
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
212
298
|
|
|
213
|
-
const witness = await this.handlerAsUtility().
|
|
299
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
214
300
|
if (!witness) {
|
|
215
301
|
throw new Error(
|
|
216
302
|
`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`,
|
|
@@ -219,34 +305,45 @@ export class Oracle {
|
|
|
219
305
|
return witness.toNoirRepresentation();
|
|
220
306
|
}
|
|
221
307
|
|
|
222
|
-
|
|
308
|
+
// eslint-disable-next-line camelcase
|
|
309
|
+
async aztec_utl_getBlockHeader([blockNumber]: ACVMField[]): Promise<ACVMField[]> {
|
|
223
310
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
224
311
|
|
|
225
|
-
const header = await this.handlerAsUtility().
|
|
312
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
226
313
|
if (!header) {
|
|
227
314
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
228
315
|
}
|
|
229
316
|
return header.toFields().map(toACVMField);
|
|
230
317
|
}
|
|
231
318
|
|
|
232
|
-
|
|
319
|
+
// eslint-disable-next-line camelcase
|
|
320
|
+
async aztec_utl_getAuthWitness([messageHash]: ACVMField[]): Promise<ACVMField[][]> {
|
|
233
321
|
const messageHashField = Fr.fromString(messageHash);
|
|
234
|
-
const witness = await this.handlerAsUtility().
|
|
322
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
235
323
|
if (!witness) {
|
|
236
324
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
237
325
|
}
|
|
238
326
|
return [witness.map(toACVMField)];
|
|
239
327
|
}
|
|
240
328
|
|
|
241
|
-
|
|
329
|
+
// eslint-disable-next-line camelcase
|
|
330
|
+
async aztec_utl_getPublicKeysAndPartialAddress([address]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
242
331
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
243
|
-
const
|
|
244
|
-
await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(parsedAddress);
|
|
332
|
+
const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(parsedAddress);
|
|
245
333
|
|
|
246
|
-
return
|
|
334
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
335
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
336
|
+
if (result === undefined) {
|
|
337
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
338
|
+
return [toACVMField(0), Array(13).fill(toACVMField(0))];
|
|
339
|
+
} else {
|
|
340
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
341
|
+
return [toACVMField(1), [...result.publicKeys.toFields(), result.partialAddress].map(toACVMField)];
|
|
342
|
+
}
|
|
247
343
|
}
|
|
248
344
|
|
|
249
|
-
|
|
345
|
+
// eslint-disable-next-line camelcase
|
|
346
|
+
async aztec_utl_getNotes(
|
|
250
347
|
[ownerSome]: ACVMField[],
|
|
251
348
|
[ownerValue]: ACVMField[],
|
|
252
349
|
[storageSlot]: ACVMField[],
|
|
@@ -268,7 +365,7 @@ export class Oracle {
|
|
|
268
365
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
269
366
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
270
367
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
271
|
-
const noteDatas = await this.handlerAsUtility().
|
|
368
|
+
const noteDatas = await this.handlerAsUtility().getNotes(
|
|
272
369
|
owner,
|
|
273
370
|
Fr.fromString(storageSlot),
|
|
274
371
|
+numSelects,
|
|
@@ -307,7 +404,8 @@ export class Oracle {
|
|
|
307
404
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
308
405
|
}
|
|
309
406
|
|
|
310
|
-
|
|
407
|
+
// eslint-disable-next-line camelcase
|
|
408
|
+
aztec_prv_notifyCreatedNote(
|
|
311
409
|
[owner]: ACVMField[],
|
|
312
410
|
[storageSlot]: ACVMField[],
|
|
313
411
|
[randomness]: ACVMField[],
|
|
@@ -316,7 +414,7 @@ export class Oracle {
|
|
|
316
414
|
[noteHash]: ACVMField[],
|
|
317
415
|
[counter]: ACVMField[],
|
|
318
416
|
): Promise<ACVMField[]> {
|
|
319
|
-
this.handlerAsPrivate().
|
|
417
|
+
this.handlerAsPrivate().notifyCreatedNote(
|
|
320
418
|
AztecAddress.fromString(owner),
|
|
321
419
|
Fr.fromString(storageSlot),
|
|
322
420
|
Fr.fromString(randomness),
|
|
@@ -328,43 +426,47 @@ export class Oracle {
|
|
|
328
426
|
return Promise.resolve([]);
|
|
329
427
|
}
|
|
330
428
|
|
|
331
|
-
|
|
429
|
+
// eslint-disable-next-line camelcase
|
|
430
|
+
async aztec_prv_notifyNullifiedNote(
|
|
332
431
|
[innerNullifier]: ACVMField[],
|
|
333
432
|
[noteHash]: ACVMField[],
|
|
334
433
|
[counter]: ACVMField[],
|
|
335
434
|
): Promise<ACVMField[]> {
|
|
336
|
-
await this.handlerAsPrivate().
|
|
337
|
-
Fr.fromString(innerNullifier),
|
|
338
|
-
Fr.fromString(noteHash),
|
|
339
|
-
+counter,
|
|
340
|
-
);
|
|
435
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
341
436
|
return [];
|
|
342
437
|
}
|
|
343
438
|
|
|
344
|
-
|
|
345
|
-
|
|
439
|
+
// eslint-disable-next-line camelcase
|
|
440
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
441
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
346
442
|
return [];
|
|
347
443
|
}
|
|
348
444
|
|
|
349
|
-
|
|
350
|
-
|
|
445
|
+
// eslint-disable-next-line camelcase
|
|
446
|
+
async aztec_prv_isNullifierPending(
|
|
447
|
+
[innerNullifier]: ACVMField[],
|
|
448
|
+
[contractAddress]: ACVMField[],
|
|
449
|
+
): Promise<ACVMField[]> {
|
|
450
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(
|
|
351
451
|
Fr.fromString(innerNullifier),
|
|
352
452
|
AztecAddress.fromString(contractAddress),
|
|
353
453
|
);
|
|
354
454
|
return [toACVMField(isPending)];
|
|
355
455
|
}
|
|
356
456
|
|
|
357
|
-
|
|
358
|
-
|
|
457
|
+
// eslint-disable-next-line camelcase
|
|
458
|
+
async aztec_utl_doesNullifierExist([innerNullifier]: ACVMField[]): Promise<ACVMField[]> {
|
|
459
|
+
const exists = await this.handlerAsUtility().doesNullifierExist(Fr.fromString(innerNullifier));
|
|
359
460
|
return [toACVMField(exists)];
|
|
360
461
|
}
|
|
361
462
|
|
|
362
|
-
|
|
463
|
+
// eslint-disable-next-line camelcase
|
|
464
|
+
async aztec_utl_getL1ToL2MembershipWitness(
|
|
363
465
|
[contractAddress]: ACVMField[],
|
|
364
466
|
[messageHash]: ACVMField[],
|
|
365
467
|
[secret]: ACVMField[],
|
|
366
468
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
367
|
-
const message = await this.handlerAsUtility().
|
|
469
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(
|
|
368
470
|
AztecAddress.fromString(contractAddress),
|
|
369
471
|
Fr.fromString(messageHash),
|
|
370
472
|
Fr.fromString(secret),
|
|
@@ -372,13 +474,14 @@ export class Oracle {
|
|
|
372
474
|
return message.toNoirRepresentation();
|
|
373
475
|
}
|
|
374
476
|
|
|
375
|
-
|
|
477
|
+
// eslint-disable-next-line camelcase
|
|
478
|
+
async aztec_utl_getFromPublicStorage(
|
|
376
479
|
[blockHash]: ACVMField[],
|
|
377
480
|
[contractAddress]: ACVMField[],
|
|
378
481
|
[startStorageSlot]: ACVMField[],
|
|
379
482
|
[numberOfElements]: ACVMField[],
|
|
380
483
|
): Promise<ACVMField[][]> {
|
|
381
|
-
const values = await this.handlerAsUtility().
|
|
484
|
+
const values = await this.handlerAsUtility().getFromPublicStorage(
|
|
382
485
|
BlockHash.fromString(blockHash),
|
|
383
486
|
new AztecAddress(Fr.fromString(contractAddress)),
|
|
384
487
|
Fr.fromString(startStorageSlot),
|
|
@@ -387,7 +490,22 @@ export class Oracle {
|
|
|
387
490
|
return [values.map(toACVMField)];
|
|
388
491
|
}
|
|
389
492
|
|
|
390
|
-
|
|
493
|
+
// eslint-disable-next-line camelcase
|
|
494
|
+
async aztec_utl_callUtilityFunction(
|
|
495
|
+
[contractAddress]: ACVMField[],
|
|
496
|
+
[functionSelector]: ACVMField[],
|
|
497
|
+
args: ACVMField[],
|
|
498
|
+
): Promise<ACVMField[][]> {
|
|
499
|
+
const result = await this.handlerAsUtility().callUtilityFunction(
|
|
500
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
501
|
+
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
502
|
+
args.map(Fr.fromString),
|
|
503
|
+
);
|
|
504
|
+
return [result.map(toACVMField)];
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// eslint-disable-next-line camelcase
|
|
508
|
+
aztec_prv_notifyCreatedContractClassLog(
|
|
391
509
|
[contractAddress]: ACVMField[],
|
|
392
510
|
message: ACVMField[],
|
|
393
511
|
[length]: ACVMField[],
|
|
@@ -396,11 +514,12 @@ export class Oracle {
|
|
|
396
514
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
397
515
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
398
516
|
|
|
399
|
-
this.handlerAsPrivate().
|
|
517
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
400
518
|
return Promise.resolve([]);
|
|
401
519
|
}
|
|
402
520
|
|
|
403
|
-
|
|
521
|
+
// eslint-disable-next-line camelcase
|
|
522
|
+
async aztec_utl_log(
|
|
404
523
|
level: ACVMField[],
|
|
405
524
|
message: ACVMField[],
|
|
406
525
|
_ignoredFieldsSize: ACVMField[],
|
|
@@ -409,20 +528,21 @@ export class Oracle {
|
|
|
409
528
|
const levelFr = Fr.fromString(level[0]);
|
|
410
529
|
const messageStr = message.map(acvmField => String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
411
530
|
const fieldsFr = fields.map(Fr.fromString);
|
|
412
|
-
this.handlerAsMisc().
|
|
413
|
-
return
|
|
531
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
532
|
+
return [];
|
|
414
533
|
}
|
|
415
534
|
|
|
416
535
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
417
536
|
// change the name here.
|
|
418
|
-
|
|
537
|
+
// eslint-disable-next-line camelcase
|
|
538
|
+
async aztec_prv_callPrivateFunction(
|
|
419
539
|
[contractAddress]: ACVMField[],
|
|
420
540
|
[functionSelector]: ACVMField[],
|
|
421
541
|
[argsHash]: ACVMField[],
|
|
422
542
|
[sideEffectCounter]: ACVMField[],
|
|
423
543
|
[isStaticCall]: ACVMField[],
|
|
424
544
|
): Promise<ACVMField[][]> {
|
|
425
|
-
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().
|
|
545
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(
|
|
426
546
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
427
547
|
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
428
548
|
Fr.fromString(argsHash),
|
|
@@ -432,113 +552,165 @@ export class Oracle {
|
|
|
432
552
|
return [[endSideEffectCounter, returnsHash].map(toACVMField)];
|
|
433
553
|
}
|
|
434
554
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
[sideEffectCounter]: ACVMField[],
|
|
439
|
-
[isStaticCall]: ACVMField[],
|
|
440
|
-
): Promise<ACVMField[]> {
|
|
441
|
-
await this.handlerAsPrivate().privateNotifyEnqueuedPublicFunctionCall(
|
|
442
|
-
AztecAddress.fromString(contractAddress),
|
|
443
|
-
Fr.fromString(calldataHash),
|
|
444
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
445
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
446
|
-
);
|
|
555
|
+
// eslint-disable-next-line camelcase
|
|
556
|
+
async aztec_prv_assertValidPublicCalldata([calldataHash]: ACVMField[]): Promise<ACVMField[]> {
|
|
557
|
+
await this.handlerAsPrivate().assertValidPublicCalldata(Fr.fromString(calldataHash));
|
|
447
558
|
return [];
|
|
448
559
|
}
|
|
449
560
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
[sideEffectCounter]: ACVMField[],
|
|
454
|
-
[isStaticCall]: ACVMField[],
|
|
455
|
-
): Promise<ACVMField[]> {
|
|
456
|
-
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(
|
|
457
|
-
AztecAddress.fromString(contractAddress),
|
|
458
|
-
Fr.fromString(calldataHash),
|
|
459
|
-
Fr.fromString(sideEffectCounter).toNumber(),
|
|
460
|
-
Fr.fromString(isStaticCall).toBool(),
|
|
461
|
-
);
|
|
462
|
-
return [];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
async privateNotifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]: ACVMField[]): Promise<
|
|
466
|
-
ACVMField[]
|
|
467
|
-
> {
|
|
468
|
-
await this.handlerAsPrivate().privateNotifySetMinRevertibleSideEffectCounter(
|
|
469
|
-
Fr.fromString(minRevertibleSideEffectCounter).toNumber(),
|
|
470
|
-
);
|
|
561
|
+
// eslint-disable-next-line camelcase
|
|
562
|
+
async aztec_prv_notifyRevertiblePhaseStart([minRevertibleSideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
563
|
+
await this.handlerAsPrivate().notifyRevertiblePhaseStart(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
471
564
|
return Promise.resolve([]);
|
|
472
565
|
}
|
|
473
566
|
|
|
474
|
-
|
|
475
|
-
|
|
567
|
+
// eslint-disable-next-line camelcase
|
|
568
|
+
async aztec_prv_isExecutionInRevertiblePhase([sideEffectCounter]: ACVMField[]): Promise<ACVMField[]> {
|
|
569
|
+
const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(
|
|
476
570
|
Fr.fromString(sideEffectCounter).toNumber(),
|
|
477
571
|
);
|
|
478
572
|
return Promise.resolve([toACVMField(isRevertible)]);
|
|
479
573
|
}
|
|
480
574
|
|
|
481
|
-
|
|
482
|
-
|
|
575
|
+
// eslint-disable-next-line camelcase
|
|
576
|
+
async aztec_prv_getNextAppTagAsSender([sender]: ACVMField[], [recipient]: ACVMField[]): Promise<ACVMField[]> {
|
|
577
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(
|
|
483
578
|
AztecAddress.fromString(sender),
|
|
484
579
|
AztecAddress.fromString(recipient),
|
|
485
580
|
);
|
|
486
581
|
return [toACVMField(tag.value)];
|
|
487
582
|
}
|
|
488
583
|
|
|
489
|
-
|
|
490
|
-
|
|
584
|
+
// eslint-disable-next-line camelcase
|
|
585
|
+
async aztec_utl_getPendingTaggedLogs(
|
|
586
|
+
[pendingTaggedLogArrayBaseSlot]: ACVMField[],
|
|
587
|
+
[scope]: ACVMField[],
|
|
588
|
+
): Promise<ACVMField[]> {
|
|
589
|
+
await this.handlerAsUtility().getPendingTaggedLogs(
|
|
590
|
+
Fr.fromString(pendingTaggedLogArrayBaseSlot),
|
|
591
|
+
AztecAddress.fromString(scope),
|
|
592
|
+
);
|
|
491
593
|
return [];
|
|
492
594
|
}
|
|
493
595
|
|
|
494
|
-
|
|
596
|
+
// eslint-disable-next-line camelcase
|
|
597
|
+
async aztec_utl_getPendingTaggedLogs_v2([scope]: ACVMField[]): Promise<ACVMField[]> {
|
|
598
|
+
const slot = await this.handlerAsUtility().getPendingTaggedLogsV2(AztecAddress.fromString(scope));
|
|
599
|
+
return [toACVMField(slot)];
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// eslint-disable-next-line camelcase
|
|
603
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents(
|
|
495
604
|
[contractAddress]: ACVMField[],
|
|
496
605
|
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
497
606
|
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
607
|
+
[maxNotePackedLen]: ACVMField[],
|
|
608
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
609
|
+
[scope]: ACVMField[],
|
|
498
610
|
): Promise<ACVMField[]> {
|
|
499
|
-
await this.handlerAsUtility().
|
|
611
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
500
612
|
AztecAddress.fromString(contractAddress),
|
|
501
613
|
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
502
614
|
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
615
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
616
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
617
|
+
AztecAddress.fromString(scope),
|
|
503
618
|
);
|
|
504
619
|
|
|
505
620
|
return [];
|
|
506
621
|
}
|
|
507
622
|
|
|
508
|
-
|
|
623
|
+
// eslint-disable-next-line camelcase
|
|
624
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2(
|
|
625
|
+
[noteValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
626
|
+
[eventValidationRequestsArrayBaseSlot]: ACVMField[],
|
|
627
|
+
[maxNotePackedLen]: ACVMField[],
|
|
628
|
+
[maxEventSerializedLen]: ACVMField[],
|
|
629
|
+
[scope]: ACVMField[],
|
|
630
|
+
): Promise<ACVMField[]> {
|
|
631
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEventsV2(
|
|
632
|
+
Fr.fromString(noteValidationRequestsArrayBaseSlot),
|
|
633
|
+
Fr.fromString(eventValidationRequestsArrayBaseSlot),
|
|
634
|
+
Fr.fromString(maxNotePackedLen).toNumber(),
|
|
635
|
+
Fr.fromString(maxEventSerializedLen).toNumber(),
|
|
636
|
+
AztecAddress.fromString(scope),
|
|
637
|
+
);
|
|
638
|
+
return [];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// eslint-disable-next-line camelcase
|
|
642
|
+
async aztec_utl_getLogsByTag(
|
|
509
643
|
[contractAddress]: ACVMField[],
|
|
510
644
|
[logRetrievalRequestsArrayBaseSlot]: ACVMField[],
|
|
511
645
|
[logRetrievalResponsesArrayBaseSlot]: ACVMField[],
|
|
646
|
+
[scope]: ACVMField[],
|
|
512
647
|
): Promise<ACVMField[]> {
|
|
513
|
-
await this.handlerAsUtility().
|
|
648
|
+
await this.handlerAsUtility().getLogsByTag(
|
|
514
649
|
AztecAddress.fromString(contractAddress),
|
|
515
650
|
Fr.fromString(logRetrievalRequestsArrayBaseSlot),
|
|
516
651
|
Fr.fromString(logRetrievalResponsesArrayBaseSlot),
|
|
652
|
+
AztecAddress.fromString(scope),
|
|
653
|
+
);
|
|
654
|
+
return [];
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// eslint-disable-next-line camelcase
|
|
658
|
+
async aztec_utl_getMessageContextsByTxHash(
|
|
659
|
+
[contractAddress]: ACVMField[],
|
|
660
|
+
[messageContextRequestsArrayBaseSlot]: ACVMField[],
|
|
661
|
+
[messageContextResponsesArrayBaseSlot]: ACVMField[],
|
|
662
|
+
[scope]: ACVMField[],
|
|
663
|
+
): Promise<ACVMField[]> {
|
|
664
|
+
await this.handlerAsUtility().getMessageContextsByTxHash(
|
|
665
|
+
AztecAddress.fromString(contractAddress),
|
|
666
|
+
Fr.fromString(messageContextRequestsArrayBaseSlot),
|
|
667
|
+
Fr.fromString(messageContextResponsesArrayBaseSlot),
|
|
668
|
+
AztecAddress.fromString(scope),
|
|
517
669
|
);
|
|
518
670
|
return [];
|
|
519
671
|
}
|
|
520
672
|
|
|
521
|
-
|
|
673
|
+
// eslint-disable-next-line camelcase
|
|
674
|
+
async aztec_utl_getLogsByTag_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
675
|
+
const responseSlot = await this.handlerAsUtility().getLogsByTagV2(Fr.fromString(requestArrayBaseSlot));
|
|
676
|
+
return [toACVMField(responseSlot)];
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// eslint-disable-next-line camelcase
|
|
680
|
+
async aztec_utl_getMessageContextsByTxHash_v2([requestArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
681
|
+
const responseSlot = await this.handlerAsUtility().getMessageContextsByTxHashV2(
|
|
682
|
+
Fr.fromString(requestArrayBaseSlot),
|
|
683
|
+
);
|
|
684
|
+
return [toACVMField(responseSlot)];
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// eslint-disable-next-line camelcase
|
|
688
|
+
aztec_utl_setCapsule(
|
|
522
689
|
[contractAddress]: ACVMField[],
|
|
523
690
|
[slot]: ACVMField[],
|
|
524
691
|
capsule: ACVMField[],
|
|
692
|
+
[scope]: ACVMField[],
|
|
525
693
|
): Promise<ACVMField[]> {
|
|
526
|
-
|
|
694
|
+
this.handlerAsUtility().setCapsule(
|
|
527
695
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
528
696
|
Fr.fromString(slot),
|
|
529
697
|
capsule.map(Fr.fromString),
|
|
698
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
530
699
|
);
|
|
531
|
-
return [];
|
|
700
|
+
return Promise.resolve([]);
|
|
532
701
|
}
|
|
533
702
|
|
|
534
|
-
|
|
703
|
+
// eslint-disable-next-line camelcase
|
|
704
|
+
async aztec_utl_getCapsule(
|
|
535
705
|
[contractAddress]: ACVMField[],
|
|
536
706
|
[slot]: ACVMField[],
|
|
537
707
|
[tSize]: ACVMField[],
|
|
708
|
+
[scope]: ACVMField[],
|
|
538
709
|
): Promise<(ACVMField | ACVMField[])[]> {
|
|
539
|
-
const values = await this.handlerAsUtility().
|
|
710
|
+
const values = await this.handlerAsUtility().getCapsule(
|
|
540
711
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
541
712
|
Fr.fromString(slot),
|
|
713
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
542
714
|
);
|
|
543
715
|
|
|
544
716
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
@@ -552,30 +724,86 @@ export class Oracle {
|
|
|
552
724
|
}
|
|
553
725
|
}
|
|
554
726
|
|
|
555
|
-
|
|
556
|
-
|
|
727
|
+
// eslint-disable-next-line camelcase
|
|
728
|
+
aztec_utl_deleteCapsule(
|
|
729
|
+
[contractAddress]: ACVMField[],
|
|
730
|
+
[slot]: ACVMField[],
|
|
731
|
+
[scope]: ACVMField[],
|
|
732
|
+
): Promise<ACVMField[]> {
|
|
733
|
+
this.handlerAsUtility().deleteCapsule(
|
|
557
734
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
558
735
|
Fr.fromString(slot),
|
|
736
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
559
737
|
);
|
|
560
|
-
return [];
|
|
738
|
+
return Promise.resolve([]);
|
|
561
739
|
}
|
|
562
740
|
|
|
563
|
-
|
|
741
|
+
// eslint-disable-next-line camelcase
|
|
742
|
+
async aztec_utl_copyCapsule(
|
|
564
743
|
[contractAddress]: ACVMField[],
|
|
565
744
|
[srcSlot]: ACVMField[],
|
|
566
745
|
[dstSlot]: ACVMField[],
|
|
567
746
|
[numEntries]: ACVMField[],
|
|
747
|
+
[scope]: ACVMField[],
|
|
568
748
|
): Promise<ACVMField[]> {
|
|
569
|
-
await this.handlerAsUtility().
|
|
749
|
+
await this.handlerAsUtility().copyCapsule(
|
|
570
750
|
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
571
751
|
Fr.fromString(srcSlot),
|
|
572
752
|
Fr.fromString(dstSlot),
|
|
573
753
|
Fr.fromString(numEntries).toNumber(),
|
|
754
|
+
AztecAddress.fromField(Fr.fromString(scope)),
|
|
574
755
|
);
|
|
575
756
|
return [];
|
|
576
757
|
}
|
|
577
758
|
|
|
578
|
-
|
|
759
|
+
// eslint-disable-next-line camelcase
|
|
760
|
+
aztec_utl_pushEphemeral([slot]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
761
|
+
const newLen = this.handlerAsUtility().pushEphemeral(Fr.fromString(slot), elements.map(Fr.fromString));
|
|
762
|
+
return Promise.resolve([toACVMField(newLen)]);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// eslint-disable-next-line camelcase
|
|
766
|
+
aztec_utl_popEphemeral([slot]: ACVMField[]): Promise<ACVMField[][]> {
|
|
767
|
+
const element = this.handlerAsUtility().popEphemeral(Fr.fromString(slot));
|
|
768
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// eslint-disable-next-line camelcase
|
|
772
|
+
aztec_utl_getEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[][]> {
|
|
773
|
+
const element = this.handlerAsUtility().getEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
774
|
+
return Promise.resolve([element.map(toACVMField)]);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// eslint-disable-next-line camelcase
|
|
778
|
+
aztec_utl_setEphemeral([slot]: ACVMField[], [index]: ACVMField[], elements: ACVMField[]): Promise<ACVMField[]> {
|
|
779
|
+
this.handlerAsUtility().setEphemeral(
|
|
780
|
+
Fr.fromString(slot),
|
|
781
|
+
Fr.fromString(index).toNumber(),
|
|
782
|
+
elements.map(Fr.fromString),
|
|
783
|
+
);
|
|
784
|
+
return Promise.resolve([]);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// eslint-disable-next-line camelcase
|
|
788
|
+
aztec_utl_getEphemeralLen([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
789
|
+
const len = this.handlerAsUtility().getEphemeralLen(Fr.fromString(slot));
|
|
790
|
+
return Promise.resolve([toACVMField(len)]);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// eslint-disable-next-line camelcase
|
|
794
|
+
aztec_utl_removeEphemeral([slot]: ACVMField[], [index]: ACVMField[]): Promise<ACVMField[]> {
|
|
795
|
+
this.handlerAsUtility().removeEphemeral(Fr.fromString(slot), Fr.fromString(index).toNumber());
|
|
796
|
+
return Promise.resolve([]);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// eslint-disable-next-line camelcase
|
|
800
|
+
aztec_utl_clearEphemeral([slot]: ACVMField[]): Promise<ACVMField[]> {
|
|
801
|
+
this.handlerAsUtility().clearEphemeral(Fr.fromString(slot));
|
|
802
|
+
return Promise.resolve([]);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// eslint-disable-next-line camelcase
|
|
806
|
+
async aztec_utl_decryptAes128(
|
|
579
807
|
ciphertextBVecStorage: ACVMField[],
|
|
580
808
|
[ciphertextLength]: ACVMField[],
|
|
581
809
|
iv: ACVMField[],
|
|
@@ -585,36 +813,63 @@ export class Oracle {
|
|
|
585
813
|
const ivBuffer = fromUintArray(iv, 8);
|
|
586
814
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
587
815
|
|
|
588
|
-
|
|
589
|
-
|
|
816
|
+
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
817
|
+
try {
|
|
818
|
+
const plaintext = await this.handlerAsUtility().decryptAes128(ciphertext, ivBuffer, symKeyBuffer);
|
|
819
|
+
const [storage, length] = bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
820
|
+
return [toACVMField(1), storage, length];
|
|
821
|
+
} catch {
|
|
822
|
+
const zeroStorage = Array(ciphertextBVecStorage.length).fill(toACVMField(0));
|
|
823
|
+
return [toACVMField(0), zeroStorage, toACVMField(0)];
|
|
824
|
+
}
|
|
590
825
|
}
|
|
591
826
|
|
|
592
|
-
|
|
827
|
+
// eslint-disable-next-line camelcase
|
|
828
|
+
async aztec_utl_getSharedSecret(
|
|
593
829
|
[address]: ACVMField[],
|
|
594
830
|
[ephPKField0]: ACVMField[],
|
|
595
831
|
[ephPKField1]: ACVMField[],
|
|
596
832
|
[ephPKField2]: ACVMField[],
|
|
833
|
+
[contractAddress]: ACVMField[],
|
|
597
834
|
): Promise<ACVMField[]> {
|
|
598
|
-
const secret = await this.handlerAsUtility().
|
|
835
|
+
const secret = await this.handlerAsUtility().getSharedSecret(
|
|
599
836
|
AztecAddress.fromField(Fr.fromString(address)),
|
|
600
837
|
Point.fromFields([ephPKField0, ephPKField1, ephPKField2].map(Fr.fromString)),
|
|
838
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
601
839
|
);
|
|
602
|
-
return secret
|
|
840
|
+
return [toACVMField(secret)];
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// eslint-disable-next-line camelcase
|
|
844
|
+
aztec_utl_setContractSyncCacheInvalid(
|
|
845
|
+
[contractAddress]: ACVMField[],
|
|
846
|
+
scopes: ACVMField[],
|
|
847
|
+
[scopeCount]: ACVMField[],
|
|
848
|
+
): Promise<ACVMField[]> {
|
|
849
|
+
const scopeAddresses = scopes.slice(0, +scopeCount).map(s => AztecAddress.fromField(Fr.fromString(s)));
|
|
850
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(
|
|
851
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
852
|
+
scopeAddresses,
|
|
853
|
+
);
|
|
854
|
+
return Promise.resolve([]);
|
|
603
855
|
}
|
|
604
856
|
|
|
605
|
-
|
|
606
|
-
|
|
857
|
+
// eslint-disable-next-line camelcase
|
|
858
|
+
async aztec_utl_emitOffchainEffect(data: ACVMField[]) {
|
|
859
|
+
await this.handlerAsUtility().emitOffchainEffect(data.map(Fr.fromString));
|
|
607
860
|
return [];
|
|
608
861
|
}
|
|
609
862
|
|
|
610
|
-
|
|
611
|
-
|
|
863
|
+
// eslint-disable-next-line camelcase
|
|
864
|
+
async aztec_prv_getSenderForTags(): Promise<ACVMField[]> {
|
|
865
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
612
866
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
613
867
|
return sender ? [toACVMField(1n), toACVMField(sender)] : [toACVMField(0n), toACVMField(0n)];
|
|
614
868
|
}
|
|
615
869
|
|
|
616
|
-
|
|
617
|
-
|
|
870
|
+
// eslint-disable-next-line camelcase
|
|
871
|
+
async aztec_prv_setSenderForTags([senderForTags]: ACVMField[]): Promise<ACVMField[]> {
|
|
872
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
618
873
|
return [];
|
|
619
874
|
}
|
|
620
875
|
}
|