@noir-lang/acvm_js 0.43.0-0adeb08.nightly → 0.43.0-4dfd7f0.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.
@@ -70,39 +70,6 @@ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap,
70
70
  */
71
71
  export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
72
72
  /**
73
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
74
- *
75
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
76
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
77
- * @returns {WitnessMap} A witness map containing the circuit's return values.
78
- * @param {Uint8Array} program
79
- * @param {WitnessMap} witness_map
80
- * @returns {WitnessMap}
81
- */
82
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
83
- /**
84
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
85
- *
86
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
87
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
88
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
89
- * @param {Uint8Array} program
90
- * @param {WitnessMap} solved_witness
91
- * @returns {WitnessMap}
92
- */
93
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
94
- /**
95
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
96
- *
97
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
98
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
99
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
100
- * @param {Uint8Array} program
101
- * @param {WitnessMap} solved_witness
102
- * @returns {WitnessMap}
103
- */
104
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
105
- /**
106
73
  * Performs a bitwise AND operation between `lhs` and `rhs`
107
74
  * @param {string} lhs
108
75
  * @param {string} rhs
@@ -153,16 +120,69 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
153
120
  */
154
121
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
155
122
  /**
123
+ * Sets the package's logging level.
124
+ *
125
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
126
+ */
127
+ export function initLogLevel(filter: string): void;
128
+ /**
129
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
130
+ *
131
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
132
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
133
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
134
+ * @param {Uint8Array} program
135
+ * @param {WitnessMap} witness_map
136
+ * @returns {WitnessMap}
137
+ */
138
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
139
+ /**
140
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
141
+ *
142
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
143
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
144
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
145
+ * @param {Uint8Array} program
146
+ * @param {WitnessMap} solved_witness
147
+ * @returns {WitnessMap}
148
+ */
149
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
150
+ /**
151
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
152
+ *
153
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
154
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
155
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
156
+ * @param {Uint8Array} program
157
+ * @param {WitnessMap} solved_witness
158
+ * @returns {WitnessMap}
159
+ */
160
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
161
+ /**
156
162
  * Returns the `BuildInfo` object containing information about how the installed package was built.
157
163
  * @returns {BuildInfo} - Information on how the installed package was built.
158
164
  */
159
165
  export function buildInfo(): BuildInfo;
166
+
167
+ export type ForeignCallInput = string[]
168
+ export type ForeignCallOutput = string | string[]
169
+
160
170
  /**
161
- * Sets the package's logging level.
162
- *
163
- * @param {LogLevel} level - The maximum level of logging to be emitted.
171
+ * A callback which performs an foreign call and returns the response.
172
+ * @callback ForeignCallHandler
173
+ * @param {string} name - The identifier for the type of foreign call being performed.
174
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
175
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
164
176
  */
165
- export function initLogLevel(filter: string): void;
177
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
178
+
179
+
180
+
181
+ export type ExecutionError = Error & {
182
+ callStack?: string[];
183
+ };
184
+
185
+
166
186
 
167
187
  // Map from witness index to hex string value of witness.
168
188
  export type WitnessMap = Map<number, string>;
