@noir-lang/acvm_js 1.0.0-beta.3-826b18a.nightly → 1.0.0-beta.3-fdd2fe7.nightly
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/nodejs/acvm_js.d.ts +50 -50
- package/nodejs/acvm_js.js +52 -52
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +3 -3
- package/package.json +1 -1
- package/web/acvm_js.d.ts +53 -53
- package/web/acvm_js.js +52 -52
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +3 -3
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
24
|
-
*
|
|
25
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
3
|
/**
|
|
32
4
|
* Sets the package's logging level.
|
|
33
5
|
*
|
|
@@ -63,6 +35,34 @@ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap
|
|
|
63
35
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
36
|
*/
|
|
65
37
|
export function buildInfo(): BuildInfo;
|
|
38
|
+
/**
|
|
39
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
40
|
+
*
|
|
41
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
42
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
43
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
44
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
45
|
+
*/
|
|
46
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
47
|
+
/**
|
|
48
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
49
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
50
|
+
*
|
|
51
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
53
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
54
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
55
|
+
*/
|
|
56
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
57
|
+
/**
|
|
58
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
59
|
+
*
|
|
60
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
61
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
62
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
63
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
64
|
+
*/
|
|
65
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
66
66
|
/**
|
|
67
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
68
|
*/
|
|
@@ -117,28 +117,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
117
117
|
*/
|
|
118
118
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
119
119
|
|
|
120
|
-
export type RawAssertionPayload = {
|
|
121
|
-
selector: string;
|
|
122
|
-
data: string[];
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ExecutionError = Error & {
|
|
126
|
-
callStack?: string[];
|
|
127
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
-
brilligFunctionId?: number;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
export type StackItem = {
|
|
134
|
-
index: number;
|
|
135
|
-
witness: WitnessMap;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type WitnessStack = Array<StackItem>;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
120
|
// Map from witness index to hex string value of witness.
|
|
143
121
|
export type WitnessMap = Map<number, string>;
|
|
144
122
|
|
|
@@ -168,6 +146,28 @@ export type BuildInfo = {
|
|
|
168
146
|
|
|
169
147
|
|
|
170
148
|
|
|
149
|
+
export type RawAssertionPayload = {
|
|
150
|
+
selector: string;
|
|
151
|
+
data: string[];
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type ExecutionError = Error & {
|
|
155
|
+
callStack?: string[];
|
|
156
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
157
|
+
brilligFunctionId?: number;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
export type StackItem = {
|
|
163
|
+
index: number;
|
|
164
|
+
witness: WitnessMap;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type WitnessStack = Array<StackItem>;
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
171
|
export type ForeignCallInput = string[]
|
|
172
172
|
export type ForeignCallOutput = string | string[]
|
|
173
173
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -202,58 +202,6 @@ function debugString(val) {
|
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
206
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
207
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
208
|
-
WASM_VECTOR_LEN = arg.length;
|
|
209
|
-
return ptr;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
213
|
-
*
|
|
214
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
215
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
216
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
217
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
218
|
-
*/
|
|
219
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
220
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
221
|
-
const len0 = WASM_VECTOR_LEN;
|
|
222
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
223
|
-
return ret;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
228
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
229
|
-
*
|
|
230
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
231
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
232
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
233
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
234
|
-
*/
|
|
235
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
236
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
237
|
-
const len0 = WASM_VECTOR_LEN;
|
|
238
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
239
|
-
return ret;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
244
|
-
*
|
|
245
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
246
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
247
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
248
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
249
|
-
*/
|
|
250
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
251
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
-
const len0 = WASM_VECTOR_LEN;
|
|
253
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
254
|
-
return ret;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
205
|
function takeFromExternrefTable0(idx) {
|
|
258
206
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
259
207
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -273,6 +221,12 @@ module.exports.initLogLevel = function(filter) {
|
|
|
273
221
|
}
|
|
274
222
|
};
|
|
275
223
|
|
|
224
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
225
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
226
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
227
|
+
WASM_VECTOR_LEN = arg.length;
|
|
228
|
+
return ptr;
|
|
229
|
+
}
|
|
276
230
|
/**
|
|
277
231
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
278
232
|
*
|
|
@@ -342,6 +296,52 @@ module.exports.buildInfo = function() {
|
|
|
342
296
|
return ret;
|
|
343
297
|
};
|
|
344
298
|
|
|
299
|
+
/**
|
|
300
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
301
|
+
*
|
|
302
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
303
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
304
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
305
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
306
|
+
*/
|
|
307
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
308
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
311
|
+
return ret;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
316
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
317
|
+
*
|
|
318
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
319
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
320
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
321
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
322
|
+
*/
|
|
323
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
324
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
325
|
+
const len0 = WASM_VECTOR_LEN;
|
|
326
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
327
|
+
return ret;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
332
|
+
*
|
|
333
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
334
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
335
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
336
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
337
|
+
*/
|
|
338
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
339
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
342
|
+
return ret;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
345
|
/**
|
|
346
346
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
347
347
|
* @param {string} lhs
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
7
4
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
8
5
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
6
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
7
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
8
|
export const buildInfo: () => any;
|
|
9
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
12
|
export const and: (a: any, b: any) => any;
|
|
13
13
|
export const xor: (a: any, b: any) => any;
|
|
14
14
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
24
|
-
*
|
|
25
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
3
|
/**
|
|
32
4
|
* Sets the package's logging level.
|
|
33
5
|
*
|
|
@@ -63,6 +35,34 @@ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap
|
|
|
63
35
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
36
|
*/
|
|
65
37
|
export function buildInfo(): BuildInfo;
|
|
38
|
+
/**
|
|
39
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
40
|
+
*
|
|
41
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
42
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
43
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
44
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
45
|
+
*/
|
|
46
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
47
|
+
/**
|
|
48
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
49
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
50
|
+
*
|
|
51
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
53
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
54
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
55
|
+
*/
|
|
56
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
57
|
+
/**
|
|
58
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
59
|
+
*
|
|
60
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
61
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
62
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
63
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
64
|
+
*/
|
|
65
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
66
66
|
/**
|
|
67
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
68
68
|
*/
|
|
@@ -117,28 +117,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
117
117
|
*/
|
|
118
118
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
119
119
|
|
|
120
|
-
export type RawAssertionPayload = {
|
|
121
|
-
selector: string;
|
|
122
|
-
data: string[];
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ExecutionError = Error & {
|
|
126
|
-
callStack?: string[];
|
|
127
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
-
brilligFunctionId?: number;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
export type StackItem = {
|
|
134
|
-
index: number;
|
|
135
|
-
witness: WitnessMap;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type WitnessStack = Array<StackItem>;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
120
|
// Map from witness index to hex string value of witness.
|
|
143
121
|
export type WitnessMap = Map<number, string>;
|
|
144
122
|
|
|
@@ -168,6 +146,28 @@ export type BuildInfo = {
|
|
|
168
146
|
|
|
169
147
|
|
|
170
148
|
|
|
149
|
+
export type RawAssertionPayload = {
|
|
150
|
+
selector: string;
|
|
151
|
+
data: string[];
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type ExecutionError = Error & {
|
|
155
|
+
callStack?: string[];
|
|
156
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
157
|
+
brilligFunctionId?: number;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
export type StackItem = {
|
|
163
|
+
index: number;
|
|
164
|
+
witness: WitnessMap;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type WitnessStack = Array<StackItem>;
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
171
|
export type ForeignCallInput = string[]
|
|
172
172
|
export type ForeignCallOutput = string | string[]
|
|
173
173
|
|
|
@@ -186,14 +186,14 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
186
186
|
|
|
187
187
|
export interface InitOutput {
|
|
188
188
|
readonly memory: WebAssembly.Memory;
|
|
189
|
-
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
190
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
191
|
-
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
192
189
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
193
190
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
194
191
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
192
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
193
|
readonly buildInfo: () => any;
|
|
194
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
195
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
196
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
197
197
|
readonly and: (a: any, b: any) => any;
|
|
198
198
|
readonly xor: (a: any, b: any) => any;
|
|
199
199
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
package/web/acvm_js.js
CHANGED
|
@@ -198,58 +198,6 @@ function debugString(val) {
|
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
202
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
203
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
204
|
-
WASM_VECTOR_LEN = arg.length;
|
|
205
|
-
return ptr;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
209
|
-
*
|
|
210
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
211
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
212
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
213
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
214
|
-
*/
|
|
215
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
216
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
217
|
-
const len0 = WASM_VECTOR_LEN;
|
|
218
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
219
|
-
return ret;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
224
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
225
|
-
*
|
|
226
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
227
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
228
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
229
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
230
|
-
*/
|
|
231
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
232
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
233
|
-
const len0 = WASM_VECTOR_LEN;
|
|
234
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
235
|
-
return ret;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
240
|
-
*
|
|
241
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
242
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
243
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
244
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
245
|
-
*/
|
|
246
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
247
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
248
|
-
const len0 = WASM_VECTOR_LEN;
|
|
249
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
250
|
-
return ret;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
201
|
function takeFromExternrefTable0(idx) {
|
|
254
202
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
255
203
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -269,6 +217,12 @@ export function initLogLevel(filter) {
|
|
|
269
217
|
}
|
|
270
218
|
}
|
|
271
219
|
|
|
220
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
221
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
222
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
223
|
+
WASM_VECTOR_LEN = arg.length;
|
|
224
|
+
return ptr;
|
|
225
|
+
}
|
|
272
226
|
/**
|
|
273
227
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
274
228
|
*
|
|
@@ -338,6 +292,52 @@ export function buildInfo() {
|
|
|
338
292
|
return ret;
|
|
339
293
|
}
|
|
340
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
297
|
+
*
|
|
298
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
299
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
300
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
301
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
302
|
+
*/
|
|
303
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
304
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
307
|
+
return ret;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
312
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
313
|
+
*
|
|
314
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
315
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
316
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
317
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
318
|
+
*/
|
|
319
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
320
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
321
|
+
const len0 = WASM_VECTOR_LEN;
|
|
322
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
323
|
+
return ret;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
328
|
+
*
|
|
329
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
330
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
331
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
332
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
333
|
+
*/
|
|
334
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
335
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
338
|
+
return ret;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
341
|
/**
|
|
342
342
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
343
343
|
* @param {string} lhs
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
7
4
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
8
5
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
6
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
7
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
8
|
export const buildInfo: () => any;
|
|
9
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
12
|
export const and: (a: any, b: any) => any;
|
|
13
13
|
export const xor: (a: any, b: any) => any;
|
|
14
14
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|