@aztec/bb.js 0.85.0-nightly.20250417 → 0.85.0-nightly.20250419

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 (48) hide show
  1. package/dest/browser/barretenberg/backend.d.ts +12 -8
  2. package/dest/browser/barretenberg/backend.d.ts.map +1 -1
  3. package/dest/browser/barretenberg-threads.js +1 -1
  4. package/dest/browser/barretenberg.js +1 -1
  5. package/dest/browser/barretenberg_api/index.d.ts +18 -27
  6. package/dest/browser/barretenberg_api/index.d.ts.map +1 -1
  7. package/dest/browser/index.js +2226 -254
  8. package/dest/node/barretenberg/backend.d.ts +12 -8
  9. package/dest/node/barretenberg/backend.d.ts.map +1 -1
  10. package/dest/node/barretenberg/backend.js +64 -15
  11. package/dest/node/barretenberg_api/index.d.ts +18 -27
  12. package/dest/node/barretenberg_api/index.d.ts.map +1 -1
  13. package/dest/node/barretenberg_api/index.js +110 -190
  14. package/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
  15. package/dest/node/bindgen/mappings.d.ts.map +1 -1
  16. package/dest/node/bindgen/mappings.js +2 -1
  17. package/dest/node/bindgen/typescript.d.ts.map +1 -1
  18. package/dest/node/bindgen/typescript.js +3 -2
  19. package/dest/node/main.d.ts +0 -1
  20. package/dest/node/main.d.ts.map +1 -1
  21. package/dest/node/main.js +41 -38
  22. package/dest/node-cjs/barretenberg/backend.d.ts +12 -8
  23. package/dest/node-cjs/barretenberg/backend.d.ts.map +1 -1
  24. package/dest/node-cjs/barretenberg/backend.js +64 -15
  25. package/dest/node-cjs/barretenberg_api/index.d.ts +18 -27
  26. package/dest/node-cjs/barretenberg_api/index.d.ts.map +1 -1
  27. package/dest/node-cjs/barretenberg_api/index.js +109 -189
  28. package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
  29. package/dest/node-cjs/bindgen/mappings.d.ts.map +1 -1
  30. package/dest/node-cjs/bindgen/mappings.js +2 -1
  31. package/dest/node-cjs/bindgen/typescript.d.ts.map +1 -1
  32. package/dest/node-cjs/bindgen/typescript.js +3 -2
  33. package/dest/node-cjs/main.d.ts +0 -1
  34. package/dest/node-cjs/main.d.ts.map +1 -1
  35. package/dest/node-cjs/main.js +42 -40
  36. package/package.json +2 -2
  37. package/src/barretenberg/backend.ts +86 -18
  38. package/src/barretenberg_api/index.ts +171 -338
  39. package/src/bindgen/mappings.ts +1 -0
  40. package/src/bindgen/typescript.ts +2 -1
  41. package/src/main.ts +43 -42
  42. package/dest/node/barretenberg/schnorr.test.d.ts +0 -2
  43. package/dest/node/barretenberg/schnorr.test.d.ts.map +0 -1
  44. package/dest/node/barretenberg/schnorr.test.js +0 -113
  45. package/dest/node-cjs/barretenberg/schnorr.test.d.ts +0 -2
  46. package/dest/node-cjs/barretenberg/schnorr.test.d.ts.map +0 -1
  47. package/dest/node-cjs/barretenberg/schnorr.test.js +0 -115
  48. package/src/barretenberg/schnorr.test.ts +0 -182
@@ -12,26 +12,6 @@ import {
12
12
  OutputType,
13
13
  } from '../serialize/index.js';
14
14
  import { Fr, Fq, Point, Buffer32, Buffer128, Ptr } from '../types/index.js';
15
- function parseBigEndianU32Array(buffer: Uint8Array, hasSizePrefix = false): number[] {
16
- const dv = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
17
-
18
- let offset = 0;
19
- let count = buffer.byteLength >>> 2; // default is entire buffer length / 4
20
-
21
- if (hasSizePrefix) {
22
- // Read the first 4 bytes as the size (big-endian).
23
- count = dv.getUint32(0, /* littleEndian= */ false);
24
- offset = 4;
25
- }
26
-
27
- const out: number[] = new Array(count);
28
- for (let i = 0; i < count; i++) {
29
- out[i] = dv.getUint32(offset, false);
30
- offset += 4;
31
- }
32
-
33
- return out;
34
- }
35
15
 
