@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.
Files changed (227) hide show
  1. package/README.md +69 -32
  2. package/package.json +56 -45
  3. package/src/barretenberg/__snapshots__/pedersen.test.ts.snap +156 -0
  4. package/src/barretenberg/__snapshots__/poseidon.test.ts.snap +40 -0
  5. package/src/barretenberg/backend.ts +378 -0
  6. package/src/barretenberg/blake2s.test.ts +70 -0
  7. package/src/{barretenberg_api → barretenberg}/common.test.ts +7 -5
  8. package/src/barretenberg/index.ts +204 -0
  9. package/src/barretenberg/pedersen.test.ts +62 -0
  10. package/src/barretenberg/poseidon.test.ts +39 -0
  11. package/src/barretenberg_api/index.ts +982 -415
  12. package/src/barretenberg_wasm/barretenberg_wasm_base/index.ts +138 -0
  13. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/index.ts +11 -0
  14. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/main.worker.ts +13 -0
  15. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/index.ts +21 -0
  16. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/main.worker.ts +19 -0
  17. package/src/{barretenberg_binder/heap_allocator_sync.ts → barretenberg_wasm/barretenberg_wasm_main/heap_allocator.ts} +20 -17
  18. package/src/barretenberg_wasm/barretenberg_wasm_main/index.ts +167 -0
  19. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/index.ts +11 -0
  20. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/thread.worker.ts +13 -0
  21. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/index.ts +21 -0
  22. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/thread.worker.ts +19 -0
  23. package/src/barretenberg_wasm/barretenberg_wasm_thread/index.ts +47 -0
  24. package/src/barretenberg_wasm/fetch_code/browser/barretenberg-threads.ts +3 -0
  25. package/src/barretenberg_wasm/fetch_code/browser/barretenberg.ts +3 -0
  26. package/src/barretenberg_wasm/fetch_code/browser/index.ts +34 -0
  27. package/src/barretenberg_wasm/fetch_code/index.ts +1 -0
  28. package/src/barretenberg_wasm/fetch_code/node/index.ts +34 -0
  29. package/src/barretenberg_wasm/fetch_code/wasm-module.d.ts +4 -0
  30. package/src/barretenberg_wasm/helpers/browser/index.ts +47 -0
  31. package/src/barretenberg_wasm/helpers/index.ts +1 -0
  32. package/src/barretenberg_wasm/{node → helpers/node}/index.ts +24 -15
  33. package/src/barretenberg_wasm/index.test.ts +45 -0
  34. package/src/barretenberg_wasm/index.ts +22 -1
  35. package/src/benchmark/index.ts +26 -0
  36. package/src/benchmark/timer.ts +45 -0
  37. package/src/bigint-array/index.ts +39 -17
  38. package/src/bindgen/index.ts +2 -2
  39. package/src/bindgen/mappings.ts +3 -2
  40. package/src/bindgen/typescript.ts +50 -25
  41. package/src/cbind/README.md +1 -0
  42. package/src/cbind/generate.ts +89 -0
  43. package/src/cbind/schema_compiler.ts +833 -0
  44. package/src/crs/browser/cached_net_crs.ts +41 -1
  45. package/src/crs/browser/index.ts +1 -1
  46. package/src/crs/index.ts +1 -1
  47. package/src/crs/net_crs.ts +114 -19
  48. package/src/crs/node/index.ts +96 -26
  49. package/src/index.html +1 -1
  50. package/src/index.ts +13 -5
  51. package/src/log/browser/index.ts +35 -0
  52. package/src/log/index.ts +1 -0
  53. package/src/log/node/index.ts +52 -0
  54. package/src/log/types.ts +6 -0
  55. package/src/main.ts +391 -168
  56. package/src/proof/index.ts +94 -0
  57. package/src/random/browser/index.ts +1 -1
  58. package/src/retry/index.ts +50 -0
  59. package/src/serialize/buffer_reader.ts +4 -1
  60. package/src/types/fields.ts +46 -18
  61. package/src/types/point.ts +4 -1
  62. package/dest/async_map/index.d.ts +0 -10
  63. package/dest/async_map/index.d.ts.map +0 -1
  64. package/dest/async_map/index.js +0 -16
  65. package/dest/barretenberg-threads.wasm +0 -0
  66. package/dest/barretenberg.wasm +0 -0
  67. package/dest/barretenberg_api/blake2s.test.d.ts +0 -2
  68. package/dest/barretenberg_api/blake2s.test.d.ts.map +0 -1
  69. package/dest/barretenberg_api/blake2s.test.js +0 -30
  70. package/dest/barretenberg_api/common.test.d.ts +0 -2
  71. package/dest/barretenberg_api/common.test.d.ts.map +0 -1
  72. package/dest/barretenberg_api/common.test.js +0 -18
  73. package/dest/barretenberg_api/index.d.ts +0 -103
  74. package/dest/barretenberg_api/index.d.ts.map +0 -1
  75. package/dest/barretenberg_api/index.js +0 -379
  76. package/dest/barretenberg_api/pedersen.test.d.ts +0 -2
  77. package/dest/barretenberg_api/pedersen.test.d.ts.map +0 -1
  78. package/dest/barretenberg_api/pedersen.test.js +0 -69
  79. package/dest/barretenberg_api/schnorr.test.d.ts +0 -2
  80. package/dest/barretenberg_api/schnorr.test.d.ts.map +0 -1
  81. package/dest/barretenberg_api/schnorr.test.js +0 -113
  82. package/dest/barretenberg_binder/heap_allocator.d.ts +0 -22
  83. package/dest/barretenberg_binder/heap_allocator.d.ts.map +0 -1
  84. package/dest/barretenberg_binder/heap_allocator.js +0 -59
  85. package/dest/barretenberg_binder/heap_allocator_sync.d.ts +0 -22
  86. package/dest/barretenberg_binder/heap_allocator_sync.d.ts.map +0 -1
  87. package/dest/barretenberg_binder/heap_allocator_sync.js +0 -58
  88. package/dest/barretenberg_binder/index.d.ts +0 -32
  89. package/dest/barretenberg_binder/index.d.ts.map +0 -1
  90. package/dest/barretenberg_binder/index.js +0 -73
  91. package/dest/barretenberg_wasm/barretenberg_wasm.d.ts +0 -50
  92. package/dest/barretenberg_wasm/barretenberg_wasm.d.ts.map +0 -1
  93. package/dest/barretenberg_wasm/barretenberg_wasm.js +0 -212
  94. package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts +0 -2
  95. package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts.map +0 -1
  96. package/dest/barretenberg_wasm/barretenberg_wasm.test.js +0 -43
  97. package/dest/barretenberg_wasm/browser/index.d.ts +0 -8
  98. package/dest/barretenberg_wasm/browser/index.d.ts.map +0 -1
  99. package/dest/barretenberg_wasm/browser/index.js +0 -26
  100. package/dest/barretenberg_wasm/browser/worker.d.ts +0 -2
  101. package/dest/barretenberg_wasm/browser/worker.d.ts.map +0 -1
  102. package/dest/barretenberg_wasm/browser/worker.js +0 -11
  103. package/dest/barretenberg_wasm/index.d.ts +0 -2
  104. package/dest/barretenberg_wasm/index.d.ts.map +0 -1
  105. package/dest/barretenberg_wasm/index.js +0 -2
  106. package/dest/barretenberg_wasm/node/index.d.ts +0 -17
  107. package/dest/barretenberg_wasm/node/index.d.ts.map +0 -1
  108. package/dest/barretenberg_wasm/node/index.js +0 -40
  109. package/dest/barretenberg_wasm/node/node_endpoint.d.ts +0 -8
  110. package/dest/barretenberg_wasm/node/node_endpoint.d.ts.map +0 -1
  111. package/dest/barretenberg_wasm/node/node_endpoint.js +0 -28
  112. package/dest/barretenberg_wasm/node/worker.d.ts +0 -2
  113. package/dest/barretenberg_wasm/node/worker.d.ts.map +0 -1
  114. package/dest/barretenberg_wasm/node/worker.js +0 -9
  115. package/dest/barretenberg_wasm.js +0 -2
  116. package/dest/barretenberg_wasm.js.LICENSE.txt +0 -5
  117. package/dest/bigint-array/index.d.ts +0 -3
  118. package/dest/bigint-array/index.d.ts.map +0 -1
  119. package/dest/bigint-array/index.js +0 -21
  120. package/dest/bindgen/function_declaration.d.ts +0 -11
  121. package/dest/bindgen/function_declaration.d.ts.map +0 -1
  122. package/dest/bindgen/function_declaration.js +0 -2
  123. package/dest/bindgen/index.d.ts +0 -2
  124. package/dest/bindgen/index.d.ts.map +0 -1
  125. package/dest/bindgen/index.js +0 -15
  126. package/dest/bindgen/mappings.d.ts +0 -4
  127. package/dest/bindgen/mappings.d.ts.map +0 -1
  128. package/dest/bindgen/mappings.js +0 -63
  129. package/dest/bindgen/rust.d.ts +0 -2
  130. package/dest/bindgen/rust.d.ts.map +0 -1
  131. package/dest/bindgen/rust.js +0 -43
  132. package/dest/bindgen/to_camel_case.d.ts +0 -2
  133. package/dest/bindgen/to_camel_case.d.ts.map +0 -1
  134. package/dest/bindgen/to_camel_case.js +0 -11
  135. package/dest/bindgen/typescript.d.ts +0 -2
  136. package/dest/bindgen/typescript.d.ts.map +0 -1
  137. package/dest/bindgen/typescript.js +0 -80
  138. package/dest/crs/browser/cached_net_crs.d.ts +0 -25
  139. package/dest/crs/browser/cached_net_crs.d.ts.map +0 -1
  140. package/dest/crs/browser/cached_net_crs.js +0 -54
  141. package/dest/crs/browser/index.d.ts +0 -2
  142. package/dest/crs/browser/index.d.ts.map +0 -1
  143. package/dest/crs/browser/index.js +0 -2
  144. package/dest/crs/index.d.ts +0 -2
  145. package/dest/crs/index.d.ts.map +0 -1
  146. package/dest/crs/index.js +0 -2
  147. package/dest/crs/net_crs.d.ts +0 -36
  148. package/dest/crs/net_crs.d.ts.map +0 -1
  149. package/dest/crs/net_crs.js +0 -59
  150. package/dest/crs/node/ignition_files_crs.d.ts +0 -37
  151. package/dest/crs/node/ignition_files_crs.d.ts.map +0 -1
  152. package/dest/crs/node/ignition_files_crs.js +0 -51
  153. package/dest/crs/node/index.d.ts +0 -21
  154. package/dest/crs/node/index.d.ts.map +0 -1
  155. package/dest/crs/node/index.js +0 -54
  156. package/dest/examples/simple.rawtest.d.ts +0 -2
  157. package/dest/examples/simple.rawtest.d.ts.map +0 -1
  158. package/dest/examples/simple.rawtest.js +0 -29
  159. package/dest/examples/simple.test.d.ts +0 -2
  160. package/dest/examples/simple.test.d.ts.map +0 -1
  161. package/dest/examples/simple.test.js +0 -22
  162. package/dest/factory/index.d.ts +0 -21
  163. package/dest/factory/index.d.ts.map +0 -1
  164. package/dest/factory/index.js +0 -34
  165. package/dest/index.d.ts +0 -6
  166. package/dest/index.d.ts.map +0 -1
  167. package/dest/index.html +0 -1
  168. package/dest/index.js +0 -6
  169. package/dest/main.d.ts +0 -10
  170. package/dest/main.d.ts.map +0 -1
  171. package/dest/main.js +0 -275
  172. package/dest/random/browser/index.d.ts +0 -2
  173. package/dest/random/browser/index.d.ts.map +0 -1
  174. package/dest/random/browser/index.js +0 -31
  175. package/dest/random/index.d.ts +0 -2
  176. package/dest/random/index.d.ts.map +0 -1
  177. package/dest/random/index.js +0 -2
  178. package/dest/random/node/index.d.ts +0 -2
  179. package/dest/random/node/index.d.ts.map +0 -1
  180. package/dest/random/node/index.js +0 -5
  181. package/dest/serialize/buffer_reader.d.ts +0 -28
  182. package/dest/serialize/buffer_reader.d.ts.map +0 -1
  183. package/dest/serialize/buffer_reader.js +0 -66
  184. package/dest/serialize/index.d.ts +0 -4
  185. package/dest/serialize/index.d.ts.map +0 -1
  186. package/dest/serialize/index.js +0 -4
  187. package/dest/serialize/output_type.d.ts +0 -11
  188. package/dest/serialize/output_type.d.ts.map +0 -1
  189. package/dest/serialize/output_type.js +0 -44
  190. package/dest/serialize/serialize.d.ts +0 -53
  191. package/dest/serialize/serialize.d.ts.map +0 -1
  192. package/dest/serialize/serialize.js +0 -139
  193. package/dest/simple_test.js +0 -2
  194. package/dest/simple_test.js.LICENSE.txt +0 -14
  195. package/dest/types/fields.d.ts +0 -33
  196. package/dest/types/fields.d.ts.map +0 -1
  197. package/dest/types/fields.js +0 -86
  198. package/dest/types/fixed_size_buffer.d.ts +0 -26
  199. package/dest/types/fixed_size_buffer.d.ts.map +0 -1
  200. package/dest/types/fixed_size_buffer.js +0 -54
  201. package/dest/types/index.d.ts +0 -6
  202. package/dest/types/index.d.ts.map +0 -1
  203. package/dest/types/index.js +0 -6
  204. package/dest/types/point.d.ts +0 -17
  205. package/dest/types/point.d.ts.map +0 -1
  206. package/dest/types/point.js +0 -32
  207. package/dest/types/ptr.d.ts +0 -13
  208. package/dest/types/ptr.d.ts.map +0 -1
  209. package/dest/types/ptr.js +0 -20
  210. package/dest/types/raw_buffer.d.ts +0 -3
  211. package/dest/types/raw_buffer.d.ts.map +0 -1
  212. package/dest/types/raw_buffer.js +0 -5
  213. package/src/barretenberg_api/blake2s.test.ts +0 -39
  214. package/src/barretenberg_api/pedersen.test.ts +0 -84
  215. package/src/barretenberg_api/schnorr.test.ts +0 -169
  216. package/src/barretenberg_binder/heap_allocator.ts +0 -62
  217. package/src/barretenberg_binder/index.ts +0 -76
  218. package/src/barretenberg_wasm/barretenberg_wasm.test.ts +0 -52
  219. package/src/barretenberg_wasm/barretenberg_wasm.ts +0 -246
  220. package/src/barretenberg_wasm/browser/index.ts +0 -32
  221. package/src/barretenberg_wasm/browser/worker.ts +0 -13
  222. package/src/barretenberg_wasm/node/worker.ts +0 -10
  223. package/src/crs/node/ignition_files_crs.ts +0 -60
  224. package/src/examples/simple.rawtest.ts +0 -37
  225. package/src/examples/simple.test.ts +0 -27
  226. package/src/factory/index.ts +0 -36
  227. /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 { BarretenbergBinder, BarretenbergBinderSync } from '../barretenberg_binder/index.js';
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, Fq, Point, Buffer32, Buffer128, Ptr } from '../types/index.js';
13
+ import { Fr, Point, Buffer32, Ptr } from '../types/index.js';
12
14
 
