@noir-lang/acvm_js 0.41.0 → 0.42.0-166e569.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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  let imports = {};
2
2
  imports['__wbindgen_placeholder__'] = module.exports;
3
3
  let wasm;
4
- const { TextDecoder, TextEncoder } = require(`util`);
4
+ const { TextEncoder, TextDecoder } = require(`util`);
5
5
 
6
6
  const heap = new Array(128).fill(undefined);
7
7
 
@@ -23,24 +23,6 @@ function takeObject(idx) {
23
23
  return ret;
24
24
  }
25
25
 
26
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
-
28
- cachedTextDecoder.decode();
29
-
30
- let cachedUint8Memory0 = null;
31
-
32
- function getUint8Memory0() {
33
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
34
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
35
- }
36
- return cachedUint8Memory0;
37
- }
38
-
39
- function getStringFromWasm0(ptr, len) {
40
- ptr = ptr >>> 0;
41
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
42
- }
43
-
44
26
  function addHeapObject(obj) {
45
27
  if (heap_next === heap.length) heap.push(heap.length + 1);
46
28
  const idx = heap_next;
@@ -52,6 +34,15 @@ function addHeapObject(obj) {
52
34
 
53
35
  let WASM_VECTOR_LEN = 0;
54
36
 
37
+ let cachedUint8Memory0 = null;
38
+
39
+ function getUint8Memory0() {
40
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
41
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
42
+ }
43
+ return cachedUint8Memory0;
44
+ }
45
+
55
46
  let cachedTextEncoder = new TextEncoder('utf-8');
56
47
 
57
48
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -118,6 +109,15 @@ function getInt32Memory0() {
118
109
  return cachedInt32Memory0;
119
110
  }
120
111
 
112
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
113
+
114
+ cachedTextDecoder.decode();
115
+
116
+ function getStringFromWasm0(ptr, len) {
117
+ ptr = ptr >>> 0;
118
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
119
+ }
120
+
121
121
  let cachedFloat64Memory0 = null;
122
122
 
123
123
  function getFloat64Memory0() {
@@ -229,13 +229,6 @@ 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);
@@ -243,6 +236,143 @@ function passArray8ToWasm0(arg, malloc) {
243
236
  return ptr;
244
237
  }
245
238
  /**
239
+ * Verifies a ECDSA signature over the secp256r1 curve.
240
+ * @param {Uint8Array} hashed_msg
241
+ * @param {Uint8Array} public_key_x_bytes
242
+ * @param {Uint8Array} public_key_y_bytes
243
+ * @param {Uint8Array} signature
244
+ * @returns {boolean}
245
+ */
246
+ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
247
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
248
+ const len0 = WASM_VECTOR_LEN;
249
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
250
+ const len1 = WASM_VECTOR_LEN;
251
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
252
+ const len2 = WASM_VECTOR_LEN;
253
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
254
+ const len3 = WASM_VECTOR_LEN;
255
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
256
+ return ret !== 0;
257
+ };
258
+
259
+ /**
260
+ * Verifies a ECDSA signature over the secp256k1 curve.
261
+ * @param {Uint8Array} hashed_msg
262
+ * @param {Uint8Array} public_key_x_bytes
263
+ * @param {Uint8Array} public_key_y_bytes
264
+ * @param {Uint8Array} signature
265
+ * @returns {boolean}
266
+ */
267
+ module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
268
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
271
+ const len1 = WASM_VECTOR_LEN;
272
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
273
+ const len2 = WASM_VECTOR_LEN;
274
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
275
+ const len3 = WASM_VECTOR_LEN;
276
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
277
+ return ret !== 0;
278
+ };
279
+
280
+ function getArrayU8FromWasm0(ptr, len) {
281
+ ptr = ptr >>> 0;
282
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
283
+ }
284
+ /**
285
+ * Calculates the Keccak256 hash of the input bytes
286
+ * @param {Uint8Array} inputs
287
+ * @returns {Uint8Array}
288
+ */
289
+ module.exports.keccak256 = function(inputs) {
290
+ try {
291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
292
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ wasm.keccak256(retptr, ptr0, len0);
295
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
296
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
297
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
298
+ wasm.__wbindgen_free(r0, r1 * 1);
299
+ return v2;
300
+ } finally {
301
+ wasm.__wbindgen_add_to_stack_pointer(16);
302
+ }
303
+ };
304
+
305
+ /**
306
+ * Calculates the Blake2s256 hash of the input bytes
307
+ * @param {Uint8Array} inputs
308
+ * @returns {Uint8Array}
309
+ */
310
+ module.exports.blake2s256 = function(inputs) {
311
+ try {
312
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
313
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ wasm.blake2s256(retptr, ptr0, len0);
316
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
317
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
318
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
319
+ wasm.__wbindgen_free(r0, r1 * 1);
320
+ return v2;
321
+ } finally {
322
+ wasm.__wbindgen_add_to_stack_pointer(16);
323
+ }
324
+ };
325
+
326
+ /**
327
+ * Calculates the SHA256 hash of the input bytes
328
+ * @param {Uint8Array} inputs
329
+ * @returns {Uint8Array}
330
+ */
331
+ module.exports.sha256 = function(inputs) {
332
+ try {
333
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
334
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ wasm.sha256(retptr, ptr0, len0);
337
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
338
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
339
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
340
+ wasm.__wbindgen_free(r0, r1 * 1);
341
+ return v2;
342
+ } finally {
343
+ wasm.__wbindgen_add_to_stack_pointer(16);
344
+ }
345
+ };
346
+
347
+ /**
348
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
349
+ * @param {string} lhs
350
+ * @param {string} rhs
351
+ * @returns {string}
352
+ */
353
+ module.exports.xor = function(lhs, rhs) {
354
+ const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
355
+ return takeObject(ret);
356
+ };
357
+
358
+ /**
359
+ * Performs a bitwise AND operation between `lhs` and `rhs`
360
+ * @param {string} lhs
361
+ * @param {string} rhs
362
+ * @returns {string}
363
+ */
364
+ module.exports.and = function(lhs, rhs) {
365
+ const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
366
+ return takeObject(ret);
367
+ };
368
+
369
+ function _assertClass(instance, klass) {
370
+ if (!(instance instanceof klass)) {
371
+ throw new Error(`expected instance of ${klass.name}`);
372
+ }
373
+ return instance.ptr;
374
+ }
375
+ /**
246
376
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
247
377
  *
248
378
  * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
@@ -251,9 +381,9 @@ function passArray8ToWasm0(arg, malloc) {
251
381
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
252
382
  * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
253
383
  */
