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