@aztec/simulator 0.87.5 → 0.87.7
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/client.d.ts +5 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +4 -2
- package/dest/private/acvm/acvm.d.ts +5 -2
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/index.d.ts +0 -1
- package/dest/private/acvm/index.d.ts.map +1 -1
- package/dest/private/acvm/index.js +0 -1
- package/dest/private/{providers/acvm_native.d.ts → acvm_native.d.ts} +4 -4
- package/dest/private/acvm_native.d.ts.map +1 -0
- package/dest/private/{providers/acvm_wasm.d.ts → acvm_wasm.d.ts} +4 -4
- package/dest/private/acvm_wasm.d.ts.map +1 -0
- package/dest/private/{providers/acvm_wasm.js → acvm_wasm.js} +2 -2
- package/dest/private/{providers/acvm_wasm_with_blobs.d.ts → acvm_wasm_with_blobs.d.ts} +5 -5
- package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -0
- package/dest/private/{providers/acvm_wasm_with_blobs.js → acvm_wasm_with_blobs.js} +2 -2
- package/dest/private/{providers/circuit_recording → circuit_recording}/circuit_recorder.d.ts +41 -21
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/circuit_recorder.js +209 -0
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +31 -0
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/file_circuit_recorder.js +135 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +5 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -0
- package/dest/private/circuit_recording/memory_circuit_recorder.js +9 -0
- package/dest/private/{providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts → circuit_recording/simulator_recorder_wrapper.d.ts} +9 -7
- package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -0
- package/dest/private/{providers/circuit_recording/simulation_provider_recorder_wrapper.js → circuit_recording/simulator_recorder_wrapper.js} +18 -13
- package/dest/private/{providers/simulation_provider.d.ts → circuit_simulator.d.ts} +4 -4
- package/dest/private/circuit_simulator.d.ts.map +1 -0
- package/dest/private/{providers/simulation_provider.js → circuit_simulator.js} +1 -1
- package/dest/private/factory.d.ts +12 -0
- package/dest/private/factory.d.ts.map +1 -0
- package/dest/private/{providers/factory.js → factory.js} +2 -2
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +1 -0
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +6 -0
- package/dest/public/public_tx_simulator/apps_tests/amm_test.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/apps_tests/amm_test.js +27 -55
- package/dest/server.d.ts +6 -3
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +5 -2
- package/dest/testing.d.ts +1 -1
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +1 -1
- package/package.json +15 -15
- package/src/client.ts +5 -3
- package/src/private/acvm/acvm.ts +5 -3
- package/src/private/acvm/index.ts +0 -1
- package/src/private/{providers/acvm_native.ts → acvm_native.ts} +4 -4
- package/src/private/{providers/acvm_wasm.ts → acvm_wasm.ts} +4 -4
- package/src/private/{providers/acvm_wasm_with_blobs.ts → acvm_wasm_with_blobs.ts} +5 -5
- package/src/private/circuit_recording/circuit_recorder.ts +260 -0
- package/src/private/circuit_recording/file_circuit_recorder.ts +158 -0
- package/src/private/circuit_recording/memory_circuit_recorder.ts +11 -0
- package/src/private/{providers/circuit_recording/simulation_provider_recorder_wrapper.ts → circuit_recording/simulator_recorder_wrapper.ts} +26 -18
- package/src/private/{providers/simulation_provider.ts → circuit_simulator.ts} +3 -3
- package/src/private/{providers/factory.ts → factory.ts} +6 -6
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +5 -0
- package/src/public/public_tx_simulator/apps_tests/amm_test.ts +49 -44
- package/src/server.ts +6 -3
- package/src/testing.ts +1 -1
- package/dest/private/acvm/oracle/index.d.ts +0 -14
- package/dest/private/acvm/oracle/index.d.ts.map +0 -1
- package/dest/private/acvm/oracle/index.js +0 -2
- package/dest/private/acvm/oracle/oracle.d.ts +0 -52
- package/dest/private/acvm/oracle/oracle.d.ts.map +0 -1
- package/dest/private/acvm/oracle/oracle.js +0 -312
- package/dest/private/acvm/oracle/typed_oracle.d.ts +0 -83
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/private/acvm/oracle/typed_oracle.js +0 -138
- package/dest/private/execution_data_provider.d.ts +0 -301
- package/dest/private/execution_data_provider.d.ts.map +0 -1
- package/dest/private/execution_data_provider.js +0 -14
- package/dest/private/execution_note_cache.d.ts +0 -93
- package/dest/private/execution_note_cache.d.ts.map +0 -1
- package/dest/private/execution_note_cache.js +0 -180
- package/dest/private/hashed_values_cache.d.ts +0 -28
- package/dest/private/hashed_values_cache.d.ts.map +0 -1
- package/dest/private/hashed_values_cache.js +0 -36
- package/dest/private/index.d.ts +0 -16
- package/dest/private/index.d.ts.map +0 -1
- package/dest/private/index.js +0 -15
- package/dest/private/message_load_oracle_inputs.d.ts +0 -19
- package/dest/private/message_load_oracle_inputs.d.ts.map +0 -1
- package/dest/private/message_load_oracle_inputs.js +0 -24
- package/dest/private/pick_notes.d.ts +0 -85
- package/dest/private/pick_notes.d.ts.map +0 -1
- package/dest/private/pick_notes.js +0 -51
- package/dest/private/private_execution.d.ts +0 -25
- package/dest/private/private_execution.d.ts.map +0 -1
- package/dest/private/private_execution.js +0 -95
- package/dest/private/private_execution_oracle.d.ts +0 -187
- package/dest/private/private_execution_oracle.d.ts.map +0 -1
- package/dest/private/private_execution_oracle.js +0 -318
- package/dest/private/providers/acvm_native.d.ts.map +0 -1
- package/dest/private/providers/acvm_wasm.d.ts.map +0 -1
- package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +0 -1
- package/dest/private/providers/circuit_recording/circuit_recorder.d.ts.map +0 -1
- package/dest/private/providers/circuit_recording/circuit_recorder.js +0 -246
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map +0 -1
- package/dest/private/providers/factory.d.ts +0 -12
- package/dest/private/providers/factory.d.ts.map +0 -1
- package/dest/private/providers/simulation_provider.d.ts.map +0 -1
- package/dest/private/simulator.d.ts +0 -36
- package/dest/private/simulator.d.ts.map +0 -1
- package/dest/private/simulator.js +0 -104
- package/dest/private/utility_execution_oracle.d.ts +0 -163
- package/dest/private/utility_execution_oracle.d.ts.map +0 -1
- package/dest/private/utility_execution_oracle.js +0 -257
- package/dest/test/utils.d.ts +0 -13
- package/dest/test/utils.d.ts.map +0 -1
- package/dest/test/utils.js +0 -22
- package/src/private/acvm/oracle/index.ts +0 -16
- package/src/private/acvm/oracle/oracle.ts +0 -523
- package/src/private/acvm/oracle/typed_oracle.ts +0 -273
- package/src/private/execution_data_provider.ts +0 -388
- package/src/private/execution_note_cache.ts +0 -217
- package/src/private/hashed_values_cache.ts +0 -47
- package/src/private/index.ts +0 -19
- package/src/private/message_load_oracle_inputs.ts +0 -23
- package/src/private/pick_notes.ts +0 -141
- package/src/private/private_execution.ts +0 -159
- package/src/private/private_execution_oracle.ts +0 -508
- package/src/private/providers/circuit_recording/circuit_recorder.ts +0 -283
- package/src/private/simulator.ts +0 -170
- package/src/private/utility_execution_oracle.ts +0 -384
- package/src/test/utils.ts +0 -36
- /package/dest/private/{providers/acvm_native.js → acvm_native.js} +0 -0
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { createHash } from 'crypto';
|
|
3
|
-
import fs from 'fs/promises';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { Oracle } from '../../acvm/oracle/oracle.js';
|
|
6
|
-
/**
|
|
7
|
-
* Class responsible for recording circuit inputs necessary to replay the circuit. These inputs are the initial witness
|
|
8
|
-
* map and the oracle calls made during the circuit execution/witness generation.
|
|
9
|
-
*
|
|
10
|
-
* The recording is stored in a JSON file called `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is
|
|
11
|
-
* a counter to ensure unique filenames. The file is stored in the `recordDir` directory provided as a parameter to
|
|
12
|
-
* CircuitRecorder.start().
|
|
13
|
-
*
|
|
14
|
-
* Example recording file:
|
|
15
|
-
* ```json
|
|
16
|
-
* {
|
|
17
|
-
* "circuitName": "AMM",
|
|
18
|
-
* "functionName": "add_liquidity",
|
|
19
|
-
* "bytecodeMd5Hash": "b46c640ed38f20eac5f61a5e41d8dd1e",
|
|
20
|
-
* "timestamp": 1740691464360,
|
|
21
|
-
* "inputs": {
|
|
22
|
-
* "0": "0x1e89de1f0ad5204263733b7ddf65bec45b8f44714a4da85a46474dad677679ef",
|
|
23
|
-
* "1": "0x00f4d59c0ff773427bb0fed5b422557ca4dc5655abe53d31fa9408cb3c5a672f",
|
|
24
|
-
* "5": "0x000000000000000000000000000000000000000000000000000000000000000f"
|
|
25
|
-
* },
|
|
26
|
-
* "oracleCalls": [
|
|
27
|
-
* {
|
|
28
|
-
* "name": "loadCapsule",
|
|
29
|
-
* "inputs": [
|
|
30
|
-
* [
|
|
31
|
-
* "0x102422483bad6abd385948435667e144ac4c272576e325e7563608876cd446fd"
|
|
32
|
-
* ],
|
|
33
|
-
* [
|
|
34
|
-
* "0x000000000000000000000000000000000000000000000000000000000000004d"
|
|
35
|
-
* ],
|
|
36
|
-
* [
|
|
37
|
-
* "0x0000000000000000000000000000000000000000000000000000000000000001"
|
|
38
|
-
* ]
|
|
39
|
-
* ],
|
|
40
|
-
* "outputs": [
|
|
41
|
-
* "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
42
|
-
* [
|
|
43
|
-
* "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
44
|
-
* ]
|
|
45
|
-
* ]
|
|
46
|
-
* },
|
|
47
|
-
* {
|
|
48
|
-
* "name": "syncPrivateState",
|
|
49
|
-
* "inputs": []
|
|
50
|
-
* }
|
|
51
|
-
* ]
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*/ export class CircuitRecorder {
|
|
55
|
-
filePath;
|
|
56
|
-
logger;
|
|
57
|
-
isFirstCall;
|
|
58
|
-
constructor(filePath){
|
|
59
|
-
this.filePath = filePath;
|
|
60
|
-
this.logger = createLogger('simulator:acvm:recording');
|
|
61
|
-
this.isFirstCall = true;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Initializes a new circuit recording session.
|
|
65
|
-
* @param recordDir - Directory to store the recording
|
|
66
|
-
* @param input - Circuit input witness
|
|
67
|
-
* @param circuitBytecode - Compiled circuit bytecode
|
|
68
|
-
* @param circuitName - Name of the circuit
|
|
69
|
-
* @param functionName - Name of the circuit function (defaults to 'main'). This is meaningful only for
|
|
70
|
-
* contracts as protocol circuits artifacts always contain a single entrypoint function called 'main'.
|
|
71
|
-
* @returns A new CircuitRecorder instance
|
|
72
|
-
*/ static async start(recordDir, input, circuitBytecode, circuitName, functionName = 'main') {
|
|
73
|
-
const recording = {
|
|
74
|
-
circuitName: circuitName,
|
|
75
|
-
functionName: functionName,
|
|
76
|
-
bytecodeMd5Hash: createHash('md5').update(circuitBytecode).digest('hex'),
|
|
77
|
-
timestamp: Date.now(),
|
|
78
|
-
inputs: Object.fromEntries(input)
|
|
79
|
-
};
|
|
80
|
-
const recordingStringWithoutClosingBracket = JSON.stringify(recording, null, 2).slice(0, -2);
|
|
81
|
-
try {
|
|
82
|
-
// Check if the recording directory exists and is a directory
|
|
83
|
-
const stats = await fs.stat(recordDir);
|
|
84
|
-
if (!stats.isDirectory()) {
|
|
85
|
-
throw new Error(`Recording path ${recordDir} exists but is not a directory`);
|
|
86
|
-
}
|
|
87
|
-
} catch (err) {
|
|
88
|
-
if (err.code === 'ENOENT') {
|
|
89
|
-
// The directory does not exist so we create it
|
|
90
|
-
await fs.mkdir(recordDir, {
|
|
91
|
-
recursive: true
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
throw err;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const filePath = await CircuitRecorder.#computeFilePathAndStoreInitialRecording(recordDir, circuitName, functionName, recordingStringWithoutClosingBracket);
|
|
98
|
-
return new CircuitRecorder(filePath);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Computes a unique file path for the recording by trying different counter values.
|
|
102
|
-
* This is needed because multiple recordings of the same circuit could be happening simultaneously or an older
|
|
103
|
-
* recording might be present.
|
|
104
|
-
* @param recordDir - Directory to store the recording
|
|
105
|
-
* @param circuitName - Name of the circuit
|
|
106
|
-
* @param functionName - Name of the circuit function
|
|
107
|
-
* @param recordingContent - Initial recording content
|
|
108
|
-
* @returns A unique file path for the recording
|
|
109
|
-
*/ static async #computeFilePathAndStoreInitialRecording(recordDir, circuitName, functionName, recordingContent) {
|
|
110
|
-
let counter = 0;
|
|
111
|
-
while(true){
|
|
112
|
-
try {
|
|
113
|
-
const filePath = getFilePath(recordDir, circuitName, functionName, counter);
|
|
114
|
-
// Write the initial recording content to the file
|
|
115
|
-
await fs.writeFile(filePath, recordingContent + ',\n "oracleCalls": [\n', {
|
|
116
|
-
flag: 'wx'
|
|
117
|
-
});
|
|
118
|
-
return filePath;
|
|
119
|
-
} catch (err) {
|
|
120
|
-
if (err.code === 'EEXIST') {
|
|
121
|
-
counter++;
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
throw err;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Wraps a callback to record all oracle/foreign calls.
|
|
130
|
-
* @param callback - The original callback to wrap, either a user circuit callback or protocol circuit callback.
|
|
131
|
-
* @returns A wrapped callback that records all oracle interactions.
|
|
132
|
-
*/ wrapCallback(callback) {
|
|
133
|
-
if (!callback) {
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
if (this.#isACIRCallback(callback)) {
|
|
137
|
-
return this.#wrapUserCircuitCallback(callback);
|
|
138
|
-
}
|
|
139
|
-
return this.#wrapProtocolCircuitCallback(callback);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Type guard to check if a callback is an ACIRCallback.
|
|
143
|
-
*/ #isACIRCallback(callback) {
|
|
144
|
-
return typeof callback === 'object' && callback !== null && !('call' in callback);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Wraps a user circuit callback to record all oracle calls.
|
|
148
|
-
* @param callback - The original circuit callback.
|
|
149
|
-
* @returns A wrapped callback that records all oracle interactions which is to be provided to the ACVM.
|
|
150
|
-
*/ #wrapUserCircuitCallback(callback) {
|
|
151
|
-
const recordingCallback = {};
|
|
152
|
-
const oracleMethods = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>name !== 'constructor');
|
|
153
|
-
for (const name of oracleMethods){
|
|
154
|
-
const fn = callback[name];
|
|
155
|
-
if (!fn) {
|
|
156
|
-
throw new Error(`Oracle method ${name} not found when setting up recording callback`);
|
|
157
|
-
}
|
|
158
|
-
recordingCallback[name] = (...args)=>{
|
|
159
|
-
const result = fn.call(callback, ...args);
|
|
160
|
-
if (result instanceof Promise) {
|
|
161
|
-
return result.then(async (r)=>{
|
|
162
|
-
await this.#recordCall(name, args, r);
|
|
163
|
-
return r;
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
void this.#recordCall(name, args, result);
|
|
167
|
-
return result;
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return recordingCallback;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Wraps a protocol circuit callback to record all oracle calls.
|
|
174
|
-
* @param callback - The original oracle circuit callback.
|
|
175
|
-
* @returns A wrapped handler that records all oracle interactions which is to be provided to the ACVM.
|
|
176
|
-
*/ #wrapProtocolCircuitCallback(callback) {
|
|
177
|
-
return async (name, inputs)=>{
|
|
178
|
-
const result = await callback(name, inputs);
|
|
179
|
-
await this.#recordCall(name, inputs, result);
|
|
180
|
-
return result;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Records a single oracle/foreign call with its inputs and outputs.
|
|
185
|
-
* @param name - Name of the call
|
|
186
|
-
* @param inputs - Input arguments
|
|
187
|
-
* @param outputs - Output results
|
|
188
|
-
*/ async #recordCall(name, inputs, outputs) {
|
|
189
|
-
try {
|
|
190
|
-
const entry = {
|
|
191
|
-
name,
|
|
192
|
-
inputs,
|
|
193
|
-
outputs
|
|
194
|
-
};
|
|
195
|
-
const prefix = this.isFirstCall ? ' ' : ' ,';
|
|
196
|
-
this.isFirstCall = false;
|
|
197
|
-
await fs.appendFile(this.filePath, prefix + JSON.stringify(entry) + '\n');
|
|
198
|
-
} catch (err) {
|
|
199
|
-
this.logger.error('Failed to log circuit call', {
|
|
200
|
-
error: err
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Finalizes the recording file by adding closing brackets. Without calling this method, the recording file is
|
|
206
|
-
* incomplete and it fails to parse.
|
|
207
|
-
*/ async finish() {
|
|
208
|
-
try {
|
|
209
|
-
await fs.appendFile(this.filePath, ' ]\n}\n');
|
|
210
|
-
} catch (err) {
|
|
211
|
-
this.logger.error('Failed to finalize recording file', {
|
|
212
|
-
error: err
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Finalizes the recording file by adding the error and closing brackets. Without calling this method or `finish`,
|
|
218
|
-
* the recording file is incomplete and it fails to parse.
|
|
219
|
-
* @param error - The error that occurred during circuit execution
|
|
220
|
-
*/ async finishWithError(error) {
|
|
221
|
-
try {
|
|
222
|
-
await fs.appendFile(this.filePath, ' ],\n');
|
|
223
|
-
await fs.appendFile(this.filePath, ` "error": ${JSON.stringify(error)}\n`);
|
|
224
|
-
await fs.appendFile(this.filePath, '}\n');
|
|
225
|
-
} catch (err) {
|
|
226
|
-
this.logger.error('Failed to finalize recording file with error', {
|
|
227
|
-
error: err
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Generates a file path for storing circuit recordings. The format of the filename is:
|
|
234
|
-
* `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is a counter to ensure unique filenames.
|
|
235
|
-
* @param recordDir - Base directory for recordings
|
|
236
|
-
* @param circuitName - Name of the circuit
|
|
237
|
-
* @param functionName - Name of the circuit function
|
|
238
|
-
* @param counter - Counter to ensure unique filenames. This is expected to be incremented in a loop until there is no
|
|
239
|
-
* existing file with the same name.
|
|
240
|
-
* @returns A file path for the recording.
|
|
241
|
-
*/ function getFilePath(recordDir, circuitName, functionName, counter) {
|
|
242
|
-
const date = new Date();
|
|
243
|
-
const formattedDate = date.toISOString().split('T')[0];
|
|
244
|
-
const filename = `${circuitName}_${functionName}_${formattedDate}_${counter}.json`;
|
|
245
|
-
return path.join(recordDir, filename);
|
|
246
|
-
}
|
package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simulation_provider_recorder_wrapper.d.ts","sourceRoot":"","sources":["../../../../src/private/providers/circuit_recording/simulation_provider_recorder_wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,kBAAkB;;IAC9D,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,kBAAkB;IAEjD,sBAAsB,CACpB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GACvC,OAAO,CAAC,WAAW,CAAC;IAavB,kBAAkB,CAChB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,gCAAgC,EAC1C,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,mBAAmB,CAAC;CA4ChC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
-
import type { SimulationProvider } from './simulation_provider.js';
|
|
3
|
-
export type SimulationProviderConfig = {
|
|
4
|
-
acvmBinaryPath?: string;
|
|
5
|
-
acvmWorkingDirectory?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function getSimulationProviderConfigFromEnv(): {
|
|
8
|
-
acvmWorkingDirectory: string | undefined;
|
|
9
|
-
acvmBinaryPath: string | undefined;
|
|
10
|
-
};
|
|
11
|
-
export declare function createSimulationProvider(config: SimulationProviderConfig, logger?: Logger): Promise<SimulationProvider>;
|
|
12
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/private/providers/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAMlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,wBAAgB,kCAAkC;;;EAMjD;AAED,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,GACzC,OAAO,CAAC,kBAAkB,CAAC,CAa7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simulation_provider.d.ts","sourceRoot":"","sources":["../../../src/private/providers/simulation_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAE3F,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,sBAAsB,CACpB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GACvC,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB;;;;;;;OAOG;IACH,kBAAkB,CAChB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,gCAAgC,EAC1C,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG;IAAE,uBAAuB,CAAC,EAAE,GAAG,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAIxG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,GAAG,YAAY,CA0C1G"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { AbiDecoded, FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
-
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { PrivateExecutionResult, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
6
|
-
import type { ExecutionDataProvider } from './execution_data_provider.js';
|
|
7
|
-
import type { SimulationProvider } from './providers/simulation_provider.js';
|
|
8
|
-
/**
|
|
9
|
-
* The ACIR simulator.
|
|
10
|
-
*/
|
|
11
|
-
export declare class AcirSimulator {
|
|
12
|
-
private executionDataProvider;
|
|
13
|
-
private simulationProvider;
|
|
14
|
-
private log;
|
|
15
|
-
constructor(executionDataProvider: ExecutionDataProvider, simulationProvider: SimulationProvider);
|
|
16
|
-
/**
|
|
17
|
-
* Runs a private function.
|
|
18
|
-
* @param request - The transaction request.
|
|
19
|
-
* @param entryPointArtifact - The artifact of the entry point function.
|
|
20
|
-
* @param contractAddress - The address of the contract (should match request.origin)
|
|
21
|
-
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract or a specific account.
|
|
22
|
-
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
23
|
-
* @returns The result of the execution.
|
|
24
|
-
*/
|
|
25
|
-
run(request: TxExecutionRequest, contractAddress: AztecAddress, selector: FunctionSelector, msgSender?: AztecAddress, scopes?: AztecAddress[]): Promise<PrivateExecutionResult>;
|
|
26
|
-
/**
|
|
27
|
-
* Runs a utility function.
|
|
28
|
-
* @param call - The function call to execute.
|
|
29
|
-
* @param authwits - Authentication witnesses required for the function call.
|
|
30
|
-
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
31
|
-
* accounts if not specified.
|
|
32
|
-
* @returns A decoded ABI value containing the function's return data.
|
|
33
|
-
*/
|
|
34
|
-
runUtility(call: FunctionCall, authwits: AuthWitness[], scopes?: AztecAddress[]): Promise<AbiDecoded>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=simulator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../src/private/simulator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAA6B,sBAAsB,EAAE,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAK1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG7E;;GAEG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,kBAAkB;IAJ5B,OAAO,CAAC,GAAG,CAAS;gBAGV,qBAAqB,EAAE,qBAAqB,EAC5C,kBAAkB,EAAE,kBAAkB;IAKhD;;;;;;;;OAQG;IACU,GAAG,CACd,OAAO,EAAE,kBAAkB,EAC3B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,eAA6C,EACtD,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,sBAAsB,CAAC;IA2ElC;;;;;;;OAOG;IACU,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;CAwCnH"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import { CallContext, HashedValues, PrivateExecutionResult, collectNested } from '@aztec/stdlib/tx';
|
|
6
|
-
import { ExecutionError, createSimulationError, resolveAssertionMessageFromError } from '../common/errors.js';
|
|
7
|
-
import { Oracle, extractCallStack, toACVMWitness, witnessMapToFields } from './acvm/index.js';
|
|
8
|
-
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
9
|
-
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
10
|
-
import { executePrivateFunction, verifyCurrentClassId } from './private_execution.js';
|
|
11
|
-
import { PrivateExecutionOracle } from './private_execution_oracle.js';
|
|
12
|
-
import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
13
|
-
/**
|
|
14
|
-
* The ACIR simulator.
|
|
15
|
-
*/ export class AcirSimulator {
|
|
16
|
-
executionDataProvider;
|
|
17
|
-
simulationProvider;
|
|
18
|
-
log;
|
|
19
|
-
constructor(executionDataProvider, simulationProvider){
|
|
20
|
-
this.executionDataProvider = executionDataProvider;
|
|
21
|
-
this.simulationProvider = simulationProvider;
|
|
22
|
-
this.log = createLogger('simulator');
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Runs a private function.
|
|
26
|
-
* @param request - The transaction request.
|
|
27
|
-
* @param entryPointArtifact - The artifact of the entry point function.
|
|
28
|
-
* @param contractAddress - The address of the contract (should match request.origin)
|
|
29
|
-
* @param msgSender - The address calling the function. This can be replaced to simulate a call from another contract or a specific account.
|
|
30
|
-
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
31
|
-
* @returns The result of the execution.
|
|
32
|
-
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), scopes) {
|
|
33
|
-
const header = await this.executionDataProvider.getBlockHeader();
|
|
34
|
-
await verifyCurrentClassId(contractAddress, this.executionDataProvider);
|
|
35
|
-
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(contractAddress, selector);
|
|
36
|
-
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
37
|
-
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as private`);
|
|
38
|
-
}
|
|
39
|
-
if (request.origin !== contractAddress) {
|
|
40
|
-
this.log.warn(`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`);
|
|
41
|
-
}
|
|
42
|
-
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
43
|
-
const startSideEffectCounter = 1;
|
|
44
|
-
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
45
|
-
const txRequestHash = await request.toTxRequest().hash();
|
|
46
|
-
const noteCache = new ExecutionNoteCache(txRequestHash);
|
|
47
|
-
const context = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, header, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, this.executionDataProvider, this.simulationProvider, /*totalPublicArgsCount=*/ 0, startSideEffectCounter, undefined, scopes);
|
|
48
|
-
try {
|
|
49
|
-
const executionResult = await executePrivateFunction(this.simulationProvider, context, entryPointArtifact, contractAddress, request.functionSelector);
|
|
50
|
-
const { usedTxRequestHashForNonces } = noteCache.finish();
|
|
51
|
-
const firstNullifierHint = usedTxRequestHashForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
52
|
-
const publicCallRequests = collectNested([
|
|
53
|
-
executionResult
|
|
54
|
-
], (r)=>[
|
|
55
|
-
...r.publicInputs.publicCallRequests.map((r)=>r.inner),
|
|
56
|
-
r.publicInputs.publicTeardownCallRequest
|
|
57
|
-
]).filter((r)=>!r.isEmpty());
|
|
58
|
-
const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
|
|
59
|
-
const calldata = await context.loadFromExecutionCache(r.calldataHash);
|
|
60
|
-
return new HashedValues(calldata, r.calldataHash);
|
|
61
|
-
}));
|
|
62
|
-
return new PrivateExecutionResult(executionResult, firstNullifierHint, publicFunctionsCalldata);
|
|
63
|
-
} catch (err) {
|
|
64
|
-
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// docs:start:execute_utility_function
|
|
68
|
-
/**
|
|
69
|
-
* Runs a utility function.
|
|
70
|
-
* @param call - The function call to execute.
|
|
71
|
-
* @param authwits - Authentication witnesses required for the function call.
|
|
72
|
-
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
73
|
-
* accounts if not specified.
|
|
74
|
-
* @returns A decoded ABI value containing the function's return data.
|
|
75
|
-
*/ async runUtility(call, authwits, scopes) {
|
|
76
|
-
await verifyCurrentClassId(call.to, this.executionDataProvider);
|
|
77
|
-
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(call.to, call.selector);
|
|
78
|
-
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
79
|
-
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
80
|
-
}
|
|
81
|
-
const oracle = new UtilityExecutionOracle(call.to, authwits, [], this.executionDataProvider, undefined, scopes);
|
|
82
|
-
try {
|
|
83
|
-
this.log.verbose(`Executing utility function ${entryPointArtifact.name}`, {
|
|
84
|
-
contract: call.to,
|
|
85
|
-
selector: call.selector
|
|
86
|
-
});
|
|
87
|
-
const initialWitness = toACVMWitness(0, call.args);
|
|
88
|
-
const acirExecutionResult = await this.simulationProvider.executeUserCircuit(initialWitness, entryPointArtifact, new Oracle(oracle)).catch((err)=>{
|
|
89
|
-
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
90
|
-
throw new ExecutionError(err.message, {
|
|
91
|
-
contractAddress: call.to,
|
|
92
|
-
functionSelector: call.selector
|
|
93
|
-
}, extractCallStack(err, entryPointArtifact.debug), {
|
|
94
|
-
cause: err
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
const returnWitness = witnessMapToFields(acirExecutionResult.returnWitness);
|
|
98
|
-
this.log.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
|
|
99
|
-
return decodeFromAbi(entryPointArtifact.returnTypes, returnWitness);
|
|
100
|
-
} catch (err) {
|
|
101
|
-
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Fr, Point } from '@aztec/foundation/fields';
|
|
2
|
-
import type { EventSelector } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
6
|
-
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
7
|
-
import { IndexedTaggingSecret, LogWithTxData } from '@aztec/stdlib/logs';
|
|
8
|
-
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
9
|
-
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
10
|
-
import type { BlockHeader, Capsule, TxHash } from '@aztec/stdlib/tx';
|
|
11
|
-
import { type NoteData, TypedOracle } from './acvm/index.js';
|
|
12
|
-
import type { ExecutionDataProvider } from './execution_data_provider.js';
|
|
13
|
-
/**
|
|
14
|
-
* The oracle for an execution of utility contract functions.
|
|
15
|
-
*/
|
|
16
|
-
export declare class UtilityExecutionOracle extends TypedOracle {
|
|
17
|
-
protected readonly contractAddress: AztecAddress;
|
|
18
|
-
/** List of transient auth witnesses to be used during this simulation */
|
|
19
|
-
protected readonly authWitnesses: AuthWitness[];
|
|
20
|
-
protected readonly capsules: Capsule[];
|
|
21
|
-
protected readonly executionDataProvider: ExecutionDataProvider;
|
|
22
|
-
protected log: import("@aztec/foundation/log").Logger;
|
|
23
|
-
protected readonly scopes?: AztecAddress[] | undefined;
|
|
24
|
-
constructor(contractAddress: AztecAddress,
|
|
25
|
-
/** List of transient auth witnesses to be used during this simulation */
|
|
26
|
-
authWitnesses: AuthWitness[], capsules: Capsule[], // TODO(#12425): Rename to transientCapsules
|
|
27
|
-
executionDataProvider: ExecutionDataProvider, log?: import("@aztec/foundation/log").Logger, scopes?: AztecAddress[] | undefined);
|
|
28
|
-
getBlockNumber(): Promise<number>;
|
|
29
|
-
getContractAddress(): Promise<AztecAddress>;
|
|
30
|
-
getChainId(): Promise<Fr>;
|
|
31
|
-
getVersion(): Promise<Fr>;
|
|
32
|
-
/**
|
|
33
|
-
* Retrieve keys associated with a specific master public key and app address.
|
|
34
|
-
* @param pkMHash - The master public key hash.
|
|
35
|
-
* @returns A Promise that resolves to nullifier keys.
|
|
36
|
-
* @throws If the keys are not registered in the key store.
|
|
37
|
-
*/
|
|
38
|
-
getKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
|
|
39
|
-
/**
|
|
40
|
-
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
41
|
-
* @param blockNumber - The block number at which to get the membership witness.
|
|
42
|
-
* @param treeId - Id of the tree to get the sibling path from.
|
|
43
|
-
* @param leafValue - The leaf value
|
|
44
|
-
* @returns The index and sibling path concatenated [index, sibling_path]
|
|
45
|
-
*/
|
|
46
|
-
getMembershipWitness(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<Fr[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Returns a nullifier membership witness for a given nullifier at a given block.
|
|
49
|
-
* @param blockNumber - The block number at which to get the index.
|
|
50
|
-
* @param nullifier - Nullifier we try to find witness for.
|
|
51
|
-
* @returns The nullifier membership witness (if found).
|
|
52
|
-
*/
|
|
53
|
-
getNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
54
|
-
/**
|
|
55
|
-
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
56
|
-
* @param blockNumber - The block number at which to get the index.
|
|
57
|
-
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
58
|
-
* @returns The low nullifier membership witness (if found).
|
|
59
|
-
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
60
|
-
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
61
|
-
* we are trying to prove non-inclusion for.
|
|
62
|
-
*/
|
|
63
|
-
getLowNullifierMembershipWitness(blockNumber: number, nullifier: Fr): Promise<NullifierMembershipWitness | undefined>;
|
|
64
|
-
/**
|
|
65
|
-
* Returns a public data tree witness for a given leaf slot at a given block.
|
|
66
|
-
* @param blockNumber - The block number at which to get the index.
|
|
67
|
-
* @param leafSlot - The slot of the public data tree to get the witness for.
|
|
68
|
-
* @returns - The witness
|
|
69
|
-
*/
|
|
70
|
-
getPublicDataWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
|
|
71
|
-
/**
|
|
72
|
-
* Fetches a block header of a given block.
|
|
73
|
-
* @param blockNumber - The number of a block of which to get the block header.
|
|
74
|
-
* @returns Block extracted from a block with block number `blockNumber`.
|
|
75
|
-
*/
|
|
76
|
-
getBlockHeader(blockNumber: number): Promise<BlockHeader | undefined>;
|
|
77
|
-
/**
|
|
78
|
-
* Retrieve the complete address associated to a given address.
|
|
79
|
-
* @param account - The account address.
|
|
80
|
-
* @returns A complete address associated with the input address.
|
|
81
|
-
* @throws An error if the account is not registered in the database.
|
|
82
|
-
*/
|
|
83
|
-
getCompleteAddress(account: AztecAddress): Promise<CompleteAddress>;
|
|
84
|
-
/**
|
|
85
|
-
* Returns a contract instance associated with an address or throws if not found.
|
|
86
|
-
* @param address - Address.
|
|
87
|
-
* @returns A contract instance.
|
|
88
|
-
*/
|
|
89
|
-
getContractInstance(address: AztecAddress): Promise<ContractInstance>;
|
|
90
|
-
/**
|
|
91
|
-
* Returns an auth witness for the given message hash. Checks on the list of transient witnesses
|
|
92
|
-
* for this transaction first, and falls back to the local database if not found.
|
|
93
|
-
* @param messageHash - Hash of the message to authenticate.
|
|
94
|
-
* @returns Authentication witness for the requested message hash.
|
|
95
|
-
*/
|
|
96
|
-
getAuthWitness(messageHash: Fr): Promise<Fr[] | undefined>;
|
|
97
|
-
/**
|
|
98
|
-
* Gets some notes for a contract address and storage slot.
|
|
99
|
-
* Returns a flattened array containing filtered notes.
|
|
100
|
-
*
|
|
101
|
-
* @remarks
|
|
102
|
-
* Check for pending notes with matching slot.
|
|
103
|
-
* Real notes coming from DB will have a leafIndex which
|
|
104
|
-
* represents their index in the note hash tree.
|
|
105
|
-
*
|
|
106
|
-
* @param storageSlot - The storage slot.
|
|
107
|
-
* @param numSelects - The number of valid selects in selectBy and selectValues.
|
|
108
|
-
* @param selectBy - An array of indices of the fields to selects.
|
|
109
|
-
* @param selectValues - The values to match.
|
|
110
|
-
* @param selectComparators - The comparators to use to match values.
|
|
111
|
-
* @param sortBy - An array of indices of the fields to sort.
|
|
112
|
-
* @param sortOrder - The order of the corresponding index in sortBy. (1: DESC, 2: ASC, 0: Do nothing)
|
|
113
|
-
* @param limit - The number of notes to retrieve per query.
|
|
114
|
-
* @param offset - The starting index for pagination.
|
|
115
|
-
* @param status - The status of notes to fetch.
|
|
116
|
-
* @returns Array of note data.
|
|
117
|
-
*/
|
|
118
|
-
getNotes(storageSlot: Fr, numSelects: number, selectByIndexes: number[], selectByOffsets: number[], selectByLengths: number[], selectValues: Fr[], selectComparators: number[], sortByIndexes: number[], sortByOffsets: number[], sortByLengths: number[], sortOrder: number[], limit: number, offset: number, status: NoteStatus): Promise<NoteData[]>;
|
|
119
|
-
/**
|
|
120
|
-
* Check if a nullifier exists in the nullifier tree.
|
|
121
|
-
* @param innerNullifier - The inner nullifier.
|
|
122
|
-
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
123
|
-
*/
|
|
124
|
-
checkNullifierExists(innerNullifier: Fr): Promise<boolean>;
|
|
125
|
-
/**
|
|
126
|
-
* Fetches a message from the executionDataProvider, given its key.
|
|
127
|
-
* @param contractAddress - Address of a contract by which the message was emitted.
|
|
128
|
-
* @param messageHash - Hash of the message.
|
|
129
|
-
* @param secret - Secret used to compute a nullifier.
|
|
130
|
-
* @dev Contract address and secret are only used to compute the nullifier to get non-nullified messages
|
|
131
|
-
* @returns The l1 to l2 membership witness (index of message in the tree and sibling path).
|
|
132
|
-
*/
|
|
133
|
-
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<import("./message_load_oracle_inputs.js").MessageLoadOracleInputs<39>>;
|
|
134
|
-
/**
|
|
135
|
-
* Read the public storage data.
|
|
136
|
-
* @param contractAddress - The address to read storage from.
|
|
137
|
-
* @param startStorageSlot - The starting storage slot.
|
|
138
|
-
* @param blockNumber - The block number to read storage at.
|
|
139
|
-
* @param numberOfElements - Number of elements to read from the starting storage slot.
|
|
140
|
-
*/
|
|
141
|
-
storageRead(contractAddress: AztecAddress, startStorageSlot: Fr, blockNumber: number, numberOfElements: number): Promise<Fr[]>;
|
|
142
|
-
debugLog(message: string, fields: Fr[]): void;
|
|
143
|
-
/**
|
|
144
|
-
* Returns the tagging secret for a given sender and recipient pair, siloed to the current contract address.
|
|
145
|
-
* Includes the next index to be used used for tagging with this secret.
|
|
146
|
-
* For this to work, the ivsk_m of the sender must be known.
|
|
147
|
-
* @param sender - The address sending the note
|
|
148
|
-
* @param recipient - The address receiving the note
|
|
149
|
-
* @returns A tagging secret that can be used to tag notes.
|
|
150
|
-
*/
|
|
151
|
-
getIndexedTaggingSecretAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<IndexedTaggingSecret>;
|
|
152
|
-
syncPrivateState(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
153
|
-
deliverNote(contractAddress: AztecAddress, storageSlot: Fr, nonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash: TxHash, recipient: AztecAddress): Promise<void>;
|
|
154
|
-
getLogByTag(tag: Fr): Promise<LogWithTxData | null>;
|
|
155
|
-
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
|
|
156
|
-
loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null>;
|
|
157
|
-
deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
|
|
158
|
-
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
|
|
159
|
-
aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer>;
|
|
160
|
-
getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
|
|
161
|
-
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector, msgContent: Fr[], txHash: TxHash, logIndexInTx: number, txIndexInBlock: number): Promise<void>;
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=utility_execution_oracle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utility_execution_oracle.d.ts","sourceRoot":"","sources":["../../src/private/utility_execution_oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,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