13
15
  export class BarretenbergApi {
14
- constructor(public binder: BarretenbergBinder) {}
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 destroy() {
17
- await this.binder.wasm.destroy();
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 pedersenInit(): Promise<void> {
21
- const result = await this.binder.callWasmExport('pedersen___init', [], []);
22
- return;
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 pedersenCompressFields(left: Fr, right: Fr): Promise<Fr> {
26
- const result = await this.binder.callWasmExport('pedersen___compress_fields', [left, right], [Fr]);
27
- return result[0];
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 pedersenPlookupCompressFields(left: Fr, right: Fr): Promise<Fr> {
31
- const result = await this.binder.callWasmExport('pedersen___plookup_compress_fields', [left, right], [Fr]);
32
- return result[0];
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 pedersenCompress(inputsBuffer: Fr[]): Promise<Fr> {
36
- const result = await this.binder.callWasmExport('pedersen___compress', [inputsBuffer], [Fr]);
37
- return result[0];
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 pedersenPlookupCompress(inputsBuffer: Fr[]): Promise<Fr> {
41
- const result = await this.binder.callWasmExport('pedersen___plookup_compress', [inputsBuffer], [Fr]);
42
- return result[0];
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 pedersenCompressWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
46
- const result = await this.binder.callWasmExport(
47
- 'pedersen___compress_with_hash_index',
48
- [inputsBuffer, hashIndex],
49
- [Fr],
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
- return result[0];
110
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
111
+ return out[0];
52
112
  }
53
113
 
54
- async pedersenCommit(inputsBuffer: Fr[]): Promise<Fr> {
55
- const result = await this.binder.callWasmExport('pedersen___commit', [inputsBuffer], [Fr]);
56
- return result[0];
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 pedersenPlookupCommit(inputsBuffer: Fr[]): Promise<Fr> {
60
- const result = await this.binder.callWasmExport('pedersen___plookup_commit', [inputsBuffer], [Fr]);
61
- return result[0];
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 pedersenPlookupCommitWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
65
- const result = await this.binder.callWasmExport(
66
- 'pedersen___plookup_commit_with_hash_index',
67
- [inputsBuffer, hashIndex],
68
- [Fr],
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
- return result[0];
146
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
147
+ return out[0];
71
148
  }
72
149
 
73
- async pedersenBufferToField(data: Uint8Array): Promise<Fr> {
74
- const result = await this.binder.callWasmExport('pedersen___buffer_to_field', [data], [Fr]);
75
- return result[0];
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 pedersenHashInit(): Promise<void> {
79
- const result = await this.binder.callWasmExport('pedersen_hash_init', [], []);
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 pedersenHashPair(left: Fr, right: Fr): Promise<Fr> {
84
- const result = await this.binder.callWasmExport('pedersen_hash_pair', [left, right], [Fr]);
85
- return result[0];
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 pedersenHashMultiple(inputsBuffer: Fr[]): Promise<Fr> {
89
- const result = await this.binder.callWasmExport('pedersen_hash_multiple', [inputsBuffer], [Fr]);
90
- return result[0];
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 pedersenHashMultipleWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
94
- const result = await this.binder.callWasmExport(
95
- 'pedersen_hash_multiple_with_hash_index',
96
- [inputsBuffer, hashIndex],
97
- [Fr],
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
- return result[0];
206
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
207
+ return;
100
208
  }
101
209
 
102
- async pedersenHashToTree(data: Fr[]): Promise<Fr[]> {
103
- const result = await this.binder.callWasmExport('pedersen_hash_to_tree', [data], [VectorDeserializer(Fr)]);
104
- return result[0];
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 blake2s(data: Uint8Array): Promise<Buffer32> {
108
- const result = await this.binder.callWasmExport('blake2s', [data], [Buffer32]);
109
- return result[0];
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 blake2sToField(data: Uint8Array): Promise<Fr> {
113
- const result = await this.binder.callWasmExport('blake2s_to_field_', [data], [Fr]);
114
- return result[0];
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 schnorrComputePublicKey(privateKey: Fr): Promise<Point> {
118
- const result = await this.binder.callWasmExport('schnorr_compute_public_key', [privateKey], [Point]);
119
- return result[0];
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 schnorrNegatePublicKey(publicKeyBuffer: Point): Promise<Point> {
123
- const result = await this.binder.callWasmExport('schnorr_negate_public_key', [publicKeyBuffer], [Point]);
124
- return result[0];
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 schnorrConstructSignature(message: Uint8Array, privateKey: Fr): Promise<[Buffer32, Buffer32]> {
128
- const result = await this.binder.callWasmExport(
129
- 'schnorr_construct_signature',
130
- [message, privateKey],
131
- [Buffer32, Buffer32],
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
- return result as any;
282
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
283
+ return;
134
284
  }
135
285
 
136
- async schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): Promise<boolean> {
137
- const result = await this.binder.callWasmExport(
138
- 'schnorr_verify_signature',
139
- [message, pubKey, sigS, sigE],
140
- [BoolDeserializer()],
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
- return result[0];
294
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
295
+ return;
143
296
  }
144
297
 
145
- async schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Promise<Buffer128> {
146
- const result = await this.binder.callWasmExport(
147
- 'schnorr_multisig_create_multisig_public_key',
148
- [privateKey],
149
- [Buffer128],
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
- return result[0];
306
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
307
+ return out[0];
152
308
  }
153
309
 
154
- async schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): Promise<[Point, boolean]> {
155
- const result = await this.binder.callWasmExport(
156
- 'schnorr_multisig_validate_and_combine_signer_pubkeys',
157
- [signerPubkeyBuf],
158
- [Point, BoolDeserializer()],
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
- return result as any;
318
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
319
+ return out[0];
161
320
  }
162
321
 
163
- async schnorrMultisigConstructSignatureRound1(): Promise<[Buffer128, Buffer128]> {
164
- const result = await this.binder.callWasmExport(
165
- 'schnorr_multisig_construct_signature_round_1',
166
- [],
167
- [Buffer128, Buffer128],
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
- return result as any;
330
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
331
+ return out[0];
170
332
  }
171
333
 
172
- async schnorrMultisigConstructSignatureRound2(
173
- message: Uint8Array,
174
- privateKey: Fq,
175
- signerRoundOnePrivateBuf: Buffer128,
176
- signerPubkeysBuf: Buffer128[],
177
- roundOnePublicBuf: Buffer128[],
178
- ): Promise<[Fq, boolean]> {
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
- return result as any;
342
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
343
+ return out[0];
185
344
  }
186
345
 
187
- async schnorrMultisigCombineSignatures(
188
- message: Uint8Array,
189
- signerPubkeysBuf: Buffer128[],
190
- roundOneBuf: Buffer128[],
191
- roundTwoBuf: Fr[],
192
- ): Promise<[Buffer32, Buffer32, boolean]> {
193
- const result = await this.binder.callWasmExport(
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
- return result as any;
354
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
355
+ return out[0];
199
356
  }
200
357
 
201
- async srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): Promise<void> {
202
- const result = await this.binder.callWasmExport('srs_init_srs', [pointsBuf, numPoints, g2PointBuf], []);
203
- return;
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 examplesSimpleCreateAndVerifyProof(): Promise<boolean> {
207
- const result = await this.binder.callWasmExport(
208
- 'examples_simple_create_and_verify_proof',
209
- [],
210
- [BoolDeserializer()],
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
- return result[0];
382
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
383
+ return out as any;
213
384
  }
214
385
 
215
- async testThreads(threads: number, iterations: number): Promise<number> {
216
- const result = await this.binder.callWasmExport('test_threads', [threads, iterations], [NumberDeserializer()]);
217
- return result[0];
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 testThreadAbort(): Promise<void> {
221
- const result = await this.binder.callWasmExport('test_thread_abort', [], []);
222
- return;
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 testAbort(): Promise<void> {
226
- const result = await this.binder.callWasmExport('test_abort', [], []);
227
- return;
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 commonInitSlabAllocator(circuitSize: number): Promise<void> {
231
- const result = await this.binder.callWasmExport('common_init_slab_allocator', [circuitSize], []);
232
- return;
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 acirGetCircuitSizes(constraintSystemBuf: Uint8Array): Promise<[number, number, number]> {
236
- const result = await this.binder.callWasmExport(
237
- 'acir_get_circuit_sizes',
238
- [constraintSystemBuf],
239
- [NumberDeserializer(), NumberDeserializer(), NumberDeserializer()],
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
- return result as any;
454
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
455
+ return out[0];
242
456
  }
243
457
 
244
- async acirNewAcirComposer(sizeHint: number): Promise<Ptr> {
245
- const result = await this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
246
- return result[0];
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 acirDeleteAcirComposer(acirComposerPtr: Ptr): Promise<void> {
250
- const result = await this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
251
- return;
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 acirCreateCircuit(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, sizeHint: number): Promise<void> {
255
- const result = await this.binder.callWasmExport(
256
- 'acir_create_circuit',
257
- [acirComposerPtr, constraintSystemBuf, sizeHint],
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
- return;
490
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
491
+ return out[0];
261
492
  }
262
493
 
263
- async acirInitProvingKey(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array): Promise<void> {
264
- const result = await this.binder.callWasmExport(
265
- 'acir_init_proving_key',
266
- [acirComposerPtr, constraintSystemBuf],
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
- return;
502
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
503
+ return out[0];
270
504
  }
271
505
 
272
- async acirCreateProof(
273
- acirComposerPtr: Ptr,
274
- constraintSystemBuf: Uint8Array,
275
- witnessBuf: Uint8Array,
276
- isRecursive: boolean,
277
- ): Promise<Uint8Array> {
278
- const result = await this.binder.callWasmExport(
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
- return result[0];
514
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
515
+ return out[0];
284
516
  }
285
517
 
286
- async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
287
- const result = await this.binder.callWasmExport('acir_load_verification_key', [acirComposerPtr, vkBuf], []);
288
- return;
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 acirInitVerificationKey(acirComposerPtr: Ptr): Promise<void> {
292
- const result = await this.binder.callWasmExport('acir_init_verification_key', [acirComposerPtr], []);
293
- return;
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 acirGetVerificationKey(acirComposerPtr: Ptr): Promise<Uint8Array> {
297
- const result = await this.binder.callWasmExport(
298
- 'acir_get_verification_key',
299
- [acirComposerPtr],
300
- [BufferDeserializer()],
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
- return result[0];
550
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
551
+ return out[0];
303
552
  }
304
553
 
305
- async acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array, isRecursive: boolean): Promise<boolean> {
306
- const result = await this.binder.callWasmExport(
307
- 'acir_verify_proof',
308
- [acirComposerPtr, proofBuf, isRecursive],
309
- [BoolDeserializer()],
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
- return result[0];
562
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
563
+ return out[0];
312
564
  }
313
565
 
314
- async acirGetSolidityVerifier(acirComposerPtr: Ptr): Promise<string> {
315
- const result = await this.binder.callWasmExport(
316
- 'acir_get_solidity_verifier',
317
- [acirComposerPtr],
318
- [StringDeserializer()],
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
- return result[0];
574
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
575
+ return out[0];
321
576
  }
322
577
 
323
- async acirSerializeProofIntoFields(
324
- acirComposerPtr: Ptr,
325
- proofBuf: Uint8Array,
326
- numInnerPublicInputs: number,
327
- ): Promise<Fr[]> {
328
- const result = await this.binder.callWasmExport(
329
- 'acir_serialize_proof_into_fields',
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
- return result[0];
586
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
587
+ return out[0];
334
588
  }
335
589
 
336
- async acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): Promise<[Fr[], Fr]> {
337
- const result = await this.binder.callWasmExport(
338
- 'acir_serialize_verification_key_into_fields',
339
- [acirComposerPtr],
340
- [VectorDeserializer(Fr), Fr],
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
- return result as any;
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(public binder: BarretenbergBinderSync) {}
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
- async destroy() {
350
- await this.binder.wasm.destroy();
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
- pedersenInit(): void {
354
- const result = this.binder.callWasmExport('pedersen___init', [], []);
355
- return;
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
- pedersenCompressFields(left: Fr, right: Fr): Fr {
359
- const result = this.binder.callWasmExport('pedersen___compress_fields', [left, right], [Fr]);
360
- return result[0];
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
- pedersenPlookupCompressFields(left: Fr, right: Fr): Fr {
364
- const result = this.binder.callWasmExport('pedersen___plookup_compress_fields', [left, right], [Fr]);
365
- return result[0];
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
- pedersenCompress(inputsBuffer: Fr[]): Fr {
369
- const result = this.binder.callWasmExport('pedersen___compress', [inputsBuffer], [Fr]);
370
- return result[0];
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
- pedersenPlookupCompress(inputsBuffer: Fr[]): Fr {
374
- const result = this.binder.callWasmExport('pedersen___plookup_compress', [inputsBuffer], [Fr]);
375
- return result[0];
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
- pedersenCompressWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
379
- const result = this.binder.callWasmExport('pedersen___compress_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
380
- return result[0];
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
- pedersenCommit(inputsBuffer: Fr[]): Fr {
384
- const result = this.binder.callWasmExport('pedersen___commit', [inputsBuffer], [Fr]);
385
- return result[0];
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
- pedersenPlookupCommit(inputsBuffer: Fr[]): Fr {
389
- const result = this.binder.callWasmExport('pedersen___plookup_commit', [inputsBuffer], [Fr]);
390
- return result[0];
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
- pedersenPlookupCommitWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
394
- const result = this.binder.callWasmExport(
395
- 'pedersen___plookup_commit_with_hash_index',
396
- [inputsBuffer, hashIndex],
397
- [Fr],
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
- return result[0];
757
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
758
+ return out[0];
400
759
  }
401
760
 
402
- pedersenBufferToField(data: Uint8Array): Fr {
403
- const result = this.binder.callWasmExport('pedersen___buffer_to_field', [data], [Fr]);
404
- return result[0];
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
- pedersenHashInit(): void {
408
- const result = this.binder.callWasmExport('pedersen_hash_init', [], []);
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
- pedersenHashPair(left: Fr, right: Fr): Fr {
413
- const result = this.binder.callWasmExport('pedersen_hash_pair', [left, right], [Fr]);
414
- return result[0];
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
- pedersenHashMultiple(inputsBuffer: Fr[]): Fr {
418
- const result = this.binder.callWasmExport('pedersen_hash_multiple', [inputsBuffer], [Fr]);
419
- return result[0];
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
- pedersenHashMultipleWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
423
- const result = this.binder.callWasmExport(
424
- 'pedersen_hash_multiple_with_hash_index',
425
- [inputsBuffer, hashIndex],
426
- [Fr],
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
- return result[0];
817
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
818
+ return;
429
819
  }
430
820
 
431
- pedersenHashToTree(data: Fr[]): Fr[] {
432
- const result = this.binder.callWasmExport('pedersen_hash_to_tree', [data], [VectorDeserializer(Fr)]);
433
- return result[0];
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
- blake2s(data: Uint8Array): Buffer32 {
437
- const result = this.binder.callWasmExport('blake2s', [data], [Buffer32]);
438
- return result[0];
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
- blake2sToField(data: Uint8Array): Fr {
442
- const result = this.binder.callWasmExport('blake2s_to_field_', [data], [Fr]);
443
- return result[0];
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
- schnorrComputePublicKey(privateKey: Fr): Point {
447
- const result = this.binder.callWasmExport('schnorr_compute_public_key', [privateKey], [Point]);
448
- return result[0];
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
- schnorrNegatePublicKey(publicKeyBuffer: Point): Point {
452
- const result = this.binder.callWasmExport('schnorr_negate_public_key', [publicKeyBuffer], [Point]);
453
- return result[0];
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
- schnorrConstructSignature(message: Uint8Array, privateKey: Fr): [Buffer32, Buffer32] {
457
- const result = this.binder.callWasmExport(
458
- 'schnorr_construct_signature',
459
- [message, privateKey],
460
- [Buffer32, Buffer32],
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
- return result as any;
889
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
890
+ return;
463
891
  }
464
892
 
465
- schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): boolean {
466
- const result = this.binder.callWasmExport(
467
- 'schnorr_verify_signature',
468
- [message, pubKey, sigS, sigE],
469
- [BoolDeserializer()],
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
- return result[0];
901
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
902
+ return;
472
903
  }
473
904
 
474
- schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Buffer128 {
475
- const result = this.binder.callWasmExport('schnorr_multisig_create_multisig_public_key', [privateKey], [Buffer128]);
476
- return result[0];
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
- schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): [Point, boolean] {
480
- const result = this.binder.callWasmExport(
481
- 'schnorr_multisig_validate_and_combine_signer_pubkeys',
482
- [signerPubkeyBuf],
483
- [Point, BoolDeserializer()],
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
- return result as any;
925
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
926
+ return out[0];
486
927
  }
487
928
 
488
- schnorrMultisigConstructSignatureRound1(): [Buffer128, Buffer128] {
489
- const result = this.binder.callWasmExport(
490
- 'schnorr_multisig_construct_signature_round_1',
491
- [],
492
- [Buffer128, Buffer128],
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
- return result as any;
937
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
938
+ return out[0];
495
939
  }
496
940
 
497
- schnorrMultisigConstructSignatureRound2(
498
- message: Uint8Array,
499
- privateKey: Fq,
500
- signerRoundOnePrivateBuf: Buffer128,
501
- signerPubkeysBuf: Buffer128[],
502
- roundOnePublicBuf: Buffer128[],
503
- ): [Fq, boolean] {
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
- return result as any;
949
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
950
+ return out[0];
510
951
  }
511
952
 
512
- schnorrMultisigCombineSignatures(
513
- message: Uint8Array,
514
- signerPubkeysBuf: Buffer128[],
515
- roundOneBuf: Buffer128[],
516
- roundTwoBuf: Fr[],
517
- ): [Buffer32, Buffer32, boolean] {
518
- const result = this.binder.callWasmExport(
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
- return result as any;
961
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
962
+ return out[0];
524
963
  }
525
964
 
526
- srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): void {
527
- const result = this.binder.callWasmExport('srs_init_srs', [pointsBuf, numPoints, g2PointBuf], []);
528
- return;
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
- examplesSimpleCreateAndVerifyProof(): boolean {
532
- const result = this.binder.callWasmExport('examples_simple_create_and_verify_proof', [], [BoolDeserializer()]);
533
- return result[0];
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
- testThreads(threads: number, iterations: number): number {
537
- const result = this.binder.callWasmExport('test_threads', [threads, iterations], [NumberDeserializer()]);
538
- return result[0];
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
- testThreadAbort(): void {
542
- const result = this.binder.callWasmExport('test_thread_abort', [], []);
543
- return;
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
- testAbort(): void {
547
- const result = this.binder.callWasmExport('test_abort', [], []);
548
- return;
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
- commonInitSlabAllocator(circuitSize: number): void {
552
- const result = this.binder.callWasmExport('common_init_slab_allocator', [circuitSize], []);
553
- return;
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
- acirGetCircuitSizes(constraintSystemBuf: Uint8Array): [number, number, number] {
557
- const result = this.binder.callWasmExport(
558
- 'acir_get_circuit_sizes',
559
- [constraintSystemBuf],
560
- [NumberDeserializer(), NumberDeserializer(), NumberDeserializer()],
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
- return result as any;
1045
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1046
+ return out[0];
563
1047
  }
564
1048
 
565
- acirNewAcirComposer(sizeHint: number): Ptr {
566
- const result = this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
567
- return result[0];
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
- acirDeleteAcirComposer(acirComposerPtr: Ptr): void {
571
- const result = this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
572
- return;
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
- acirCreateCircuit(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, sizeHint: number): void {
576
- const result = this.binder.callWasmExport(
577
- 'acir_create_circuit',
578
- [acirComposerPtr, constraintSystemBuf, sizeHint],
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
- return;
1081
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1082
+ return out[0];
582
1083
  }
583
1084
 
584
- acirInitProvingKey(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array): void {
585
- const result = this.binder.callWasmExport('acir_init_proving_key', [acirComposerPtr, constraintSystemBuf], []);
586
- return;
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
- acirCreateProof(
590
- acirComposerPtr: Ptr,
591
- constraintSystemBuf: Uint8Array,
592
- witnessBuf: Uint8Array,
593
- isRecursive: boolean,
594
- ): Uint8Array {
595
- const result = this.binder.callWasmExport(
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
- return result[0];
1105
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1106
+ return out[0];
601
1107
  }
602
1108
 
603
- acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
604
- const result = this.binder.callWasmExport('acir_load_verification_key', [acirComposerPtr, vkBuf], []);
605
- return;
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
- acirInitVerificationKey(acirComposerPtr: Ptr): void {
609
- const result = this.binder.callWasmExport('acir_init_verification_key', [acirComposerPtr], []);
610
- return;
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
- acirGetVerificationKey(acirComposerPtr: Ptr): Uint8Array {
614
- const result = this.binder.callWasmExport('acir_get_verification_key', [acirComposerPtr], [BufferDeserializer()]);
615
- return result[0];
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
- acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array, isRecursive: boolean): boolean {
619
- const result = this.binder.callWasmExport(
620
- 'acir_verify_proof',
621
- [acirComposerPtr, proofBuf, isRecursive],
622
- [BoolDeserializer()],
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
- return result[0];
1153
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1154
+ return out[0];
625
1155
  }
626
1156
 
627
- acirGetSolidityVerifier(acirComposerPtr: Ptr): string {
628
- const result = this.binder.callWasmExport('acir_get_solidity_verifier', [acirComposerPtr], [StringDeserializer()]);
629
- return result[0];
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
- acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Fr[] {
633
- const result = this.binder.callWasmExport(
634
- 'acir_serialize_proof_into_fields',
635
- [acirComposerPtr, proofBuf, numInnerPublicInputs],
636
- [VectorDeserializer(Fr)],
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
- return result[0];
1177
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1178
+ return out[0];
639
1179
  }
640
1180
 
641
- acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): [Fr[], Fr] {
642
- const result = this.binder.callWasmExport(
643
- 'acir_serialize_verification_key_into_fields',
644
- [acirComposerPtr],
645
- [VectorDeserializer(Fr), Fr],
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
- return result as any;
1213
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1214
+ return out[0];
648
1215
  }
649
1216
  }