@@ -179,29 +199,6 @@ export type SolvedAndReturnWitness = {
179
199
 
180
200
 
181
201
 
182
- export type StackItem = {
183
- index: number;
184
- witness: WitnessMap;
185
- }
186
-
187
- export type WitnessStack = Array<StackItem>;
188
-
189
-
190
-
191
- export type ForeignCallInput = string[]
192
- export type ForeignCallOutput = string | string[]
193
-
194
- /**
195
- * A callback which performs an foreign call and returns the response.
196
- * @callback ForeignCallHandler
197
- * @param {string} name - The identifier for the type of foreign call being performed.
198
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
199
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
200
- */
201
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
202
-
203
-
204
-
205
202
  /**
206
203
  * @typedef {Object} BuildInfo - Information about how the installed package was built
207
204
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -216,9 +213,12 @@ export type BuildInfo = {
216
213
 
217
214
 
218
215
 
219
- export type ExecutionError = Error & {
220
- callStack?: string[];
221
- };
216
+ export type StackItem = {
217
+ index: number;
218
+ witness: WitnessMap;
219
+ }
220
+
221
+ export type WitnessStack = Array<StackItem>;
222
222
 
223
223
 
224
224
  /**
package/nodejs/acvm_js.js CHANGED
@@ -23,6 +23,28 @@ function takeObject(idx) {
23
23
  return ret;
24
24
  }
25
25
 
26
+ function isLikeNone(x) {
27
+ return x === undefined || x === null;
28
+ }
29
+
30
+ let cachedFloat64Memory0 = null;
31
+
32
+ function getFloat64Memory0() {
33
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
34
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
35
+ }
36
+ return cachedFloat64Memory0;
37
+ }
38
+
39
+ let cachedInt32Memory0 = null;
40
+
41
+ function getInt32Memory0() {
42
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
43
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
44
+ }
45
+ return cachedInt32Memory0;
46
+ }
47
+
26
48
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
49
 
28
50
  cachedTextDecoder.decode();
@@ -50,28 +72,6 @@ function addHeapObject(obj) {
50
72
  return idx;
51
73
  }
52
74
 
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
-
75
75
  let WASM_VECTOR_LEN = 0;
76
76
 
77
77
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -421,90 +421,6 @@ module.exports.executeProgramWithBlackBoxSolver = function(solver, program, init
421
421
  return takeObject(ret);
422
422
  };
423
423
 
424
- /**
425
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
426
- *
427
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
428
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
429
- * @returns {WitnessMap} A witness map containing the circuit's return values.
430
- * @param {Uint8Array} program
431
- * @param {WitnessMap} witness_map
432
- * @returns {WitnessMap}
433
- */
434
- module.exports.getReturnWitness = function(program, witness_map) {
435
- try {
436
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
438
- const len0 = WASM_VECTOR_LEN;
439
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
440
- var r0 = getInt32Memory0()[retptr / 4 + 0];
441
- var r1 = getInt32Memory0()[retptr / 4 + 1];
442
- var r2 = getInt32Memory0()[retptr / 4 + 2];
443
- if (r2) {
444
- throw takeObject(r1);
445
- }
446
- return takeObject(r0);
447
- } finally {
448
- wasm.__wbindgen_add_to_stack_pointer(16);
449
- }
450
- };
451
-
452
- /**
453
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
454
- *
455
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
456
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
457
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
458
- * @param {Uint8Array} program
459
- * @param {WitnessMap} solved_witness
460
- * @returns {WitnessMap}
461
- */
462
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
463
- try {
464
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
465
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
466
- const len0 = WASM_VECTOR_LEN;
467
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
468
- var r0 = getInt32Memory0()[retptr / 4 + 0];
469
- var r1 = getInt32Memory0()[retptr / 4 + 1];
470
- var r2 = getInt32Memory0()[retptr / 4 + 2];
471
- if (r2) {
472
- throw takeObject(r1);
473
- }
474
- return takeObject(r0);
475
- } finally {
476
- wasm.__wbindgen_add_to_stack_pointer(16);
477
- }
478
- };
479
-
480
- /**
481
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
482
- *
483
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
484
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
485
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
486
- * @param {Uint8Array} program
487
- * @param {WitnessMap} solved_witness
488
- * @returns {WitnessMap}
489
- */
490
- module.exports.getPublicWitness = function(program, solved_witness) {
491
- try {
492
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
493
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
494
- const len0 = WASM_VECTOR_LEN;
495
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
496
- var r0 = getInt32Memory0()[retptr / 4 + 0];
497
- var r1 = getInt32Memory0()[retptr / 4 + 1];
498
- var r2 = getInt32Memory0()[retptr / 4 + 2];
499
- if (r2) {
500
- throw takeObject(r1);
501
- }
502
- return takeObject(r0);
503
- } finally {
504
- wasm.__wbindgen_add_to_stack_pointer(16);
505
- }
506
- };
507
-
508
424
  /**
509
425
  * Performs a bitwise AND operation between `lhs` and `rhs`
510
426
  * @param {string} lhs
@@ -632,15 +548,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
632
548
  return ret !== 0;
633
549
  };
634
550
 
635
- /**
636
- * Returns the `BuildInfo` object containing information about how the installed package was built.
637
- * @returns {BuildInfo} - Information on how the installed package was built.
638
- */
639
- module.exports.buildInfo = function() {
640
- const ret = wasm.buildInfo();
641
- return takeObject(ret);
642
- };
643
-
644
551
  /**
645
552
  * Sets the package's logging level.
646
553
  *
@@ -662,6 +569,99 @@ module.exports.initLogLevel = function(filter) {
662
569
  }
663
570
  };
664
571
 
572
+ /**
573
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
574
+ *
575
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
576
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
577
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
578
+ * @param {Uint8Array} program
579
+ * @param {WitnessMap} witness_map
580
+ * @returns {WitnessMap}
581
+ */
582
+ module.exports.getReturnWitness = function(program, witness_map) {
583
+ try {
584
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
585
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
586
+ const len0 = WASM_VECTOR_LEN;
587
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
588
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
589
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
590
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
591
+ if (r2) {
592
+ throw takeObject(r1);
593
+ }
594
+ return takeObject(r0);
595
+ } finally {
596
+ wasm.__wbindgen_add_to_stack_pointer(16);
597
+ }
598
+ };
599
+
600
+ /**
601
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
602
+ *
603
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
604
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
605
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
606
+ * @param {Uint8Array} program
607
+ * @param {WitnessMap} solved_witness
608
+ * @returns {WitnessMap}
609
+ */
610
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
611
+ try {
612
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
613
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
614
+ const len0 = WASM_VECTOR_LEN;
615
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
616
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
617
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
618
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
619
+ if (r2) {
620
+ throw takeObject(r1);
621
+ }
622
+ return takeObject(r0);
623
+ } finally {
624
+ wasm.__wbindgen_add_to_stack_pointer(16);
625
+ }
626
+ };
627
+
628
+ /**
629
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
630
+ *
631
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
632
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
633
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
634
+ * @param {Uint8Array} program
635
+ * @param {WitnessMap} solved_witness
636
+ * @returns {WitnessMap}
637
+ */
638
+ module.exports.getPublicWitness = function(program, solved_witness) {
639
+ try {
640
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
641
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
642
+ const len0 = WASM_VECTOR_LEN;
643
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
644
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
645
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
646
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
647
+ if (r2) {
648
+ throw takeObject(r1);
649
+ }
650
+ return takeObject(r0);
651
+ } finally {
652
+ wasm.__wbindgen_add_to_stack_pointer(16);
653
+ }
654
+ };
655
+
656
+ /**
657
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
658
+ * @returns {BuildInfo} - Information on how the installed package was built.
659
+ */
660
+ module.exports.buildInfo = function() {
661
+ const ret = wasm.buildInfo();
662
+ return takeObject(ret);
663
+ };
664
+
665
665
  function handleError(f, args) {
666
666
  try {
667
667
  return f.apply(this, args);
@@ -732,19 +732,14 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
732
732
  takeObject(arg0);
733
733
  };
734
734
 
735
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
736
- const ret = getStringFromWasm0(arg0, arg1);
737
- return addHeapObject(ret);
738
- };
739
-
740
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
741
- const ret = getObject(arg0);
735
+ module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
736
+ const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
742
737
  return addHeapObject(ret);