36
16
  export class BarretenbergApi {
37
17
  constructor(protected wasm: BarretenbergWasmWorker | BarretenbergWasmMain) {}
@@ -96,11 +76,11 @@ export class BarretenbergApi {
96
76
  return out[0];
97
77
  }
98
78
 
99
- async poseidon2HashAccumulate(inputsBuffer: Fr[]): Promise<Fr> {
79
+ async poseidon2Hashes(inputsBuffer: Fr[]): Promise<Fr> {
100
80
  const inArgs = [inputsBuffer].map(serializeBufferable);
101
81
  const outTypes: OutputType[] = [Fr];
102
82
  const result = await this.wasm.callWasmExport(
103
- 'poseidon2_hash_accumulate',
83
+ 'poseidon2_hashes',
104
84
  inArgs,
105
85
  outTypes.map(t => t.SIZE_IN_BYTES),
106
86
  );
@@ -108,11 +88,11 @@ export class BarretenbergApi {
108
88
  return out[0];
109
89
  }
110
90
 
111
- async poseidon2Hashes(inputsBuffer: Fr[]): Promise<Fr> {
91
+ async poseidon2Permutation(inputsBuffer: Fr[]): Promise<Fr[]> {
112
92
  const inArgs = [inputsBuffer].map(serializeBufferable);
113
- const outTypes: OutputType[] = [Fr];
93
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
114
94
  const result = await this.wasm.callWasmExport(
115
- 'poseidon2_hashes',
95
+ 'poseidon2_permutation',
116
96
  inArgs,
117
97
  outTypes.map(t => t.SIZE_IN_BYTES),
118
98
  );
@@ -120,11 +100,11 @@ export class BarretenbergApi {
120
100
  return out[0];
121
101
  }
122
102
 
123
- async poseidon2Permutation(inputsBuffer: Fr[]): Promise<Fr[]> {
103
+ async poseidon2HashAccumulate(inputsBuffer: Fr[]): Promise<Fr> {
124
104
  const inArgs = [inputsBuffer].map(serializeBufferable);
125
- const outTypes: OutputType[] = [VectorDeserializer(Fr)];
105
+ const outTypes: OutputType[] = [Fr];
126
106
  const result = await this.wasm.callWasmExport(
127
- 'poseidon2_permutation',
107
+ 'poseidon2_hash_accumulate',
128
108
  inArgs,
129
109
  outTypes.map(t => t.SIZE_IN_BYTES),
130
110
  );
@@ -156,127 +136,6 @@ export class BarretenbergApi {
156
136
  return out[0];
157
137
  }
158
138
 
159
- async schnorrComputePublicKey(privateKey: Fr): Promise<Point> {
160
- const inArgs = [privateKey].map(serializeBufferable);
161
- const outTypes: OutputType[] = [Point];
162
- const result = await this.wasm.callWasmExport(
163
- 'schnorr_compute_public_key',
164
- inArgs,
165
- outTypes.map(t => t.SIZE_IN_BYTES),
166
- );
167
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
168
- return out[0];
169
- }
170
-
171
- async schnorrNegatePublicKey(publicKeyBuffer: Point): Promise<Point> {
172
- const inArgs = [publicKeyBuffer].map(serializeBufferable);
173
- const outTypes: OutputType[] = [Point];
174
- const result = await this.wasm.callWasmExport(
175
- 'schnorr_negate_public_key',
176
- inArgs,
177
- outTypes.map(t => t.SIZE_IN_BYTES),
178
- );
179
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
180
- return out[0];
181
- }
182
-
183
- async schnorrConstructSignature(message: Uint8Array, privateKey: Fr): Promise<[Buffer32, Buffer32]> {
184
- const inArgs = [message, privateKey].map(serializeBufferable);
185
- const outTypes: OutputType[] = [Buffer32, Buffer32];
186
- const result = await this.wasm.callWasmExport(
187
- 'schnorr_construct_signature',
188
- inArgs,
189
- outTypes.map(t => t.SIZE_IN_BYTES),
190
- );
191
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
192
- return out as any;
193
- }
194
-
195
- async schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): Promise<boolean> {
196
- const inArgs = [message, pubKey, sigS, sigE].map(serializeBufferable);
197
- const outTypes: OutputType[] = [BoolDeserializer()];
198
- const result = await this.wasm.callWasmExport(
199
- 'schnorr_verify_signature',
200
- inArgs,
201
- outTypes.map(t => t.SIZE_IN_BYTES),
202
- );
203
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
204
- return out[0];
205
- }
206
-
207
- async schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Promise<Buffer128> {
208
- const inArgs = [privateKey].map(serializeBufferable);
209
- const outTypes: OutputType[] = [Buffer128];
210
- const result = await this.wasm.callWasmExport(
211
- 'schnorr_multisig_create_multisig_public_key',
212
- inArgs,
213
- outTypes.map(t => t.SIZE_IN_BYTES),
214
- );
215
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
216
- return out[0];
217
- }
218
-
219
- async schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): Promise<[Point, boolean]> {
220
- const inArgs = [signerPubkeyBuf].map(serializeBufferable);
221
- const outTypes: OutputType[] = [Point, BoolDeserializer()];
222
- const result = await this.wasm.callWasmExport(
223
- 'schnorr_multisig_validate_and_combine_signer_pubkeys',
224
- inArgs,
225
- outTypes.map(t => t.SIZE_IN_BYTES),
226
- );
227
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
228
- return out as any;
229
- }
230
-
231
- async schnorrMultisigConstructSignatureRound1(): Promise<[Buffer128, Buffer128]> {
232
- const inArgs = [].map(serializeBufferable);
233
- const outTypes: OutputType[] = [Buffer128, Buffer128];
234
- const result = await this.wasm.callWasmExport(
235
- 'schnorr_multisig_construct_signature_round_1',
236
- inArgs,
237
- outTypes.map(t => t.SIZE_IN_BYTES),
238
- );
239
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
240
- return out as any;
241
- }
242
-
243
- async schnorrMultisigConstructSignatureRound2(
244
- message: Uint8Array,
245
- privateKey: Fq,
246
- signerRoundOnePrivateBuf: Buffer128,
247
- signerPubkeysBuf: Buffer128[],
248
- roundOnePublicBuf: Buffer128[],
249
- ): Promise<[Fq, boolean]> {
250
- const inArgs = [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf].map(
251
- serializeBufferable,
252
- );
253
- const outTypes: OutputType[] = [Fq, BoolDeserializer()];
254
- const result = await this.wasm.callWasmExport(
255
- 'schnorr_multisig_construct_signature_round_2',
256
- inArgs,
257
- outTypes.map(t => t.SIZE_IN_BYTES),
258
- );
259
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
260
- return out as any;
261
- }
262
-
263
- async schnorrMultisigCombineSignatures(
264
- message: Uint8Array,
265
- signerPubkeysBuf: Buffer128[],
266
- roundOneBuf: Buffer128[],
267
- roundTwoBuf: Fq[],
268
- ): Promise<[Buffer32, Buffer32, boolean]> {
269
- const inArgs = [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf].map(serializeBufferable);
270
- const outTypes: OutputType[] = [Buffer32, Buffer32, BoolDeserializer()];
271
- const result = await this.wasm.callWasmExport(
272
- 'schnorr_multisig_combine_signatures',
273
- inArgs,
274
- outTypes.map(t => t.SIZE_IN_BYTES),
275
- );
276
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
277
- return out as any;
278
- }
279
-
280
139
  async aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Promise<Uint8Array> {
281
140
  const inArgs = [input, iv, key, length].map(serializeBufferable);
282
141
  const outTypes: OutputType[] = [BufferDeserializer()];
@@ -374,22 +233,7 @@ export class BarretenbergApi {
374
233
  outTypes.map(t => t.SIZE_IN_BYTES),
375
234
  );
376
235
  const out = result.map((r, i) => outTypes[i].fromBuffer(r));
377
- return out as [number, number];
378
- }
379
-
380
- async acirGatesAztecClient(
381
- // cf acirProveAztecClient
382
- acirVec: Uint8Array[],
383
- ): Promise<number[]> {
384
- const inArgs = [acirVec].map(serializeBufferable);
385
- const outTypes: OutputType[] = [BufferDeserializer()];
386
- const resultBuffer = await this.wasm.callWasmExport(
387
- 'acir_gates_aztec_client',
388
- inArgs,
389
- outTypes.map(t => t.SIZE_IN_BYTES),
390
- );
391
-
392
- return parseBigEndianU32Array(resultBuffer[0], /*hasSizePrefix=*/ true);
236
+ return out as any;
393
237
  }
394
238
 
395
239
  async acirNewAcirComposer(sizeHint: number): Promise<Ptr> {
@@ -445,10 +289,7 @@ export class BarretenbergApi {
445
289
  return out[0];
446
290
  }
447
291
 
448
- async acirProveAndVerifyUltraHonk(
449
- constraintSystemBuf: Uint8Array,
450
- witnessBuf: Uint8Array,
451
- ): Promise<boolean> {
292
+ async acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
452
293
  const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
453
294
  const outTypes: OutputType[] = [BoolDeserializer()];
454
295
  const result = await this.wasm.callWasmExport(
@@ -460,10 +301,7 @@ export class BarretenbergApi {
460
301
  return out[0];
461
302
  }
462
303
 
463
- async acirProveAndVerifyMegaHonk(
464
- constraintSystemBuf: Uint8Array,
465
- witnessBuf: Uint8Array,
466
- ): Promise<boolean> {
304
+ async acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
467
305
  const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
468
306
  const outTypes: OutputType[] = [BoolDeserializer()];
469
307
  const result = await this.wasm.callWasmExport(
@@ -475,6 +313,30 @@ export class BarretenbergApi {
475
313
  return out[0];
476
314
  }
477
315
 
316
+ async acirProveAztecClient(ivcInputsBuf: Uint8Array): Promise<[Uint8Array, Uint8Array]> {
317
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
318
+ const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
319
+ const result = await this.wasm.callWasmExport(
320
+ 'acir_prove_aztec_client',
321
+ inArgs,
322
+ outTypes.map(t => t.SIZE_IN_BYTES),
323
+ );
324
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
325
+ return out as any;
326
+ }
327
+
328
+ async acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
329
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
330
+ const outTypes: OutputType[] = [BoolDeserializer()];
331
+ const result = await this.wasm.callWasmExport(
332
+ 'acir_verify_aztec_client',
333
+ inArgs,
334
+ outTypes.map(t => t.SIZE_IN_BYTES),
335
+ );
336
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
337
+ return out[0];
338
+ }
339
+
478
340
  async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
479
341
  const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
480
342
  const outTypes: OutputType[] = [];
@@ -547,6 +409,18 @@ export class BarretenbergApi {
547
409
  return out[0];
548
410
  }
549
411
 
412
+ async acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<string> {
413
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
414
+ const outTypes: OutputType[] = [StringDeserializer()];
415
+ const result = await this.wasm.callWasmExport(
416
+ 'acir_honk_solidity_verifier',
417
+ inArgs,
418
+ outTypes.map(t => t.SIZE_IN_BYTES),
419
+ );
420
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
421
+ return out[0];
422
+ }
423
+
550
424
  async acirSerializeProofIntoFields(
551
425
  acirComposerPtr: Ptr,
552
426
  proofBuf: Uint8Array,
@@ -575,11 +449,11 @@ export class BarretenbergApi {
575
449
  return out as any;
576
450
  }
577
451
 
578
- async acirProveAndVerifyAztecClient(acirVec: Uint8Array[], witnessVec: Uint8Array[]): Promise<boolean> {
452
+ async acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
579
453
  const inArgs = [acirVec, witnessVec].map(serializeBufferable);
580
- const outTypes: OutputType[] = [BoolDeserializer()];
454
+ const outTypes: OutputType[] = [BufferDeserializer()];
581
455
  const result = await this.wasm.callWasmExport(
582
- 'acir_prove_and_verify_aztec_client',
456
+ 'acir_prove_ultra_honk',
583
457
  inArgs,
584
458
  outTypes.map(t => t.SIZE_IN_BYTES),
585
459
  );
@@ -587,23 +461,11 @@ export class BarretenbergApi {
587
461
  return out[0];
588
462
  }
589
463
 
590
- async acirProveAztecClient(acirVec: Uint8Array[], witnessVec: Uint8Array[]): Promise<[Uint8Array, Uint8Array]> {
464
+ async acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
591
465
  const inArgs = [acirVec, witnessVec].map(serializeBufferable);
592
- const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
593
- const result = await this.wasm.callWasmExport(
594
- 'acir_prove_aztec_client',
595
- inArgs,
596
- outTypes.map(t => t.SIZE_IN_BYTES),
597
- );
598
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
599
- return [out[0], out[1]];
600
- }
601
-
602
- async acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
603
- const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
604
- const outTypes: OutputType[] = [BoolDeserializer()];
466
+ const outTypes: OutputType[] = [BufferDeserializer()];
605
467
  const result = await this.wasm.callWasmExport(
606
- 'acir_verify_aztec_client',
468
+ 'acir_prove_ultra_keccak_honk',
607
469
  inArgs,
608
470
  outTypes.map(t => t.SIZE_IN_BYTES),
609
471
  );
@@ -611,11 +473,11 @@ export class BarretenbergApi {
611
473
  return out[0];
612
474
  }
613
475
 
614
- async acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
476
+ async acirProveUltraStarknetHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
615
477
  const inArgs = [acirVec, witnessVec].map(serializeBufferable);
616
478
  const outTypes: OutputType[] = [BufferDeserializer()];
617
479
  const result = await this.wasm.callWasmExport(
618
- 'acir_prove_ultra_honk',
480
+ 'acir_prove_ultra_starknet_honk',
619
481
  inArgs,
620
482
  outTypes.map(t => t.SIZE_IN_BYTES),
621
483
  );
@@ -623,11 +485,11 @@ export class BarretenbergApi {
623
485
  return out[0];
624
486
  }
625
487
 
626
- async acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
627
- const inArgs = [acirVec, witnessVec].map(serializeBufferable);
628
- const outTypes: OutputType[] = [BufferDeserializer()];
488
+ async acirVerifyUltraHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
489
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
490
+ const outTypes: OutputType[] = [BoolDeserializer()];
629
491
  const result = await this.wasm.callWasmExport(
630
- 'acir_prove_ultra_keccak_honk',
492
+ 'acir_verify_ultra_honk',
631
493
  inArgs,
632
494
  outTypes.map(t => t.SIZE_IN_BYTES),
633
495
  );
@@ -635,11 +497,11 @@ export class BarretenbergApi {
635
497
  return out[0];
636
498
  }
637
499
 
638
- async acirVerifyUltraHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
500
+ async acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
639
501
  const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
640
502
  const outTypes: OutputType[] = [BoolDeserializer()];
641
503
  const result = await this.wasm.callWasmExport(
642
- 'acir_verify_ultra_honk',
504
+ 'acir_verify_ultra_keccak_honk',
643
505
  inArgs,
644
506
  outTypes.map(t => t.SIZE_IN_BYTES),
645
507
  );
@@ -647,11 +509,11 @@ export class BarretenbergApi {
647
509
  return out[0];
648
510
  }
649
511
 
650
- async acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
512
+ async acirVerifyUltraStarknetHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
651
513
  const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
652
514
  const outTypes: OutputType[] = [BoolDeserializer()];
653
515
  const result = await this.wasm.callWasmExport(
654
- 'acir_verify_ultra_keccak_honk',
516
+ 'acir_verify_ultra_starknet_honk',
655
517
  inArgs,
656
518
  outTypes.map(t => t.SIZE_IN_BYTES),
657
519
  );
@@ -683,11 +545,11 @@ export class BarretenbergApi {
683
545
  return out[0];
684
546
  }
685
547
 
686
- async acirHonkSolidityVerifier(acirVec: Uint8Array, vkBuf: Uint8Array): Promise<string> {
687
- const inArgs = [acirVec, vkBuf].map(serializeBufferable);
548
+ async acirWriteVkUltraStarknetHonk(acirVec: Uint8Array): Promise<Uint8Array> {
549
+ const inArgs = [acirVec].map(serializeBufferable);
688
550
  const outTypes: OutputType[] = [BufferDeserializer()];
689
551
  const result = await this.wasm.callWasmExport(
690
- 'acir_honk_solidity_verifier',
552
+ 'acir_write_vk_ultra_starknet_honk',
691
553
  inArgs,
692
554
  outTypes.map(t => t.SIZE_IN_BYTES),
693
555
  );
@@ -730,6 +592,18 @@ export class BarretenbergApi {
730
592
  const out = result.map((r, i) => outTypes[i].fromBuffer(r));
731
593
  return out[0];
732
594
  }
595
+
596
+ async acirGatesAztecClient(ivcInputsBuf: Uint8Array): Promise<Uint8Array> {
597
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
598
+ const outTypes: OutputType[] = [BufferDeserializer()];
599
+ const result = await this.wasm.callWasmExport(
600
+ 'acir_gates_aztec_client',
601
+ inArgs,
602
+ outTypes.map(t => t.SIZE_IN_BYTES),
603
+ );
604
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
605
+ return out[0];
606
+ }
733
607
  }
734
608
  export class BarretenbergApiSync {
735
609
  constructor(protected wasm: BarretenbergWasm) {}
@@ -794,11 +668,11 @@ export class BarretenbergApiSync {
794
668
  return out[0];
795
669
  }
796
670
 
797
- poseidon2HashAccumulate(inputsBuffer: Fr[]): Fr {
671
+ poseidon2Hashes(inputsBuffer: Fr[]): Fr {
798
672
  const inArgs = [inputsBuffer].map(serializeBufferable);
799
673
  const outTypes: OutputType[] = [Fr];
800
674
  const result = this.wasm.callWasmExport(
801
- 'poseidon2_hash_accumulate',
675
+ 'poseidon2_hashes',
802
676
  inArgs,
803
677
  outTypes.map(t => t.SIZE_IN_BYTES),
804
678
  );
@@ -806,11 +680,11 @@ export class BarretenbergApiSync {
806
680
  return out[0];
807
681
  }
808
682
 
809
- poseidon2Hashes(inputsBuffer: Fr[]): Fr {
683
+ poseidon2Permutation(inputsBuffer: Fr[]): Fr[] {
810
684
  const inArgs = [inputsBuffer].map(serializeBufferable);
811
- const outTypes: OutputType[] = [Fr];
685
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
812
686
  const result = this.wasm.callWasmExport(
813
- 'poseidon2_hashes',
687
+ 'poseidon2_permutation',
814
688
  inArgs,
815
689
  outTypes.map(t => t.SIZE_IN_BYTES),
816
690
  );
@@ -818,11 +692,11 @@ export class BarretenbergApiSync {
818
692
  return out[0];
819
693
  }
820
694
 
821
- poseidon2Permutation(inputsBuffer: Fr[]): Fr[] {
695
+ poseidon2HashAccumulate(inputsBuffer: Fr[]): Fr {
822
696
  const inArgs = [inputsBuffer].map(serializeBufferable);
823
- const outTypes: OutputType[] = [VectorDeserializer(Fr)];
697
+ const outTypes: OutputType[] = [Fr];
824
698
  const result = this.wasm.callWasmExport(
825
- 'poseidon2_permutation',
699
+ 'poseidon2_hash_accumulate',
826
700
  inArgs,
827
701
  outTypes.map(t => t.SIZE_IN_BYTES),
828
702
  );
@@ -854,127 +728,6 @@ export class BarretenbergApiSync {
854
728
  return out[0];
855
729
  }
856
730
 
857
- schnorrComputePublicKey(privateKey: Fr): Point {
858
- const inArgs = [privateKey].map(serializeBufferable);
859
- const outTypes: OutputType[] = [Point];
860
- const result = this.wasm.callWasmExport(
861
- 'schnorr_compute_public_key',
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[0];
867
- }
868
-
869
- schnorrNegatePublicKey(publicKeyBuffer: Point): Point {
870
- const inArgs = [publicKeyBuffer].map(serializeBufferable);
871
- const outTypes: OutputType[] = [Point];
872
- const result = this.wasm.callWasmExport(
873
- 'schnorr_negate_public_key',
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];
879
- }
880
-
881
- schnorrConstructSignature(message: Uint8Array, privateKey: Fr): [Buffer32, Buffer32] {
882
- const inArgs = [message, privateKey].map(serializeBufferable);
883
- const outTypes: OutputType[] = [Buffer32, Buffer32];
884
- const result = this.wasm.callWasmExport(
885
- 'schnorr_construct_signature',
886
- inArgs,
887
- outTypes.map(t => t.SIZE_IN_BYTES),
888
- );
889
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
890
- return out as any;
891
- }
892
-
893
- schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): boolean {
894
- const inArgs = [message, pubKey, sigS, sigE].map(serializeBufferable);
895
- const outTypes: OutputType[] = [BoolDeserializer()];
896
- const result = this.wasm.callWasmExport(
897
- 'schnorr_verify_signature',
898
- inArgs,
899
- outTypes.map(t => t.SIZE_IN_BYTES),
900
- );
901
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
902
- return out[0];
903
- }
904
-
905
- schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Buffer128 {
906
- const inArgs = [privateKey].map(serializeBufferable);
907
- const outTypes: OutputType[] = [Buffer128];
908
- const result = this.wasm.callWasmExport(
909
- 'schnorr_multisig_create_multisig_public_key',
910
- inArgs,
911
- outTypes.map(t => t.SIZE_IN_BYTES),
912
- );
913
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
914
- return out[0];
915
- }
916
-
917
- schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): [Point, boolean] {
918
- const inArgs = [signerPubkeyBuf].map(serializeBufferable);
919
- const outTypes: OutputType[] = [Point, BoolDeserializer()];
920
- const result = this.wasm.callWasmExport(
921
- 'schnorr_multisig_validate_and_combine_signer_pubkeys',
922
- inArgs,
923
- outTypes.map(t => t.SIZE_IN_BYTES),
924
- );
925
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
926
- return out as any;
927
- }
928
-
929
- schnorrMultisigConstructSignatureRound1(): [Buffer128, Buffer128] {
930
- const inArgs = [].map(serializeBufferable);
931
- const outTypes: OutputType[] = [Buffer128, Buffer128];
932
- const result = this.wasm.callWasmExport(
933
- 'schnorr_multisig_construct_signature_round_1',
934
- inArgs,
935
- outTypes.map(t => t.SIZE_IN_BYTES),
936
- );
937
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
938
- return out as any;
939
- }
940
-
941
- schnorrMultisigConstructSignatureRound2(
942
- message: Uint8Array,
943
- privateKey: Fq,
944
- signerRoundOnePrivateBuf: Buffer128,
945
- signerPubkeysBuf: Buffer128[],
946
- roundOnePublicBuf: Buffer128[],
947
- ): [Fq, boolean] {
948
- const inArgs = [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf].map(
949
- serializeBufferable,
950
- );
951
- const outTypes: OutputType[] = [Fq, BoolDeserializer()];
952
- const result = this.wasm.callWasmExport(
953
- 'schnorr_multisig_construct_signature_round_2',
954
- inArgs,
955
- outTypes.map(t => t.SIZE_IN_BYTES),
956
- );
957
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
958
- return out as any;
959
- }
960
-
961
- schnorrMultisigCombineSignatures(
962
- message: Uint8Array,
963
- signerPubkeysBuf: Buffer128[],
964
- roundOneBuf: Buffer128[],
965
- roundTwoBuf: Fq[],
966
- ): [Buffer32, Buffer32, boolean] {
967
- const inArgs = [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf].map(serializeBufferable);
968
- const outTypes: OutputType[] = [Buffer32, Buffer32, BoolDeserializer()];
969
- const result = this.wasm.callWasmExport(
970
- 'schnorr_multisig_combine_signatures',
971
- inArgs,
972
- outTypes.map(t => t.SIZE_IN_BYTES),
973
- );
974
- const out = result.map((r, i) => outTypes[i].fromBuffer(r));
975
- return out as any;
976
- }
977
-
978
731
  aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Uint8Array {
979
732
  const inArgs = [input, iv, key, length].map(serializeBufferable);
980
733
  const outTypes: OutputType[] = [BufferDeserializer()];
@@ -1059,11 +812,7 @@ export class BarretenbergApiSync {
1059
812
  return;
1060
813
  }
1061
814
 
1062
- acirGetCircuitSizes(
1063
- constraintSystemBuf: Uint8Array,
1064
- recursive: boolean,
1065
- honkRecursion: boolean,
1066
- ): [number, number, number] {
815
+ acirGetCircuitSizes(constraintSystemBuf: Uint8Array, recursive: boolean, honkRecursion: boolean): [number, number] {
1067
816
  const inArgs = [constraintSystemBuf, recursive, honkRecursion].map(serializeBufferable);
1068
817
  const outTypes: OutputType[] = [NumberDeserializer(), NumberDeserializer()];
1069
818
  const result = this.wasm.callWasmExport(
@@ -1152,6 +901,30 @@ export class BarretenbergApiSync {
1152
901
  return out[0];
1153
902
  }
1154
903
 
904
+ acirProveAztecClient(ivcInputsBuf: Uint8Array): [Uint8Array, Uint8Array] {
905
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
906
+ const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
907
+ const result = this.wasm.callWasmExport(
908
+ 'acir_prove_aztec_client',
909
+ inArgs,
910
+ outTypes.map(t => t.SIZE_IN_BYTES),
911
+ );
912
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
913
+ return out as any;
914
+ }
915
+
916
+ acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
917
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
918
+ const outTypes: OutputType[] = [BoolDeserializer()];
919
+ const result = this.wasm.callWasmExport(
920
+ 'acir_verify_aztec_client',
921
+ inArgs,
922
+ outTypes.map(t => t.SIZE_IN_BYTES),
923
+ );
924
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
925
+ return out[0];
926
+ }
927
+
1155
928
  acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
1156
929
  const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
1157
930
  const outTypes: OutputType[] = [];
@@ -1224,6 +997,18 @@ export class BarretenbergApiSync {
1224
997
  return out[0];
1225
998
  }
1226
999
 
1000
+ acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): string {
1001
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1002
+ const outTypes: OutputType[] = [StringDeserializer()];
1003
+ const result = this.wasm.callWasmExport(
1004
+ 'acir_honk_solidity_verifier',
1005
+ inArgs,
1006
+ outTypes.map(t => t.SIZE_IN_BYTES),
1007
+ );
1008
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1009
+ return out[0];
1010
+ }
1011
+
1227
1012
  acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Fr[] {
1228
1013
  const inArgs = [acirComposerPtr, proofBuf, numInnerPublicInputs].map(serializeBufferable);
1229
1014
  const outTypes: OutputType[] = [VectorDeserializer(Fr)];
@@ -1260,6 +1045,18 @@ export class BarretenbergApiSync {
1260
1045
  return out[0];
1261
1046
  }
1262
1047
 
1048
+ acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
1049
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
1050
+ const outTypes: OutputType[] = [BufferDeserializer()];
1051
+ const result = this.wasm.callWasmExport(
1052
+ 'acir_prove_ultra_keccak_honk',
1053
+ inArgs,
1054
+ outTypes.map(t => t.SIZE_IN_BYTES),
1055
+ );
1056
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1057
+ return out[0];
1058
+ }
1059
+
1263
1060
  acirVerifyUltraHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1264
1061
  const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1265
1062
  const outTypes: OutputType[] = [BoolDeserializer()];
@@ -1272,6 +1069,18 @@ export class BarretenbergApiSync {
1272
1069
  return out[0];
1273
1070
  }
1274
1071
 
1072
+ acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1073
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1074
+ const outTypes: OutputType[] = [BoolDeserializer()];
1075
+ const result = this.wasm.callWasmExport(
1076
+ 'acir_verify_ultra_keccak_honk',
1077
+ inArgs,
1078
+ outTypes.map(t => t.SIZE_IN_BYTES),
1079
+ );
1080
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1081
+ return out[0];
1082
+ }
1083
+
1275
1084
  acirWriteVkUltraHonk(acirVec: Uint8Array): Uint8Array {
1276
1085
  const inArgs = [acirVec].map(serializeBufferable);
1277
1086
  const outTypes: OutputType[] = [BufferDeserializer()];
@@ -1284,6 +1093,18 @@ export class BarretenbergApiSync {
1284
1093
  return out[0];
1285
1094
  }
1286
1095
 
1096
+ acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Uint8Array {
1097
+ const inArgs = [acirVec].map(serializeBufferable);
1098
+ const outTypes: OutputType[] = [BufferDeserializer()];
1099
+ const result = this.wasm.callWasmExport(
1100
+ 'acir_write_vk_ultra_keccak_honk',
1101
+ inArgs,
1102
+ outTypes.map(t => t.SIZE_IN_BYTES),
1103
+ );
1104
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1105
+ return out[0];
1106
+ }
1107
+
1287
1108
  acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Fr[] {
1288
1109
  const inArgs = [proofBuf].map(serializeBufferable);
1289
1110
  const outTypes: OutputType[] = [VectorDeserializer(Fr)];
@@ -1319,4 +1140,16 @@ export class BarretenbergApiSync {
1319
1140
  const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1320
1141
  return out[0];
1321
1142
  }
1143
+
1144
+ acirGatesAztecClient(ivcInputsBuf: Uint8Array): Uint8Array {
1145
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
1146
+ const outTypes: OutputType[] = [BufferDeserializer()];
1147
+ const result = this.wasm.callWasmExport(
1148
+ 'acir_gates_aztec_client',
1149
+ inArgs,
1150
+ outTypes.map(t => t.SIZE_IN_BYTES),
1151
+ );
1152
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1153
+ return out[0];
1154
+ }
1322
1155
  }