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