743
738
  };
744
739
 
745
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
746
- const ret = new Error(getStringFromWasm0(arg0, arg1));
747
- return addHeapObject(ret);
740
+ module.exports.__wbindgen_is_array = function(arg0) {
741
+ const ret = Array.isArray(getObject(arg0));
742
+ return ret;
748
743
  };
749
744
 
750
745
  module.exports.__wbindgen_cb_drop = function(arg0) {
@@ -757,16 +752,6 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
757
752
  return ret;
758
753
  };
759
754
 
760
- module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
761
- const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
762
- return addHeapObject(ret);
763
- };
764
-
765
- module.exports.__wbindgen_is_array = function(arg0) {
766
- const ret = Array.isArray(getObject(arg0));
767
- return ret;
768
- };
769
-
770
755
  module.exports.__wbindgen_number_get = function(arg0, arg1) {
771
756
  const obj = getObject(arg1);
772
757
  const ret = typeof(obj) === 'number' ? obj : undefined;
@@ -774,14 +759,34 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
774
759
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
775
760
  };
776
761
 
762
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
763
+ const ret = getStringFromWasm0(arg0, arg1);
764
+ return addHeapObject(ret);
765
+ };
766
+
777
767
  module.exports.__wbindgen_is_undefined = function(arg0) {
778
768
  const ret = getObject(arg0) === undefined;
779
769
  return ret;
780
770
  };
781
771
 
782
- module.exports.__wbindgen_is_string = function(arg0) {
783
- const ret = typeof(getObject(arg0)) === 'string';
784
- return ret;
772
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
773
+ const ret = getObject(arg0);
774
+ return addHeapObject(ret);
775
+ };
776
+
777
+ module.exports.__wbg_constructor_885d22c82fec0fdb = function(arg0) {
778
+ const ret = new Error(takeObject(arg0));
779
+ return addHeapObject(ret);
780
+ };
781
+
782
+ module.exports.__wbg_new_e1076c3a38c86fee = function() {
783
+ const ret = new Map();
784
+ return addHeapObject(ret);
785
+ };
786
+
787
+ module.exports.__wbindgen_number_new = function(arg0) {
788
+ const ret = arg0;
789
+ return addHeapObject(ret);
785
790
  };
