@noir-lang/acvm_js 0.46.0-e73cdbb.nightly → 0.46.0-ff7bb72.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 +54 -54
- package/nodejs/acvm_js.js +106 -106
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +4 -4
- package/package.json +1 -1
- package/web/acvm_js.d.ts +58 -58
- package/web/acvm_js.js +105 -105
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +4 -4
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -63,6 +63,40 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
63
|
*/
|
|
64
64
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
65
65
|
/**
|
|
66
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
67
|
+
*
|
|
68
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
70
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
71
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
72
|
+
*/
|
|
73
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
74
|
+
/**
|
|
75
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
76
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
77
|
+
*
|
|
78
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
79
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
80
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
81
|
+
* @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.
|
|
82
|
+
*/
|
|
83
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
84
|
+
/**
|
|
85
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
86
|
+
*
|
|
87
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
88
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
89
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
90
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
91
|
+
*/
|
|
92
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the package's logging level.
|
|
95
|
+
*
|
|
96
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
97
|
+
*/
|
|
98
|
+
export function initLogLevel(filter: string): void;
|
|
99
|
+
/**
|
|
66
100
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
67
101
|
* @param {string} lhs
|
|
68
102
|
* @param {string} rhs
|
|
@@ -117,40 +151,6 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
117
151
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
118
152
|
*/
|
|
119
153
|
export function buildInfo(): BuildInfo;
|
|
120
|
-
/**
|
|
121
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
122
|
-
*
|
|
123
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
124
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
125
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
126
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
127
|
-
*/
|
|
128
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
129
|
-
/**
|
|
130
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
131
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
132
|
-
*
|
|
133
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
134
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
135
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
136
|
-
* @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.
|
|
137
|
-
*/
|
|
138
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
139
|
-
/**
|
|
140
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
141
|
-
*
|
|
142
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
143
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
144
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
145
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
146
|
-
*/
|
|
147
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
148
|
-
/**
|
|
149
|
-
* Sets the package's logging level.
|
|
150
|
-
*
|
|
151
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
152
|
-
*/
|
|
153
|
-
export function initLogLevel(filter: string): void;
|
|
154
154
|
|
|
155
155
|
export type RawAssertionPayload = {
|
|
156
156
|
selector: string;
|
|
@@ -163,17 +163,17 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
+
export type ForeignCallInput = string[]
|
|
167
|
+
export type ForeignCallOutput = string | string[]
|
|
168
|
+
|
|
166
169
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
version: string;
|
|
175
|
-
dirty: string;
|
|
176
|
-
}
|
|
170
|
+
* A callback which performs an foreign call and returns the response.
|
|
171
|
+
* @callback ForeignCallHandler
|
|
172
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
173
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
174
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
175
|
+
*/
|
|
176
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
@@ -201,16 +201,16 @@ export type WitnessStack = Array<StackItem>;
|
|
|
201
201
|
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
export type ForeignCallInput = string[]
|
|
205
|
-
export type ForeignCallOutput = string | string[]
|
|
206
|
-
|
|
207
204
|
/**
|
|
208
|
-
*
|
|
209
|
-
* @
|
|
210
|
-
* @
|
|
211
|
-
* @
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
215
|
|
|
216
216
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -50,28 +50,6 @@ function addHeapObject(obj) {
|
|
|
50
50
|
return idx;
|
|
51
51
|
}
|
|
52
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
53
|
let WASM_VECTOR_LEN = 0;
|
|
76
54
|
|
|
77
55
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -127,6 +105,28 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
127
105
|
return ptr;
|
|
128
106
|
}
|
|
129
107
|
|
|
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;
|
|
@@ -413,6 +413,73 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
418
|
+
*
|
|
419
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
420
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
421
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
422
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
423
|
+
*/
|
|
424
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
425
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
426
|
+
const len0 = WASM_VECTOR_LEN;
|
|
427
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
428
|
+
return takeObject(ret);
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
433
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
434
|
+
*
|
|
435
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
436
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
437
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
438
|
+
* @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.
|
|
439
|
+
*/
|
|
440
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
441
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
442
|
+
const len0 = WASM_VECTOR_LEN;
|
|
443
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
444
|
+
return takeObject(ret);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
449
|
+
*
|
|
450
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
451
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
452
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
453
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
454
|
+
*/
|
|
455
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
456
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
457
|
+
const len0 = WASM_VECTOR_LEN;
|
|
458
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
459
|
+
return takeObject(ret);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Sets the package's logging level.
|
|
464
|
+
*
|
|
465
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
466
|
+
*/
|
|
467
|
+
module.exports.initLogLevel = function(filter) {
|
|
468
|
+
try {
|
|
469
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
470
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
473
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
474
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
475
|
+
if (r1) {
|
|
476
|
+
throw takeObject(r0);
|
|
477
|
+
}
|
|
478
|
+
} finally {
|
|
479
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
416
483
|
/**
|
|
417
484
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
418
485
|
* @param {string} lhs
|
|
@@ -549,73 +616,6 @@ module.exports.buildInfo = function() {
|
|
|
549
616
|
return takeObject(ret);
|
|
550
617
|
};
|
|
551
618
|
|
|
552
|
-
/**
|
|
553
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
554
|
-
*
|
|
555
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
556
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
557
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
558
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
559
|
-
*/
|
|
560
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
561
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
562
|
-
const len0 = WASM_VECTOR_LEN;
|
|
563
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
564
|
-
return takeObject(ret);
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
569
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
570
|
-
*
|
|
571
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
572
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
573
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
574
|
-
* @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.
|
|
575
|
-
*/
|
|
576
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
577
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
578
|
-
const len0 = WASM_VECTOR_LEN;
|
|
579
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
580
|
-
return takeObject(ret);
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
585
|
-
*
|
|
586
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
587
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
588
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
589
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
590
|
-
*/
|
|
591
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
592
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
593
|
-
const len0 = WASM_VECTOR_LEN;
|
|
594
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
595
|
-
return takeObject(ret);
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Sets the package's logging level.
|
|
600
|
-
*
|
|
601
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
602
|
-
*/
|
|
603
|
-
module.exports.initLogLevel = function(filter) {
|
|
604
|
-
try {
|
|
605
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
606
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
607
|
-
const len0 = WASM_VECTOR_LEN;
|
|
608
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
609
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
610
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
611
|
-
if (r1) {
|
|
612
|
-
throw takeObject(r0);
|
|
613
|
-
}
|
|
614
|
-
} finally {
|
|
615
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
|
|
619
619
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
620
620
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
621
621
|
}
|
|
@@ -635,16 +635,6 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
635
635
|
takeObject(arg0);
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
639
|
-
const obj = takeObject(arg0).original;
|
|
640
|
-
if (obj.cnt-- == 1) {
|
|
641
|
-
obj.a = 0;
|
|
642
|
-
return true;
|
|
643
|
-
}
|
|
644
|
-
const ret = false;
|
|
645
|
-
return ret;
|
|
646
|
-
};
|
|
647
|
-
|
|
648
638
|
module.exports.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
649
639
|
const ret = new Error(takeObject(arg0));
|
|
650
640
|
return addHeapObject(ret);
|
|
@@ -655,11 +645,14 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
655
645
|
return addHeapObject(ret);
|
|
656
646
|
};
|
|
657
647
|
|
|
658
|
-
module.exports.
|
|
659
|
-
const obj =
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
648
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
649
|
+
const obj = takeObject(arg0).original;
|
|
650
|
+
if (obj.cnt-- == 1) {
|
|
651
|
+
obj.a = 0;
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
const ret = false;
|
|
655
|
+
return ret;
|
|
663
656
|
};
|
|
664
657
|
|
|
665
658
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
@@ -686,6 +679,13 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
|
686
679
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
687
680
|
};
|
|
688
681
|
|
|
682
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
683
|
+
const obj = getObject(arg1);
|
|
684
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
685
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
686
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
689
|
module.exports.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
690
690
|
const ret = new Array();
|
|
691
691
|
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_wrapper739 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 240, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -8,6 +8,10 @@ export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
|
8
8
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
9
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
10
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
11
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
12
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
13
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
14
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
11
15
|
export function and(a: number, b: number): number;
|
|
12
16
|
export function xor(a: number, b: number): number;
|
|
13
17
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -16,10 +20,6 @@ export function keccak256(a: number, b: number, c: number): void;
|
|
|
16
20
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
21
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
22
|
export function buildInfo(): number;
|
|
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
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -63,6 +63,40 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
63
|
*/
|
|
64
64
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
65
65
|
/**
|
|
66
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
67
|
+
*
|
|
68
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
70
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
71
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
72
|
+
*/
|
|
73
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
74
|
+
/**
|
|
75
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
76
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
77
|
+
*
|
|
78
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
79
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
80
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
81
|
+
* @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.
|
|
82
|
+
*/
|
|
83
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
84
|
+
/**
|
|
85
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
86
|
+
*
|
|
87
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
88
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
89
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
90
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
91
|
+
*/
|
|
92
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the package's logging level.
|
|
95
|
+
*
|
|
96
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
97
|
+
*/
|
|
98
|
+
export function initLogLevel(filter: string): void;
|
|
99
|
+
/**
|
|
66
100
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
67
101
|
* @param {string} lhs
|
|
68
102
|
* @param {string} rhs
|
|
@@ -117,40 +151,6 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
117
151
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
118
152
|
*/
|
|
119
153
|
export function buildInfo(): BuildInfo;
|
|
120
|
-
/**
|
|
121
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
122
|
-
*
|
|
123
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
124
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
125
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
126
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
127
|
-
*/
|
|
128
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
129
|
-
/**
|
|
130
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
131
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
132
|
-
*
|
|
133
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
134
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
135
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
136
|
-
* @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.
|
|
137
|
-
*/
|
|
138
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
139
|
-
/**
|
|
140
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
141
|
-
*
|
|
142
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
143
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
144
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
145
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
146
|
-
*/
|
|
147
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
148
|
-
/**
|
|
149
|
-
* Sets the package's logging level.
|
|
150
|
-
*
|
|
151
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
152
|
-
*/
|
|
153
|
-
export function initLogLevel(filter: string): void;
|
|
154
154
|
|
|
155
155
|
export type RawAssertionPayload = {
|
|
156
156
|
selector: string;
|
|
@@ -163,17 +163,17 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
+
export type ForeignCallInput = string[]
|
|
167
|
+
export type ForeignCallOutput = string | string[]
|
|
168
|
+
|
|
166
169
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
169
|
-
* @
|
|
170
|
-
* @
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
version: string;
|
|
175
|
-
dirty: string;
|
|
176
|
-
}
|
|
170
|
+
* A callback which performs an foreign call and returns the response.
|
|
171
|
+
* @callback ForeignCallHandler
|
|
172
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
173
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
174
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
175
|
+
*/
|
|
176
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
@@ -201,17 +201,17 @@ export type WitnessStack = Array<StackItem>;
|
|
|
201
201
|
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
export type ForeignCallInput = string[]
|
|
205
|
-
export type ForeignCallOutput = string | string[]
|
|
206
|
-
|
|
207
204
|
/**
|
|
208
|
-
*
|
|
209
|
-
* @
|
|
210
|
-
* @
|
|
211
|
-
* @
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
215
|
|
|
216
216
|
|
|
217
217
|
|
|
@@ -226,6 +226,10 @@ export interface InitOutput {
|
|
|
226
226
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
227
227
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
228
228
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
229
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
230
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
231
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
232
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
229
233
|
readonly and: (a: number, b: number) => number;
|
|
230
234
|
readonly xor: (a: number, b: number) => number;
|
|
231
235
|
readonly sha256: (a: number, b: number, c: number) => void;
|
|
@@ -234,10 +238,6 @@ export interface InitOutput {
|
|
|
234
238
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
235
239
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
236
240
|
readonly buildInfo: () => number;
|
|
237
|
-
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
238
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
239
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
240
|
-
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
241
241
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
242
242
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
243
243
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -47,28 +47,6 @@ function addHeapObject(obj) {
|
|
|
47
47
|
return idx;
|
|
48
48
|
}
|
|
49
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
50
|
let WASM_VECTOR_LEN = 0;
|
|
73
51
|
|
|
74
52
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -124,6 +102,28 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
124
102
|
return ptr;
|
|
125
103
|
}
|
|
126
104
|
|
|
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;
|
|
@@ -410,6 +410,73 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
/**
|
|
414
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
415
|
+
*
|
|
416
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
417
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
418
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
419
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
420
|
+
*/
|
|
421
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
422
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
424
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
425
|
+
return takeObject(ret);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
430
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
431
|
+
*
|
|
432
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
433
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
434
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
435
|
+
* @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.
|
|
436
|
+
*/
|
|
437
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
438
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
439
|
+
const len0 = WASM_VECTOR_LEN;
|
|
440
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
441
|
+
return takeObject(ret);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
446
|
+
*
|
|
447
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
448
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
449
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
450
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
451
|
+
*/
|
|
452
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
453
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
454
|
+
const len0 = WASM_VECTOR_LEN;
|
|
455
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
456
|
+
return takeObject(ret);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Sets the package's logging level.
|
|
461
|
+
*
|
|
462
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
463
|
+
*/
|
|
464
|
+
export function initLogLevel(filter) {
|
|
465
|
+
try {
|
|
466
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
467
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
468
|
+
const len0 = WASM_VECTOR_LEN;
|
|
469
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
470
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
471
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
472
|
+
if (r1) {
|
|
473
|
+
throw takeObject(r0);
|
|
474
|
+
}
|
|
475
|
+
} finally {
|
|
476
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
413
480
|
/**
|
|
414
481
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
415
482
|
* @param {string} lhs
|
|
@@ -546,73 +613,6 @@ export function buildInfo() {
|
|
|
546
613
|
return takeObject(ret);
|
|
547
614
|
}
|
|
548
615
|
|
|
549
|
-
/**
|
|
550
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
551
|
-
*
|
|
552
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
553
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
554
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
555
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
556
|
-
*/
|
|
557
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
558
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
559
|
-
const len0 = WASM_VECTOR_LEN;
|
|
560
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
561
|
-
return takeObject(ret);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
566
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
567
|
-
*
|
|
568
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
569
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
570
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
571
|
-
* @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.
|
|
572
|
-
*/
|
|
573
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
574
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
575
|
-
const len0 = WASM_VECTOR_LEN;
|
|
576
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
577
|
-
return takeObject(ret);
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
582
|
-
*
|
|
583
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
584
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
585
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
586
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
587
|
-
*/
|
|
588
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
589
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
590
|
-
const len0 = WASM_VECTOR_LEN;
|
|
591
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
592
|
-
return takeObject(ret);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* Sets the package's logging level.
|
|
597
|
-
*
|
|
598
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
599
|
-
*/
|
|
600
|
-
export function initLogLevel(filter) {
|
|
601
|
-
try {
|
|
602
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
603
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
604
|
-
const len0 = WASM_VECTOR_LEN;
|
|
605
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
606
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
607
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
608
|
-
if (r1) {
|
|
609
|
-
throw takeObject(r0);
|
|
610
|
-
}
|
|
611
|
-
} finally {
|
|
612
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
616
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
617
617
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
618
618
|
}
|
|
@@ -665,15 +665,6 @@ function __wbg_get_imports() {
|
|
|
665
665
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
666
666
|
takeObject(arg0);
|
|
667
667
|
};
|
|
668
|
-
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
669
|
-
const obj = takeObject(arg0).original;
|
|
670
|
-
if (obj.cnt-- == 1) {
|
|
671
|
-
obj.a = 0;
|
|
672
|
-
return true;
|
|
673
|
-
}
|
|
674
|
-
const ret = false;
|
|
675
|
-
return ret;
|
|
676
|
-
};
|
|
677
668
|
imports.wbg.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
678
669
|
const ret = new Error(takeObject(arg0));
|
|
679
670
|
return addHeapObject(ret);
|
|
@@ -682,11 +673,14 @@ function __wbg_get_imports() {
|
|
|
682
673
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
683
674
|
return addHeapObject(ret);
|
|
684
675
|
};
|
|
685
|
-
imports.wbg.
|
|
686
|
-
const obj =
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
676
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
677
|
+
const obj = takeObject(arg0).original;
|
|
678
|
+
if (obj.cnt-- == 1) {
|
|
679
|
+
obj.a = 0;
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
const ret = false;
|
|
683
|
+
return ret;
|
|
690
684
|
};
|
|
691
685
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
692
686
|
const ret = Array.isArray(getObject(arg0));
|
|
@@ -708,6 +702,12 @@ function __wbg_get_imports() {
|
|
|
708
702
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
709
703
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
710
704
|
};
|
|
705
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
706
|
+
const obj = getObject(arg1);
|
|
707
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
708
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
709
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
710
|
+
};
|
|
711
711
|
imports.wbg.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
712
712
|
const ret = new Array();
|
|
713
713
|
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_wrapper739 = function(arg0, arg1, arg2) {
|
|
903
|
+
const ret = makeMutClosure(arg0, arg1, 240, __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
|
@@ -8,6 +8,10 @@ export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
|
8
8
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
9
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
10
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
11
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
12
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
13
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
14
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
11
15
|
export function and(a: number, b: number): number;
|
|
12
16
|
export function xor(a: number, b: number): number;
|
|
13
17
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -16,10 +20,6 @@ export function keccak256(a: number, b: number, c: number): void;
|
|
|
16
20
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
21
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
18
22
|
export function buildInfo(): number;
|
|
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
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|