@aztec/txe 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/AuthRegistry-QVGDDH5X.js +3 -0
- package/dest/AuthRegistry-QVGDDH5X.js.map +7 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js +3 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js.map +7 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js +3 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js.map +7 -0
- package/dest/FeeJuice-MAQJU53K.js +3 -0
- package/dest/FeeJuice-MAQJU53K.js.map +7 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js +3 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js.map +7 -0
- package/dest/SchnorrAccount-ADD65DYA.js +3 -0
- package/dest/SchnorrAccount-ADD65DYA.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js +3 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.js +9 -19
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_test_server.d.ts +3 -0
- package/dest/bin/oracle_test_server.d.ts.map +1 -0
- package/dest/bin/oracle_test_server.js +41 -0
- package/dest/chunk-32UHX7YY.js +3 -0
- package/dest/{chunk-DF6RMOC6.js → chunk-RVEPNDEP.js} +2 -2
- package/dest/{chunk-DF6RMOC6.js.map → chunk-RVEPNDEP.js.map} +3 -3
- package/dest/chunk-XWIMXLKD.js +258 -0
- package/dest/chunk-XWIMXLKD.js.map +7 -0
- package/dest/constants.d.ts +3 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +5 -2
- package/dest/dispatcher_pool.d.ts +2 -2
- package/dest/dispatcher_pool.d.ts.map +1 -1
- package/dest/dispatcher_pool.js +5 -3
- package/dest/index.d.ts +6 -143
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +12 -169
- package/dest/metafile.json +10267 -9581
- package/dest/oracle/interfaces.d.ts +38 -11
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
- package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
- package/dest/oracle/tagging_secret_strategy.js +12 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts +16 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/default_fixtures.js +200 -0
- package/dest/oracle/test-resolver/index.d.ts +9 -0
- package/dest/oracle/test-resolver/index.d.ts.map +1 -0
- package/dest/oracle/test-resolver/index.js +32 -0
- package/dest/oracle/test-resolver/resolver.d.ts +48 -0
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
- package/dest/oracle/test-resolver/resolver.js +181 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +25 -6
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +34 -1
- package/dest/oracle/txe_oracle_registry.d.ts +172 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +767 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +39 -14
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +489 -289
- package/dest/{txe_oracle_version.d.ts → oracle/txe_oracle_version.d.ts} +5 -5
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/{txe_oracle_version.js → oracle/txe_oracle_version.js} +4 -4
- package/dest/rpc_translator.d.ts +116 -284
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +809 -860
- package/dest/server.bundle.js +1 -1
- package/dest/state_machine/archiver.d.ts +3 -2
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +9 -3
- package/dest/state_machine/dummy_p2p_client.d.ts +5 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +9 -0
- package/dest/state_machine/global_variable_builder.d.ts +3 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +0 -3
- package/dest/state_machine/index.d.ts +8 -6
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +41 -19
- package/dest/state_machine/mock_epoch_cache.d.ts +2 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +3 -6
- package/dest/state_machine/synchronizer.d.ts +10 -2
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +18 -5
- package/dest/txe_session.d.ts +43 -28
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +183 -47
- package/dest/utils/block_creation.d.ts +2 -2
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +2 -2
- package/dest/utils/encoding.d.ts +8 -5
- package/dest/utils/encoding.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.d.ts +1 -1
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +0 -1
- package/dest/utils/txe_artifact_resolver.d.ts +37 -0
- package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
- package/dest/utils/txe_artifact_resolver.js +161 -0
- package/dest/utils/txe_public_contract_data_source.d.ts +1 -1
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/utils/txe_public_contract_data_source.js +7 -4
- package/dest/worker.bundle.js +1 -1
- package/package.json +18 -17
- package/src/bin/check_txe_oracle_version.ts +11 -17
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +6 -2
- package/src/dispatcher_pool.ts +4 -3
- package/src/index.ts +21 -198
- package/src/oracle/interfaces.ts +35 -9
- package/src/oracle/tagging_secret_strategy.ts +25 -0
- package/src/oracle/test-resolver/default_fixtures.ts +271 -0
- package/src/oracle/test-resolver/index.ts +44 -0
- package/src/oracle/test-resolver/resolver.ts +245 -0
- package/src/oracle/txe_oracle_public_context.ts +36 -4
- package/src/oracle/txe_oracle_registry.ts +556 -0
- package/src/oracle/txe_oracle_top_level_context.ts +249 -66
- package/src/{txe_oracle_version.ts → oracle/txe_oracle_version.ts} +4 -4
- package/src/rpc_translator.ts +850 -1065
- package/src/state_machine/archiver.ts +9 -3
- package/src/state_machine/dummy_p2p_client.ts +13 -0
- package/src/state_machine/global_variable_builder.ts +2 -16
- package/src/state_machine/index.ts +50 -34
- package/src/state_machine/mock_epoch_cache.ts +4 -8
- package/src/state_machine/synchronizer.ts +26 -5
- package/src/txe_session.ts +325 -56
- package/src/utils/block_creation.ts +2 -1
- package/src/utils/tx_effect_creation.ts +0 -2
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/utils/txe_public_contract_data_source.ts +6 -4
- package/dest/ContractClassRegistry-KKNT527R.js +0 -3
- package/dest/ContractClassRegistry-KKNT527R.js.map +0 -7
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js +0 -3
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js.map +0 -7
- package/dest/FeeJuice-GUJ5O6GB.js +0 -3
- package/dest/FeeJuice-GUJ5O6GB.js.map +0 -7
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js +0 -3
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js.map +0 -7
- package/dest/SchnorrAccount-QIXE5DXA.js +0 -3
- package/dest/SchnorrAccount-QIXE5DXA.js.map +0 -7
- package/dest/chunk-BJVAAXNA.js +0 -3
- package/dest/chunk-PPJTNNUG.js +0 -265
- package/dest/chunk-PPJTNNUG.js.map +0 -7
- package/dest/txe_oracle_version.d.ts.map +0 -1
- /package/dest/{chunk-BJVAAXNA.js.map → chunk-32UHX7YY.js.map} +0 -0
package/src/rpc_translator.ts
CHANGED
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ARCHIVE_HEIGHT,
|
|
5
|
-
MAX_NOTE_HASHES_PER_TX,
|
|
6
|
-
MAX_NULLIFIERS_PER_TX,
|
|
7
|
-
MAX_PRIVATE_LOGS_PER_TX,
|
|
8
|
-
PRIVATE_LOG_SIZE_IN_FIELDS,
|
|
9
|
-
} from '@aztec/constants';
|
|
10
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
11
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
12
|
-
import {
|
|
13
|
-
BoundedVec,
|
|
14
|
-
type IMiscOracle,
|
|
15
|
-
type IPrivateExecutionOracle,
|
|
16
|
-
type IUtilityExecutionOracle,
|
|
17
|
-
Option,
|
|
18
|
-
packAsHintedNote,
|
|
19
|
-
} from '@aztec/pxe/simulator';
|
|
20
|
-
import { type ContractArtifact, EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
21
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
22
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
23
|
-
|
|
24
|
-
import { MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFECT_LEN } from './constants.js';
|
|
1
|
+
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
2
|
+
|
|
25
3
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
4
|
+
import { callTxeHandler } from './oracle/txe_oracle_registry.js';
|
|
26
5
|
import type { TXESessionStateHandler } from './txe_session.js';
|
|
27
|
-
import {
|
|
28
|
-
type ForeignCallArray,
|
|
29
|
-
type ForeignCallSingle,
|
|
30
|
-
addressFromSingle,
|
|
31
|
-
arrayOfArraysToBoundedVecOfArrays,
|
|
32
|
-
arrayToBoundedVec,
|
|
33
|
-
blockHashFromSingle,
|
|
34
|
-
bufferToU8Array,
|
|
35
|
-
fromArray,
|
|
36
|
-
fromSingle,
|
|
37
|
-
fromUintArray,
|
|
38
|
-
fromUintBoundedVec,
|
|
39
|
-
toArray,
|
|
40
|
-
toForeignCallResult,
|
|
41
|
-
toSingle,
|
|
42
|
-
} from './utils/encoding.js';
|
|
43
|
-
|
|
44
|
-
const MAX_EVENT_LEN = 10; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN
|
|
45
|
-
const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
|
|
6
|
+
import type { ForeignCallArgs } from './utils/encoding.js';
|
|
46
7
|
|
|
47
8
|
export class UnavailableOracleError extends Error {
|
|
48
9
|
constructor(oracleName: string) {
|
|
@@ -114,77 +75,53 @@ export class RPCTranslator {
|
|
|
114
75
|
}
|
|
115
76
|
|
|
116
77
|
// eslint-disable-next-line camelcase
|
|
117
|
-
aztec_txe_assertCompatibleOracleVersion(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
78
|
+
aztec_txe_assertCompatibleOracleVersion(...inputs: ForeignCallArgs) {
|
|
79
|
+
return callTxeHandler({
|
|
80
|
+
oracle: 'aztec_txe_assertCompatibleOracleVersion',
|
|
81
|
+
inputs,
|
|
82
|
+
handler: ([major, minor]) => {
|
|
83
|
+
this.stateHandler.setTxeOracleVersion(major, minor);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
124
86
|
}
|
|
125
87
|
|
|
126
88
|
// TXE session state transition functions - these get handled by the state handler
|
|
127
89
|
|
|
128
90
|
// eslint-disable-next-line camelcase
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
91
|
+
aztec_txe_setTopLevelTXEContext() {
|
|
92
|
+
return callTxeHandler({
|
|
93
|
+
oracle: 'aztec_txe_setTopLevelTXEContext',
|
|
94
|
+
inputs: [],
|
|
95
|
+
handler: () => this.stateHandler.enterTopLevelState(),
|
|
96
|
+
});
|
|
133
97
|
}
|
|
134
98
|
|
|
135
99
|
// eslint-disable-next-line camelcase
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const contractAddress = fromSingle(foreignContractAddressIsSome).toBool()
|
|
144
|
-
? AztecAddress.fromField(fromSingle(foreignContractAddressValue))
|
|
145
|
-
: undefined;
|
|
146
|
-
|
|
147
|
-
const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool()
|
|
148
|
-
? BlockNumber(fromSingle(foreignAnchorBlockNumberValue).toNumber())
|
|
149
|
-
: undefined;
|
|
150
|
-
|
|
151
|
-
const gasSettings = GasSettings.fromFields(fromArray(foreignGasSettings));
|
|
152
|
-
|
|
153
|
-
const privateContextInputs = await this.stateHandler.enterPrivateState(
|
|
154
|
-
contractAddress,
|
|
155
|
-
anchorBlockNumber,
|
|
156
|
-
gasSettings,
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
|
|
100
|
+
aztec_txe_setPrivateTXEContext(...inputs: ForeignCallArgs) {
|
|
101
|
+
return callTxeHandler({
|
|
102
|
+
oracle: 'aztec_txe_setPrivateTXEContext',
|
|
103
|
+
inputs,
|
|
104
|
+
handler: ([contractAddress, anchorBlockNumber, gasSettings]) =>
|
|
105
|
+
this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber, gasSettings),
|
|
106
|
+
});
|
|
160
107
|
}
|
|
161
108
|
|
|
162
109
|
// eslint-disable-next-line camelcase
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
: undefined;
|
|
170
|
-
|
|
171
|
-
await this.stateHandler.enterPublicState(contractAddress);
|
|
172
|
-
|
|
173
|
-
return toForeignCallResult([]);
|
|
110
|
+
aztec_txe_setPublicTXEContext(...inputs: ForeignCallArgs) {
|
|
111
|
+
return callTxeHandler({
|
|
112
|
+
oracle: 'aztec_txe_setPublicTXEContext',
|
|
113
|
+
inputs,
|
|
114
|
+
handler: ([contractAddress]) => this.stateHandler.enterPublicState(contractAddress),
|
|
115
|
+
});
|
|
174
116
|
}
|
|
175
117
|
|
|
176
118
|
// eslint-disable-next-line camelcase
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
: undefined;
|
|
184
|
-
|
|
185
|
-
await this.stateHandler.enterUtilityState(contractAddress);
|
|
186
|
-
|
|
187
|
-
return toForeignCallResult([]);
|
|
119
|
+
aztec_txe_setUtilityTXEContext(...inputs: ForeignCallArgs) {
|
|
120
|
+
return callTxeHandler({
|
|
121
|
+
oracle: 'aztec_txe_setUtilityTXEContext',
|
|
122
|
+
inputs,
|
|
123
|
+
handler: ([contractAddress]) => this.stateHandler.enterUtilityState(contractAddress),
|
|
124
|
+
});
|
|
188
125
|
}
|
|
189
126
|
|
|
190
127
|
// Other oracles - these get handled by the oracle handler
|
|
@@ -193,802 +130,690 @@ export class RPCTranslator {
|
|
|
193
130
|
|
|
194
131
|
// eslint-disable-next-line camelcase
|
|
195
132
|
aztec_txe_getDefaultAddress() {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
133
|
+
return callTxeHandler({
|
|
134
|
+
oracle: 'aztec_txe_getDefaultAddress',
|
|
135
|
+
inputs: [],
|
|
136
|
+
handler: () => this.handlerAsTxe().getDefaultAddress(),
|
|
137
|
+
});
|
|
199
138
|
}
|
|
200
139
|
|
|
201
140
|
// eslint-disable-next-line camelcase
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
141
|
+
aztec_txe_getNextBlockNumber() {
|
|
142
|
+
return callTxeHandler({
|
|
143
|
+
oracle: 'aztec_txe_getNextBlockNumber',
|
|
144
|
+
inputs: [],
|
|
145
|
+
handler: () => this.handlerAsTxe().getNextBlockNumber(),
|
|
146
|
+
});
|
|
206
147
|
}
|
|
207
148
|
|
|
208
149
|
// eslint-disable-next-line camelcase
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
150
|
+
aztec_txe_getNextBlockTimestamp() {
|
|
151
|
+
return callTxeHandler({
|
|
152
|
+
oracle: 'aztec_txe_getNextBlockTimestamp',
|
|
153
|
+
inputs: [],
|
|
154
|
+
handler: () => this.handlerAsTxe().getNextBlockTimestamp(),
|
|
155
|
+
});
|
|
213
156
|
}
|
|
214
157
|
|
|
215
158
|
// eslint-disable-next-line camelcase
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
159
|
+
aztec_txe_advanceBlocksBy(...inputs: ForeignCallArgs) {
|
|
160
|
+
return callTxeHandler({
|
|
161
|
+
oracle: 'aztec_txe_advanceBlocksBy',
|
|
162
|
+
inputs,
|
|
163
|
+
handler: ([blocks]) => this.handlerAsTxe().advanceBlocksBy(blocks),
|
|
164
|
+
});
|
|
222
165
|
}
|
|
223
166
|
|
|
224
167
|
// eslint-disable-next-line camelcase
|
|
225
|
-
aztec_txe_advanceTimestampBy(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
168
|
+
aztec_txe_advanceTimestampBy(...inputs: ForeignCallArgs) {
|
|
169
|
+
return callTxeHandler({
|
|
170
|
+
oracle: 'aztec_txe_advanceTimestampBy',
|
|
171
|
+
inputs,
|
|
172
|
+
handler: ([duration]) => this.handlerAsTxe().advanceTimestampBy(duration),
|
|
173
|
+
});
|
|
231
174
|
}
|
|
232
175
|
|
|
233
176
|
// eslint-disable-next-line camelcase
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
await this.handlerAsTxe().deploy(artifact, instance, secret);
|
|
242
|
-
|
|
243
|
-
return toForeignCallResult([
|
|
244
|
-
toArray([
|
|
245
|
-
instance.salt,
|
|
246
|
-
instance.deployer.toField(),
|
|
247
|
-
instance.currentContractClassId,
|
|
248
|
-
instance.initializationHash,
|
|
249
|
-
instance.immutablesHash,
|
|
250
|
-
...instance.publicKeys.toFields(),
|
|
251
|
-
]),
|
|
252
|
-
]);
|
|
177
|
+
aztec_txe_deploy(...inputs: ForeignCallArgs) {
|
|
178
|
+
return callTxeHandler({
|
|
179
|
+
oracle: 'aztec_txe_deploy',
|
|
180
|
+
inputs,
|
|
181
|
+
handler: ([contractPath, initializer, _, args, secret, salt, deployer]) =>
|
|
182
|
+
this.handlerAsTxe().deploy(contractPath, initializer, args, secret, salt, deployer),
|
|
183
|
+
});
|
|
253
184
|
}
|
|
254
185
|
|
|
255
186
|
// eslint-disable-next-line camelcase
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
toSingle(completeAddress.address),
|
|
263
|
-
...completeAddress.publicKeys.toFields().map(toSingle),
|
|
264
|
-
]);
|
|
187
|
+
aztec_txe_createAccount(...inputs: ForeignCallArgs) {
|
|
188
|
+
return callTxeHandler({
|
|
189
|
+
oracle: 'aztec_txe_createAccount',
|
|
190
|
+
inputs,
|
|
191
|
+
handler: ([secret, partialAddress]) => this.handlerAsTxe().createAccount(secret, partialAddress),
|
|
192
|
+
});
|
|
265
193
|
}
|
|
266
194
|
|
|
267
195
|
// eslint-disable-next-line camelcase
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
|
|
196
|
+
aztec_txe_addAccount(...inputs: ForeignCallArgs) {
|
|
197
|
+
return callTxeHandler({
|
|
198
|
+
oracle: 'aztec_txe_addAccount',
|
|
199
|
+
inputs,
|
|
200
|
+
handler: ([secret]) => this.handlerAsTxe().addAccount(secret),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
276
203
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
204
|
+
// eslint-disable-next-line camelcase
|
|
205
|
+
aztec_txe_addAuthWitness(...inputs: ForeignCallArgs) {
|
|
206
|
+
return callTxeHandler({
|
|
207
|
+
oracle: 'aztec_txe_addAuthWitness',
|
|
208
|
+
inputs,
|
|
209
|
+
handler: ([address, messageHash]) => this.handlerAsTxe().addAuthWitness(address, messageHash),
|
|
210
|
+
});
|
|
281
211
|
}
|
|
282
212
|
|
|
283
213
|
// eslint-disable-next-line camelcase
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
214
|
+
aztec_txe_sendL1ToL2Message(...inputs: ForeignCallArgs) {
|
|
215
|
+
return callTxeHandler({
|
|
216
|
+
oracle: 'aztec_txe_sendL1ToL2Message',
|
|
217
|
+
inputs,
|
|
218
|
+
handler: ([content, secretHash, sender, recipient]) =>
|
|
219
|
+
this.handlerAsTxe().sendL1ToL2Message(content, secretHash, sender, recipient),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
287
222
|
|
|
288
|
-
|
|
223
|
+
// eslint-disable-next-line camelcase
|
|
224
|
+
aztec_txe_setTaggingSecretStrategies(...inputs: ForeignCallArgs) {
|
|
225
|
+
return callTxeHandler({
|
|
226
|
+
oracle: 'aztec_txe_setTaggingSecretStrategies',
|
|
227
|
+
inputs,
|
|
228
|
+
handler: ([unconstrainedStrategy, constrainedStrategy]) =>
|
|
229
|
+
this.handlerAsTxe().setTaggingSecretStrategies(unconstrainedStrategy, constrainedStrategy),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
289
232
|
|
|
290
|
-
|
|
233
|
+
// eslint-disable-next-line camelcase
|
|
234
|
+
aztec_txe_setAuthorizeAllUtilityCallTargets(...inputs: ForeignCallArgs) {
|
|
235
|
+
return callTxeHandler({
|
|
236
|
+
oracle: 'aztec_txe_setAuthorizeAllUtilityCallTargets',
|
|
237
|
+
inputs,
|
|
238
|
+
handler: ([authorizeAll]) => this.handlerAsTxe().setAuthorizeAllUtilityCallTargets(authorizeAll),
|
|
239
|
+
});
|
|
291
240
|
}
|
|
292
241
|
|
|
293
242
|
// PXE oracles
|
|
294
243
|
|
|
295
244
|
// eslint-disable-next-line camelcase
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return toForeignCallResult([]);
|
|
245
|
+
aztec_misc_assertCompatibleOracleVersion(...inputs: ForeignCallArgs) {
|
|
246
|
+
return callTxeHandler({
|
|
247
|
+
oracle: 'aztec_misc_assertCompatibleOracleVersion',
|
|
248
|
+
inputs,
|
|
249
|
+
handler: ([major, minor]) => this.handlerAsMisc().assertCompatibleOracleVersion(major, minor),
|
|
250
|
+
});
|
|
303
251
|
}
|
|
304
252
|
|
|
305
253
|
// eslint-disable-next-line camelcase
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
254
|
+
aztec_misc_getRandomField() {
|
|
255
|
+
return callTxeHandler({
|
|
256
|
+
oracle: 'aztec_misc_getRandomField',
|
|
257
|
+
inputs: [],
|
|
258
|
+
handler: () => this.handlerAsMisc().getRandomField(),
|
|
259
|
+
});
|
|
310
260
|
}
|
|
311
261
|
|
|
312
262
|
// eslint-disable-next-line camelcase
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
263
|
+
aztec_txe_getLastBlockTimestamp() {
|
|
264
|
+
return callTxeHandler({
|
|
265
|
+
oracle: 'aztec_txe_getLastBlockTimestamp',
|
|
266
|
+
inputs: [],
|
|
267
|
+
handler: () => this.handlerAsTxe().getLastBlockTimestamp(),
|
|
268
|
+
});
|
|
317
269
|
}
|
|
318
270
|
|
|
319
271
|
// eslint-disable-next-line camelcase
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
// is zero-padded to `PRIVATE_LOG_SIZE_IN_FIELDS`.
|
|
327
|
-
const emittedLogs = privateLogs.map(log => log.getEmittedFields());
|
|
328
|
-
|
|
329
|
-
const rawLogStorage = emittedLogs
|
|
330
|
-
.map(fields => fields.concat(Array(PRIVATE_LOG_SIZE_IN_FIELDS - fields.length).fill(new Fr(0))))
|
|
331
|
-
.concat(
|
|
332
|
-
Array(MAX_PRIVATE_LOGS_PER_TX - emittedLogs.length).fill(Array(PRIVATE_LOG_SIZE_IN_FIELDS).fill(new Fr(0))),
|
|
333
|
-
)
|
|
334
|
-
.flat();
|
|
335
|
-
|
|
336
|
-
const logLengths = emittedLogs
|
|
337
|
-
.map(fields => new Fr(fields.length))
|
|
338
|
-
.concat(Array(MAX_PRIVATE_LOGS_PER_TX - emittedLogs.length).fill(new Fr(0)));
|
|
339
|
-
|
|
340
|
-
const logCount = new Fr(emittedLogs.length);
|
|
341
|
-
|
|
342
|
-
return toForeignCallResult([
|
|
343
|
-
toSingle(txHash.hash),
|
|
344
|
-
...arrayToBoundedVec(toArray(noteHashes), MAX_NOTE_HASHES_PER_TX),
|
|
345
|
-
...arrayToBoundedVec(toArray(nullifiers), MAX_NULLIFIERS_PER_TX),
|
|
346
|
-
toArray(rawLogStorage),
|
|
347
|
-
toArray(logLengths),
|
|
348
|
-
toSingle(logCount),
|
|
349
|
-
]);
|
|
272
|
+
aztec_txe_getLastTxEffects() {
|
|
273
|
+
return callTxeHandler({
|
|
274
|
+
oracle: 'aztec_txe_getLastTxEffects',
|
|
275
|
+
inputs: [],
|
|
276
|
+
handler: () => this.handlerAsTxe().getLastTxEffects(),
|
|
277
|
+
});
|
|
350
278
|
}
|
|
351
279
|
|
|
352
280
|
// eslint-disable-next-line camelcase
|
|
353
281
|
aztec_txe_getLastCallOffchainEffects() {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
Array(MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY - effects.length).fill(Array(MAX_OFFCHAIN_EFFECT_LEN).fill(new Fr(0))),
|
|
360
|
-
)
|
|
361
|
-
.flat();
|
|
362
|
-
|
|
363
|
-
const effectLengths = effects
|
|
364
|
-
.map(e => new Fr(e.length))
|
|
365
|
-
.concat(Array(MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY - effects.length).fill(new Fr(0)));
|
|
366
|
-
|
|
367
|
-
const count = new Fr(effects.length);
|
|
368
|
-
|
|
369
|
-
return toForeignCallResult([toArray(rawArrayStorage), toArray(effectLengths), toSingle(count)]);
|
|
282
|
+
return callTxeHandler({
|
|
283
|
+
oracle: 'aztec_txe_getLastCallOffchainEffects',
|
|
284
|
+
inputs: [],
|
|
285
|
+
handler: () => this.stateHandler.getLastCallOffchainEffects(),
|
|
286
|
+
});
|
|
370
287
|
}
|
|
371
288
|
|
|
372
289
|
// eslint-disable-next-line camelcase
|
|
373
290
|
aztec_txe_getLastCallContext() {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
async aztec_txe_getPrivateEvents(
|
|
381
|
-
foreignSelector: ForeignCallSingle,
|
|
382
|
-
foreignContractAddress: ForeignCallSingle,
|
|
383
|
-
foreignScope: ForeignCallSingle,
|
|
384
|
-
) {
|
|
385
|
-
const selector = EventSelector.fromField(fromSingle(foreignSelector));
|
|
386
|
-
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
387
|
-
const scope = addressFromSingle(foreignScope);
|
|
388
|
-
|
|
389
|
-
// TODO(F-335): Avoid doing the following 2 calls here.
|
|
390
|
-
{
|
|
391
|
-
await this.handlerAsTxe().syncContractNonOracleMethod(contractAddress, scope, this.stateHandler.getCurrentJob());
|
|
392
|
-
// We cycle job to commit the stores after the contract sync.
|
|
393
|
-
await this.stateHandler.cycleJob();
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
|
|
397
|
-
|
|
398
|
-
if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
|
|
399
|
-
throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (events.some(e => e.length > MAX_EVENT_LEN)) {
|
|
403
|
-
throw new Error(`Some private event has length larger than maxLen ${MAX_EVENT_LEN}`);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// This is a workaround as Noir does not currently let us return nested structs with arrays. We instead return a raw
|
|
407
|
-
// multidimensional array in get_private_events_oracle and create the BoundedVecs here.
|
|
408
|
-
const rawArrayStorage = events
|
|
409
|
-
.map(e => e.concat(Array(MAX_EVENT_LEN - e.length).fill(new Fr(0))))
|
|
410
|
-
.concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(Array(MAX_EVENT_LEN).fill(new Fr(0))))
|
|
411
|
-
.flat();
|
|
412
|
-
const eventLengths = events
|
|
413
|
-
.map(e => new Fr(e.length))
|
|
414
|
-
.concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(new Fr(0)));
|
|
415
|
-
const queryLength = new Fr(events.length);
|
|
291
|
+
return callTxeHandler({
|
|
292
|
+
oracle: 'aztec_txe_getLastCallContext',
|
|
293
|
+
inputs: [],
|
|
294
|
+
handler: () => this.stateHandler.getLastCallContext(),
|
|
295
|
+
});
|
|
296
|
+
}
|
|
416
297
|
|
|
417
|
-
|
|
298
|
+
// eslint-disable-next-line camelcase
|
|
299
|
+
aztec_txe_getPrivateEvents(...inputs: ForeignCallArgs) {
|
|
300
|
+
return callTxeHandler({
|
|
301
|
+
oracle: 'aztec_txe_getPrivateEvents',
|
|
302
|
+
inputs,
|
|
303
|
+
handler: ([selector, contractAddress, scope]) =>
|
|
304
|
+
this.stateHandler.getPrivateEvents(selector, contractAddress, scope),
|
|
305
|
+
});
|
|
418
306
|
}
|
|
419
307
|
|
|
420
308
|
// eslint-disable-next-line camelcase
|
|
421
|
-
aztec_prv_setHashPreimage(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// eslint-disable-next-line camelcase
|
|
431
|
-
async aztec_prv_getHashPreimage(foreignHash: ForeignCallSingle) {
|
|
432
|
-
const hash = fromSingle(foreignHash);
|
|
433
|
-
|
|
434
|
-
const returns = await this.handlerAsPrivate().getHashPreimage(hash);
|
|
435
|
-
|
|
436
|
-
return toForeignCallResult([toArray(returns)]);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// When the argument is a slice, noir automatically adds a length field to oracle call.
|
|
440
|
-
// When the argument is an array, we add the field length manually to the signature.
|
|
441
|
-
// eslint-disable-next-line camelcase
|
|
442
|
-
async aztec_utl_log(
|
|
443
|
-
foreignLevel: ForeignCallSingle,
|
|
444
|
-
foreignMessage: ForeignCallArray,
|
|
445
|
-
_foreignLength: ForeignCallSingle,
|
|
446
|
-
foreignFields: ForeignCallArray,
|
|
447
|
-
) {
|
|
448
|
-
const level = fromSingle(foreignLevel).toNumber();
|
|
449
|
-
const message = fromArray(foreignMessage)
|
|
450
|
-
.map(field => String.fromCharCode(field.toNumber()))
|
|
451
|
-
.join('');
|
|
452
|
-
const fields = fromArray(foreignFields);
|
|
453
|
-
|
|
454
|
-
await this.handlerAsMisc().log(level, message, fields);
|
|
455
|
-
|
|
456
|
-
return toForeignCallResult([]);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// eslint-disable-next-line camelcase
|
|
460
|
-
async aztec_utl_getFromPublicStorage(
|
|
461
|
-
foreignBlockHash: ForeignCallSingle,
|
|
462
|
-
foreignContractAddress: ForeignCallSingle,
|
|
463
|
-
foreignStartStorageSlot: ForeignCallSingle,
|
|
464
|
-
foreignNumberOfElements: ForeignCallSingle,
|
|
465
|
-
) {
|
|
466
|
-
const blockHash = blockHashFromSingle(foreignBlockHash);
|
|
467
|
-
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
468
|
-
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
469
|
-
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
470
|
-
|
|
471
|
-
const values = await this.handlerAsUtility().getFromPublicStorage(
|
|
472
|
-
blockHash,
|
|
473
|
-
contractAddress,
|
|
474
|
-
startStorageSlot,
|
|
475
|
-
numberOfElements,
|
|
476
|
-
);
|
|
477
|
-
|
|
478
|
-
return toForeignCallResult([toArray(values)]);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// eslint-disable-next-line camelcase
|
|
482
|
-
async aztec_utl_getPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
|
|
483
|
-
const blockHash = blockHashFromSingle(foreignBlockHash);
|
|
484
|
-
const leafSlot = fromSingle(foreignLeafSlot);
|
|
485
|
-
|
|
486
|
-
const witness = await this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot);
|
|
487
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// eslint-disable-next-line camelcase
|
|
491
|
-
async aztec_utl_getNotes(
|
|
492
|
-
foreignOwnerIsSome: ForeignCallSingle,
|
|
493
|
-
foreignOwnerValue: ForeignCallSingle,
|
|
494
|
-
foreignStorageSlot: ForeignCallSingle,
|
|
495
|
-
foreignNumSelects: ForeignCallSingle,
|
|
496
|
-
foreignSelectByIndexes: ForeignCallArray,
|
|
497
|
-
foreignSelectByOffsets: ForeignCallArray,
|
|
498
|
-
foreignSelectByLengths: ForeignCallArray,
|
|
499
|
-
foreignSelectValues: ForeignCallArray,
|
|
500
|
-
foreignSelectComparators: ForeignCallArray,
|
|
501
|
-
foreignSortByIndexes: ForeignCallArray,
|
|
502
|
-
foreignSortByOffsets: ForeignCallArray,
|
|
503
|
-
foreignSortByLengths: ForeignCallArray,
|
|
504
|
-
foreignSortOrder: ForeignCallArray,
|
|
505
|
-
foreignLimit: ForeignCallSingle,
|
|
506
|
-
foreignOffset: ForeignCallSingle,
|
|
507
|
-
foreignStatus: ForeignCallSingle,
|
|
508
|
-
foreignMaxNotes: ForeignCallSingle,
|
|
509
|
-
foreignPackedHintedNoteLength: ForeignCallSingle,
|
|
510
|
-
) {
|
|
511
|
-
// Parse Option<AztecAddress>: ownerIsSome is 0 for None, 1 for Some
|
|
512
|
-
const owner = fromSingle(foreignOwnerIsSome).toBool()
|
|
513
|
-
? Option.some(AztecAddress.fromField(fromSingle(foreignOwnerValue)))
|
|
514
|
-
: Option.none(AztecAddress.ZERO);
|
|
515
|
-
const storageSlot = fromSingle(foreignStorageSlot);
|
|
516
|
-
const numSelects = fromSingle(foreignNumSelects).toNumber();
|
|
517
|
-
const selectByIndexes = fromArray(foreignSelectByIndexes).map(fr => fr.toNumber());
|
|
518
|
-
const selectByOffsets = fromArray(foreignSelectByOffsets).map(fr => fr.toNumber());
|
|
519
|
-
const selectByLengths = fromArray(foreignSelectByLengths).map(fr => fr.toNumber());
|
|
520
|
-
const selectValues = fromArray(foreignSelectValues);
|
|
521
|
-
const selectComparators = fromArray(foreignSelectComparators).map(fr => fr.toNumber());
|
|
522
|
-
const sortByIndexes = fromArray(foreignSortByIndexes).map(fr => fr.toNumber());
|
|
523
|
-
const sortByOffsets = fromArray(foreignSortByOffsets).map(fr => fr.toNumber());
|
|
524
|
-
const sortByLengths = fromArray(foreignSortByLengths).map(fr => fr.toNumber());
|
|
525
|
-
const sortOrder = fromArray(foreignSortOrder).map(fr => fr.toNumber());
|
|
526
|
-
const limit = fromSingle(foreignLimit).toNumber();
|
|
527
|
-
const offset = fromSingle(foreignOffset).toNumber();
|
|
528
|
-
const status = fromSingle(foreignStatus).toNumber();
|
|
529
|
-
const maxNotes = fromSingle(foreignMaxNotes).toNumber();
|
|
530
|
-
const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
|
|
531
|
-
|
|
532
|
-
const noteVec = await this.handlerAsUtility().getNotes(
|
|
533
|
-
owner,
|
|
534
|
-
storageSlot,
|
|
535
|
-
numSelects,
|
|
536
|
-
selectByIndexes,
|
|
537
|
-
selectByOffsets,
|
|
538
|
-
selectByLengths,
|
|
539
|
-
selectValues,
|
|
540
|
-
selectComparators,
|
|
541
|
-
sortByIndexes,
|
|
542
|
-
sortByOffsets,
|
|
543
|
-
sortByLengths,
|
|
544
|
-
sortOrder,
|
|
545
|
-
limit,
|
|
546
|
-
offset,
|
|
547
|
-
status,
|
|
548
|
-
maxNotes,
|
|
549
|
-
packedHintedNoteLength,
|
|
550
|
-
);
|
|
551
|
-
|
|
552
|
-
const returnDataAsArrayOfArrays = Array.from(noteVec.data).map(noteData =>
|
|
553
|
-
packAsHintedNote({
|
|
554
|
-
contractAddress: noteData.contractAddress,
|
|
555
|
-
owner: noteData.owner,
|
|
556
|
-
randomness: noteData.randomness,
|
|
557
|
-
storageSlot: noteData.storageSlot,
|
|
558
|
-
noteNonce: noteData.noteNonce,
|
|
559
|
-
isPending: noteData.isPending,
|
|
560
|
-
note: noteData.note,
|
|
561
|
-
}),
|
|
562
|
-
);
|
|
563
|
-
|
|
564
|
-
const returnDataAsArrayOfForeignCallSingleArrays = returnDataAsArrayOfArrays.map(subArray =>
|
|
565
|
-
subArray.map(toSingle),
|
|
566
|
-
);
|
|
567
|
-
|
|
568
|
-
return toForeignCallResult(
|
|
569
|
-
arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes, packedHintedNoteLength),
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// eslint-disable-next-line camelcase
|
|
574
|
-
aztec_prv_notifyCreatedNote(
|
|
575
|
-
foreignOwner: ForeignCallSingle,
|
|
576
|
-
foreignStorageSlot: ForeignCallSingle,
|
|
577
|
-
foreignRandomness: ForeignCallSingle,
|
|
578
|
-
foreignNoteTypeId: ForeignCallSingle,
|
|
579
|
-
foreignNote: ForeignCallArray,
|
|
580
|
-
foreignNoteHash: ForeignCallSingle,
|
|
581
|
-
foreignCounter: ForeignCallSingle,
|
|
582
|
-
) {
|
|
583
|
-
const owner = addressFromSingle(foreignOwner);
|
|
584
|
-
const storageSlot = fromSingle(foreignStorageSlot);
|
|
585
|
-
const randomness = fromSingle(foreignRandomness);
|
|
586
|
-
const noteTypeId = NoteSelector.fromField(fromSingle(foreignNoteTypeId));
|
|
587
|
-
const note = fromArray(foreignNote);
|
|
588
|
-
const noteHash = fromSingle(foreignNoteHash);
|
|
589
|
-
const counter = fromSingle(foreignCounter).toNumber();
|
|
590
|
-
|
|
591
|
-
this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
|
|
592
|
-
|
|
593
|
-
return toForeignCallResult([]);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// eslint-disable-next-line camelcase
|
|
597
|
-
async aztec_prv_notifyNullifiedNote(
|
|
598
|
-
foreignInnerNullifier: ForeignCallSingle,
|
|
599
|
-
foreignNoteHash: ForeignCallSingle,
|
|
600
|
-
foreignCounter: ForeignCallSingle,
|
|
601
|
-
) {
|
|
602
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
603
|
-
const noteHash = fromSingle(foreignNoteHash);
|
|
604
|
-
const counter = fromSingle(foreignCounter).toNumber();
|
|
605
|
-
|
|
606
|
-
await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
|
|
607
|
-
|
|
608
|
-
return toForeignCallResult([]);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// eslint-disable-next-line camelcase
|
|
612
|
-
async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
|
|
613
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
614
|
-
|
|
615
|
-
await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
|
|
616
|
-
|
|
617
|
-
return toForeignCallResult([]);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// eslint-disable-next-line camelcase
|
|
621
|
-
async aztec_prv_isNullifierPending(
|
|
622
|
-
foreignInnerNullifier: ForeignCallSingle,
|
|
623
|
-
foreignContractAddress: ForeignCallSingle,
|
|
624
|
-
) {
|
|
625
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
626
|
-
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
627
|
-
|
|
628
|
-
const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
|
|
629
|
-
|
|
630
|
-
return toForeignCallResult([toSingle(new Fr(isPending))]);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// eslint-disable-next-line camelcase
|
|
634
|
-
async aztec_utl_doesNullifierExist(foreignInnerNullifier: ForeignCallSingle) {
|
|
635
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
309
|
+
aztec_prv_setHashPreimage(...inputs: ForeignCallArgs) {
|
|
310
|
+
return callTxeHandler({
|
|
311
|
+
oracle: 'aztec_prv_setHashPreimage',
|
|
312
|
+
inputs,
|
|
313
|
+
handler: ([values, hash]) => this.handlerAsPrivate().setHashPreimage(values, hash),
|
|
314
|
+
});
|
|
315
|
+
}
|
|
636
316
|
|
|
637
|
-
|
|
317
|
+
// eslint-disable-next-line camelcase
|
|
318
|
+
aztec_prv_getHashPreimage(...inputs: ForeignCallArgs) {
|
|
319
|
+
return callTxeHandler({
|
|
320
|
+
oracle: 'aztec_prv_getHashPreimage',
|
|
321
|
+
inputs,
|
|
322
|
+
handler: ([hash]) => this.handlerAsPrivate().getHashPreimage(hash),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
638
325
|
|
|
639
|
-
|
|
326
|
+
// eslint-disable-next-line camelcase
|
|
327
|
+
aztec_misc_log(...inputs: ForeignCallArgs) {
|
|
328
|
+
return callTxeHandler({
|
|
329
|
+
oracle: 'aztec_misc_log',
|
|
330
|
+
inputs,
|
|
331
|
+
handler: ([level, message, fieldsSize, fields]) => this.handlerAsMisc().log(level, message, fieldsSize, fields),
|
|
332
|
+
});
|
|
640
333
|
}
|
|
641
334
|
|
|
642
335
|
// eslint-disable-next-line camelcase
|
|
643
|
-
|
|
644
|
-
|
|
336
|
+
aztec_utl_getFromPublicStorage(...inputs: ForeignCallArgs) {
|
|
337
|
+
return callTxeHandler({
|
|
338
|
+
oracle: 'aztec_utl_getFromPublicStorage',
|
|
339
|
+
inputs,
|
|
340
|
+
handler: ([blockHash, contractAddress, startStorageSlot, numberOfElements]) =>
|
|
341
|
+
this.handlerAsUtility().getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
645
344
|
|
|
646
|
-
|
|
345
|
+
// eslint-disable-next-line camelcase
|
|
346
|
+
aztec_utl_getPublicDataWitness(...inputs: ForeignCallArgs) {
|
|
347
|
+
return callTxeHandler({
|
|
348
|
+
oracle: 'aztec_utl_getPublicDataWitness',
|
|
349
|
+
inputs,
|
|
350
|
+
handler: ([blockHash, leafSlot]) => this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot),
|
|
351
|
+
});
|
|
352
|
+
}
|
|
647
353
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
354
|
+
// eslint-disable-next-line camelcase
|
|
355
|
+
aztec_utl_getNotes(...inputs: ForeignCallArgs) {
|
|
356
|
+
return callTxeHandler({
|
|
357
|
+
oracle: 'aztec_utl_getNotes',
|
|
358
|
+
inputs,
|
|
359
|
+
handler: ([
|
|
360
|
+
owner,
|
|
361
|
+
storageSlot,
|
|
362
|
+
numSelects,
|
|
363
|
+
selectByIndexes,
|
|
364
|
+
selectByOffsets,
|
|
365
|
+
selectByLengths,
|
|
366
|
+
selectValues,
|
|
367
|
+
selectComparators,
|
|
368
|
+
sortByIndexes,
|
|
369
|
+
sortByOffsets,
|
|
370
|
+
sortByLengths,
|
|
371
|
+
sortOrder,
|
|
372
|
+
limit,
|
|
373
|
+
offset,
|
|
374
|
+
status,
|
|
375
|
+
maxNotes,
|
|
376
|
+
packedHintedNoteLength,
|
|
377
|
+
]) =>
|
|
378
|
+
this.handlerAsUtility().getNotes(
|
|
379
|
+
owner,
|
|
380
|
+
storageSlot,
|
|
381
|
+
numSelects,
|
|
382
|
+
selectByIndexes,
|
|
383
|
+
selectByOffsets,
|
|
384
|
+
selectByLengths,
|
|
385
|
+
selectValues,
|
|
386
|
+
selectComparators,
|
|
387
|
+
sortByIndexes,
|
|
388
|
+
sortByOffsets,
|
|
389
|
+
sortByLengths,
|
|
390
|
+
sortOrder,
|
|
391
|
+
limit,
|
|
392
|
+
offset,
|
|
393
|
+
status,
|
|
394
|
+
maxNotes,
|
|
395
|
+
packedHintedNoteLength,
|
|
396
|
+
),
|
|
397
|
+
});
|
|
658
398
|
}
|
|
659
399
|
|
|
660
400
|
// eslint-disable-next-line camelcase
|
|
661
|
-
|
|
662
|
-
|
|
401
|
+
aztec_prv_notifyCreatedNote(...inputs: ForeignCallArgs) {
|
|
402
|
+
return callTxeHandler({
|
|
403
|
+
oracle: 'aztec_prv_notifyCreatedNote',
|
|
404
|
+
inputs,
|
|
405
|
+
handler: ([owner, storageSlot, randomness, noteTypeId, note, noteHash, counter]) =>
|
|
406
|
+
this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter),
|
|
407
|
+
});
|
|
408
|
+
}
|
|
663
409
|
|
|
664
|
-
|
|
410
|
+
// eslint-disable-next-line camelcase
|
|
411
|
+
aztec_prv_notifyNullifiedNote(...inputs: ForeignCallArgs) {
|
|
412
|
+
return callTxeHandler({
|
|
413
|
+
oracle: 'aztec_prv_notifyNullifiedNote',
|
|
414
|
+
inputs,
|
|
415
|
+
handler: ([innerNullifier, noteHash, counter]) =>
|
|
416
|
+
this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter),
|
|
417
|
+
});
|
|
418
|
+
}
|
|
665
419
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
// The Noir side hand-decodes a `[Field; 8]` here (see aztec-nr/aztec/src/oracle/keys.nr), so we
|
|
674
|
-
// emit the 7-field PublicKeys shape + partial_address explicitly
|
|
675
|
-
// rather than going through `publicKeys.toFields()` (which is the struct-flattened 8-field
|
|
676
|
-
// wire for oracle returns that decode via struct shape).
|
|
677
|
-
const { publicKeys, partialAddress } = result.value;
|
|
678
|
-
return toForeignCallResult([
|
|
679
|
-
toSingle(new Fr(1)),
|
|
680
|
-
toArray([
|
|
681
|
-
publicKeys.npkMHash,
|
|
682
|
-
publicKeys.ivpkM.x,
|
|
683
|
-
publicKeys.ivpkM.y,
|
|
684
|
-
publicKeys.ovpkMHash,
|
|
685
|
-
publicKeys.tpkMHash,
|
|
686
|
-
publicKeys.mspkMHash,
|
|
687
|
-
publicKeys.fbpkMHash,
|
|
688
|
-
partialAddress,
|
|
689
|
-
]),
|
|
690
|
-
]);
|
|
691
|
-
}
|
|
420
|
+
// eslint-disable-next-line camelcase
|
|
421
|
+
aztec_prv_notifyCreatedNullifier(...inputs: ForeignCallArgs) {
|
|
422
|
+
return callTxeHandler({
|
|
423
|
+
oracle: 'aztec_prv_notifyCreatedNullifier',
|
|
424
|
+
inputs,
|
|
425
|
+
handler: ([innerNullifier]) => this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier),
|
|
426
|
+
});
|
|
692
427
|
}
|
|
693
428
|
|
|
694
429
|
// eslint-disable-next-line camelcase
|
|
695
|
-
|
|
696
|
-
|
|
430
|
+
aztec_prv_isNullifierPending(...inputs: ForeignCallArgs) {
|
|
431
|
+
return callTxeHandler({
|
|
432
|
+
oracle: 'aztec_prv_isNullifierPending',
|
|
433
|
+
inputs,
|
|
434
|
+
handler: ([innerNullifier, contractAddress]) =>
|
|
435
|
+
this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress),
|
|
436
|
+
});
|
|
437
|
+
}
|
|
697
438
|
|
|
698
|
-
|
|
439
|
+
// eslint-disable-next-line camelcase
|
|
440
|
+
aztec_utl_doesNullifierExist(...inputs: ForeignCallArgs) {
|
|
441
|
+
return callTxeHandler({
|
|
442
|
+
oracle: 'aztec_utl_doesNullifierExist',
|
|
443
|
+
inputs,
|
|
444
|
+
handler: ([innerNullifier]) => this.handlerAsUtility().doesNullifierExist(innerNullifier),
|
|
445
|
+
});
|
|
446
|
+
}
|
|
699
447
|
|
|
700
|
-
|
|
448
|
+
// eslint-disable-next-line camelcase
|
|
449
|
+
aztec_utl_getContractInstance(...inputs: ForeignCallArgs) {
|
|
450
|
+
return callTxeHandler({
|
|
451
|
+
oracle: 'aztec_utl_getContractInstance',
|
|
452
|
+
inputs,
|
|
453
|
+
handler: ([address]) => this.handlerAsUtility().getContractInstance(address),
|
|
454
|
+
});
|
|
701
455
|
}
|
|
702
456
|
|
|
703
457
|
// eslint-disable-next-line camelcase
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
712
|
-
const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
|
|
713
|
-
const argsHash = fromSingle(foreignArgsHash);
|
|
714
|
-
const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
|
|
715
|
-
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
458
|
+
aztec_utl_getPublicKeysAndPartialAddress(...inputs: ForeignCallArgs) {
|
|
459
|
+
return callTxeHandler({
|
|
460
|
+
oracle: 'aztec_utl_getPublicKeysAndPartialAddress',
|
|
461
|
+
inputs,
|
|
462
|
+
handler: ([address]) => this.handlerAsUtility().getPublicKeysAndPartialAddress(address),
|
|
463
|
+
});
|
|
464
|
+
}
|
|
716
465
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
);
|
|
724
|
-
return toForeignCallResult([[endSideEffectCounter, returnsHash].map(toSingle)]);
|
|
466
|
+
// eslint-disable-next-line camelcase
|
|
467
|
+
aztec_utl_getKeyValidationRequest(...inputs: ForeignCallArgs) {
|
|
468
|
+
return callTxeHandler({
|
|
469
|
+
oracle: 'aztec_utl_getKeyValidationRequest',
|
|
470
|
+
inputs,
|
|
471
|
+
handler: ([pkMHash, keyIndex]) => this.handlerAsUtility().getKeyValidationRequest(pkMHash, keyIndex),
|
|
472
|
+
});
|
|
725
473
|
}
|
|
726
474
|
|
|
727
475
|
// eslint-disable-next-line camelcase
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
476
|
+
aztec_prv_callPrivateFunction(...inputs: ForeignCallArgs) {
|
|
477
|
+
return callTxeHandler({
|
|
478
|
+
oracle: 'aztec_prv_callPrivateFunction',
|
|
479
|
+
inputs,
|
|
480
|
+
handler: ([contractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall]) =>
|
|
481
|
+
this.handlerAsPrivate().callPrivateFunction(
|
|
482
|
+
contractAddress,
|
|
483
|
+
functionSelector,
|
|
484
|
+
argsHash,
|
|
485
|
+
sideEffectCounter,
|
|
486
|
+
isStaticCall,
|
|
487
|
+
),
|
|
488
|
+
});
|
|
489
|
+
}
|
|
734
490
|
|
|
735
|
-
|
|
736
|
-
|
|
491
|
+
// eslint-disable-next-line camelcase
|
|
492
|
+
aztec_utl_getNullifierMembershipWitness(...inputs: ForeignCallArgs) {
|
|
493
|
+
return callTxeHandler({
|
|
494
|
+
oracle: 'aztec_utl_getNullifierMembershipWitness',
|
|
495
|
+
inputs,
|
|
496
|
+
handler: ([blockHash, nullifier]) => this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier),
|
|
497
|
+
});
|
|
737
498
|
}
|
|
738
499
|
|
|
739
500
|
// eslint-disable-next-line camelcase
|
|
740
|
-
|
|
741
|
-
|
|
501
|
+
aztec_utl_getL1ToL2MembershipWitnessV2(...inputs: ForeignCallArgs) {
|
|
502
|
+
return callTxeHandler({
|
|
503
|
+
oracle: 'aztec_utl_getL1ToL2MembershipWitnessV2',
|
|
504
|
+
inputs,
|
|
505
|
+
handler: ([messageHash, nullifier]) =>
|
|
506
|
+
this.handlerAsUtility().getL1ToL2MembershipWitnessV2(messageHash, nullifier),
|
|
507
|
+
});
|
|
508
|
+
}
|
|
742
509
|
|
|
743
|
-
|
|
744
|
-
|
|
510
|
+
// eslint-disable-next-line camelcase
|
|
511
|
+
aztec_utl_getAuthWitness(...inputs: ForeignCallArgs) {
|
|
512
|
+
return callTxeHandler({
|
|
513
|
+
oracle: 'aztec_utl_getAuthWitness',
|
|
514
|
+
inputs,
|
|
515
|
+
handler: ([messageHash]) => this.handlerAsUtility().getAuthWitness(messageHash),
|
|
516
|
+
});
|
|
745
517
|
}
|
|
746
518
|
|
|
747
519
|
// eslint-disable-next-line camelcase
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
520
|
+
aztec_prv_assertValidPublicCalldata(...inputs: ForeignCallArgs) {
|
|
521
|
+
return callTxeHandler({
|
|
522
|
+
oracle: 'aztec_prv_assertValidPublicCalldata',
|
|
523
|
+
inputs,
|
|
524
|
+
handler: ([calldataHash]) => this.handlerAsPrivate().assertValidPublicCalldata(calldataHash),
|
|
525
|
+
});
|
|
752
526
|
}
|
|
753
527
|
|
|
754
528
|
// eslint-disable-next-line camelcase
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
529
|
+
aztec_prv_notifyRevertiblePhaseStart(...inputs: ForeignCallArgs) {
|
|
530
|
+
return callTxeHandler({
|
|
531
|
+
oracle: 'aztec_prv_notifyRevertiblePhaseStart',
|
|
532
|
+
inputs,
|
|
533
|
+
handler: ([minRevertibleSideEffectCounter]) =>
|
|
534
|
+
this.handlerAsPrivate().notifyRevertiblePhaseStart(minRevertibleSideEffectCounter),
|
|
535
|
+
});
|
|
759
536
|
}
|
|
760
537
|
|
|
761
538
|
// eslint-disable-next-line camelcase
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
539
|
+
aztec_prv_isExecutionInRevertiblePhase(...inputs: ForeignCallArgs) {
|
|
540
|
+
return callTxeHandler({
|
|
541
|
+
oracle: 'aztec_prv_isExecutionInRevertiblePhase',
|
|
542
|
+
inputs,
|
|
543
|
+
handler: ([sideEffectCounter]) => this.handlerAsPrivate().isExecutionInRevertiblePhase(sideEffectCounter),
|
|
544
|
+
});
|
|
766
545
|
}
|
|
767
546
|
|
|
768
547
|
// eslint-disable-next-line camelcase
|
|
769
548
|
aztec_utl_getUtilityContext() {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
549
|
+
return callTxeHandler({
|
|
550
|
+
oracle: 'aztec_utl_getUtilityContext',
|
|
551
|
+
inputs: [],
|
|
552
|
+
handler: () => this.handlerAsUtility().getUtilityContext(),
|
|
553
|
+
});
|
|
773
554
|
}
|
|
774
555
|
|
|
775
556
|
// eslint-disable-next-line camelcase
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
557
|
+
aztec_utl_getBlockHeader(...inputs: ForeignCallArgs) {
|
|
558
|
+
return callTxeHandler({
|
|
559
|
+
oracle: 'aztec_utl_getBlockHeader',
|
|
560
|
+
inputs,
|
|
561
|
+
handler: ([blockNumber]) => this.handlerAsUtility().getBlockHeader(blockNumber),
|
|
562
|
+
});
|
|
781
563
|
}
|
|
782
564
|
|
|
783
565
|
// eslint-disable-next-line camelcase
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
|
|
792
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
566
|
+
aztec_utl_getNoteHashMembershipWitness(...inputs: ForeignCallArgs) {
|
|
567
|
+
return callTxeHandler({
|
|
568
|
+
oracle: 'aztec_utl_getNoteHashMembershipWitness',
|
|
569
|
+
inputs,
|
|
570
|
+
handler: ([blockHash, noteHash]) => this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash),
|
|
571
|
+
});
|
|
793
572
|
}
|
|
794
573
|
|
|
795
574
|
// eslint-disable-next-line camelcase
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
const witnessOpt = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
|
|
804
|
-
const effective = witnessOpt.value ?? MembershipWitness.empty(ARCHIVE_HEIGHT);
|
|
805
|
-
return toForeignCallResult([toSingle(new Fr(witnessOpt.isSome() ? 1 : 0)), ...effective.toNoirRepresentation()]);
|
|
575
|
+
aztec_utl_getBlockHashMembershipWitness(...inputs: ForeignCallArgs) {
|
|
576
|
+
return callTxeHandler({
|
|
577
|
+
oracle: 'aztec_utl_getBlockHashMembershipWitness',
|
|
578
|
+
inputs,
|
|
579
|
+
handler: ([anchorBlockHash, blockHash]) =>
|
|
580
|
+
this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash),
|
|
581
|
+
});
|
|
806
582
|
}
|
|
807
583
|
|
|
808
584
|
// eslint-disable-next-line camelcase
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
|
|
817
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
585
|
+
aztec_utl_areBlockHashesInArchive(...inputs: ForeignCallArgs) {
|
|
586
|
+
return callTxeHandler({
|
|
587
|
+
oracle: 'aztec_utl_areBlockHashesInArchive',
|
|
588
|
+
inputs,
|
|
589
|
+
handler: ([anchorBlockHash, blockHashes]) =>
|
|
590
|
+
this.handlerAsUtility().areBlockHashesInArchive(anchorBlockHash, blockHashes),
|
|
591
|
+
});
|
|
818
592
|
}
|
|
819
593
|
|
|
820
594
|
// eslint-disable-next-line camelcase
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
595
|
+
aztec_utl_getLowNullifierMembershipWitness(...inputs: ForeignCallArgs) {
|
|
596
|
+
return callTxeHandler({
|
|
597
|
+
oracle: 'aztec_utl_getLowNullifierMembershipWitness',
|
|
598
|
+
inputs,
|
|
599
|
+
handler: ([blockHash, nullifier]) =>
|
|
600
|
+
this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier),
|
|
601
|
+
});
|
|
825
602
|
}
|
|
826
603
|
|
|
827
604
|
// eslint-disable-next-line camelcase
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const scope = AztecAddress.fromField(fromSingle(foreignScope));
|
|
836
|
-
|
|
837
|
-
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
838
|
-
noteValidationRequestsArrayBaseSlot,
|
|
839
|
-
eventValidationRequestsArrayBaseSlot,
|
|
840
|
-
scope,
|
|
841
|
-
);
|
|
605
|
+
aztec_utl_getPendingTaggedLogsV2(...inputs: ForeignCallArgs) {
|
|
606
|
+
return callTxeHandler({
|
|
607
|
+
oracle: 'aztec_utl_getPendingTaggedLogsV2',
|
|
608
|
+
inputs,
|
|
609
|
+
handler: ([scope, providedSecrets]) => this.handlerAsUtility().getPendingTaggedLogsV2(scope, providedSecrets),
|
|
610
|
+
});
|
|
611
|
+
}
|
|
842
612
|
|
|
843
|
-
|
|
613
|
+
// eslint-disable-next-line camelcase
|
|
614
|
+
aztec_utl_validateAndStoreEnqueuedNotesAndEvents(...inputs: ForeignCallArgs) {
|
|
615
|
+
return callTxeHandler({
|
|
616
|
+
oracle: 'aztec_utl_validateAndStoreEnqueuedNotesAndEvents',
|
|
617
|
+
inputs,
|
|
618
|
+
handler: ([noteValidationRequests, eventValidationRequests, scope]) =>
|
|
619
|
+
this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
620
|
+
noteValidationRequests,
|
|
621
|
+
eventValidationRequests,
|
|
622
|
+
scope,
|
|
623
|
+
),
|
|
624
|
+
});
|
|
844
625
|
}
|
|
845
626
|
|
|
846
627
|
// eslint-disable-next-line camelcase
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
628
|
+
aztec_utl_getLogsByTagV2(...inputs: ForeignCallArgs) {
|
|
629
|
+
return callTxeHandler({
|
|
630
|
+
oracle: 'aztec_utl_getLogsByTagV2',
|
|
631
|
+
inputs,
|
|
632
|
+
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().getLogsByTagV2(requestArrayBaseSlot),
|
|
633
|
+
});
|
|
851
634
|
}
|
|
852
635
|
|
|
853
636
|
// eslint-disable-next-line camelcase
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
637
|
+
aztec_utl_getResolvedTxs(...inputs: ForeignCallArgs) {
|
|
638
|
+
return callTxeHandler({
|
|
639
|
+
oracle: 'aztec_utl_getResolvedTxs',
|
|
640
|
+
inputs,
|
|
641
|
+
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().getResolvedTxs(requestArrayBaseSlot),
|
|
642
|
+
});
|
|
858
643
|
}
|
|
859
644
|
|
|
860
645
|
// eslint-disable-next-line camelcase
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
const slot = fromSingle(foreignSlot);
|
|
869
|
-
const capsule = fromArray(foreignCapsule);
|
|
870
|
-
const scope = AztecAddress.fromField(fromSingle(foreignScope));
|
|
646
|
+
aztec_utl_getTxEffects(...inputs: ForeignCallArgs) {
|
|
647
|
+
return callTxeHandler({
|
|
648
|
+
oracle: 'aztec_utl_getTxEffects',
|
|
649
|
+
inputs,
|
|
650
|
+
handler: ([txHashes]) => this.handlerAsUtility().getTxEffects(txHashes),
|
|
651
|
+
});
|
|
652
|
+
}
|
|
871
653
|
|
|
872
|
-
|
|
654
|
+
// eslint-disable-next-line camelcase
|
|
655
|
+
aztec_utl_setCapsule(...inputs: ForeignCallArgs) {
|
|
656
|
+
return callTxeHandler({
|
|
657
|
+
oracle: 'aztec_utl_setCapsule',
|
|
658
|
+
inputs,
|
|
659
|
+
handler: ([contractAddress, slot, capsule, scope]) =>
|
|
660
|
+
this.handlerAsUtility().setCapsule(contractAddress, slot, capsule, scope),
|
|
661
|
+
});
|
|
662
|
+
}
|
|
873
663
|
|
|
874
|
-
|
|
664
|
+
// eslint-disable-next-line camelcase
|
|
665
|
+
aztec_utl_getCapsule(...inputs: ForeignCallArgs) {
|
|
666
|
+
return callTxeHandler({
|
|
667
|
+
oracle: 'aztec_utl_getCapsule',
|
|
668
|
+
inputs,
|
|
669
|
+
handler: ([contractAddress, slot, tSize, scope]) =>
|
|
670
|
+
this.handlerAsUtility().getCapsule(contractAddress, slot, tSize, scope),
|
|
671
|
+
});
|
|
875
672
|
}
|
|
876
673
|
|
|
877
674
|
// eslint-disable-next-line camelcase
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
const slot = fromSingle(foreignSlot);
|
|
886
|
-
const tSize = fromSingle(foreignTSize).toNumber();
|
|
887
|
-
const scope = AztecAddress.fromField(fromSingle(foreignScope));
|
|
675
|
+
aztec_utl_deleteCapsule(...inputs: ForeignCallArgs) {
|
|
676
|
+
return callTxeHandler({
|
|
677
|
+
oracle: 'aztec_utl_deleteCapsule',
|
|
678
|
+
inputs,
|
|
679
|
+
handler: ([contractAddress, slot, scope]) => this.handlerAsUtility().deleteCapsule(contractAddress, slot, scope),
|
|
680
|
+
});
|
|
681
|
+
}
|
|
888
682
|
|
|
889
|
-
|
|
683
|
+
// eslint-disable-next-line camelcase
|
|
684
|
+
aztec_utl_copyCapsule(...inputs: ForeignCallArgs) {
|
|
685
|
+
return callTxeHandler({
|
|
686
|
+
oracle: 'aztec_utl_copyCapsule',
|
|
687
|
+
inputs,
|
|
688
|
+
handler: ([contractAddress, srcSlot, dstSlot, numEntries, scope]) =>
|
|
689
|
+
this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, scope),
|
|
690
|
+
});
|
|
691
|
+
}
|
|
890
692
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
return toForeignCallResult([toSingle(new Fr(0)), toArray(Array(tSize).fill(new Fr(0)))]);
|
|
899
|
-
}
|
|
693
|
+
// eslint-disable-next-line camelcase
|
|
694
|
+
aztec_utl_pushEphemeral(...inputs: ForeignCallArgs) {
|
|
695
|
+
return callTxeHandler({
|
|
696
|
+
oracle: 'aztec_utl_pushEphemeral',
|
|
697
|
+
inputs,
|
|
698
|
+
handler: ([slot, elements]) => this.handlerAsUtility().pushEphemeral(slot, elements),
|
|
699
|
+
});
|
|
900
700
|
}
|
|
901
701
|
|
|
902
702
|
// eslint-disable-next-line camelcase
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
const scope = AztecAddress.fromField(fromSingle(foreignScope));
|
|
703
|
+
aztec_utl_popEphemeral(...inputs: ForeignCallArgs) {
|
|
704
|
+
return callTxeHandler({
|
|
705
|
+
oracle: 'aztec_utl_popEphemeral',
|
|
706
|
+
inputs,
|
|
707
|
+
handler: ([slot]) => this.handlerAsUtility().popEphemeral(slot),
|
|
708
|
+
});
|
|
709
|
+
}
|
|
911
710
|
|
|
912
|
-
|
|
711
|
+
// eslint-disable-next-line camelcase
|
|
712
|
+
aztec_utl_getEphemeral(...inputs: ForeignCallArgs) {
|
|
713
|
+
return callTxeHandler({
|
|
714
|
+
oracle: 'aztec_utl_getEphemeral',
|
|
715
|
+
inputs,
|
|
716
|
+
handler: ([slot, index]) => this.handlerAsUtility().getEphemeral(slot, index),
|
|
717
|
+
});
|
|
718
|
+
}
|
|
913
719
|
|
|
914
|
-
|
|
720
|
+
// eslint-disable-next-line camelcase
|
|
721
|
+
aztec_utl_setEphemeral(...inputs: ForeignCallArgs) {
|
|
722
|
+
return callTxeHandler({
|
|
723
|
+
oracle: 'aztec_utl_setEphemeral',
|
|
724
|
+
inputs,
|
|
725
|
+
handler: ([slot, index, elements]) => this.handlerAsUtility().setEphemeral(slot, index, elements),
|
|
726
|
+
});
|
|
915
727
|
}
|
|
916
728
|
|
|
917
729
|
// eslint-disable-next-line camelcase
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
926
|
-
const srcSlot = fromSingle(foreignSrcSlot);
|
|
927
|
-
const dstSlot = fromSingle(foreignDstSlot);
|
|
928
|
-
const numEntries = fromSingle(foreignNumEntries).toNumber();
|
|
929
|
-
const scope = AztecAddress.fromField(fromSingle(foreignScope));
|
|
730
|
+
aztec_utl_getEphemeralLen(...inputs: ForeignCallArgs) {
|
|
731
|
+
return callTxeHandler({
|
|
732
|
+
oracle: 'aztec_utl_getEphemeralLen',
|
|
733
|
+
inputs,
|
|
734
|
+
handler: ([slot]) => this.handlerAsUtility().getEphemeralLen(slot),
|
|
735
|
+
});
|
|
736
|
+
}
|
|
930
737
|
|
|
931
|
-
|
|
738
|
+
// eslint-disable-next-line camelcase
|
|
739
|
+
aztec_utl_removeEphemeral(...inputs: ForeignCallArgs) {
|
|
740
|
+
return callTxeHandler({
|
|
741
|
+
oracle: 'aztec_utl_removeEphemeral',
|
|
742
|
+
inputs,
|
|
743
|
+
handler: ([slot, index]) => this.handlerAsUtility().removeEphemeral(slot, index),
|
|
744
|
+
});
|
|
745
|
+
}
|
|
932
746
|
|
|
933
|
-
|
|
747
|
+
// eslint-disable-next-line camelcase
|
|
748
|
+
aztec_utl_clearEphemeral(...inputs: ForeignCallArgs) {
|
|
749
|
+
return callTxeHandler({
|
|
750
|
+
oracle: 'aztec_utl_clearEphemeral',
|
|
751
|
+
inputs,
|
|
752
|
+
handler: ([slot]) => this.handlerAsUtility().clearEphemeral(slot),
|
|
753
|
+
});
|
|
934
754
|
}
|
|
935
755
|
|
|
936
756
|
// eslint-disable-next-line camelcase
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
757
|
+
aztec_utl_pushTransient(...inputs: ForeignCallArgs) {
|
|
758
|
+
return callTxeHandler({
|
|
759
|
+
oracle: 'aztec_utl_pushTransient',
|
|
760
|
+
inputs,
|
|
761
|
+
handler: ([slot, elements]) => this.handlerAsUtility().pushTransient(slot, elements),
|
|
762
|
+
});
|
|
942
763
|
}
|
|
943
764
|
|
|
944
765
|
// eslint-disable-next-line camelcase
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
766
|
+
aztec_utl_popTransient(...inputs: ForeignCallArgs) {
|
|
767
|
+
return callTxeHandler({
|
|
768
|
+
oracle: 'aztec_utl_popTransient',
|
|
769
|
+
inputs,
|
|
770
|
+
handler: ([slot]) => this.handlerAsUtility().popTransient(slot),
|
|
771
|
+
});
|
|
949
772
|
}
|
|
950
773
|
|
|
951
774
|
// eslint-disable-next-line camelcase
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
775
|
+
aztec_utl_getTransient(...inputs: ForeignCallArgs) {
|
|
776
|
+
return callTxeHandler({
|
|
777
|
+
oracle: 'aztec_utl_getTransient',
|
|
778
|
+
inputs,
|
|
779
|
+
handler: ([slot, index]) => this.handlerAsUtility().getTransient(slot, index),
|
|
780
|
+
});
|
|
957
781
|
}
|
|
958
782
|
|
|
959
783
|
// eslint-disable-next-line camelcase
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
const index = fromSingle(foreignIndex).toNumber();
|
|
967
|
-
const elements = fromArray(foreignElements);
|
|
968
|
-
this.handlerAsUtility().setEphemeral(slot, index, elements);
|
|
969
|
-
return toForeignCallResult([]);
|
|
784
|
+
aztec_utl_setTransient(...inputs: ForeignCallArgs) {
|
|
785
|
+
return callTxeHandler({
|
|
786
|
+
oracle: 'aztec_utl_setTransient',
|
|
787
|
+
inputs,
|
|
788
|
+
handler: ([slot, index, elements]) => this.handlerAsUtility().setTransient(slot, index, elements),
|
|
789
|
+
});
|
|
970
790
|
}
|
|
971
791
|
|
|
972
792
|
// eslint-disable-next-line camelcase
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
793
|
+
aztec_utl_getTransientLen(...inputs: ForeignCallArgs) {
|
|
794
|
+
return callTxeHandler({
|
|
795
|
+
oracle: 'aztec_utl_getTransientLen',
|
|
796
|
+
inputs,
|
|
797
|
+
handler: ([slot]) => this.handlerAsUtility().getTransientLen(slot),
|
|
798
|
+
});
|
|
977
799
|
}
|
|
978
800
|
|
|
979
801
|
// eslint-disable-next-line camelcase
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
802
|
+
aztec_utl_removeTransient(...inputs: ForeignCallArgs) {
|
|
803
|
+
return callTxeHandler({
|
|
804
|
+
oracle: 'aztec_utl_removeTransient',
|
|
805
|
+
inputs,
|
|
806
|
+
handler: ([slot, index]) => this.handlerAsUtility().removeTransient(slot, index),
|
|
807
|
+
});
|
|
985
808
|
}
|
|
986
809
|
|
|
987
810
|
// eslint-disable-next-line camelcase
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
811
|
+
aztec_utl_clearTransient(...inputs: ForeignCallArgs) {
|
|
812
|
+
return callTxeHandler({
|
|
813
|
+
oracle: 'aztec_utl_clearTransient',
|
|
814
|
+
inputs,
|
|
815
|
+
handler: ([slot]) => this.handlerAsUtility().clearTransient(slot),
|
|
816
|
+
});
|
|
992
817
|
}
|
|
993
818
|
|
|
994
819
|
// TODO: I forgot to add a corresponding function here, when I introduced an oracle method to txe_oracle.ts.
|
|
@@ -996,311 +821,316 @@ export class RPCTranslator {
|
|
|
996
821
|
// to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
|
|
997
822
|
// existence of a txe_oracle method?
|
|
998
823
|
// eslint-disable-next-line camelcase
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
const capacity = foreignCiphertextBVecStorage.length;
|
|
1006
|
-
const ciphertextBuf = fromUintBoundedVec(foreignCiphertextBVecStorage, foreignCiphertextLength, 8);
|
|
1007
|
-
const ciphertext = BoundedVec.from<number>({ data: [...ciphertextBuf], maxLength: capacity });
|
|
1008
|
-
const iv = fromUintArray(foreignIv, 8);
|
|
1009
|
-
const symKey = fromUintArray(foreignSymKey, 8);
|
|
1010
|
-
|
|
1011
|
-
// Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
|
|
1012
|
-
const plaintextOpt = await this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey);
|
|
1013
|
-
if (plaintextOpt.isSome()) {
|
|
1014
|
-
const [storage, length] = arrayToBoundedVec(bufferToU8Array(Buffer.from(plaintextOpt.value.data)), capacity);
|
|
1015
|
-
return toForeignCallResult([toSingle(new Fr(1)), storage, length]);
|
|
1016
|
-
} else {
|
|
1017
|
-
const zeroStorage = toArray(Array(capacity).fill(new Fr(0)));
|
|
1018
|
-
return toForeignCallResult([toSingle(new Fr(0)), zeroStorage, toSingle(new Fr(0))]);
|
|
1019
|
-
}
|
|
824
|
+
aztec_utl_decryptAes128(...inputs: ForeignCallArgs) {
|
|
825
|
+
return callTxeHandler({
|
|
826
|
+
oracle: 'aztec_utl_decryptAes128',
|
|
827
|
+
inputs,
|
|
828
|
+
handler: ([ciphertext, iv, symKey]) => this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey),
|
|
829
|
+
});
|
|
1020
830
|
}
|
|
1021
831
|
|
|
1022
832
|
// eslint-disable-next-line camelcase
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
1031
|
-
|
|
1032
|
-
const responseSlot = await this.handlerAsUtility().getSharedSecrets(address, ephPksSlot, contractAddress);
|
|
1033
|
-
|
|
1034
|
-
return toForeignCallResult([toSingle(responseSlot)]);
|
|
833
|
+
aztec_utl_getSharedSecrets(...inputs: ForeignCallArgs) {
|
|
834
|
+
return callTxeHandler({
|
|
835
|
+
oracle: 'aztec_utl_getSharedSecrets',
|
|
836
|
+
inputs,
|
|
837
|
+
handler: ([address, ephPksSlot, contractAddress]) =>
|
|
838
|
+
this.handlerAsUtility().getSharedSecrets(address, ephPksSlot, contractAddress),
|
|
839
|
+
});
|
|
1035
840
|
}
|
|
1036
841
|
|
|
1037
842
|
// eslint-disable-next-line camelcase
|
|
1038
|
-
aztec_utl_setContractSyncCacheInvalid(
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
const allFields = fromArray(foreignScopes);
|
|
1045
|
-
const count = fromSingle(foreignScopeCount).toNumber();
|
|
1046
|
-
const scopes = BoundedVec.from({
|
|
1047
|
-
data: allFields.slice(0, count).map(f => new AztecAddress(f)),
|
|
1048
|
-
maxLength: allFields.length,
|
|
843
|
+
aztec_utl_setContractSyncCacheInvalid(...inputs: ForeignCallArgs) {
|
|
844
|
+
return callTxeHandler({
|
|
845
|
+
oracle: 'aztec_utl_setContractSyncCacheInvalid',
|
|
846
|
+
inputs,
|
|
847
|
+
handler: ([contractAddress, scopes]) =>
|
|
848
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes),
|
|
1049
849
|
});
|
|
1050
|
-
|
|
1051
|
-
this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes);
|
|
1052
|
-
|
|
1053
|
-
return Promise.resolve(toForeignCallResult([]));
|
|
1054
850
|
}
|
|
1055
851
|
|
|
1056
852
|
// eslint-disable-next-line camelcase
|
|
1057
|
-
aztec_utl_emitOffchainEffect(
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
853
|
+
aztec_utl_emitOffchainEffect(...inputs: ForeignCallArgs) {
|
|
854
|
+
return callTxeHandler({
|
|
855
|
+
oracle: 'aztec_utl_emitOffchainEffect',
|
|
856
|
+
inputs,
|
|
857
|
+
handler: ([data]) => {
|
|
858
|
+
// Record the raw payload against the currently-executing top-level call. The Noir side
|
|
859
|
+
// (via `env.offchain_messages()`) is responsible for decoding the protocol-reserved prefix
|
|
860
|
+
// (`OFFCHAIN_MESSAGE_IDENTIFIER`, recipient) and turning each payload into an `OffchainMessage` struct suitable
|
|
861
|
+
// for `offchain_receive`.
|
|
862
|
+
this.stateHandler.recordOffchainEffect(data);
|
|
863
|
+
},
|
|
864
|
+
});
|
|
1064
865
|
}
|
|
1065
866
|
|
|
1066
|
-
// AVM opcodes
|
|
1067
|
-
|
|
1068
867
|
// eslint-disable-next-line camelcase
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
868
|
+
aztec_utl_recordFact(...inputs: ForeignCallArgs) {
|
|
869
|
+
return callTxeHandler({
|
|
870
|
+
oracle: 'aztec_utl_recordFact',
|
|
871
|
+
inputs,
|
|
872
|
+
handler: ([contractAddress, scope, factCollectionTypeId, factCollectionId, factTypeId, payload, originBlock]) =>
|
|
873
|
+
this.handlerAsUtility().recordFact(
|
|
874
|
+
contractAddress,
|
|
875
|
+
scope,
|
|
876
|
+
factCollectionTypeId,
|
|
877
|
+
factCollectionId,
|
|
878
|
+
factTypeId,
|
|
879
|
+
payload,
|
|
880
|
+
originBlock,
|
|
881
|
+
),
|
|
882
|
+
});
|
|
1072
883
|
}
|
|
1073
884
|
|
|
1074
885
|
// eslint-disable-next-line camelcase
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
886
|
+
aztec_utl_deleteFactCollection(...inputs: ForeignCallArgs) {
|
|
887
|
+
return callTxeHandler({
|
|
888
|
+
oracle: 'aztec_utl_deleteFactCollection',
|
|
889
|
+
inputs,
|
|
890
|
+
handler: ([contractAddress, scope, factCollectionTypeId, factCollectionId]) =>
|
|
891
|
+
this.handlerAsUtility().deleteFactCollection(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
892
|
+
});
|
|
1082
893
|
}
|
|
1083
894
|
|
|
1084
895
|
// eslint-disable-next-line camelcase
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
896
|
+
aztec_utl_getFactCollection(...inputs: ForeignCallArgs) {
|
|
897
|
+
return callTxeHandler({
|
|
898
|
+
oracle: 'aztec_utl_getFactCollection',
|
|
899
|
+
inputs,
|
|
900
|
+
handler: ([contractAddress, scope, factCollectionTypeId, factCollectionId]) =>
|
|
901
|
+
this.handlerAsUtility().getFactCollection(contractAddress, scope, factCollectionTypeId, factCollectionId),
|
|
902
|
+
});
|
|
1092
903
|
}
|
|
1093
904
|
|
|
1094
905
|
// eslint-disable-next-line camelcase
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
1103
|
-
toSingle(new Fr(1)),
|
|
1104
|
-
]);
|
|
906
|
+
aztec_utl_getFactCollectionsByType(...inputs: ForeignCallArgs) {
|
|
907
|
+
return callTxeHandler({
|
|
908
|
+
oracle: 'aztec_utl_getFactCollectionsByType',
|
|
909
|
+
inputs,
|
|
910
|
+
handler: ([contractAddress, scope, factCollectionTypeId]) =>
|
|
911
|
+
this.handlerAsUtility().getFactCollectionsByType(contractAddress, scope, factCollectionTypeId),
|
|
912
|
+
});
|
|
1105
913
|
}
|
|
1106
914
|
|
|
1107
915
|
// eslint-disable-next-line camelcase
|
|
1108
|
-
|
|
1109
|
-
|
|
916
|
+
aztec_utl_callUtilityFunction(...inputs: ForeignCallArgs) {
|
|
917
|
+
return callTxeHandler({
|
|
918
|
+
oracle: 'aztec_utl_callUtilityFunction',
|
|
919
|
+
inputs,
|
|
920
|
+
handler: ([contractAddress, functionSelector, args]) =>
|
|
921
|
+
this.handlerAsUtility().callUtilityFunction(contractAddress, functionSelector, args),
|
|
922
|
+
});
|
|
923
|
+
}
|
|
1110
924
|
|
|
1111
|
-
|
|
925
|
+
// AVM opcodes
|
|
1112
926
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
927
|
+
// eslint-disable-next-line camelcase
|
|
928
|
+
aztec_avm_emitPublicLog() {
|
|
929
|
+
return callTxeHandler({
|
|
930
|
+
oracle: 'aztec_avm_emitPublicLog',
|
|
931
|
+
inputs: [],
|
|
932
|
+
// TODO(#8811): Implement
|
|
933
|
+
handler: () => {},
|
|
934
|
+
});
|
|
1118
935
|
}
|
|
1119
936
|
|
|
1120
937
|
// eslint-disable-next-line camelcase
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
toSingle(instance.initializationHash),
|
|
1128
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
1129
|
-
toSingle(new Fr(1)),
|
|
1130
|
-
]);
|
|
938
|
+
aztec_avm_storageRead(...inputs: ForeignCallArgs) {
|
|
939
|
+
return callTxeHandler({
|
|
940
|
+
oracle: 'aztec_avm_storageRead',
|
|
941
|
+
inputs,
|
|
942
|
+
handler: ([slot, contractAddress]) => this.handlerAsAvm().storageRead(slot, contractAddress),
|
|
943
|
+
});
|
|
1131
944
|
}
|
|
1132
945
|
|
|
1133
946
|
// eslint-disable-next-line camelcase
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
toSingle(instance.immutablesHash),
|
|
1141
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
1142
|
-
toSingle(new Fr(1)),
|
|
1143
|
-
]);
|
|
947
|
+
aztec_avm_storageWrite(...inputs: ForeignCallArgs) {
|
|
948
|
+
return callTxeHandler({
|
|
949
|
+
oracle: 'aztec_avm_storageWrite',
|
|
950
|
+
inputs,
|
|
951
|
+
handler: ([slot, value]) => this.handlerAsAvm().storageWrite(slot, value),
|
|
952
|
+
});
|
|
1144
953
|
}
|
|
1145
954
|
|
|
1146
955
|
// eslint-disable-next-line camelcase
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
956
|
+
aztec_avm_getContractInstanceDeployer(...inputs: ForeignCallArgs) {
|
|
957
|
+
return callTxeHandler({
|
|
958
|
+
oracle: 'aztec_avm_getContractInstanceDeployer',
|
|
959
|
+
inputs,
|
|
960
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceDeployer(address),
|
|
961
|
+
});
|
|
1151
962
|
}
|
|
1152
963
|
|
|
1153
964
|
// eslint-disable-next-line camelcase
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
965
|
+
aztec_avm_getContractInstanceClassId(...inputs: ForeignCallArgs) {
|
|
966
|
+
return callTxeHandler({
|
|
967
|
+
oracle: 'aztec_avm_getContractInstanceClassId',
|
|
968
|
+
inputs,
|
|
969
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceClassId(address),
|
|
970
|
+
});
|
|
1160
971
|
}
|
|
1161
972
|
|
|
1162
973
|
// eslint-disable-next-line camelcase
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
974
|
+
aztec_avm_getContractInstanceInitializationHash(...inputs: ForeignCallArgs) {
|
|
975
|
+
return callTxeHandler({
|
|
976
|
+
oracle: 'aztec_avm_getContractInstanceInitializationHash',
|
|
977
|
+
inputs,
|
|
978
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceInitializationHash(address),
|
|
979
|
+
});
|
|
1169
980
|
}
|
|
1170
981
|
|
|
1171
982
|
// eslint-disable-next-line camelcase
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
983
|
+
aztec_avm_getContractInstanceImmutablesHash(...inputs: ForeignCallArgs) {
|
|
984
|
+
return callTxeHandler({
|
|
985
|
+
oracle: 'aztec_avm_getContractInstanceImmutablesHash',
|
|
986
|
+
inputs,
|
|
987
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceImmutablesHash(address),
|
|
988
|
+
});
|
|
1178
989
|
}
|
|
1179
990
|
|
|
1180
991
|
// eslint-disable-next-line camelcase
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
992
|
+
aztec_avm_sender() {
|
|
993
|
+
return callTxeHandler({
|
|
994
|
+
oracle: 'aztec_avm_sender',
|
|
995
|
+
inputs: [],
|
|
996
|
+
handler: () => this.handlerAsAvm().sender(),
|
|
997
|
+
});
|
|
1185
998
|
}
|
|
1186
999
|
|
|
1187
1000
|
// eslint-disable-next-line camelcase
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1001
|
+
aztec_avm_emitNullifier(...inputs: ForeignCallArgs) {
|
|
1002
|
+
return callTxeHandler({
|
|
1003
|
+
oracle: 'aztec_avm_emitNullifier',
|
|
1004
|
+
inputs,
|
|
1005
|
+
handler: ([nullifier]) => this.handlerAsAvm().emitNullifier(nullifier),
|
|
1006
|
+
});
|
|
1192
1007
|
}
|
|
1193
1008
|
|
|
1194
1009
|
// eslint-disable-next-line camelcase
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1010
|
+
aztec_avm_emitNoteHash(...inputs: ForeignCallArgs) {
|
|
1011
|
+
return callTxeHandler({
|
|
1012
|
+
oracle: 'aztec_avm_emitNoteHash',
|
|
1013
|
+
inputs,
|
|
1014
|
+
handler: ([noteHash]) => this.handlerAsAvm().emitNoteHash(noteHash),
|
|
1015
|
+
});
|
|
1199
1016
|
}
|
|
1200
1017
|
|
|
1201
1018
|
// eslint-disable-next-line camelcase
|
|
1202
|
-
|
|
1203
|
-
|
|
1019
|
+
aztec_avm_nullifierExists(...inputs: ForeignCallArgs) {
|
|
1020
|
+
return callTxeHandler({
|
|
1021
|
+
oracle: 'aztec_avm_nullifierExists',
|
|
1022
|
+
inputs,
|
|
1023
|
+
handler: ([siloedNullifier]) => this.handlerAsAvm().nullifierExists(siloedNullifier),
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1204
1026
|
|
|
1205
|
-
|
|
1027
|
+
// eslint-disable-next-line camelcase
|
|
1028
|
+
aztec_avm_address() {
|
|
1029
|
+
return callTxeHandler({
|
|
1030
|
+
oracle: 'aztec_avm_address',
|
|
1031
|
+
inputs: [],
|
|
1032
|
+
handler: () => this.handlerAsAvm().address(),
|
|
1033
|
+
});
|
|
1206
1034
|
}
|
|
1207
1035
|
|
|
1208
1036
|
// eslint-disable-next-line camelcase
|
|
1209
|
-
|
|
1210
|
-
|
|
1037
|
+
aztec_avm_blockNumber() {
|
|
1038
|
+
return callTxeHandler({
|
|
1039
|
+
oracle: 'aztec_avm_blockNumber',
|
|
1040
|
+
inputs: [],
|
|
1041
|
+
handler: () => this.handlerAsAvm().blockNumber(),
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1211
1044
|
|
|
1212
|
-
|
|
1045
|
+
// eslint-disable-next-line camelcase
|
|
1046
|
+
aztec_avm_timestamp() {
|
|
1047
|
+
return callTxeHandler({
|
|
1048
|
+
oracle: 'aztec_avm_timestamp',
|
|
1049
|
+
inputs: [],
|
|
1050
|
+
handler: () => this.handlerAsAvm().timestamp(),
|
|
1051
|
+
});
|
|
1213
1052
|
}
|
|
1214
1053
|
|
|
1215
1054
|
// eslint-disable-next-line camelcase
|
|
1216
|
-
|
|
1217
|
-
|
|
1055
|
+
aztec_avm_isStaticCall() {
|
|
1056
|
+
return callTxeHandler({
|
|
1057
|
+
oracle: 'aztec_avm_isStaticCall',
|
|
1058
|
+
inputs: [],
|
|
1059
|
+
handler: () => this.handlerAsAvm().isStaticCall(),
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1218
1062
|
|
|
1219
|
-
|
|
1063
|
+
// eslint-disable-next-line camelcase
|
|
1064
|
+
aztec_avm_chainId() {
|
|
1065
|
+
return callTxeHandler({
|
|
1066
|
+
oracle: 'aztec_avm_chainId',
|
|
1067
|
+
inputs: [],
|
|
1068
|
+
handler: () => this.handlerAsAvm().chainId(),
|
|
1069
|
+
});
|
|
1220
1070
|
}
|
|
1221
1071
|
|
|
1222
1072
|
// eslint-disable-next-line camelcase
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1073
|
+
aztec_avm_version() {
|
|
1074
|
+
return callTxeHandler({
|
|
1075
|
+
oracle: 'aztec_avm_version',
|
|
1076
|
+
inputs: [],
|
|
1077
|
+
handler: () => this.handlerAsAvm().version(),
|
|
1078
|
+
});
|
|
1226
1079
|
}
|
|
1227
1080
|
|
|
1228
1081
|
// eslint-disable-next-line camelcase
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1082
|
+
aztec_avm_returndataSize() {
|
|
1083
|
+
return callTxeHandler({
|
|
1084
|
+
oracle: 'aztec_avm_returndataSize',
|
|
1085
|
+
inputs: [],
|
|
1086
|
+
handler: () => this.handlerAsAvm().returndataSize(),
|
|
1087
|
+
});
|
|
1234
1088
|
}
|
|
1235
1089
|
|
|
1236
1090
|
// eslint-disable-next-line camelcase
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
) {
|
|
1244
|
-
const l2Gas = fromSingle(foreignL2Gas).toNumber();
|
|
1245
|
-
const daGas = fromSingle(foreignDaGas).toNumber();
|
|
1246
|
-
const address = addressFromSingle(foreignAddress);
|
|
1247
|
-
const argsLength = fromSingle(foreignLength).toNumber();
|
|
1248
|
-
const args = fromArray(foreignArgs);
|
|
1249
|
-
const result = await this.handlerAsAvm().call(l2Gas, daGas, address, argsLength, args);
|
|
1250
|
-
return toForeignCallResult([toArray(result)]);
|
|
1091
|
+
aztec_avm_returndataCopy(...inputs: ForeignCallArgs) {
|
|
1092
|
+
return callTxeHandler({
|
|
1093
|
+
oracle: 'aztec_avm_returndataCopy',
|
|
1094
|
+
inputs,
|
|
1095
|
+
handler: ([rdOffset, copySize]) => this.handlerAsAvm().returndataCopy(rdOffset, copySize),
|
|
1096
|
+
});
|
|
1251
1097
|
}
|
|
1252
1098
|
|
|
1253
1099
|
// eslint-disable-next-line camelcase
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
const l2Gas = fromSingle(foreignL2Gas).toNumber();
|
|
1262
|
-
const daGas = fromSingle(foreignDaGas).toNumber();
|
|
1263
|
-
const address = addressFromSingle(foreignAddress);
|
|
1264
|
-
const argsLength = fromSingle(foreignLength).toNumber();
|
|
1265
|
-
const args = fromArray(foreignArgs);
|
|
1266
|
-
const result = await this.handlerAsAvm().staticCall(l2Gas, daGas, address, argsLength, args);
|
|
1267
|
-
return toForeignCallResult([toArray(result)]);
|
|
1100
|
+
aztec_avm_call(...inputs: ForeignCallArgs) {
|
|
1101
|
+
return callTxeHandler({
|
|
1102
|
+
oracle: 'aztec_avm_call',
|
|
1103
|
+
inputs,
|
|
1104
|
+
handler: ([l2Gas, daGas, address, argsLength, args]) =>
|
|
1105
|
+
this.handlerAsAvm().call(l2Gas, daGas, address, argsLength, args),
|
|
1106
|
+
});
|
|
1268
1107
|
}
|
|
1269
1108
|
|
|
1270
1109
|
// eslint-disable-next-line camelcase
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1110
|
+
aztec_avm_staticCall(...inputs: ForeignCallArgs) {
|
|
1111
|
+
return callTxeHandler({
|
|
1112
|
+
oracle: 'aztec_avm_staticCall',
|
|
1113
|
+
inputs,
|
|
1114
|
+
handler: ([l2Gas, daGas, address, argsLength, args]) =>
|
|
1115
|
+
this.handlerAsAvm().staticCall(l2Gas, daGas, address, argsLength, args),
|
|
1116
|
+
});
|
|
1274
1117
|
}
|
|
1275
1118
|
|
|
1276
|
-
// TODO(F-674): Move orchestration logic into the handler so the transport layer is pure serialize→delegate→deserialize.
|
|
1277
1119
|
// eslint-disable-next-line camelcase
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
foreignIsStaticCall: ForeignCallSingle,
|
|
1286
|
-
foreignAdditionalScopes: ForeignCallArray,
|
|
1287
|
-
foreignAuthorizedUtilityCallTargets: ForeignCallArray,
|
|
1288
|
-
foreignGasSettings: ForeignCallArray,
|
|
1289
|
-
) {
|
|
1290
|
-
const from = fromSingle(foreignFromIsSome).toBool() ? addressFromSingle(foreignFromValue) : undefined;
|
|
1291
|
-
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
1292
|
-
const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
|
|
1293
|
-
const args = fromArray(foreignArgs);
|
|
1294
|
-
const argsHash = fromSingle(foreignArgsHash);
|
|
1295
|
-
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
1296
|
-
const additionalScopes = fromArray(foreignAdditionalScopes).map(field => AztecAddress.fromField(field));
|
|
1297
|
-
const authorizedUtilityCallTargets = fromArray(foreignAuthorizedUtilityCallTargets).map(field =>
|
|
1298
|
-
AztecAddress.fromField(field),
|
|
1299
|
-
);
|
|
1300
|
-
const gasSettings = GasSettings.fromFields(fromArray(foreignGasSettings));
|
|
1120
|
+
aztec_avm_successCopy() {
|
|
1121
|
+
return callTxeHandler({
|
|
1122
|
+
oracle: 'aztec_avm_successCopy',
|
|
1123
|
+
inputs: [],
|
|
1124
|
+
handler: () => this.handlerAsAvm().successCopy(),
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1301
1127
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1128
|
+
// eslint-disable-next-line camelcase
|
|
1129
|
+
aztec_txe_privateCallNewFlow(...inputs: ForeignCallArgs) {
|
|
1130
|
+
return callTxeHandler({
|
|
1131
|
+
oracle: 'aztec_txe_privateCallNewFlow',
|
|
1132
|
+
inputs,
|
|
1133
|
+
handler: ([
|
|
1304
1134
|
from,
|
|
1305
1135
|
targetContractAddress,
|
|
1306
1136
|
functionSelector,
|
|
@@ -1308,137 +1138,92 @@ export class RPCTranslator {
|
|
|
1308
1138
|
argsHash,
|
|
1309
1139
|
isStaticCall,
|
|
1310
1140
|
additionalScopes,
|
|
1311
|
-
this.stateHandler.getCurrentJob(),
|
|
1312
1141
|
authorizedUtilityCallTargets,
|
|
1313
1142
|
gasSettings,
|
|
1314
|
-
)
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
if (isStaticCall) {
|
|
1328
|
-
// Static calls revert their checkpoint and mine no block, so there is no tx hash to tag
|
|
1329
|
-
// offchain effects with. Querying `getLastTxEffects()` here would return an unrelated
|
|
1330
|
-
// predecessor tx.
|
|
1331
|
-
return { result: returnValues };
|
|
1332
|
-
}
|
|
1333
|
-
const { txHash } = await this.handlerAsTxe().getLastTxEffects();
|
|
1334
|
-
return { result: returnValues, txHash: txHash.hash };
|
|
1143
|
+
]) =>
|
|
1144
|
+
this.stateHandler.executePrivateCall(
|
|
1145
|
+
from,
|
|
1146
|
+
targetContractAddress,
|
|
1147
|
+
functionSelector,
|
|
1148
|
+
args,
|
|
1149
|
+
argsHash,
|
|
1150
|
+
isStaticCall,
|
|
1151
|
+
additionalScopes,
|
|
1152
|
+
authorizedUtilityCallTargets,
|
|
1153
|
+
gasSettings,
|
|
1154
|
+
),
|
|
1335
1155
|
});
|
|
1336
|
-
|
|
1337
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1338
1156
|
}
|
|
1339
1157
|
|
|
1340
|
-
// TODO(F-674): Move orchestration logic into the handler so the transport layer is pure serialize→delegate→deserialize.
|
|
1341
1158
|
// eslint-disable-next-line camelcase
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
const returnValues = await this.stateHandler.withTopLevelCallTracking(async () => {
|
|
1356
|
-
const returnValues = await this.handlerAsTxe().executeUtilityFunction(
|
|
1357
|
-
targetContractAddress,
|
|
1358
|
-
functionSelector,
|
|
1359
|
-
args,
|
|
1360
|
-
this.stateHandler.getCurrentJob(),
|
|
1361
|
-
authorizedUtilityCallTargets,
|
|
1362
|
-
);
|
|
1363
|
-
|
|
1364
|
-
// TODO(F-335): Avoid doing the following call here.
|
|
1365
|
-
await this.stateHandler.cycleJob();
|
|
1366
|
-
|
|
1367
|
-
return { result: returnValues };
|
|
1159
|
+
aztec_txe_executeUtilityFunction(...inputs: ForeignCallArgs) {
|
|
1160
|
+
return callTxeHandler({
|
|
1161
|
+
oracle: 'aztec_txe_executeUtilityFunction',
|
|
1162
|
+
inputs,
|
|
1163
|
+
handler: ([from, targetContractAddress, functionSelector, args, authorizedUtilityCallTargets]) =>
|
|
1164
|
+
this.stateHandler.executeUtilityFunction(
|
|
1165
|
+
from,
|
|
1166
|
+
targetContractAddress,
|
|
1167
|
+
functionSelector,
|
|
1168
|
+
args,
|
|
1169
|
+
authorizedUtilityCallTargets,
|
|
1170
|
+
),
|
|
1368
1171
|
});
|
|
1369
|
-
|
|
1370
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1371
1172
|
}
|
|
1372
1173
|
|
|
1373
|
-
// TODO(F-674): Move orchestration logic into the handler so the transport layer is pure serialize→delegate→deserialize.
|
|
1374
1174
|
// eslint-disable-next-line camelcase
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
foreignGasSettings: ForeignCallArray,
|
|
1382
|
-
) {
|
|
1383
|
-
const from = fromSingle(foreignFromIsSome).toBool() ? addressFromSingle(foreignFromValue) : undefined;
|
|
1384
|
-
const address = addressFromSingle(foreignAddress);
|
|
1385
|
-
const calldata = fromArray(foreignCalldata);
|
|
1386
|
-
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
1387
|
-
const gasSettings = GasSettings.fromFields(fromArray(foreignGasSettings));
|
|
1388
|
-
|
|
1389
|
-
const returnValues = await this.stateHandler.withTopLevelCallTracking(async () => {
|
|
1390
|
-
const returnValues = await this.handlerAsTxe().publicCallNewFlow(
|
|
1391
|
-
from,
|
|
1392
|
-
address,
|
|
1393
|
-
calldata,
|
|
1394
|
-
isStaticCall,
|
|
1395
|
-
gasSettings,
|
|
1396
|
-
);
|
|
1397
|
-
|
|
1398
|
-
// TODO(F-335): Avoid doing the following call here.
|
|
1399
|
-
await this.stateHandler.cycleJob();
|
|
1400
|
-
|
|
1401
|
-
if (isStaticCall) {
|
|
1402
|
-
// See equivalent branch in `aztec_txe_privateCallNewFlow`.
|
|
1403
|
-
return { result: returnValues };
|
|
1404
|
-
}
|
|
1405
|
-
const { txHash } = await this.handlerAsTxe().getLastTxEffects();
|
|
1406
|
-
return { result: returnValues, txHash: txHash.hash };
|
|
1175
|
+
aztec_txe_publicCallNewFlow(...inputs: ForeignCallArgs) {
|
|
1176
|
+
return callTxeHandler({
|
|
1177
|
+
oracle: 'aztec_txe_publicCallNewFlow',
|
|
1178
|
+
inputs,
|
|
1179
|
+
handler: ([from, address, calldata, isStaticCall, gasSettings]) =>
|
|
1180
|
+
this.stateHandler.executePublicCall(from, address, calldata, isStaticCall, gasSettings),
|
|
1407
1181
|
});
|
|
1408
|
-
|
|
1409
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1410
1182
|
}
|
|
1411
1183
|
|
|
1412
1184
|
// eslint-disable-next-line camelcase
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
return toForeignCallResult([toSingle(1), toSingle(senderOpt.value)]);
|
|
1420
|
-
} else {
|
|
1421
|
-
// No sender found, return Option with some=0 and value=0
|
|
1422
|
-
return toForeignCallResult([toSingle(0), toSingle(0)]);
|
|
1423
|
-
}
|
|
1185
|
+
aztec_prv_getSenderForTags() {
|
|
1186
|
+
return callTxeHandler({
|
|
1187
|
+
oracle: 'aztec_prv_getSenderForTags',
|
|
1188
|
+
inputs: [],
|
|
1189
|
+
handler: () => this.handlerAsPrivate().getSenderForTags(),
|
|
1190
|
+
});
|
|
1424
1191
|
}
|
|
1425
1192
|
|
|
1426
1193
|
// eslint-disable-next-line camelcase
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1194
|
+
aztec_prv_resolveTaggingStrategy(...inputs: ForeignCallArgs) {
|
|
1195
|
+
return callTxeHandler({
|
|
1196
|
+
oracle: 'aztec_prv_resolveTaggingStrategy',
|
|
1197
|
+
inputs,
|
|
1198
|
+
handler: ([sender, recipient, deliveryMode]) =>
|
|
1199
|
+
this.handlerAsPrivate().resolveTaggingStrategy(sender, recipient, deliveryMode),
|
|
1200
|
+
});
|
|
1434
1201
|
}
|
|
1435
1202
|
|
|
1436
1203
|
// eslint-disable-next-line camelcase
|
|
1437
|
-
|
|
1438
|
-
|
|
1204
|
+
aztec_prv_resolveCustomRequest(...inputs: ForeignCallArgs) {
|
|
1205
|
+
return callTxeHandler({
|
|
1206
|
+
oracle: 'aztec_prv_resolveCustomRequest',
|
|
1207
|
+
inputs,
|
|
1208
|
+
handler: ([kind, payload]) => this.handlerAsPrivate().resolveCustomRequest(kind, payload),
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1439
1211
|
|
|
1440
|
-
|
|
1212
|
+
// eslint-disable-next-line camelcase
|
|
1213
|
+
aztec_prv_getAppTaggingSecret(...inputs: ForeignCallArgs) {
|
|
1214
|
+
return callTxeHandler({
|
|
1215
|
+
oracle: 'aztec_prv_getAppTaggingSecret',
|
|
1216
|
+
inputs,
|
|
1217
|
+
handler: ([sender, recipient]) => this.handlerAsPrivate().getAppTaggingSecret(sender, recipient),
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1441
1220
|
|
|
1442
|
-
|
|
1221
|
+
// eslint-disable-next-line camelcase
|
|
1222
|
+
aztec_prv_getNextTaggingIndex(...inputs: ForeignCallArgs) {
|
|
1223
|
+
return callTxeHandler({
|
|
1224
|
+
oracle: 'aztec_prv_getNextTaggingIndex',
|
|
1225
|
+
inputs,
|
|
1226
|
+
handler: ([secret, deliveryMode]) => this.handlerAsPrivate().getNextTaggingIndex(secret, deliveryMode),
|
|
1227
|
+
});
|
|
1443
1228
|
}
|
|
1444
1229
|
}
|