786
791
 
787
792
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
@@ -793,14 +798,14 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
793
798
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
794
799
  };
795
800
 
796
- module.exports.__wbg_new_e1076c3a38c86fee = function() {
797
- const ret = new Map();
801
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
802
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
798
803
  return addHeapObject(ret);
799
804
  };
800
805
 
801
- module.exports.__wbindgen_number_new = function(arg0) {
802
- const ret = arg0;
803
- return addHeapObject(ret);
806
+ module.exports.__wbindgen_is_string = function(arg0) {
807
+ const ret = typeof(getObject(arg0)) === 'string';
808
+ return ret;
804
809
  };
805
810
 
806
811
  module.exports.__wbg_new_967d701c7af7cc58 = function() {
@@ -808,11 +813,6 @@ module.exports.__wbg_new_967d701c7af7cc58 = function() {
808
813
  return addHeapObject(ret);
809
814
  };
810
815
 
811
- module.exports.__wbg_constructor_885d22c82fec0fdb = function(arg0) {
812
- const ret = new Error(takeObject(arg0));
813
- return addHeapObject(ret);
814
- };
815
-
816
816
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
817
817
  const ret = new Error();
818
818
  return addHeapObject(ret);
@@ -838,6 +838,16 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
838
838
  }
839
839
  };
840
840
 
