@noir-lang/acvm_js 0.46.0-7936262.nightly → 0.46.0-e4eb5f5.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 +88 -88
- package/nodejs/acvm_js.js +257 -256
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -7
- package/package.json +1 -1
- package/web/acvm_js.d.ts +95 -95
- package/web/acvm_js.js +253 -252
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -7
package/nodejs/acvm_js.js
CHANGED
|
@@ -9,6 +9,20 @@ heap.push(undefined, null, true, false);
|
|
|
9
9
|
|
|
10
10
|
function getObject(idx) { return heap[idx]; }
|
|
11
11
|
|
|
12
|
+
let heap_next = heap.length;
|
|
13
|
+
|
|
14
|
+
function dropObject(idx) {
|
|
15
|
+
if (idx < 132) return;
|
|
16
|
+
heap[idx] = heap_next;
|
|
17
|
+
heap_next = idx;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function takeObject(idx) {
|
|
21
|
+
const ret = getObject(idx);
|
|
22
|
+
dropObject(idx);
|
|
23
|
+
return ret;
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
function isLikeNone(x) {
|
|
13
27
|
return x === undefined || x === null;
|
|
14
28
|
}
|
|
@@ -31,29 +45,6 @@ function getInt32Memory0() {
|
|
|
31
45
|
return cachedInt32Memory0;
|
|
32
46
|
}
|
|
33
47
|
|
|
34
|
-
let heap_next = heap.length;
|
|
35
|
-
|
|
36
|
-
function dropObject(idx) {
|
|
37
|
-
if (idx < 132) return;
|
|
38
|
-
heap[idx] = heap_next;
|
|
39
|
-
heap_next = idx;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function takeObject(idx) {
|
|
43
|
-
const ret = getObject(idx);
|
|
44
|
-
dropObject(idx);
|
|
45
|
-
return ret;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function addHeapObject(obj) {
|
|
49
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
50
|
-
const idx = heap_next;
|
|
51
|
-
heap_next = heap[idx];
|
|
52
|
-
|
|
53
|
-
heap[idx] = obj;
|
|
54
|
-
return idx;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
48
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
58
49
|
|
|
59
50
|
cachedTextDecoder.decode();
|
|
@@ -72,6 +63,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
72
63
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
73
64
|
}
|
|
74
65
|
|
|
66
|
+
function addHeapObject(obj) {
|
|
67
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
68
|
+
const idx = heap_next;
|
|
69
|
+
heap_next = heap[idx];
|
|
70
|
+
|
|
71
|
+
heap[idx] = obj;
|
|
72
|
+
return idx;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
let WASM_VECTOR_LEN = 0;
|
|
76
76
|
|
|
77
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -220,199 +220,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
224
|
-
ptr = ptr >>> 0;
|
|
225
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
229
|
-
*
|
|
230
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
231
|
-
* @returns {Uint8Array} A compressed witness map
|
|
232
|
-
*/
|
|
233
|
-
module.exports.compressWitness = function(witness_map) {
|
|
234
|
-
try {
|
|
235
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
237
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
238
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
239
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
240
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
241
|
-
if (r3) {
|
|
242
|
-
throw takeObject(r2);
|
|
243
|
-
}
|
|
244
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
245
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
246
|
-
return v1;
|
|
247
|
-
} finally {
|
|
248
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
253
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
254
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
255
|
-
WASM_VECTOR_LEN = arg.length;
|
|
256
|
-
return ptr;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
260
|
-
* This should be used to only fetch the witness map for the main function.
|
|
261
|
-
*
|
|
262
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
263
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
264
|
-
*/
|
|
265
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
266
|
-
try {
|
|
267
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
268
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
269
|
-
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
271
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
272
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
273
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
274
|
-
if (r2) {
|
|
275
|
-
throw takeObject(r1);
|
|
276
|
-
}
|
|
277
|
-
return takeObject(r0);
|
|
278
|
-
} finally {
|
|
279
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
285
|
-
*
|
|
286
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
287
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
288
|
-
*/
|
|
289
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
290
|
-
try {
|
|
291
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
292
|
-
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
293
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
294
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
295
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
296
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
297
|
-
if (r3) {
|
|
298
|
-
throw takeObject(r2);
|
|
299
|
-
}
|
|
300
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
301
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
302
|
-
return v1;
|
|
303
|
-
} finally {
|
|
304
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
310
|
-
*
|
|
311
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
312
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
313
|
-
*/
|
|
314
|
-
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
315
|
-
try {
|
|
316
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
317
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
318
|
-
const len0 = WASM_VECTOR_LEN;
|
|
319
|
-
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
320
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
321
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
322
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
323
|
-
if (r2) {
|
|
324
|
-
throw takeObject(r1);
|
|
325
|
-
}
|
|
326
|
-
return takeObject(r0);
|
|
327
|
-
} finally {
|
|
328
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
334
|
-
*
|
|
335
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
336
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
337
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
338
|
-
* @param {Uint8Array} program
|
|
339
|
-
* @param {WitnessMap} witness_map
|
|
340
|
-
* @returns {WitnessMap}
|
|
341
|
-
*/
|
|
342
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
343
|
-
try {
|
|
344
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
345
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
346
|
-
const len0 = WASM_VECTOR_LEN;
|
|
347
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
348
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
349
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
350
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
351
|
-
if (r2) {
|
|
352
|
-
throw takeObject(r1);
|
|
353
|
-
}
|
|
354
|
-
return takeObject(r0);
|
|
355
|
-
} finally {
|
|
356
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
362
|
-
*
|
|
363
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
364
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
365
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
366
|
-
* @param {Uint8Array} program
|
|
367
|
-
* @param {WitnessMap} solved_witness
|
|
368
|
-
* @returns {WitnessMap}
|
|
369
|
-
*/
|
|
370
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
371
|
-
try {
|
|
372
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
373
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
374
|
-
const len0 = WASM_VECTOR_LEN;
|
|
375
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
376
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
377
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
378
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
379
|
-
if (r2) {
|
|
380
|
-
throw takeObject(r1);
|
|
381
|
-
}
|
|
382
|
-
return takeObject(r0);
|
|
383
|
-
} finally {
|
|
384
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
390
|
-
*
|
|
391
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
392
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
393
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
394
|
-
* @param {Uint8Array} program
|
|
395
|
-
* @param {WitnessMap} solved_witness
|
|
396
|
-
* @returns {WitnessMap}
|
|
397
|
-
*/
|
|
398
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
399
|
-
try {
|
|
400
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
401
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
402
|
-
const len0 = WASM_VECTOR_LEN;
|
|
403
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
404
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
405
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
406
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
407
|
-
if (r2) {
|
|
408
|
-
throw takeObject(r1);
|
|
409
|
-
}
|
|
410
|
-
return takeObject(r0);
|
|
411
|
-
} finally {
|
|
412
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
|
|
416
223
|
/**
|
|
417
224
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
418
225
|
* @param {string} lhs
|
|
@@ -435,6 +242,17 @@ module.exports.xor = function(lhs, rhs) {
|
|
|
435
242
|
return takeObject(ret);
|
|
436
243
|
};
|
|
437
244
|
|
|
245
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
246
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
247
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
248
|
+
WASM_VECTOR_LEN = arg.length;
|
|
249
|
+
return ptr;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
253
|
+
ptr = ptr >>> 0;
|
|
254
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
255
|
+
}
|
|
438
256
|
/**
|
|
439
257
|
* Calculates the SHA256 hash of the input bytes
|
|
440
258
|
* @param {Uint8Array} inputs
|
|
@@ -579,11 +397,11 @@ function _assertClass(instance, klass) {
|
|
|
579
397
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
580
398
|
* @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.
|
|
581
399
|
*/
|
|
582
|
-
module.exports.executeCircuitWithReturnWitness = function(
|
|
583
|
-
_assertClass(
|
|
400
|
+
module.exports.executeCircuitWithReturnWitness = function(_solver, program, initial_witness, foreign_call_handler) {
|
|
401
|
+
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
584
402
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
585
403
|
const len0 = WASM_VECTOR_LEN;
|
|
586
|
-
const ret = wasm.executeCircuitWithReturnWitness(
|
|
404
|
+
const ret = wasm.executeCircuitWithReturnWitness(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
587
405
|
return takeObject(ret);
|
|
588
406
|
};
|
|
589
407
|
|
|
@@ -596,11 +414,11 @@ module.exports.executeCircuitWithReturnWitness = function(solver, program, initi
|
|
|
596
414
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
597
415
|
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
598
416
|
*/
|
|
599
|
-
module.exports.executeCircuitWithBlackBoxSolver = function(
|
|
600
|
-
_assertClass(
|
|
417
|
+
module.exports.executeCircuitWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_handler) {
|
|
418
|
+
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
601
419
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
602
420
|
const len0 = WASM_VECTOR_LEN;
|
|
603
|
-
const ret = wasm.executeCircuitWithBlackBoxSolver(
|
|
421
|
+
const ret = wasm.executeCircuitWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
604
422
|
return takeObject(ret);
|
|
605
423
|
};
|
|
606
424
|
|
|
@@ -615,11 +433,11 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
615
433
|
|
|
616
434
|
/**
|
|
617
435
|
*/
|
|
618
|
-
module.exports.executeProgramWithBlackBoxSolver = function(
|
|
619
|
-
_assertClass(
|
|
436
|
+
module.exports.executeProgramWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_executor) {
|
|
437
|
+
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
620
438
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
621
439
|
const len0 = WASM_VECTOR_LEN;
|
|
622
|
-
const ret = wasm.executeProgramWithBlackBoxSolver(
|
|
440
|
+
const ret = wasm.executeProgramWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
|
|
623
441
|
return takeObject(ret);
|
|
624
442
|
};
|
|
625
443
|
|
|
@@ -653,6 +471,189 @@ module.exports.buildInfo = function() {
|
|
|
653
471
|
return takeObject(ret);
|
|
654
472
|
};
|
|
655
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
476
|
+
*
|
|
477
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
478
|
+
* @returns {Uint8Array} A compressed witness map
|
|
479
|
+
*/
|
|
480
|
+
module.exports.compressWitness = function(witness_map) {
|
|
481
|
+
try {
|
|
482
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
483
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
484
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
485
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
486
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
487
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
488
|
+
if (r3) {
|
|
489
|
+
throw takeObject(r2);
|
|
490
|
+
}
|
|
491
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
492
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
493
|
+
return v1;
|
|
494
|
+
} finally {
|
|
495
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
501
|
+
* This should be used to only fetch the witness map for the main function.
|
|
502
|
+
*
|
|
503
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
504
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
505
|
+
*/
|
|
506
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
507
|
+
try {
|
|
508
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
509
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
510
|
+
const len0 = WASM_VECTOR_LEN;
|
|
511
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
512
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
513
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
514
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
515
|
+
if (r2) {
|
|
516
|
+
throw takeObject(r1);
|
|
517
|
+
}
|
|
518
|
+
return takeObject(r0);
|
|
519
|
+
} finally {
|
|
520
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
526
|
+
*
|
|
527
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
528
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
529
|
+
*/
|
|
530
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
531
|
+
try {
|
|
532
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
533
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
534
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
535
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
536
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
537
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
538
|
+
if (r3) {
|
|
539
|
+
throw takeObject(r2);
|
|
540
|
+
}
|
|
541
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
542
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
543
|
+
return v1;
|
|
544
|
+
} finally {
|
|
545
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
551
|
+
*
|
|
552
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
553
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
554
|
+
*/
|
|
555
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
556
|
+
try {
|
|
557
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
558
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
559
|
+
const len0 = WASM_VECTOR_LEN;
|
|
560
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
561
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
562
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
563
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
564
|
+
if (r2) {
|
|
565
|
+
throw takeObject(r1);
|
|
566
|
+
}
|
|
567
|
+
return takeObject(r0);
|
|
568
|
+
} finally {
|
|
569
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
575
|
+
*
|
|
576
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
577
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
578
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
579
|
+
* @param {Uint8Array} program
|
|
580
|
+
* @param {WitnessMap} witness_map
|
|
581
|
+
* @returns {WitnessMap}
|
|
582
|
+
*/
|
|
583
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
584
|
+
try {
|
|
585
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
586
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
588
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
589
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
590
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
591
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
592
|
+
if (r2) {
|
|
593
|
+
throw takeObject(r1);
|
|
594
|
+
}
|
|
595
|
+
return takeObject(r0);
|
|
596
|
+
} finally {
|
|
597
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
603
|
+
*
|
|
604
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
605
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
606
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
607
|
+
* @param {Uint8Array} program
|
|
608
|
+
* @param {WitnessMap} solved_witness
|
|
609
|
+
* @returns {WitnessMap}
|
|
610
|
+
*/
|
|
611
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
612
|
+
try {
|
|
613
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
614
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
615
|
+
const len0 = WASM_VECTOR_LEN;
|
|
616
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
617
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
618
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
619
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
620
|
+
if (r2) {
|
|
621
|
+
throw takeObject(r1);
|
|
622
|
+
}
|
|
623
|
+
return takeObject(r0);
|
|
624
|
+
} finally {
|
|
625
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
631
|
+
*
|
|
632
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
633
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
634
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
635
|
+
* @param {Uint8Array} program
|
|
636
|
+
* @param {WitnessMap} solved_witness
|
|
637
|
+
* @returns {WitnessMap}
|
|
638
|
+
*/
|
|
639
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
640
|
+
try {
|
|
641
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
642
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
643
|
+
const len0 = WASM_VECTOR_LEN;
|
|
644
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
645
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
646
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
647
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
648
|
+
if (r2) {
|
|
649
|
+
throw takeObject(r1);
|
|
650
|
+
}
|
|
651
|
+
return takeObject(r0);
|
|
652
|
+
} finally {
|
|
653
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
|
|
656
657
|
function __wbg_adapter_81(arg0, arg1, arg2, arg3, arg4) {
|
|
657
658
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
658
659
|
}
|
|
@@ -694,39 +695,20 @@ class WasmBlackBoxFunctionSolver {
|
|
|
694
695
|
}
|
|
695
696
|
module.exports.WasmBlackBoxFunctionSolver = WasmBlackBoxFunctionSolver;
|
|
696
697
|
|
|
697
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
698
|
-
const obj = getObject(arg1);
|
|
699
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
700
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
701
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
702
|
-
};
|
|
703
|
-
|
|
704
698
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
705
699
|
takeObject(arg0);
|
|
706
700
|
};
|
|
707
701
|
|
|
708
|
-
module.exports.
|
|
709
|
-
const ret =
|
|
710
|
-
return addHeapObject(ret);
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
module.exports.__wbindgen_number_new = function(arg0) {
|
|
714
|
-
const ret = arg0;
|
|
715
|
-
return addHeapObject(ret);
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
719
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
702
|
+
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
|
|
703
|
+
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
|
|
720
704
|
return addHeapObject(ret);
|
|
721
705
|
};
|
|
722
706
|
|
|
723
|
-
module.exports.
|
|
707
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
724
708
|
const obj = getObject(arg1);
|
|
725
|
-
const ret = typeof(obj) === '
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
729
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
709
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
710
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
711
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
730
712
|
};
|
|
731
713
|
|
|
732
714
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
@@ -739,11 +721,6 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
739
721
|
return ret;
|
|
740
722
|
};
|
|
741
723
|
|
|
742
|
-
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
|
|
743
|
-
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
|
|
744
|
-
return addHeapObject(ret);
|
|
745
|
-
};
|
|
746
|
-
|
|
747
724
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
748
725
|
const ret = Array.isArray(getObject(arg0));
|
|
749
726
|
return ret;
|
|
@@ -759,6 +736,30 @@ module.exports.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
|
759
736
|
return addHeapObject(ret);
|
|
760
737
|
};
|
|
761
738
|
|
|
739
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
740
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
741
|
+
return addHeapObject(ret);
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
module.exports.__wbg_new_6f6c75f9324b78e8 = function() {
|
|
745
|
+
const ret = new Map();
|
|
746
|
+
return addHeapObject(ret);
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
750
|
+
const ret = arg0;
|
|
751
|
+
return addHeapObject(ret);
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
755
|
+
const obj = getObject(arg1);
|
|
756
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
757
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
758
|
+
var len1 = WASM_VECTOR_LEN;
|
|
759
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
760
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
761
|
+
};
|
|
762
|
+
|
|
762
763
|
module.exports.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
763
764
|
const ret = new Array();
|
|
764
765
|
return addHeapObject(ret);
|
|
@@ -982,7 +983,7 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
982
983
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
983
984
|
};
|
|
984
985
|
|
|
985
|
-
module.exports.
|
|
986
|
+
module.exports.__wbindgen_closure_wrapper493 = function(arg0, arg1, arg2) {
|
|
986
987
|
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_22);
|
|
987
988
|
return addHeapObject(ret);
|
|
988
989
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function compressWitness(a: number, b: number): void;
|
|
5
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
6
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
7
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
8
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
11
4
|
export function and(a: number, b: number): number;
|
|
12
5
|
export function xor(a: number, b: number): number;
|
|
13
6
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -24,6 +17,13 @@ export function executeProgram(a: number, b: number, c: number, d: number): numb
|
|
|
24
17
|
export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
|
|
25
18
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
26
19
|
export function buildInfo(): number;
|
|
20
|
+
export function compressWitness(a: number, b: number): void;
|
|
21
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
22
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
23
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
24
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
25
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
26
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
27
27
|
export function __wbindgen_malloc(a: number): number;
|
|
28
28
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
29
29
|
export const __wbindgen_export_2: WebAssembly.Table;
|