@noir-lang/acvm_js 0.47.0-96ef87b.nightly → 0.47.0-bf3a75a.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 +62 -62
- package/nodejs/acvm_js.js +142 -142
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +6 -6
- package/package.json +1 -1
- package/web/acvm_js.d.ts +68 -68
- package/web/acvm_js.js +138 -138
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +6 -6
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
10
|
*
|
|
6
|
-
* @param {
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
7
13
|
*/
|
|
8
|
-
export function
|
|
14
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
17
|
+
* This should be used to only fetch the witness map for the main function.
|
|
18
|
+
*
|
|
19
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
20
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
21
|
+
*/
|
|
22
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
23
|
+
/**
|
|
24
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
25
|
+
*
|
|
26
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
27
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
28
|
+
*/
|
|
29
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
32
|
+
*
|
|
33
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
34
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
|
+
*/
|
|
36
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
9
37
|
/**
|
|
10
38
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
39
|
*
|
|
@@ -118,61 +146,24 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
146
|
*/
|
|
119
147
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
148
|
/**
|
|
121
|
-
*
|
|
122
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
123
|
-
*/
|
|
124
|
-
export function buildInfo(): BuildInfo;
|
|
125
|
-
/**
|
|
126
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
|
-
*
|
|
128
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
129
|
-
* @returns {Uint8Array} A compressed witness map
|
|
130
|
-
*/
|
|
131
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
132
|
-
/**
|
|
133
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
134
|
-
* This should be used to only fetch the witness map for the main function.
|
|
135
|
-
*
|
|
136
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
137
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
138
|
-
*/
|
|
139
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
140
|
-
/**
|
|
141
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
142
|
-
*
|
|
143
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
144
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
145
|
-
*/
|
|
146
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
147
|
-
/**
|
|
148
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
149
|
+
* Sets the package's logging level.
|
|
149
150
|
*
|
|
150
|
-
* @param {
|
|
151
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
151
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
152
152
|
*/
|
|
153
|
-
export function
|
|
154
|
-
|
|
155
|
-
export type ForeignCallInput = string[]
|
|
156
|
-
export type ForeignCallOutput = string | string[]
|
|
153
|
+
export function initLogLevel(filter: string): void;
|
|
157
154
|
|
|
158
155
|
/**
|
|
159
|
-
*
|
|
160
|
-
* @
|
|
161
|
-
* @
|
|
162
|
-
* @
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
export type StackItem = {
|
|
170
|
-
index: number;
|
|
171
|
-
witness: WitnessMap;
|
|
156
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
157
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
158
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
159
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
160
|
+
*/
|
|
161
|
+
export type BuildInfo = {
|
|
162
|
+
gitHash: string;
|
|
163
|
+
version: string;
|
|
164
|
+
dirty: string;
|
|
172
165
|
}
|
|
173
166
|
|
|
174
|
-
export type WitnessStack = Array<StackItem>;
|
|
175
|
-
|
|
176
167
|
|
|
177
168
|
|
|
178
169
|
export type RawAssertionPayload = {
|
|
@@ -201,16 +192,25 @@ export type SolvedAndReturnWitness = {
|
|
|
201
192
|
|
|
202
193
|
|
|
203
194
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
195
|
+
export type StackItem = {
|
|
196
|
+
index: number;
|
|
197
|
+
witness: WitnessMap;
|
|
214
198
|
}
|
|
215
199
|
|
|
200
|
+
export type WitnessStack = Array<StackItem>;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
export type ForeignCallInput = string[]
|
|
205
|
+
export type ForeignCallOutput = string | string[]
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A callback which performs an foreign call and returns the response.
|
|
209
|
+
* @callback ForeignCallHandler
|
|
210
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
211
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
212
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
213
|
+
*/
|
|
214
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
215
|
+
|
|
216
216
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,15 +23,6 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function addHeapObject(obj) {
|
|
27
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
-
const idx = heap_next;
|
|
29
|
-
heap_next = heap[idx];
|
|
30
|
-
|
|
31
|
-
heap[idx] = obj;
|
|
32
|
-
return idx;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
27
|
|
|
37
28
|
cachedTextDecoder.decode();
|
|
@@ -50,6 +41,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
50
41
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
51
42
|
}
|
|
52
43
|
|
|
44
|
+
function addHeapObject(obj) {
|
|
45
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
46
|
+
const idx = heap_next;
|
|
47
|
+
heap_next = heap[idx];
|
|
48
|
+
|
|
49
|
+
heap[idx] = obj;
|
|
50
|
+
return idx;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
53
|
let WASM_VECTOR_LEN = 0;
|
|
54
54
|
|
|
55
55
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -221,21 +221,38 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
225
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
226
|
+
*/
|
|
227
|
+
module.exports.buildInfo = function() {
|
|
228
|
+
const ret = wasm.buildInfo();
|
|
229
|
+
return takeObject(ret);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
233
|
+
ptr = ptr >>> 0;
|
|
234
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
225
238
|
*
|
|
226
|
-
* @param {
|
|
239
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
240
|
+
* @returns {Uint8Array} A compressed witness map
|
|
227
241
|
*/
|
|
228
|
-
module.exports.
|
|
242
|
+
module.exports.compressWitness = function(witness_map) {
|
|
229
243
|
try {
|
|
230
244
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
-
|
|
232
|
-
const len0 = WASM_VECTOR_LEN;
|
|
233
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
245
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
234
246
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
247
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
249
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
250
|
+
if (r3) {
|
|
251
|
+
throw takeObject(r2);
|
|
238
252
|
}
|
|
253
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
254
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
255
|
+
return v1;
|
|
239
256
|
} finally {
|
|
240
257
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
258
|
}
|
|
@@ -247,6 +264,80 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
247
264
|
WASM_VECTOR_LEN = arg.length;
|
|
248
265
|
return ptr;
|
|
249
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
269
|
+
* This should be used to only fetch the witness map for the main function.
|
|
270
|
+
*
|
|
271
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
272
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
273
|
+
*/
|
|
274
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
275
|
+
try {
|
|
276
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
277
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
279
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
280
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
281
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
282
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
283
|
+
if (r2) {
|
|
284
|
+
throw takeObject(r1);
|
|
285
|
+
}
|
|
286
|
+
return takeObject(r0);
|
|
287
|
+
} finally {
|
|
288
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
294
|
+
*
|
|
295
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
296
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
297
|
+
*/
|
|
298
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
299
|
+
try {
|
|
300
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
301
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
302
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
303
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
304
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
305
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
306
|
+
if (r3) {
|
|
307
|
+
throw takeObject(r2);
|
|
308
|
+
}
|
|
309
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
310
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
311
|
+
return v1;
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
319
|
+
*
|
|
320
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
321
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
322
|
+
*/
|
|
323
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
324
|
+
try {
|
|
325
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
326
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
327
|
+
const len0 = WASM_VECTOR_LEN;
|
|
328
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
329
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
330
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
331
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
332
|
+
if (r2) {
|
|
333
|
+
throw takeObject(r1);
|
|
334
|
+
}
|
|
335
|
+
return takeObject(r0);
|
|
336
|
+
} finally {
|
|
337
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
250
341
|
/**
|
|
251
342
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
252
343
|
*
|
|
@@ -399,10 +490,6 @@ module.exports.xor = function(lhs, rhs) {
|
|
|
399
490
|
return takeObject(ret);
|
|
400
491
|
};
|
|
401
492
|
|
|
402
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
403
|
-
ptr = ptr >>> 0;
|
|
404
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
405
|
-
}
|
|
406
493
|
/**
|
|
407
494
|
* Calculates the SHA256 hash of the input bytes
|
|
408
495
|
* @param {Uint8Array} inputs
|
|
@@ -509,108 +596,21 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
509
596
|
};
|
|
510
597
|
|
|
511
598
|
/**
|
|
512
|
-
*
|
|
513
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
514
|
-
*/
|
|
515
|
-
module.exports.buildInfo = function() {
|
|
516
|
-
const ret = wasm.buildInfo();
|
|
517
|
-
return takeObject(ret);
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
522
|
-
*
|
|
523
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
524
|
-
* @returns {Uint8Array} A compressed witness map
|
|
525
|
-
*/
|
|
526
|
-
module.exports.compressWitness = function(witness_map) {
|
|
527
|
-
try {
|
|
528
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
529
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
530
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
531
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
532
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
533
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
534
|
-
if (r3) {
|
|
535
|
-
throw takeObject(r2);
|
|
536
|
-
}
|
|
537
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
538
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
539
|
-
return v1;
|
|
540
|
-
} finally {
|
|
541
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
547
|
-
* This should be used to only fetch the witness map for the main function.
|
|
548
|
-
*
|
|
549
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
550
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
551
|
-
*/
|
|
552
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
553
|
-
try {
|
|
554
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
555
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
556
|
-
const len0 = WASM_VECTOR_LEN;
|
|
557
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
558
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
559
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
560
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
561
|
-
if (r2) {
|
|
562
|
-
throw takeObject(r1);
|
|
563
|
-
}
|
|
564
|
-
return takeObject(r0);
|
|
565
|
-
} finally {
|
|
566
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
567
|
-
}
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
/**
|
|
571
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
572
|
-
*
|
|
573
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
574
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
575
|
-
*/
|
|
576
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
577
|
-
try {
|
|
578
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
579
|
-
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
580
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
581
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
582
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
583
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
584
|
-
if (r3) {
|
|
585
|
-
throw takeObject(r2);
|
|
586
|
-
}
|
|
587
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
588
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
589
|
-
return v1;
|
|
590
|
-
} finally {
|
|
591
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
599
|
+
* Sets the package's logging level.
|
|
597
600
|
*
|
|
598
|
-
* @param {
|
|
599
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
601
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
600
602
|
*/
|
|
601
|
-
module.exports.
|
|
603
|
+
module.exports.initLogLevel = function(filter) {
|
|
602
604
|
try {
|
|
603
605
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
604
|
-
const ptr0 =
|
|
606
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
605
607
|
const len0 = WASM_VECTOR_LEN;
|
|
606
|
-
wasm.
|
|
608
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
607
609
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
608
610
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
throw takeObject(r1);
|
|
611
|
+
if (r1) {
|
|
612
|
+
throw takeObject(r0);
|
|
612
613
|
}
|
|
613
|
-
return takeObject(r0);
|
|
614
614
|
} finally {
|
|
615
615
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
616
|
}
|
|
@@ -635,46 +635,31 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
635
635
|
takeObject(arg0);
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
639
|
-
const obj = takeObject(arg0).original;
|
|
640
|
-
if (obj.cnt-- == 1) {
|
|
641
|
-
obj.a = 0;
|
|
642
|
-
return true;
|
|
643
|
-
}
|
|
644
|
-
const ret = false;
|
|
645
|
-
return ret;
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
649
|
-
const ret = new Array();
|
|
650
|
-
return addHeapObject(ret);
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
module.exports.__wbindgen_number_new = function(arg0) {
|
|
654
|
-
const ret = arg0;
|
|
655
|
-
return addHeapObject(ret);
|
|
656
|
-
};
|
|
657
|
-
|
|
658
638
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
659
639
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
660
640
|
return addHeapObject(ret);
|
|
661
641
|
};
|
|
662
642
|
|
|
663
|
-
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
664
|
-
const ret = new Error(takeObject(arg0));
|
|
665
|
-
return addHeapObject(ret);
|
|
666
|
-
};
|
|
667
|
-
|
|
668
643
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
669
644
|
const ret = Array.isArray(getObject(arg0));
|
|
670
645
|
return ret;
|
|
671
646
|
};
|
|
672
647
|
|
|
648
|
+
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
649
|
+
const ret = new Error(takeObject(arg0));
|
|
650
|
+
return addHeapObject(ret);
|
|
651
|
+
};
|
|
652
|
+
|
|
673
653
|
module.exports.__wbg_new_193bac1dd2be232d = function() {
|
|
674
654
|
const ret = new Map();
|
|
675
655
|
return addHeapObject(ret);
|
|
676
656
|
};
|
|
677
657
|
|
|
658
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
659
|
+
const ret = arg0;
|
|
660
|
+
return addHeapObject(ret);
|
|
661
|
+
};
|
|
662
|
+
|
|
678
663
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
679
664
|
const obj = getObject(arg1);
|
|
680
665
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -691,6 +676,21 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
|
691
676
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
692
677
|
};
|
|
693
678
|
|
|
679
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
680
|
+
const obj = takeObject(arg0).original;
|
|
681
|
+
if (obj.cnt-- == 1) {
|
|
682
|
+
obj.a = 0;
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
const ret = false;
|
|
686
|
+
return ret;
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
690
|
+
const ret = new Array();
|
|
691
|
+
return addHeapObject(ret);
|
|
692
|
+
};
|
|
693
|
+
|
|
694
694
|
module.exports.__wbindgen_is_string = function(arg0) {
|
|
695
695
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
696
696
|
return ret;
|
|
@@ -914,8 +914,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
914
914
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
-
module.exports.
|
|
918
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
917
|
+
module.exports.__wbindgen_closure_wrapper748 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 246, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
4
|
+
export function buildInfo(): number;
|
|
5
|
+
export function compressWitness(a: number, b: number): void;
|
|
6
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
7
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
8
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
5
9
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
10
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
11
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
@@ -15,11 +19,7 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
19
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
20
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
21
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
|
-
export function
|
|
19
|
-
export function compressWitness(a: number, b: number): void;
|
|
20
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
22
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
22
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
10
|
*
|
|
6
|
-
* @param {
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
7
13
|
*/
|
|
8
|
-
export function
|
|
14
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
17
|
+
* This should be used to only fetch the witness map for the main function.
|
|
18
|
+
*
|
|
19
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
20
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
21
|
+
*/
|
|
22
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
23
|
+
/**
|
|
24
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
25
|
+
*
|
|
26
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
27
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
28
|
+
*/
|
|
29
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
32
|
+
*
|
|
33
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
34
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
|
+
*/
|
|
36
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
9
37
|
/**
|
|
10
38
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
39
|
*
|
|
@@ -118,61 +146,24 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
146
|
*/
|
|
119
147
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
148
|
/**
|
|
121
|
-
*
|
|
122
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
123
|
-
*/
|
|
124
|
-
export function buildInfo(): BuildInfo;
|
|
125
|
-
/**
|
|
126
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
|
-
*
|
|
128
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
129
|
-
* @returns {Uint8Array} A compressed witness map
|
|
130
|
-
*/
|
|
131
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
132
|
-
/**
|
|
133
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
134
|
-
* This should be used to only fetch the witness map for the main function.
|
|
135
|
-
*
|
|
136
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
137
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
138
|
-
*/
|
|
139
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
140
|
-
/**
|
|
141
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
142
|
-
*
|
|
143
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
144
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
145
|
-
*/
|
|
146
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
147
|
-
/**
|
|
148
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
149
|
+
* Sets the package's logging level.
|
|
149
150
|
*
|
|
150
|
-
* @param {
|
|
151
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
151
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
152
152
|
*/
|
|
153
|
-
export function
|
|
154
|
-
|
|
155
|
-
export type ForeignCallInput = string[]
|
|
156
|
-
export type ForeignCallOutput = string | string[]
|
|
153
|
+
export function initLogLevel(filter: string): void;
|
|
157
154
|
|
|
158
155
|
/**
|
|
159
|
-
*
|
|
160
|
-
* @
|
|
161
|
-
* @
|
|
162
|
-
* @
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
export type StackItem = {
|
|
170
|
-
index: number;
|
|
171
|
-
witness: WitnessMap;
|
|
156
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
157
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
158
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
159
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
160
|
+
*/
|
|
161
|
+
export type BuildInfo = {
|
|
162
|
+
gitHash: string;
|
|
163
|
+
version: string;
|
|
164
|
+
dirty: string;
|
|
172
165
|
}
|
|
173
166
|
|
|
174
|
-
export type WitnessStack = Array<StackItem>;
|
|
175
|
-
|
|
176
167
|
|
|
177
168
|
|
|
178
169
|
export type RawAssertionPayload = {
|
|
@@ -201,25 +192,38 @@ export type SolvedAndReturnWitness = {
|
|
|
201
192
|
|
|
202
193
|
|
|
203
194
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
195
|
+
export type StackItem = {
|
|
196
|
+
index: number;
|
|
197
|
+
witness: WitnessMap;
|
|
214
198
|
}
|
|
215
199
|
|
|
200
|
+
export type WitnessStack = Array<StackItem>;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
export type ForeignCallInput = string[]
|
|
205
|
+
export type ForeignCallOutput = string | string[]
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A callback which performs an foreign call and returns the response.
|
|
209
|
+
* @callback ForeignCallHandler
|
|
210
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
211
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
212
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
213
|
+
*/
|
|
214
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
215
|
+
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
219
219
|
|
|
220
220
|
export interface InitOutput {
|
|
221
221
|
readonly memory: WebAssembly.Memory;
|
|
222
|
-
readonly
|
|
222
|
+
readonly buildInfo: () => number;
|
|
223
|
+
readonly compressWitness: (a: number, b: number) => void;
|
|
224
|
+
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
225
|
+
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
226
|
+
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
223
227
|
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
224
228
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
225
229
|
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -233,11 +237,7 @@ export interface InitOutput {
|
|
|
233
237
|
readonly keccak256: (a: number, b: number, c: number) => void;
|
|
234
238
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
235
239
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
236
|
-
readonly
|
|
237
|
-
readonly compressWitness: (a: number, b: number) => void;
|
|
238
|
-
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
239
|
-
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
240
|
-
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
240
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
241
241
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
242
242
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
243
243
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,15 +20,6 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function addHeapObject(obj) {
|
|
24
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
25
|
-
const idx = heap_next;
|
|
26
|
-
heap_next = heap[idx];
|
|
27
|
-
|
|
28
|
-
heap[idx] = obj;
|
|
29
|
-
return idx;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
23
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
33
24
|
|
|
34
25
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -47,6 +38,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
47
38
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
48
39
|
}
|
|
49
40
|
|
|
41
|
+
function addHeapObject(obj) {
|
|
42
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
+
const idx = heap_next;
|
|
44
|
+
heap_next = heap[idx];
|
|
45
|
+
|
|
46
|
+
heap[idx] = obj;
|
|
47
|
+
return idx;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
50
|
let WASM_VECTOR_LEN = 0;
|
|
51
51
|
|
|
52
52
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -218,21 +218,38 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
*
|
|
221
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
222
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
223
|
+
*/
|
|
224
|
+
export function buildInfo() {
|
|
225
|
+
const ret = wasm.buildInfo();
|
|
226
|
+
return takeObject(ret);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
230
|
+
ptr = ptr >>> 0;
|
|
231
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
222
235
|
*
|
|
223
|
-
* @param {
|
|
236
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
237
|
+
* @returns {Uint8Array} A compressed witness map
|
|
224
238
|
*/
|
|
225
|
-
export function
|
|
239
|
+
export function compressWitness(witness_map) {
|
|
226
240
|
try {
|
|
227
241
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
-
|
|
229
|
-
const len0 = WASM_VECTOR_LEN;
|
|
230
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
242
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
231
243
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
232
244
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
233
|
-
|
|
234
|
-
|
|
245
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
246
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
247
|
+
if (r3) {
|
|
248
|
+
throw takeObject(r2);
|
|
235
249
|
}
|
|
250
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
251
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
252
|
+
return v1;
|
|
236
253
|
} finally {
|
|
237
254
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
255
|
}
|
|
@@ -244,6 +261,80 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
244
261
|
WASM_VECTOR_LEN = arg.length;
|
|
245
262
|
return ptr;
|
|
246
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
266
|
+
* This should be used to only fetch the witness map for the main function.
|
|
267
|
+
*
|
|
268
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
269
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
270
|
+
*/
|
|
271
|
+
export function decompressWitness(compressed_witness) {
|
|
272
|
+
try {
|
|
273
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
274
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
275
|
+
const len0 = WASM_VECTOR_LEN;
|
|
276
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
277
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
278
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
279
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
280
|
+
if (r2) {
|
|
281
|
+
throw takeObject(r1);
|
|
282
|
+
}
|
|
283
|
+
return takeObject(r0);
|
|
284
|
+
} finally {
|
|
285
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
291
|
+
*
|
|
292
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
293
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
294
|
+
*/
|
|
295
|
+
export function compressWitnessStack(witness_stack) {
|
|
296
|
+
try {
|
|
297
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
298
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
299
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
300
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
301
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
302
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
303
|
+
if (r3) {
|
|
304
|
+
throw takeObject(r2);
|
|
305
|
+
}
|
|
306
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
307
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
308
|
+
return v1;
|
|
309
|
+
} finally {
|
|
310
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
316
|
+
*
|
|
317
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
318
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
319
|
+
*/
|
|
320
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
321
|
+
try {
|
|
322
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
323
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
324
|
+
const len0 = WASM_VECTOR_LEN;
|
|
325
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
326
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
327
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
328
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
329
|
+
if (r2) {
|
|
330
|
+
throw takeObject(r1);
|
|
331
|
+
}
|
|
332
|
+
return takeObject(r0);
|
|
333
|
+
} finally {
|
|
334
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
247
338
|
/**
|
|
248
339
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
249
340
|
*
|
|
@@ -396,10 +487,6 @@ export function xor(lhs, rhs) {
|
|
|
396
487
|
return takeObject(ret);
|
|
397
488
|
}
|
|
398
489
|
|
|
399
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
400
|
-
ptr = ptr >>> 0;
|
|
401
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
402
|
-
}
|
|
403
490
|
/**
|
|
404
491
|
* Calculates the SHA256 hash of the input bytes
|
|
405
492
|
* @param {Uint8Array} inputs
|
|
@@ -506,108 +593,21 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
506
593
|
}
|
|
507
594
|
|
|
508
595
|
/**
|
|
509
|
-
*
|
|
510
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
511
|
-
*/
|
|
512
|
-
export function buildInfo() {
|
|
513
|
-
const ret = wasm.buildInfo();
|
|
514
|
-
return takeObject(ret);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
519
|
-
*
|
|
520
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
521
|
-
* @returns {Uint8Array} A compressed witness map
|
|
522
|
-
*/
|
|
523
|
-
export function compressWitness(witness_map) {
|
|
524
|
-
try {
|
|
525
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
526
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
527
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
528
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
529
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
530
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
531
|
-
if (r3) {
|
|
532
|
-
throw takeObject(r2);
|
|
533
|
-
}
|
|
534
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
535
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
536
|
-
return v1;
|
|
537
|
-
} finally {
|
|
538
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
544
|
-
* This should be used to only fetch the witness map for the main function.
|
|
545
|
-
*
|
|
546
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
547
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
548
|
-
*/
|
|
549
|
-
export function decompressWitness(compressed_witness) {
|
|
550
|
-
try {
|
|
551
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
552
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
553
|
-
const len0 = WASM_VECTOR_LEN;
|
|
554
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
555
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
556
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
557
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
558
|
-
if (r2) {
|
|
559
|
-
throw takeObject(r1);
|
|
560
|
-
}
|
|
561
|
-
return takeObject(r0);
|
|
562
|
-
} finally {
|
|
563
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
569
|
-
*
|
|
570
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
571
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
572
|
-
*/
|
|
573
|
-
export function compressWitnessStack(witness_stack) {
|
|
574
|
-
try {
|
|
575
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
576
|
-
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
577
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
578
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
579
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
580
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
581
|
-
if (r3) {
|
|
582
|
-
throw takeObject(r2);
|
|
583
|
-
}
|
|
584
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
585
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
586
|
-
return v1;
|
|
587
|
-
} finally {
|
|
588
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
596
|
+
* Sets the package's logging level.
|
|
594
597
|
*
|
|
595
|
-
* @param {
|
|
596
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
598
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
597
599
|
*/
|
|
598
|
-
export function
|
|
600
|
+
export function initLogLevel(filter) {
|
|
599
601
|
try {
|
|
600
602
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
601
|
-
const ptr0 =
|
|
603
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
602
604
|
const len0 = WASM_VECTOR_LEN;
|
|
603
|
-
wasm.
|
|
605
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
604
606
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
605
607
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
throw takeObject(r1);
|
|
608
|
+
if (r1) {
|
|
609
|
+
throw takeObject(r0);
|
|
609
610
|
}
|
|
610
|
-
return takeObject(r0);
|
|
611
611
|
} finally {
|
|
612
612
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
613
613
|
}
|
|
@@ -665,39 +665,26 @@ function __wbg_get_imports() {
|
|
|
665
665
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
666
666
|
takeObject(arg0);
|
|
667
667
|
};
|
|
668
|
-
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
669
|
-
const obj = takeObject(arg0).original;
|
|
670
|
-
if (obj.cnt-- == 1) {
|
|
671
|
-
obj.a = 0;
|
|
672
|
-
return true;
|
|
673
|
-
}
|
|
674
|
-
const ret = false;
|
|
675
|
-
return ret;
|
|
676
|
-
};
|
|
677
|
-
imports.wbg.__wbg_new_f139361aad331bd0 = function() {
|
|
678
|
-
const ret = new Array();
|
|
679
|
-
return addHeapObject(ret);
|
|
680
|
-
};
|
|
681
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
682
|
-
const ret = arg0;
|
|
683
|
-
return addHeapObject(ret);
|
|
684
|
-
};
|
|
685
668
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
686
669
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
687
670
|
return addHeapObject(ret);
|
|
688
671
|
};
|
|
689
|
-
imports.wbg.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
690
|
-
const ret = new Error(takeObject(arg0));
|
|
691
|
-
return addHeapObject(ret);
|
|
692
|
-
};
|
|
693
672
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
694
673
|
const ret = Array.isArray(getObject(arg0));
|
|
695
674
|
return ret;
|
|
696
675
|
};
|
|
676
|
+
imports.wbg.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
677
|
+
const ret = new Error(takeObject(arg0));
|
|
678
|
+
return addHeapObject(ret);
|
|
679
|
+
};
|
|
697
680
|
imports.wbg.__wbg_new_193bac1dd2be232d = function() {
|
|
698
681
|
const ret = new Map();
|
|
699
682
|
return addHeapObject(ret);
|
|
700
683
|
};
|
|
684
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
685
|
+
const ret = arg0;
|
|
686
|
+
return addHeapObject(ret);
|
|
687
|
+
};
|
|
701
688
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
702
689
|
const obj = getObject(arg1);
|
|
703
690
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -712,6 +699,19 @@ function __wbg_get_imports() {
|
|
|
712
699
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
713
700
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
714
701
|
};
|
|
702
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
703
|
+
const obj = takeObject(arg0).original;
|
|
704
|
+
if (obj.cnt-- == 1) {
|
|
705
|
+
obj.a = 0;
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
const ret = false;
|
|
709
|
+
return ret;
|
|
710
|
+
};
|
|
711
|
+
imports.wbg.__wbg_new_f139361aad331bd0 = function() {
|
|
712
|
+
const ret = new Array();
|
|
713
|
+
return addHeapObject(ret);
|
|
714
|
+
};
|
|
715
715
|
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
716
716
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
717
717
|
return ret;
|
|
@@ -899,8 +899,8 @@ function __wbg_get_imports() {
|
|
|
899
899
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
900
900
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
901
901
|
};
|
|
902
|
-
imports.wbg.
|
|
903
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
902
|
+
imports.wbg.__wbindgen_closure_wrapper748 = function(arg0, arg1, arg2) {
|
|
903
|
+
const ret = makeMutClosure(arg0, arg1, 246, __wbg_adapter_22);
|
|
904
904
|
return addHeapObject(ret);
|
|
905
905
|
};
|
|
906
906
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
4
|
+
export function buildInfo(): number;
|
|
5
|
+
export function compressWitness(a: number, b: number): void;
|
|
6
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
7
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
8
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
5
9
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
10
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
11
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
@@ -15,11 +19,7 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
19
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
20
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
21
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
|
-
export function
|
|
19
|
-
export function compressWitness(a: number, b: number): void;
|
|
20
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
22
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
22
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|