@noir-lang/acvm_js 1.0.0-beta.9 → 1.0.0-beta.9-e7fb7f3.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 +48 -48
- package/nodejs/acvm_js.js +74 -73
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +3 -3
- package/package.json +1 -1
- package/web/acvm_js.d.ts +51 -51
- package/web/acvm_js.js +74 -73
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +3 -3
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
5
|
+
*
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
8
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
9
|
+
*/
|
|
10
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
15
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
16
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
17
|
+
*/
|
|
18
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
24
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
25
|
+
*/
|
|
26
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
3
27
|
/**
|
|
4
28
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
29
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -62,30 +86,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
62
86
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
63
87
|
*/
|
|
64
88
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
65
|
-
/**
|
|
66
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
67
|
-
*
|
|
68
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
70
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
71
|
-
*/
|
|
72
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
73
|
-
/**
|
|
74
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
75
|
-
*
|
|
76
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
77
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
78
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
79
|
-
*/
|
|
80
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
83
|
-
*
|
|
84
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
85
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
86
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
87
|
-
*/
|
|
88
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
89
89
|
/**
|
|
90
90
|
* Sets the package's logging level.
|
|
91
91
|
*
|
|
@@ -117,20 +117,6 @@ 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
|
-
|
|
134
120
|
// Map from witness index to hex string value of witness.
|
|
135
121
|
export type WitnessMap = Map<number, string>;
|
|
136
122
|
|
|
@@ -146,17 +132,17 @@ export type SolvedAndReturnWitness = {
|
|
|
146
132
|
|
|
147
133
|
|
|
148
134
|
|
|
149
|
-
export type ForeignCallInput = string[]
|
|
150
|
-
export type ForeignCallOutput = string | string[]
|
|
151
|
-
|
|
152
135
|
/**
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
155
|
-
* @
|
|
156
|
-
* @
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
136
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
137
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
138
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
139
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
140
|
+
*/
|
|
141
|
+
export type BuildInfo = {
|
|
142
|
+
gitHash: string;
|
|
143
|
+
version: string;
|
|
144
|
+
dirty: string;
|
|
145
|
+
}
|
|
160
146
|
|
|
161
147
|
|
|
162
148
|
|
|
@@ -174,6 +160,20 @@ export type ExecutionError = Error & {
|
|
|
174
160
|
|
|
175
161
|
|
|
176
162
|
|
|
163
|
+
export type ForeignCallInput = string[]
|
|
164
|
+
export type ForeignCallOutput = string | string[]
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A callback which performs an foreign call and returns the response.
|
|
168
|
+
* @callback ForeignCallHandler
|
|
169
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
170
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
171
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
172
|
+
*/
|
|
173
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
177
|
export type StackItem = {
|
|
178
178
|
index: number;
|
|
179
179
|
witness: WitnessMap;
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,6 +201,79 @@ 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 passArray8ToWasm0(arg, malloc) {
|
|
206
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
207
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
208
|
+
WASM_VECTOR_LEN = arg.length;
|
|
209
|
+
return ptr;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function takeFromExternrefTable0(idx) {
|
|
213
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
214
|
+
wasm.__externref_table_dealloc(idx);
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
219
|
+
*
|
|
220
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
221
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
222
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
223
|
+
* @param {Uint8Array} program
|
|
224
|
+
* @param {WitnessMap} witness_map
|
|
225
|
+
* @returns {WitnessMap}
|
|
226
|
+
*/
|
|
227
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
228
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
231
|
+
if (ret[2]) {
|
|
232
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
233
|
+
}
|
|
234
|
+
return takeFromExternrefTable0(ret[0]);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
239
|
+
*
|
|
240
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
241
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
242
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
243
|
+
* @param {Uint8Array} program
|
|
244
|
+
* @param {WitnessMap} solved_witness
|
|
245
|
+
* @returns {WitnessMap}
|
|
246
|
+
*/
|
|
247
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
248
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
251
|
+
if (ret[2]) {
|
|
252
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
253
|
+
}
|
|
254
|
+
return takeFromExternrefTable0(ret[0]);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
259
|
+
*
|
|
260
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
261
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
262
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
263
|
+
* @param {Uint8Array} program
|
|
264
|
+
* @param {WitnessMap} solved_witness
|
|
265
|
+
* @returns {WitnessMap}
|
|
266
|
+
*/
|
|
267
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
268
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
271
|
+
if (ret[2]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
273
|
+
}
|
|
274
|
+
return takeFromExternrefTable0(ret[0]);
|
|
275
|
+
};
|
|
276
|
+
|
|
204
277
|
/**
|
|
205
278
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
206
279
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -210,12 +283,6 @@ module.exports.buildInfo = function() {
|
|
|
210
283
|
return ret;
|
|
211
284
|
};
|
|
212
285
|
|
|
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
286
|
function getArrayU8FromWasm0(ptr, len) {
|
|
220
287
|
ptr = ptr >>> 0;
|
|
221
288
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -236,12 +303,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
236
303
|
return v1;
|
|
237
304
|
};
|
|
238
305
|
|
|
239
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
240
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
241
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
242
|
-
WASM_VECTOR_LEN = arg.length;
|
|
243
|
-
return ptr;
|
|
244
|
-
}
|
|
245
306
|
/**
|
|
246
307
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
247
308
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -337,66 +398,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
337
398
|
return ret;
|
|
338
399
|
};
|
|
339
400
|
|
|
340
|
-
/**
|
|
341
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
342
|
-
*
|
|
343
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
344
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
345
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
346
|
-
* @param {Uint8Array} program
|
|
347
|
-
* @param {WitnessMap} witness_map
|
|
348
|
-
* @returns {WitnessMap}
|
|
349
|
-
*/
|
|
350
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
351
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
352
|
-
const len0 = WASM_VECTOR_LEN;
|
|
353
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
354
|
-
if (ret[2]) {
|
|
355
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
356
|
-
}
|
|
357
|
-
return takeFromExternrefTable0(ret[0]);
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
362
|
-
*
|
|
363
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
364
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
365
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
366
|
-
* @param {Uint8Array} program
|
|
367
|
-
* @param {WitnessMap} solved_witness
|
|
368
|
-
* @returns {WitnessMap}
|
|
369
|
-
*/
|
|
370
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
371
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
372
|
-
const len0 = WASM_VECTOR_LEN;
|
|
373
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
374
|
-
if (ret[2]) {
|
|
375
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
376
|
-
}
|
|
377
|
-
return takeFromExternrefTable0(ret[0]);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
382
|
-
*
|
|
383
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
384
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
385
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
386
|
-
* @param {Uint8Array} program
|
|
387
|
-
* @param {WitnessMap} solved_witness
|
|
388
|
-
* @returns {WitnessMap}
|
|
389
|
-
*/
|
|
390
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
391
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
392
|
-
const len0 = WASM_VECTOR_LEN;
|
|
393
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
394
|
-
if (ret[2]) {
|
|
395
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
396
|
-
}
|
|
397
|
-
return takeFromExternrefTable0(ret[0]);
|
|
398
|
-
};
|
|
399
|
-
|
|
400
401
|
/**
|
|
401
402
|
* Sets the package's logging level.
|
|
402
403
|
*
|
|
@@ -813,7 +814,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
814
|
return ret;
|
|
814
815
|
};
|
|
815
816
|
|
|
816
|
-
module.exports.
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper2144 = function(arg0, arg1, arg2) {
|
|
817
818
|
const ret = makeMutClosure(arg0, arg1, 647, __wbg_adapter_30);
|
|
818
819
|
return ret;
|
|
819
820
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
5
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
4
7
|
export const buildInfo: () => any;
|
|
5
8
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
9
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
@@ -9,9 +12,6 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
|
|
|
9
12
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
13
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
14
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
15
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
16
16
|
export const and: (a: any, b: any) => any;
|
|
17
17
|
export const xor: (a: any, b: any) => any;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
5
|
+
*
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
8
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
9
|
+
*/
|
|
10
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
15
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
16
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
17
|
+
*/
|
|
18
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
24
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
25
|
+
*/
|
|
26
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
3
27
|
/**
|
|
4
28
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
29
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -62,30 +86,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
62
86
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
63
87
|
*/
|
|
64
88
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
65
|
-
/**
|
|
66
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
67
|
-
*
|
|
68
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
70
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
71
|
-
*/
|
|
72
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
73
|
-
/**
|
|
74
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
75
|
-
*
|
|
76
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
77
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
78
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
79
|
-
*/
|
|
80
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
83
|
-
*
|
|
84
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
85
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
86
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
87
|
-
*/
|
|
88
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
89
89
|
/**
|
|
90
90
|
* Sets the package's logging level.
|
|
91
91
|
*
|
|
@@ -117,20 +117,6 @@ 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
|
-
|
|
134
120
|
// Map from witness index to hex string value of witness.
|
|
135
121
|
export type WitnessMap = Map<number, string>;
|
|
136
122
|
|
|
@@ -146,17 +132,17 @@ export type SolvedAndReturnWitness = {
|
|
|
146
132
|
|
|
147
133
|
|
|
148
134
|
|
|
149
|
-
export type ForeignCallInput = string[]
|
|
150
|
-
export type ForeignCallOutput = string | string[]
|
|
151
|
-
|
|
152
135
|
/**
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
155
|
-
* @
|
|
156
|
-
* @
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
136
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
137
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
138
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
139
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
140
|
+
*/
|
|
141
|
+
export type BuildInfo = {
|
|
142
|
+
gitHash: string;
|
|
143
|
+
version: string;
|
|
144
|
+
dirty: string;
|
|
145
|
+
}
|
|
160
146
|
|
|
161
147
|
|
|
162
148
|
|
|
@@ -174,6 +160,20 @@ export type ExecutionError = Error & {
|
|
|
174
160
|
|
|
175
161
|
|
|
176
162
|
|
|
163
|
+
export type ForeignCallInput = string[]
|
|
164
|
+
export type ForeignCallOutput = string | string[]
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A callback which performs an foreign call and returns the response.
|
|
168
|
+
* @callback ForeignCallHandler
|
|
169
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
170
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
171
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
172
|
+
*/
|
|
173
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
177
|
export type StackItem = {
|
|
178
178
|
index: number;
|
|
179
179
|
witness: WitnessMap;
|
|
@@ -187,6 +187,9 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
191
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
192
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
190
193
|
readonly buildInfo: () => any;
|
|
191
194
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
195
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
@@ -195,9 +198,6 @@ export interface InitOutput {
|
|
|
195
198
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
196
199
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
197
200
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
198
|
-
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
199
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
201
201
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
202
202
|
readonly and: (a: any, b: any) => any;
|
|
203
203
|
readonly xor: (a: any, b: any) => any;
|
package/web/acvm_js.js
CHANGED
|
@@ -197,6 +197,79 @@ 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 passArray8ToWasm0(arg, malloc) {
|
|
202
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
203
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
204
|
+
WASM_VECTOR_LEN = arg.length;
|
|
205
|
+
return ptr;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function takeFromExternrefTable0(idx) {
|
|
209
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
210
|
+
wasm.__externref_table_dealloc(idx);
|
|
211
|
+
return value;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
215
|
+
*
|
|
216
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
217
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
218
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
219
|
+
* @param {Uint8Array} program
|
|
220
|
+
* @param {WitnessMap} witness_map
|
|
221
|
+
* @returns {WitnessMap}
|
|
222
|
+
*/
|
|
223
|
+
export function getReturnWitness(program, witness_map) {
|
|
224
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
227
|
+
if (ret[2]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
229
|
+
}
|
|
230
|
+
return takeFromExternrefTable0(ret[0]);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
235
|
+
*
|
|
236
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
237
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
238
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
239
|
+
* @param {Uint8Array} program
|
|
240
|
+
* @param {WitnessMap} solved_witness
|
|
241
|
+
* @returns {WitnessMap}
|
|
242
|
+
*/
|
|
243
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
244
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
246
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
247
|
+
if (ret[2]) {
|
|
248
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
249
|
+
}
|
|
250
|
+
return takeFromExternrefTable0(ret[0]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
255
|
+
*
|
|
256
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
257
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
258
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
259
|
+
* @param {Uint8Array} program
|
|
260
|
+
* @param {WitnessMap} solved_witness
|
|
261
|
+
* @returns {WitnessMap}
|
|
262
|
+
*/
|
|
263
|
+
export function getPublicWitness(program, solved_witness) {
|
|
264
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
265
|
+
const len0 = WASM_VECTOR_LEN;
|
|
266
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
267
|
+
if (ret[2]) {
|
|
268
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
269
|
+
}
|
|
270
|
+
return takeFromExternrefTable0(ret[0]);
|
|
271
|
+
}
|
|
272
|
+
|
|
200
273
|
/**
|
|
201
274
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
202
275
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -206,12 +279,6 @@ export function buildInfo() {
|
|
|
206
279
|
return ret;
|
|
207
280
|
}
|
|
208
281
|
|
|
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
282
|
function getArrayU8FromWasm0(ptr, len) {
|
|
216
283
|
ptr = ptr >>> 0;
|
|
217
284
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -232,12 +299,6 @@ export function compressWitness(witness_map) {
|
|
|
232
299
|
return v1;
|
|
233
300
|
}
|
|
234
301
|
|
|
235
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
236
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
237
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
238
|
-
WASM_VECTOR_LEN = arg.length;
|
|
239
|
-
return ptr;
|
|
240
|
-
}
|
|
241
302
|
/**
|
|
242
303
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
243
304
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -333,66 +394,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
333
394
|
return ret;
|
|
334
395
|
}
|
|
335
396
|
|
|
336
|
-
/**
|
|
337
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
338
|
-
*
|
|
339
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
340
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
341
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
342
|
-
* @param {Uint8Array} program
|
|
343
|
-
* @param {WitnessMap} witness_map
|
|
344
|
-
* @returns {WitnessMap}
|
|
345
|
-
*/
|
|
346
|
-
export function getReturnWitness(program, witness_map) {
|
|
347
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
348
|
-
const len0 = WASM_VECTOR_LEN;
|
|
349
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
350
|
-
if (ret[2]) {
|
|
351
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
352
|
-
}
|
|
353
|
-
return takeFromExternrefTable0(ret[0]);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
358
|
-
*
|
|
359
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
360
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
361
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
362
|
-
* @param {Uint8Array} program
|
|
363
|
-
* @param {WitnessMap} solved_witness
|
|
364
|
-
* @returns {WitnessMap}
|
|
365
|
-
*/
|
|
366
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
367
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
368
|
-
const len0 = WASM_VECTOR_LEN;
|
|
369
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
370
|
-
if (ret[2]) {
|
|
371
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
372
|
-
}
|
|
373
|
-
return takeFromExternrefTable0(ret[0]);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
378
|
-
*
|
|
379
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
380
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
381
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
382
|
-
* @param {Uint8Array} program
|
|
383
|
-
* @param {WitnessMap} solved_witness
|
|
384
|
-
* @returns {WitnessMap}
|
|
385
|
-
*/
|
|
386
|
-
export function getPublicWitness(program, solved_witness) {
|
|
387
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
388
|
-
const len0 = WASM_VECTOR_LEN;
|
|
389
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
390
|
-
if (ret[2]) {
|
|
391
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
392
|
-
}
|
|
393
|
-
return takeFromExternrefTable0(ret[0]);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
397
|
/**
|
|
397
398
|
* Sets the package's logging level.
|
|
398
399
|
*
|
|
@@ -797,7 +798,7 @@ function __wbg_get_imports() {
|
|
|
797
798
|
const ret = false;
|
|
798
799
|
return ret;
|
|
799
800
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper2144 = function(arg0, arg1, arg2) {
|
|
801
802
|
const ret = makeMutClosure(arg0, arg1, 647, __wbg_adapter_30);
|
|
802
803
|
return ret;
|
|
803
804
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
5
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
4
7
|
export const buildInfo: () => any;
|
|
5
8
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
9
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
@@ -9,9 +12,6 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
|
|
|
9
12
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
13
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
14
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
15
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
16
16
|
export const and: (a: any, b: any) => any;
|
|
17
17
|
export const xor: (a: any, b: any) => any;
|