@noir-lang/acvm_js 0.47.0-ef44270.nightly → 0.48.0
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 +61 -61
- package/nodejs/acvm_js.js +103 -103
- 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 +64 -64
- package/web/acvm_js.js +100 -100
- 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
|
@@ -7,34 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function initLogLevel(filter: string): void;
|
|
9
9
|
/**
|
|
10
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
|
-
*
|
|
12
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
14
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
15
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
|
-
*/
|
|
17
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
|
-
/**
|
|
19
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
20
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
21
|
-
*
|
|
22
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
24
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
25
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
26
|
-
*/
|
|
27
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
28
|
-
/**
|
|
29
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
30
|
-
*
|
|
31
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
32
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
33
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
34
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
|
-
*/
|
|
36
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
-
/**
|
|
38
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
11
|
*
|
|
40
12
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -68,6 +40,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
68
40
|
*/
|
|
69
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
70
42
|
/**
|
|
43
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
44
|
+
*
|
|
45
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
49
|
+
*/
|
|
50
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
+
*/
|
|
69
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
|
+
/**
|
|
71
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
72
|
* @param {string} lhs
|
|
73
73
|
* @param {string} rhs
|
|
@@ -152,17 +152,14 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
152
152
|
*/
|
|
153
153
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
|
-
export type
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
164
|
-
*/
|
|
165
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
155
|
+
export type RawAssertionPayload = {
|
|
156
|
+
selector: string;
|
|
157
|
+
data: string[];
|
|
158
|
+
};
|
|
159
|
+
export type ExecutionError = Error & {
|
|
160
|
+
callStack?: string[];
|
|
161
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
162
|
+
};
|
|
166
163
|
|
|
167
164
|
|
|
168
165
|
|
|
@@ -175,14 +172,31 @@ export type WitnessStack = Array<StackItem>;
|
|
|
175
172
|
|
|
176
173
|
|
|
177
174
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
/**
|
|
176
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
177
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
178
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
179
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
180
|
+
*/
|
|
181
|
+
export type BuildInfo = {
|
|
182
|
+
gitHash: string;
|
|
183
|
+
version: string;
|
|
184
|
+
dirty: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
export type ForeignCallInput = string[]
|
|
190
|
+
export type ForeignCallOutput = string | string[]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A callback which performs an foreign call and returns the response.
|
|
194
|
+
* @callback ForeignCallHandler
|
|
195
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
196
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
197
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
198
|
+
*/
|
|
199
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
186
200
|
|
|
187
201
|
|
|
188
202
|
|
|
@@ -200,17 +214,3 @@ export type SolvedAndReturnWitness = {
|
|
|
200
214
|
}
|
|
201
215
|
|
|
202
216
|
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,13 +23,26 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
heap_next = heap[idx];
|
|
26
|
+
function isLikeNone(x) {
|
|
27
|
+
return x === undefined || x === null;
|
|
28
|
+
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
let cachedFloat64Memory0 = null;
|
|
31
|
+
|
|
32
|
+
function getFloat64Memory0() {
|
|
33
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
34
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
35
|
+
}
|
|
36
|
+
return cachedFloat64Memory0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let cachedInt32Memory0 = null;
|
|
40
|
+
|
|
41
|
+
function getInt32Memory0() {
|
|
42
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
43
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
44
|
+
}
|
|
45
|
+
return cachedInt32Memory0;
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -50,6 +63,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
50
63
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
51
64
|
}
|
|
52
65
|
|
|
66
|
+
function addHeapObject(obj) {
|
|
67
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
68
|
+
const idx = heap_next;
|
|
69
|
+
heap_next = heap[idx];
|
|
70
|
+
|
|
71
|
+
heap[idx] = obj;
|
|
72
|
+
return idx;
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
let WASM_VECTOR_LEN = 0;
|
|
54
76
|
|
|
55
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -105,28 +127,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
105
127
|
return ptr;
|
|
106
128
|
}
|
|
107
129
|
|
|
108
|
-
function isLikeNone(x) {
|
|
109
|
-
return x === undefined || x === null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
let cachedInt32Memory0 = null;
|
|
113
|
-
|
|
114
|
-
function getInt32Memory0() {
|
|
115
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
116
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
117
|
-
}
|
|
118
|
-
return cachedInt32Memory0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let cachedFloat64Memory0 = null;
|
|
122
|
-
|
|
123
|
-
function getFloat64Memory0() {
|
|
124
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
125
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
126
|
-
}
|
|
127
|
-
return cachedFloat64Memory0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
130
|
function debugString(val) {
|
|
131
131
|
// primitive types
|
|
132
132
|
const type = typeof val;
|
|
@@ -247,52 +247,6 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
247
247
|
WASM_VECTOR_LEN = arg.length;
|
|
248
248
|
return ptr;
|
|
249
249
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
252
|
-
*
|
|
253
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
254
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
255
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
256
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
257
|
-
*/
|
|
258
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
259
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
260
|
-
const len0 = WASM_VECTOR_LEN;
|
|
261
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
262
|
-
return takeObject(ret);
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
267
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
268
|
-
*
|
|
269
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
270
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
271
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
272
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
273
|
-
*/
|
|
274
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
275
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
276
|
-
const len0 = WASM_VECTOR_LEN;
|
|
277
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
278
|
-
return takeObject(ret);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
283
|
-
*
|
|
284
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
285
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
286
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
287
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
288
|
-
*/
|
|
289
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
290
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
291
|
-
const len0 = WASM_VECTOR_LEN;
|
|
292
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
293
|
-
return takeObject(ret);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
250
|
/**
|
|
297
251
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
298
252
|
*
|
|
@@ -377,6 +331,52 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
377
331
|
}
|
|
378
332
|
};
|
|
379
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
336
|
+
*
|
|
337
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
338
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
339
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
340
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
341
|
+
*/
|
|
342
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
343
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
346
|
+
return takeObject(ret);
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
351
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
352
|
+
*
|
|
353
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
354
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
355
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
356
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
357
|
+
*/
|
|
358
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
359
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
362
|
+
return takeObject(ret);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
367
|
+
*
|
|
368
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
369
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
370
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
371
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
372
|
+
*/
|
|
373
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
374
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
375
|
+
const len0 = WASM_VECTOR_LEN;
|
|
376
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
377
|
+
return takeObject(ret);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
380
|
/**
|
|
381
381
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
382
382
|
* @param {string} lhs
|
|
@@ -631,10 +631,6 @@ function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
|
|
|
631
631
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
635
|
-
takeObject(arg0);
|
|
636
|
-
};
|
|
637
|
-
|
|
638
634
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
639
635
|
const obj = takeObject(arg0).original;
|
|
640
636
|
if (obj.cnt-- == 1) {
|
|
@@ -645,32 +641,48 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
645
641
|
return ret;
|
|
646
642
|
};
|
|
647
643
|
|
|
648
|
-
module.exports.
|
|
649
|
-
|
|
650
|
-
return addHeapObject(ret);
|
|
644
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
645
|
+
takeObject(arg0);
|
|
651
646
|
};
|
|
652
647
|
|
|
653
|
-
module.exports.
|
|
654
|
-
const
|
|
648
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
649
|
+
const obj = getObject(arg1);
|
|
650
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
651
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
652
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
module.exports.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
|
|
656
|
+
const ret = new Error(takeObject(arg0));
|
|
655
657
|
return addHeapObject(ret);
|
|
656
658
|
};
|
|
657
659
|
|
|
660
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
661
|
+
const ret = Array.isArray(getObject(arg0));
|
|
662
|
+
return ret;
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
666
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
667
|
+
return ret;
|
|
668
|
+
};
|
|
669
|
+
|
|
658
670
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
659
671
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
660
672
|
return addHeapObject(ret);
|
|
661
673
|
};
|
|
662
674
|
|
|
663
|
-
module.exports.
|
|
664
|
-
const ret = new
|
|
675
|
+
module.exports.__wbg_new_99fb929611321a93 = function() {
|
|
676
|
+
const ret = new Array();
|
|
665
677
|
return addHeapObject(ret);
|
|
666
678
|
};
|
|
667
679
|
|
|
668
|
-
module.exports.
|
|
669
|
-
const ret =
|
|
670
|
-
return ret;
|
|
680
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
681
|
+
const ret = arg0;
|
|
682
|
+
return addHeapObject(ret);
|
|
671
683
|
};
|
|
672
684
|
|
|
673
|
-
module.exports.
|
|
685
|
+
module.exports.__wbg_new_237eb36a3bda602b = function() {
|
|
674
686
|
const ret = new Map();
|
|
675
687
|
return addHeapObject(ret);
|
|
676
688
|
};
|
|
@@ -684,18 +696,6 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
|
684
696
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
685
697
|
};
|
|
686
698
|
|
|
687
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
688
|
-
const obj = getObject(arg1);
|
|
689
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
690
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
691
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
695
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
696
|
-
return ret;
|
|
697
|
-
};
|
|
698
|
-
|
|
699
699
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
700
700
|
const ret = new Error();
|
|
701
701
|
return addHeapObject(ret);
|
|
@@ -914,8 +914,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
914
914
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
-
module.exports.
|
|
918
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
917
|
+
module.exports.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
8
5
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
6
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
7
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
11
|
export function and(a: number, b: number): number;
|
|
12
12
|
export function xor(a: number, b: number): number;
|
|
13
13
|
export function sha256(a: number, b: number, c: number): void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -7,34 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function initLogLevel(filter: string): void;
|
|
9
9
|
/**
|
|
10
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
|
-
*
|
|
12
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
14
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
15
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
|
-
*/
|
|
17
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
|
-
/**
|
|
19
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
20
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
21
|
-
*
|
|
22
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
24
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
25
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
26
|
-
*/
|
|
27
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
28
|
-
/**
|
|
29
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
30
|
-
*
|
|
31
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
32
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
33
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
34
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
|
-
*/
|
|
36
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
-
/**
|
|
38
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
11
|
*
|
|
40
12
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -68,6 +40,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
68
40
|
*/
|
|
69
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
70
42
|
/**
|
|
43
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
44
|
+
*
|
|
45
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
49
|
+
*/
|
|
50
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
+
*/
|
|
69
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
|
+
/**
|
|
71
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
72
|
* @param {string} lhs
|
|
73
73
|
* @param {string} rhs
|
|
@@ -152,17 +152,14 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
152
152
|
*/
|
|
153
153
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
|
-
export type
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
164
|
-
*/
|
|
165
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
155
|
+
export type RawAssertionPayload = {
|
|
156
|
+
selector: string;
|
|
157
|
+
data: string[];
|
|
158
|
+
};
|
|
159
|
+
export type ExecutionError = Error & {
|
|
160
|
+
callStack?: string[];
|
|
161
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
162
|
+
};
|
|
166
163
|
|
|
167
164
|
|
|
168
165
|
|
|
@@ -175,14 +172,31 @@ export type WitnessStack = Array<StackItem>;
|
|
|
175
172
|
|
|
176
173
|
|
|
177
174
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
/**
|
|
176
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
177
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
178
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
179
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
180
|
+
*/
|
|
181
|
+
export type BuildInfo = {
|
|
182
|
+
gitHash: string;
|
|
183
|
+
version: string;
|
|
184
|
+
dirty: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
export type ForeignCallInput = string[]
|
|
190
|
+
export type ForeignCallOutput = string | string[]
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A callback which performs an foreign call and returns the response.
|
|
194
|
+
* @callback ForeignCallHandler
|
|
195
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
196
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
197
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
198
|
+
*/
|
|
199
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
186
200
|
|
|
187
201
|
|
|
188
202
|
|
|
@@ -201,31 +215,17 @@ export type SolvedAndReturnWitness = {
|
|
|
201
215
|
|
|
202
216
|
|
|
203
217
|
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
218
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
219
219
|
|
|
220
220
|
export interface InitOutput {
|
|
221
221
|
readonly memory: WebAssembly.Memory;
|
|
222
222
|
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
223
|
-
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
224
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
225
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
226
223
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
227
224
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
228
225
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
226
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
227
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
228
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
229
229
|
readonly and: (a: number, b: number) => number;
|
|
230
230
|
readonly xor: (a: number, b: number) => number;
|
|
231
231
|
readonly sha256: (a: number, b: number, c: number) => void;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,13 +20,26 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
heap_next = heap[idx];
|
|
23
|
+
function isLikeNone(x) {
|
|
24
|
+
return x === undefined || x === null;
|
|
25
|
+
}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
let cachedFloat64Memory0 = null;
|
|
28
|
+
|
|
29
|
+
function getFloat64Memory0() {
|
|
30
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
31
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
32
|
+
}
|
|
33
|
+
return cachedFloat64Memory0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let cachedInt32Memory0 = null;
|
|
37
|
+
|
|
38
|
+
function getInt32Memory0() {
|
|
39
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
40
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
41
|
+
}
|
|
42
|
+
return cachedInt32Memory0;
|
|
30
43
|
}
|
|
31
44
|
|
|
32
45
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
@@ -47,6 +60,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
47
60
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
48
61
|
}
|
|
49
62
|
|
|
63
|
+
function addHeapObject(obj) {
|
|
64
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
65
|
+
const idx = heap_next;
|
|
66
|
+
heap_next = heap[idx];
|
|
67
|
+
|
|
68
|
+
heap[idx] = obj;
|
|
69
|
+
return idx;
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
let WASM_VECTOR_LEN = 0;
|
|
51
73
|
|
|
52
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -102,28 +124,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
102
124
|
return ptr;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
|
-
function isLikeNone(x) {
|
|
106
|
-
return x === undefined || x === null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
let cachedInt32Memory0 = null;
|
|
110
|
-
|
|
111
|
-
function getInt32Memory0() {
|
|
112
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
113
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
114
|
-
}
|
|
115
|
-
return cachedInt32Memory0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let cachedFloat64Memory0 = null;
|
|
119
|
-
|
|
120
|
-
function getFloat64Memory0() {
|
|
121
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
122
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
123
|
-
}
|
|
124
|
-
return cachedFloat64Memory0;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
127
|
function debugString(val) {
|
|
128
128
|
// primitive types
|
|
129
129
|
const type = typeof val;
|
|
@@ -244,52 +244,6 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
244
244
|
WASM_VECTOR_LEN = arg.length;
|
|
245
245
|
return ptr;
|
|
246
246
|
}
|
|
247
|
-
/**
|
|
248
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
249
|
-
*
|
|
250
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
251
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
252
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
253
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
254
|
-
*/
|
|
255
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
256
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
257
|
-
const len0 = WASM_VECTOR_LEN;
|
|
258
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
259
|
-
return takeObject(ret);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
264
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
265
|
-
*
|
|
266
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
267
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
268
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
269
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
270
|
-
*/
|
|
271
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
272
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
273
|
-
const len0 = WASM_VECTOR_LEN;
|
|
274
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
275
|
-
return takeObject(ret);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
280
|
-
*
|
|
281
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
282
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
283
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
284
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
285
|
-
*/
|
|
286
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
287
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
288
|
-
const len0 = WASM_VECTOR_LEN;
|
|
289
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
290
|
-
return takeObject(ret);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
247
|
/**
|
|
294
248
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
295
249
|
*
|
|
@@ -374,6 +328,52 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
374
328
|
}
|
|
375
329
|
}
|
|
376
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
333
|
+
*
|
|
334
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
335
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
336
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
337
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
338
|
+
*/
|
|
339
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
340
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
341
|
+
const len0 = WASM_VECTOR_LEN;
|
|
342
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
343
|
+
return takeObject(ret);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
348
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
349
|
+
*
|
|
350
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
351
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
352
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
353
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
354
|
+
*/
|
|
355
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
356
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
357
|
+
const len0 = WASM_VECTOR_LEN;
|
|
358
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
359
|
+
return takeObject(ret);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
364
|
+
*
|
|
365
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
366
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
367
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
368
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
369
|
+
*/
|
|
370
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
371
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
372
|
+
const len0 = WASM_VECTOR_LEN;
|
|
373
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
374
|
+
return takeObject(ret);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
377
|
/**
|
|
378
378
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
379
379
|
* @param {string} lhs
|
|
@@ -662,9 +662,6 @@ async function __wbg_load(module, imports) {
|
|
|
662
662
|
function __wbg_get_imports() {
|
|
663
663
|
const imports = {};
|
|
664
664
|
imports.wbg = {};
|
|
665
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
666
|
-
takeObject(arg0);
|
|
667
|
-
};
|
|
668
665
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
669
666
|
const obj = takeObject(arg0).original;
|
|
670
667
|
if (obj.cnt-- == 1) {
|
|
@@ -674,27 +671,40 @@ function __wbg_get_imports() {
|
|
|
674
671
|
const ret = false;
|
|
675
672
|
return ret;
|
|
676
673
|
};
|
|
677
|
-
imports.wbg.
|
|
678
|
-
|
|
679
|
-
return addHeapObject(ret);
|
|
674
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
675
|
+
takeObject(arg0);
|
|
680
676
|
};
|
|
681
|
-
imports.wbg.
|
|
682
|
-
const
|
|
677
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
678
|
+
const obj = getObject(arg1);
|
|
679
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
680
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
681
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
682
|
+
};
|
|
683
|
+
imports.wbg.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
|
|
684
|
+
const ret = new Error(takeObject(arg0));
|
|
683
685
|
return addHeapObject(ret);
|
|
684
686
|
};
|
|
687
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
688
|
+
const ret = Array.isArray(getObject(arg0));
|
|
689
|
+
return ret;
|
|
690
|
+
};
|
|
691
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
692
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
693
|
+
return ret;
|
|
694
|
+
};
|
|
685
695
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
686
696
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
687
697
|
return addHeapObject(ret);
|
|
688
698
|
};
|
|
689
|
-
imports.wbg.
|
|
690
|
-
const ret = new
|
|
699
|
+
imports.wbg.__wbg_new_99fb929611321a93 = function() {
|
|
700
|
+
const ret = new Array();
|
|
691
701
|
return addHeapObject(ret);
|
|
692
702
|
};
|
|
693
|
-
imports.wbg.
|
|
694
|
-
const ret =
|
|
695
|
-
return ret;
|
|
703
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
704
|
+
const ret = arg0;
|
|
705
|
+
return addHeapObject(ret);
|
|
696
706
|
};
|
|
697
|
-
imports.wbg.
|
|
707
|
+
imports.wbg.__wbg_new_237eb36a3bda602b = function() {
|
|
698
708
|
const ret = new Map();
|
|
699
709
|
return addHeapObject(ret);
|
|
700
710
|
};
|
|
@@ -706,16 +716,6 @@ function __wbg_get_imports() {
|
|
|
706
716
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
707
717
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
708
718
|
};
|
|
709
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
710
|
-
const obj = getObject(arg1);
|
|
711
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
712
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
713
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
714
|
-
};
|
|
715
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
716
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
717
|
-
return ret;
|
|
718
|
-
};
|
|
719
719
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
720
720
|
const ret = new Error();
|
|
721
721
|
return addHeapObject(ret);
|
|
@@ -899,8 +899,8 @@ function __wbg_get_imports() {
|
|
|
899
899
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
900
900
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
901
901
|
};
|
|
902
|
-
imports.wbg.
|
|
903
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
902
|
+
imports.wbg.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
|
|
903
|
+
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
904
904
|
return addHeapObject(ret);
|
|
905
905
|
};
|
|
906
906
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
8
5
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
6
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
7
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
11
|
export function and(a: number, b: number): number;
|
|
12
12
|
export function xor(a: number, b: number): number;
|
|
13
13
|
export function sha256(a: number, b: number, c: number): void;
|