@aztec/simulator 0.87.2 → 0.87.3
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 +2 -0
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +2 -0
- package/dest/private/acvm/acvm.d.ts +4 -0
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/oracle/oracle.d.ts +1 -1
- package/dest/private/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/private/acvm/oracle/oracle.js +2 -2
- package/dest/private/acvm/oracle/typed_oracle.d.ts +1 -1
- package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/private/acvm/oracle/typed_oracle.js +2 -2
- package/dest/private/private_execution.d.ts.map +1 -1
- package/dest/private/private_execution.js +2 -1
- package/dest/private/private_execution_oracle.d.ts +1 -1
- package/dest/private/private_execution_oracle.d.ts.map +1 -1
- package/dest/private/private_execution_oracle.js +1 -1
- package/dest/private/providers/circuit_recording/circuit_recorder.d.ts +39 -19
- package/dest/private/providers/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/providers/circuit_recording/circuit_recorder.js +90 -126
- package/dest/private/providers/circuit_recording/file_circuit_recorder.d.ts +31 -0
- package/dest/private/providers/circuit_recording/file_circuit_recorder.d.ts.map +1 -0
- package/dest/private/providers/circuit_recording/file_circuit_recorder.js +135 -0
- package/dest/private/providers/circuit_recording/memory_circuit_recorder.d.ts +5 -0
- package/dest/private/providers/circuit_recording/memory_circuit_recorder.d.ts.map +1 -0
- package/dest/private/providers/circuit_recording/memory_circuit_recorder.js +9 -0
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts +3 -1
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map +1 -1
- package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.js +16 -11
- package/dest/private/utility_execution_oracle.d.ts +1 -1
- package/dest/private/utility_execution_oracle.d.ts.map +1 -1
- package/dest/private/utility_execution_oracle.js +1 -1
- 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 +2 -0
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +2 -0
- 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 +2 -0
- package/src/private/acvm/acvm.ts +3 -0
- package/src/private/acvm/oracle/oracle.ts +2 -2
- package/src/private/acvm/oracle/typed_oracle.ts +2 -2
- package/src/private/private_execution.ts +1 -0
- package/src/private/private_execution_oracle.ts +1 -1
- package/src/private/providers/circuit_recording/circuit_recorder.ts +114 -136
- package/src/private/providers/circuit_recording/file_circuit_recorder.ts +158 -0
- package/src/private/providers/circuit_recording/memory_circuit_recorder.ts +11 -0
- package/src/private/providers/circuit_recording/simulation_provider_recorder_wrapper.ts +22 -14
- package/src/private/utility_execution_oracle.ts +1 -1
- 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 +2 -0
- package/src/testing.ts +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ACVMWitness } from '../../acvm/acvm_types.js';
|
|
2
|
+
import { CircuitRecorder, type CircuitRecording } from './circuit_recorder.js';
|
|
3
|
+
export declare class FileCircuitRecorder extends CircuitRecorder {
|
|
4
|
+
#private;
|
|
5
|
+
private readonly recordDir;
|
|
6
|
+
recording?: CircuitRecording & {
|
|
7
|
+
filePath: string;
|
|
8
|
+
isFirstCall: boolean;
|
|
9
|
+
};
|
|
10
|
+
constructor(recordDir: string);
|
|
11
|
+
start(input: ACVMWitness, circuitBytecode: Buffer, circuitName: string, functionName?: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Records a single oracle/foreign call with its inputs and outputs.
|
|
14
|
+
* @param name - Name of the call
|
|
15
|
+
* @param inputs - Input arguments
|
|
16
|
+
* @param outputs - Output results
|
|
17
|
+
*/
|
|
18
|
+
recordCall(name: string, inputs: unknown[], outputs: unknown, time: number, stackDepth: number): Promise<import("./circuit_recorder.js").OracleCall>;
|
|
19
|
+
/**
|
|
20
|
+
* Finalizes the recording file by adding closing brackets. Without calling this method, the recording file is
|
|
21
|
+
* incomplete and it fails to parse.
|
|
22
|
+
*/
|
|
23
|
+
finish(): Promise<CircuitRecording>;
|
|
24
|
+
/**
|
|
25
|
+
* Finalizes the recording file by adding the error and closing brackets. Without calling this method or `finish`,
|
|
26
|
+
* the recording file is incomplete and it fails to parse.
|
|
27
|
+
* @param error - The error that occurred during circuit execution
|
|
28
|
+
*/
|
|
29
|
+
finishWithError(error: unknown): Promise<CircuitRecording>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=file_circuit_recorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_circuit_recorder.d.ts","sourceRoot":"","sources":["../../../../src/private/providers/circuit_recording/file_circuit_recorder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,qBAAa,mBAAoB,SAAQ,eAAe;;IAG1C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAF9B,SAAS,CAAC,EAAE,gBAAgB,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;gBAErD,SAAS,EAAE,MAAM;IAI/B,KAAK,CAClB,KAAK,EAAE,WAAW,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,YAAY,GAAE,MAAe;IAqE/B;;;;;OAKG;IACY,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAY7G;;;OAGG;IACY,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAalD;;;;OAIG;IACY,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAc1E"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { CircuitRecorder } from './circuit_recorder.js';
|
|
4
|
+
export class FileCircuitRecorder extends CircuitRecorder {
|
|
5
|
+
recordDir;
|
|
6
|
+
constructor(recordDir){
|
|
7
|
+
super(), this.recordDir = recordDir;
|
|
8
|
+
}
|
|
9
|
+
async start(input, circuitBytecode, circuitName, functionName = 'main') {
|
|
10
|
+
await super.start(input, circuitBytecode, circuitName, functionName);
|
|
11
|
+
const recordingStringWithoutClosingBracket = JSON.stringify({
|
|
12
|
+
...this.recording,
|
|
13
|
+
isFirstCall: undefined,
|
|
14
|
+
parent: undefined,
|
|
15
|
+
oracleCalls: undefined,
|
|
16
|
+
filePath: undefined
|
|
17
|
+
}, null, 2).slice(0, -2);
|
|
18
|
+
try {
|
|
19
|
+
// Check if the recording directory exists and is a directory
|
|
20
|
+
const stats = await fs.stat(this.recordDir);
|
|
21
|
+
if (!stats.isDirectory()) {
|
|
22
|
+
throw new Error(`Recording path ${this.recordDir} exists but is not a directory`);
|
|
23
|
+
}
|
|
24
|
+
} catch (err) {
|
|
25
|
+
if (err.code === 'ENOENT') {
|
|
26
|
+
// The directory does not exist so we create it
|
|
27
|
+
await fs.mkdir(this.recordDir, {
|
|
28
|
+
recursive: true
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
throw err;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this.recording.isFirstCall = true;
|
|
35
|
+
this.recording.filePath = await FileCircuitRecorder.#computeFilePathAndStoreInitialRecording(this.recordDir, this.recording.circuitName, this.recording.functionName, recordingStringWithoutClosingBracket);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Computes a unique file path for the recording by trying different counter values.
|
|
39
|
+
* This is needed because multiple recordings of the same circuit could be happening simultaneously or an older
|
|
40
|
+
* recording might be present.
|
|
41
|
+
* @param recordDir - Directory to store the recording
|
|
42
|
+
* @param circuitName - Name of the circuit
|
|
43
|
+
* @param functionName - Name of the circuit function
|
|
44
|
+
* @param recordingContent - Initial recording content
|
|
45
|
+
* @returns A unique file path for the recording
|
|
46
|
+
*/ static async #computeFilePathAndStoreInitialRecording(recordDir, circuitName, functionName, recordingContent) {
|
|
47
|
+
let counter = 0;
|
|
48
|
+
while(true){
|
|
49
|
+
try {
|
|
50
|
+
const filePath = getFilePath(recordDir, circuitName, functionName, counter);
|
|
51
|
+
// Write the initial recording content to the file
|
|
52
|
+
await fs.writeFile(filePath, recordingContent + ',\n "oracleCalls": [\n', {
|
|
53
|
+
flag: 'wx'
|
|
54
|
+
});
|
|
55
|
+
return filePath;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
if (err.code === 'EEXIST') {
|
|
58
|
+
counter++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
throw err;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Records a single oracle/foreign call with its inputs and outputs.
|
|
67
|
+
* @param name - Name of the call
|
|
68
|
+
* @param inputs - Input arguments
|
|
69
|
+
* @param outputs - Output results
|
|
70
|
+
*/ async recordCall(name, inputs, outputs, time, stackDepth) {
|
|
71
|
+
const entry = await super.recordCall(name, inputs, outputs, time, stackDepth);
|
|
72
|
+
try {
|
|
73
|
+
const prefix = this.recording.isFirstCall ? ' ' : ' ,';
|
|
74
|
+
this.recording.isFirstCall = false;
|
|
75
|
+
await fs.appendFile(this.recording.filePath, prefix + JSON.stringify(entry) + '\n');
|
|
76
|
+
} catch (err) {
|
|
77
|
+
this.logger.error('Failed to log circuit call', {
|
|
78
|
+
error: err
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return entry;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Finalizes the recording file by adding closing brackets. Without calling this method, the recording file is
|
|
85
|
+
* incomplete and it fails to parse.
|
|
86
|
+
*/ async finish() {
|
|
87
|
+
// Finish sets the recording to undefined if we are at the topmost circuit,
|
|
88
|
+
// so we save the current file path before that
|
|
89
|
+
const filePath = this.recording.filePath;
|
|
90
|
+
const result = await super.finish();
|
|
91
|
+
try {
|
|
92
|
+
await fs.appendFile(filePath, ' ]\n}\n');
|
|
93
|
+
} catch (err) {
|
|
94
|
+
this.logger.error('Failed to finalize recording file', {
|
|
95
|
+
error: err
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Finalizes the recording file by adding the error and closing brackets. Without calling this method or `finish`,
|
|
102
|
+
* the recording file is incomplete and it fails to parse.
|
|
103
|
+
* @param error - The error that occurred during circuit execution
|
|
104
|
+
*/ async finishWithError(error) {
|
|
105
|
+
// Finish sets the recording to undefined if we are at the topmost circuit,
|
|
106
|
+
// so we save the current file path before that
|
|
107
|
+
const filePath = this.recording.filePath;
|
|
108
|
+
const result = await super.finishWithError(error);
|
|
109
|
+
try {
|
|
110
|
+
await fs.appendFile(filePath, ' ],\n');
|
|
111
|
+
await fs.appendFile(filePath, ` "error": ${JSON.stringify(error)}\n`);
|
|
112
|
+
await fs.appendFile(filePath, '}\n');
|
|
113
|
+
} catch (err) {
|
|
114
|
+
this.logger.error('Failed to finalize recording file with error', {
|
|
115
|
+
error: err
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generates a file path for storing circuit recordings. The format of the filename is:
|
|
123
|
+
* `circuit_name_circuit_function_name_YYYY-MM-DD_N.json` where N is a counter to ensure unique filenames.
|
|
124
|
+
* @param recordDir - Base directory for recordings
|
|
125
|
+
* @param circuitName - Name of the circuit
|
|
126
|
+
* @param functionName - Name of the circuit function
|
|
127
|
+
* @param counter - Counter to ensure unique filenames. This is expected to be incremented in a loop until there is no
|
|
128
|
+
* existing file with the same name.
|
|
129
|
+
* @returns A file path for the recording.
|
|
130
|
+
*/ function getFilePath(recordDir, circuitName, functionName, counter) {
|
|
131
|
+
const date = new Date();
|
|
132
|
+
const formattedDate = date.toISOString().split('T')[0];
|
|
133
|
+
const filename = `${circuitName}_${functionName}_${formattedDate}_${counter}.json`;
|
|
134
|
+
return path.join(recordDir, filename);
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory_circuit_recorder.d.ts","sourceRoot":"","sources":["../../../../src/private/providers/circuit_recording/memory_circuit_recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAMxD,qBAAa,qBAAsB,SAAQ,eAAe;;CAIzD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CircuitRecorder } from './circuit_recorder.js';
|
|
2
|
+
/*
|
|
3
|
+
* In memory circuit recorder uses the default implementation. This is kept
|
|
4
|
+
* while we decide the fate of the FileCircuitRecorder
|
|
5
|
+
*/ export class MemoryCircuitRecorder extends CircuitRecorder {
|
|
6
|
+
constructor(){
|
|
7
|
+
super();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { ACIRCallback, ACIRExecutionResult } from '../../acvm/acvm.js';
|
|
|
5
5
|
import type { ACVMWitness } from '../../acvm/acvm_types.js';
|
|
6
6
|
import type { ACVMSuccess } from '../acvm_native.js';
|
|
7
7
|
import type { SimulationProvider } from '../simulation_provider.js';
|
|
8
|
+
import type { CircuitRecorder } from './circuit_recorder.js';
|
|
8
9
|
/**
|
|
9
10
|
* Takes a simulation provider and wraps it in a circuit recorder. See CircuitRecorder for more details on how circuit
|
|
10
11
|
* recording works.
|
|
@@ -12,7 +13,8 @@ import type { SimulationProvider } from '../simulation_provider.js';
|
|
|
12
13
|
export declare class SimulationProviderRecorderWrapper implements SimulationProvider {
|
|
13
14
|
#private;
|
|
14
15
|
private simulator;
|
|
15
|
-
|
|
16
|
+
private recorder;
|
|
17
|
+
constructor(simulator: SimulationProvider, recorder: CircuitRecorder);
|
|
16
18
|
executeProtocolCircuit(input: ACVMWitness, artifact: NoirCompiledCircuitWithName, callback: ForeignCallHandler | undefined): Promise<ACVMSuccess>;
|
|
17
19
|
executeUserCircuit(input: ACVMWitness, artifact: FunctionArtifactWithContractName, callback: ACIRCallback): Promise<ACIRExecutionResult>;
|
|
18
20
|
}
|
package/dest/private/providers/circuit_recording/simulation_provider_recorder_wrapper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAAqB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC/F,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;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,kBAAkB;;IAExE,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,QAAQ;gBADR,SAAS,EAAE,kBAAkB,EAC7B,QAAQ,EAAE,eAAe;IAGnC,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;CAiDhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { CircuitRecorder } from './circuit_recorder.js';
|
|
2
1
|
/**
|
|
3
2
|
* Takes a simulation provider and wraps it in a circuit recorder. See CircuitRecorder for more details on how circuit
|
|
4
3
|
* recording works.
|
|
5
4
|
*/ export class SimulationProviderRecorderWrapper {
|
|
6
5
|
simulator;
|
|
7
|
-
|
|
6
|
+
recorder;
|
|
7
|
+
constructor(simulator, recorder){
|
|
8
8
|
this.simulator = simulator;
|
|
9
|
+
this.recorder = recorder;
|
|
9
10
|
}
|
|
10
11
|
executeProtocolCircuit(input, artifact, callback) {
|
|
11
12
|
const bytecode = Buffer.from(artifact.bytecode, 'base64');
|
|
@@ -15,25 +16,29 @@ import { CircuitRecorder } from './circuit_recorder.js';
|
|
|
15
16
|
return this.#simulate((wrappedCallback)=>this.simulator.executeUserCircuit(input, artifact, wrappedCallback), input, artifact.bytecode, artifact.contractName, artifact.name, callback);
|
|
16
17
|
}
|
|
17
18
|
async #simulate(simulateFn, input, bytecode, contractName, functionName, callback) {
|
|
18
|
-
const recordDir = process.env.CIRCUIT_RECORD_DIR;
|
|
19
|
-
if (!recordDir) {
|
|
20
|
-
// Recording is not enabled so we just execute the circuit
|
|
21
|
-
return simulateFn(callback);
|
|
22
|
-
}
|
|
23
19
|
// Start recording circuit execution
|
|
24
|
-
|
|
20
|
+
await this.recorder.start(input, bytecode, contractName, functionName);
|
|
25
21
|
// If callback was provided, we wrap it in a circuit recorder callback wrapper
|
|
26
|
-
const wrappedCallback = recorder.wrapCallback(callback);
|
|
22
|
+
const wrappedCallback = this.recorder.wrapCallback(callback);
|
|
27
23
|
let result;
|
|
28
24
|
try {
|
|
29
25
|
result = await simulateFn(wrappedCallback);
|
|
30
26
|
} catch (error) {
|
|
31
27
|
// If an error occurs, we finalize the recording file with the error
|
|
32
|
-
await recorder.finishWithError(error);
|
|
28
|
+
await this.recorder.finishWithError(error);
|
|
33
29
|
throw error;
|
|
34
30
|
}
|
|
35
31
|
// Witness generation is complete so we finish the circuit recorder
|
|
36
|
-
await recorder.finish();
|
|
32
|
+
const recording = await this.recorder.finish();
|
|
33
|
+
result.oracles = recording.oracleCalls?.reduce((acc, { time, name })=>{
|
|
34
|
+
if (!acc[name]) {
|
|
35
|
+
acc[name] = {
|
|
36
|
+
times: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
acc[name].times.push(time);
|
|
40
|
+
return acc;
|
|
41
|
+
}, {});
|
|
37
42
|
return result;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -149,7 +149,7 @@ export declare class UtilityExecutionOracle extends TypedOracle {
|
|
|
149
149
|
* @returns A tagging secret that can be used to tag notes.
|
|
150
150
|
*/
|
|
151
151
|
getIndexedTaggingSecretAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<IndexedTaggingSecret>;
|
|
152
|
-
|
|
152
|
+
fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
153
153
|
deliverNote(contractAddress: AztecAddress, storageSlot: Fr, nonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash: TxHash, recipient: AztecAddress): Promise<void>;
|
|
154
154
|
getLogByTag(tag: Fr): Promise<LogWithTxData | null>;
|
|
155
155
|
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,KAAK,QAAQ,EAAE,WAA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EAAE,YAAY,EAC7B,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;CAWjB"}
|
|
@@ -200,7 +200,7 @@ import { pickNotes } from './pick_notes.js';
|
|
|
200
200
|
*/ async getIndexedTaggingSecretAsSender(sender, recipient) {
|
|
201
201
|
return await this.executionDataProvider.getIndexedTaggingSecretAsSender(this.contractAddress, sender, recipient);
|
|
202
202
|
}
|
|
203
|
-
async
|
|
203
|
+
async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot) {
|
|
204
204
|
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
205
205
|
await this.executionDataProvider.removeNullifiedNotes(this.contractAddress);
|
|
206
206
|
}
|
|
@@ -31,5 +31,6 @@ export declare abstract class BaseAvmSimulationTester {
|
|
|
31
31
|
registerFeeJuiceContract(): Promise<ContractInstanceWithAddress>;
|
|
32
32
|
addContractInstance(contractInstance: ContractInstanceWithAddress, skipNullifierInsertion?: boolean): Promise<void>;
|
|
33
33
|
private insertContractAddressNullifier;
|
|
34
|
+
insertNullifier(contractThatEmitted: AztecAddress, nullifier: Fr): Promise<void>;
|
|
34
35
|
}
|
|
35
36
|
//# sourceMappingURL=base_avm_simulation_tester.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/base_avm_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EA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OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAGjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAG9F;;;;;;;;;;GAUG;AACH,8BAAsB,uBAAuB;IAIlC,kBAAkB,EAAE,wBAAwB;IAC5C,WAAW,EAAE,yBAAyB;IAC7C,OAAO,CAAC,sBAAsB;IALzB,MAAM,yCAAyC;gBAG7C,kBAAkB,EAAE,wBAAwB,EAC5C,WAAW,EAAE,yBAAyB,EACrC,sBAAsB,KAAmB;IAG7C,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,KAA8B;IAMhF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;IAOjE;;;OAGG;IACG,yBAAyB,CAC7B,eAAe,EAAE,GAAG,EAAE,EACtB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,sBAAsB,UAAQ,EAC9B,IAAI,SAAI,EACR,uBAAuB,CAAC,EAAE,EAAE,GAC3B,OAAO,CAAC,2BAA2B,CAAC;IAiBjC,wBAAwB,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAWhE,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,sBAAsB,UAAQ;YAOzF,8BAA8B;IAQtC,eAAe,CAAC,mBAAmB,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE;CAIvE"}
|
|
@@ -75,4 +75,10 @@ import { createContractClassAndInstance } from './index.js';
|
|
|
75
75
|
contractAddressNullifier.toBuffer()
|
|
76
76
|
]);
|
|
77
77
|
}
|
|
78
|
+
async insertNullifier(contractThatEmitted, nullifier) {
|
|
79
|
+
const siloedNullifier = await siloNullifier(contractThatEmitted, nullifier);
|
|
80
|
+
await this.merkleTrees.sequentialInsert(MerkleTreeId.NULLIFIER_TREE, [
|
|
81
|
+
siloedNullifier.toBuffer()
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
78
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm_test.d.ts","sourceRoot":"","sources":["../../../../src/public/public_tx_simulator/apps_tests/amm_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amm_test.d.ts","sourceRoot":"","sources":["../../../../src/public/public_tx_simulator/apps_tests/amm_test.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAIzF;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBAoG7E"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
1
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
4
|
import { AMMContractArtifact } from '@aztec/noir-contracts.js/AMM';
|
|
3
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -69,6 +71,14 @@ async function addLiquidity(tester, sender, amm, token0, token1, liquidityToken,
|
|
|
69
71
|
const liquidityPartialNote = {
|
|
70
72
|
commitment: new Fr(99)
|
|
71
73
|
};
|
|
74
|
+
const refundToken0PartialNoteValidityCommitment = await computePartialNoteValidityCommitment(refundToken0PartialNote, amm.address);
|
|
75
|
+
const refundToken1PartialNoteValidityCommitment = await computePartialNoteValidityCommitment(refundToken1PartialNote, amm.address);
|
|
76
|
+
const liquidityPartialNoteValidityCommitment = await computePartialNoteValidityCommitment(liquidityPartialNote, amm.address);
|
|
77
|
+
// We need to inject the validity commitments into the nullifier tree as that would be performed by the private token
|
|
78
|
+
// functions that are not invoked in this test.
|
|
79
|
+
await tester.insertNullifier(token0.address, refundToken0PartialNoteValidityCommitment);
|
|
80
|
+
await tester.insertNullifier(token1.address, refundToken1PartialNoteValidityCommitment);
|
|
81
|
+
await tester.insertNullifier(liquidityToken.address, liquidityPartialNoteValidityCommitment);
|
|
72
82
|
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/add_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
73
83
|
// token0.transfer_to_public enqueues a call to _increase_public_balance
|
|
74
84
|
{
|
|
@@ -80,15 +90,6 @@ async function addLiquidity(tester, sender, amm, token0, token1, liquidityToken,
|
|
|
80
90
|
],
|
|
81
91
|
address: token0.address
|
|
82
92
|
},
|
|
83
|
-
// token0.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
84
|
-
{
|
|
85
|
-
sender: token0.address,
|
|
86
|
-
fnName: '_store_balances_set_partial_note',
|
|
87
|
-
args: [
|
|
88
|
-
refundToken0PartialNote
|
|
89
|
-
],
|
|
90
|
-
address: token0.address
|
|
91
|
-
},
|
|
92
93
|
// token1.transfer_to_public enqueues a call to _increase_public_balance
|
|
93
94
|
{
|
|
94
95
|
sender: token1.address,
|
|
@@ -99,24 +100,6 @@ async function addLiquidity(tester, sender, amm, token0, token1, liquidityToken,
|
|
|
99
100
|
],
|
|
100
101
|
address: token1.address
|
|
101
102
|
},
|
|
102
|
-
// token1.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
103
|
-
{
|
|
104
|
-
sender: token1.address,
|
|
105
|
-
fnName: '_store_balances_set_partial_note',
|
|
106
|
-
args: [
|
|
107
|
-
refundToken1PartialNote
|
|
108
|
-
],
|
|
109
|
-
address: token1.address
|
|
110
|
-
},
|
|
111
|
-
// liquidityToken.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
112
|
-
{
|
|
113
|
-
sender: liquidityToken.address,
|
|
114
|
-
fnName: '_store_balances_set_partial_note',
|
|
115
|
-
args: [
|
|
116
|
-
liquidityPartialNote
|
|
117
|
-
],
|
|
118
|
-
address: liquidityToken.address
|
|
119
|
-
},
|
|
120
103
|
// amm.add_liquidity enqueues a call to _add_liquidity
|
|
121
104
|
{
|
|
122
105
|
sender: amm.address,
|
|
@@ -142,8 +125,12 @@ async function addLiquidity(tester, sender, amm, token0, token1, liquidityToken,
|
|
|
142
125
|
}
|
|
143
126
|
async function swapExactTokensForTokens(tester, sender, amm, tokenIn, tokenOut, amountIn, amountOutMin, _nonce) {
|
|
144
127
|
const tokenOutPartialNote = {
|
|
145
|
-
commitment: new Fr(
|
|
128
|
+
commitment: new Fr(166)
|
|
146
129
|
};
|
|
130
|
+
const tokenOutPartialNoteValidityCommitment = await computePartialNoteValidityCommitment(tokenOutPartialNote, amm.address);
|
|
131
|
+
// We need to inject the validity commitment into the nullifier tree as that would be performed by the private token
|
|
132
|
+
// function that is not invoked in this test.
|
|
133
|
+
await tester.insertNullifier(tokenOut.address, tokenOutPartialNoteValidityCommitment);
|
|
147
134
|
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/swap_exact_tokens_for_tokens', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
148
135
|
// tokenIn.transfer_to_public enqueues a call to _increase_public_balance
|
|
149
136
|
{
|
|
@@ -155,15 +142,6 @@ async function swapExactTokensForTokens(tester, sender, amm, tokenIn, tokenOut,
|
|
|
155
142
|
],
|
|
156
143
|
address: tokenIn.address
|
|
157
144
|
},
|
|
158
|
-
// tokenOut.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
159
|
-
{
|
|
160
|
-
sender: tokenOut.address,
|
|
161
|
-
fnName: '_store_balances_set_partial_note',
|
|
162
|
-
args: [
|
|
163
|
-
tokenOutPartialNote
|
|
164
|
-
],
|
|
165
|
-
address: tokenOut.address
|
|
166
|
-
},
|
|
167
145
|
{
|
|
168
146
|
sender: amm.address,
|
|
169
147
|
fnName: '_swap_exact_tokens_for_tokens',
|
|
@@ -185,6 +163,12 @@ async function removeLiquidity(tester, sender, amm, token0, token1, liquidityTok
|
|
|
185
163
|
const token1PartialNote = {
|
|
186
164
|
commitment: new Fr(222)
|
|
187
165
|
};
|
|
166
|
+
const token0PartialNoteValidityCommitment = await computePartialNoteValidityCommitment(token0PartialNote, amm.address);
|
|
167
|
+
const token1PartialNoteValidityCommitment = await computePartialNoteValidityCommitment(token1PartialNote, amm.address);
|
|
168
|
+
// We need to inject the validity commitments into the nullifier tree as that would be performed by the private token
|
|
169
|
+
// functions that are not invoked in this test.
|
|
170
|
+
await tester.insertNullifier(token0.address, token0PartialNoteValidityCommitment);
|
|
171
|
+
await tester.insertNullifier(token1.address, token1PartialNoteValidityCommitment);
|
|
188
172
|
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/remove_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
189
173
|
// liquidityToken.transfer_to_public enqueues a call to _increase_public_balance
|
|
190
174
|
{
|
|
@@ -196,24 +180,6 @@ async function removeLiquidity(tester, sender, amm, token0, token1, liquidityTok
|
|
|
196
180
|
],
|
|
197
181
|
address: liquidityToken.address
|
|
198
182
|
},
|
|
199
|
-
// token0.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
200
|
-
{
|
|
201
|
-
sender: token0.address,
|
|
202
|
-
fnName: '_store_balances_set_partial_note',
|
|
203
|
-
args: [
|
|
204
|
-
token0PartialNote
|
|
205
|
-
],
|
|
206
|
-
address: token0.address
|
|
207
|
-
},
|
|
208
|
-
// token1.prepare_private_balance_increase enqueues a call to _store_balances_set_partial_note
|
|
209
|
-
{
|
|
210
|
-
sender: token1.address,
|
|
211
|
-
fnName: '_store_balances_set_partial_note',
|
|
212
|
-
args: [
|
|
213
|
-
token1PartialNote
|
|
214
|
-
],
|
|
215
|
-
address: token1.address
|
|
216
|
-
},
|
|
217
183
|
// amm.remove_liquidity enqueues a call to _remove_liquidity
|
|
218
184
|
{
|
|
219
185
|
sender: amm.address,
|
|
@@ -235,3 +201,9 @@ async function removeLiquidity(tester, sender, amm, token0, token1, liquidityTok
|
|
|
235
201
|
}
|
|
236
202
|
]);
|
|
237
203
|
}
|
|
204
|
+
async function computePartialNoteValidityCommitment(partialNote, completer) {
|
|
205
|
+
return await poseidon2HashWithSeparator([
|
|
206
|
+
partialNote.commitment,
|
|
207
|
+
completer
|
|
208
|
+
], GeneratorIndex.PARTIAL_NOTE_VALIDITY_COMMITMENT);
|
|
209
|
+
}
|
package/dest/server.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './public/index.js';
|
|
2
2
|
export { WASMSimulatorWithBlobs } from './private/providers/acvm_wasm_with_blobs.js';
|
|
3
3
|
export { NativeACVMSimulator } from './private/providers/acvm_native.js';
|
|
4
|
+
export { SimulationProviderRecorderWrapper } from './private/providers/circuit_recording/simulation_provider_recorder_wrapper.js';
|
|
5
|
+
export { MemoryCircuitRecorder } from './private/providers/circuit_recording/memory_circuit_recorder.js';
|
|
4
6
|
export { type SimulationProvider } from './private/providers/simulation_provider.js';
|
|
5
7
|
export * from './common/index.js';
|
|
6
8
|
//# sourceMappingURL=server.d.ts.map
|
package/dest/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AACrF,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,+EAA+E,CAAC;AAClI,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AACzG,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AACrF,cAAc,mBAAmB,CAAC"}
|
package/dest/server.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './public/index.js';
|
|
2
2
|
export { WASMSimulatorWithBlobs } from './private/providers/acvm_wasm_with_blobs.js';
|
|
3
3
|
export { NativeACVMSimulator } from './private/providers/acvm_native.js';
|
|
4
|
+
export { SimulationProviderRecorderWrapper } from './private/providers/circuit_recording/simulation_provider_recorder_wrapper.js';
|
|
5
|
+
export { MemoryCircuitRecorder } from './private/providers/circuit_recording/memory_circuit_recorder.js';
|
|
4
6
|
export * from './common/index.js';
|
package/dest/testing.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { FileCircuitRecorder } from './private/providers/circuit_recording/file_circuit_recorder.js';
|
|
2
2
|
//# sourceMappingURL=testing.d.ts.map
|
package/dest/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gEAAgE,CAAC"}
|
package/dest/testing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { FileCircuitRecorder } from './private/providers/circuit_recording/file_circuit_recorder.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -58,25 +58,25 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aztec/constants": "0.87.
|
|
62
|
-
"@aztec/foundation": "0.87.
|
|
63
|
-
"@aztec/noir-acvm_js": "0.87.
|
|
64
|
-
"@aztec/noir-noirc_abi": "0.87.
|
|
65
|
-
"@aztec/noir-protocol-circuits-types": "0.87.
|
|
66
|
-
"@aztec/noir-types": "0.87.
|
|
67
|
-
"@aztec/protocol-contracts": "0.87.
|
|
68
|
-
"@aztec/stdlib": "0.87.
|
|
69
|
-
"@aztec/telemetry-client": "0.87.
|
|
70
|
-
"@aztec/world-state": "0.87.
|
|
61
|
+
"@aztec/constants": "0.87.3",
|
|
62
|
+
"@aztec/foundation": "0.87.3",
|
|
63
|
+
"@aztec/noir-acvm_js": "0.87.3",
|
|
64
|
+
"@aztec/noir-noirc_abi": "0.87.3",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.87.3",
|
|
66
|
+
"@aztec/noir-types": "0.87.3",
|
|
67
|
+
"@aztec/protocol-contracts": "0.87.3",
|
|
68
|
+
"@aztec/stdlib": "0.87.3",
|
|
69
|
+
"@aztec/telemetry-client": "0.87.3",
|
|
70
|
+
"@aztec/world-state": "0.87.3",
|
|
71
71
|
"lodash.clonedeep": "^4.5.0",
|
|
72
72
|
"lodash.merge": "^4.6.2",
|
|
73
73
|
"tslib": "^2.4.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@aztec/kv-store": "0.87.
|
|
77
|
-
"@aztec/merkle-tree": "0.87.
|
|
78
|
-
"@aztec/noir-contracts.js": "0.87.
|
|
79
|
-
"@aztec/noir-test-contracts.js": "0.87.
|
|
76
|
+
"@aztec/kv-store": "0.87.3",
|
|
77
|
+
"@aztec/merkle-tree": "0.87.3",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.87.3",
|
|
79
|
+
"@aztec/noir-test-contracts.js": "0.87.3",
|
|
80
80
|
"@jest/globals": "^29.5.0",
|
|
81
81
|
"@types/jest": "^29.5.0",
|
|
82
82
|
"@types/lodash.clonedeep": "^4.5.7",
|
package/src/client.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './private/index.js';
|
|
2
2
|
export { WASMSimulator } from './private/providers/acvm_wasm.js';
|
|
3
|
+
export { SimulationProviderRecorderWrapper } from './private/providers/circuit_recording/simulation_provider_recorder_wrapper.js';
|
|
4
|
+
export { MemoryCircuitRecorder } from './private/providers/circuit_recording/memory_circuit_recorder.js';
|
|
3
5
|
export { type SimulationProvider, type DecodedError } from './private/providers/simulation_provider.js';
|
|
4
6
|
export * from './common/index.js';
|
package/src/private/acvm/acvm.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type { ORACLE_NAMES } from './oracle/index.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export type ACIRCallback = Record<ORACLE_NAMES, (...args: ForeignCallInput[]) => Promise<ForeignCallOutput[]>>;
|
|
19
19
|
|
|
20
|
+
export type ACIRCallbackStats = { times: number[] };
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* The result of executing an ACIR.
|
|
22
24
|
*/
|
|
@@ -28,6 +30,7 @@ export interface ACIRExecutionResult {
|
|
|
28
30
|
*/
|
|
29
31
|
partialWitness: ACVMWitness;
|
|
30
32
|
returnWitness: ACVMWitness;
|
|
33
|
+
oracles?: Record<string, ACIRCallbackStats>;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
/**
|
|
@@ -379,8 +379,8 @@ export class Oracle {
|
|
|
379
379
|
return [];
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
async
|
|
383
|
-
await this.typedOracle.
|
|
382
|
+
async fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
|
|
383
|
+
await this.typedOracle.fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
384
384
|
return [];
|
|
385
385
|
}
|
|
386
386
|
|
|
@@ -214,8 +214,8 @@ export abstract class TypedOracle {
|
|
|
214
214
|
return Promise.reject(new OracleMethodNotAvailableError('incrementAppTaggingSecretIndexAsSender'));
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
217
|
+
fetchTaggedLogs(_pendingTaggedLogArrayBaseSlot: Fr): Promise<void> {
|
|
218
|
+
return Promise.reject(new OracleMethodNotAvailableError('fetchTaggedLogs'));
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
deliverNote(
|
|
@@ -97,6 +97,7 @@ export async function executePrivateFunction(
|
|
|
97
97
|
// Due to the recursive nature of execution, we have to subtract the time taken by the first level of
|
|
98
98
|
// child executions
|
|
99
99
|
duration - nestedExecutions.reduce((acc, nested) => acc + (nested.profileResult?.timings.witgen ?? 0), 0),
|
|
100
|
+
oracles: acirExecutionResult.oracles,
|
|
100
101
|
},
|
|
101
102
|
},
|
|
102
103
|
);
|