@aztec/bb.js 0.0.1-alpha.7 → 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 -32
- package/package.json +56 -45
- 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 +982 -415
- 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 -1
- 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 +96 -26
- 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 +391 -168
- 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/ignition_files_crs.d.ts +0 -37
- package/dest/crs/node/ignition_files_crs.d.ts.map +0 -1
- package/dest/crs/node/ignition_files_crs.js +0 -51
- package/dest/crs/node/index.d.ts +0 -21
- package/dest/crs/node/index.d.ts.map +0 -1
- package/dest/crs/node/index.js +0 -54
- 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 -275
- 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/ignition_files_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,649 +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 {
|
|
3
|
+
import { BarretenbergWasmMain, BarretenbergWasmMainWorker } from '../barretenberg_wasm/barretenberg_wasm_main/index.js';
|
|
4
4
|
import {
|
|
5
5
|
BufferDeserializer,
|
|
6
6
|
NumberDeserializer,
|
|
7
7
|
VectorDeserializer,
|
|
8
8
|
BoolDeserializer,
|
|
9
9
|
StringDeserializer,
|
|
10
|
+
serializeBufferable,
|
|
11
|
+
OutputType,
|
|
10
12
|
} from '../serialize/index.js';
|
|
11
|
-
import { Fr,
|
|
13
|
+
import { Fr, Point, Buffer32, Ptr } from '../types/index.js';
|
|
12
14
|
|
|
13
15
|
export class BarretenbergApi {
|
|
14
|
-
constructor(
|
|
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
|
+
}
|
|
15
29
|
|
|
16
|
-
async
|
|
17
|
-
|
|
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];
|
|
18
40
|
}
|
|
19
41
|
|
|
20
|
-
async
|
|
21
|
-
const
|
|
22
|
-
|
|
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];
|
|
23
52
|
}
|
|
24
53
|
|
|
25
|
-
async
|
|
26
|
-
const
|
|
27
|
-
|
|
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];
|
|
28
64
|
}
|
|
29
65
|
|
|
30
|
-
async
|
|
31
|
-
const
|
|
32
|
-
|
|
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];
|
|
33
76
|
}
|
|
34
77
|
|
|
35
|
-
async
|
|
36
|
-
const
|
|
37
|
-
|
|
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];
|
|
38
88
|
}
|
|
39
89
|
|
|
40
|
-
async
|
|
41
|
-
const
|
|
42
|
-
|
|
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];
|
|
43
100
|
}
|
|
44
101
|
|
|
45
|
-
async
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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),
|
|
50
109
|
);
|
|
51
|
-
|
|
110
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
111
|
+
return out[0];
|
|
52
112
|
}
|
|
53
113
|
|
|
54
|
-
async
|
|
55
|
-
const
|
|
56
|
-
|
|
114
|
+
async blake2s(data: Uint8Array): Promise<Buffer32> {
|
|
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];
|
|
57
124
|
}
|
|
58
125
|
|
|
59
|
-
async
|
|
60
|
-
const
|
|
61
|
-
|
|
126
|
+
async blake2sToField(data: Uint8Array): Promise<Fr> {
|
|
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];
|
|
62
136
|
}
|
|
63
137
|
|
|
64
|
-
async
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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),
|
|
69
145
|
);
|
|
70
|
-
|
|
146
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
147
|
+
return out[0];
|
|
71
148
|
}
|
|
72
149
|
|
|
73
|
-
async
|
|
74
|
-
const
|
|
75
|
-
|
|
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];
|
|
76
160
|
}
|
|
77
161
|
|
|
78
|
-
async
|
|
79
|
-
const
|
|
162
|
+
async srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): Promise<void> {
|
|
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));
|
|
80
171
|
return;
|
|
81
172
|
}
|
|
82
173
|
|
|
83
|
-
async
|
|
84
|
-
const
|
|
85
|
-
|
|
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));
|
|
183
|
+
return;
|
|
86
184
|
}
|
|
87
185
|
|
|
88
|
-
async
|
|
89
|
-
const
|
|
90
|
-
|
|
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];
|
|
91
196
|
}
|
|
92
197
|
|
|
93
|
-
async
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
198
|
+
async commonInitSlabAllocator(circuitSize: number): Promise<void> {
|
|
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),
|
|
98
205
|
);
|
|
99
|
-
|
|
206
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
207
|
+
return;
|
|
100
208
|
}
|
|
101
209
|
|
|
102
|
-
async
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
105
224
|
}
|
|
106
225
|
|
|
107
|
-
async
|
|
108
|
-
const
|
|
109
|
-
|
|
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];
|
|
110
236
|
}
|
|
111
237
|
|
|
112
|
-
async
|
|
113
|
-
const
|
|
114
|
-
|
|
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];
|
|
115
248
|
}
|
|
116
249
|
|
|
117
|
-
async
|
|
118
|
-
const
|
|
119
|
-
|
|
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;
|
|
120
260
|
}
|
|
121
261
|
|
|
122
|
-
async
|
|
123
|
-
const
|
|
124
|
-
|
|
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];
|
|
125
272
|
}
|
|
126
273
|
|
|
127
|
-
async
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
274
|
+
async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
|
|
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),
|
|
132
281
|
);
|
|
133
|
-
|
|
282
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
283
|
+
return;
|
|
134
284
|
}
|
|
135
285
|
|
|
136
|
-
async
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
286
|
+
async acirInitVerificationKey(acirComposerPtr: Ptr): Promise<void> {
|
|
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),
|
|
141
293
|
);
|
|
142
|
-
|
|
294
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
295
|
+
return;
|
|
143
296
|
}
|
|
144
297
|
|
|
145
|
-
async
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
298
|
+
async acirGetVerificationKey(acirComposerPtr: Ptr): Promise<Uint8Array> {
|
|
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),
|
|
150
305
|
);
|
|
151
|
-
|
|
306
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
307
|
+
return out[0];
|
|
152
308
|
}
|
|
153
309
|
|
|
154
|
-
async
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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),
|
|
159
317
|
);
|
|
160
|
-
|
|
318
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
319
|
+
return out[0];
|
|
161
320
|
}
|
|
162
321
|
|
|
163
|
-
async
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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),
|
|
168
329
|
);
|
|
169
|
-
|
|
330
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
331
|
+
return out[0];
|
|
170
332
|
}
|
|
171
333
|
|
|
172
|
-
async
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const result = await this.binder.callWasmExport(
|
|
180
|
-
'schnorr_multisig_construct_signature_round_2',
|
|
181
|
-
[message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf],
|
|
182
|
-
[Fq, BoolDeserializer()],
|
|
334
|
+
async acirGetSolidityVerifier(acirComposerPtr: Ptr): Promise<string> {
|
|
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),
|
|
183
341
|
);
|
|
184
|
-
|
|
342
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
343
|
+
return out[0];
|
|
185
344
|
}
|
|
186
345
|
|
|
187
|
-
async
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
'schnorr_multisig_combine_signatures',
|
|
195
|
-
[message, signerPubkeysBuf, roundOneBuf, roundTwoBuf],
|
|
196
|
-
[Buffer32, Buffer32, BoolDeserializer()],
|
|
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),
|
|
197
353
|
);
|
|
198
|
-
|
|
354
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
355
|
+
return out[0];
|
|
199
356
|
}
|
|
200
357
|
|
|
201
|
-
async
|
|
202
|
-
|
|
203
|
-
|
|
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];
|
|
204
372
|
}
|
|
205
373
|
|
|
206
|
-
async
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
374
|
+
async acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): Promise<[Fr[], Fr]> {
|
|
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),
|
|
211
381
|
);
|
|
212
|
-
|
|
382
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
383
|
+
return out as any;
|
|
213
384
|
}
|
|
214
385
|
|
|
215
|
-
async
|
|
216
|
-
const
|
|
217
|
-
|
|
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];
|
|
218
396
|
}
|
|
219
397
|
|
|
220
|
-
async
|
|
221
|
-
const
|
|
222
|
-
|
|
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];
|
|
223
408
|
}
|
|
224
409
|
|
|
225
|
-
async
|
|
226
|
-
|
|
227
|
-
|
|
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];
|
|
228
424
|
}
|
|
229
425
|
|
|
230
|
-
async
|
|
231
|
-
|
|
232
|
-
|
|
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];
|
|
233
440
|
}
|
|
234
441
|
|
|
235
|
-
async
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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),
|
|
240
453
|
);
|
|
241
|
-
|
|
454
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
455
|
+
return out[0];
|
|
242
456
|
}
|
|
243
457
|
|
|
244
|
-
async
|
|
245
|
-
const
|
|
246
|
-
|
|
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];
|
|
247
468
|
}
|
|
248
469
|
|
|
249
|
-
async
|
|
250
|
-
const
|
|
251
|
-
|
|
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];
|
|
252
480
|
}
|
|
253
481
|
|
|
254
|
-
async
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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),
|
|
259
489
|
);
|
|
260
|
-
|
|
490
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
491
|
+
return out[0];
|
|
261
492
|
}
|
|
262
493
|
|
|
263
|
-
async
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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),
|
|
268
501
|
);
|
|
269
|
-
|
|
502
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
503
|
+
return out[0];
|
|
270
504
|
}
|
|
271
505
|
|
|
272
|
-
async
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
'acir_create_proof',
|
|
280
|
-
[acirComposerPtr, constraintSystemBuf, witnessBuf, isRecursive],
|
|
281
|
-
[BufferDeserializer()],
|
|
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),
|
|
282
513
|
);
|
|
283
|
-
|
|
514
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
515
|
+
return out[0];
|
|
284
516
|
}
|
|
285
517
|
|
|
286
|
-
async
|
|
287
|
-
const
|
|
288
|
-
|
|
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];
|
|
289
528
|
}
|
|
290
529
|
|
|
291
|
-
async
|
|
292
|
-
const
|
|
293
|
-
|
|
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];
|
|
294
540
|
}
|
|
295
541
|
|
|
296
|
-
async
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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),
|
|
301
549
|
);
|
|
302
|
-
|
|
550
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
551
|
+
return out[0];
|
|
303
552
|
}
|
|
304
553
|
|
|
305
|
-
async
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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),
|
|
310
561
|
);
|
|
311
|
-
|
|
562
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
563
|
+
return out[0];
|
|
312
564
|
}
|
|
313
565
|
|
|
314
|
-
async
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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),
|
|
319
573
|
);
|
|
320
|
-
|
|
574
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
575
|
+
return out[0];
|
|
321
576
|
}
|
|
322
577
|
|
|
323
|
-
async
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
[acirComposerPtr, proofBuf, numInnerPublicInputs],
|
|
331
|
-
[VectorDeserializer(Fr)],
|
|
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),
|
|
332
585
|
);
|
|
333
|
-
|
|
586
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
587
|
+
return out[0];
|
|
334
588
|
}
|
|
335
589
|
|
|
336
|
-
async
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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),
|
|
341
597
|
);
|
|
342
|
-
|
|
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];
|
|
343
612
|
}
|
|
344
|
-
}
|
|
345
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];
|
|
624
|
+
}
|
|
625
|
+
}
|
|
346
626
|
export class BarretenbergApiSync {
|
|
347
|
-
constructor(
|
|
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
|
+
}
|
|
348
640
|
|
|
349
|
-
|
|
350
|
-
|
|
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];
|
|
351
651
|
}
|
|
352
652
|
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
|
|
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];
|
|
356
663
|
}
|
|
357
664
|
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
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];
|
|
361
675
|
}
|
|
362
676
|
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
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];
|
|
366
687
|
}
|
|
367
688
|
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
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];
|
|
371
699
|
}
|
|
372
700
|
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
|
|
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];
|
|
376
711
|
}
|
|
377
712
|
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
|
|
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];
|
|
381
723
|
}
|
|
382
724
|
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
725
|
+
blake2s(data: Uint8Array): Buffer32 {
|
|
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];
|
|
386
735
|
}
|
|
387
736
|
|
|
388
|
-
|
|
389
|
-
const
|
|
390
|
-
|
|
737
|
+
blake2sToField(data: Uint8Array): Fr {
|
|
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];
|
|
391
747
|
}
|
|
392
748
|
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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),
|
|
398
756
|
);
|
|
399
|
-
|
|
757
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
758
|
+
return out[0];
|
|
400
759
|
}
|
|
401
760
|
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
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];
|
|
405
771
|
}
|
|
406
772
|
|
|
407
|
-
|
|
408
|
-
const
|
|
773
|
+
srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): void {
|
|
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));
|
|
409
782
|
return;
|
|
410
783
|
}
|
|
411
784
|
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
|
|
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));
|
|
794
|
+
return;
|
|
415
795
|
}
|
|
416
796
|
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
-
|
|
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];
|
|
420
807
|
}
|
|
421
808
|
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
809
|
+
commonInitSlabAllocator(circuitSize: number): void {
|
|
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),
|
|
427
816
|
);
|
|
428
|
-
|
|
817
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
818
|
+
return;
|
|
429
819
|
}
|
|
430
820
|
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
|
|
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;
|
|
434
831
|
}
|
|
435
832
|
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
|
|
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];
|
|
439
843
|
}
|
|
440
844
|
|
|
441
|
-
|
|
442
|
-
const
|
|
443
|
-
|
|
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];
|
|
444
855
|
}
|
|
445
856
|
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
|
|
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;
|
|
449
867
|
}
|
|
450
868
|
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
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];
|
|
454
879
|
}
|
|
455
880
|
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
881
|
+
acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
|
|
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),
|
|
461
888
|
);
|
|
462
|
-
|
|
889
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
890
|
+
return;
|
|
463
891
|
}
|
|
464
892
|
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
893
|
+
acirInitVerificationKey(acirComposerPtr: Ptr): void {
|
|
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),
|
|
470
900
|
);
|
|
471
|
-
|
|
901
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
902
|
+
return;
|
|
472
903
|
}
|
|
473
904
|
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
905
|
+
acirGetVerificationKey(acirComposerPtr: Ptr): Uint8Array {
|
|
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];
|
|
477
915
|
}
|
|
478
916
|
|
|
479
|
-
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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),
|
|
484
924
|
);
|
|
485
|
-
|
|
925
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
926
|
+
return out[0];
|
|
486
927
|
}
|
|
487
928
|
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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),
|
|
493
936
|
);
|
|
494
|
-
|
|
937
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
938
|
+
return out[0];
|
|
495
939
|
}
|
|
496
940
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const result = this.binder.callWasmExport(
|
|
505
|
-
'schnorr_multisig_construct_signature_round_2',
|
|
506
|
-
[message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf],
|
|
507
|
-
[Fq, BoolDeserializer()],
|
|
941
|
+
acirGetSolidityVerifier(acirComposerPtr: Ptr): string {
|
|
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),
|
|
508
948
|
);
|
|
509
|
-
|
|
949
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
950
|
+
return out[0];
|
|
510
951
|
}
|
|
511
952
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
'schnorr_multisig_combine_signatures',
|
|
520
|
-
[message, signerPubkeysBuf, roundOneBuf, roundTwoBuf],
|
|
521
|
-
[Buffer32, Buffer32, BoolDeserializer()],
|
|
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),
|
|
522
960
|
);
|
|
523
|
-
|
|
961
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
962
|
+
return out[0];
|
|
524
963
|
}
|
|
525
964
|
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
|
|
965
|
+
acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Fr[] {
|
|
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];
|
|
529
975
|
}
|
|
530
976
|
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
977
|
+
acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): [Fr[], Fr] {
|
|
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;
|
|
534
987
|
}
|
|
535
988
|
|
|
536
|
-
|
|
537
|
-
const
|
|
538
|
-
|
|
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];
|
|
539
999
|
}
|
|
540
1000
|
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
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];
|
|
544
1011
|
}
|
|
545
1012
|
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
|
|
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];
|
|
549
1023
|
}
|
|
550
1024
|
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
|
|
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];
|
|
554
1035
|
}
|
|
555
1036
|
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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),
|
|
561
1044
|
);
|
|
562
|
-
|
|
1045
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1046
|
+
return out[0];
|
|
563
1047
|
}
|
|
564
1048
|
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
|
|
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];
|
|
568
1059
|
}
|
|
569
1060
|
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
|
|
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];
|
|
573
1071
|
}
|
|
574
1072
|
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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),
|
|
580
1080
|
);
|
|
581
|
-
|
|
1081
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1082
|
+
return out[0];
|
|
582
1083
|
}
|
|
583
1084
|
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
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];
|
|
587
1095
|
}
|
|
588
1096
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
'acir_create_proof',
|
|
597
|
-
[acirComposerPtr, constraintSystemBuf, witnessBuf, isRecursive],
|
|
598
|
-
[BufferDeserializer()],
|
|
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),
|
|
599
1104
|
);
|
|
600
|
-
|
|
1105
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1106
|
+
return out[0];
|
|
601
1107
|
}
|
|
602
1108
|
|
|
603
|
-
|
|
604
|
-
const
|
|
605
|
-
|
|
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];
|
|
606
1119
|
}
|
|
607
1120
|
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
|
|
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];
|
|
611
1131
|
}
|
|
612
1132
|
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
|
|
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];
|
|
616
1143
|
}
|
|
617
1144
|
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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),
|
|
623
1152
|
);
|
|
624
|
-
|
|
1153
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1154
|
+
return out[0];
|
|
625
1155
|
}
|
|
626
1156
|
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
|
|
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];
|
|
630
1167
|
}
|
|
631
1168
|
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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),
|
|
637
1176
|
);
|
|
638
|
-
|
|
1177
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1178
|
+
return out[0];
|
|
639
1179
|
}
|
|
640
1180
|
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
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),
|
|
646
1212
|
);
|
|
647
|
-
|
|
1213
|
+
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1214
|
+
return out[0];
|
|
648
1215
|
}
|
|
649
1216
|
}
|