@noir-lang/acvm_js 1.0.0-beta.18 → 1.0.0-beta.18-e51d969.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 +68 -68
- package/nodejs/acvm_js.js +92 -91
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -9
- package/package.json +1 -1
- package/web/acvm_js.d.ts +77 -77
- package/web/acvm_js.js +92 -91
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -9
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Sets the package's logging level.
|
|
5
|
+
*
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
6
7
|
*/
|
|
7
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
8
9
|
/**
|
|
9
10
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
11
|
*
|
|
@@ -57,6 +58,30 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
57
58
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
58
59
|
*/
|
|
59
60
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
+
/**
|
|
62
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
63
|
+
*/
|
|
64
|
+
export function and(lhs: string, rhs: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
67
|
+
*/
|
|
68
|
+
export function xor(lhs: string, rhs: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Sha256 compression function
|
|
71
|
+
*/
|
|
72
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
73
|
+
/**
|
|
74
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
75
|
+
*/
|
|
76
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
77
|
+
/**
|
|
78
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
79
|
+
*/
|
|
80
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
83
|
+
*/
|
|
84
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
60
85
|
/**
|
|
61
86
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
62
87
|
*
|
|
@@ -87,56 +112,36 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
87
112
|
*/
|
|
88
113
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
89
114
|
/**
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
export function and(lhs: string, rhs: string): string;
|
|
93
|
-
/**
|
|
94
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
95
|
-
*/
|
|
96
|
-
export function xor(lhs: string, rhs: string): string;
|
|
97
|
-
/**
|
|
98
|
-
* Sha256 compression function
|
|
99
|
-
*/
|
|
100
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
101
|
-
/**
|
|
102
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
103
|
-
*/
|
|
104
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
105
|
-
/**
|
|
106
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
107
|
-
*/
|
|
108
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
111
|
-
*/
|
|
112
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Sets the package's logging level.
|
|
115
|
-
*
|
|
116
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
115
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
116
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function buildInfo(): BuildInfo;
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
}
|
|
120
|
+
export type RawAssertionPayload = {
|
|
121
|
+
selector: string;
|
|
122
|
+
data: string[];
|
|
123
|
+
};
|
|
131
124
|
|
|
125
|
+
export type ExecutionError = Error & {
|
|
126
|
+
callStack?: string[];
|
|
127
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
+
acirFunctionId?: number;
|
|
129
|
+
brilligFunctionId?: number;
|
|
130
|
+
};
|
|
132
131
|
|
|
133
132
|
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
133
|
|
|
139
|
-
export type
|
|
134
|
+
export type ForeignCallInput = string[]
|
|
135
|
+
export type ForeignCallOutput = string | string[]
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A callback which performs an foreign call and returns the response.
|
|
139
|
+
* @callback ForeignCallHandler
|
|
140
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
141
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
142
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
143
|
+
*/
|
|
144
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
140
145
|
|
|
141
146
|
|
|
142
147
|
|
|
@@ -155,30 +160,25 @@ export type SolvedAndReturnWitness = {
|
|
|
155
160
|
|
|
156
161
|
|
|
157
162
|
|
|
158
|
-
export type
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* A callback which performs an foreign call and returns the response.
|
|
163
|
-
* @callback ForeignCallHandler
|
|
164
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
165
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
166
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
167
|
-
*/
|
|
168
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
|
+
export type StackItem = {
|
|
164
|
+
index: number;
|
|
165
|
+
witness: WitnessMap;
|
|
166
|
+
}
|
|
169
167
|
|
|
168
|
+
export type WitnessStack = Array<StackItem>;
|
|
170
169
|
|
|
171
170
|
|
|
172
|
-
export type RawAssertionPayload = {
|
|
173
|
-
selector: string;
|
|
174
|
-
data: string[];
|
|
175
|
-
};
|
|
176
171
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
/**
|
|
173
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
175
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
176
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
177
|
+
*/
|
|
178
|
+
export type BuildInfo = {
|
|
179
|
+
gitHash: string;
|
|
180
|
+
version: string;
|
|
181
|
+
dirty: string;
|
|
182
|
+
}
|
|
183
183
|
|
|
184
184
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,13 +201,24 @@ 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
|
+
function takeFromExternrefTable0(idx) {
|
|
206
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
207
|
+
wasm.__externref_table_dealloc(idx);
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
204
210
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
211
|
+
* Sets the package's logging level.
|
|
212
|
+
*
|
|
213
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
207
214
|
*/
|
|
208
|
-
module.exports.
|
|
209
|
-
const
|
|
210
|
-
|
|
215
|
+
module.exports.initLogLevel = function(filter) {
|
|
216
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
218
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
219
|
+
if (ret[1]) {
|
|
220
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
221
|
+
}
|
|
211
222
|
};
|
|
212
223
|
|
|
213
224
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -262,11 +273,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
262
273
|
return ret;
|
|
263
274
|
};
|
|
264
275
|
|
|
265
|
-
function takeFromExternrefTable0(idx) {
|
|
266
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
267
|
-
wasm.__externref_table_dealloc(idx);
|
|
268
|
-
return value;
|
|
269
|
-
}
|
|
270
276
|
/**
|
|
271
277
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
272
278
|
*
|
|
@@ -327,75 +333,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
327
333
|
return takeFromExternrefTable0(ret[0]);
|
|
328
334
|
};
|
|
329
335
|
|
|
330
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
331
|
-
ptr = ptr >>> 0;
|
|
332
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
336
|
-
*
|
|
337
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
338
|
-
* @returns {Uint8Array} A compressed witness map
|
|
339
|
-
*/
|
|
340
|
-
module.exports.compressWitness = function(witness_map) {
|
|
341
|
-
const ret = wasm.compressWitness(witness_map);
|
|
342
|
-
if (ret[3]) {
|
|
343
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
344
|
-
}
|
|
345
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
346
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
347
|
-
return v1;
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
352
|
-
* This should be used to only fetch the witness map for the main function.
|
|
353
|
-
*
|
|
354
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
355
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
356
|
-
*/
|
|
357
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
358
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
359
|
-
const len0 = WASM_VECTOR_LEN;
|
|
360
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
361
|
-
if (ret[2]) {
|
|
362
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
363
|
-
}
|
|
364
|
-
return takeFromExternrefTable0(ret[0]);
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
369
|
-
*
|
|
370
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
371
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
372
|
-
*/
|
|
373
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
374
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
375
|
-
if (ret[3]) {
|
|
376
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
377
|
-
}
|
|
378
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
379
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
380
|
-
return v1;
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
385
|
-
*
|
|
386
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
387
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
388
|
-
*/
|
|
389
|
-
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
390
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
391
|
-
const len0 = WASM_VECTOR_LEN;
|
|
392
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
393
|
-
if (ret[2]) {
|
|
394
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
395
|
-
}
|
|
396
|
-
return takeFromExternrefTable0(ret[0]);
|
|
397
|
-
};
|
|
398
|
-
|
|
399
336
|
/**
|
|
400
337
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
401
338
|
* @param {string} lhs
|
|
@@ -455,6 +392,10 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
455
392
|
return v3;
|
|
456
393
|
};
|
|
457
394
|
|
|
395
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
396
|
+
ptr = ptr >>> 0;
|
|
397
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
398
|
+
}
|
|
458
399
|
/**
|
|
459
400
|
* Calculates the Blake2s256 hash of the input bytes
|
|
460
401
|
* @param {Uint8Array} inputs
|
|
@@ -512,29 +453,89 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
512
453
|
};
|
|
513
454
|
|
|
514
455
|
/**
|
|
515
|
-
*
|
|
456
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
516
457
|
*
|
|
517
|
-
* @param {
|
|
458
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
459
|
+
* @returns {Uint8Array} A compressed witness map
|
|
518
460
|
*/
|
|
519
|
-
module.exports.
|
|
520
|
-
const
|
|
461
|
+
module.exports.compressWitness = function(witness_map) {
|
|
462
|
+
const ret = wasm.compressWitness(witness_map);
|
|
463
|
+
if (ret[3]) {
|
|
464
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
465
|
+
}
|
|
466
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
467
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
468
|
+
return v1;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
473
|
+
* This should be used to only fetch the witness map for the main function.
|
|
474
|
+
*
|
|
475
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
476
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
477
|
+
*/
|
|
478
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
479
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
521
480
|
const len0 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.
|
|
523
|
-
if (ret[
|
|
524
|
-
throw takeFromExternrefTable0(ret[
|
|
481
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
482
|
+
if (ret[2]) {
|
|
483
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
484
|
+
}
|
|
485
|
+
return takeFromExternrefTable0(ret[0]);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
490
|
+
*
|
|
491
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
492
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
493
|
+
*/
|
|
494
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
495
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
496
|
+
if (ret[3]) {
|
|
497
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
525
498
|
}
|
|
499
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
500
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
501
|
+
return v1;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
506
|
+
*
|
|
507
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
508
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
509
|
+
*/
|
|
510
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
511
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
512
|
+
const len0 = WASM_VECTOR_LEN;
|
|
513
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
514
|
+
if (ret[2]) {
|
|
515
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
516
|
+
}
|
|
517
|
+
return takeFromExternrefTable0(ret[0]);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
522
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
523
|
+
*/
|
|
524
|
+
module.exports.buildInfo = function() {
|
|
525
|
+
const ret = wasm.buildInfo();
|
|
526
|
+
return ret;
|
|
526
527
|
};
|
|
527
528
|
|
|
528
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
529
|
-
wasm.
|
|
530
|
+
wasm.closure490_externref_shim(arg0, arg1, arg2);
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
533
|
-
wasm.
|
|
534
|
+
wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
537
|
-
wasm.
|
|
538
|
+
wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
|
|
538
539
|
}
|
|
539
540
|
|
|
540
541
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -812,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
812
813
|
return ret;
|
|
813
814
|
};
|
|
814
815
|
|
|
815
|
-
module.exports.
|
|
816
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
|
|
817
818
|
return ret;
|
|
818
819
|
};
|
|
819
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
5
5
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
6
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
7
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
8
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
9
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
10
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const compressWitness: (a: any) => [number, number, number, number];
|
|
12
|
-
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
13
|
-
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
14
|
-
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
15
11
|
export const and: (a: any, b: any) => any;
|
|
16
12
|
export const xor: (a: any, b: any) => any;
|
|
17
13
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
18
14
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
19
15
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
20
16
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
-
export const
|
|
17
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
18
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
19
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
20
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
21
|
+
export const buildInfo: () => any;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure490_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Sets the package's logging level.
|
|
5
|
+
*
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
6
7
|
*/
|
|
7
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
8
9
|
/**
|
|
9
10
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
11
|
*
|
|
@@ -57,6 +58,30 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
57
58
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
58
59
|
*/
|
|
59
60
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
|
+
/**
|
|
62
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
63
|
+
*/
|
|
64
|
+
export function and(lhs: string, rhs: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
67
|
+
*/
|
|
68
|
+
export function xor(lhs: string, rhs: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Sha256 compression function
|
|
71
|
+
*/
|
|
72
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
73
|
+
/**
|
|
74
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
75
|
+
*/
|
|
76
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
77
|
+
/**
|
|
78
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
79
|
+
*/
|
|
80
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
83
|
+
*/
|
|
84
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
60
85
|
/**
|
|
61
86
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
62
87
|
*
|
|
@@ -87,56 +112,36 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
87
112
|
*/
|
|
88
113
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
89
114
|
/**
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
export function and(lhs: string, rhs: string): string;
|
|
93
|
-
/**
|
|
94
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
95
|
-
*/
|
|
96
|
-
export function xor(lhs: string, rhs: string): string;
|
|
97
|
-
/**
|
|
98
|
-
* Sha256 compression function
|
|
99
|
-
*/
|
|
100
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
101
|
-
/**
|
|
102
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
103
|
-
*/
|
|
104
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
105
|
-
/**
|
|
106
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
107
|
-
*/
|
|
108
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
111
|
-
*/
|
|
112
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Sets the package's logging level.
|
|
115
|
-
*
|
|
116
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
115
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
116
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function buildInfo(): BuildInfo;
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
}
|
|
120
|
+
export type RawAssertionPayload = {
|
|
121
|
+
selector: string;
|
|
122
|
+
data: string[];
|
|
123
|
+
};
|
|
131
124
|
|
|
125
|
+
export type ExecutionError = Error & {
|
|
126
|
+
callStack?: string[];
|
|
127
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
+
acirFunctionId?: number;
|
|
129
|
+
brilligFunctionId?: number;
|
|
130
|
+
};
|
|
132
131
|
|
|
133
132
|
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
133
|
|
|
139
|
-
export type
|
|
134
|
+
export type ForeignCallInput = string[]
|
|
135
|
+
export type ForeignCallOutput = string | string[]
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A callback which performs an foreign call and returns the response.
|
|
139
|
+
* @callback ForeignCallHandler
|
|
140
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
141
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
142
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
143
|
+
*/
|
|
144
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
140
145
|
|
|
141
146
|
|
|
142
147
|
|
|
@@ -155,31 +160,26 @@ export type SolvedAndReturnWitness = {
|
|
|
155
160
|
|
|
156
161
|
|
|
157
162
|
|
|
158
|
-
export type
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* A callback which performs an foreign call and returns the response.
|
|
163
|
-
* @callback ForeignCallHandler
|
|
164
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
165
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
166
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
167
|
-
*/
|
|
168
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
|
+
export type StackItem = {
|
|
164
|
+
index: number;
|
|
165
|
+
witness: WitnessMap;
|
|
166
|
+
}
|
|
169
167
|
|
|
168
|
+
export type WitnessStack = Array<StackItem>;
|
|
170
169
|
|
|
171
170
|
|
|
172
|
-
export type RawAssertionPayload = {
|
|
173
|
-
selector: string;
|
|
174
|
-
data: string[];
|
|
175
|
-
};
|
|
176
171
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
/**
|
|
173
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
175
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
176
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
177
|
+
*/
|
|
178
|
+
export type BuildInfo = {
|
|
179
|
+
gitHash: string;
|
|
180
|
+
version: string;
|
|
181
|
+
dirty: string;
|
|
182
|
+
}
|
|
183
183
|
|
|
184
184
|
|
|
185
185
|
|
|
@@ -187,24 +187,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
-
readonly
|
|
190
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
191
191
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
192
192
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
193
193
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
194
194
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
195
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
196
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
197
|
-
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
198
|
-
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
199
|
-
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
200
|
-
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
201
197
|
readonly and: (a: any, b: any) => any;
|
|
202
198
|
readonly xor: (a: any, b: any) => any;
|
|
203
199
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
204
200
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
205
201
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
206
202
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
207
|
-
readonly
|
|
203
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
204
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
205
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
206
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
207
|
+
readonly buildInfo: () => any;
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,9 +213,9 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
214
214
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
215
215
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure490_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
219
219
|
readonly __wbindgen_start: () => void;
|
|
220
220
|
}
|
|
221
221
|
|
package/web/acvm_js.js
CHANGED
|
@@ -197,13 +197,24 @@ 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
|
+
function takeFromExternrefTable0(idx) {
|
|
202
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
203
|
+
wasm.__externref_table_dealloc(idx);
|
|
204
|
+
return value;
|
|
205
|
+
}
|
|
200
206
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
207
|
+
* Sets the package's logging level.
|
|
208
|
+
*
|
|
209
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
203
210
|
*/
|
|
204
|
-
export function
|
|
205
|
-
const
|
|
206
|
-
|
|
211
|
+
export function initLogLevel(filter) {
|
|
212
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
213
|
+
const len0 = WASM_VECTOR_LEN;
|
|
214
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
215
|
+
if (ret[1]) {
|
|
216
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
217
|
+
}
|
|
207
218
|
}
|
|
208
219
|
|
|
209
220
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -258,11 +269,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
258
269
|
return ret;
|
|
259
270
|
}
|
|
260
271
|
|
|
261
|
-
function takeFromExternrefTable0(idx) {
|
|
262
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
263
|
-
wasm.__externref_table_dealloc(idx);
|
|
264
|
-
return value;
|
|
265
|
-
}
|
|
266
272
|
/**
|
|
267
273
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
268
274
|
*
|
|
@@ -323,75 +329,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
323
329
|
return takeFromExternrefTable0(ret[0]);
|
|
324
330
|
}
|
|
325
331
|
|
|
326
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
327
|
-
ptr = ptr >>> 0;
|
|
328
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
332
|
-
*
|
|
333
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
334
|
-
* @returns {Uint8Array} A compressed witness map
|
|
335
|
-
*/
|
|
336
|
-
export function compressWitness(witness_map) {
|
|
337
|
-
const ret = wasm.compressWitness(witness_map);
|
|
338
|
-
if (ret[3]) {
|
|
339
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
340
|
-
}
|
|
341
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
342
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
343
|
-
return v1;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
348
|
-
* This should be used to only fetch the witness map for the main function.
|
|
349
|
-
*
|
|
350
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
351
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
352
|
-
*/
|
|
353
|
-
export function decompressWitness(compressed_witness) {
|
|
354
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
355
|
-
const len0 = WASM_VECTOR_LEN;
|
|
356
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
357
|
-
if (ret[2]) {
|
|
358
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
359
|
-
}
|
|
360
|
-
return takeFromExternrefTable0(ret[0]);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
365
|
-
*
|
|
366
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
367
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
368
|
-
*/
|
|
369
|
-
export function compressWitnessStack(witness_stack) {
|
|
370
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
371
|
-
if (ret[3]) {
|
|
372
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
373
|
-
}
|
|
374
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
375
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
376
|
-
return v1;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
381
|
-
*
|
|
382
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
383
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
384
|
-
*/
|
|
385
|
-
export function decompressWitnessStack(compressed_witness) {
|
|
386
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
387
|
-
const len0 = WASM_VECTOR_LEN;
|
|
388
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
389
|
-
if (ret[2]) {
|
|
390
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
391
|
-
}
|
|
392
|
-
return takeFromExternrefTable0(ret[0]);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
332
|
/**
|
|
396
333
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
397
334
|
* @param {string} lhs
|
|
@@ -451,6 +388,10 @@ export function sha256_compression(inputs, state) {
|
|
|
451
388
|
return v3;
|
|
452
389
|
}
|
|
453
390
|
|
|
391
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
392
|
+
ptr = ptr >>> 0;
|
|
393
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
394
|
+
}
|
|
454
395
|
/**
|
|
455
396
|
* Calculates the Blake2s256 hash of the input bytes
|
|
456
397
|
* @param {Uint8Array} inputs
|
|
@@ -508,29 +449,89 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
508
449
|
}
|
|
509
450
|
|
|
510
451
|
/**
|
|
511
|
-
*
|
|
452
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
512
453
|
*
|
|
513
|
-
* @param {
|
|
454
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
455
|
+
* @returns {Uint8Array} A compressed witness map
|
|
514
456
|
*/
|
|
515
|
-
export function
|
|
516
|
-
const
|
|
457
|
+
export function compressWitness(witness_map) {
|
|
458
|
+
const ret = wasm.compressWitness(witness_map);
|
|
459
|
+
if (ret[3]) {
|
|
460
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
461
|
+
}
|
|
462
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
463
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
464
|
+
return v1;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
469
|
+
* This should be used to only fetch the witness map for the main function.
|
|
470
|
+
*
|
|
471
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
472
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
473
|
+
*/
|
|
474
|
+
export function decompressWitness(compressed_witness) {
|
|
475
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
517
476
|
const len0 = WASM_VECTOR_LEN;
|
|
518
|
-
const ret = wasm.
|
|
519
|
-
if (ret[
|
|
520
|
-
throw takeFromExternrefTable0(ret[
|
|
477
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
478
|
+
if (ret[2]) {
|
|
479
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
480
|
+
}
|
|
481
|
+
return takeFromExternrefTable0(ret[0]);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
486
|
+
*
|
|
487
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
488
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
489
|
+
*/
|
|
490
|
+
export function compressWitnessStack(witness_stack) {
|
|
491
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
492
|
+
if (ret[3]) {
|
|
493
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
521
494
|
}
|
|
495
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
496
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
497
|
+
return v1;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
502
|
+
*
|
|
503
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
504
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
505
|
+
*/
|
|
506
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
507
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
508
|
+
const len0 = WASM_VECTOR_LEN;
|
|
509
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
510
|
+
if (ret[2]) {
|
|
511
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
512
|
+
}
|
|
513
|
+
return takeFromExternrefTable0(ret[0]);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
518
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
519
|
+
*/
|
|
520
|
+
export function buildInfo() {
|
|
521
|
+
const ret = wasm.buildInfo();
|
|
522
|
+
return ret;
|
|
522
523
|
}
|
|
523
524
|
|
|
524
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
525
|
-
wasm.
|
|
526
|
+
wasm.closure490_externref_shim(arg0, arg1, arg2);
|
|
526
527
|
}
|
|
527
528
|
|
|
528
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
529
|
-
wasm.
|
|
530
|
+
wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
533
|
-
wasm.
|
|
534
|
+
wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
|
|
534
535
|
}
|
|
535
536
|
|
|
536
537
|
async function __wbg_load(module, imports) {
|
|
@@ -796,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
796
797
|
const ret = false;
|
|
797
798
|
return ret;
|
|
798
799
|
};
|
|
799
|
-
imports.wbg.
|
|
800
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
|
|
801
802
|
return ret;
|
|
802
803
|
};
|
|
803
804
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
5
5
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
6
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
7
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
8
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
9
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
10
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const compressWitness: (a: any) => [number, number, number, number];
|
|
12
|
-
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
13
|
-
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
14
|
-
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
15
11
|
export const and: (a: any, b: any) => any;
|
|
16
12
|
export const xor: (a: any, b: any) => any;
|
|
17
13
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
18
14
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
19
15
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
20
16
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
-
export const
|
|
17
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
18
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
19
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
20
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
21
|
+
export const buildInfo: () => any;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure490_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|