@noir-lang/acvm_js 1.0.0-beta.16-7615632.nightly → 1.0.0-beta.16-a4c1387.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 +83 -83
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
- package/web/acvm_js.d.ts +67 -67
- package/web/acvm_js.js +83 -83
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +5 -5
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
13
|
+
*/
|
|
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;
|
|
3
37
|
/**
|
|
4
38
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
39
|
*
|
|
@@ -58,40 +92,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
58
92
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
59
93
|
*/
|
|
60
94
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
63
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
|
-
*/
|
|
65
|
-
export function buildInfo(): BuildInfo;
|
|
66
|
-
/**
|
|
67
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
68
|
-
*
|
|
69
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
70
|
-
* @returns {Uint8Array} A compressed witness map
|
|
71
|
-
*/
|
|
72
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
73
|
-
/**
|
|
74
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
75
|
-
* This should be used to only fetch the witness map for the main function.
|
|
76
|
-
*
|
|
77
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
78
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
79
|
-
*/
|
|
80
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
83
|
-
*
|
|
84
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
85
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
86
|
-
*/
|
|
87
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
88
|
-
/**
|
|
89
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
90
|
-
*
|
|
91
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
92
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
93
|
-
*/
|
|
94
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
95
95
|
/**
|
|
96
96
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
97
|
*/
|
|
@@ -117,6 +117,20 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
117
117
|
*/
|
|
118
118
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
120
134
|
// Map from witness index to hex string value of witness.
|
|
121
135
|
export type WitnessMap = Map<number, string>;
|
|
122
136
|
|
|
@@ -141,34 +155,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
141
155
|
|
|
142
156
|
|
|
143
157
|
|
|
144
|
-
export type RawAssertionPayload = {
|
|
145
|
-
selector: string;
|
|
146
|
-
data: string[];
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export type ExecutionError = Error & {
|
|
150
|
-
callStack?: string[];
|
|
151
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
152
|
-
acirFunctionId?: number;
|
|
153
|
-
brilligFunctionId?: number;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
160
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
161
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
162
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
163
|
-
*/
|
|
164
|
-
export type BuildInfo = {
|
|
165
|
-
gitHash: string;
|
|
166
|
-
version: string;
|
|
167
|
-
dirty: string;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
158
|
export type ForeignCallInput = string[]
|
|
173
159
|
export type ForeignCallOutput = string | string[]
|
|
174
160
|
|
|
@@ -182,3 +168,17 @@ export type ForeignCallOutput = string | string[]
|
|
|
182
168
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
169
|
|
|
184
170
|
|
|
171
|
+
|
|
172
|
+
export type RawAssertionPayload = {
|
|
173
|
+
selector: string;
|
|
174
|
+
data: string[];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type ExecutionError = Error & {
|
|
178
|
+
callStack?: string[];
|
|
179
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
+
acirFunctionId?: number;
|
|
181
|
+
brilligFunctionId?: number;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,6 +201,40 @@ function debugString(val) {
|
|
|
201
201
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
206
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
207
|
+
*/
|
|
208
|
+
module.exports.buildInfo = function() {
|
|
209
|
+
const ret = wasm.buildInfo();
|
|
210
|
+
return ret;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
function takeFromExternrefTable0(idx) {
|
|
214
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
215
|
+
wasm.__externref_table_dealloc(idx);
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
220
|
+
ptr = ptr >>> 0;
|
|
221
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
225
|
+
*
|
|
226
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
227
|
+
* @returns {Uint8Array} A compressed witness map
|
|
228
|
+
*/
|
|
229
|
+
module.exports.compressWitness = function(witness_map) {
|
|
230
|
+
const ret = wasm.compressWitness(witness_map);
|
|
231
|
+
if (ret[3]) {
|
|
232
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
233
|
+
}
|
|
234
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
235
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
236
|
+
return v1;
|
|
237
|
+
};
|
|
204
238
|
|
|
205
239
|
function passArray8ToWasm0(arg, malloc) {
|
|
206
240
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
@@ -208,6 +242,55 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
208
242
|
WASM_VECTOR_LEN = arg.length;
|
|
209
243
|
return ptr;
|
|
210
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
247
|
+
* This should be used to only fetch the witness map for the main function.
|
|
248
|
+
*
|
|
249
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
250
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
251
|
+
*/
|
|
252
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
253
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
254
|
+
const len0 = WASM_VECTOR_LEN;
|
|
255
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
256
|
+
if (ret[2]) {
|
|
257
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
258
|
+
}
|
|
259
|
+
return takeFromExternrefTable0(ret[0]);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
264
|
+
*
|
|
265
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
266
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
267
|
+
*/
|
|
268
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
269
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
270
|
+
if (ret[3]) {
|
|
271
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
272
|
+
}
|
|
273
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
274
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
275
|
+
return v1;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
280
|
+
*
|
|
281
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
282
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
283
|
+
*/
|
|
284
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
285
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
287
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
288
|
+
if (ret[2]) {
|
|
289
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
290
|
+
}
|
|
291
|
+
return takeFromExternrefTable0(ret[0]);
|
|
292
|
+
};
|
|
293
|
+
|
|
211
294
|
/**
|
|
212
295
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
213
296
|
*
|
|
@@ -254,11 +337,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
254
337
|
return ret;
|
|
255
338
|
};
|
|
256
339
|
|
|
257
|
-
function takeFromExternrefTable0(idx) {
|
|
258
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
259
|
-
wasm.__externref_table_dealloc(idx);
|
|
260
|
-
return value;
|
|
261
|
-
}
|
|
262
340
|
/**
|
|
263
341
|
* Sets the package's logging level.
|
|
264
342
|
*
|
|
@@ -333,84 +411,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
333
411
|
return takeFromExternrefTable0(ret[0]);
|
|
334
412
|
};
|
|
335
413
|
|
|
336
|
-
/**
|
|
337
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
338
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
339
|
-
*/
|
|
340
|
-
module.exports.buildInfo = function() {
|
|
341
|
-
const ret = wasm.buildInfo();
|
|
342
|
-
return ret;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
346
|
-
ptr = ptr >>> 0;
|
|
347
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
351
|
-
*
|
|
352
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
353
|
-
* @returns {Uint8Array} A compressed witness map
|
|
354
|
-
*/
|
|
355
|
-
module.exports.compressWitness = function(witness_map) {
|
|
356
|
-
const ret = wasm.compressWitness(witness_map);
|
|
357
|
-
if (ret[3]) {
|
|
358
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
359
|
-
}
|
|
360
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
361
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
362
|
-
return v1;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
367
|
-
* This should be used to only fetch the witness map for the main function.
|
|
368
|
-
*
|
|
369
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
370
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
371
|
-
*/
|
|
372
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
373
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
374
|
-
const len0 = WASM_VECTOR_LEN;
|
|
375
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
376
|
-
if (ret[2]) {
|
|
377
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
378
|
-
}
|
|
379
|
-
return takeFromExternrefTable0(ret[0]);
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
384
|
-
*
|
|
385
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
386
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
387
|
-
*/
|
|
388
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
389
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
390
|
-
if (ret[3]) {
|
|
391
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
392
|
-
}
|
|
393
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
394
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
395
|
-
return v1;
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
400
|
-
*
|
|
401
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
402
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
403
|
-
*/
|
|
404
|
-
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
405
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
406
|
-
const len0 = WASM_VECTOR_LEN;
|
|
407
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
408
|
-
if (ret[2]) {
|
|
409
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
410
|
-
}
|
|
411
|
-
return takeFromExternrefTable0(ret[0]);
|
|
412
|
-
};
|
|
413
|
-
|
|
414
414
|
/**
|
|
415
415
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
416
416
|
* @param {string} lhs
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const buildInfo: () => any;
|
|
5
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
4
9
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
10
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
11
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -8,11 +13,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
8
13
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
14
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
15
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const buildInfo: () => any;
|
|
12
|
-
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
|
-
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
|
-
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
15
|
-
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
16
16
|
export const and: (a: any, b: any) => any;
|
|
17
17
|
export const xor: (a: any, b: any) => any;
|
|
18
18
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
13
|
+
*/
|
|
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;
|
|
3
37
|
/**
|
|
4
38
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
39
|
*
|
|
@@ -58,40 +92,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
58
92
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
59
93
|
*/
|
|
60
94
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
63
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
64
|
-
*/
|
|
65
|
-
export function buildInfo(): BuildInfo;
|
|
66
|
-
/**
|
|
67
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
68
|
-
*
|
|
69
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
70
|
-
* @returns {Uint8Array} A compressed witness map
|
|
71
|
-
*/
|
|
72
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
73
|
-
/**
|
|
74
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
75
|
-
* This should be used to only fetch the witness map for the main function.
|
|
76
|
-
*
|
|
77
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
78
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
79
|
-
*/
|
|
80
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
83
|
-
*
|
|
84
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
85
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
86
|
-
*/
|
|
87
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
88
|
-
/**
|
|
89
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
90
|
-
*
|
|
91
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
92
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
93
|
-
*/
|
|
94
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
95
95
|
/**
|
|
96
96
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
97
|
*/
|
|
@@ -117,6 +117,20 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
117
117
|
*/
|
|
118
118
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
120
134
|
// Map from witness index to hex string value of witness.
|
|
121
135
|
export type WitnessMap = Map<number, string>;
|
|
122
136
|
|
|
@@ -141,34 +155,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
141
155
|
|
|
142
156
|
|
|
143
157
|
|
|
144
|
-
export type RawAssertionPayload = {
|
|
145
|
-
selector: string;
|
|
146
|
-
data: string[];
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export type ExecutionError = Error & {
|
|
150
|
-
callStack?: string[];
|
|
151
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
152
|
-
acirFunctionId?: number;
|
|
153
|
-
brilligFunctionId?: number;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
160
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
161
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
162
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
163
|
-
*/
|
|
164
|
-
export type BuildInfo = {
|
|
165
|
-
gitHash: string;
|
|
166
|
-
version: string;
|
|
167
|
-
dirty: string;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
158
|
export type ForeignCallInput = string[]
|
|
173
159
|
export type ForeignCallOutput = string | string[]
|
|
174
160
|
|
|
@@ -183,10 +169,29 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
183
169
|
|
|
184
170
|
|
|
185
171
|
|
|
172
|
+
export type RawAssertionPayload = {
|
|
173
|
+
selector: string;
|
|
174
|
+
data: string[];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type ExecutionError = Error & {
|
|
178
|
+
callStack?: string[];
|
|
179
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
+
acirFunctionId?: number;
|
|
181
|
+
brilligFunctionId?: number;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
+
readonly buildInfo: () => any;
|
|
191
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
194
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
190
195
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
191
196
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
192
197
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -194,11 +199,6 @@ export interface InitOutput {
|
|
|
194
199
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
200
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
201
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
197
|
-
readonly buildInfo: () => any;
|
|
198
|
-
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
199
|
-
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
200
|
-
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
201
|
-
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
202
202
|
readonly and: (a: any, b: any) => any;
|
|
203
203
|
readonly xor: (a: any, b: any) => any;
|
|
204
204
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
package/web/acvm_js.js
CHANGED
|
@@ -197,6 +197,40 @@ function debugString(val) {
|
|
|
197
197
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
202
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
203
|
+
*/
|
|
204
|
+
export function buildInfo() {
|
|
205
|
+
const ret = wasm.buildInfo();
|
|
206
|
+
return ret;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function takeFromExternrefTable0(idx) {
|
|
210
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
211
|
+
wasm.__externref_table_dealloc(idx);
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
216
|
+
ptr = ptr >>> 0;
|
|
217
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
221
|
+
*
|
|
222
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
223
|
+
* @returns {Uint8Array} A compressed witness map
|
|
224
|
+
*/
|
|
225
|
+
export function compressWitness(witness_map) {
|
|
226
|
+
const ret = wasm.compressWitness(witness_map);
|
|
227
|
+
if (ret[3]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
229
|
+
}
|
|
230
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
231
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
232
|
+
return v1;
|
|
233
|
+
}
|
|
200
234
|
|
|
201
235
|
function passArray8ToWasm0(arg, malloc) {
|
|
202
236
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
@@ -204,6 +238,55 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
204
238
|
WASM_VECTOR_LEN = arg.length;
|
|
205
239
|
return ptr;
|
|
206
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
243
|
+
* This should be used to only fetch the witness map for the main function.
|
|
244
|
+
*
|
|
245
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
246
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
247
|
+
*/
|
|
248
|
+
export function decompressWitness(compressed_witness) {
|
|
249
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
251
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
252
|
+
if (ret[2]) {
|
|
253
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
254
|
+
}
|
|
255
|
+
return takeFromExternrefTable0(ret[0]);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
260
|
+
*
|
|
261
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
262
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
263
|
+
*/
|
|
264
|
+
export function compressWitnessStack(witness_stack) {
|
|
265
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
266
|
+
if (ret[3]) {
|
|
267
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
268
|
+
}
|
|
269
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
270
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
271
|
+
return v1;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
276
|
+
*
|
|
277
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
278
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
279
|
+
*/
|
|
280
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
281
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
282
|
+
const len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
284
|
+
if (ret[2]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
+
}
|
|
287
|
+
return takeFromExternrefTable0(ret[0]);
|
|
288
|
+
}
|
|
289
|
+
|
|
207
290
|
/**
|
|
208
291
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
209
292
|
*
|
|
@@ -250,11 +333,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
250
333
|
return ret;
|
|
251
334
|
}
|
|
252
335
|
|
|
253
|
-
function takeFromExternrefTable0(idx) {
|
|
254
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
255
|
-
wasm.__externref_table_dealloc(idx);
|
|
256
|
-
return value;
|
|
257
|
-
}
|
|
258
336
|
/**
|
|
259
337
|
* Sets the package's logging level.
|
|
260
338
|
*
|
|
@@ -329,84 +407,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
329
407
|
return takeFromExternrefTable0(ret[0]);
|
|
330
408
|
}
|
|
331
409
|
|
|
332
|
-
/**
|
|
333
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
334
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
335
|
-
*/
|
|
336
|
-
export function buildInfo() {
|
|
337
|
-
const ret = wasm.buildInfo();
|
|
338
|
-
return ret;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
342
|
-
ptr = ptr >>> 0;
|
|
343
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
347
|
-
*
|
|
348
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
349
|
-
* @returns {Uint8Array} A compressed witness map
|
|
350
|
-
*/
|
|
351
|
-
export function compressWitness(witness_map) {
|
|
352
|
-
const ret = wasm.compressWitness(witness_map);
|
|
353
|
-
if (ret[3]) {
|
|
354
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
355
|
-
}
|
|
356
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
357
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
358
|
-
return v1;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
363
|
-
* This should be used to only fetch the witness map for the main function.
|
|
364
|
-
*
|
|
365
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
366
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
367
|
-
*/
|
|
368
|
-
export function decompressWitness(compressed_witness) {
|
|
369
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
370
|
-
const len0 = WASM_VECTOR_LEN;
|
|
371
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
372
|
-
if (ret[2]) {
|
|
373
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
374
|
-
}
|
|
375
|
-
return takeFromExternrefTable0(ret[0]);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
380
|
-
*
|
|
381
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
382
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
383
|
-
*/
|
|
384
|
-
export function compressWitnessStack(witness_stack) {
|
|
385
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
386
|
-
if (ret[3]) {
|
|
387
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
388
|
-
}
|
|
389
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
390
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
391
|
-
return v1;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
396
|
-
*
|
|
397
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
398
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
399
|
-
*/
|
|
400
|
-
export function decompressWitnessStack(compressed_witness) {
|
|
401
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
402
|
-
const len0 = WASM_VECTOR_LEN;
|
|
403
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
404
|
-
if (ret[2]) {
|
|
405
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
406
|
-
}
|
|
407
|
-
return takeFromExternrefTable0(ret[0]);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
410
|
/**
|
|
411
411
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
412
412
|
* @param {string} lhs
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const buildInfo: () => any;
|
|
5
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
4
9
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
10
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
11
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -8,11 +13,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
8
13
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
14
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
15
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const buildInfo: () => any;
|
|
12
|
-
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
|
-
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
|
-
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
15
|
-
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
16
16
|
export const and: (a: any, b: any) => any;
|
|
17
17
|
export const xor: (a: any, b: any) => any;
|
|
18
18
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|