@aztec/bb.js 0.0.1-alpha.6 → 0.0.1-fake-ceab37513c
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/README.md +69 -33
- package/package.json +56 -41
- package/src/barretenberg/__snapshots__/pedersen.test.ts.snap +156 -0
- package/src/barretenberg/__snapshots__/poseidon.test.ts.snap +40 -0
- package/src/barretenberg/backend.ts +378 -0
- package/src/barretenberg/blake2s.test.ts +70 -0
- package/src/{barretenberg_api → barretenberg}/common.test.ts +7 -5
- package/src/barretenberg/index.ts +204 -0
- package/src/barretenberg/pedersen.test.ts +62 -0
- package/src/barretenberg/poseidon.test.ts +39 -0
- package/src/barretenberg_api/index.ts +1128 -383
- package/src/barretenberg_wasm/barretenberg_wasm_base/index.ts +138 -0
- package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/index.ts +11 -0
- package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/main.worker.ts +13 -0
- package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/index.ts +21 -0
- package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/main.worker.ts +19 -0
- package/src/{barretenberg_binder/heap_allocator_sync.ts → barretenberg_wasm/barretenberg_wasm_main/heap_allocator.ts} +20 -17
- package/src/barretenberg_wasm/barretenberg_wasm_main/index.ts +167 -0
- package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/index.ts +11 -0
- package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/thread.worker.ts +13 -0
- package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/index.ts +21 -0
- package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/thread.worker.ts +19 -0
- package/src/barretenberg_wasm/barretenberg_wasm_thread/index.ts +47 -0
- package/src/barretenberg_wasm/fetch_code/browser/barretenberg-threads.ts +3 -0
- package/src/barretenberg_wasm/fetch_code/browser/barretenberg.ts +3 -0
- package/src/barretenberg_wasm/fetch_code/browser/index.ts +34 -0
- package/src/barretenberg_wasm/fetch_code/index.ts +1 -0
- package/src/barretenberg_wasm/fetch_code/node/index.ts +34 -0
- package/src/barretenberg_wasm/fetch_code/wasm-module.d.ts +4 -0
- package/src/barretenberg_wasm/helpers/browser/index.ts +47 -0
- package/src/barretenberg_wasm/helpers/index.ts +1 -0
- package/src/barretenberg_wasm/{node → helpers/node}/index.ts +24 -15
- package/src/barretenberg_wasm/index.test.ts +45 -0
- package/src/barretenberg_wasm/index.ts +22 -1
- package/src/benchmark/index.ts +26 -0
- package/src/benchmark/timer.ts +45 -0
- package/src/bigint-array/index.ts +39 -17
- package/src/bindgen/index.ts +2 -2
- package/src/bindgen/mappings.ts +3 -2
- package/src/bindgen/typescript.ts +50 -25
- package/src/cbind/README.md +1 -0
- package/src/cbind/generate.ts +89 -0
- package/src/cbind/schema_compiler.ts +833 -0
- package/src/crs/browser/cached_net_crs.ts +41 -2
- package/src/crs/browser/index.ts +1 -1
- package/src/crs/index.ts +1 -1
- package/src/crs/net_crs.ts +114 -19
- package/src/crs/node/index.ts +98 -20
- package/src/index.html +1 -1
- package/src/index.ts +13 -5
- package/src/log/browser/index.ts +35 -0
- package/src/log/index.ts +1 -0
- package/src/log/node/index.ts +52 -0
- package/src/log/types.ts +6 -0
- package/src/main.ts +395 -185
- package/src/proof/index.ts +94 -0
- package/src/random/browser/index.ts +1 -1
- package/src/retry/index.ts +50 -0
- package/src/serialize/buffer_reader.ts +4 -1
- package/src/types/fields.ts +46 -18
- package/src/types/point.ts +4 -1
- package/dest/async_map/index.d.ts +0 -10
- package/dest/async_map/index.d.ts.map +0 -1
- package/dest/async_map/index.js +0 -16
- package/dest/barretenberg-threads.wasm +0 -0
- package/dest/barretenberg.wasm +0 -0
- package/dest/barretenberg_api/blake2s.test.d.ts +0 -2
- package/dest/barretenberg_api/blake2s.test.d.ts.map +0 -1
- package/dest/barretenberg_api/blake2s.test.js +0 -30
- package/dest/barretenberg_api/common.test.d.ts +0 -2
- package/dest/barretenberg_api/common.test.d.ts.map +0 -1
- package/dest/barretenberg_api/common.test.js +0 -18
- package/dest/barretenberg_api/index.d.ts +0 -103
- package/dest/barretenberg_api/index.d.ts.map +0 -1
- package/dest/barretenberg_api/index.js +0 -379
- package/dest/barretenberg_api/pedersen.test.d.ts +0 -2
- package/dest/barretenberg_api/pedersen.test.d.ts.map +0 -1
- package/dest/barretenberg_api/pedersen.test.js +0 -69
- package/dest/barretenberg_api/schnorr.test.d.ts +0 -2
- package/dest/barretenberg_api/schnorr.test.d.ts.map +0 -1
- package/dest/barretenberg_api/schnorr.test.js +0 -113
- package/dest/barretenberg_binder/heap_allocator.d.ts +0 -22
- package/dest/barretenberg_binder/heap_allocator.d.ts.map +0 -1
- package/dest/barretenberg_binder/heap_allocator.js +0 -59
- package/dest/barretenberg_binder/heap_allocator_sync.d.ts +0 -22
- package/dest/barretenberg_binder/heap_allocator_sync.d.ts.map +0 -1
- package/dest/barretenberg_binder/heap_allocator_sync.js +0 -58
- package/dest/barretenberg_binder/index.d.ts +0 -32
- package/dest/barretenberg_binder/index.d.ts.map +0 -1
- package/dest/barretenberg_binder/index.js +0 -73
- package/dest/barretenberg_wasm/barretenberg_wasm.d.ts +0 -50
- package/dest/barretenberg_wasm/barretenberg_wasm.d.ts.map +0 -1
- package/dest/barretenberg_wasm/barretenberg_wasm.js +0 -212
- package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts +0 -2
- package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts.map +0 -1
- package/dest/barretenberg_wasm/barretenberg_wasm.test.js +0 -43
- package/dest/barretenberg_wasm/browser/index.d.ts +0 -8
- package/dest/barretenberg_wasm/browser/index.d.ts.map +0 -1
- package/dest/barretenberg_wasm/browser/index.js +0 -26
- package/dest/barretenberg_wasm/browser/worker.d.ts +0 -2
- package/dest/barretenberg_wasm/browser/worker.d.ts.map +0 -1
- package/dest/barretenberg_wasm/browser/worker.js +0 -11
- package/dest/barretenberg_wasm/index.d.ts +0 -2
- package/dest/barretenberg_wasm/index.d.ts.map +0 -1
- package/dest/barretenberg_wasm/index.js +0 -2
- package/dest/barretenberg_wasm/node/index.d.ts +0 -17
- package/dest/barretenberg_wasm/node/index.d.ts.map +0 -1
- package/dest/barretenberg_wasm/node/index.js +0 -40
- package/dest/barretenberg_wasm/node/node_endpoint.d.ts +0 -8
- package/dest/barretenberg_wasm/node/node_endpoint.d.ts.map +0 -1
- package/dest/barretenberg_wasm/node/node_endpoint.js +0 -28
- package/dest/barretenberg_wasm/node/worker.d.ts +0 -2
- package/dest/barretenberg_wasm/node/worker.d.ts.map +0 -1
- package/dest/barretenberg_wasm/node/worker.js +0 -9
- package/dest/barretenberg_wasm.js +0 -2
- package/dest/barretenberg_wasm.js.LICENSE.txt +0 -5
- package/dest/bigint-array/index.d.ts +0 -3
- package/dest/bigint-array/index.d.ts.map +0 -1
- package/dest/bigint-array/index.js +0 -21
- package/dest/bindgen/function_declaration.d.ts +0 -11
- package/dest/bindgen/function_declaration.d.ts.map +0 -1
- package/dest/bindgen/function_declaration.js +0 -2
- package/dest/bindgen/index.d.ts +0 -2
- package/dest/bindgen/index.d.ts.map +0 -1
- package/dest/bindgen/index.js +0 -15
- package/dest/bindgen/mappings.d.ts +0 -4
- package/dest/bindgen/mappings.d.ts.map +0 -1
- package/dest/bindgen/mappings.js +0 -63
- package/dest/bindgen/rust.d.ts +0 -2
- package/dest/bindgen/rust.d.ts.map +0 -1
- package/dest/bindgen/rust.js +0 -43
- package/dest/bindgen/to_camel_case.d.ts +0 -2
- package/dest/bindgen/to_camel_case.d.ts.map +0 -1
- package/dest/bindgen/to_camel_case.js +0 -11
- package/dest/bindgen/typescript.d.ts +0 -2
- package/dest/bindgen/typescript.d.ts.map +0 -1
- package/dest/bindgen/typescript.js +0 -80
- package/dest/crs/browser/cached_net_crs.d.ts +0 -25
- package/dest/crs/browser/cached_net_crs.d.ts.map +0 -1
- package/dest/crs/browser/cached_net_crs.js +0 -54
- package/dest/crs/browser/index.d.ts +0 -2
- package/dest/crs/browser/index.d.ts.map +0 -1
- package/dest/crs/browser/index.js +0 -2
- package/dest/crs/index.d.ts +0 -2
- package/dest/crs/index.d.ts.map +0 -1
- package/dest/crs/index.js +0 -2
- package/dest/crs/net_crs.d.ts +0 -36
- package/dest/crs/net_crs.d.ts.map +0 -1
- package/dest/crs/net_crs.js +0 -59
- package/dest/crs/node/file_crs.d.ts +0 -37
- package/dest/crs/node/file_crs.d.ts.map +0 -1
- package/dest/crs/node/file_crs.js +0 -51
- package/dest/crs/node/index.d.ts +0 -31
- package/dest/crs/node/index.d.ts.map +0 -1
- package/dest/crs/node/index.js +0 -41
- package/dest/examples/simple.rawtest.d.ts +0 -2
- package/dest/examples/simple.rawtest.d.ts.map +0 -1
- package/dest/examples/simple.rawtest.js +0 -29
- package/dest/examples/simple.test.d.ts +0 -2
- package/dest/examples/simple.test.d.ts.map +0 -1
- package/dest/examples/simple.test.js +0 -22
- package/dest/factory/index.d.ts +0 -21
- package/dest/factory/index.d.ts.map +0 -1
- package/dest/factory/index.js +0 -34
- package/dest/index.d.ts +0 -6
- package/dest/index.d.ts.map +0 -1
- package/dest/index.html +0 -1
- package/dest/index.js +0 -6
- package/dest/main.d.ts +0 -10
- package/dest/main.d.ts.map +0 -1
- package/dest/main.js +0 -280
- package/dest/random/browser/index.d.ts +0 -2
- package/dest/random/browser/index.d.ts.map +0 -1
- package/dest/random/browser/index.js +0 -31
- package/dest/random/index.d.ts +0 -2
- package/dest/random/index.d.ts.map +0 -1
- package/dest/random/index.js +0 -2
- package/dest/random/node/index.d.ts +0 -2
- package/dest/random/node/index.d.ts.map +0 -1
- package/dest/random/node/index.js +0 -5
- package/dest/serialize/buffer_reader.d.ts +0 -28
- package/dest/serialize/buffer_reader.d.ts.map +0 -1
- package/dest/serialize/buffer_reader.js +0 -66
- package/dest/serialize/index.d.ts +0 -4
- package/dest/serialize/index.d.ts.map +0 -1
- package/dest/serialize/index.js +0 -4
- package/dest/serialize/output_type.d.ts +0 -11
- package/dest/serialize/output_type.d.ts.map +0 -1
- package/dest/serialize/output_type.js +0 -44
- package/dest/serialize/serialize.d.ts +0 -53
- package/dest/serialize/serialize.d.ts.map +0 -1
- package/dest/serialize/serialize.js +0 -139
- package/dest/simple_test.js +0 -2
- package/dest/simple_test.js.LICENSE.txt +0 -14
- package/dest/types/fields.d.ts +0 -33
- package/dest/types/fields.d.ts.map +0 -1
- package/dest/types/fields.js +0 -86
- package/dest/types/fixed_size_buffer.d.ts +0 -26
- package/dest/types/fixed_size_buffer.d.ts.map +0 -1
- package/dest/types/fixed_size_buffer.js +0 -54
- package/dest/types/index.d.ts +0 -6
- package/dest/types/index.d.ts.map +0 -1
- package/dest/types/index.js +0 -6
- package/dest/types/point.d.ts +0 -17
- package/dest/types/point.d.ts.map +0 -1
- package/dest/types/point.js +0 -32
- package/dest/types/ptr.d.ts +0 -13
- package/dest/types/ptr.d.ts.map +0 -1
- package/dest/types/ptr.js +0 -20
- package/dest/types/raw_buffer.d.ts +0 -3
- package/dest/types/raw_buffer.d.ts.map +0 -1
- package/dest/types/raw_buffer.js +0 -5
- package/src/barretenberg_api/blake2s.test.ts +0 -39
- package/src/barretenberg_api/pedersen.test.ts +0 -84
- package/src/barretenberg_api/schnorr.test.ts +0 -169
- package/src/barretenberg_binder/heap_allocator.ts +0 -62
- package/src/barretenberg_binder/index.ts +0 -76
- package/src/barretenberg_wasm/barretenberg_wasm.test.ts +0 -52
- package/src/barretenberg_wasm/barretenberg_wasm.ts +0 -246
- package/src/barretenberg_wasm/browser/index.ts +0 -32
- package/src/barretenberg_wasm/browser/worker.ts +0 -13
- package/src/barretenberg_wasm/node/worker.ts +0 -10
- package/src/crs/node/file_crs.ts +0 -60
- package/src/examples/simple.rawtest.ts +0 -37
- package/src/examples/simple.test.ts +0 -27
- package/src/factory/index.ts +0 -36
- /package/src/barretenberg_wasm/{node → helpers/node}/node_endpoint.ts +0 -0
|
@@ -1,471 +1,1216 @@
|
|
|
1
1
|
// WARNING: FILE CODE GENERATED BY BINDGEN UTILITY. DO NOT EDIT!
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { BarretenbergWasmMain, BarretenbergWasmMainWorker } from '../barretenberg_wasm/barretenberg_wasm_main/index.js';
|
|
4
|
+
import {
|
|
5
|
+
BufferDeserializer,
|
|
6
|
+
NumberDeserializer,
|
|
7
|
+
VectorDeserializer,
|
|
8
|
+
BoolDeserializer,
|
|
9
|
+
StringDeserializer,
|
|
10
|
+
serializeBufferable,
|
|
11
|
+
OutputType,
|
|
12
|
+
} from '../serialize/index.js';
|
|
13
|
+
import { Fr, Point, Buffer32, Ptr } from '../types/index.js';
|
|
6
14
|
|
|
7
15
|
export class BarretenbergApi {
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
async
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const result = await this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const result = await this.
|
|
86
|
-
|
|
16
|
+
constructor(protected wasm: BarretenbergWasmMainWorker) {}
|
|
17
|
+
|
|
18
|
+
async pedersenCommit(inputsBuffer: Fr[], ctxIndex: number): Promise<Point> {
|
|
19
|
+
const inArgs = [inputsBuffer, ctxIndex].map(serializeBufferable);
|
|
20
|
+
const outTypes: OutputType[] = [Point];
|
|
21
|
+
const result = await this.wasm.callWasmExport(
|
|
22
|
+
'pedersen_commit',
|
|
23
|
+
inArgs,
|
|
24
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
25
|
+
);
|
|
26
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
27
|
+
return out[0];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async pedersenHash(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
|
|
31
|
+
const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
|
|
32
|
+
const outTypes: OutputType[] = [Fr];
|
|
33
|
+
const result = await this.wasm.callWasmExport(
|
|
34
|
+
'pedersen_hash',
|
|
35
|
+
inArgs,
|
|
36
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
37
|
+
);
|
|
38
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
39
|
+
return out[0];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async pedersenHashes(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
|
|
43
|
+
const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
|
|
44
|
+
const outTypes: OutputType[] = [Fr];
|
|
45
|
+
const result = await this.wasm.callWasmExport(
|
|
46
|
+
'pedersen_hashes',
|
|
47
|
+
inArgs,
|
|
48
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
49
|
+
);
|
|
50
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
51
|
+
return out[0];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async pedersenHashBuffer(inputBuffer: Uint8Array, hashIndex: number): Promise<Fr> {
|
|
55
|
+
const inArgs = [inputBuffer, hashIndex].map(serializeBufferable);
|
|
56
|
+
const outTypes: OutputType[] = [Fr];
|
|
57
|
+
const result = await this.wasm.callWasmExport(
|
|
58
|
+
'pedersen_hash_buffer',
|
|
59
|
+
inArgs,
|
|
60
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
61
|
+
);
|
|
62
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
63
|
+
return out[0];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async poseidon2Hash(inputsBuffer: Fr[]): Promise<Fr> {
|
|
67
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
68
|
+
const outTypes: OutputType[] = [Fr];
|
|
69
|
+
const result = await this.wasm.callWasmExport(
|
|
70
|
+
'poseidon2_hash',
|
|
71
|
+
inArgs,
|
|
72
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
73
|
+
);
|
|
74
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
75
|
+
return out[0];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async poseidon2Hashes(inputsBuffer: Fr[]): Promise<Fr> {
|
|
79
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
80
|
+
const outTypes: OutputType[] = [Fr];
|
|
81
|
+
const result = await this.wasm.callWasmExport(
|
|
82
|
+
'poseidon2_hashes',
|
|
83
|
+
inArgs,
|
|
84
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
85
|
+
);
|
|
86
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
87
|
+
return out[0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async poseidon2Permutation(inputsBuffer: Fr[]): Promise<Fr[]> {
|
|
91
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
92
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
93
|
+
const result = await this.wasm.callWasmExport(
|
|
94
|
+
'poseidon2_permutation',
|
|
95
|
+
inArgs,
|
|
96
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
97
|
+
);
|
|
98
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
99
|
+
return out[0];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async poseidon2HashAccumulate(inputsBuffer: Fr[]): Promise<Fr> {
|
|
103
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
104
|
+
const outTypes: OutputType[] = [Fr];
|
|
105
|
+
const result = await this.wasm.callWasmExport(
|
|
106
|
+
'poseidon2_hash_accumulate',
|
|
107
|
+
inArgs,
|
|
108
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
109
|
+
);
|
|
110
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
111
|
+
return out[0];
|
|
87
112
|
}
|
|
88
113
|
|
|
89
114
|
async blake2s(data: Uint8Array): Promise<Buffer32> {
|
|
90
|
-
const
|
|
91
|
-
|
|
115
|
+
const inArgs = [data].map(serializeBufferable);
|
|
116
|
+
const outTypes: OutputType[] = [Buffer32];
|
|
117
|
+
const result = await this.wasm.callWasmExport(
|
|
118
|
+
'blake2s',
|
|
119
|
+
inArgs,
|
|
120
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
121
|
+
);
|
|
122
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
123
|
+
return out[0];
|
|
92
124
|
}
|
|
93
125
|
|
|
94
126
|
async blake2sToField(data: Uint8Array): Promise<Fr> {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
async schnorrMultisigConstructSignatureRound1(): Promise<[Buffer128, Buffer128]> {
|
|
130
|
-
const result = await this.binder.callWasmExport('schnorr_multisig_construct_signature_round_1', [], [Buffer128, Buffer128]);
|
|
131
|
-
return result as any;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async schnorrMultisigConstructSignatureRound2(message: Uint8Array, privateKey: Fq, signerRoundOnePrivateBuf: Buffer128, signerPubkeysBuf: Buffer128[], roundOnePublicBuf: Buffer128[]): Promise<[Fq, boolean]> {
|
|
135
|
-
const result = await this.binder.callWasmExport('schnorr_multisig_construct_signature_round_2', [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf], [Fq, BoolDeserializer()]);
|
|
136
|
-
return result as any;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async schnorrMultisigCombineSignatures(message: Uint8Array, signerPubkeysBuf: Buffer128[], roundOneBuf: Buffer128[], roundTwoBuf: Fr[]): Promise<[Buffer32, Buffer32, boolean]> {
|
|
140
|
-
const result = await this.binder.callWasmExport('schnorr_multisig_combine_signatures', [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf], [Buffer32, Buffer32, BoolDeserializer()]);
|
|
141
|
-
return result as any;
|
|
127
|
+
const inArgs = [data].map(serializeBufferable);
|
|
128
|
+
const outTypes: OutputType[] = [Fr];
|
|
129
|
+
const result = await this.wasm.callWasmExport(
|
|
130
|
+
'blake2s_to_field_',
|
|
131
|
+
inArgs,
|
|
132
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
133
|
+
);
|
|
134
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
135
|
+
return out[0];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Promise<Uint8Array> {
|
|
139
|
+
const inArgs = [input, iv, key, length].map(serializeBufferable);
|
|
140
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
141
|
+
const result = await this.wasm.callWasmExport(
|
|
142
|
+
'aes_encrypt_buffer_cbc',
|
|
143
|
+
inArgs,
|
|
144
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
145
|
+
);
|
|
146
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
147
|
+
return out[0];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async aesDecryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Promise<Uint8Array> {
|
|
151
|
+
const inArgs = [input, iv, key, length].map(serializeBufferable);
|
|
152
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
153
|
+
const result = await this.wasm.callWasmExport(
|
|
154
|
+
'aes_decrypt_buffer_cbc',
|
|
155
|
+
inArgs,
|
|
156
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
157
|
+
);
|
|
158
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
159
|
+
return out[0];
|
|
142
160
|
}
|
|
143
161
|
|
|
144
162
|
async srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): Promise<void> {
|
|
145
|
-
const
|
|
163
|
+
const inArgs = [pointsBuf, numPoints, g2PointBuf].map(serializeBufferable);
|
|
164
|
+
const outTypes: OutputType[] = [];
|
|
165
|
+
const result = await this.wasm.callWasmExport(
|
|
166
|
+
'srs_init_srs',
|
|
167
|
+
inArgs,
|
|
168
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
169
|
+
);
|
|
170
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
146
171
|
return;
|
|
147
172
|
}
|
|
148
173
|
|
|
149
|
-
async
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
async testThreadAbort(): Promise<void> {
|
|
160
|
-
const result = await this.binder.callWasmExport('test_thread_abort', [], []);
|
|
174
|
+
async srsInitGrumpkinSrs(pointsBuf: Uint8Array, numPoints: number): Promise<void> {
|
|
175
|
+
const inArgs = [pointsBuf, numPoints].map(serializeBufferable);
|
|
176
|
+
const outTypes: OutputType[] = [];
|
|
177
|
+
const result = await this.wasm.callWasmExport(
|
|
178
|
+
'srs_init_grumpkin_srs',
|
|
179
|
+
inArgs,
|
|
180
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
181
|
+
);
|
|
182
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
161
183
|
return;
|
|
162
184
|
}
|
|
163
185
|
|
|
164
|
-
async
|
|
165
|
-
const
|
|
166
|
-
|
|
186
|
+
async testThreads(threads: number, iterations: number): Promise<number> {
|
|
187
|
+
const inArgs = [threads, iterations].map(serializeBufferable);
|
|
188
|
+
const outTypes: OutputType[] = [NumberDeserializer()];
|
|
189
|
+
const result = await this.wasm.callWasmExport(
|
|
190
|
+
'test_threads',
|
|
191
|
+
inArgs,
|
|
192
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
193
|
+
);
|
|
194
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
195
|
+
return out[0];
|
|
167
196
|
}
|
|
168
197
|
|
|
169
198
|
async commonInitSlabAllocator(circuitSize: number): Promise<void> {
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
async acirNewAcirComposer(sizeHint: number): Promise<Ptr> {
|
|
180
|
-
const result = await this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
|
|
181
|
-
return result[0];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async acirDeleteAcirComposer(acirComposerPtr: Ptr): Promise<void> {
|
|
185
|
-
const result = await this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
async acirCreateCircuit(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, sizeHint: number): Promise<void> {
|
|
190
|
-
const result = await this.binder.callWasmExport('acir_create_circuit', [acirComposerPtr, constraintSystemBuf, sizeHint], []);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async acirInitProvingKey(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array): Promise<void> {
|
|
195
|
-
const result = await this.binder.callWasmExport('acir_init_proving_key', [acirComposerPtr, constraintSystemBuf], []);
|
|
199
|
+
const inArgs = [circuitSize].map(serializeBufferable);
|
|
200
|
+
const outTypes: OutputType[] = [];
|
|
201
|
+
const result = await this.wasm.callWasmExport(
|
|
202
|
+
'common_init_slab_allocator',
|
|
203
|
+
inArgs,
|
|
204
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
205
|
+
);
|
|
206
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
196
207
|
return;
|
|
197
208
|
}
|
|
198
209
|
|
|
199
|
-
async
|
|
200
|
-
|
|
201
|
-
|
|
210
|
+
async acirGetCircuitSizes(
|
|
211
|
+
constraintSystemBuf: Uint8Array,
|
|
212
|
+
recursive: boolean,
|
|
213
|
+
honkRecursion: boolean,
|
|
214
|
+
): Promise<[number, number]> {
|
|
215
|
+
const inArgs = [constraintSystemBuf, recursive, honkRecursion].map(serializeBufferable);
|
|
216
|
+
const outTypes: OutputType[] = [NumberDeserializer(), NumberDeserializer()];
|
|
217
|
+
const result = await this.wasm.callWasmExport(
|
|
218
|
+
'acir_get_circuit_sizes',
|
|
219
|
+
inArgs,
|
|
220
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
221
|
+
);
|
|
222
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
223
|
+
return out as any;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
|
|
227
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
228
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
229
|
+
const result = await this.wasm.callWasmExport(
|
|
230
|
+
'acir_prove_and_verify_ultra_honk',
|
|
231
|
+
inArgs,
|
|
232
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
233
|
+
);
|
|
234
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
235
|
+
return out[0];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
|
|
239
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
240
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
241
|
+
const result = await this.wasm.callWasmExport(
|
|
242
|
+
'acir_prove_and_verify_mega_honk',
|
|
243
|
+
inArgs,
|
|
244
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
245
|
+
);
|
|
246
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
247
|
+
return out[0];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async acirProveAztecClient(ivcInputsBuf: Uint8Array): Promise<[Uint8Array, Uint8Array]> {
|
|
251
|
+
const inArgs = [ivcInputsBuf].map(serializeBufferable);
|
|
252
|
+
const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
|
|
253
|
+
const result = await this.wasm.callWasmExport(
|
|
254
|
+
'acir_prove_aztec_client',
|
|
255
|
+
inArgs,
|
|
256
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
257
|
+
);
|
|
258
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
259
|
+
return out as any;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
263
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
264
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
265
|
+
const result = await this.wasm.callWasmExport(
|
|
266
|
+
'acir_verify_aztec_client',
|
|
267
|
+
inArgs,
|
|
268
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
269
|
+
);
|
|
270
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
271
|
+
return out[0];
|
|
202
272
|
}
|
|
203
273
|
|
|
204
274
|
async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
|
|
205
|
-
const
|
|
275
|
+
const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
|
|
276
|
+
const outTypes: OutputType[] = [];
|
|
277
|
+
const result = await this.wasm.callWasmExport(
|
|
278
|
+
'acir_load_verification_key',
|
|
279
|
+
inArgs,
|
|
280
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
281
|
+
);
|
|
282
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
206
283
|
return;
|
|
207
284
|
}
|
|
208
285
|
|
|
209
286
|
async acirInitVerificationKey(acirComposerPtr: Ptr): Promise<void> {
|
|
210
|
-
const
|
|
287
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
288
|
+
const outTypes: OutputType[] = [];
|
|
289
|
+
const result = await this.wasm.callWasmExport(
|
|
290
|
+
'acir_init_verification_key',
|
|
291
|
+
inArgs,
|
|
292
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
293
|
+
);
|
|
294
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
211
295
|
return;
|
|
212
296
|
}
|
|
213
297
|
|
|
214
298
|
async acirGetVerificationKey(acirComposerPtr: Ptr): Promise<Uint8Array> {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
299
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
300
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
301
|
+
const result = await this.wasm.callWasmExport(
|
|
302
|
+
'acir_get_verification_key',
|
|
303
|
+
inArgs,
|
|
304
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
305
|
+
);
|
|
306
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
307
|
+
return out[0];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async acirGetProvingKey(acirComposerPtr: Ptr, acirVec: Uint8Array, recursive: boolean): Promise<Uint8Array> {
|
|
311
|
+
const inArgs = [acirComposerPtr, acirVec, recursive].map(serializeBufferable);
|
|
312
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
313
|
+
const result = await this.wasm.callWasmExport(
|
|
314
|
+
'acir_get_proving_key',
|
|
315
|
+
inArgs,
|
|
316
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
317
|
+
);
|
|
318
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
319
|
+
return out[0];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array): Promise<boolean> {
|
|
323
|
+
const inArgs = [acirComposerPtr, proofBuf].map(serializeBufferable);
|
|
324
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
325
|
+
const result = await this.wasm.callWasmExport(
|
|
326
|
+
'acir_verify_proof',
|
|
327
|
+
inArgs,
|
|
328
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
329
|
+
);
|
|
330
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
331
|
+
return out[0];
|
|
222
332
|
}
|
|
223
333
|
|
|
224
334
|
async acirGetSolidityVerifier(acirComposerPtr: Ptr): Promise<string> {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
335
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
336
|
+
const outTypes: OutputType[] = [StringDeserializer()];
|
|
337
|
+
const result = await this.wasm.callWasmExport(
|
|
338
|
+
'acir_get_solidity_verifier',
|
|
339
|
+
inArgs,
|
|
340
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
341
|
+
);
|
|
342
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
343
|
+
return out[0];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<string> {
|
|
347
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
348
|
+
const outTypes: OutputType[] = [StringDeserializer()];
|
|
349
|
+
const result = await this.wasm.callWasmExport(
|
|
350
|
+
'acir_honk_solidity_verifier',
|
|
351
|
+
inArgs,
|
|
352
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
353
|
+
);
|
|
354
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
355
|
+
return out[0];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
async acirSerializeProofIntoFields(
|
|
359
|
+
acirComposerPtr: Ptr,
|
|
360
|
+
proofBuf: Uint8Array,
|
|
361
|
+
numInnerPublicInputs: number,
|
|
362
|
+
): Promise<Fr[]> {
|
|
363
|
+
const inArgs = [acirComposerPtr, proofBuf, numInnerPublicInputs].map(serializeBufferable);
|
|
364
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
365
|
+
const result = await this.wasm.callWasmExport(
|
|
366
|
+
'acir_serialize_proof_into_fields',
|
|
367
|
+
inArgs,
|
|
368
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
369
|
+
);
|
|
370
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
371
|
+
return out[0];
|
|
232
372
|
}
|
|
233
373
|
|
|
234
374
|
async acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): Promise<[Fr[], Fr]> {
|
|
235
|
-
const
|
|
236
|
-
|
|
375
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
376
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr), Fr];
|
|
377
|
+
const result = await this.wasm.callWasmExport(
|
|
378
|
+
'acir_serialize_verification_key_into_fields',
|
|
379
|
+
inArgs,
|
|
380
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
381
|
+
);
|
|
382
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
383
|
+
return out as any;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
async acirProveUltraZKHonk(acirVec: Uint8Array, witnessVec: Uint8Array, vkBuf: Uint8Array): Promise<Uint8Array> {
|
|
387
|
+
const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
|
|
388
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
389
|
+
const result = await this.wasm.callWasmExport(
|
|
390
|
+
'acir_prove_ultra_zk_honk',
|
|
391
|
+
inArgs,
|
|
392
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
393
|
+
);
|
|
394
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
395
|
+
return out[0];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array, vkBuf: Uint8Array): Promise<Uint8Array> {
|
|
399
|
+
const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
|
|
400
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
401
|
+
const result = await this.wasm.callWasmExport(
|
|
402
|
+
'acir_prove_ultra_keccak_honk',
|
|
403
|
+
inArgs,
|
|
404
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
405
|
+
);
|
|
406
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
407
|
+
return out[0];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
async acirProveUltraKeccakZkHonk(
|
|
411
|
+
acirVec: Uint8Array,
|
|
412
|
+
witnessVec: Uint8Array,
|
|
413
|
+
vkBuf: Uint8Array,
|
|
414
|
+
): Promise<Uint8Array> {
|
|
415
|
+
const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
|
|
416
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
417
|
+
const result = await this.wasm.callWasmExport(
|
|
418
|
+
'acir_prove_ultra_keccak_zk_honk',
|
|
419
|
+
inArgs,
|
|
420
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
421
|
+
);
|
|
422
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
423
|
+
return out[0];
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async acirProveUltraStarknetHonk(
|
|
427
|
+
acirVec: Uint8Array,
|
|
428
|
+
witnessVec: Uint8Array,
|
|
429
|
+
vkBuf: Uint8Array,
|
|
430
|
+
): Promise<Uint8Array> {
|
|
431
|
+
const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
|
|
432
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
433
|
+
const result = await this.wasm.callWasmExport(
|
|
434
|
+
'acir_prove_ultra_starknet_honk',
|
|
435
|
+
inArgs,
|
|
436
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
437
|
+
);
|
|
438
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
439
|
+
return out[0];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
async acirProveUltraStarknetZkHonk(
|
|
443
|
+
acirVec: Uint8Array,
|
|
444
|
+
witnessVec: Uint8Array,
|
|
445
|
+
vkBuf: Uint8Array,
|
|
446
|
+
): Promise<Uint8Array> {
|
|
447
|
+
const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
|
|
448
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
449
|
+
const result = await this.wasm.callWasmExport(
|
|
450
|
+
'acir_prove_ultra_starknet_zk_honk',
|
|
451
|
+
inArgs,
|
|
452
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
453
|
+
);
|
|
454
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
455
|
+
return out[0];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
async acirVerifyUltraZKHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
459
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
460
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
461
|
+
const result = await this.wasm.callWasmExport(
|
|
462
|
+
'acir_verify_ultra_zk_honk',
|
|
463
|
+
inArgs,
|
|
464
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
465
|
+
);
|
|
466
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
467
|
+
return out[0];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
async acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
471
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
472
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
473
|
+
const result = await this.wasm.callWasmExport(
|
|
474
|
+
'acir_verify_ultra_keccak_honk',
|
|
475
|
+
inArgs,
|
|
476
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
477
|
+
);
|
|
478
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
479
|
+
return out[0];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
async acirVerifyUltraKeccakZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
483
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
484
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
485
|
+
const result = await this.wasm.callWasmExport(
|
|
486
|
+
'acir_verify_ultra_keccak_zk_honk',
|
|
487
|
+
inArgs,
|
|
488
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
489
|
+
);
|
|
490
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
491
|
+
return out[0];
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
async acirVerifyUltraStarknetHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
495
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
496
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
497
|
+
const result = await this.wasm.callWasmExport(
|
|
498
|
+
'acir_verify_ultra_starknet_honk',
|
|
499
|
+
inArgs,
|
|
500
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
501
|
+
);
|
|
502
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
503
|
+
return out[0];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
async acirVerifyUltraStarknetZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
|
|
507
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
508
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
509
|
+
const result = await this.wasm.callWasmExport(
|
|
510
|
+
'acir_verify_ultra_starknet_zk_honk',
|
|
511
|
+
inArgs,
|
|
512
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
513
|
+
);
|
|
514
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
515
|
+
return out[0];
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
async acirWriteVkUltraHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
519
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
520
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
521
|
+
const result = await this.wasm.callWasmExport(
|
|
522
|
+
'acir_write_vk_ultra_honk',
|
|
523
|
+
inArgs,
|
|
524
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
525
|
+
);
|
|
526
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
527
|
+
return out[0];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
async acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
531
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
532
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
533
|
+
const result = await this.wasm.callWasmExport(
|
|
534
|
+
'acir_write_vk_ultra_keccak_honk',
|
|
535
|
+
inArgs,
|
|
536
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
537
|
+
);
|
|
538
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
539
|
+
return out[0];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
async acirWriteVkUltraKeccakZkHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
543
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
544
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
545
|
+
const result = await this.wasm.callWasmExport(
|
|
546
|
+
'acir_write_vk_ultra_keccak_zk_honk',
|
|
547
|
+
inArgs,
|
|
548
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
549
|
+
);
|
|
550
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
551
|
+
return out[0];
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
async acirWriteVkUltraStarknetHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
555
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
556
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
557
|
+
const result = await this.wasm.callWasmExport(
|
|
558
|
+
'acir_write_vk_ultra_starknet_honk',
|
|
559
|
+
inArgs,
|
|
560
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
561
|
+
);
|
|
562
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
563
|
+
return out[0];
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
async acirWriteVkUltraStarknetZkHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
567
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
568
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
569
|
+
const result = await this.wasm.callWasmExport(
|
|
570
|
+
'acir_write_vk_ultra_starknet_zk_honk',
|
|
571
|
+
inArgs,
|
|
572
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
573
|
+
);
|
|
574
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
575
|
+
return out[0];
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Promise<Fr[]> {
|
|
579
|
+
const inArgs = [proofBuf].map(serializeBufferable);
|
|
580
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
581
|
+
const result = await this.wasm.callWasmExport(
|
|
582
|
+
'acir_proof_as_fields_ultra_honk',
|
|
583
|
+
inArgs,
|
|
584
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
585
|
+
);
|
|
586
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
587
|
+
return out[0];
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async acirVkAsFieldsUltraHonk(vkBuf: Uint8Array): Promise<Fr[]> {
|
|
591
|
+
const inArgs = [vkBuf].map(serializeBufferable);
|
|
592
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
593
|
+
const result = await this.wasm.callWasmExport(
|
|
594
|
+
'acir_vk_as_fields_ultra_honk',
|
|
595
|
+
inArgs,
|
|
596
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
597
|
+
);
|
|
598
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
599
|
+
return out[0];
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
async acirVkAsFieldsMegaHonk(vkBuf: Uint8Array): Promise<Fr[]> {
|
|
603
|
+
const inArgs = [vkBuf].map(serializeBufferable);
|
|
604
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
605
|
+
const result = await this.wasm.callWasmExport(
|
|
606
|
+
'acir_vk_as_fields_mega_honk',
|
|
607
|
+
inArgs,
|
|
608
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
609
|
+
);
|
|
610
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
611
|
+
return out[0];
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
async acirGatesAztecClient(ivcInputsBuf: Uint8Array): Promise<Uint8Array> {
|
|
615
|
+
const inArgs = [ivcInputsBuf].map(serializeBufferable);
|
|
616
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
617
|
+
const result = await this.wasm.callWasmExport(
|
|
618
|
+
'acir_gates_aztec_client',
|
|
619
|
+
inArgs,
|
|
620
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
621
|
+
);
|
|
622
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
623
|
+
return out[0];
|
|
237
624
|
}
|
|
238
625
|
}
|
|
239
|
-
|
|
240
626
|
export class BarretenbergApiSync {
|
|
241
|
-
constructor(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const result = this.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const result = this.
|
|
319
|
-
|
|
627
|
+
constructor(protected wasm: BarretenbergWasmMain) {}
|
|
628
|
+
|
|
629
|
+
pedersenCommit(inputsBuffer: Fr[], ctxIndex: number): Point {
|
|
630
|
+
const inArgs = [inputsBuffer, ctxIndex].map(serializeBufferable);
|
|
631
|
+
const outTypes: OutputType[] = [Point];
|
|
632
|
+
const result = this.wasm.callWasmExport(
|
|
633
|
+
'pedersen_commit',
|
|
634
|
+
inArgs,
|
|
635
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
636
|
+
);
|
|
637
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
638
|
+
return out[0];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
pedersenHash(inputsBuffer: Fr[], hashIndex: number): Fr {
|
|
642
|
+
const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
|
|
643
|
+
const outTypes: OutputType[] = [Fr];
|
|
644
|
+
const result = this.wasm.callWasmExport(
|
|
645
|
+
'pedersen_hash',
|
|
646
|
+
inArgs,
|
|
647
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
648
|
+
);
|
|
649
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
650
|
+
return out[0];
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
pedersenHashes(inputsBuffer: Fr[], hashIndex: number): Fr {
|
|
654
|
+
const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
|
|
655
|
+
const outTypes: OutputType[] = [Fr];
|
|
656
|
+
const result = this.wasm.callWasmExport(
|
|
657
|
+
'pedersen_hashes',
|
|
658
|
+
inArgs,
|
|
659
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
660
|
+
);
|
|
661
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
662
|
+
return out[0];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
pedersenHashBuffer(inputBuffer: Uint8Array, hashIndex: number): Fr {
|
|
666
|
+
const inArgs = [inputBuffer, hashIndex].map(serializeBufferable);
|
|
667
|
+
const outTypes: OutputType[] = [Fr];
|
|
668
|
+
const result = this.wasm.callWasmExport(
|
|
669
|
+
'pedersen_hash_buffer',
|
|
670
|
+
inArgs,
|
|
671
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
672
|
+
);
|
|
673
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
674
|
+
return out[0];
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
poseidon2Hash(inputsBuffer: Fr[]): Fr {
|
|
678
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
679
|
+
const outTypes: OutputType[] = [Fr];
|
|
680
|
+
const result = this.wasm.callWasmExport(
|
|
681
|
+
'poseidon2_hash',
|
|
682
|
+
inArgs,
|
|
683
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
684
|
+
);
|
|
685
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
686
|
+
return out[0];
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
poseidon2Hashes(inputsBuffer: Fr[]): Fr {
|
|
690
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
691
|
+
const outTypes: OutputType[] = [Fr];
|
|
692
|
+
const result = this.wasm.callWasmExport(
|
|
693
|
+
'poseidon2_hashes',
|
|
694
|
+
inArgs,
|
|
695
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
696
|
+
);
|
|
697
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
698
|
+
return out[0];
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
poseidon2Permutation(inputsBuffer: Fr[]): Fr[] {
|
|
702
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
703
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
704
|
+
const result = this.wasm.callWasmExport(
|
|
705
|
+
'poseidon2_permutation',
|
|
706
|
+
inArgs,
|
|
707
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
708
|
+
);
|
|
709
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
710
|
+
return out[0];
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
poseidon2HashAccumulate(inputsBuffer: Fr[]): Fr {
|
|
714
|
+
const inArgs = [inputsBuffer].map(serializeBufferable);
|
|
715
|
+
const outTypes: OutputType[] = [Fr];
|
|
716
|
+
const result = this.wasm.callWasmExport(
|
|
717
|
+
'poseidon2_hash_accumulate',
|
|
718
|
+
inArgs,
|
|
719
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
720
|
+
);
|
|
721
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
722
|
+
return out[0];
|
|
320
723
|
}
|
|
321
724
|
|
|
322
725
|
blake2s(data: Uint8Array): Buffer32 {
|
|
323
|
-
const
|
|
324
|
-
|
|
726
|
+
const inArgs = [data].map(serializeBufferable);
|
|
727
|
+
const outTypes: OutputType[] = [Buffer32];
|
|
728
|
+
const result = this.wasm.callWasmExport(
|
|
729
|
+
'blake2s',
|
|
730
|
+
inArgs,
|
|
731
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
732
|
+
);
|
|
733
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
734
|
+
return out[0];
|
|
325
735
|
}
|
|
326
736
|
|
|
327
737
|
blake2sToField(data: Uint8Array): Fr {
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
schnorrMultisigConstructSignatureRound1(): [Buffer128, Buffer128] {
|
|
363
|
-
const result = this.binder.callWasmExport('schnorr_multisig_construct_signature_round_1', [], [Buffer128, Buffer128]);
|
|
364
|
-
return result as any;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
schnorrMultisigConstructSignatureRound2(message: Uint8Array, privateKey: Fq, signerRoundOnePrivateBuf: Buffer128, signerPubkeysBuf: Buffer128[], roundOnePublicBuf: Buffer128[]): [Fq, boolean] {
|
|
368
|
-
const result = this.binder.callWasmExport('schnorr_multisig_construct_signature_round_2', [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf], [Fq, BoolDeserializer()]);
|
|
369
|
-
return result as any;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
schnorrMultisigCombineSignatures(message: Uint8Array, signerPubkeysBuf: Buffer128[], roundOneBuf: Buffer128[], roundTwoBuf: Fr[]): [Buffer32, Buffer32, boolean] {
|
|
373
|
-
const result = this.binder.callWasmExport('schnorr_multisig_combine_signatures', [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf], [Buffer32, Buffer32, BoolDeserializer()]);
|
|
374
|
-
return result as any;
|
|
738
|
+
const inArgs = [data].map(serializeBufferable);
|
|
739
|
+
const outTypes: OutputType[] = [Fr];
|
|
740
|
+
const result = this.wasm.callWasmExport(
|
|
741
|
+
'blake2s_to_field_',
|
|
742
|
+
inArgs,
|
|
743
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
744
|
+
);
|
|
745
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
746
|
+
return out[0];
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Uint8Array {
|
|
750
|
+
const inArgs = [input, iv, key, length].map(serializeBufferable);
|
|
751
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
752
|
+
const result = this.wasm.callWasmExport(
|
|
753
|
+
'aes_encrypt_buffer_cbc',
|
|
754
|
+
inArgs,
|
|
755
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
756
|
+
);
|
|
757
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
758
|
+
return out[0];
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
aesDecryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Uint8Array {
|
|
762
|
+
const inArgs = [input, iv, key, length].map(serializeBufferable);
|
|
763
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
764
|
+
const result = this.wasm.callWasmExport(
|
|
765
|
+
'aes_decrypt_buffer_cbc',
|
|
766
|
+
inArgs,
|
|
767
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
768
|
+
);
|
|
769
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
770
|
+
return out[0];
|
|
375
771
|
}
|
|
376
772
|
|
|
377
773
|
srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): void {
|
|
378
|
-
const
|
|
774
|
+
const inArgs = [pointsBuf, numPoints, g2PointBuf].map(serializeBufferable);
|
|
775
|
+
const outTypes: OutputType[] = [];
|
|
776
|
+
const result = this.wasm.callWasmExport(
|
|
777
|
+
'srs_init_srs',
|
|
778
|
+
inArgs,
|
|
779
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
780
|
+
);
|
|
781
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
379
782
|
return;
|
|
380
783
|
}
|
|
381
784
|
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
testThreadAbort(): void {
|
|
393
|
-
const result = this.binder.callWasmExport('test_thread_abort', [], []);
|
|
785
|
+
srsInitGrumpkinSrs(pointsBuf: Uint8Array, numPoints: number): void {
|
|
786
|
+
const inArgs = [pointsBuf, numPoints].map(serializeBufferable);
|
|
787
|
+
const outTypes: OutputType[] = [];
|
|
788
|
+
const result = this.wasm.callWasmExport(
|
|
789
|
+
'srs_init_grumpkin_srs',
|
|
790
|
+
inArgs,
|
|
791
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
792
|
+
);
|
|
793
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
394
794
|
return;
|
|
395
795
|
}
|
|
396
796
|
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
797
|
+
testThreads(threads: number, iterations: number): number {
|
|
798
|
+
const inArgs = [threads, iterations].map(serializeBufferable);
|
|
799
|
+
const outTypes: OutputType[] = [NumberDeserializer()];
|
|
800
|
+
const result = this.wasm.callWasmExport(
|
|
801
|
+
'test_threads',
|
|
802
|
+
inArgs,
|
|
803
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
804
|
+
);
|
|
805
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
806
|
+
return out[0];
|
|
400
807
|
}
|
|
401
808
|
|
|
402
809
|
commonInitSlabAllocator(circuitSize: number): void {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
acirNewAcirComposer(sizeHint: number): Ptr {
|
|
413
|
-
const result = this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
|
|
414
|
-
return result[0];
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
acirDeleteAcirComposer(acirComposerPtr: Ptr): void {
|
|
418
|
-
const result = this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
|
|
810
|
+
const inArgs = [circuitSize].map(serializeBufferable);
|
|
811
|
+
const outTypes: OutputType[] = [];
|
|
812
|
+
const result = this.wasm.callWasmExport(
|
|
813
|
+
'common_init_slab_allocator',
|
|
814
|
+
inArgs,
|
|
815
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
816
|
+
);
|
|
817
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
419
818
|
return;
|
|
420
819
|
}
|
|
421
820
|
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
821
|
+
acirGetCircuitSizes(constraintSystemBuf: Uint8Array, recursive: boolean, honkRecursion: boolean): [number, number] {
|
|
822
|
+
const inArgs = [constraintSystemBuf, recursive, honkRecursion].map(serializeBufferable);
|
|
823
|
+
const outTypes: OutputType[] = [NumberDeserializer(), NumberDeserializer()];
|
|
824
|
+
const result = this.wasm.callWasmExport(
|
|
825
|
+
'acir_get_circuit_sizes',
|
|
826
|
+
inArgs,
|
|
827
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
828
|
+
);
|
|
829
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
830
|
+
return out as any;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
|
|
834
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
835
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
836
|
+
const result = this.wasm.callWasmExport(
|
|
837
|
+
'acir_prove_and_verify_ultra_honk',
|
|
838
|
+
inArgs,
|
|
839
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
840
|
+
);
|
|
841
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
842
|
+
return out[0];
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
|
|
846
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
847
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
848
|
+
const result = this.wasm.callWasmExport(
|
|
849
|
+
'acir_prove_and_verify_mega_honk',
|
|
850
|
+
inArgs,
|
|
851
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
852
|
+
);
|
|
853
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
854
|
+
return out[0];
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
acirProveAztecClient(ivcInputsBuf: Uint8Array): [Uint8Array, Uint8Array] {
|
|
858
|
+
const inArgs = [ivcInputsBuf].map(serializeBufferable);
|
|
859
|
+
const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
|
|
860
|
+
const result = this.wasm.callWasmExport(
|
|
861
|
+
'acir_prove_aztec_client',
|
|
862
|
+
inArgs,
|
|
863
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
864
|
+
);
|
|
865
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
866
|
+
return out as any;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
870
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
871
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
872
|
+
const result = this.wasm.callWasmExport(
|
|
873
|
+
'acir_verify_aztec_client',
|
|
874
|
+
inArgs,
|
|
875
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
876
|
+
);
|
|
877
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
878
|
+
return out[0];
|
|
435
879
|
}
|
|
436
880
|
|
|
437
881
|
acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
|
|
438
|
-
const
|
|
882
|
+
const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
|
|
883
|
+
const outTypes: OutputType[] = [];
|
|
884
|
+
const result = this.wasm.callWasmExport(
|
|
885
|
+
'acir_load_verification_key',
|
|
886
|
+
inArgs,
|
|
887
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
888
|
+
);
|
|
889
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
439
890
|
return;
|
|
440
891
|
}
|
|
441
892
|
|
|
442
893
|
acirInitVerificationKey(acirComposerPtr: Ptr): void {
|
|
443
|
-
const
|
|
894
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
895
|
+
const outTypes: OutputType[] = [];
|
|
896
|
+
const result = this.wasm.callWasmExport(
|
|
897
|
+
'acir_init_verification_key',
|
|
898
|
+
inArgs,
|
|
899
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
900
|
+
);
|
|
901
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
444
902
|
return;
|
|
445
903
|
}
|
|
446
904
|
|
|
447
905
|
acirGetVerificationKey(acirComposerPtr: Ptr): Uint8Array {
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
906
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
907
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
908
|
+
const result = this.wasm.callWasmExport(
|
|
909
|
+
'acir_get_verification_key',
|
|
910
|
+
inArgs,
|
|
911
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
912
|
+
);
|
|
913
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
914
|
+
return out[0];
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
acirGetProvingKey(acirComposerPtr: Ptr, acirVec: Uint8Array, recursive: boolean): Uint8Array {
|
|
918
|
+
const inArgs = [acirComposerPtr, acirVec, recursive].map(serializeBufferable);
|
|
919
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
920
|
+
const result = this.wasm.callWasmExport(
|
|
921
|
+
'acir_get_proving_key',
|
|
922
|
+
inArgs,
|
|
923
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
924
|
+
);
|
|
925
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
926
|
+
return out[0];
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array): boolean {
|
|
930
|
+
const inArgs = [acirComposerPtr, proofBuf].map(serializeBufferable);
|
|
931
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
932
|
+
const result = this.wasm.callWasmExport(
|
|
933
|
+
'acir_verify_proof',
|
|
934
|
+
inArgs,
|
|
935
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
936
|
+
);
|
|
937
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
938
|
+
return out[0];
|
|
455
939
|
}
|
|
456
940
|
|
|
457
941
|
acirGetSolidityVerifier(acirComposerPtr: Ptr): string {
|
|
458
|
-
const
|
|
459
|
-
|
|
942
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
943
|
+
const outTypes: OutputType[] = [StringDeserializer()];
|
|
944
|
+
const result = this.wasm.callWasmExport(
|
|
945
|
+
'acir_get_solidity_verifier',
|
|
946
|
+
inArgs,
|
|
947
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
948
|
+
);
|
|
949
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
950
|
+
return out[0];
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): string {
|
|
954
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
955
|
+
const outTypes: OutputType[] = [StringDeserializer()];
|
|
956
|
+
const result = this.wasm.callWasmExport(
|
|
957
|
+
'acir_honk_solidity_verifier',
|
|
958
|
+
inArgs,
|
|
959
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
960
|
+
);
|
|
961
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
962
|
+
return out[0];
|
|
460
963
|
}
|
|
461
964
|
|
|
462
965
|
acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Fr[] {
|
|
463
|
-
const
|
|
464
|
-
|
|
966
|
+
const inArgs = [acirComposerPtr, proofBuf, numInnerPublicInputs].map(serializeBufferable);
|
|
967
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
968
|
+
const result = this.wasm.callWasmExport(
|
|
969
|
+
'acir_serialize_proof_into_fields',
|
|
970
|
+
inArgs,
|
|
971
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
972
|
+
);
|
|
973
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
974
|
+
return out[0];
|
|
465
975
|
}
|
|
466
976
|
|
|
467
977
|
acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): [Fr[], Fr] {
|
|
468
|
-
const
|
|
469
|
-
|
|
978
|
+
const inArgs = [acirComposerPtr].map(serializeBufferable);
|
|
979
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr), Fr];
|
|
980
|
+
const result = this.wasm.callWasmExport(
|
|
981
|
+
'acir_serialize_verification_key_into_fields',
|
|
982
|
+
inArgs,
|
|
983
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
984
|
+
);
|
|
985
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
986
|
+
return out as any;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
990
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
991
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
992
|
+
const result = this.wasm.callWasmExport(
|
|
993
|
+
'acir_prove_ultra_honk',
|
|
994
|
+
inArgs,
|
|
995
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
996
|
+
);
|
|
997
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
998
|
+
return out[0];
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
1002
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
1003
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1004
|
+
const result = this.wasm.callWasmExport(
|
|
1005
|
+
'acir_prove_ultra_keccak_honk',
|
|
1006
|
+
inArgs,
|
|
1007
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1008
|
+
);
|
|
1009
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1010
|
+
return out[0];
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
acirProveUltraKeccakZkHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
1014
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
1015
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1016
|
+
const result = this.wasm.callWasmExport(
|
|
1017
|
+
'acir_prove_ultra_keccak_zk_honk',
|
|
1018
|
+
inArgs,
|
|
1019
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1020
|
+
);
|
|
1021
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1022
|
+
return out[0];
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
acirProveUltraStarknetHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
1026
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
1027
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1028
|
+
const result = this.wasm.callWasmExport(
|
|
1029
|
+
'acir_prove_ultra_starknet_honk',
|
|
1030
|
+
inArgs,
|
|
1031
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1032
|
+
);
|
|
1033
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1034
|
+
return out[0];
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
acirProveUltraStarknetZkHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
1038
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
1039
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1040
|
+
const result = this.wasm.callWasmExport(
|
|
1041
|
+
'acir_prove_ultra_starknet_zk_honk',
|
|
1042
|
+
inArgs,
|
|
1043
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1044
|
+
);
|
|
1045
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1046
|
+
return out[0];
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
acirVerifyUltraHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
1050
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
1051
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1052
|
+
const result = this.wasm.callWasmExport(
|
|
1053
|
+
'acir_verify_ultra_honk',
|
|
1054
|
+
inArgs,
|
|
1055
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1056
|
+
);
|
|
1057
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1058
|
+
return out[0];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
1062
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
1063
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1064
|
+
const result = this.wasm.callWasmExport(
|
|
1065
|
+
'acir_verify_ultra_keccak_honk',
|
|
1066
|
+
inArgs,
|
|
1067
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1068
|
+
);
|
|
1069
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1070
|
+
return out[0];
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
acirVerifyUltraKeccakZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
1074
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
1075
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1076
|
+
const result = this.wasm.callWasmExport(
|
|
1077
|
+
'acir_verify_ultra_keccak_zk_honk',
|
|
1078
|
+
inArgs,
|
|
1079
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1080
|
+
);
|
|
1081
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1082
|
+
return out[0];
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
acirVerifyUltraStarknetHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
1086
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
1087
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1088
|
+
const result = this.wasm.callWasmExport(
|
|
1089
|
+
'acir_verify_ultra_starknet_honk',
|
|
1090
|
+
inArgs,
|
|
1091
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1092
|
+
);
|
|
1093
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1094
|
+
return out[0];
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
acirVerifyUltraStarknetZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
|
|
1098
|
+
const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
|
|
1099
|
+
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1100
|
+
const result = this.wasm.callWasmExport(
|
|
1101
|
+
'acir_verify_ultra_starknet_zk_honk',
|
|
1102
|
+
inArgs,
|
|
1103
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1104
|
+
);
|
|
1105
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1106
|
+
return out[0];
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
acirWriteVkUltraHonk(acirVec: Uint8Array): Uint8Array {
|
|
1110
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1111
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1112
|
+
const result = this.wasm.callWasmExport(
|
|
1113
|
+
'acir_write_vk_ultra_honk',
|
|
1114
|
+
inArgs,
|
|
1115
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1116
|
+
);
|
|
1117
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1118
|
+
return out[0];
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Uint8Array {
|
|
1122
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1123
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1124
|
+
const result = this.wasm.callWasmExport(
|
|
1125
|
+
'acir_write_vk_ultra_keccak_honk',
|
|
1126
|
+
inArgs,
|
|
1127
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1128
|
+
);
|
|
1129
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1130
|
+
return out[0];
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
acirWriteVkUltraKeccakZkHonk(acirVec: Uint8Array): Uint8Array {
|
|
1134
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1135
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1136
|
+
const result = this.wasm.callWasmExport(
|
|
1137
|
+
'acir_write_vk_ultra_keccak_zk_honk',
|
|
1138
|
+
inArgs,
|
|
1139
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1140
|
+
);
|
|
1141
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1142
|
+
return out[0];
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
acirWriteVkUltraStarknetHonk(acirVec: Uint8Array): Uint8Array {
|
|
1146
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1147
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1148
|
+
const result = this.wasm.callWasmExport(
|
|
1149
|
+
'acir_write_vk_ultra_starknet_honk',
|
|
1150
|
+
inArgs,
|
|
1151
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1152
|
+
);
|
|
1153
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1154
|
+
return out[0];
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
acirWriteVkUltraStarknetZkHonk(acirVec: Uint8Array): Uint8Array {
|
|
1158
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1159
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1160
|
+
const result = this.wasm.callWasmExport(
|
|
1161
|
+
'acir_write_vk_ultra_starknet_zk_honk',
|
|
1162
|
+
inArgs,
|
|
1163
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1164
|
+
);
|
|
1165
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1166
|
+
return out[0];
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Fr[] {
|
|
1170
|
+
const inArgs = [proofBuf].map(serializeBufferable);
|
|
1171
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
1172
|
+
const result = this.wasm.callWasmExport(
|
|
1173
|
+
'acir_proof_as_fields_ultra_honk',
|
|
1174
|
+
inArgs,
|
|
1175
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1176
|
+
);
|
|
1177
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1178
|
+
return out[0];
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
acirVkAsFieldsUltraHonk(vkBuf: Uint8Array): Fr[] {
|
|
1182
|
+
const inArgs = [vkBuf].map(serializeBufferable);
|
|
1183
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
1184
|
+
const result = this.wasm.callWasmExport(
|
|
1185
|
+
'acir_vk_as_fields_ultra_honk',
|
|
1186
|
+
inArgs,
|
|
1187
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1188
|
+
);
|
|
1189
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1190
|
+
return out[0];
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
acirVkAsFieldsMegaHonk(vkBuf: Uint8Array): Fr[] {
|
|
1194
|
+
const inArgs = [vkBuf].map(serializeBufferable);
|
|
1195
|
+
const outTypes: OutputType[] = [VectorDeserializer(Fr)];
|
|
1196
|
+
const result = this.wasm.callWasmExport(
|
|
1197
|
+
'acir_vk_as_fields_mega_honk',
|
|
1198
|
+
inArgs,
|
|
1199
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1200
|
+
);
|
|
1201
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1202
|
+
return out[0];
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
acirGatesAztecClient(ivcInputsBuf: Uint8Array): Uint8Array {
|
|
1206
|
+
const inArgs = [ivcInputsBuf].map(serializeBufferable);
|
|
1207
|
+
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1208
|
+
const result = this.wasm.callWasmExport(
|
|
1209
|
+
'acir_gates_aztec_client',
|
|
1210
|
+
inArgs,
|
|
1211
|
+
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1212
|
+
);
|
|
1213
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1214
|
+
return out[0];
|
|
470
1215
|
}
|
|
471
1216
|
}
|