254
- module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) {
384
+ module.exports.executeCircuitWithBlackBoxSolver = function(solver, program, initial_witness, foreign_call_handler) {
255
385
  _assertClass(solver, WasmBlackBoxFunctionSolver);
256
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
386
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
257
387
  const len0 = WASM_VECTOR_LEN;
258
388
  const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
259
389
  return takeObject(ret);
@@ -267,8 +397,8 @@ module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, init
267
397
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
268
398
  * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
269
399
  */
270
- module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) {
271
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
400
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
401
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
272
402
  const len0 = WASM_VECTOR_LEN;
273
403
  const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
274
404
  return takeObject(ret);
@@ -288,14 +418,14 @@ module.exports.createBlackBoxSolver = function() {
288
418
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
289
419
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
290
420
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
291
- * @param {Uint8Array} circuit
421
+ * @param {Uint8Array} program
292
422
  * @param {WitnessMap} solved_witness
293
423
  * @returns {WitnessMap}
294
424
  */
295
- module.exports.getPublicWitness = function(circuit, solved_witness) {
425
+ module.exports.getPublicWitness = function(program, solved_witness) {
296
426
  try {
297
427
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
298
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
428
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
299
429
  const len0 = WASM_VECTOR_LEN;
300
430
  wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
301
431
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -316,14 +446,14 @@ module.exports.getPublicWitness = function(circuit, solved_witness) {
316
446
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
317
447
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
318
448
  * @returns {WitnessMap} A witness map containing the circuit's public parameters.
319
- * @param {Uint8Array} circuit
449
+ * @param {Uint8Array} program
320
450
  * @param {WitnessMap} solved_witness
321
451
  * @returns {WitnessMap}
322
452
  */
323
- module.exports.getPublicParametersWitness = function(circuit, solved_witness) {
453
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
324
454
  try {
325
455
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
326
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
456
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
327
457
  const len0 = WASM_VECTOR_LEN;
328
458
  wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
329
459
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -344,14 +474,14 @@ module.exports.getPublicParametersWitness = function(circuit, solved_witness) {
344
474
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
345
475
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
346
476
  * @returns {WitnessMap} A witness map containing the circuit's return values.
347
- * @param {Uint8Array} circuit
477
+ * @param {Uint8Array} program
348
478
  * @param {WitnessMap} witness_map
349
479
  * @returns {WitnessMap}
350
480
  */
351
- module.exports.getReturnWitness = function(circuit, witness_map) {
481
+ module.exports.getReturnWitness = function(program, witness_map) {
352
482
  try {
353
483
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
354
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
484
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
355
485
  const len0 = WASM_VECTOR_LEN;
356
486
  wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
357
487
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -366,6 +496,27 @@ module.exports.getReturnWitness = function(circuit, witness_map) {
366
496
  }
367
497
  };
368
498
 
499
+ /**
500
+ * Sets the package's logging level.
501
+ *
502
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
503
+ */
504
+ module.exports.initLogLevel = function(filter) {
505
+ try {
506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
507
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
508
+ const len0 = WASM_VECTOR_LEN;
509
+ wasm.initLogLevel(retptr, ptr0, len0);
510
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
511
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
512
+ if (r1) {
513
+ throw takeObject(r0);
514
+ }
515
+ } finally {
516
+ wasm.__wbindgen_add_to_stack_pointer(16);
517
+ }
518
+ };
519
+
369
520
  /**
370
521
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
371
522
  *
@@ -390,10 +541,6 @@ module.exports.decompressWitness = function(compressed_witness) {
390
541
  }
391
542
  };
392
543
 
393
- function getArrayU8FromWasm0(ptr, len) {
394
- ptr = ptr >>> 0;
395
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
396
- }
397
544
  /**
398
545
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
399
546
  *
@@ -419,154 +566,6 @@ module.exports.compressWitness = function(witness_map) {
419
566
  }
420
567
  };
421
568
 
422
- /**
423
- * Verifies a ECDSA signature over the secp256r1 curve.
424
- * @param {Uint8Array} hashed_msg
425
- * @param {Uint8Array} public_key_x_bytes
426
- * @param {Uint8Array} public_key_y_bytes
427
- * @param {Uint8Array} signature
428
- * @returns {boolean}
429
- */
430
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
431
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
432
- const len0 = WASM_VECTOR_LEN;
433
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
434
- const len1 = WASM_VECTOR_LEN;
435
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
436
- const len2 = WASM_VECTOR_LEN;
437
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
438
- const len3 = WASM_VECTOR_LEN;
439
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
440
- return ret !== 0;
441
- };
442
-
443
- /**
444
- * Verifies a ECDSA signature over the secp256k1 curve.
445
- * @param {Uint8Array} hashed_msg
446
- * @param {Uint8Array} public_key_x_bytes
447
- * @param {Uint8Array} public_key_y_bytes
448
- * @param {Uint8Array} signature
449
- * @returns {boolean}
450
- */
451
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
452
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
453
- const len0 = WASM_VECTOR_LEN;
454
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
455
- const len1 = WASM_VECTOR_LEN;
456
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
457
- const len2 = WASM_VECTOR_LEN;
458
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
459
- const len3 = WASM_VECTOR_LEN;
460
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
461
- return ret !== 0;
462
- };
463
-
464
- /**
465
- * Calculates the Keccak256 hash of the input bytes
466
- * @param {Uint8Array} inputs
467
- * @returns {Uint8Array}
468
- */
469
- module.exports.keccak256 = function(inputs) {
470
- try {
471
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
472
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
473
- const len0 = WASM_VECTOR_LEN;
474
- wasm.keccak256(retptr, ptr0, len0);
475
- var r0 = getInt32Memory0()[retptr / 4 + 0];
476
- var r1 = getInt32Memory0()[retptr / 4 + 1];
477
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
478
- wasm.__wbindgen_free(r0, r1 * 1);
479
- return v2;
480
- } finally {
481
- wasm.__wbindgen_add_to_stack_pointer(16);
482
- }
483
- };
484
-
485
- /**
486
- * Calculates the Blake2s256 hash of the input bytes
487
- * @param {Uint8Array} inputs
488
- * @returns {Uint8Array}
489
- */
490
- module.exports.blake2s256 = function(inputs) {
491
- try {
492
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
493
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
494
- const len0 = WASM_VECTOR_LEN;
495
- wasm.blake2s256(retptr, ptr0, len0);
496
- var r0 = getInt32Memory0()[retptr / 4 + 0];
497
- var r1 = getInt32Memory0()[retptr / 4 + 1];
498
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
499
- wasm.__wbindgen_free(r0, r1 * 1);
500
- return v2;
501
- } finally {
502
- wasm.__wbindgen_add_to_stack_pointer(16);
503
- }
504
- };
505
-
506
- /**
507
- * Calculates the SHA256 hash of the input bytes
508
- * @param {Uint8Array} inputs
509
- * @returns {Uint8Array}
510
- */
511
- module.exports.sha256 = function(inputs) {
512
- try {
513
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
514
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
515
- const len0 = WASM_VECTOR_LEN;
516
- wasm.sha256(retptr, ptr0, len0);
517
- var r0 = getInt32Memory0()[retptr / 4 + 0];
518
- var r1 = getInt32Memory0()[retptr / 4 + 1];
519
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
520
- wasm.__wbindgen_free(r0, r1 * 1);
521
- return v2;
522
- } finally {
523
- wasm.__wbindgen_add_to_stack_pointer(16);
524
- }
525
- };
526
-
527
- /**
528
- * Performs a bitwise XOR operation between `lhs` and `rhs`
529
- * @param {string} lhs
530
- * @param {string} rhs
531
- * @returns {string}
532
- */
533
- module.exports.xor = function(lhs, rhs) {
534
- const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
535
- return takeObject(ret);
536
- };
537
-
538
- /**
539
- * Performs a bitwise AND operation between `lhs` and `rhs`
540
- * @param {string} lhs
541
- * @param {string} rhs
542
- * @returns {string}
543
- */
544
- module.exports.and = function(lhs, rhs) {
545
- const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
546
- return takeObject(ret);
547
- };
548
-
549
- /**
550
- * Sets the package's logging level.
551
- *
552
- * @param {LogLevel} level - The maximum level of logging to be emitted.
553
- */
554
- module.exports.initLogLevel = function(filter) {
555
- try {
556
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
557
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
558
- const len0 = WASM_VECTOR_LEN;
559
- wasm.initLogLevel(retptr, ptr0, len0);
560
- var r0 = getInt32Memory0()[retptr / 4 + 0];
561
- var r1 = getInt32Memory0()[retptr / 4 + 1];
562
- if (r1) {
563
- throw takeObject(r0);
564
- }
565
- } finally {
566
- wasm.__wbindgen_add_to_stack_pointer(16);
567
- }
568
- };
569
-
570
569
  /**
571
570
  * Returns the `BuildInfo` object containing information about how the installed package was built.
572
571
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -642,37 +641,12 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
642
641
  takeObject(arg0);
643
642
  };
644
643
 
645
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
646
- const ret = new Error(getStringFromWasm0(arg0, arg1));
647
- return addHeapObject(ret);
648
- };
649
-
650
644
  module.exports.__wbindgen_object_clone_ref = function(arg0) {
651
645
  const ret = getObject(arg0);
652
646
  return addHeapObject(ret);
653
647
  };
654
648
 
655
- module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
656
- const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
657
- return addHeapObject(ret);
658
- };
659
-
660
- module.exports.__wbindgen_cb_drop = function(arg0) {
661
- const obj = takeObject(arg0).original;
662
- if (obj.cnt-- == 1) {
663
- obj.a = 0;
664
- return true;
665
- }
666
- const ret = false;
667
- return ret;
668
- };
669
-
670
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
671
- const ret = getStringFromWasm0(arg0, arg1);
672
- return addHeapObject(ret);
673
- };
674
-
675
- module.exports.__wbg_new_ab82e8584bdd2143 = function() {
649
+ module.exports.__wbg_new_0d2c031c3755a625 = function() {
676
650
  const ret = new Map();
677
651
  return addHeapObject(ret);
678
652
  };
@@ -691,11 +665,26 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
691
665
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
692
666
  };
693
667
 
694
- module.exports.__wbg_constructor_d9cb984c4e2c6bcd = function(arg0) {
668
+ module.exports.__wbg_constructor_9a4af6ecd5050c55 = function(arg0) {
695
669
  const ret = new Error(takeObject(arg0));
696
670
  return addHeapObject(ret);
697
671
  };
698
672
 
673
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
674
+ const ret = getStringFromWasm0(arg0, arg1);
675
+ return addHeapObject(ret);
676
+ };
677
+
678
+ module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
679
+ const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
680
+ return addHeapObject(ret);
681
+ };
682
+
683
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
684
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
685
+ return addHeapObject(ret);
686
+ };
687
+
699
688
  module.exports.__wbindgen_number_get = function(arg0, arg1) {
700
689
  const obj = getObject(arg1);
701
690
  const ret = typeof(obj) === 'number' ? obj : undefined;
@@ -718,6 +707,16 @@ module.exports.__wbindgen_is_array = function(arg0) {
718
707
  return ret;
719
708
  };
720
709
 
710
+ module.exports.__wbindgen_cb_drop = function(arg0) {
711
+ const obj = takeObject(arg0).original;
712
+ if (obj.cnt-- == 1) {
713
+ obj.a = 0;
714
+ return true;
715
+ }
716
+ const ret = false;
717
+ return ret;
718
+ };
719
+
721
720
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
722
721
  const ret = new Error();
723
722
  return addHeapObject(ret);
@@ -1231,8 +1230,8 @@ module.exports.__wbindgen_function_table = function() {
1231
1230
  return addHeapObject(ret);
1232
1231
  };
1233
1232
 
1234
- module.exports.__wbindgen_closure_wrapper1388 = function(arg0, arg1, arg2) {
1235
- const ret = makeMutClosure(arg0, arg1, 484, __wbg_adapter_52);
1233
+ module.exports.__wbindgen_closure_wrapper1400 = function(arg0, arg1, arg2) {
1234
+ const ret = makeMutClosure(arg0, arg1, 485, __wbg_adapter_52);
1236
1235
  return addHeapObject(ret);
1237
1236
  };
1238
1237
 
Binary file
@@ -1,6 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
5
+ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
6
+ export function keccak256(a: number, b: number, c: number): void;
7
+ export function blake2s256(a: number, b: number, c: number): void;
8
+ export function sha256(a: number, b: number, c: number): void;
9
+ export function xor(a: number, b: number): number;
10
+ export function and(a: number, b: number): number;
4
11
  export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
5
12
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
13
  export function createBlackBoxSolver(): number;
@@ -8,16 +15,9 @@ export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
8
15
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
9
16
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
10
17
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
18
+ export function initLogLevel(a: number, b: number, c: number): void;
11
19
  export function decompressWitness(a: number, b: number, c: number): void;
12
20
  export function compressWitness(a: number, b: number): void;
13
- export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
14
- export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
15
- export function keccak256(a: number, b: number, c: number): void;
16
- export function blake2s256(a: number, b: number, c: number): void;
17
- export function sha256(a: number, b: number, c: number): void;
18
- export function xor(a: number, b: number): number;
19
- export function and(a: number, b: number): number;
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;
23
23
  export function trap___wbg_wasmer_trap(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.41.0",
3
+ "version": "0.42.0-166e569.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.15.3",
44
+ "@web/test-runner": "^0.18.1",
45
45
  "@web/test-runner-playwright": "^0.10.0",
46
- "chai": "^4.3.7",
47
- "eslint": "^8.56.0",
48
- "eslint-plugin-prettier": "^5.0.0",
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.0.3",
50
+ "prettier": "3.2.5",
51
51
  "ts-node": "^10.9.1",
52
- "typescript": "^5.0.4"
52
+ "typescript": "^5.4.2"
53
53
  }
54
54
  }