841
+ module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
842
+ const ret = arg0;
843
+ return addHeapObject(ret);
844
+ };
845
+
846
+ module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
847
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
848
+ return addHeapObject(ret);
849
+ };
850
+
841
851
  module.exports.__wbindgen_ge = function(arg0, arg1) {
842
852
  const ret = getObject(arg0) >= getObject(arg1);
843
853
  return ret;
@@ -863,16 +873,6 @@ module.exports.__wbindgen_is_bigint = function(arg0) {
863
873
  return ret;
864
874
  };
865
875
 
866
- module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
867
- const ret = arg0;
868
- return addHeapObject(ret);
869
- };
870
-
871
- module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
872
- const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
873
- return addHeapObject(ret);
874
- };
875
-
876
876
  module.exports.__wbindgen_is_object = function(arg0) {
877
877
  const val = getObject(arg0);
878
878
  const ret = typeof(val) === 'object' && val !== null;
@@ -1364,8 +1364,8 @@ module.exports.__wbindgen_function_table = function() {
1364
1364
  return addHeapObject(ret);
1365
1365
  };
1366
1366
 
1367
- module.exports.__wbindgen_closure_wrapper2118 = function(arg0, arg1, arg2) {
1368
- const ret = makeMutClosure(arg0, arg1, 723, __wbg_adapter_52);
1367
+ module.exports.__wbindgen_closure_wrapper2124 = function(arg0, arg1, arg2) {
1368
+ const ret = makeMutClosure(arg0, arg1, 724, __wbg_adapter_52);
1369
1369
  return addHeapObject(ret);
1370
1370
  };
1371
1371
 
Binary file
@@ -12,9 +12,6 @@ export function executeCircuitWithReturnWitness(a: number, b: number, c: number,
12
12
  export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
13
13
  export function executeProgram(a: number, b: number, c: number, d: number): number;
14
14
  export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
15
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
16
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
17
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
18
15
  export function and(a: number, b: number): number;
19
16
  export function xor(a: number, b: number): number;
20
17
  export function sha256(a: number, b: number, c: number): void;
@@ -22,8 +19,11 @@ export function blake2s256(a: number, b: number, c: number): void;
22
19
  export function keccak256(a: number, b: number, c: number): void;
23
20
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
24
21
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
25
- export function buildInfo(): number;
26
22
  export function initLogLevel(a: number, b: number, c: number): void;
23
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
24
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
25
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
26
+ export function buildInfo(): number;
27
27
  export function __wbg_trap_free(a: number): void;
28
28
  export function trap___wbg_wasmer_trap(): void;
29
29
  export function __wbindgen_malloc(a: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.43.0-0adeb08.nightly",
3
+ "version": "0.43.0-4dfd7f0.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -70,39 +70,6 @@ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap,
70
70
  */
71
71
  export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
72
72
  /**
73
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
74
- *
75
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
76
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
77
- * @returns {WitnessMap} A witness map containing the circuit's return values.
78
- * @param {Uint8Array} program
79
- * @param {WitnessMap} witness_map
80
- * @returns {WitnessMap}
81
- */
82
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
83
- /**
84
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
85
- *
86
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
87
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
88
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
89
- * @param {Uint8Array} program
90
- * @param {WitnessMap} solved_witness
91
- * @returns {WitnessMap}
92
- */
93
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
94
- /**
95
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
96
- *
97
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
98
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
99
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
100
- * @param {Uint8Array} program
101
- * @param {WitnessMap} solved_witness
102
- * @returns {WitnessMap}
103
- */
104
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
105
- /**
106
73
  * Performs a bitwise AND operation between `lhs` and `rhs`
107
74
  * @param {string} lhs
108
75
  * @param {string} rhs
@@ -153,16 +120,69 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
153
120
  */
154
121
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
155
122
  /**
123
+ * Sets the package's logging level.
124
+ *
125
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
126
+ */
127
+ export function initLogLevel(filter: string): void;
128
+ /**
129
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
130
+ *
131
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
132
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
133
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
134
+ * @param {Uint8Array} program
135
+ * @param {WitnessMap} witness_map
136
+ * @returns {WitnessMap}
137
+ */
138
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
139
+ /**
140
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
141
+ *
142
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
143
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
144
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
145
+ * @param {Uint8Array} program
146
+ * @param {WitnessMap} solved_witness
147
+ * @returns {WitnessMap}
148
+ */
149
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
150
+ /**
151
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
152
+ *
153
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
154
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
155
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
156
+ * @param {Uint8Array} program
157
+ * @param {WitnessMap} solved_witness
158
+ * @returns {WitnessMap}
159
+ */
160
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
161
+ /**
156
162
  * Returns the `BuildInfo` object containing information about how the installed package was built.
157
163
  * @returns {BuildInfo} - Information on how the installed package was built.
158
164
  */
159
165
  export function buildInfo(): BuildInfo;
166
+
167
+ export type ForeignCallInput = string[]
168
+ export type ForeignCallOutput = string | string[]
169
+
160
170
  /**
161
- * Sets the package's logging level.
162
- *
163
- * @param {LogLevel} level - The maximum level of logging to be emitted.
171
+ * A callback which performs an foreign call and returns the response.
172
+ * @callback ForeignCallHandler
173
+ * @param {string} name - The identifier for the type of foreign call being performed.
174
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
175
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
164
176
  */
165
- export function initLogLevel(filter: string): void;
177
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
178
+
179
+
180
+
181
+ export type ExecutionError = Error & {
182
+ callStack?: string[];
183
+ };
184
+
185
+
166
186
 
167
187
  // Map from witness index to hex string value of witness.
168
188
  export type WitnessMap = Map<number, string>;
@@ -179,29 +199,6 @@ export type SolvedAndReturnWitness = {
179
199
 
180
200
 
181
201
 
182
- export type StackItem = {
183
- index: number;
184
- witness: WitnessMap;
185
- }
186
-
187
- export type WitnessStack = Array<StackItem>;
188
-
189
-
190
-
191
- export type ForeignCallInput = string[]
192
- export type ForeignCallOutput = string | string[]
193
-
194
- /**
195
- * A callback which performs an foreign call and returns the response.
196
- * @callback ForeignCallHandler
197
- * @param {string} name - The identifier for the type of foreign call being performed.
198
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
199
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
200
- */
201
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
202
-
203
-
204
-
205
202
  /**
206
203
  * @typedef {Object} BuildInfo - Information about how the installed package was built
207
204
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -216,9 +213,12 @@ export type BuildInfo = {
216
213
 
217
214
 
218
215
 
219
- export type ExecutionError = Error & {
220
- callStack?: string[];
221
- };
216
+ export type StackItem = {
217
+ index: number;
218
+ witness: WitnessMap;
219
+ }
220
+
221
+ export type WitnessStack = Array<StackItem>;
222
222
 
223
223
 
224
224
  /**
@@ -242,9 +242,6 @@ export interface InitOutput {
242
242
  readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
243
243
  readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
244
244
  readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
245
- readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
246
- readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
247
- readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
248
245
  readonly and: (a: number, b: number) => number;
249
246
  readonly xor: (a: number, b: number) => number;
250
247
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -252,8 +249,11 @@ export interface InitOutput {
252
249
  readonly keccak256: (a: number, b: number, c: number) => void;
253
250
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
254
251
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
255
- readonly buildInfo: () => number;
256
252
  readonly initLogLevel: (a: number, b: number, c: number) => void;
253
+ readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
254
+ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
255
+ readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
256
+ readonly buildInfo: () => number;
257
257
  readonly __wbg_trap_free: (a: number) => void;
258
258
  readonly trap___wbg_wasmer_trap: () => void;
259
259
  readonly __wbindgen_malloc: (a: number) => number;
package/web/acvm_js.js CHANGED
@@ -20,6 +20,28 @@ function takeObject(idx) {
20
20
  return ret;
21
21
  }
22
22
 
23
+ function isLikeNone(x) {
24
+ return x === undefined || x === null;
25
+ }
26
+
27
+ let cachedFloat64Memory0 = null;
28
+
29
+ function getFloat64Memory0() {
30
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
31
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
32
+ }
33
+ return cachedFloat64Memory0;
34
+ }
35
+
36
+ let cachedInt32Memory0 = null;
37
+
38
+ function getInt32Memory0() {
39
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
40
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
41
+ }
42
+ return cachedInt32Memory0;
43
+ }
44
+
23
45
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
24
46
 
25
47
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -47,28 +69,6 @@ function addHeapObject(obj) {
47
69
  return idx;
48
70
  }
49
71
 
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
-
72
72
  let WASM_VECTOR_LEN = 0;
73
73
 
74
74
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -418,90 +418,6 @@ export function executeProgramWithBlackBoxSolver(solver, program, initial_witnes
418
418
  return takeObject(ret);
419
419
  }
420
420
 
421
- /**
422
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
423
- *
424
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
425
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
426
- * @returns {WitnessMap} A witness map containing the circuit's return values.
427
- * @param {Uint8Array} program
428
- * @param {WitnessMap} witness_map
429
- * @returns {WitnessMap}
430
- */
431
- export function getReturnWitness(program, witness_map) {
432
- try {
433
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
434
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
435
- const len0 = WASM_VECTOR_LEN;
436
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
437
- var r0 = getInt32Memory0()[retptr / 4 + 0];
438
- var r1 = getInt32Memory0()[retptr / 4 + 1];
439
- var r2 = getInt32Memory0()[retptr / 4 + 2];
440
- if (r2) {
441
- throw takeObject(r1);
442
- }
443
- return takeObject(r0);
444
- } finally {
445
- wasm.__wbindgen_add_to_stack_pointer(16);
446
- }
447
- }
448
-
449
- /**
450
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
451
- *
452
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
453
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
454
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
455
- * @param {Uint8Array} program
456
- * @param {WitnessMap} solved_witness
457
- * @returns {WitnessMap}
458
- */
459
- export function getPublicParametersWitness(program, solved_witness) {
460
- try {
461
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
462
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
463
- const len0 = WASM_VECTOR_LEN;
464
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
465
- var r0 = getInt32Memory0()[retptr / 4 + 0];
466
- var r1 = getInt32Memory0()[retptr / 4 + 1];
467
- var r2 = getInt32Memory0()[retptr / 4 + 2];
468
- if (r2) {
469
- throw takeObject(r1);
470
- }
471
- return takeObject(r0);
472
- } finally {
473
- wasm.__wbindgen_add_to_stack_pointer(16);
474
- }
475
- }
476
-
477
- /**
478
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
479
- *
480
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
481
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
482
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
483
- * @param {Uint8Array} program
484
- * @param {WitnessMap} solved_witness
485
- * @returns {WitnessMap}
486
- */
487
- export function getPublicWitness(program, solved_witness) {
488
- try {
489
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
490
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
491
- const len0 = WASM_VECTOR_LEN;
492
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
493
- var r0 = getInt32Memory0()[retptr / 4 + 0];
494
- var r1 = getInt32Memory0()[retptr / 4 + 1];
495
- var r2 = getInt32Memory0()[retptr / 4 + 2];
496
- if (r2) {
497
- throw takeObject(r1);
498
- }
499
- return takeObject(r0);
500
- } finally {
501
- wasm.__wbindgen_add_to_stack_pointer(16);
502
- }
503
- }
504
-
505
421
  /**
506
422
  * Performs a bitwise AND operation between `lhs` and `rhs`
507
423
  * @param {string} lhs
@@ -629,15 +545,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
629
545
  return ret !== 0;
630
546
  }
631
547
 
632
- /**
633
- * Returns the `BuildInfo` object containing information about how the installed package was built.
634
- * @returns {BuildInfo} - Information on how the installed package was built.
635
- */
636
- export function buildInfo() {
637
- const ret = wasm.buildInfo();
638
- return takeObject(ret);
639
- }
640
-
641
548
  /**
642
549
  * Sets the package's logging level.
643
550
  *
@@ -659,6 +566,99 @@ export function initLogLevel(filter) {
659
566
  }
660
567
  }
661
568
 
569
+ /**
570
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
571
+ *
572
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
573
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
574
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
575
+ * @param {Uint8Array} program
576
+ * @param {WitnessMap} witness_map
577
+ * @returns {WitnessMap}
578
+ */
579
+ export function getReturnWitness(program, witness_map) {
580
+ try {
581
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
582
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
585
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
586
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
587
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
588
+ if (r2) {
589
+ throw takeObject(r1);
590
+ }
591
+ return takeObject(r0);
592
+ } finally {
593
+ wasm.__wbindgen_add_to_stack_pointer(16);
594
+ }
595
+ }
596
+
597
+ /**
598
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
599
+ *
600
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
601
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
602
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
603
+ * @param {Uint8Array} program
604
+ * @param {WitnessMap} solved_witness
605
+ * @returns {WitnessMap}
606
+ */
607
+ export function getPublicParametersWitness(program, solved_witness) {
608
+ try {
609
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
610
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
611
+ const len0 = WASM_VECTOR_LEN;
612
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
613
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
614
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
615
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
616
+ if (r2) {
617
+ throw takeObject(r1);
618
+ }
619
+ return takeObject(r0);
620
+ } finally {
621
+ wasm.__wbindgen_add_to_stack_pointer(16);
622
+ }
623
+ }
624
+
625
+ /**
626
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
627
+ *
628
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
629
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
630
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
631
+ * @param {Uint8Array} program
632
+ * @param {WitnessMap} solved_witness
633
+ * @returns {WitnessMap}
634
+ */
635
+ export function getPublicWitness(program, solved_witness) {
636
+ try {
637
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
638
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
639
+ const len0 = WASM_VECTOR_LEN;
640
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
641
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
642
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
643
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
644
+ if (r2) {
645
+ throw takeObject(r1);
646
+ }
647
+ return takeObject(r0);
648
+ } finally {
649
+ wasm.__wbindgen_add_to_stack_pointer(16);
650
+ }
651
+ }
652
+
653
+ /**
654
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
655
+ * @returns {BuildInfo} - Information on how the installed package was built.
656
+ */
657
+ export function buildInfo() {
658
+ const ret = wasm.buildInfo();
659
+ return takeObject(ret);
660
+ }
661
+
662
662
  function handleError(f, args) {
663
663
  try {
664
664
  return f.apply(this, args);
@@ -760,17 +760,13 @@ function __wbg_get_imports() {
760
760
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
761
761
  takeObject(arg0);
762
762
  };
763
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
764
- const ret = getStringFromWasm0(arg0, arg1);
765
- return addHeapObject(ret);
766
- };
767
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
768
- const ret = getObject(arg0);
763
+ imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
764
+ const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
769
765
  return addHeapObject(ret);
770
766
  };
771
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
772
- const ret = new Error(getStringFromWasm0(arg0, arg1));
773
- return addHeapObject(ret);
767
+ imports.wbg.__wbindgen_is_array = function(arg0) {
768
+ const ret = Array.isArray(getObject(arg0));
769
+ return ret;
774
770
  };
775
771
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
776
772
  const obj = takeObject(arg0).original;
@@ -781,27 +777,35 @@ function __wbg_get_imports() {
781
777
  const ret = false;
782
778
  return ret;
783
779
  };
784
- imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
785
- const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
786
- return addHeapObject(ret);
787
- };
788
- imports.wbg.__wbindgen_is_array = function(arg0) {
789
- const ret = Array.isArray(getObject(arg0));
790
- return ret;
791
- };
792
780
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
793
781
  const obj = getObject(arg1);
794
782
  const ret = typeof(obj) === 'number' ? obj : undefined;
795
783
  getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
796
784
  getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
797
785
  };
786
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
787
+ const ret = getStringFromWasm0(arg0, arg1);
788
+ return addHeapObject(ret);
789
+ };
798
790
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
799
791
  const ret = getObject(arg0) === undefined;
800
792
  return ret;
801
793
  };
802
- imports.wbg.__wbindgen_is_string = function(arg0) {
803
- const ret = typeof(getObject(arg0)) === 'string';
804
- return ret;
794
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
795
+ const ret = getObject(arg0);
796
+ return addHeapObject(ret);
797
+ };
798
+ imports.wbg.__wbg_constructor_885d22c82fec0fdb = function(arg0) {
799
+ const ret = new Error(takeObject(arg0));
800
+ return addHeapObject(ret);
801
+ };
802
+ imports.wbg.__wbg_new_e1076c3a38c86fee = function() {
803
+ const ret = new Map();
804
+ return addHeapObject(ret);
805
+ };
806
+ imports.wbg.__wbindgen_number_new = function(arg0) {
807
+ const ret = arg0;
808
+ return addHeapObject(ret);
805
809
  };
806
810
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
807
811
  const obj = getObject(arg1);
@@ -811,22 +815,18 @@ function __wbg_get_imports() {
811
815
  getInt32Memory0()[arg0 / 4 + 1] = len1;
812
816
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
813
817
  };
814
- imports.wbg.__wbg_new_e1076c3a38c86fee = function() {
815
- const ret = new Map();
818
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
819
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
816
820
  return addHeapObject(ret);
817
821
  };
818
- imports.wbg.__wbindgen_number_new = function(arg0) {
819
- const ret = arg0;
820
- return addHeapObject(ret);
822
+ imports.wbg.__wbindgen_is_string = function(arg0) {
823
+ const ret = typeof(getObject(arg0)) === 'string';
824
+ return ret;
821
825
  };
822
826
  imports.wbg.__wbg_new_967d701c7af7cc58 = function() {
823
827
  const ret = new Array();
824
828
  return addHeapObject(ret);
825
829
  };
826
- imports.wbg.__wbg_constructor_885d22c82fec0fdb = function(arg0) {
827
- const ret = new Error(takeObject(arg0));
828
- return addHeapObject(ret);
829
- };
830
830
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
831
831
  const ret = new Error();
832
832
  return addHeapObject(ret);
@@ -849,6 +849,14 @@ function __wbg_get_imports() {
849
849
  wasm.__wbindgen_free(deferred0_0, deferred0_1);
850
850
  }
851
851
  };
852
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
853
+ const ret = arg0;
854
+ return addHeapObject(ret);
855
+ };
856
+ imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
857
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
858
+ return addHeapObject(ret);
859
+ };
852
860
  imports.wbg.__wbindgen_ge = function(arg0, arg1) {
853
861
  const ret = getObject(arg0) >= getObject(arg1);
854
862
  return ret;
@@ -869,14 +877,6 @@ function __wbg_get_imports() {
869
877
  const ret = typeof(getObject(arg0)) === 'bigint';
870
878
  return ret;
871
879
  };
872
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
873
- const ret = arg0;
874
- return addHeapObject(ret);
875
- };
876
- imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
877
- const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
878
- return addHeapObject(ret);
879
- };
880
880
  imports.wbg.__wbindgen_is_object = function(arg0) {
881
881
  const val = getObject(arg0);
882
882
  const ret = typeof(val) === 'object' && val !== null;
@@ -1284,8 +1284,8 @@ function __wbg_get_imports() {
1284
1284
  const ret = wasm.__wbindgen_export_2;
1285
1285
  return addHeapObject(ret);
1286
1286
  };
1287
- imports.wbg.__wbindgen_closure_wrapper2118 = function(arg0, arg1, arg2) {
1288
- const ret = makeMutClosure(arg0, arg1, 723, __wbg_adapter_52);
1287
+ imports.wbg.__wbindgen_closure_wrapper2124 = function(arg0, arg1, arg2) {
1288
+ const ret = makeMutClosure(arg0, arg1, 724, __wbg_adapter_52);
1289
1289
  return addHeapObject(ret);
1290
1290
  };
1291
1291
 
Binary file
@@ -12,9 +12,6 @@ export function executeCircuitWithReturnWitness(a: number, b: number, c: number,
12
12
  export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
13
13
  export function executeProgram(a: number, b: number, c: number, d: number): number;
14
14
  export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
15
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
16
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
17
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
18
15
  export function and(a: number, b: number): number;
19
16
  export function xor(a: number, b: number): number;
20
17
  export function sha256(a: number, b: number, c: number): void;
@@ -22,8 +19,11 @@ export function blake2s256(a: number, b: number, c: number): void;
22
19
  export function keccak256(a: number, b: number, c: number): void;
23
20
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
24
21
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
25
- export function buildInfo(): number;
26
22
  export function initLogLevel(a: number, b: number, c: number): void;
23
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
24
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
25
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
26
+ export function buildInfo(): number;
27
27
  export function __wbg_trap_free(a: number): void;
28
28
  export function trap___wbg_wasmer_trap(): void;
29
29
  export function __wbindgen_malloc(a: number): number;