@noir-lang/acvm_js 0.52.0 → 0.53.0-b8654f7.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 +58 -58
- package/nodejs/acvm_js.js +115 -115
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
- package/web/acvm_js.d.ts +63 -63
- package/web/acvm_js.js +112 -112
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +5 -5
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,38 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @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.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
4
|
+
* Sets the package's logging level.
|
|
24
5
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
33
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
34
7
|
*/
|
|
35
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
36
9
|
/**
|
|
37
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
38
11
|
*
|
|
@@ -112,6 +85,11 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
112
85
|
*/
|
|
113
86
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
114
87
|
/**
|
|
88
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
89
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
90
|
+
*/
|
|
91
|
+
export function buildInfo(): BuildInfo;
|
|
92
|
+
/**
|
|
115
93
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
116
94
|
*
|
|
117
95
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -141,39 +119,33 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
141
119
|
*/
|
|
142
120
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
143
121
|
/**
|
|
144
|
-
*
|
|
122
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
145
123
|
*
|
|
146
|
-
* @param {
|
|
124
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
125
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
126
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
127
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
147
128
|
*/
|
|
148
|
-
export function
|
|
149
|
-
|
|
150
|
-
export type ForeignCallInput = string[]
|
|
151
|
-
export type ForeignCallOutput = string | string[]
|
|
152
|
-
|
|
129
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
153
130
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @param {
|
|
158
|
-
* @
|
|
131
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
132
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
133
|
+
*
|
|
134
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
135
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
136
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
137
|
+
* @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.
|
|
159
138
|
*/
|
|
160
|
-
export
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
164
140
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* @
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
dirty: string;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
141
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
142
|
+
*
|
|
143
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
144
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
145
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
146
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
147
|
+
*/
|
|
148
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
177
149
|
|
|
178
150
|
export type RawAssertionPayload = {
|
|
179
151
|
selector: string;
|
|
@@ -197,6 +169,34 @@ export type WitnessStack = Array<StackItem>;
|
|
|
197
169
|
|
|
198
170
|
|
|
199
171
|
|
|
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
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
export type ForeignCallInput = string[]
|
|
187
|
+
export type ForeignCallOutput = string | string[]
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* A callback which performs an foreign call and returns the response.
|
|
191
|
+
* @callback ForeignCallHandler
|
|
192
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
193
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
194
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
195
|
+
*/
|
|
196
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
200
|
// Map from witness index to hex string value of witness.
|
|
201
201
|
export type WitnessMap = Map<number, string>;
|
|
202
202
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,28 +23,6 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function isLikeNone(x) {
|
|
27
|
-
return x === undefined || x === null;
|
|
28
|
-
}
|
|
29
|
-
|
|
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;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
26
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
49
27
|
|
|
50
28
|
cachedTextDecoder.decode();
|
|
@@ -72,6 +50,28 @@ function addHeapObject(obj) {
|
|
|
72
50
|
return idx;
|
|
73
51
|
}
|
|
74
52
|
|
|
53
|
+
function isLikeNone(x) {
|
|
54
|
+
return x === undefined || x === null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let cachedFloat64Memory0 = null;
|
|
58
|
+
|
|
59
|
+
function getFloat64Memory0() {
|
|
60
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
61
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
62
|
+
}
|
|
63
|
+
return cachedFloat64Memory0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let cachedInt32Memory0 = null;
|
|
67
|
+
|
|
68
|
+
function getInt32Memory0() {
|
|
69
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
70
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
71
|
+
}
|
|
72
|
+
return cachedInt32Memory0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
let WASM_VECTOR_LEN = 0;
|
|
76
76
|
|
|
77
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -220,67 +220,33 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Sets the package's logging level.
|
|
225
|
+
*
|
|
226
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
227
|
+
*/
|
|
228
|
+
module.exports.initLogLevel = function(filter) {
|
|
229
|
+
try {
|
|
230
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
233
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
234
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
+
if (r1) {
|
|
237
|
+
throw takeObject(r0);
|
|
238
|
+
}
|
|
239
|
+
} finally {
|
|
240
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
223
244
|
function passArray8ToWasm0(arg, malloc) {
|
|
224
245
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
225
246
|
getUint8Memory0().set(arg, ptr / 1);
|
|
226
247
|
WASM_VECTOR_LEN = arg.length;
|
|
227
248
|
return ptr;
|
|
228
249
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
231
|
-
*
|
|
232
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
233
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
234
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
235
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
236
|
-
*/
|
|
237
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
238
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
239
|
-
const len0 = WASM_VECTOR_LEN;
|
|
240
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
241
|
-
return takeObject(ret);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
246
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
247
|
-
*
|
|
248
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
249
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
250
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
251
|
-
* @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.
|
|
252
|
-
*/
|
|
253
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
254
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
255
|
-
const len0 = WASM_VECTOR_LEN;
|
|
256
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
257
|
-
return takeObject(ret);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
262
|
-
*
|
|
263
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
264
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
265
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
266
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
267
|
-
*/
|
|
268
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
269
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
270
|
-
const len0 = WASM_VECTOR_LEN;
|
|
271
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
272
|
-
return takeObject(ret);
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
277
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
278
|
-
*/
|
|
279
|
-
module.exports.buildInfo = function() {
|
|
280
|
-
const ret = wasm.buildInfo();
|
|
281
|
-
return takeObject(ret);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
250
|
/**
|
|
285
251
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
286
252
|
*
|
|
@@ -498,6 +464,15 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
498
464
|
return ret !== 0;
|
|
499
465
|
};
|
|
500
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
469
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
470
|
+
*/
|
|
471
|
+
module.exports.buildInfo = function() {
|
|
472
|
+
const ret = wasm.buildInfo();
|
|
473
|
+
return takeObject(ret);
|
|
474
|
+
};
|
|
475
|
+
|
|
501
476
|
/**
|
|
502
477
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
503
478
|
*
|
|
@@ -598,24 +573,49 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
598
573
|
};
|
|
599
574
|
|
|
600
575
|
/**
|
|
601
|
-
*
|
|
576
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
602
577
|
*
|
|
603
|
-
* @param {
|
|
578
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
579
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
580
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
581
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
604
582
|
*/
|
|
605
|
-
module.exports.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
583
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
584
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
585
|
+
const len0 = WASM_VECTOR_LEN;
|
|
586
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
587
|
+
return takeObject(ret);
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
592
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
593
|
+
*
|
|
594
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
595
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
596
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
597
|
+
* @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.
|
|
598
|
+
*/
|
|
599
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
600
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
601
|
+
const len0 = WASM_VECTOR_LEN;
|
|
602
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
603
|
+
return takeObject(ret);
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
608
|
+
*
|
|
609
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
610
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
611
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
612
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
613
|
+
*/
|
|
614
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
615
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
616
|
+
const len0 = WASM_VECTOR_LEN;
|
|
617
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
618
|
+
return takeObject(ret);
|
|
619
619
|
};
|
|
620
620
|
|
|
621
621
|
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
@@ -637,23 +637,6 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
637
637
|
takeObject(arg0);
|
|
638
638
|
};
|
|
639
639
|
|
|
640
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
641
|
-
const ret = Array.isArray(getObject(arg0));
|
|
642
|
-
return ret;
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
646
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
647
|
-
return ret;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
651
|
-
const obj = getObject(arg1);
|
|
652
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
653
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
654
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
655
|
-
};
|
|
656
|
-
|
|
657
640
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
658
641
|
const obj = takeObject(arg0).original;
|
|
659
642
|
if (obj.cnt-- == 1) {
|
|
@@ -664,7 +647,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
664
647
|
return ret;
|
|
665
648
|
};
|
|
666
649
|
|
|
667
|
-
module.exports.
|
|
650
|
+
module.exports.__wbg_constructor_01cf62506201187d = function(arg0) {
|
|
668
651
|
const ret = new Error(takeObject(arg0));
|
|
669
652
|
return addHeapObject(ret);
|
|
670
653
|
};
|
|
@@ -674,7 +657,7 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
674
657
|
return addHeapObject(ret);
|
|
675
658
|
};
|
|
676
659
|
|
|
677
|
-
module.exports.
|
|
660
|
+
module.exports.__wbg_new_0d58cd3f85c51a07 = function() {
|
|
678
661
|
const ret = new Array();
|
|
679
662
|
return addHeapObject(ret);
|
|
680
663
|
};
|
|
@@ -684,7 +667,24 @@ module.exports.__wbindgen_number_new = function(arg0) {
|
|
|
684
667
|
return addHeapObject(ret);
|
|
685
668
|
};
|
|
686
669
|
|
|
687
|
-
module.exports.
|
|
670
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
671
|
+
const obj = getObject(arg1);
|
|
672
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
673
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
674
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
678
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
679
|
+
return ret;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
683
|
+
const ret = Array.isArray(getObject(arg0));
|
|
684
|
+
return ret;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
module.exports.__wbg_new_ced18ca7e58573af = function() {
|
|
688
688
|
const ret = new Map();
|
|
689
689
|
return addHeapObject(ret);
|
|
690
690
|
};
|
|
@@ -916,8 +916,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
916
916
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
917
917
|
};
|
|
918
918
|
|
|
919
|
-
module.exports.
|
|
920
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
919
|
+
module.exports.__wbindgen_closure_wrapper736 = function(arg0, arg1, arg2) {
|
|
920
|
+
const ret = makeMutClosure(arg0, arg1, 269, __wbg_adapter_22);
|
|
921
921
|
return addHeapObject(ret);
|
|
922
922
|
};
|
|
923
923
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function buildInfo(): number;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
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;
|
|
@@ -14,11 +11,14 @@ export function sha256_compression(a: number, b: number, c: number, d: number, e
|
|
|
14
11
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
15
12
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
16
13
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
14
|
+
export function buildInfo(): number;
|
|
17
15
|
export function compressWitness(a: number, b: number): void;
|
|
18
16
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
19
17
|
export function compressWitnessStack(a: number, b: number): void;
|
|
20
18
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
21
|
-
export function
|
|
19
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
20
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
21
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
22
22
|
export function __wbindgen_malloc(a: number): number;
|
|
23
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,38 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @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.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
4
|
+
* Sets the package's logging level.
|
|
24
5
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
|
-
*/
|
|
30
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
33
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
34
7
|
*/
|
|
35
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
36
9
|
/**
|
|
37
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
38
11
|
*
|
|
@@ -112,6 +85,11 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
112
85
|
*/
|
|
113
86
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
114
87
|
/**
|
|
88
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
89
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
90
|
+
*/
|
|
91
|
+
export function buildInfo(): BuildInfo;
|
|
92
|
+
/**
|
|
115
93
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
116
94
|
*
|
|
117
95
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -141,39 +119,33 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
141
119
|
*/
|
|
142
120
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
143
121
|
/**
|
|
144
|
-
*
|
|
122
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
145
123
|
*
|
|
146
|
-
* @param {
|
|
124
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
125
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
126
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
127
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
147
128
|
*/
|
|
148
|
-
export function
|
|
149
|
-
|
|
150
|
-
export type ForeignCallInput = string[]
|
|
151
|
-
export type ForeignCallOutput = string | string[]
|
|
152
|
-
|
|
129
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
153
130
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @param {
|
|
158
|
-
* @
|
|
131
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
132
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
133
|
+
*
|
|
134
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
135
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
136
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
137
|
+
* @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.
|
|
159
138
|
*/
|
|
160
|
-
export
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
164
140
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* @
|
|
168
|
-
* @
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
dirty: string;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
141
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
142
|
+
*
|
|
143
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
144
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
145
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
146
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
147
|
+
*/
|
|
148
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
177
149
|
|
|
178
150
|
export type RawAssertionPayload = {
|
|
179
151
|
selector: string;
|
|
@@ -197,6 +169,34 @@ export type WitnessStack = Array<StackItem>;
|
|
|
197
169
|
|
|
198
170
|
|
|
199
171
|
|
|
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
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
export type ForeignCallInput = string[]
|
|
187
|
+
export type ForeignCallOutput = string | string[]
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* A callback which performs an foreign call and returns the response.
|
|
191
|
+
* @callback ForeignCallHandler
|
|
192
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
193
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
194
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
195
|
+
*/
|
|
196
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
200
|
// Map from witness index to hex string value of witness.
|
|
201
201
|
export type WitnessMap = Map<number, string>;
|
|
202
202
|
|
|
@@ -216,10 +216,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
216
216
|
|
|
217
217
|
export interface InitOutput {
|
|
218
218
|
readonly memory: WebAssembly.Memory;
|
|
219
|
-
readonly
|
|
220
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
221
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
222
|
-
readonly buildInfo: () => number;
|
|
219
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
223
220
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
224
221
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
225
222
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -229,11 +226,14 @@ export interface InitOutput {
|
|
|
229
226
|
readonly blake2s256: (a: number, b: number, c: number) => void;
|
|
230
227
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
231
228
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
229
|
+
readonly buildInfo: () => number;
|
|
232
230
|
readonly compressWitness: (a: number, b: number) => void;
|
|
233
231
|
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
234
232
|
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
235
233
|
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
236
|
-
readonly
|
|
234
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
235
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
236
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
237
237
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
238
238
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
239
239
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,28 +20,6 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function isLikeNone(x) {
|
|
24
|
-
return x === undefined || x === null;
|
|
25
|
-
}
|
|
26
|
-
|
|
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;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
23
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
46
24
|
|
|
47
25
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -69,6 +47,28 @@ function addHeapObject(obj) {
|
|
|
69
47
|
return idx;
|
|
70
48
|
}
|
|
71
49
|
|
|
50
|
+
function isLikeNone(x) {
|
|
51
|
+
return x === undefined || x === null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let cachedFloat64Memory0 = null;
|
|
55
|
+
|
|
56
|
+
function getFloat64Memory0() {
|
|
57
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
58
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
59
|
+
}
|
|
60
|
+
return cachedFloat64Memory0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let cachedInt32Memory0 = null;
|
|
64
|
+
|
|
65
|
+
function getInt32Memory0() {
|
|
66
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
67
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
68
|
+
}
|
|
69
|
+
return cachedInt32Memory0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
72
|
let WASM_VECTOR_LEN = 0;
|
|
73
73
|
|
|
74
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -217,67 +217,33 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
217
217
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
221
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
222
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
223
|
-
WASM_VECTOR_LEN = arg.length;
|
|
224
|
-
return ptr;
|
|
225
|
-
}
|
|
226
220
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
230
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
231
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
232
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
233
|
-
*/
|
|
234
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
235
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
236
|
-
const len0 = WASM_VECTOR_LEN;
|
|
237
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
238
|
-
return takeObject(ret);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
243
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
244
|
-
*
|
|
245
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
246
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
247
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
248
|
-
* @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.
|
|
249
|
-
*/
|
|
250
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
251
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
-
const len0 = WASM_VECTOR_LEN;
|
|
253
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
254
|
-
return takeObject(ret);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
221
|
+
* Sets the package's logging level.
|
|
259
222
|
*
|
|
260
|
-
* @param {
|
|
261
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
262
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
263
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
223
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
264
224
|
*/
|
|
265
|
-
export function
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
225
|
+
export function initLogLevel(filter) {
|
|
226
|
+
try {
|
|
227
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
231
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
232
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
233
|
+
if (r1) {
|
|
234
|
+
throw takeObject(r0);
|
|
235
|
+
}
|
|
236
|
+
} finally {
|
|
237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
|
+
}
|
|
270
239
|
}
|
|
271
240
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const ret = wasm.buildInfo();
|
|
278
|
-
return takeObject(ret);
|
|
241
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
242
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
243
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
244
|
+
WASM_VECTOR_LEN = arg.length;
|
|
245
|
+
return ptr;
|
|
279
246
|
}
|
|
280
|
-
|
|
281
247
|
/**
|
|
282
248
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
283
249
|
*
|
|
@@ -495,6 +461,15 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
495
461
|
return ret !== 0;
|
|
496
462
|
}
|
|
497
463
|
|
|
464
|
+
/**
|
|
465
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
466
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
467
|
+
*/
|
|
468
|
+
export function buildInfo() {
|
|
469
|
+
const ret = wasm.buildInfo();
|
|
470
|
+
return takeObject(ret);
|
|
471
|
+
}
|
|
472
|
+
|
|
498
473
|
/**
|
|
499
474
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
500
475
|
*
|
|
@@ -595,24 +570,49 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
595
570
|
}
|
|
596
571
|
|
|
597
572
|
/**
|
|
598
|
-
*
|
|
573
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
599
574
|
*
|
|
600
|
-
* @param {
|
|
575
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
576
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
577
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
578
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
601
579
|
*/
|
|
602
|
-
export function
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
580
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
581
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
582
|
+
const len0 = WASM_VECTOR_LEN;
|
|
583
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
584
|
+
return takeObject(ret);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
589
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
590
|
+
*
|
|
591
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
592
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
593
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
594
|
+
* @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.
|
|
595
|
+
*/
|
|
596
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
597
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
598
|
+
const len0 = WASM_VECTOR_LEN;
|
|
599
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
600
|
+
return takeObject(ret);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
605
|
+
*
|
|
606
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
607
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
608
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
609
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
610
|
+
*/
|
|
611
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
612
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
613
|
+
const len0 = WASM_VECTOR_LEN;
|
|
614
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
615
|
+
return takeObject(ret);
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
@@ -667,20 +667,6 @@ function __wbg_get_imports() {
|
|
|
667
667
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
668
668
|
takeObject(arg0);
|
|
669
669
|
};
|
|
670
|
-
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
671
|
-
const ret = Array.isArray(getObject(arg0));
|
|
672
|
-
return ret;
|
|
673
|
-
};
|
|
674
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
675
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
676
|
-
return ret;
|
|
677
|
-
};
|
|
678
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
679
|
-
const obj = getObject(arg1);
|
|
680
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
681
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
682
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
683
|
-
};
|
|
684
670
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
685
671
|
const obj = takeObject(arg0).original;
|
|
686
672
|
if (obj.cnt-- == 1) {
|
|
@@ -690,7 +676,7 @@ function __wbg_get_imports() {
|
|
|
690
676
|
const ret = false;
|
|
691
677
|
return ret;
|
|
692
678
|
};
|
|
693
|
-
imports.wbg.
|
|
679
|
+
imports.wbg.__wbg_constructor_01cf62506201187d = function(arg0) {
|
|
694
680
|
const ret = new Error(takeObject(arg0));
|
|
695
681
|
return addHeapObject(ret);
|
|
696
682
|
};
|
|
@@ -698,7 +684,7 @@ function __wbg_get_imports() {
|
|
|
698
684
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
699
685
|
return addHeapObject(ret);
|
|
700
686
|
};
|
|
701
|
-
imports.wbg.
|
|
687
|
+
imports.wbg.__wbg_new_0d58cd3f85c51a07 = function() {
|
|
702
688
|
const ret = new Array();
|
|
703
689
|
return addHeapObject(ret);
|
|
704
690
|
};
|
|
@@ -706,7 +692,21 @@ function __wbg_get_imports() {
|
|
|
706
692
|
const ret = arg0;
|
|
707
693
|
return addHeapObject(ret);
|
|
708
694
|
};
|
|
709
|
-
imports.wbg.
|
|
695
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
696
|
+
const obj = getObject(arg1);
|
|
697
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
698
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
699
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
700
|
+
};
|
|
701
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
702
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
703
|
+
return ret;
|
|
704
|
+
};
|
|
705
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
706
|
+
const ret = Array.isArray(getObject(arg0));
|
|
707
|
+
return ret;
|
|
708
|
+
};
|
|
709
|
+
imports.wbg.__wbg_new_ced18ca7e58573af = function() {
|
|
710
710
|
const ret = new Map();
|
|
711
711
|
return addHeapObject(ret);
|
|
712
712
|
};
|
|
@@ -901,8 +901,8 @@ function __wbg_get_imports() {
|
|
|
901
901
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
902
902
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
903
903
|
};
|
|
904
|
-
imports.wbg.
|
|
905
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
904
|
+
imports.wbg.__wbindgen_closure_wrapper736 = function(arg0, arg1, arg2) {
|
|
905
|
+
const ret = makeMutClosure(arg0, arg1, 269, __wbg_adapter_22);
|
|
906
906
|
return addHeapObject(ret);
|
|
907
907
|
};
|
|
908
908
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function buildInfo(): number;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
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;
|
|
@@ -14,11 +11,14 @@ export function sha256_compression(a: number, b: number, c: number, d: number, e
|
|
|
14
11
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
15
12
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
16
13
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
14
|
+
export function buildInfo(): number;
|
|
17
15
|
export function compressWitness(a: number, b: number): void;
|
|
18
16
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
19
17
|
export function compressWitnessStack(a: number, b: number): void;
|
|
20
18
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
21
|
-
export function
|
|
19
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
20
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
21
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
22
22
|
export function __wbindgen_malloc(a: number): number;
|
|
23
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|