@aztec/txe 5.0.0-private.20260318 → 5.0.0-rc.1
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-CPGFQR26.js +3 -0
- package/dest/AuthRegistry-CPGFQR26.js.map +7 -0
- package/dest/ContractClassRegistry-EHVIHGEK.js +3 -0
- package/dest/ContractClassRegistry-EHVIHGEK.js.map +7 -0
- package/dest/ContractInstanceRegistry-DWZDXHRG.js +3 -0
- package/dest/ContractInstanceRegistry-DWZDXHRG.js.map +7 -0
- package/dest/FeeJuice-MI32ZO7B.js +3 -0
- package/dest/FeeJuice-MI32ZO7B.js.map +7 -0
- package/dest/HandshakeRegistry-3KSP3ITH.js +3 -0
- package/dest/HandshakeRegistry-3KSP3ITH.js.map +7 -0
- package/dest/MultiCallEntrypoint-IU7HYFYE.js +3 -0
- package/dest/MultiCallEntrypoint-IU7HYFYE.js.map +7 -0
- package/dest/SchnorrAccount-6TUE7JX4.js +3 -0
- package/dest/SchnorrAccount-6TUE7JX4.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-S3DU2DJK.js +3 -0
- package/dest/SchnorrInitializerlessAccount-S3DU2DJK.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.d.ts +2 -0
- package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_txe_oracle_version.js +61 -0
- package/dest/bin/index.js +3 -30
- package/dest/bin/index.js.map +7 -0
- 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-5U25VAFR.js +265 -0
- package/dest/chunk-5U25VAFR.js.map +7 -0
- package/dest/chunk-BJVAAXNA.js +3 -0
- package/dest/chunk-BJVAAXNA.js.map +7 -0
- package/dest/chunk-UPW55EJX.js +304 -0
- package/dest/chunk-UPW55EJX.js.map +7 -0
- package/dest/constants.d.ts +5 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +8 -0
- package/dest/dispatcher_pool.d.ts +67 -0
- package/dest/dispatcher_pool.d.ts.map +1 -0
- package/dest/dispatcher_pool.js +286 -0
- package/dest/index.d.ts +51 -7
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +70 -190
- package/dest/metafile.json +38829 -0
- package/dest/msgpackr_fr_extension.d.ts +2 -0
- package/dest/msgpackr_fr_extension.d.ts.map +1 -0
- package/dest/msgpackr_fr_extension.js +21 -0
- package/dest/oracle/interfaces.d.ts +33 -8
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/test-resolver/fixtures.d.ts +43 -0
- package/dest/oracle/test-resolver/fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/fixtures.js +39 -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 +33 -0
- package/dest/oracle/test-resolver/resolver.d.ts +34 -0
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
- package/dest/oracle/test-resolver/resolver.js +114 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +26 -2
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +43 -1
- package/dest/oracle/txe_oracle_registry.d.ts +14 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +562 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +32 -18
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +151 -55
- package/dest/oracle/txe_oracle_version.d.ts +17 -0
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_version.js +14 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
- package/dest/oracle/txe_private_execution_oracle.js +15 -0
- package/dest/rpc_server.d.ts +14 -0
- package/dest/rpc_server.d.ts.map +1 -0
- package/dest/rpc_server.js +78 -0
- package/dest/rpc_translator.d.ts +103 -230
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +697 -616
- package/dest/server.bundle.js +3 -0
- package/dest/server.bundle.js.map +7 -0
- package/dest/state_machine/archiver.d.ts +4 -3
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +26 -15
- package/dest/state_machine/dummy_p2p_client.d.ts +14 -7
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +19 -4
- package/dest/state_machine/global_variable_builder.d.ts +9 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +9 -3
- package/dest/state_machine/index.d.ts +4 -2
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +11 -3
- package/dest/state_machine/mock_epoch_cache.d.ts +16 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +29 -2
- package/dest/state_machine/synchronizer.js +1 -1
- package/dest/txe_session.d.ts +85 -17
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +245 -40
- package/dest/utils/encoding.d.ts +191 -0
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/{util → utils}/encoding.js +7 -2
- package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
- package/dest/utils/expected_failure_error.d.ts.map +1 -0
- package/dest/{util → utils}/txe_account_store.d.ts +1 -1
- package/dest/utils/txe_account_store.d.ts.map +1 -0
- 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 +20 -0
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
- package/dest/{util → utils}/txe_public_contract_data_source.js +1 -3
- package/dest/worker.bundle.js +3 -0
- package/dest/worker.bundle.js.map +7 -0
- package/dest/worker.d.ts +2 -0
- package/dest/worker.d.ts.map +1 -0
- package/dest/worker.js +92 -0
- package/package.json +38 -21
- package/src/bin/check_txe_oracle_version.ts +70 -0
- package/src/bin/index.ts +11 -2
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +10 -0
- package/src/dispatcher_pool.ts +317 -0
- package/src/index.ts +97 -227
- package/src/msgpackr_fr_extension.ts +23 -0
- package/src/oracle/interfaces.ts +29 -7
- package/src/oracle/test-resolver/fixtures.ts +84 -0
- package/src/oracle/test-resolver/index.ts +45 -0
- package/src/oracle/test-resolver/resolver.ts +165 -0
- package/src/oracle/txe_oracle_public_context.ts +60 -0
- package/src/oracle/txe_oracle_registry.ts +401 -0
- package/src/oracle/txe_oracle_top_level_context.ts +185 -64
- package/src/oracle/txe_oracle_version.ts +17 -0
- package/src/oracle/txe_private_execution_oracle.ts +30 -0
- package/src/rpc_server.ts +87 -0
- package/src/rpc_translator.ts +767 -892
- package/src/state_machine/archiver.ts +38 -16
- package/src/state_machine/dummy_p2p_client.ts +35 -11
- package/src/state_machine/global_variable_builder.ts +18 -3
- package/src/state_machine/index.ts +17 -5
- package/src/state_machine/mock_epoch_cache.ts +38 -3
- package/src/state_machine/synchronizer.ts +1 -1
- package/src/txe_session.ts +437 -50
- package/src/{util → utils}/encoding.ts +8 -2
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/{util → utils}/txe_public_contract_data_source.ts +0 -2
- package/src/worker.ts +98 -0
- package/dest/util/encoding.d.ts +0 -720
- package/dest/util/encoding.d.ts.map +0 -1
- package/dest/util/expected_failure_error.d.ts.map +0 -1
- package/dest/util/txe_account_store.d.ts.map +0 -1
- package/dest/util/txe_public_contract_data_source.d.ts +0 -20
- package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
- /package/dest/{util → utils}/expected_failure_error.js +0 -0
- /package/dest/{util → utils}/txe_account_store.js +0 -0
- /package/src/{util → utils}/expected_failure_error.ts +0 -0
- /package/src/{util → utils}/txe_account_store.ts +0 -0
package/src/rpc_translator.ts
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
|
|
4
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
5
|
-
import {
|
|
6
|
-
type IMiscOracle,
|
|
7
|
-
type IPrivateExecutionOracle,
|
|
8
|
-
type IUtilityExecutionOracle,
|
|
9
|
-
packAsHintedNote,
|
|
10
|
-
} from '@aztec/pxe/simulator';
|
|
11
|
-
import { type ContractArtifact, EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
12
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import { BlockHash } from '@aztec/stdlib/block';
|
|
1
|
+
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
14
2
|
|
|
15
3
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
4
|
+
import { callTxeHandler } from './oracle/txe_oracle_registry.js';
|
|
16
5
|
import type { TXESessionStateHandler } from './txe_session.js';
|
|
17
|
-
import {
|
|
18
|
-
type ForeignCallArray,
|
|
19
|
-
type ForeignCallSingle,
|
|
20
|
-
addressFromSingle,
|
|
21
|
-
arrayOfArraysToBoundedVecOfArrays,
|
|
22
|
-
arrayToBoundedVec,
|
|
23
|
-
bufferToU8Array,
|
|
24
|
-
fromArray,
|
|
25
|
-
fromSingle,
|
|
26
|
-
fromUintArray,
|
|
27
|
-
fromUintBoundedVec,
|
|
28
|
-
toArray,
|
|
29
|
-
toForeignCallResult,
|
|
30
|
-
toSingle,
|
|
31
|
-
} from './util/encoding.js';
|
|
32
|
-
|
|
33
|
-
const MAX_EVENT_LEN = 10; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN
|
|
34
|
-
const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
|
|
6
|
+
import type { ForeignCallArgs } from './utils/encoding.js';
|
|
35
7
|
|
|
36
8
|
export class UnavailableOracleError extends Error {
|
|
37
9
|
constructor(oracleName: string) {
|
|
@@ -102,61 +74,54 @@ export class RPCTranslator {
|
|
|
102
74
|
return this.oracleHandler;
|
|
103
75
|
}
|
|
104
76
|
|
|
77
|
+
// eslint-disable-next-line camelcase
|
|
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
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
105
88
|
// TXE session state transition functions - these get handled by the state handler
|
|
106
89
|
|
|
107
90
|
// eslint-disable-next-line camelcase
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
aztec_txe_setTopLevelTXEContext() {
|
|
92
|
+
return callTxeHandler({
|
|
93
|
+
oracle: 'aztec_txe_setTopLevelTXEContext',
|
|
94
|
+
inputs: [],
|
|
95
|
+
handler: () => this.stateHandler.enterTopLevelState(),
|
|
96
|
+
});
|
|
112
97
|
}
|
|
113
98
|
|
|
114
99
|
// eslint-disable-next-line camelcase
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
? AztecAddress.fromField(fromSingle(foreignContractAddressValue))
|
|
123
|
-
: undefined;
|
|
124
|
-
|
|
125
|
-
const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool()
|
|
126
|
-
? BlockNumber(fromSingle(foreignAnchorBlockNumberValue).toNumber())
|
|
127
|
-
: undefined;
|
|
128
|
-
|
|
129
|
-
const privateContextInputs = await this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber);
|
|
130
|
-
|
|
131
|
-
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
|
+
});
|
|
132
107
|
}
|
|
133
108
|
|
|
134
109
|
// eslint-disable-next-line camelcase
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
: undefined;
|
|
142
|
-
|
|
143
|
-
await this.stateHandler.enterPublicState(contractAddress);
|
|
144
|
-
|
|
145
|
-
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
|
+
});
|
|
146
116
|
}
|
|
147
117
|
|
|
148
118
|
// eslint-disable-next-line camelcase
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
: undefined;
|
|
156
|
-
|
|
157
|
-
await this.stateHandler.enterUtilityState(contractAddress);
|
|
158
|
-
|
|
159
|
-
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
|
+
});
|
|
160
125
|
}
|
|
161
126
|
|
|
162
127
|
// Other oracles - these get handled by the oracle handler
|
|
@@ -165,1054 +130,964 @@ export class RPCTranslator {
|
|
|
165
130
|
|
|
166
131
|
// eslint-disable-next-line camelcase
|
|
167
132
|
aztec_txe_getDefaultAddress() {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
133
|
+
return callTxeHandler({
|
|
134
|
+
oracle: 'aztec_txe_getDefaultAddress',
|
|
135
|
+
inputs: [],
|
|
136
|
+
handler: () => this.handlerAsTxe().getDefaultAddress(),
|
|
137
|
+
});
|
|
171
138
|
}
|
|
172
139
|
|
|
173
140
|
// eslint-disable-next-line camelcase
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
141
|
+
aztec_txe_getNextBlockNumber() {
|
|
142
|
+
return callTxeHandler({
|
|
143
|
+
oracle: 'aztec_txe_getNextBlockNumber',
|
|
144
|
+
inputs: [],
|
|
145
|
+
handler: () => this.handlerAsTxe().getNextBlockNumber(),
|
|
146
|
+
});
|
|
178
147
|
}
|
|
179
148
|
|
|
180
149
|
// eslint-disable-next-line camelcase
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
150
|
+
aztec_txe_getNextBlockTimestamp() {
|
|
151
|
+
return callTxeHandler({
|
|
152
|
+
oracle: 'aztec_txe_getNextBlockTimestamp',
|
|
153
|
+
inputs: [],
|
|
154
|
+
handler: () => this.handlerAsTxe().getNextBlockTimestamp(),
|
|
155
|
+
});
|
|
185
156
|
}
|
|
186
157
|
|
|
187
158
|
// eslint-disable-next-line camelcase
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
159
|
+
aztec_txe_advanceBlocksBy(...inputs: ForeignCallArgs) {
|
|
160
|
+
return callTxeHandler({
|
|
161
|
+
oracle: 'aztec_txe_advanceBlocksBy',
|
|
162
|
+
inputs,
|
|
163
|
+
handler: ([blocks]) => this.handlerAsTxe().advanceBlocksBy(blocks),
|
|
164
|
+
});
|
|
194
165
|
}
|
|
195
166
|
|
|
196
167
|
// eslint-disable-next-line camelcase
|
|
197
|
-
aztec_txe_advanceTimestampBy(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
168
|
+
aztec_txe_advanceTimestampBy(...inputs: ForeignCallArgs) {
|
|
169
|
+
return callTxeHandler({
|
|
170
|
+
oracle: 'aztec_txe_advanceTimestampBy',
|
|
171
|
+
inputs,
|
|
172
|
+
handler: ([duration]) => this.handlerAsTxe().advanceTimestampBy(duration),
|
|
173
|
+
});
|
|
203
174
|
}
|
|
204
175
|
|
|
205
176
|
// eslint-disable-next-line camelcase
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
await this.handlerAsTxe().deploy(artifact, instance, secret);
|
|
214
|
-
|
|
215
|
-
return toForeignCallResult([
|
|
216
|
-
toArray([
|
|
217
|
-
instance.salt,
|
|
218
|
-
instance.deployer.toField(),
|
|
219
|
-
instance.currentContractClassId,
|
|
220
|
-
instance.initializationHash,
|
|
221
|
-
...instance.publicKeys.toFields(),
|
|
222
|
-
]),
|
|
223
|
-
]);
|
|
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
|
+
});
|
|
224
184
|
}
|
|
225
185
|
|
|
226
186
|
// eslint-disable-next-line camelcase
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
toSingle(completeAddress.address),
|
|
234
|
-
...completeAddress.publicKeys.toFields().map(toSingle),
|
|
235
|
-
]);
|
|
187
|
+
aztec_txe_createAccount(...inputs: ForeignCallArgs) {
|
|
188
|
+
return callTxeHandler({
|
|
189
|
+
oracle: 'aztec_txe_createAccount',
|
|
190
|
+
inputs,
|
|
191
|
+
handler: ([secret]) => this.handlerAsTxe().createAccount(secret),
|
|
192
|
+
});
|
|
236
193
|
}
|
|
237
194
|
|
|
238
195
|
// eslint-disable-next-line camelcase
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const completeAddress = await this.handlerAsTxe().addAccount(artifact, instance, secret);
|
|
247
|
-
|
|
248
|
-
return toForeignCallResult([
|
|
249
|
-
toSingle(completeAddress.address),
|
|
250
|
-
...completeAddress.publicKeys.toFields().map(toSingle),
|
|
251
|
-
]);
|
|
196
|
+
aztec_txe_addAccount(...inputs: ForeignCallArgs) {
|
|
197
|
+
return callTxeHandler({
|
|
198
|
+
oracle: 'aztec_txe_addAccount',
|
|
199
|
+
inputs,
|
|
200
|
+
handler: ([secret]) => this.handlerAsTxe().addAccount(secret),
|
|
201
|
+
});
|
|
252
202
|
}
|
|
253
203
|
|
|
254
204
|
// eslint-disable-next-line camelcase
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
return toForeignCallResult([]);
|
|
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
|
+
});
|
|
262
211
|
}
|
|
263
212
|
|
|
264
213
|
// PXE oracles
|
|
265
214
|
|
|
266
215
|
// eslint-disable-next-line camelcase
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
216
|
+
aztec_misc_assertCompatibleOracleVersion(...inputs: ForeignCallArgs) {
|
|
217
|
+
return callTxeHandler({
|
|
218
|
+
oracle: 'aztec_misc_assertCompatibleOracleVersion',
|
|
219
|
+
inputs,
|
|
220
|
+
handler: ([major, minor]) => this.handlerAsMisc().assertCompatibleOracleVersion(major, minor),
|
|
221
|
+
});
|
|
273
222
|
}
|
|
274
223
|
|
|
275
224
|
// eslint-disable-next-line camelcase
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
225
|
+
aztec_misc_getRandomField() {
|
|
226
|
+
return callTxeHandler({
|
|
227
|
+
oracle: 'aztec_misc_getRandomField',
|
|
228
|
+
inputs: [],
|
|
229
|
+
handler: () => this.handlerAsMisc().getRandomField(),
|
|
230
|
+
});
|
|
280
231
|
}
|
|
281
232
|
|
|
282
233
|
// eslint-disable-next-line camelcase
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
234
|
+
aztec_txe_getLastBlockTimestamp() {
|
|
235
|
+
return callTxeHandler({
|
|
236
|
+
oracle: 'aztec_txe_getLastBlockTimestamp',
|
|
237
|
+
inputs: [],
|
|
238
|
+
handler: () => this.handlerAsTxe().getLastBlockTimestamp(),
|
|
239
|
+
});
|
|
287
240
|
}
|
|
288
241
|
|
|
289
242
|
// eslint-disable-next-line camelcase
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
...arrayToBoundedVec(toArray(nullifiers), MAX_NULLIFIERS_PER_TX),
|
|
297
|
-
]);
|
|
243
|
+
aztec_txe_getLastTxEffects() {
|
|
244
|
+
return callTxeHandler({
|
|
245
|
+
oracle: 'aztec_txe_getLastTxEffects',
|
|
246
|
+
inputs: [],
|
|
247
|
+
handler: () => this.handlerAsTxe().getLastTxEffects(),
|
|
248
|
+
});
|
|
298
249
|
}
|
|
299
250
|
|
|
300
251
|
// eslint-disable-next-line camelcase
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
308
|
-
const scope = addressFromSingle(foreignScope);
|
|
309
|
-
|
|
310
|
-
// TODO(F-335): Avoid doing the following 2 calls here.
|
|
311
|
-
{
|
|
312
|
-
await this.handlerAsTxe().syncContractNonOracleMethod(contractAddress, scope, this.stateHandler.getCurrentJob());
|
|
313
|
-
// We cycle job to commit the stores after the contract sync.
|
|
314
|
-
await this.stateHandler.cycleJob();
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const events = await this.handlerAsTxe().getPrivateEvents(selector, contractAddress, scope);
|
|
318
|
-
|
|
319
|
-
if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
|
|
320
|
-
throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (events.some(e => e.length > MAX_EVENT_LEN)) {
|
|
324
|
-
throw new Error(`Some private event has length larger than maxLen ${MAX_EVENT_LEN}`);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// This is a workaround as Noir does not currently let us return nested structs with arrays. We instead return a raw
|
|
328
|
-
// multidimensional array in get_private_events_oracle and create the BoundedVecs here.
|
|
329
|
-
const rawArrayStorage = events
|
|
330
|
-
.map(e => e.concat(Array(MAX_EVENT_LEN - e.length).fill(new Fr(0))))
|
|
331
|
-
.concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(Array(MAX_EVENT_LEN).fill(new Fr(0))))
|
|
332
|
-
.flat();
|
|
333
|
-
const eventLengths = events
|
|
334
|
-
.map(e => new Fr(e.length))
|
|
335
|
-
.concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(new Fr(0)));
|
|
336
|
-
const queryLength = new Fr(events.length);
|
|
337
|
-
|
|
338
|
-
return toForeignCallResult([toArray(rawArrayStorage), toArray(eventLengths), toSingle(queryLength)]);
|
|
252
|
+
aztec_txe_getLastCallOffchainEffects() {
|
|
253
|
+
return callTxeHandler({
|
|
254
|
+
oracle: 'aztec_txe_getLastCallOffchainEffects',
|
|
255
|
+
inputs: [],
|
|
256
|
+
handler: () => this.stateHandler.getLastCallOffchainEffects(),
|
|
257
|
+
});
|
|
339
258
|
}
|
|
340
259
|
|
|
341
260
|
// eslint-disable-next-line camelcase
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return toForeignCallResult([]);
|
|
261
|
+
aztec_txe_getLastCallContext() {
|
|
262
|
+
return callTxeHandler({
|
|
263
|
+
oracle: 'aztec_txe_getLastCallContext',
|
|
264
|
+
inputs: [],
|
|
265
|
+
handler: () => this.stateHandler.getLastCallContext(),
|
|
266
|
+
});
|
|
349
267
|
}
|
|
350
268
|
|
|
351
269
|
// eslint-disable-next-line camelcase
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
270
|
+
aztec_txe_getPrivateEvents(...inputs: ForeignCallArgs) {
|
|
271
|
+
return callTxeHandler({
|
|
272
|
+
oracle: 'aztec_txe_getPrivateEvents',
|
|
273
|
+
inputs,
|
|
274
|
+
handler: ([selector, contractAddress, scope]) =>
|
|
275
|
+
this.stateHandler.getPrivateEvents(selector, contractAddress, scope),
|
|
276
|
+
});
|
|
358
277
|
}
|
|
359
278
|
|
|
360
|
-
// When the argument is a slice, noir automatically adds a length field to oracle call.
|
|
361
|
-
// When the argument is an array, we add the field length manually to the signature.
|
|
362
279
|
// eslint-disable-next-line camelcase
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const level = fromSingle(foreignLevel).toNumber();
|
|
370
|
-
const message = fromArray(foreignMessage)
|
|
371
|
-
.map(field => String.fromCharCode(field.toNumber()))
|
|
372
|
-
.join('');
|
|
373
|
-
const fields = fromArray(foreignFields);
|
|
374
|
-
|
|
375
|
-
await this.handlerAsMisc().log(level, message, fields);
|
|
376
|
-
|
|
377
|
-
return toForeignCallResult([]);
|
|
280
|
+
aztec_prv_setHashPreimage(...inputs: ForeignCallArgs) {
|
|
281
|
+
return callTxeHandler({
|
|
282
|
+
oracle: 'aztec_prv_setHashPreimage',
|
|
283
|
+
inputs,
|
|
284
|
+
handler: ([values, hash]) => this.handlerAsPrivate().setHashPreimage(values, hash),
|
|
285
|
+
});
|
|
378
286
|
}
|
|
379
287
|
|
|
380
288
|
// eslint-disable-next-line camelcase
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
388
|
-
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
389
|
-
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
390
|
-
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
391
|
-
|
|
392
|
-
const values = await this.handlerAsUtility().storageRead(
|
|
393
|
-
blockHash,
|
|
394
|
-
contractAddress,
|
|
395
|
-
startStorageSlot,
|
|
396
|
-
numberOfElements,
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
return toForeignCallResult([toArray(values)]);
|
|
289
|
+
aztec_prv_getHashPreimage(...inputs: ForeignCallArgs) {
|
|
290
|
+
return callTxeHandler({
|
|
291
|
+
oracle: 'aztec_prv_getHashPreimage',
|
|
292
|
+
inputs,
|
|
293
|
+
handler: ([hash]) => this.handlerAsPrivate().getHashPreimage(hash),
|
|
294
|
+
});
|
|
400
295
|
}
|
|
401
296
|
|
|
402
297
|
// eslint-disable-next-line camelcase
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (!witness) {
|
|
410
|
-
throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
|
|
411
|
-
}
|
|
412
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// eslint-disable-next-line camelcase
|
|
416
|
-
async aztec_utl_getNotes(
|
|
417
|
-
foreignOwnerIsSome: ForeignCallSingle,
|
|
418
|
-
foreignOwnerValue: ForeignCallSingle,
|
|
419
|
-
foreignStorageSlot: ForeignCallSingle,
|
|
420
|
-
foreignNumSelects: ForeignCallSingle,
|
|
421
|
-
foreignSelectByIndexes: ForeignCallArray,
|
|
422
|
-
foreignSelectByOffsets: ForeignCallArray,
|
|
423
|
-
foreignSelectByLengths: ForeignCallArray,
|
|
424
|
-
foreignSelectValues: ForeignCallArray,
|
|
425
|
-
foreignSelectComparators: ForeignCallArray,
|
|
426
|
-
foreignSortByIndexes: ForeignCallArray,
|
|
427
|
-
foreignSortByOffsets: ForeignCallArray,
|
|
428
|
-
foreignSortByLengths: ForeignCallArray,
|
|
429
|
-
foreignSortOrder: ForeignCallArray,
|
|
430
|
-
foreignLimit: ForeignCallSingle,
|
|
431
|
-
foreignOffset: ForeignCallSingle,
|
|
432
|
-
foreignStatus: ForeignCallSingle,
|
|
433
|
-
foreignMaxNotes: ForeignCallSingle,
|
|
434
|
-
foreignPackedHintedNoteLength: ForeignCallSingle,
|
|
435
|
-
) {
|
|
436
|
-
// Parse Option<AztecAddress>: ownerIsSome is 0 for None, 1 for Some
|
|
437
|
-
const owner = fromSingle(foreignOwnerIsSome).toBool()
|
|
438
|
-
? AztecAddress.fromField(fromSingle(foreignOwnerValue))
|
|
439
|
-
: undefined;
|
|
440
|
-
const storageSlot = fromSingle(foreignStorageSlot);
|
|
441
|
-
const numSelects = fromSingle(foreignNumSelects).toNumber();
|
|
442
|
-
const selectByIndexes = fromArray(foreignSelectByIndexes).map(fr => fr.toNumber());
|
|
443
|
-
const selectByOffsets = fromArray(foreignSelectByOffsets).map(fr => fr.toNumber());
|
|
444
|
-
const selectByLengths = fromArray(foreignSelectByLengths).map(fr => fr.toNumber());
|
|
445
|
-
const selectValues = fromArray(foreignSelectValues);
|
|
446
|
-
const selectComparators = fromArray(foreignSelectComparators).map(fr => fr.toNumber());
|
|
447
|
-
const sortByIndexes = fromArray(foreignSortByIndexes).map(fr => fr.toNumber());
|
|
448
|
-
const sortByOffsets = fromArray(foreignSortByOffsets).map(fr => fr.toNumber());
|
|
449
|
-
const sortByLengths = fromArray(foreignSortByLengths).map(fr => fr.toNumber());
|
|
450
|
-
const sortOrder = fromArray(foreignSortOrder).map(fr => fr.toNumber());
|
|
451
|
-
const limit = fromSingle(foreignLimit).toNumber();
|
|
452
|
-
const offset = fromSingle(foreignOffset).toNumber();
|
|
453
|
-
const status = fromSingle(foreignStatus).toNumber();
|
|
454
|
-
const maxNotes = fromSingle(foreignMaxNotes).toNumber();
|
|
455
|
-
const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
|
|
456
|
-
|
|
457
|
-
const noteDatas = await this.handlerAsUtility().getNotes(
|
|
458
|
-
owner,
|
|
459
|
-
storageSlot,
|
|
460
|
-
numSelects,
|
|
461
|
-
selectByIndexes,
|
|
462
|
-
selectByOffsets,
|
|
463
|
-
selectByLengths,
|
|
464
|
-
selectValues,
|
|
465
|
-
selectComparators,
|
|
466
|
-
sortByIndexes,
|
|
467
|
-
sortByOffsets,
|
|
468
|
-
sortByLengths,
|
|
469
|
-
sortOrder,
|
|
470
|
-
limit,
|
|
471
|
-
offset,
|
|
472
|
-
status,
|
|
473
|
-
);
|
|
474
|
-
|
|
475
|
-
const returnDataAsArrayOfArrays = noteDatas.map(noteData =>
|
|
476
|
-
packAsHintedNote({
|
|
477
|
-
contractAddress: noteData.contractAddress,
|
|
478
|
-
owner: noteData.owner,
|
|
479
|
-
randomness: noteData.randomness,
|
|
480
|
-
storageSlot: noteData.storageSlot,
|
|
481
|
-
noteNonce: noteData.noteNonce,
|
|
482
|
-
isPending: noteData.isPending,
|
|
483
|
-
note: noteData.note,
|
|
484
|
-
}),
|
|
485
|
-
);
|
|
486
|
-
|
|
487
|
-
// Now we convert each sub-array to an array of ForeignCallSingles
|
|
488
|
-
const returnDataAsArrayOfForeignCallSingleArrays = returnDataAsArrayOfArrays.map(subArray =>
|
|
489
|
-
subArray.map(toSingle),
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
// At last we convert the array of arrays to a bounded vec of arrays
|
|
493
|
-
return toForeignCallResult(
|
|
494
|
-
arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes, packedHintedNoteLength),
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// eslint-disable-next-line camelcase
|
|
499
|
-
aztec_prv_notifyCreatedNote(
|
|
500
|
-
foreignOwner: ForeignCallSingle,
|
|
501
|
-
foreignStorageSlot: ForeignCallSingle,
|
|
502
|
-
foreignRandomness: ForeignCallSingle,
|
|
503
|
-
foreignNoteTypeId: ForeignCallSingle,
|
|
504
|
-
foreignNote: ForeignCallArray,
|
|
505
|
-
foreignNoteHash: ForeignCallSingle,
|
|
506
|
-
foreignCounter: ForeignCallSingle,
|
|
507
|
-
) {
|
|
508
|
-
const owner = addressFromSingle(foreignOwner);
|
|
509
|
-
const storageSlot = fromSingle(foreignStorageSlot);
|
|
510
|
-
const randomness = fromSingle(foreignRandomness);
|
|
511
|
-
const noteTypeId = NoteSelector.fromField(fromSingle(foreignNoteTypeId));
|
|
512
|
-
const note = fromArray(foreignNote);
|
|
513
|
-
const noteHash = fromSingle(foreignNoteHash);
|
|
514
|
-
const counter = fromSingle(foreignCounter).toNumber();
|
|
515
|
-
|
|
516
|
-
this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter);
|
|
517
|
-
|
|
518
|
-
return toForeignCallResult([]);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// eslint-disable-next-line camelcase
|
|
522
|
-
async aztec_prv_notifyNullifiedNote(
|
|
523
|
-
foreignInnerNullifier: ForeignCallSingle,
|
|
524
|
-
foreignNoteHash: ForeignCallSingle,
|
|
525
|
-
foreignCounter: ForeignCallSingle,
|
|
526
|
-
) {
|
|
527
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
528
|
-
const noteHash = fromSingle(foreignNoteHash);
|
|
529
|
-
const counter = fromSingle(foreignCounter).toNumber();
|
|
530
|
-
|
|
531
|
-
await this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter);
|
|
532
|
-
|
|
533
|
-
return toForeignCallResult([]);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// eslint-disable-next-line camelcase
|
|
537
|
-
async aztec_prv_notifyCreatedNullifier(foreignInnerNullifier: ForeignCallSingle) {
|
|
538
|
-
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
539
|
-
|
|
540
|
-
await this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier);
|
|
541
|
-
|
|
542
|
-
return toForeignCallResult([]);
|
|
298
|
+
aztec_misc_log(...inputs: ForeignCallArgs) {
|
|
299
|
+
return callTxeHandler({
|
|
300
|
+
oracle: 'aztec_misc_log',
|
|
301
|
+
inputs,
|
|
302
|
+
handler: ([level, message, fieldsSize, fields]) => this.handlerAsMisc().log(level, message, fieldsSize, fields),
|
|
303
|
+
});
|
|
543
304
|
}
|
|
544
305
|
|
|
545
306
|
// eslint-disable-next-line camelcase
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
const isPending = await this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress);
|
|
554
|
-
|
|
555
|
-
return toForeignCallResult([toSingle(new Fr(isPending))]);
|
|
307
|
+
aztec_utl_getFromPublicStorage(...inputs: ForeignCallArgs) {
|
|
308
|
+
return callTxeHandler({
|
|
309
|
+
oracle: 'aztec_utl_getFromPublicStorage',
|
|
310
|
+
inputs,
|
|
311
|
+
handler: ([blockHash, contractAddress, startStorageSlot, numberOfElements]) =>
|
|
312
|
+
this.handlerAsUtility().getFromPublicStorage(blockHash, contractAddress, startStorageSlot, numberOfElements),
|
|
313
|
+
});
|
|
556
314
|
}
|
|
557
315
|
|
|
558
316
|
// eslint-disable-next-line camelcase
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
317
|
+
aztec_utl_getPublicDataWitness(...inputs: ForeignCallArgs) {
|
|
318
|
+
return callTxeHandler({
|
|
319
|
+
oracle: 'aztec_utl_getPublicDataWitness',
|
|
320
|
+
inputs,
|
|
321
|
+
handler: ([blockHash, leafSlot]) => this.handlerAsUtility().getPublicDataWitness(blockHash, leafSlot),
|
|
322
|
+
});
|
|
565
323
|
}
|
|
566
324
|
|
|
567
325
|
// eslint-disable-next-line camelcase
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
326
|
+
aztec_utl_getNotes(...inputs: ForeignCallArgs) {
|
|
327
|
+
return callTxeHandler({
|
|
328
|
+
oracle: 'aztec_utl_getNotes',
|
|
329
|
+
inputs,
|
|
330
|
+
handler: ([
|
|
331
|
+
owner,
|
|
332
|
+
storageSlot,
|
|
333
|
+
numSelects,
|
|
334
|
+
selectByIndexes,
|
|
335
|
+
selectByOffsets,
|
|
336
|
+
selectByLengths,
|
|
337
|
+
selectValues,
|
|
338
|
+
selectComparators,
|
|
339
|
+
sortByIndexes,
|
|
340
|
+
sortByOffsets,
|
|
341
|
+
sortByLengths,
|
|
342
|
+
sortOrder,
|
|
343
|
+
limit,
|
|
344
|
+
offset,
|
|
345
|
+
status,
|
|
346
|
+
maxNotes,
|
|
347
|
+
packedHintedNoteLength,
|
|
348
|
+
]) =>
|
|
349
|
+
this.handlerAsUtility().getNotes(
|
|
350
|
+
owner,
|
|
351
|
+
storageSlot,
|
|
352
|
+
numSelects,
|
|
353
|
+
selectByIndexes,
|
|
354
|
+
selectByOffsets,
|
|
355
|
+
selectByLengths,
|
|
356
|
+
selectValues,
|
|
357
|
+
selectComparators,
|
|
358
|
+
sortByIndexes,
|
|
359
|
+
sortByOffsets,
|
|
360
|
+
sortByLengths,
|
|
361
|
+
sortOrder,
|
|
362
|
+
limit,
|
|
363
|
+
offset,
|
|
364
|
+
status,
|
|
365
|
+
maxNotes,
|
|
366
|
+
packedHintedNoteLength,
|
|
367
|
+
),
|
|
368
|
+
});
|
|
582
369
|
}
|
|
583
370
|
|
|
584
371
|
// eslint-disable-next-line camelcase
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
if (result === undefined) {
|
|
593
|
-
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
594
|
-
return toForeignCallResult([toSingle(new Fr(0)), toArray(Array(13).fill(new Fr(0)))]);
|
|
595
|
-
} else {
|
|
596
|
-
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
597
|
-
return toForeignCallResult([
|
|
598
|
-
toSingle(new Fr(1)),
|
|
599
|
-
toArray([...result.publicKeys.toFields(), result.partialAddress]),
|
|
600
|
-
]);
|
|
601
|
-
}
|
|
372
|
+
aztec_prv_notifyCreatedNote(...inputs: ForeignCallArgs) {
|
|
373
|
+
return callTxeHandler({
|
|
374
|
+
oracle: 'aztec_prv_notifyCreatedNote',
|
|
375
|
+
inputs,
|
|
376
|
+
handler: ([owner, storageSlot, randomness, noteTypeId, note, noteHash, counter]) =>
|
|
377
|
+
this.handlerAsPrivate().notifyCreatedNote(owner, storageSlot, randomness, noteTypeId, note, noteHash, counter),
|
|
378
|
+
});
|
|
602
379
|
}
|
|
603
380
|
|
|
604
381
|
// eslint-disable-next-line camelcase
|
|
605
|
-
|
|
606
|
-
|
|
382
|
+
aztec_prv_notifyNullifiedNote(...inputs: ForeignCallArgs) {
|
|
383
|
+
return callTxeHandler({
|
|
384
|
+
oracle: 'aztec_prv_notifyNullifiedNote',
|
|
385
|
+
inputs,
|
|
386
|
+
handler: ([innerNullifier, noteHash, counter]) =>
|
|
387
|
+
this.handlerAsPrivate().notifyNullifiedNote(innerNullifier, noteHash, counter),
|
|
388
|
+
});
|
|
389
|
+
}
|
|
607
390
|
|
|
608
|
-
|
|
391
|
+
// eslint-disable-next-line camelcase
|
|
392
|
+
aztec_prv_notifyCreatedNullifier(...inputs: ForeignCallArgs) {
|
|
393
|
+
return callTxeHandler({
|
|
394
|
+
oracle: 'aztec_prv_notifyCreatedNullifier',
|
|
395
|
+
inputs,
|
|
396
|
+
handler: ([innerNullifier]) => this.handlerAsPrivate().notifyCreatedNullifier(innerNullifier),
|
|
397
|
+
});
|
|
398
|
+
}
|
|
609
399
|
|
|
610
|
-
|
|
400
|
+
// eslint-disable-next-line camelcase
|
|
401
|
+
aztec_prv_isNullifierPending(...inputs: ForeignCallArgs) {
|
|
402
|
+
return callTxeHandler({
|
|
403
|
+
oracle: 'aztec_prv_isNullifierPending',
|
|
404
|
+
inputs,
|
|
405
|
+
handler: ([innerNullifier, contractAddress]) =>
|
|
406
|
+
this.handlerAsPrivate().isNullifierPending(innerNullifier, contractAddress),
|
|
407
|
+
});
|
|
611
408
|
}
|
|
612
409
|
|
|
613
410
|
// eslint-disable-next-line camelcase
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
) {
|
|
621
|
-
throw new Error(
|
|
622
|
-
'Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead',
|
|
623
|
-
);
|
|
411
|
+
aztec_utl_doesNullifierExist(...inputs: ForeignCallArgs) {
|
|
412
|
+
return callTxeHandler({
|
|
413
|
+
oracle: 'aztec_utl_doesNullifierExist',
|
|
414
|
+
inputs,
|
|
415
|
+
handler: ([innerNullifier]) => this.handlerAsUtility().doesNullifierExist(innerNullifier),
|
|
416
|
+
});
|
|
624
417
|
}
|
|
625
418
|
|
|
626
419
|
// eslint-disable-next-line camelcase
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
420
|
+
aztec_utl_getContractInstance(...inputs: ForeignCallArgs) {
|
|
421
|
+
return callTxeHandler({
|
|
422
|
+
oracle: 'aztec_utl_getContractInstance',
|
|
423
|
+
inputs,
|
|
424
|
+
handler: ([address]) => this.handlerAsUtility().getContractInstance(address),
|
|
425
|
+
});
|
|
426
|
+
}
|
|
633
427
|
|
|
634
|
-
|
|
428
|
+
// eslint-disable-next-line camelcase
|
|
429
|
+
aztec_utl_getPublicKeysAndPartialAddress(...inputs: ForeignCallArgs) {
|
|
430
|
+
return callTxeHandler({
|
|
431
|
+
oracle: 'aztec_utl_getPublicKeysAndPartialAddress',
|
|
432
|
+
inputs,
|
|
433
|
+
handler: ([address]) => this.handlerAsUtility().getPublicKeysAndPartialAddress(address),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
635
436
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
437
|
+
// eslint-disable-next-line camelcase
|
|
438
|
+
aztec_utl_getKeyValidationRequest(...inputs: ForeignCallArgs) {
|
|
439
|
+
return callTxeHandler({
|
|
440
|
+
oracle: 'aztec_utl_getKeyValidationRequest',
|
|
441
|
+
inputs,
|
|
442
|
+
handler: ([pkMHash]) => this.handlerAsUtility().getKeyValidationRequest(pkMHash),
|
|
443
|
+
});
|
|
640
444
|
}
|
|
641
445
|
|
|
642
446
|
// eslint-disable-next-line camelcase
|
|
643
|
-
|
|
644
|
-
|
|
447
|
+
aztec_prv_callPrivateFunction(...inputs: ForeignCallArgs) {
|
|
448
|
+
return callTxeHandler({
|
|
449
|
+
oracle: 'aztec_prv_callPrivateFunction',
|
|
450
|
+
inputs,
|
|
451
|
+
handler: ([contractAddress, functionSelector, argsHash, sideEffectCounter, isStaticCall]) =>
|
|
452
|
+
this.handlerAsPrivate().callPrivateFunction(
|
|
453
|
+
contractAddress,
|
|
454
|
+
functionSelector,
|
|
455
|
+
argsHash,
|
|
456
|
+
sideEffectCounter,
|
|
457
|
+
isStaticCall,
|
|
458
|
+
),
|
|
459
|
+
});
|
|
460
|
+
}
|
|
645
461
|
|
|
646
|
-
|
|
462
|
+
// eslint-disable-next-line camelcase
|
|
463
|
+
aztec_utl_getNullifierMembershipWitness(...inputs: ForeignCallArgs) {
|
|
464
|
+
return callTxeHandler({
|
|
465
|
+
oracle: 'aztec_utl_getNullifierMembershipWitness',
|
|
466
|
+
inputs,
|
|
467
|
+
handler: ([blockHash, nullifier]) => this.handlerAsUtility().getNullifierMembershipWitness(blockHash, nullifier),
|
|
468
|
+
});
|
|
469
|
+
}
|
|
647
470
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
471
|
+
// eslint-disable-next-line camelcase
|
|
472
|
+
aztec_utl_getAuthWitness(...inputs: ForeignCallArgs) {
|
|
473
|
+
return callTxeHandler({
|
|
474
|
+
oracle: 'aztec_utl_getAuthWitness',
|
|
475
|
+
inputs,
|
|
476
|
+
handler: ([messageHash]) => this.handlerAsUtility().getAuthWitness(messageHash),
|
|
477
|
+
});
|
|
652
478
|
}
|
|
653
479
|
|
|
654
480
|
// eslint-disable-next-line camelcase
|
|
655
|
-
|
|
656
|
-
|
|
481
|
+
aztec_prv_assertValidPublicCalldata(...inputs: ForeignCallArgs) {
|
|
482
|
+
return callTxeHandler({
|
|
483
|
+
oracle: 'aztec_prv_assertValidPublicCalldata',
|
|
484
|
+
inputs,
|
|
485
|
+
handler: ([calldataHash]) => this.handlerAsPrivate().assertValidPublicCalldata(calldataHash),
|
|
486
|
+
});
|
|
657
487
|
}
|
|
658
488
|
|
|
659
489
|
// eslint-disable-next-line camelcase
|
|
660
|
-
|
|
661
|
-
|
|
490
|
+
aztec_prv_notifyRevertiblePhaseStart(...inputs: ForeignCallArgs) {
|
|
491
|
+
return callTxeHandler({
|
|
492
|
+
oracle: 'aztec_prv_notifyRevertiblePhaseStart',
|
|
493
|
+
inputs,
|
|
494
|
+
handler: ([minRevertibleSideEffectCounter]) =>
|
|
495
|
+
this.handlerAsPrivate().notifyRevertiblePhaseStart(minRevertibleSideEffectCounter),
|
|
496
|
+
});
|
|
662
497
|
}
|
|
663
498
|
|
|
664
499
|
// eslint-disable-next-line camelcase
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
500
|
+
aztec_prv_isExecutionInRevertiblePhase(...inputs: ForeignCallArgs) {
|
|
501
|
+
return callTxeHandler({
|
|
502
|
+
oracle: 'aztec_prv_isExecutionInRevertiblePhase',
|
|
503
|
+
inputs,
|
|
504
|
+
handler: ([sideEffectCounter]) => this.handlerAsPrivate().isExecutionInRevertiblePhase(sideEffectCounter),
|
|
505
|
+
});
|
|
669
506
|
}
|
|
670
507
|
|
|
671
508
|
// eslint-disable-next-line camelcase
|
|
672
509
|
aztec_utl_getUtilityContext() {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
510
|
+
return callTxeHandler({
|
|
511
|
+
oracle: 'aztec_utl_getUtilityContext',
|
|
512
|
+
inputs: [],
|
|
513
|
+
handler: () => this.handlerAsUtility().getUtilityContext(),
|
|
514
|
+
});
|
|
676
515
|
}
|
|
677
516
|
|
|
678
517
|
// eslint-disable-next-line camelcase
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
throw new Error(`Block header not found for block ${blockNumber}.`);
|
|
686
|
-
}
|
|
687
|
-
return toForeignCallResult(header.toFields().map(toSingle));
|
|
518
|
+
aztec_utl_getBlockHeader(...inputs: ForeignCallArgs) {
|
|
519
|
+
return callTxeHandler({
|
|
520
|
+
oracle: 'aztec_utl_getBlockHeader',
|
|
521
|
+
inputs,
|
|
522
|
+
handler: ([blockNumber]) => this.handlerAsUtility().getBlockHeader(blockNumber),
|
|
523
|
+
});
|
|
688
524
|
}
|
|
689
525
|
|
|
690
526
|
// eslint-disable-next-line camelcase
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash);
|
|
699
|
-
|
|
700
|
-
if (!witness) {
|
|
701
|
-
throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
|
|
702
|
-
}
|
|
703
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
527
|
+
aztec_utl_getNoteHashMembershipWitness(...inputs: ForeignCallArgs) {
|
|
528
|
+
return callTxeHandler({
|
|
529
|
+
oracle: 'aztec_utl_getNoteHashMembershipWitness',
|
|
530
|
+
inputs,
|
|
531
|
+
handler: ([blockHash, noteHash]) => this.handlerAsUtility().getNoteHashMembershipWitness(blockHash, noteHash),
|
|
532
|
+
});
|
|
704
533
|
}
|
|
705
534
|
|
|
706
535
|
// eslint-disable-next-line camelcase
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash);
|
|
715
|
-
|
|
716
|
-
if (!witness) {
|
|
717
|
-
throw new Error(
|
|
718
|
-
`Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`,
|
|
719
|
-
);
|
|
720
|
-
}
|
|
721
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
536
|
+
aztec_utl_getBlockHashMembershipWitness(...inputs: ForeignCallArgs) {
|
|
537
|
+
return callTxeHandler({
|
|
538
|
+
oracle: 'aztec_utl_getBlockHashMembershipWitness',
|
|
539
|
+
inputs,
|
|
540
|
+
handler: ([anchorBlockHash, blockHash]) =>
|
|
541
|
+
this.handlerAsUtility().getBlockHashMembershipWitness(anchorBlockHash, blockHash),
|
|
542
|
+
});
|
|
722
543
|
}
|
|
723
544
|
|
|
724
545
|
// eslint-disable-next-line camelcase
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier);
|
|
733
|
-
|
|
734
|
-
if (!witness) {
|
|
735
|
-
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
|
|
736
|
-
}
|
|
737
|
-
return toForeignCallResult(witness.toNoirRepresentation());
|
|
546
|
+
aztec_utl_getLowNullifierMembershipWitness(...inputs: ForeignCallArgs) {
|
|
547
|
+
return callTxeHandler({
|
|
548
|
+
oracle: 'aztec_utl_getLowNullifierMembershipWitness',
|
|
549
|
+
inputs,
|
|
550
|
+
handler: ([blockHash, nullifier]) =>
|
|
551
|
+
this.handlerAsUtility().getLowNullifierMembershipWitness(blockHash, nullifier),
|
|
552
|
+
});
|
|
738
553
|
}
|
|
739
554
|
|
|
740
555
|
// eslint-disable-next-line camelcase
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
556
|
+
aztec_utl_getPendingTaggedLogs(...inputs: ForeignCallArgs) {
|
|
557
|
+
return callTxeHandler({
|
|
558
|
+
oracle: 'aztec_utl_getPendingTaggedLogs',
|
|
559
|
+
inputs,
|
|
560
|
+
handler: ([scope, providedSecrets]) => this.handlerAsUtility().getPendingTaggedLogs(scope, providedSecrets),
|
|
561
|
+
});
|
|
747
562
|
}
|
|
748
563
|
|
|
749
564
|
// eslint-disable-next-line camelcase
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
565
|
+
aztec_utl_validateAndStoreEnqueuedNotesAndEvents(...inputs: ForeignCallArgs) {
|
|
566
|
+
return callTxeHandler({
|
|
567
|
+
oracle: 'aztec_utl_validateAndStoreEnqueuedNotesAndEvents',
|
|
568
|
+
inputs,
|
|
569
|
+
handler: ([noteValidationRequests, eventValidationRequests, scope]) =>
|
|
570
|
+
this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
|
|
571
|
+
noteValidationRequests,
|
|
572
|
+
eventValidationRequests,
|
|
573
|
+
scope,
|
|
574
|
+
),
|
|
575
|
+
});
|
|
576
|
+
}
|
|
762
577
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
);
|
|
578
|
+
// eslint-disable-next-line camelcase
|
|
579
|
+
aztec_utl_getLogsByTag(...inputs: ForeignCallArgs) {
|
|
580
|
+
return callTxeHandler({
|
|
581
|
+
oracle: 'aztec_utl_getLogsByTag',
|
|
582
|
+
inputs,
|
|
583
|
+
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().getLogsByTag(requestArrayBaseSlot),
|
|
584
|
+
});
|
|
585
|
+
}
|
|
770
586
|
|
|
771
|
-
|
|
587
|
+
// eslint-disable-next-line camelcase
|
|
588
|
+
aztec_utl_getMessageContextsByTxHash(...inputs: ForeignCallArgs) {
|
|
589
|
+
return callTxeHandler({
|
|
590
|
+
oracle: 'aztec_utl_getMessageContextsByTxHash',
|
|
591
|
+
inputs,
|
|
592
|
+
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().getMessageContextsByTxHash(requestArrayBaseSlot),
|
|
593
|
+
});
|
|
772
594
|
}
|
|
773
595
|
|
|
774
596
|
// eslint-disable-next-line camelcase
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
597
|
+
aztec_utl_setCapsule(...inputs: ForeignCallArgs) {
|
|
598
|
+
return callTxeHandler({
|
|
599
|
+
oracle: 'aztec_utl_setCapsule',
|
|
600
|
+
inputs,
|
|
601
|
+
handler: ([contractAddress, slot, capsule, scope]) =>
|
|
602
|
+
this.handlerAsUtility().setCapsule(contractAddress, slot, capsule, scope),
|
|
603
|
+
});
|
|
604
|
+
}
|
|
783
605
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
606
|
+
// eslint-disable-next-line camelcase
|
|
607
|
+
aztec_utl_getCapsule(...inputs: ForeignCallArgs) {
|
|
608
|
+
return callTxeHandler({
|
|
609
|
+
oracle: 'aztec_utl_getCapsule',
|
|
610
|
+
inputs,
|
|
611
|
+
handler: ([contractAddress, slot, tSize, scope]) =>
|
|
612
|
+
this.handlerAsUtility().getCapsule(contractAddress, slot, tSize, scope),
|
|
613
|
+
});
|
|
614
|
+
}
|
|
789
615
|
|
|
790
|
-
|
|
616
|
+
// eslint-disable-next-line camelcase
|
|
617
|
+
aztec_utl_deleteCapsule(...inputs: ForeignCallArgs) {
|
|
618
|
+
return callTxeHandler({
|
|
619
|
+
oracle: 'aztec_utl_deleteCapsule',
|
|
620
|
+
inputs,
|
|
621
|
+
handler: ([contractAddress, slot, scope]) => this.handlerAsUtility().deleteCapsule(contractAddress, slot, scope),
|
|
622
|
+
});
|
|
791
623
|
}
|
|
792
624
|
|
|
793
625
|
// eslint-disable-next-line camelcase
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
626
|
+
aztec_utl_copyCapsule(...inputs: ForeignCallArgs) {
|
|
627
|
+
return callTxeHandler({
|
|
628
|
+
oracle: 'aztec_utl_copyCapsule',
|
|
629
|
+
inputs,
|
|
630
|
+
handler: ([contractAddress, srcSlot, dstSlot, numEntries, scope]) =>
|
|
631
|
+
this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, scope),
|
|
632
|
+
});
|
|
633
|
+
}
|
|
802
634
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
635
|
+
// eslint-disable-next-line camelcase
|
|
636
|
+
aztec_utl_pushEphemeral(...inputs: ForeignCallArgs) {
|
|
637
|
+
return callTxeHandler({
|
|
638
|
+
oracle: 'aztec_utl_pushEphemeral',
|
|
639
|
+
inputs,
|
|
640
|
+
handler: ([slot, elements]) => this.handlerAsUtility().pushEphemeral(slot, elements),
|
|
641
|
+
});
|
|
642
|
+
}
|
|
808
643
|
|
|
809
|
-
|
|
644
|
+
// eslint-disable-next-line camelcase
|
|
645
|
+
aztec_utl_popEphemeral(...inputs: ForeignCallArgs) {
|
|
646
|
+
return callTxeHandler({
|
|
647
|
+
oracle: 'aztec_utl_popEphemeral',
|
|
648
|
+
inputs,
|
|
649
|
+
handler: ([slot]) => this.handlerAsUtility().popEphemeral(slot),
|
|
650
|
+
});
|
|
810
651
|
}
|
|
811
652
|
|
|
812
653
|
// eslint-disable-next-line camelcase
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
const capsule = fromArray(foreignCapsule);
|
|
654
|
+
aztec_utl_getEphemeral(...inputs: ForeignCallArgs) {
|
|
655
|
+
return callTxeHandler({
|
|
656
|
+
oracle: 'aztec_utl_getEphemeral',
|
|
657
|
+
inputs,
|
|
658
|
+
handler: ([slot, index]) => this.handlerAsUtility().getEphemeral(slot, index),
|
|
659
|
+
});
|
|
660
|
+
}
|
|
821
661
|
|
|
822
|
-
|
|
662
|
+
// eslint-disable-next-line camelcase
|
|
663
|
+
aztec_utl_setEphemeral(...inputs: ForeignCallArgs) {
|
|
664
|
+
return callTxeHandler({
|
|
665
|
+
oracle: 'aztec_utl_setEphemeral',
|
|
666
|
+
inputs,
|
|
667
|
+
handler: ([slot, index, elements]) => this.handlerAsUtility().setEphemeral(slot, index, elements),
|
|
668
|
+
});
|
|
669
|
+
}
|
|
823
670
|
|
|
824
|
-
|
|
671
|
+
// eslint-disable-next-line camelcase
|
|
672
|
+
aztec_utl_getEphemeralLen(...inputs: ForeignCallArgs) {
|
|
673
|
+
return callTxeHandler({
|
|
674
|
+
oracle: 'aztec_utl_getEphemeralLen',
|
|
675
|
+
inputs,
|
|
676
|
+
handler: ([slot]) => this.handlerAsUtility().getEphemeralLen(slot),
|
|
677
|
+
});
|
|
825
678
|
}
|
|
826
679
|
|
|
827
680
|
// eslint-disable-next-line camelcase
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const tSize = fromSingle(foreignTSize).toNumber();
|
|
681
|
+
aztec_utl_removeEphemeral(...inputs: ForeignCallArgs) {
|
|
682
|
+
return callTxeHandler({
|
|
683
|
+
oracle: 'aztec_utl_removeEphemeral',
|
|
684
|
+
inputs,
|
|
685
|
+
handler: ([slot, index]) => this.handlerAsUtility().removeEphemeral(slot, index),
|
|
686
|
+
});
|
|
687
|
+
}
|
|
836
688
|
|
|
837
|
-
|
|
689
|
+
// eslint-disable-next-line camelcase
|
|
690
|
+
aztec_utl_clearEphemeral(...inputs: ForeignCallArgs) {
|
|
691
|
+
return callTxeHandler({
|
|
692
|
+
oracle: 'aztec_utl_clearEphemeral',
|
|
693
|
+
inputs,
|
|
694
|
+
handler: ([slot]) => this.handlerAsUtility().clearEphemeral(slot),
|
|
695
|
+
});
|
|
696
|
+
}
|
|
838
697
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
return toForeignCallResult([toSingle(new Fr(1)), toArray(values)]);
|
|
847
|
-
}
|
|
698
|
+
// eslint-disable-next-line camelcase
|
|
699
|
+
aztec_utl_pushTransient(...inputs: ForeignCallArgs) {
|
|
700
|
+
return callTxeHandler({
|
|
701
|
+
oracle: 'aztec_utl_pushTransient',
|
|
702
|
+
inputs,
|
|
703
|
+
handler: ([slot, elements]) => this.handlerAsUtility().pushTransient(slot, elements),
|
|
704
|
+
});
|
|
848
705
|
}
|
|
849
706
|
|
|
850
707
|
// eslint-disable-next-line camelcase
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
708
|
+
aztec_utl_popTransient(...inputs: ForeignCallArgs) {
|
|
709
|
+
return callTxeHandler({
|
|
710
|
+
oracle: 'aztec_utl_popTransient',
|
|
711
|
+
inputs,
|
|
712
|
+
handler: ([slot]) => this.handlerAsUtility().popTransient(slot),
|
|
713
|
+
});
|
|
714
|
+
}
|
|
854
715
|
|
|
855
|
-
|
|
716
|
+
// eslint-disable-next-line camelcase
|
|
717
|
+
aztec_utl_getTransient(...inputs: ForeignCallArgs) {
|
|
718
|
+
return callTxeHandler({
|
|
719
|
+
oracle: 'aztec_utl_getTransient',
|
|
720
|
+
inputs,
|
|
721
|
+
handler: ([slot, index]) => this.handlerAsUtility().getTransient(slot, index),
|
|
722
|
+
});
|
|
723
|
+
}
|
|
856
724
|
|
|
857
|
-
|
|
725
|
+
// eslint-disable-next-line camelcase
|
|
726
|
+
aztec_utl_setTransient(...inputs: ForeignCallArgs) {
|
|
727
|
+
return callTxeHandler({
|
|
728
|
+
oracle: 'aztec_utl_setTransient',
|
|
729
|
+
inputs,
|
|
730
|
+
handler: ([slot, index, elements]) => this.handlerAsUtility().setTransient(slot, index, elements),
|
|
731
|
+
});
|
|
858
732
|
}
|
|
859
733
|
|
|
860
734
|
// eslint-disable-next-line camelcase
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
const srcSlot = fromSingle(foreignSrcSlot);
|
|
869
|
-
const dstSlot = fromSingle(foreignDstSlot);
|
|
870
|
-
const numEntries = fromSingle(foreignNumEntries).toNumber();
|
|
735
|
+
aztec_utl_getTransientLen(...inputs: ForeignCallArgs) {
|
|
736
|
+
return callTxeHandler({
|
|
737
|
+
oracle: 'aztec_utl_getTransientLen',
|
|
738
|
+
inputs,
|
|
739
|
+
handler: ([slot]) => this.handlerAsUtility().getTransientLen(slot),
|
|
740
|
+
});
|
|
741
|
+
}
|
|
871
742
|
|
|
872
|
-
|
|
743
|
+
// eslint-disable-next-line camelcase
|
|
744
|
+
aztec_utl_removeTransient(...inputs: ForeignCallArgs) {
|
|
745
|
+
return callTxeHandler({
|
|
746
|
+
oracle: 'aztec_utl_removeTransient',
|
|
747
|
+
inputs,
|
|
748
|
+
handler: ([slot, index]) => this.handlerAsUtility().removeTransient(slot, index),
|
|
749
|
+
});
|
|
750
|
+
}
|
|
873
751
|
|
|
874
|
-
|
|
752
|
+
// eslint-disable-next-line camelcase
|
|
753
|
+
aztec_utl_clearTransient(...inputs: ForeignCallArgs) {
|
|
754
|
+
return callTxeHandler({
|
|
755
|
+
oracle: 'aztec_utl_clearTransient',
|
|
756
|
+
inputs,
|
|
757
|
+
handler: ([slot]) => this.handlerAsUtility().clearTransient(slot),
|
|
758
|
+
});
|
|
875
759
|
}
|
|
876
760
|
|
|
877
761
|
// TODO: I forgot to add a corresponding function here, when I introduced an oracle method to txe_oracle.ts.
|
|
878
762
|
// The compiler didn't throw an error, so it took me a while to learn of the existence of this file, and that I need
|
|
879
763
|
// to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
|
|
880
764
|
// existence of a txe_oracle method?
|
|
881
|
-
// TODO(F-452): Return Option and wrap in try/catch so BB exceptions don't crash TXE.
|
|
882
765
|
// eslint-disable-next-line camelcase
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const ciphertext = fromUintBoundedVec(foreignCiphertextBVecStorage, foreignCiphertextLength, 8);
|
|
890
|
-
const iv = fromUintArray(foreignIv, 8);
|
|
891
|
-
const symKey = fromUintArray(foreignSymKey, 8);
|
|
892
|
-
|
|
893
|
-
const plaintextBuffer = await this.handlerAsUtility().aes128Decrypt(ciphertext, iv, symKey);
|
|
894
|
-
|
|
895
|
-
return toForeignCallResult(
|
|
896
|
-
arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length),
|
|
897
|
-
);
|
|
766
|
+
aztec_utl_decryptAes128(...inputs: ForeignCallArgs) {
|
|
767
|
+
return callTxeHandler({
|
|
768
|
+
oracle: 'aztec_utl_decryptAes128',
|
|
769
|
+
inputs,
|
|
770
|
+
handler: ([ciphertext, iv, symKey]) => this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey),
|
|
771
|
+
});
|
|
898
772
|
}
|
|
899
773
|
|
|
900
774
|
// eslint-disable-next-line camelcase
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
fromSingle(foreignEphPKField0),
|
|
910
|
-
fromSingle(foreignEphPKField1),
|
|
911
|
-
fromSingle(foreignEphPKField2),
|
|
912
|
-
]);
|
|
913
|
-
|
|
914
|
-
const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK);
|
|
775
|
+
aztec_utl_getSharedSecrets(...inputs: ForeignCallArgs) {
|
|
776
|
+
return callTxeHandler({
|
|
777
|
+
oracle: 'aztec_utl_getSharedSecrets',
|
|
778
|
+
inputs,
|
|
779
|
+
handler: ([address, ephPksSlot, contractAddress]) =>
|
|
780
|
+
this.handlerAsUtility().getSharedSecrets(address, ephPksSlot, contractAddress),
|
|
781
|
+
});
|
|
782
|
+
}
|
|
915
783
|
|
|
916
|
-
|
|
784
|
+
// eslint-disable-next-line camelcase
|
|
785
|
+
aztec_utl_setContractSyncCacheInvalid(...inputs: ForeignCallArgs) {
|
|
786
|
+
return callTxeHandler({
|
|
787
|
+
oracle: 'aztec_utl_setContractSyncCacheInvalid',
|
|
788
|
+
inputs,
|
|
789
|
+
handler: ([contractAddress, scopes]) =>
|
|
790
|
+
this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes),
|
|
791
|
+
});
|
|
917
792
|
}
|
|
918
793
|
|
|
919
794
|
// eslint-disable-next-line camelcase
|
|
920
|
-
aztec_utl_emitOffchainEffect(
|
|
921
|
-
|
|
795
|
+
aztec_utl_emitOffchainEffect(...inputs: ForeignCallArgs) {
|
|
796
|
+
return callTxeHandler({
|
|
797
|
+
oracle: 'aztec_utl_emitOffchainEffect',
|
|
798
|
+
inputs,
|
|
799
|
+
handler: ([data]) => {
|
|
800
|
+
// Record the raw payload against the currently-executing top-level call. The Noir side
|
|
801
|
+
// (via `env.offchain_messages()`) is responsible for decoding the protocol-reserved prefix
|
|
802
|
+
// (`OFFCHAIN_MESSAGE_IDENTIFIER`, recipient) and turning each payload into an `OffchainMessage` struct suitable
|
|
803
|
+
// for `offchain_receive`.
|
|
804
|
+
this.stateHandler.recordOffchainEffect(data);
|
|
805
|
+
},
|
|
806
|
+
});
|
|
922
807
|
}
|
|
923
808
|
|
|
924
809
|
// AVM opcodes
|
|
925
810
|
|
|
926
811
|
// eslint-disable-next-line camelcase
|
|
927
|
-
aztec_avm_emitPublicLog(
|
|
928
|
-
|
|
929
|
-
|
|
812
|
+
aztec_avm_emitPublicLog() {
|
|
813
|
+
return callTxeHandler({
|
|
814
|
+
oracle: 'aztec_avm_emitPublicLog',
|
|
815
|
+
inputs: [],
|
|
816
|
+
// TODO(#8811): Implement
|
|
817
|
+
handler: () => {},
|
|
818
|
+
});
|
|
930
819
|
}
|
|
931
820
|
|
|
932
821
|
// eslint-disable-next-line camelcase
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return toForeignCallResult([toSingle(new Fr(value))]);
|
|
822
|
+
aztec_avm_storageRead(...inputs: ForeignCallArgs) {
|
|
823
|
+
return callTxeHandler({
|
|
824
|
+
oracle: 'aztec_avm_storageRead',
|
|
825
|
+
inputs,
|
|
826
|
+
handler: ([slot, contractAddress]) => this.handlerAsAvm().storageRead(slot, contractAddress),
|
|
827
|
+
});
|
|
940
828
|
}
|
|
941
829
|
|
|
942
830
|
// eslint-disable-next-line camelcase
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return toForeignCallResult([]);
|
|
831
|
+
aztec_avm_storageWrite(...inputs: ForeignCallArgs) {
|
|
832
|
+
return callTxeHandler({
|
|
833
|
+
oracle: 'aztec_avm_storageWrite',
|
|
834
|
+
inputs,
|
|
835
|
+
handler: ([slot, value]) => this.handlerAsAvm().storageWrite(slot, value),
|
|
836
|
+
});
|
|
950
837
|
}
|
|
951
838
|
|
|
952
839
|
// eslint-disable-next-line camelcase
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
toSingle(instance.deployer),
|
|
960
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
961
|
-
toSingle(new Fr(1)),
|
|
962
|
-
]);
|
|
840
|
+
aztec_avm_getContractInstanceDeployer(...inputs: ForeignCallArgs) {
|
|
841
|
+
return callTxeHandler({
|
|
842
|
+
oracle: 'aztec_avm_getContractInstanceDeployer',
|
|
843
|
+
inputs,
|
|
844
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceDeployer(address),
|
|
845
|
+
});
|
|
963
846
|
}
|
|
964
847
|
|
|
965
848
|
// eslint-disable-next-line camelcase
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
toSingle(instance.currentContractClassId),
|
|
973
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
974
|
-
toSingle(new Fr(1)),
|
|
975
|
-
]);
|
|
849
|
+
aztec_avm_getContractInstanceClassId(...inputs: ForeignCallArgs) {
|
|
850
|
+
return callTxeHandler({
|
|
851
|
+
oracle: 'aztec_avm_getContractInstanceClassId',
|
|
852
|
+
inputs,
|
|
853
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceClassId(address),
|
|
854
|
+
});
|
|
976
855
|
}
|
|
977
856
|
|
|
978
857
|
// eslint-disable-next-line camelcase
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
toSingle(instance.initializationHash),
|
|
986
|
-
// AVM requires an extra boolean indicating the instance was found
|
|
987
|
-
toSingle(new Fr(1)),
|
|
988
|
-
]);
|
|
858
|
+
aztec_avm_getContractInstanceInitializationHash(...inputs: ForeignCallArgs) {
|
|
859
|
+
return callTxeHandler({
|
|
860
|
+
oracle: 'aztec_avm_getContractInstanceInitializationHash',
|
|
861
|
+
inputs,
|
|
862
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceInitializationHash(address),
|
|
863
|
+
});
|
|
989
864
|
}
|
|
990
865
|
|
|
991
866
|
// eslint-disable-next-line camelcase
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
867
|
+
aztec_avm_getContractInstanceImmutablesHash(...inputs: ForeignCallArgs) {
|
|
868
|
+
return callTxeHandler({
|
|
869
|
+
oracle: 'aztec_avm_getContractInstanceImmutablesHash',
|
|
870
|
+
inputs,
|
|
871
|
+
handler: ([address]) => this.handlerAsAvm().getContractInstanceImmutablesHash(address),
|
|
872
|
+
});
|
|
996
873
|
}
|
|
997
874
|
|
|
998
875
|
// eslint-disable-next-line camelcase
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
876
|
+
aztec_avm_sender() {
|
|
877
|
+
return callTxeHandler({
|
|
878
|
+
oracle: 'aztec_avm_sender',
|
|
879
|
+
inputs: [],
|
|
880
|
+
handler: () => this.handlerAsAvm().sender(),
|
|
881
|
+
});
|
|
1005
882
|
}
|
|
1006
883
|
|
|
1007
884
|
// eslint-disable-next-line camelcase
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
885
|
+
aztec_avm_emitNullifier(...inputs: ForeignCallArgs) {
|
|
886
|
+
return callTxeHandler({
|
|
887
|
+
oracle: 'aztec_avm_emitNullifier',
|
|
888
|
+
inputs,
|
|
889
|
+
handler: ([nullifier]) => this.handlerAsAvm().emitNullifier(nullifier),
|
|
890
|
+
});
|
|
1014
891
|
}
|
|
1015
892
|
|
|
1016
893
|
// eslint-disable-next-line camelcase
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
894
|
+
aztec_avm_emitNoteHash(...inputs: ForeignCallArgs) {
|
|
895
|
+
return callTxeHandler({
|
|
896
|
+
oracle: 'aztec_avm_emitNoteHash',
|
|
897
|
+
inputs,
|
|
898
|
+
handler: ([noteHash]) => this.handlerAsAvm().emitNoteHash(noteHash),
|
|
899
|
+
});
|
|
1023
900
|
}
|
|
1024
901
|
|
|
1025
902
|
// eslint-disable-next-line camelcase
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
903
|
+
aztec_avm_nullifierExists(...inputs: ForeignCallArgs) {
|
|
904
|
+
return callTxeHandler({
|
|
905
|
+
oracle: 'aztec_avm_nullifierExists',
|
|
906
|
+
inputs,
|
|
907
|
+
handler: ([siloedNullifier]) => this.handlerAsAvm().nullifierExists(siloedNullifier),
|
|
908
|
+
});
|
|
1030
909
|
}
|
|
1031
910
|
|
|
1032
911
|
// eslint-disable-next-line camelcase
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
912
|
+
aztec_avm_address() {
|
|
913
|
+
return callTxeHandler({
|
|
914
|
+
oracle: 'aztec_avm_address',
|
|
915
|
+
inputs: [],
|
|
916
|
+
handler: () => this.handlerAsAvm().address(),
|
|
917
|
+
});
|
|
1037
918
|
}
|
|
1038
919
|
|
|
1039
920
|
// eslint-disable-next-line camelcase
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
921
|
+
aztec_avm_blockNumber() {
|
|
922
|
+
return callTxeHandler({
|
|
923
|
+
oracle: 'aztec_avm_blockNumber',
|
|
924
|
+
inputs: [],
|
|
925
|
+
handler: () => this.handlerAsAvm().blockNumber(),
|
|
926
|
+
});
|
|
1044
927
|
}
|
|
1045
928
|
|
|
1046
929
|
// eslint-disable-next-line camelcase
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
930
|
+
aztec_avm_timestamp() {
|
|
931
|
+
return callTxeHandler({
|
|
932
|
+
oracle: 'aztec_avm_timestamp',
|
|
933
|
+
inputs: [],
|
|
934
|
+
handler: () => this.handlerAsAvm().timestamp(),
|
|
935
|
+
});
|
|
1051
936
|
}
|
|
1052
937
|
|
|
1053
938
|
// eslint-disable-next-line camelcase
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
939
|
+
aztec_avm_isStaticCall() {
|
|
940
|
+
return callTxeHandler({
|
|
941
|
+
oracle: 'aztec_avm_isStaticCall',
|
|
942
|
+
inputs: [],
|
|
943
|
+
handler: () => this.handlerAsAvm().isStaticCall(),
|
|
944
|
+
});
|
|
1058
945
|
}
|
|
1059
946
|
|
|
1060
947
|
// eslint-disable-next-line camelcase
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
948
|
+
aztec_avm_chainId() {
|
|
949
|
+
return callTxeHandler({
|
|
950
|
+
oracle: 'aztec_avm_chainId',
|
|
951
|
+
inputs: [],
|
|
952
|
+
handler: () => this.handlerAsAvm().chainId(),
|
|
953
|
+
});
|
|
1065
954
|
}
|
|
1066
955
|
|
|
1067
956
|
// eslint-disable-next-line camelcase
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
957
|
+
aztec_avm_version() {
|
|
958
|
+
return callTxeHandler({
|
|
959
|
+
oracle: 'aztec_avm_version',
|
|
960
|
+
inputs: [],
|
|
961
|
+
handler: () => this.handlerAsAvm().version(),
|
|
962
|
+
});
|
|
1072
963
|
}
|
|
1073
964
|
|
|
1074
965
|
// eslint-disable-next-line camelcase
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
// eslint-disable-next-line camelcase
|
|
1082
|
-
aztec_avm_call(
|
|
1083
|
-
_foreignL2Gas: ForeignCallSingle,
|
|
1084
|
-
_foreignDaGas: ForeignCallSingle,
|
|
1085
|
-
_foreignAddress: ForeignCallSingle,
|
|
1086
|
-
_foreignLength: ForeignCallSingle,
|
|
1087
|
-
_foreignArgs: ForeignCallArray,
|
|
1088
|
-
) {
|
|
1089
|
-
throw new Error(
|
|
1090
|
-
'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
|
|
1091
|
-
);
|
|
966
|
+
aztec_avm_returndataSize() {
|
|
967
|
+
return callTxeHandler({
|
|
968
|
+
oracle: 'aztec_avm_returndataSize',
|
|
969
|
+
inputs: [],
|
|
970
|
+
handler: () => this.handlerAsAvm().returndataSize(),
|
|
971
|
+
});
|
|
1092
972
|
}
|
|
1093
973
|
|
|
1094
974
|
// eslint-disable-next-line camelcase
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
) {
|
|
1102
|
-
throw new Error(
|
|
1103
|
-
'Contract calls are forbidden inside a `TestEnvironment::public_context`, use `public_call` instead',
|
|
1104
|
-
);
|
|
975
|
+
aztec_avm_returndataCopy(...inputs: ForeignCallArgs) {
|
|
976
|
+
return callTxeHandler({
|
|
977
|
+
oracle: 'aztec_avm_returndataCopy',
|
|
978
|
+
inputs,
|
|
979
|
+
handler: ([rdOffset, copySize]) => this.handlerAsAvm().returndataCopy(rdOffset, copySize),
|
|
980
|
+
});
|
|
1105
981
|
}
|
|
1106
982
|
|
|
1107
983
|
// eslint-disable-next-line camelcase
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
async aztec_txe_privateCallNewFlow(
|
|
1116
|
-
foreignFrom: ForeignCallSingle,
|
|
1117
|
-
foreignTargetContractAddress: ForeignCallSingle,
|
|
1118
|
-
foreignFunctionSelector: ForeignCallSingle,
|
|
1119
|
-
foreignArgs: ForeignCallArray,
|
|
1120
|
-
foreignArgsHash: ForeignCallSingle,
|
|
1121
|
-
foreignIsStaticCall: ForeignCallSingle,
|
|
1122
|
-
) {
|
|
1123
|
-
const from = addressFromSingle(foreignFrom);
|
|
1124
|
-
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
1125
|
-
const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
|
|
1126
|
-
const args = fromArray(foreignArgs);
|
|
1127
|
-
const argsHash = fromSingle(foreignArgsHash);
|
|
1128
|
-
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
1129
|
-
|
|
1130
|
-
const returnValues = await this.handlerAsTxe().privateCallNewFlow(
|
|
1131
|
-
from,
|
|
1132
|
-
targetContractAddress,
|
|
1133
|
-
functionSelector,
|
|
1134
|
-
args,
|
|
1135
|
-
argsHash,
|
|
1136
|
-
isStaticCall,
|
|
1137
|
-
this.stateHandler.getCurrentJob(),
|
|
1138
|
-
);
|
|
1139
|
-
|
|
1140
|
-
// TODO(F-335): Avoid doing the following call here.
|
|
1141
|
-
await this.stateHandler.cycleJob();
|
|
1142
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
// eslint-disable-next-line camelcase
|
|
1146
|
-
async aztec_txe_executeUtilityFunction(
|
|
1147
|
-
foreignTargetContractAddress: ForeignCallSingle,
|
|
1148
|
-
foreignFunctionSelector: ForeignCallSingle,
|
|
1149
|
-
foreignArgs: ForeignCallArray,
|
|
1150
|
-
) {
|
|
1151
|
-
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
1152
|
-
const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
|
|
1153
|
-
const args = fromArray(foreignArgs);
|
|
1154
|
-
|
|
1155
|
-
const returnValues = await this.handlerAsTxe().executeUtilityFunction(
|
|
1156
|
-
targetContractAddress,
|
|
1157
|
-
functionSelector,
|
|
1158
|
-
args,
|
|
1159
|
-
this.stateHandler.getCurrentJob(),
|
|
1160
|
-
);
|
|
1161
|
-
|
|
1162
|
-
// TODO(F-335): Avoid doing the following call here.
|
|
1163
|
-
await this.stateHandler.cycleJob();
|
|
1164
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
// eslint-disable-next-line camelcase
|
|
1168
|
-
async aztec_txe_publicCallNewFlow(
|
|
1169
|
-
foreignFrom: ForeignCallSingle,
|
|
1170
|
-
foreignAddress: ForeignCallSingle,
|
|
1171
|
-
foreignCalldata: ForeignCallArray,
|
|
1172
|
-
foreignIsStaticCall: ForeignCallSingle,
|
|
1173
|
-
) {
|
|
1174
|
-
const from = addressFromSingle(foreignFrom);
|
|
1175
|
-
const address = addressFromSingle(foreignAddress);
|
|
1176
|
-
const calldata = fromArray(foreignCalldata);
|
|
1177
|
-
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
1178
|
-
|
|
1179
|
-
const returnValues = await this.handlerAsTxe().publicCallNewFlow(from, address, calldata, isStaticCall);
|
|
1180
|
-
|
|
1181
|
-
// TODO(F-335): Avoid doing the following call here.
|
|
1182
|
-
await this.stateHandler.cycleJob();
|
|
1183
|
-
return toForeignCallResult([toArray(returnValues)]);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
// eslint-disable-next-line camelcase
|
|
1187
|
-
async aztec_prv_getSenderForTags() {
|
|
1188
|
-
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
1189
|
-
|
|
1190
|
-
// Return a Noir Option struct with `some` and `value` fields
|
|
1191
|
-
if (sender === undefined) {
|
|
1192
|
-
// No sender found, return Option with some=0 and value=0
|
|
1193
|
-
return toForeignCallResult([toSingle(0), toSingle(0)]);
|
|
1194
|
-
} else {
|
|
1195
|
-
// Sender found, return Option with some=1 and value=sender address
|
|
1196
|
-
return toForeignCallResult([toSingle(1), toSingle(sender)]);
|
|
1197
|
-
}
|
|
984
|
+
aztec_avm_call(...inputs: ForeignCallArgs) {
|
|
985
|
+
return callTxeHandler({
|
|
986
|
+
oracle: 'aztec_avm_call',
|
|
987
|
+
inputs,
|
|
988
|
+
handler: ([l2Gas, daGas, address, argsLength, args]) =>
|
|
989
|
+
this.handlerAsAvm().call(l2Gas, daGas, address, argsLength, args),
|
|
990
|
+
});
|
|
1198
991
|
}
|
|
1199
992
|
|
|
1200
993
|
// eslint-disable-next-line camelcase
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
994
|
+
aztec_avm_staticCall(...inputs: ForeignCallArgs) {
|
|
995
|
+
return callTxeHandler({
|
|
996
|
+
oracle: 'aztec_avm_staticCall',
|
|
997
|
+
inputs,
|
|
998
|
+
handler: ([l2Gas, daGas, address, argsLength, args]) =>
|
|
999
|
+
this.handlerAsAvm().staticCall(l2Gas, daGas, address, argsLength, args),
|
|
1000
|
+
});
|
|
1207
1001
|
}
|
|
1208
1002
|
|
|
1209
1003
|
// eslint-disable-next-line camelcase
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1004
|
+
aztec_avm_successCopy() {
|
|
1005
|
+
return callTxeHandler({
|
|
1006
|
+
oracle: 'aztec_avm_successCopy',
|
|
1007
|
+
inputs: [],
|
|
1008
|
+
handler: () => this.handlerAsAvm().successCopy(),
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// eslint-disable-next-line camelcase
|
|
1013
|
+
aztec_txe_privateCallNewFlow(...inputs: ForeignCallArgs) {
|
|
1014
|
+
return callTxeHandler({
|
|
1015
|
+
oracle: 'aztec_txe_privateCallNewFlow',
|
|
1016
|
+
inputs,
|
|
1017
|
+
handler: ([
|
|
1018
|
+
from,
|
|
1019
|
+
targetContractAddress,
|
|
1020
|
+
functionSelector,
|
|
1021
|
+
args,
|
|
1022
|
+
argsHash,
|
|
1023
|
+
isStaticCall,
|
|
1024
|
+
additionalScopes,
|
|
1025
|
+
authorizedUtilityCallTargets,
|
|
1026
|
+
gasSettings,
|
|
1027
|
+
]) =>
|
|
1028
|
+
this.stateHandler.executePrivateCall(
|
|
1029
|
+
from,
|
|
1030
|
+
targetContractAddress,
|
|
1031
|
+
functionSelector,
|
|
1032
|
+
args,
|
|
1033
|
+
argsHash,
|
|
1034
|
+
isStaticCall,
|
|
1035
|
+
additionalScopes,
|
|
1036
|
+
authorizedUtilityCallTargets,
|
|
1037
|
+
gasSettings,
|
|
1038
|
+
),
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// eslint-disable-next-line camelcase
|
|
1043
|
+
aztec_txe_executeUtilityFunction(...inputs: ForeignCallArgs) {
|
|
1044
|
+
return callTxeHandler({
|
|
1045
|
+
oracle: 'aztec_txe_executeUtilityFunction',
|
|
1046
|
+
inputs,
|
|
1047
|
+
handler: ([targetContractAddress, functionSelector, args, authorizedUtilityCallTargets]) =>
|
|
1048
|
+
this.stateHandler.executeUtilityFunction(
|
|
1049
|
+
targetContractAddress,
|
|
1050
|
+
functionSelector,
|
|
1051
|
+
args,
|
|
1052
|
+
authorizedUtilityCallTargets,
|
|
1053
|
+
),
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
// eslint-disable-next-line camelcase
|
|
1058
|
+
aztec_txe_publicCallNewFlow(...inputs: ForeignCallArgs) {
|
|
1059
|
+
return callTxeHandler({
|
|
1060
|
+
oracle: 'aztec_txe_publicCallNewFlow',
|
|
1061
|
+
inputs,
|
|
1062
|
+
handler: ([from, address, calldata, isStaticCall, gasSettings]) =>
|
|
1063
|
+
this.stateHandler.executePublicCall(from, address, calldata, isStaticCall, gasSettings),
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// eslint-disable-next-line camelcase
|
|
1068
|
+
aztec_prv_getSenderForTags() {
|
|
1069
|
+
return callTxeHandler({
|
|
1070
|
+
oracle: 'aztec_prv_getSenderForTags',
|
|
1071
|
+
inputs: [],
|
|
1072
|
+
handler: () => this.handlerAsPrivate().getSenderForTags(),
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// eslint-disable-next-line camelcase
|
|
1077
|
+
aztec_prv_getAppTaggingSecret(...inputs: ForeignCallArgs) {
|
|
1078
|
+
return callTxeHandler({
|
|
1079
|
+
oracle: 'aztec_prv_getAppTaggingSecret',
|
|
1080
|
+
inputs,
|
|
1081
|
+
handler: ([sender, recipient]) => this.handlerAsPrivate().getAppTaggingSecret(sender, recipient),
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// eslint-disable-next-line camelcase
|
|
1086
|
+
aztec_prv_getNextTaggingIndex(...inputs: ForeignCallArgs) {
|
|
1087
|
+
return callTxeHandler({
|
|
1088
|
+
oracle: 'aztec_prv_getNextTaggingIndex',
|
|
1089
|
+
inputs,
|
|
1090
|
+
handler: ([secret, deliveryMode]) => this.handlerAsPrivate().getNextTaggingIndex(secret, deliveryMode),
|
|
1091
|
+
});
|
|
1217
1092
|
}
|
|
1218
1093
|
}
|