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