@noir-lang/acvm_js 0.41.0 → 0.42.0-05b32fc.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 +34 -34
- package/nodejs/acvm_js.js +105 -106
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +4 -4
- package/package.json +7 -7
- package/web/acvm_js.d.ts +38 -38
- package/web/acvm_js.js +102 -103
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +4 -4
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,61 +1,38 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
7
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
8
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
9
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
10
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
11
|
-
*/
|
|
12
|
-
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
13
|
-
/**
|
|
14
|
-
* Executes an ACIR circuit to generate the solved witness from the initial 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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
22
|
-
/**
|
|
23
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
24
|
-
*/
|
|
25
|
-
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
26
|
-
/**
|
|
27
4
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
28
5
|
*
|
|
29
6
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
30
7
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
31
8
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
32
|
-
* @param {Uint8Array}
|
|
9
|
+
* @param {Uint8Array} program
|
|
33
10
|
* @param {WitnessMap} solved_witness
|
|
34
11
|
* @returns {WitnessMap}
|
|
35
12
|
*/
|
|
36
|
-
export function getPublicWitness(
|
|
13
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
37
14
|
/**
|
|
38
15
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
39
16
|
*
|
|
40
17
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
41
18
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
42
19
|
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
43
|
-
* @param {Uint8Array}
|
|
20
|
+
* @param {Uint8Array} program
|
|
44
21
|
* @param {WitnessMap} solved_witness
|
|
45
22
|
* @returns {WitnessMap}
|
|
46
23
|
*/
|
|
47
|
-
export function getPublicParametersWitness(
|
|
24
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
48
25
|
/**
|
|
49
26
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
50
27
|
*
|
|
51
28
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
29
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
53
30
|
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
54
|
-
* @param {Uint8Array}
|
|
31
|
+
* @param {Uint8Array} program
|
|
55
32
|
* @param {WitnessMap} witness_map
|
|
56
33
|
* @returns {WitnessMap}
|
|
57
34
|
*/
|
|
58
|
-
export function getReturnWitness(
|
|
35
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
59
36
|
/**
|
|
60
37
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
61
38
|
*
|
|
@@ -121,6 +98,29 @@ export function xor(lhs: string, rhs: string): string;
|
|
|
121
98
|
*/
|
|
122
99
|
export function and(lhs: string, rhs: string): string;
|
|
123
100
|
/**
|
|
101
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
102
|
+
*
|
|
103
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
104
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
105
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
106
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
107
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
108
|
+
*/
|
|
109
|
+
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
110
|
+
/**
|
|
111
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
112
|
+
*
|
|
113
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
114
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
115
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
116
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
117
|
+
*/
|
|
118
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
119
|
+
/**
|
|
120
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
121
|
+
*/
|
|
122
|
+
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
123
|
+
/**
|
|
124
124
|
* Sets the package's logging level.
|
|
125
125
|
*
|
|
126
126
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
@@ -146,17 +146,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
|
|
149
|
-
// Map from witness index to hex string value of witness.
|
|
150
|
-
export type WitnessMap = Map<number, string>;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
149
|
export type ExecutionError = Error & {
|
|
155
150
|
callStack?: string[];
|
|
156
151
|
};
|
|
157
152
|
|
|
158
153
|
|
|
159
154
|
|
|
155
|
+
// Map from witness index to hex string value of witness.
|
|
156
|
+
export type WitnessMap = Map<number, string>;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
160
|
/**
|
|
161
161
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
162
162
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -50,6 +50,28 @@ function addHeapObject(obj) {
|
|
|
50
50
|
return idx;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function isLikeNone(x) {
|
|
54
|
+
return x === undefined || x === null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let cachedFloat64Memory0 = null;
|
|
58
|
+
|
|
59
|
+
function getFloat64Memory0() {
|
|
60
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
61
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
62
|
+
}
|
|
63
|
+
return cachedFloat64Memory0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let cachedInt32Memory0 = null;
|
|
67
|
+
|
|
68
|
+
function getInt32Memory0() {
|
|
69
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
70
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
71
|
+
}
|
|
72
|
+
return cachedInt32Memory0;
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
let WASM_VECTOR_LEN = 0;
|
|
54
76
|
|
|
55
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -105,28 +127,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
105
127
|
return ptr;
|
|
106
128
|
}
|
|
107
129
|
|
|
108
|
-
function isLikeNone(x) {
|
|
109
|
-
return x === undefined || x === null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
let cachedInt32Memory0 = null;
|
|
113
|
-
|
|
114
|
-
function getInt32Memory0() {
|
|
115
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
116
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
117
|
-
}
|
|
118
|
-
return cachedInt32Memory0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let cachedFloat64Memory0 = null;
|
|
122
|
-
|
|
123
|
-
function getFloat64Memory0() {
|
|
124
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
125
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
126
|
-
}
|
|
127
|
-
return cachedFloat64Memory0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
130
|
let cachedBigInt64Memory0 = null;
|
|
131
131
|
|
|
132
132
|
function getBigInt64Memory0() {
|
|
@@ -229,73 +229,26 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
|
|
|
229
229
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfdf1d0fa4debaf70(arg0, arg1, addHeapObject(arg2));
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
function _assertClass(instance, klass) {
|
|
233
|
-
if (!(instance instanceof klass)) {
|
|
234
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
235
|
-
}
|
|
236
|
-
return instance.ptr;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
232
|
function passArray8ToWasm0(arg, malloc) {
|
|
240
233
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
241
234
|
getUint8Memory0().set(arg, ptr / 1);
|
|
242
235
|
WASM_VECTOR_LEN = arg.length;
|
|
243
236
|
return ptr;
|
|
244
237
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
247
|
-
*
|
|
248
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
249
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
250
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
251
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
252
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
253
|
-
*/
|
|
254
|
-
module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) {
|
|
255
|
-
_assertClass(solver, WasmBlackBoxFunctionSolver);
|
|
256
|
-
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
|
|
257
|
-
const len0 = WASM_VECTOR_LEN;
|
|
258
|
-
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
259
|
-
return takeObject(ret);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
264
|
-
*
|
|
265
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
266
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
267
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
268
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
269
|
-
*/
|
|
270
|
-
module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) {
|
|
271
|
-
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
|
|
272
|
-
const len0 = WASM_VECTOR_LEN;
|
|
273
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
274
|
-
return takeObject(ret);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
279
|
-
*/
|
|
280
|
-
module.exports.createBlackBoxSolver = function() {
|
|
281
|
-
const ret = wasm.createBlackBoxSolver();
|
|
282
|
-
return takeObject(ret);
|
|
283
|
-
};
|
|
284
|
-
|
|
285
238
|
/**
|
|
286
239
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
287
240
|
*
|
|
288
241
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
289
242
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
290
243
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
291
|
-
* @param {Uint8Array}
|
|
244
|
+
* @param {Uint8Array} program
|
|
292
245
|
* @param {WitnessMap} solved_witness
|
|
293
246
|
* @returns {WitnessMap}
|
|
294
247
|
*/
|
|
295
|
-
module.exports.getPublicWitness = function(
|
|
248
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
296
249
|
try {
|
|
297
250
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
298
|
-
const ptr0 = passArray8ToWasm0(
|
|
251
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
299
252
|
const len0 = WASM_VECTOR_LEN;
|
|
300
253
|
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
301
254
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -316,14 +269,14 @@ module.exports.getPublicWitness = function(circuit, solved_witness) {
|
|
|
316
269
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
317
270
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
318
271
|
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
319
|
-
* @param {Uint8Array}
|
|
272
|
+
* @param {Uint8Array} program
|
|
320
273
|
* @param {WitnessMap} solved_witness
|
|
321
274
|
* @returns {WitnessMap}
|
|
322
275
|
*/
|
|
323
|
-
module.exports.getPublicParametersWitness = function(
|
|
276
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
324
277
|
try {
|
|
325
278
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
326
|
-
const ptr0 = passArray8ToWasm0(
|
|
279
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
327
280
|
const len0 = WASM_VECTOR_LEN;
|
|
328
281
|
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
329
282
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -344,14 +297,14 @@ module.exports.getPublicParametersWitness = function(circuit, solved_witness) {
|
|
|
344
297
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
345
298
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
346
299
|
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
347
|
-
* @param {Uint8Array}
|
|
300
|
+
* @param {Uint8Array} program
|
|
348
301
|
* @param {WitnessMap} witness_map
|
|
349
302
|
* @returns {WitnessMap}
|
|
350
303
|
*/
|
|
351
|
-
module.exports.getReturnWitness = function(
|
|
304
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
352
305
|
try {
|
|
353
306
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
354
|
-
const ptr0 = passArray8ToWasm0(
|
|
307
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
355
308
|
const len0 = WASM_VECTOR_LEN;
|
|
356
309
|
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
357
310
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -546,6 +499,52 @@ module.exports.and = function(lhs, rhs) {
|
|
|
546
499
|
return takeObject(ret);
|
|
547
500
|
};
|
|
548
501
|
|
|
502
|
+
function _assertClass(instance, klass) {
|
|
503
|
+
if (!(instance instanceof klass)) {
|
|
504
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
505
|
+
}
|
|
506
|
+
return instance.ptr;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
510
|
+
*
|
|
511
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
512
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
513
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
514
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
515
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
516
|
+
*/
|
|
517
|
+
module.exports.executeCircuitWithBlackBoxSolver = function(solver, program, initial_witness, foreign_call_handler) {
|
|
518
|
+
_assertClass(solver, WasmBlackBoxFunctionSolver);
|
|
519
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
520
|
+
const len0 = WASM_VECTOR_LEN;
|
|
521
|
+
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
522
|
+
return takeObject(ret);
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
527
|
+
*
|
|
528
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
529
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
530
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
531
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
532
|
+
*/
|
|
533
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
534
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
535
|
+
const len0 = WASM_VECTOR_LEN;
|
|
536
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
537
|
+
return takeObject(ret);
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
542
|
+
*/
|
|
543
|
+
module.exports.createBlackBoxSolver = function() {
|
|
544
|
+
const ret = wasm.createBlackBoxSolver();
|
|
545
|
+
return takeObject(ret);
|
|
546
|
+
};
|
|
547
|
+
|
|
549
548
|
/**
|
|
550
549
|
* Sets the package's logging level.
|
|
551
550
|
*
|
|
@@ -642,6 +641,11 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
642
641
|
takeObject(arg0);
|
|
643
642
|
};
|
|
644
643
|
|
|
644
|
+
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
|
|
645
|
+
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
|
|
646
|
+
return addHeapObject(ret);
|
|
647
|
+
};
|
|
648
|
+
|
|
645
649
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
646
650
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
647
651
|
return addHeapObject(ret);
|
|
@@ -652,9 +656,9 @@ module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
|
652
656
|
return addHeapObject(ret);
|
|
653
657
|
};
|
|
654
658
|
|
|
655
|
-
module.exports.
|
|
656
|
-
const ret =
|
|
657
|
-
return
|
|
659
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
660
|
+
const ret = Array.isArray(getObject(arg0));
|
|
661
|
+
return ret;
|
|
658
662
|
};
|
|
659
663
|
|
|
660
664
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
@@ -672,26 +676,7 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
672
676
|
return addHeapObject(ret);
|
|
673
677
|
};
|
|
674
678
|
|
|
675
|
-
module.exports.
|
|
676
|
-
const ret = new Map();
|
|
677
|
-
return addHeapObject(ret);
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
module.exports.__wbindgen_number_new = function(arg0) {
|
|
681
|
-
const ret = arg0;
|
|
682
|
-
return addHeapObject(ret);
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
686
|
-
const obj = getObject(arg1);
|
|
687
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
688
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
689
|
-
var len1 = WASM_VECTOR_LEN;
|
|
690
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
691
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
module.exports.__wbg_constructor_d9cb984c4e2c6bcd = function(arg0) {
|
|
679
|
+
module.exports.__wbg_constructor_9a4af6ecd5050c55 = function(arg0) {
|
|
695
680
|
const ret = new Error(takeObject(arg0));
|
|
696
681
|
return addHeapObject(ret);
|
|
697
682
|
};
|
|
@@ -713,9 +698,23 @@ module.exports.__wbindgen_is_string = function(arg0) {
|
|
|
713
698
|
return ret;
|
|
714
699
|
};
|
|
715
700
|
|
|
716
|
-
module.exports.
|
|
717
|
-
const ret =
|
|
718
|
-
return ret;
|
|
701
|
+
module.exports.__wbg_new_0d2c031c3755a625 = function() {
|
|
702
|
+
const ret = new Map();
|
|
703
|
+
return addHeapObject(ret);
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
707
|
+
const ret = arg0;
|
|
708
|
+
return addHeapObject(ret);
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
712
|
+
const obj = getObject(arg1);
|
|
713
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
714
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
715
|
+
var len1 = WASM_VECTOR_LEN;
|
|
716
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
717
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
719
718
|
};
|
|
720
719
|
|
|
721
720
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
@@ -1231,8 +1230,8 @@ module.exports.__wbindgen_function_table = function() {
|
|
|
1231
1230
|
return addHeapObject(ret);
|
|
1232
1231
|
};
|
|
1233
1232
|
|
|
1234
|
-
module.exports.
|
|
1235
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1233
|
+
module.exports.__wbindgen_closure_wrapper1412 = function(arg0, arg1, arg2) {
|
|
1234
|
+
const ret = makeMutClosure(arg0, arg1, 490, __wbg_adapter_52);
|
|
1236
1235
|
return addHeapObject(ret);
|
|
1237
1236
|
};
|
|
1238
1237
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
5
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function createBlackBoxSolver(): number;
|
|
7
|
-
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
8
4
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
9
5
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
6
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
@@ -17,6 +13,10 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
17
13
|
export function sha256(a: number, b: number, c: number): void;
|
|
18
14
|
export function xor(a: number, b: number): number;
|
|
19
15
|
export function and(a: number, b: number): number;
|
|
16
|
+
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
17
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
18
|
+
export function createBlackBoxSolver(): number;
|
|
19
|
+
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
20
20
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
21
21
|
export function buildInfo(): number;
|
|
22
22
|
export function __wbg_trap_free(a: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/acvm_js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0-05b32fc.nightly",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
43
43
|
"@web/dev-server-esbuild": "^0.3.6",
|
|
44
|
-
"@web/test-runner": "^0.
|
|
44
|
+
"@web/test-runner": "^0.18.1",
|
|
45
45
|
"@web/test-runner-playwright": "^0.10.0",
|
|
46
|
-
"chai": "^4.
|
|
47
|
-
"eslint": "^8.
|
|
48
|
-
"eslint-plugin-prettier": "^5.
|
|
46
|
+
"chai": "^4.4.1",
|
|
47
|
+
"eslint": "^8.57.0",
|
|
48
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
49
49
|
"mocha": "^10.2.0",
|
|
50
|
-
"prettier": "3.
|
|
50
|
+
"prettier": "3.2.5",
|
|
51
51
|
"ts-node": "^10.9.1",
|
|
52
|
-
"typescript": "^5.
|
|
52
|
+
"typescript": "^5.4.2"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,61 +1,38 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
|
-
*
|
|
6
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
7
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
8
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
9
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
10
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
11
|
-
*/
|
|
12
|
-
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
13
|
-
/**
|
|
14
|
-
* Executes an ACIR circuit to generate the solved witness from the initial 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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
22
|
-
/**
|
|
23
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
24
|
-
*/
|
|
25
|
-
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
26
|
-
/**
|
|
27
4
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
28
5
|
*
|
|
29
6
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
30
7
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
31
8
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
32
|
-
* @param {Uint8Array}
|
|
9
|
+
* @param {Uint8Array} program
|
|
33
10
|
* @param {WitnessMap} solved_witness
|
|
34
11
|
* @returns {WitnessMap}
|
|
35
12
|
*/
|
|
36
|
-
export function getPublicWitness(
|
|
13
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
37
14
|
/**
|
|
38
15
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
39
16
|
*
|
|
40
17
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
41
18
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
42
19
|
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
43
|
-
* @param {Uint8Array}
|
|
20
|
+
* @param {Uint8Array} program
|
|
44
21
|
* @param {WitnessMap} solved_witness
|
|
45
22
|
* @returns {WitnessMap}
|
|
46
23
|
*/
|
|
47
|
-
export function getPublicParametersWitness(
|
|
24
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
48
25
|
/**
|
|
49
26
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
50
27
|
*
|
|
51
28
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
52
29
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
53
30
|
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
54
|
-
* @param {Uint8Array}
|
|
31
|
+
* @param {Uint8Array} program
|
|
55
32
|
* @param {WitnessMap} witness_map
|
|
56
33
|
* @returns {WitnessMap}
|
|
57
34
|
*/
|
|
58
|
-
export function getReturnWitness(
|
|
35
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
59
36
|
/**
|
|
60
37
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
61
38
|
*
|
|
@@ -121,6 +98,29 @@ export function xor(lhs: string, rhs: string): string;
|
|
|
121
98
|
*/
|
|
122
99
|
export function and(lhs: string, rhs: string): string;
|
|
123
100
|
/**
|
|
101
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
102
|
+
*
|
|
103
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
104
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
105
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
106
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
107
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
108
|
+
*/
|
|
109
|
+
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
110
|
+
/**
|
|
111
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
112
|
+
*
|
|
113
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
114
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
115
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
116
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
117
|
+
*/
|
|
118
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
119
|
+
/**
|
|
120
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
121
|
+
*/
|
|
122
|
+
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
123
|
+
/**
|
|
124
124
|
* Sets the package's logging level.
|
|
125
125
|
*
|
|
126
126
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
@@ -146,17 +146,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
|
|
149
|
-
// Map from witness index to hex string value of witness.
|
|
150
|
-
export type WitnessMap = Map<number, string>;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
149
|
export type ExecutionError = Error & {
|
|
155
150
|
callStack?: string[];
|
|
156
151
|
};
|
|
157
152
|
|
|
158
153
|
|
|
159
154
|
|
|
155
|
+
// Map from witness index to hex string value of witness.
|
|
156
|
+
export type WitnessMap = Map<number, string>;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
160
|
/**
|
|
161
161
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
162
162
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -180,10 +180,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
180
180
|
|
|
181
181
|
export interface InitOutput {
|
|
182
182
|
readonly memory: WebAssembly.Memory;
|
|
183
|
-
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
184
|
-
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
185
|
-
readonly createBlackBoxSolver: () => number;
|
|
186
|
-
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
|
|
187
183
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
188
184
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
189
185
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -196,6 +192,10 @@ export interface InitOutput {
|
|
|
196
192
|
readonly sha256: (a: number, b: number, c: number) => void;
|
|
197
193
|
readonly xor: (a: number, b: number) => number;
|
|
198
194
|
readonly and: (a: number, b: number) => number;
|
|
195
|
+
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
196
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
197
|
+
readonly createBlackBoxSolver: () => number;
|
|
198
|
+
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
|
|
199
199
|
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
200
200
|
readonly buildInfo: () => number;
|
|
201
201
|
readonly __wbg_trap_free: (a: number) => void;
|
package/web/acvm_js.js
CHANGED
|
@@ -47,6 +47,28 @@ function addHeapObject(obj) {
|
|
|
47
47
|
return idx;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
function isLikeNone(x) {
|
|
51
|
+
return x === undefined || x === null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let cachedFloat64Memory0 = null;
|
|
55
|
+
|
|
56
|
+
function getFloat64Memory0() {
|
|
57
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
58
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
59
|
+
}
|
|
60
|
+
return cachedFloat64Memory0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let cachedInt32Memory0 = null;
|
|
64
|
+
|
|
65
|
+
function getInt32Memory0() {
|
|
66
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
67
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
68
|
+
}
|
|
69
|
+
return cachedInt32Memory0;
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
let WASM_VECTOR_LEN = 0;
|
|
51
73
|
|
|
52
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -102,28 +124,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
102
124
|
return ptr;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
|
-
function isLikeNone(x) {
|
|
106
|
-
return x === undefined || x === null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
let cachedInt32Memory0 = null;
|
|
110
|
-
|
|
111
|
-
function getInt32Memory0() {
|
|
112
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
113
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
114
|
-
}
|
|
115
|
-
return cachedInt32Memory0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let cachedFloat64Memory0 = null;
|
|
119
|
-
|
|
120
|
-
function getFloat64Memory0() {
|
|
121
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
122
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
123
|
-
}
|
|
124
|
-
return cachedFloat64Memory0;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
127
|
let cachedBigInt64Memory0 = null;
|
|
128
128
|
|
|
129
129
|
function getBigInt64Memory0() {
|
|
@@ -226,73 +226,26 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
|
|
|
226
226
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfdf1d0fa4debaf70(arg0, arg1, addHeapObject(arg2));
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
function _assertClass(instance, klass) {
|
|
230
|
-
if (!(instance instanceof klass)) {
|
|
231
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
232
|
-
}
|
|
233
|
-
return instance.ptr;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
229
|
function passArray8ToWasm0(arg, malloc) {
|
|
237
230
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
238
231
|
getUint8Memory0().set(arg, ptr / 1);
|
|
239
232
|
WASM_VECTOR_LEN = arg.length;
|
|
240
233
|
return ptr;
|
|
241
234
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
244
|
-
*
|
|
245
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
246
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
247
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
248
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
249
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
250
|
-
*/
|
|
251
|
-
export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) {
|
|
252
|
-
_assertClass(solver, WasmBlackBoxFunctionSolver);
|
|
253
|
-
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
|
|
254
|
-
const len0 = WASM_VECTOR_LEN;
|
|
255
|
-
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
256
|
-
return takeObject(ret);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
261
|
-
*
|
|
262
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
263
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
264
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
265
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
266
|
-
*/
|
|
267
|
-
export function executeCircuit(circuit, initial_witness, foreign_call_handler) {
|
|
268
|
-
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
|
|
269
|
-
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
271
|
-
return takeObject(ret);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
276
|
-
*/
|
|
277
|
-
export function createBlackBoxSolver() {
|
|
278
|
-
const ret = wasm.createBlackBoxSolver();
|
|
279
|
-
return takeObject(ret);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
235
|
/**
|
|
283
236
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
284
237
|
*
|
|
285
238
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
286
239
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
287
240
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
288
|
-
* @param {Uint8Array}
|
|
241
|
+
* @param {Uint8Array} program
|
|
289
242
|
* @param {WitnessMap} solved_witness
|
|
290
243
|
* @returns {WitnessMap}
|
|
291
244
|
*/
|
|
292
|
-
export function getPublicWitness(
|
|
245
|
+
export function getPublicWitness(program, solved_witness) {
|
|
293
246
|
try {
|
|
294
247
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
295
|
-
const ptr0 = passArray8ToWasm0(
|
|
248
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
296
249
|
const len0 = WASM_VECTOR_LEN;
|
|
297
250
|
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
298
251
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -313,14 +266,14 @@ export function getPublicWitness(circuit, solved_witness) {
|
|
|
313
266
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
314
267
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
315
268
|
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
316
|
-
* @param {Uint8Array}
|
|
269
|
+
* @param {Uint8Array} program
|
|
317
270
|
* @param {WitnessMap} solved_witness
|
|
318
271
|
* @returns {WitnessMap}
|
|
319
272
|
*/
|
|
320
|
-
export function getPublicParametersWitness(
|
|
273
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
321
274
|
try {
|
|
322
275
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
323
|
-
const ptr0 = passArray8ToWasm0(
|
|
276
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
324
277
|
const len0 = WASM_VECTOR_LEN;
|
|
325
278
|
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
326
279
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -341,14 +294,14 @@ export function getPublicParametersWitness(circuit, solved_witness) {
|
|
|
341
294
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
342
295
|
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
343
296
|
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
344
|
-
* @param {Uint8Array}
|
|
297
|
+
* @param {Uint8Array} program
|
|
345
298
|
* @param {WitnessMap} witness_map
|
|
346
299
|
* @returns {WitnessMap}
|
|
347
300
|
*/
|
|
348
|
-
export function getReturnWitness(
|
|
301
|
+
export function getReturnWitness(program, witness_map) {
|
|
349
302
|
try {
|
|
350
303
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
351
|
-
const ptr0 = passArray8ToWasm0(
|
|
304
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
352
305
|
const len0 = WASM_VECTOR_LEN;
|
|
353
306
|
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
354
307
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
@@ -543,6 +496,52 @@ export function and(lhs, rhs) {
|
|
|
543
496
|
return takeObject(ret);
|
|
544
497
|
}
|
|
545
498
|
|
|
499
|
+
function _assertClass(instance, klass) {
|
|
500
|
+
if (!(instance instanceof klass)) {
|
|
501
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
502
|
+
}
|
|
503
|
+
return instance.ptr;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
507
|
+
*
|
|
508
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
509
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
510
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
511
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
512
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
513
|
+
*/
|
|
514
|
+
export function executeCircuitWithBlackBoxSolver(solver, program, initial_witness, foreign_call_handler) {
|
|
515
|
+
_assertClass(solver, WasmBlackBoxFunctionSolver);
|
|
516
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
517
|
+
const len0 = WASM_VECTOR_LEN;
|
|
518
|
+
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
519
|
+
return takeObject(ret);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
524
|
+
*
|
|
525
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
526
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
527
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
528
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
529
|
+
*/
|
|
530
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
531
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
532
|
+
const len0 = WASM_VECTOR_LEN;
|
|
533
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
534
|
+
return takeObject(ret);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
539
|
+
*/
|
|
540
|
+
export function createBlackBoxSolver() {
|
|
541
|
+
const ret = wasm.createBlackBoxSolver();
|
|
542
|
+
return takeObject(ret);
|
|
543
|
+
}
|
|
544
|
+
|
|
546
545
|
/**
|
|
547
546
|
* Sets the package's logging level.
|
|
548
547
|
*
|
|
@@ -670,6 +669,10 @@ function __wbg_get_imports() {
|
|
|
670
669
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
671
670
|
takeObject(arg0);
|
|
672
671
|
};
|
|
672
|
+
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
|
|
673
|
+
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
|
|
674
|
+
return addHeapObject(ret);
|
|
675
|
+
};
|
|
673
676
|
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
674
677
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
675
678
|
return addHeapObject(ret);
|
|
@@ -678,9 +681,9 @@ function __wbg_get_imports() {
|
|
|
678
681
|
const ret = getObject(arg0);
|
|
679
682
|
return addHeapObject(ret);
|
|
680
683
|
};
|
|
681
|
-
imports.wbg.
|
|
682
|
-
const ret =
|
|
683
|
-
return
|
|
684
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
685
|
+
const ret = Array.isArray(getObject(arg0));
|
|
686
|
+
return ret;
|
|
684
687
|
};
|
|
685
688
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
686
689
|
const obj = takeObject(arg0).original;
|
|
@@ -695,23 +698,7 @@ function __wbg_get_imports() {
|
|
|
695
698
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
696
699
|
return addHeapObject(ret);
|
|
697
700
|
};
|
|
698
|
-
imports.wbg.
|
|
699
|
-
const ret = new Map();
|
|
700
|
-
return addHeapObject(ret);
|
|
701
|
-
};
|
|
702
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
703
|
-
const ret = arg0;
|
|
704
|
-
return addHeapObject(ret);
|
|
705
|
-
};
|
|
706
|
-
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
707
|
-
const obj = getObject(arg1);
|
|
708
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
709
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
710
|
-
var len1 = WASM_VECTOR_LEN;
|
|
711
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
712
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
713
|
-
};
|
|
714
|
-
imports.wbg.__wbg_constructor_d9cb984c4e2c6bcd = function(arg0) {
|
|
701
|
+
imports.wbg.__wbg_constructor_9a4af6ecd5050c55 = function(arg0) {
|
|
715
702
|
const ret = new Error(takeObject(arg0));
|
|
716
703
|
return addHeapObject(ret);
|
|
717
704
|
};
|
|
@@ -729,9 +716,21 @@ function __wbg_get_imports() {
|
|
|
729
716
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
730
717
|
return ret;
|
|
731
718
|
};
|
|
732
|
-
imports.wbg.
|
|
733
|
-
const ret =
|
|
734
|
-
return ret;
|
|
719
|
+
imports.wbg.__wbg_new_0d2c031c3755a625 = function() {
|
|
720
|
+
const ret = new Map();
|
|
721
|
+
return addHeapObject(ret);
|
|
722
|
+
};
|
|
723
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
724
|
+
const ret = arg0;
|
|
725
|
+
return addHeapObject(ret);
|
|
726
|
+
};
|
|
727
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
728
|
+
const obj = getObject(arg1);
|
|
729
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
730
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
731
|
+
var len1 = WASM_VECTOR_LEN;
|
|
732
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
733
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
735
734
|
};
|
|
736
735
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
737
736
|
const ret = new Error();
|
|
@@ -1157,8 +1156,8 @@ function __wbg_get_imports() {
|
|
|
1157
1156
|
const ret = wasm.__wbindgen_export_2;
|
|
1158
1157
|
return addHeapObject(ret);
|
|
1159
1158
|
};
|
|
1160
|
-
imports.wbg.
|
|
1161
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1159
|
+
imports.wbg.__wbindgen_closure_wrapper1412 = function(arg0, arg1, arg2) {
|
|
1160
|
+
const ret = makeMutClosure(arg0, arg1, 490, __wbg_adapter_52);
|
|
1162
1161
|
return addHeapObject(ret);
|
|
1163
1162
|
};
|
|
1164
1163
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
5
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function createBlackBoxSolver(): number;
|
|
7
|
-
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
8
4
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
9
5
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
6
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
@@ -17,6 +13,10 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
17
13
|
export function sha256(a: number, b: number, c: number): void;
|
|
18
14
|
export function xor(a: number, b: number): number;
|
|
19
15
|
export function and(a: number, b: number): number;
|
|
16
|
+
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
17
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
18
|
+
export function createBlackBoxSolver(): number;
|
|
19
|
+
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
|
|
20
20
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
21
21
|
export function buildInfo(): number;
|
|
22
22
|
export function __wbg_trap_free(a: number): void;
|