@aztec/bb.js 0.86.0-starknet.1 → 0.87.0

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 (105) hide show
  1. package/dest/browser/barretenberg-threads.js +1 -1
  2. package/dest/browser/barretenberg.js +1 -1
  3. package/dest/browser/index.js +125 -209
  4. package/dest/browser/main.worker.js +116 -116
  5. package/dest/browser/thread.worker.js +116 -116
  6. package/dest/node/barretenberg/backend.d.ts.map +1 -1
  7. package/dest/node/barretenberg/backend.js +1 -1
  8. package/dest/node/barretenberg/index.d.ts.map +1 -1
  9. package/dest/node/barretenberg/index.js +5 -5
  10. package/dest/node/barretenberg/verifier.d.ts +0 -2
  11. package/dest/node/barretenberg/verifier.d.ts.map +1 -1
  12. package/dest/node/barretenberg/verifier.js +2 -12
  13. package/dest/node/barretenberg_api/index.d.ts +0 -10
  14. package/dest/node/barretenberg_api/index.d.ts.map +1 -1
  15. package/dest/node/barretenberg_api/index.js +2 -72
  16. package/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
  17. package/dest/node/bigint-array/index.d.ts +1 -0
  18. package/dest/node/bigint-array/index.d.ts.map +1 -1
  19. package/dest/node/bindgen/mappings.js +2 -2
  20. package/dest/node/bindgen/typescript.js +1 -1
  21. package/dest/node/crs/net_crs.d.ts.map +1 -1
  22. package/dest/node/crs/net_crs.js +6 -7
  23. package/dest/node/crs/node/index.js +4 -4
  24. package/dest/node/main.d.ts +0 -8
  25. package/dest/node/main.d.ts.map +1 -1
  26. package/dest/node/main.js +3 -193
  27. package/dest/node/proof/index.d.ts +0 -1
  28. package/dest/node/proof/index.d.ts.map +1 -1
  29. package/dest/node/proof/index.js +1 -8
  30. package/dest/node/serialize/buffer_reader.d.ts.map +1 -1
  31. package/dest/node/serialize/buffer_reader.js +1 -1
  32. package/dest/node/types/fields.d.ts +1 -0
  33. package/dest/node/types/fields.d.ts.map +1 -1
  34. package/dest/node/types/fields.js +1 -1
  35. package/dest/node/types/point.d.ts +1 -0
  36. package/dest/node/types/point.d.ts.map +1 -1
  37. package/dest/node/types/point.js +1 -1
  38. package/dest/node-cjs/barretenberg/backend.d.ts.map +1 -1
  39. package/dest/node-cjs/barretenberg/backend.js +1 -1
  40. package/dest/node-cjs/barretenberg/index.d.ts.map +1 -1
  41. package/dest/node-cjs/barretenberg/index.js +5 -5
  42. package/dest/node-cjs/barretenberg/verifier.d.ts +0 -2
  43. package/dest/node-cjs/barretenberg/verifier.d.ts.map +1 -1
  44. package/dest/node-cjs/barretenberg/verifier.js +1 -11
  45. package/dest/node-cjs/barretenberg_api/index.d.ts +0 -10
  46. package/dest/node-cjs/barretenberg_api/index.d.ts.map +1 -1
  47. package/dest/node-cjs/barretenberg_api/index.js +1 -71
  48. package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
  49. package/dest/node-cjs/bigint-array/index.d.ts +1 -0
  50. package/dest/node-cjs/bigint-array/index.d.ts.map +1 -1
  51. package/dest/node-cjs/bindgen/mappings.js +2 -2
  52. package/dest/node-cjs/bindgen/typescript.js +1 -1
  53. package/dest/node-cjs/crs/net_crs.d.ts.map +1 -1
  54. package/dest/node-cjs/crs/net_crs.js +6 -7
  55. package/dest/node-cjs/crs/node/index.js +4 -4
  56. package/dest/node-cjs/main.d.ts +0 -8
  57. package/dest/node-cjs/main.d.ts.map +1 -1
  58. package/dest/node-cjs/main.js +4 -202
  59. package/dest/node-cjs/proof/index.d.ts +0 -1
  60. package/dest/node-cjs/proof/index.d.ts.map +1 -1
  61. package/dest/node-cjs/proof/index.js +2 -10
  62. package/dest/node-cjs/serialize/buffer_reader.d.ts.map +1 -1
  63. package/dest/node-cjs/serialize/buffer_reader.js +1 -1
  64. package/dest/node-cjs/types/fields.d.ts +1 -0
  65. package/dest/node-cjs/types/fields.d.ts.map +1 -1
  66. package/dest/node-cjs/types/fields.js +1 -1
  67. package/dest/node-cjs/types/point.d.ts +1 -0
  68. package/dest/node-cjs/types/point.d.ts.map +1 -1
  69. package/dest/node-cjs/types/point.js +1 -1
  70. package/package.json +7 -8
  71. package/src/barretenberg/backend.ts +24 -22
  72. package/src/barretenberg/index.ts +9 -5
  73. package/src/barretenberg/verifier.ts +1 -13
  74. package/src/barretenberg_api/index.ts +0 -128
  75. package/src/bindgen/mappings.ts +1 -1
  76. package/src/bindgen/typescript.ts +4 -4
  77. package/src/crs/net_crs.ts +5 -6
  78. package/src/crs/node/index.ts +3 -3
  79. package/src/index.html +1 -1
  80. package/src/main.ts +14 -230
  81. package/src/proof/index.ts +0 -12
  82. package/src/serialize/buffer_reader.ts +4 -1
  83. package/src/types/fields.ts +2 -2
  84. package/src/types/point.ts +4 -1
  85. package/dest/node/crs/node/ignition_files_crs.d.ts +0 -38
  86. package/dest/node/crs/node/ignition_files_crs.d.ts.map +0 -1
  87. package/dest/node/crs/node/ignition_files_crs.js +0 -65
  88. package/dest/node/examples/simple.rawtest.d.ts +0 -2
  89. package/dest/node/examples/simple.rawtest.d.ts.map +0 -1
  90. package/dest/node/examples/simple.rawtest.js +0 -30
  91. package/dest/node/examples/simple.test.d.ts +0 -2
  92. package/dest/node/examples/simple.test.d.ts.map +0 -1
  93. package/dest/node/examples/simple.test.js +0 -23
  94. package/dest/node-cjs/crs/node/ignition_files_crs.d.ts +0 -38
  95. package/dest/node-cjs/crs/node/ignition_files_crs.d.ts.map +0 -1
  96. package/dest/node-cjs/crs/node/ignition_files_crs.js +0 -69
  97. package/dest/node-cjs/examples/simple.rawtest.d.ts +0 -2
  98. package/dest/node-cjs/examples/simple.rawtest.d.ts.map +0 -1
  99. package/dest/node-cjs/examples/simple.rawtest.js +0 -33
  100. package/dest/node-cjs/examples/simple.test.d.ts +0 -2
  101. package/dest/node-cjs/examples/simple.test.d.ts.map +0 -1
  102. package/dest/node-cjs/examples/simple.test.js +0 -25
  103. package/src/crs/node/ignition_files_crs.ts +0 -74
  104. package/src/examples/simple.rawtest.ts +0 -38
  105. package/src/examples/simple.test.ts +0 -28
package/src/main.ts CHANGED
@@ -11,13 +11,6 @@ import { UltraHonkBackendOptions } from './barretenberg/backend.js';
11
11
  createDebug.log = console.error.bind(console);
12
12
  const debug = createDebug('bb.js');
13
13
 
14
- // Maximum circuit size for plonk we support in node and the browser is 2^19.
15
- // This is because both node and browser use barretenberg.wasm which has a 4GB memory limit.
16
- //
17
- // This is not a restriction in the bb binary and one should be
18
- // aware of this discrepancy, when creating proofs in bb versus
19
- // creating the same proofs in the node CLI.
20
- const MAX_ULTRAPLONK_CIRCUIT_SIZE_IN_WASM = 2 ** 19;
21
14
  const threads = +process.env.HARDWARE_CONCURRENCY! || undefined;
22
15
 
23
16
  function getBytecode(bytecodePath: string): Uint8Array {
@@ -63,39 +56,6 @@ async function computeCircuitSize(bytecodePath: string, recursive: boolean, honk
63
56
  return { total, subgroup };
64
57
  }
65
58
 
66
- async function initUltraPlonk(
67
- bytecodePath: string,
68
- recursive: boolean,
69
- crsPath: string,
70
- subgroupSizeOverride = -1,
71
- honkRecursion = false,
72
- ) {
73
- const api = await Barretenberg.new({ threads });
74
-
75
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1248): Get rid of this call to avoid building the circuit twice.
76
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1126): use specific UltraPlonk function
77
- const circuitSize = await getGatesUltra(bytecodePath, recursive, honkRecursion, api);
78
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/811): remove subgroupSizeOverride hack for goblin
79
- const subgroupSize = Math.max(subgroupSizeOverride, Math.pow(2, Math.ceil(Math.log2(circuitSize))));
80
-
81
- if (subgroupSize > MAX_ULTRAPLONK_CIRCUIT_SIZE_IN_WASM) {
82
- throw new Error(`Circuit size of ${subgroupSize} exceeds max supported of ${MAX_ULTRAPLONK_CIRCUIT_SIZE_IN_WASM}`);
83
- }
84
- debug(`Loading CRS for UltraPlonk with circuit-size=${circuitSize} subgroup-size=${subgroupSize}`);
85
- // Plus 1 needed! (Move +1 into Crs?)
86
- const crs = await Crs.new(subgroupSize + 1, crsPath);
87
-
88
- // // Important to init slab allocator as first thing, to ensure maximum memory efficiency for Plonk.
89
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1129): Do slab allocator initialization?
90
- // await api.commonInitSlabAllocator(subgroupSize);
91
-
92
- // Load CRS into wasm global CRS state.
93
- // TODO: Make RawBuffer be default behavior, and have a specific Vector type for when wanting length prefixed.
94
- await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
95
- const acirComposer = await api.acirNewAcirComposer(subgroupSize);
96
- return { api, acirComposer, circuitSize, subgroupSize };
97
- }
98
-
99
59
  async function initUltraHonk(bytecodePath: string, crsPath: string) {
100
60
  const api = await Barretenberg.new({ threads });
101
61
 
@@ -138,38 +98,7 @@ async function initLite(crsPath: string) {
138
98
  // Load CRS into wasm global CRS state.
139
99
  await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
140
100
 
141
- const acirComposer = await api.acirNewAcirComposer(0);
142
- return { api, acirComposer };
143
- }
144
-
145
- export async function proveAndVerify(bytecodePath: string, recursive: boolean, witnessPath: string, crsPath: string) {
146
- /* eslint-disable camelcase */
147
- const acir_test = path.basename(process.cwd());
148
-
149
- const { api, acirComposer, circuitSize, subgroupSize } = await initUltraPlonk(bytecodePath, recursive, crsPath);
150
- try {
151
- debug(`Creating proof bytecode=${bytecodePath} witness=${witnessPath} recursive=${recursive}`);
152
- const bytecode = getBytecode(bytecodePath);
153
- const witness = getWitness(witnessPath);
154
-
155
- const pkTimer = new Timer();
156
- await api.acirInitProvingKey(acirComposer, bytecode, recursive);
157
- writeBenchmark('pk_construction_time', pkTimer.ms(), { acir_test, threads });
158
- writeBenchmark('gate_count', circuitSize, { acir_test, threads });
159
- writeBenchmark('subgroup_size', subgroupSize, { acir_test, threads });
160
-
161
- const proofTimer = new Timer();
162
- const proof = await api.acirCreateProof(acirComposer, bytecode, recursive, witness);
163
- writeBenchmark('proof_construction_time', proofTimer.ms(), { acir_test, threads });
164
-
165
- debug(`Proof complete. Verifying.`);
166
- const verified = await api.acirVerifyProof(acirComposer, proof);
167
- debug(`Verification ${verified ? 'successful' : 'failed'}`);
168
- return verified;
169
- } finally {
170
- await api.destroy();
171
- }
172
- /* eslint-enable camelcase */
101
+ return { api };
173
102
  }
174
103
 
175
104
  export async function proveAndVerifyUltraHonk(bytecodePath: string, witnessPath: string, crsPath: string) {
@@ -189,7 +118,7 @@ export async function proveAndVerifyUltraHonk(bytecodePath: string, witnessPath:
189
118
 
190
119
  export async function proveAndVerifyMegaHonk(bytecodePath: string, witnessPath: string, crsPath: string) {
191
120
  /* eslint-disable camelcase */
192
- const { api } = await initUltraPlonk(bytecodePath, false, crsPath);
121
+ const { api } = await initUltraHonk(bytecodePath, crsPath);
193
122
  try {
194
123
  const bytecode = getBytecode(bytecodePath);
195
124
  const witness = getWitness(witnessPath);
@@ -202,32 +131,6 @@ export async function proveAndVerifyMegaHonk(bytecodePath: string, witnessPath:
202
131
  /* eslint-enable camelcase */
203
132
  }
204
133
 
205
- export async function prove(
206
- bytecodePath: string,
207
- recursive: boolean,
208
- witnessPath: string,
209
- crsPath: string,
210
- outputPath: string,
211
- ) {
212
- const { api, acirComposer } = await initUltraPlonk(bytecodePath, recursive, crsPath);
213
- try {
214
- debug(`Creating proof bytecode=${bytecodePath} witness=${witnessPath} recursive=${recursive}`);
215
- const bytecode = getBytecode(bytecodePath);
216
- const witness = getWitness(witnessPath);
217
- const proof = await api.acirCreateProof(acirComposer, bytecode, recursive, witness);
218
-
219
- if (outputPath === '-') {
220
- process.stdout.write(proof);
221
- debug(`Proof written to stdout`);
222
- } else {
223
- writeFileSync(outputPath, proof);
224
- debug(`Proof written to ${outputPath}`);
225
- }
226
- } finally {
227
- await api.destroy();
228
- }
229
- }
230
-
231
134
  export async function gateCountUltra(bytecodePath: string, recursive: boolean, honkRecursion: boolean) {
232
135
  const api = await Barretenberg.new({ threads: 1 });
233
136
  try {
@@ -245,37 +148,6 @@ export async function gateCountUltra(bytecodePath: string, recursive: boolean, h
245
148
  }
246
149
  }
247
150
 
248
- export async function verify(proofPath: string, vkPath: string, crsPath: string) {
249
- const { api, acirComposer } = await initLite(crsPath);
250
- try {
251
- await api.acirLoadVerificationKey(acirComposer, new RawBuffer(readFileSync(vkPath)));
252
- const verified = await api.acirVerifyProof(acirComposer, Uint8Array.from(readFileSync(proofPath)));
253
- debug(`Verification ${verified ? 'successful' : 'failed'}`);
254
- return verified;
255
- } finally {
256
- await api.destroy();
257
- }
258
- }
259
-
260
- export async function contract(outputPath: string, vkPath: string, crsPath: string) {
261
- const { api, acirComposer } = await initLite(crsPath);
262
- try {
263
- debug(`Creating verifier contract vk=${vkPath}`);
264
- await api.acirLoadVerificationKey(acirComposer, new RawBuffer(readFileSync(vkPath)));
265
- const contract = await api.acirGetSolidityVerifier(acirComposer);
266
-
267
- if (outputPath === '-') {
268
- process.stdout.write(contract);
269
- debug(`Solidity verifier contract written to stdout`);
270
- } else {
271
- writeFileSync(outputPath, contract);
272
- debug(`Solidity verifier contract written to ${outputPath}`);
273
- }
274
- } finally {
275
- await api.destroy();
276
- }
277
- }
278
-
279
151
  export async function contractUltraHonk(bytecodePath: string, vkPath: string, crsPath: string, outputPath: string) {
280
152
  const { api } = await initUltraHonk(bytecodePath, crsPath);
281
153
  try {
@@ -296,94 +168,6 @@ export async function contractUltraHonk(bytecodePath: string, vkPath: string, cr
296
168
  }
297
169
  }
298
170
 
299
- export async function writeVk(bytecodePath: string, recursive: boolean, crsPath: string, outputPath: string) {
300
- const { api, acirComposer } = await initUltraPlonk(bytecodePath, recursive, crsPath);
301
- try {
302
- debug(`Initializing proving key bytecode=${bytecodePath} recursive=${recursive}`);
303
- const bytecode = getBytecode(bytecodePath);
304
- await api.acirInitProvingKey(acirComposer, bytecode, recursive);
305
-
306
- debug(`Initializing verification key`);
307
- const vk = await api.acirGetVerificationKey(acirComposer);
308
-
309
- if (outputPath === '-') {
310
- process.stdout.write(vk);
311
- debug(`Verification key written to stdout`);
312
- } else {
313
- writeFileSync(outputPath, vk);
314
- debug(`Verification key written to ${outputPath}`);
315
- }
316
- } finally {
317
- await api.destroy();
318
- }
319
- }
320
-
321
- export async function writePk(bytecodePath: string, recursive: boolean, crsPath: string, outputPath: string) {
322
- const { api, acirComposer } = await initUltraPlonk(bytecodePath, recursive, crsPath);
323
- try {
324
- debug(`Initializing proving key bytecode=${bytecodePath} recursive=${recursive}`);
325
- const bytecode = getBytecode(bytecodePath);
326
- const pk = await api.acirGetProvingKey(acirComposer, bytecode, recursive);
327
-
328
- if (outputPath === '-') {
329
- process.stdout.write(pk);
330
- debug(`Proving key written to stdout`);
331
- } else {
332
- writeFileSync(outputPath, pk);
333
- debug(`Proving key written to ${outputPath}`);
334
- }
335
- } finally {
336
- await api.destroy();
337
- }
338
- }
339
-
340
- export async function proofAsFields(proofPath: string, vkPath: string, outputPath: string, crsPath: string) {
341
- const { api, acirComposer } = await initLite(crsPath);
342
-
343
- try {
344
- debug(`Serializing proof byte array into field elements proof=${proofPath} vk=${vkPath}`);
345
- const numPublicInputs = readFileSync(vkPath).readUint32BE(8);
346
- const proofAsFields = await api.acirSerializeProofIntoFields(
347
- acirComposer,
348
- Uint8Array.from(readFileSync(proofPath)),
349
- numPublicInputs,
350
- );
351
- const jsonProofAsFields = JSON.stringify(proofAsFields.map(f => f.toString()));
352
-
353
- if (outputPath === '-') {
354
- process.stdout.write(jsonProofAsFields);
355
- debug(`Proof as fields written to stdout`);
356
- } else {
357
- writeFileSync(outputPath, jsonProofAsFields);
358
- debug(`Proof as fields written to ${outputPath}`);
359
- }
360
- } finally {
361
- await api.destroy();
362
- }
363
- }
364
-
365
- export async function vkAsFields(vkPath: string, vkeyOutputPath: string, crsPath: string) {
366
- const { api, acirComposer } = await initLite(crsPath);
367
-
368
- try {
369
- debug(`Serializing vk byte array into field elements vk=${vkPath}`);
370
- await api.acirLoadVerificationKey(acirComposer, new RawBuffer(readFileSync(vkPath)));
371
- const [vkAsFields, vkHash] = await api.acirSerializeVerificationKeyIntoFields(acirComposer);
372
- const output = [vkHash, ...vkAsFields].map(f => f.toString());
373
- const jsonVKAsFields = JSON.stringify(output);
374
-
375
- if (vkeyOutputPath === '-') {
376
- process.stdout.write(jsonVKAsFields);
377
- debug(`Verification key as fields written to stdout`);
378
- } else {
379
- writeFileSync(vkeyOutputPath, jsonVKAsFields);
380
- debug(`Verification key as fields written to ${vkeyOutputPath}`);
381
- }
382
- } finally {
383
- await api.destroy();
384
- }
385
- }
386
-
387
171
  export async function proveUltraHonk(
388
172
  bytecodePath: string,
389
173
  witnessPath: string,
@@ -400,10 +184,10 @@ export async function proveUltraHonk(
400
184
  const acirProveUltraHonk = options?.keccak
401
185
  ? api.acirProveUltraKeccakHonk.bind(api)
402
186
  : options?.keccakZK
403
- ? api.acirProveUltraKeccakZKHonk.bind(api)
404
- : options?.starknet
405
- ? api.acirProveUltraStarknetHonk.bind(api)
406
- : api.acirProveUltraHonk.bind(api);
187
+ ? api.acirProveUltraKeccakZKHonk.bind(api)
188
+ : options?.starknet
189
+ ? api.acirProveUltraStarknetHonk.bind(api)
190
+ : api.acirProveUltraHonk.bind(api);
407
191
  const proof = await acirProveUltraHonk(bytecode, witness);
408
192
 
409
193
  if (outputPath === '-') {
@@ -432,10 +216,10 @@ export async function writeVkUltraHonk(
432
216
  const acirWriteVkUltraHonk = options?.keccak
433
217
  ? api.acirWriteVkUltraKeccakHonk.bind(api)
434
218
  : options?.keccakZK
435
- ? api.acirWriteVkUltraKeccakZKHonk.bind(api)
436
- : options?.starknet
437
- ? api.acirWriteVkUltraStarknetHonk.bind(api)
438
- : api.acirWriteVkUltraHonk.bind(api);
219
+ ? api.acirWriteVkUltraKeccakZKHonk.bind(api)
220
+ : options?.starknet
221
+ ? api.acirWriteVkUltraStarknetHonk.bind(api)
222
+ : api.acirWriteVkUltraHonk.bind(api);
439
223
  const vk = await acirWriteVkUltraHonk(bytecode);
440
224
 
441
225
  if (outputPath === '-') {
@@ -461,10 +245,10 @@ export async function verifyUltraHonk(
461
245
  const acirVerifyUltraHonk = options?.keccak
462
246
  ? api.acirVerifyUltraKeccakHonk.bind(api)
463
247
  : options?.keccakZK
464
- ? api.acirVerifyUltraKeccakZKHonk.bind(api)
465
- : options?.starknet
466
- ? api.acirVerifyUltraStarknetHonk.bind(api)
467
- : api.acirVerifyUltraHonk.bind(api);
248
+ ? api.acirVerifyUltraKeccakZKHonk.bind(api)
249
+ : options?.starknet
250
+ ? api.acirVerifyUltraStarknetHonk.bind(api)
251
+ : api.acirVerifyUltraHonk.bind(api);
468
252
  const verified = await acirVerifyUltraHonk(
469
253
  Uint8Array.from(readFileSync(proofPath)),
470
254
  new RawBuffer(readFileSync(vkPath)),
@@ -1,5 +1,3 @@
1
- import { numToUInt32BE } from '../serialize/serialize.js';
2
-
3
1
  /**
4
2
  * @description
5
3
  * The representation of a proof
@@ -34,16 +32,6 @@ export function reconstructHonkProof(publicInputs: Uint8Array, proof: Uint8Array
34
32
  return proofWithPublicInputs;
35
33
  }
36
34
 
37
- export function reconstructUltraPlonkProof(proofData: ProofData): Uint8Array {
38
- // Flatten publicInputs
39
- const publicInputsConcatenated = flattenFieldsAsArray(proofData.publicInputs);
40
-
41
- // Concatenate publicInputs and proof
42
- const proofWithPublicInputs = Uint8Array.from([...publicInputsConcatenated, ...proofData.proof]);
43
-
44
- return proofWithPublicInputs;
45
- }
46
-
47
35
  export function deflattenFields(flattenedFields: Uint8Array): string[] {
48
36
  const publicInputSize = 32;
49
37
  const chunkedFlattenedPublicInputs: Uint8Array[] = [];
@@ -1,6 +1,9 @@
1
1
  export class BufferReader {
2
2
  private index: number;
3
- constructor(private buffer: Uint8Array, offset = 0) {
3
+ constructor(
4
+ private buffer: Uint8Array,
5
+ offset = 0,
6
+ ) {
4
7
  this.index = offset;
5
8
  }
6
9
 
@@ -26,8 +26,8 @@ export class Fr {
26
26
  typeof value === 'bigint'
27
27
  ? value
28
28
  : value instanceof Buffer
29
- ? buffer32BytesToBigIntBE(value)
30
- : uint8ArrayToBigIntBE(value);
29
+ ? buffer32BytesToBigIntBE(value)
30
+ : uint8ArrayToBigIntBE(value);
31
31
 
32
32
  if (valueBigInt > Fr.MAX_VALUE) {
33
33
  throw new Error(`Value 0x${valueBigInt.toString(16)} is greater or equal to field modulus.`);
@@ -5,7 +5,10 @@ export class Point {
5
5
  static SIZE_IN_BYTES = 64;
6
6
  static EMPTY = new Point(Fr.ZERO, Fr.ZERO);
7
7
 
8
- constructor(public readonly x: Fr, public readonly y: Fr) {}
8
+ constructor(
9
+ public readonly x: Fr,
10
+ public readonly y: Fr,
11
+ ) {}
9
12
 
10
13
  static random() {
11
14
  // TODO: This is not a point on the curve!
@@ -1,38 +0,0 @@
1
- /**
2
- * The path to our SRS object, assuming that we are in e.g. barretenberg/ts/dest/node/crs/node folder.
3
- */
4
- export declare const SRS_DEV_PATH: string;
5
- export declare const GRUMPKIN_SRS_DEV_PATH: string;
6
- /**
7
- * Downloader for CRS from a local file (for Node).
8
- */
9
- export declare class IgnitionFilesCrs {
10
- /**
11
- * The number of circuit gates.
12
- */
13
- readonly numPoints: number;
14
- private path;
15
- private data;
16
- private g2Data;
17
- constructor(
18
- /**
19
- * The number of circuit gates.
20
- */
21
- numPoints: number, path?: string);
22
- pathExists(): boolean;
23
- /**
24
- * Read the data file.
25
- */
26
- init(): Promise<void>;
27
- /**
28
- * G1 points data for prover key.
29
- * @returns The points data.
30
- */
31
- getG1Data(): Uint8Array;
32
- /**
33
- * G2 points data for verification key.
34
- * @returns The points data.
35
- */
36
- getG2Data(): Uint8Array;
37
- }
38
- //# sourceMappingURL=ignition_files_crs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ignition_files_crs.d.ts","sourceRoot":"","sources":["../../../../src/crs/node/ignition_files_crs.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,eAAO,MAAM,YAAY,QAAmE,CAAC;AAC7F,eAAO,MAAM,qBAAqB,QAAmE,CAAC;AAEtG;;GAEG;AACH,qBAAa,gBAAgB;IAKzB;;OAEG;aACa,SAAS,EAAE,MAAM;IACjC,OAAO,CAAC,IAAI;IARd,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,MAAM,CAAc;;IAG1B;;OAEG;IACa,SAAS,EAAE,MAAM,EACzB,IAAI,SAAe;IAG7B,UAAU;IAIV;;OAEG;IACG,IAAI;IAeV;;;OAGG;IACH,SAAS,IAAI,UAAU;IAIvB;;;OAGG;IACH,SAAS,IAAI,UAAU;CAGxB"}
@@ -1,65 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { readFile } from 'fs/promises';
3
- import { dirname } from 'path';
4
- import { fileURLToPath } from 'url';
5
- function getCurrentDir() {
6
- if (typeof __dirname !== 'undefined') {
7
- return __dirname;
8
- }
9
- else {
10
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
- // @ts-ignore
12
- return dirname(fileURLToPath(import.meta.url));
13
- }
14
- }
15
- /**
16
- * The path to our SRS object, assuming that we are in e.g. barretenberg/ts/dest/node/crs/node folder.
17
- */
18
- export const SRS_DEV_PATH = getCurrentDir() + '/../../../../../cpp/srs_db/ignition/monomial';
19
- export const GRUMPKIN_SRS_DEV_PATH = getCurrentDir() + '/../../../../../cpp/srs_db/grumpkin/monomial';
20
- /**
21
- * Downloader for CRS from a local file (for Node).
22
- */
23
- export class IgnitionFilesCrs {
24
- constructor(
25
- /**
26
- * The number of circuit gates.
27
- */
28
- numPoints, path = SRS_DEV_PATH) {
29
- this.numPoints = numPoints;
30
- this.path = path;
31
- }
32
- pathExists() {
33
- return existsSync(this.path);
34
- }
35
- /**
36
- * Read the data file.
37
- */
38
- async init() {
39
- // We need this.numPoints number of g1 points.
40
- // numPoints should be circuitSize + 1.
41
- const g1Start = 28;
42
- const g1End = g1Start + this.numPoints * 64;
43
- const data = await readFile(this.path + '/transcript00.dat');
44
- this.data = data.subarray(g1Start, g1End);
45
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/811): proper abstraction from Grumpkin which does not have g2
46
- if (existsSync(this.path + '/g2.dat')) {
47
- this.g2Data = await readFile(this.path + '/g2.dat');
48
- }
49
- }
50
- /**
51
- * G1 points data for prover key.
52
- * @returns The points data.
53
- */
54
- getG1Data() {
55
- return this.data;
56
- }
57
- /**
58
- * G2 points data for verification key.
59
- * @returns The points data.
60
- */
61
- getG2Data() {
62
- return this.g2Data;
63
- }
64
- }
65
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWduaXRpb25fZmlsZXNfY3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2Nycy9ub2RlL2lnbml0aW9uX2ZpbGVzX2Nycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sSUFBSSxDQUFDO0FBQ2hDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDdkMsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMvQixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sS0FBSyxDQUFDO0FBRXBDLFNBQVMsYUFBYTtJQUNwQixJQUFJLE9BQU8sU0FBUyxLQUFLLFdBQVcsRUFBRSxDQUFDO1FBQ3JDLE9BQU8sU0FBUyxDQUFDO0lBQ25CLENBQUM7U0FBTSxDQUFDO1FBQ04sNkRBQTZEO1FBQzdELGFBQWE7UUFDYixPQUFPLE9BQU8sQ0FBQyxhQUFhLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO0lBQ2pELENBQUM7QUFDSCxDQUFDO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLENBQUMsTUFBTSxZQUFZLEdBQUcsYUFBYSxFQUFFLEdBQUcsOENBQThDLENBQUM7QUFDN0YsTUFBT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s7O09BR0c7SUFDSCxTQUFTO1FBQ1AsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDO0lBQ3JCLENBQUM7Q0FDRiJ9
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=simple.rawtest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple.rawtest.d.ts","sourceRoot":"","sources":["../../../src/examples/simple.rawtest.ts"],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- import { Crs } from '../crs/index.js';
2
- import createDebug from 'debug';
3
- import { Barretenberg } from '../barretenberg/index.js';
4
- import { RawBuffer } from '../types/index.js';
5
- createDebug.enable('*');
6
- const debug = createDebug('simple_test');
7
- async function main() {
8
- const CIRCUIT_SIZE = 2 ** 19;
9
- debug('starting test...');
10
- const api = await Barretenberg.new();
11
- // // Important to init slab allocator as first thing, to ensure maximum memory efficiency.
12
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1129): Do slab allocator initialization?
13
- // await api.commonInitSlabAllocator(CIRCUIT_SIZE);
14
- // Plus 1 needed!
15
- const crs = await Crs.new(CIRCUIT_SIZE + 1);
16
- await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
17
- const iterations = 10;
18
- let totalTime = 0;
19
- for (let i = 0; i < iterations; ++i) {
20
- const start = new Date().getTime();
21
- debug(`iteration ${i} starting...`);
22
- await api.examplesSimpleCreateAndVerifyProof();
23
- totalTime += new Date().getTime() - start;
24
- }
25
- await api.destroy();
26
- debug(`avg iteration time: ${totalTime / iterations}ms`);
27
- debug('test complete.');
28
- }
29
- void main();
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2ltcGxlLnJhd3Rlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZXhhbXBsZXMvc2ltcGxlLnJhd3Rlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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UFVLEVBQUUsRUFBRSxDQUFDLEVBQUUsQ0FBQztRQUNwQyxNQUFNLEtBQUssR0FBRyxJQUFJLElBQUksRUFBRSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ25DLEtBQUssQ0FBQyxhQUFhLENBQUMsY0FBYyxDQUFDLENBQUM7UUFDcEMsTUFBTSxHQUFHLENBQUMsa0NBQWtDLEVBQUUsQ0FBQztRQUMvQyxTQUFTLElBQUksSUFBSSxJQUFJLEVBQUUsQ0FBQyxPQUFPLEVBQUUsR0FBRyxLQUFLLENBQUM7SUFDNUMsQ0FBQztJQUVELE1BQU0sR0FBRyxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBRXBCLEtBQUssQ0FBQyx1QkFBdUIsU0FBUyxHQUFHLFVBQVUsSUFBSSxDQUFDLENBQUM7SUFDekQsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUM7QUFDMUIsQ0FBQztBQUVELEtBQUssSUFBSSxFQUFFLENBQUMifQ==
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=simple.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simple.test.d.ts","sourceRoot":"","sources":["../../../src/examples/simple.test.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- import { Crs } from '../crs/index.js';
2
- import { Barretenberg } from '../barretenberg/index.js';
3
- import { RawBuffer } from '../types/index.js';
4
- describe('simple', () => {
5
- let api;
6
- beforeAll(async () => {
7
- api = await Barretenberg.new();
8
- // // Important to init slab allocator as first thing, to ensure maximum memory efficiency.
9
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/1129): Do slab allocator initialization?
10
- // const CIRCUIT_SIZE = 2 ** 19;
11
- // await api.commonInitSlabAllocator(CIRCUIT_SIZE);
12
- const crs = await Crs.new(2 ** 20 + 1);
13
- await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data()));
14
- }, 60000);
15
- afterAll(async () => {
16
- await api.destroy();
17
- }, 10000);
18
- it('should construct 512k gate proof', async () => {
19
- const valid = await api.examplesSimpleCreateAndVerifyProof();
20
- expect(valid).toBe(true);
21
- }, 300000);
22
- });
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2ltcGxlLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZXhhbXBsZXMvc2ltcGxlLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ3RDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUN4RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFOUMsUUFBUSxDQUFDLFFBQVEsRUFBRSxHQUFHLEVBQUU7SUFDdEIsSUFBSSxHQUFpQixDQUFDO0lBRXRCLFNBQVMsQ0FBQyxLQUFLLElBQUksRUFBRTtRQUNuQixHQUFHLEdBQUcsTUFBTSxZQUFZLENBQUMsR0FBRyxFQUFFLENBQUM7UUFFL0IsMkZBQTJGO1FBQzNGLHFHQUFxRztRQUNyRyxnQ0FBZ0M7UUFDaEMsbURBQW1EO1FBRW5ELE1BQU0sR0FBRyxHQUFHLE1BQU0sR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksRUFBRSxHQUFHLENBQUMsQ0FBQyxDQUFDO1FBQ3ZDLE1BQU0sR0FBRyxDQUFDLFVBQVUsQ0FBQyxJQUFJLFNBQVMsQ0FBQyxHQUFHLENBQUMsU0FBUyxFQUFFLENBQUMsRUFBRSxHQUFHLENBQUMsU0FBUyxFQUFFLElBQUksU0FBUyxDQUFDLEdBQUcsQ0FBQyxTQUFTLEVBQUUsQ0FBQyxDQUFDLENBQUM7SUFDdEcsQ0FBQyxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBRVYsUUFBUSxDQUFDLEtBQUssSUFBSSxFQUFFO1FBQ2xCLE1BQU0sR0FBRyxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ3RCLENBQUMsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUVWLEVBQUUsQ0FBQyxrQ0FBa0MsRUFBRSxLQUFLLElBQUksRUFBRTtRQUNoRCxNQUFNLEtBQUssR0FBRyxNQUFNLEdBQUcsQ0FBQyxrQ0FBa0MsRUFBRSxDQUFDO1FBQzdELE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0FBQ2IsQ0FBQyxDQUFDLENBQUMifQ==
@@ -1,38 +0,0 @@
1
- /**
2
- * The path to our SRS object, assuming that we are in e.g. barretenberg/ts/dest/node/crs/node folder.
3
- */
4
- export declare const SRS_DEV_PATH: string;
5
- export declare const GRUMPKIN_SRS_DEV_PATH: string;
6
- /**
7
- * Downloader for CRS from a local file (for Node).
8
- */
9
- export declare class IgnitionFilesCrs {
10
- /**
11
- * The number of circuit gates.
12
- */
13
- readonly numPoints: number;
14
- private path;
15
- private data;
16
- private g2Data;
17
- constructor(
18
- /**
19
- * The number of circuit gates.
20
- */
21
- numPoints: number, path?: string);
22
- pathExists(): boolean;
23
- /**
24
- * Read the data file.
25
- */
26
- init(): Promise<void>;
27
- /**
28
- * G1 points data for prover key.
29
- * @returns The points data.
30
- */
31
- getG1Data(): Uint8Array;
32
- /**
33
- * G2 points data for verification key.
34
- * @returns The points data.
35
- */
36
- getG2Data(): Uint8Array;
37
- }
38
- //# sourceMappingURL=ignition_files_crs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ignition_files_crs.d.ts","sourceRoot":"","sources":["../../../../src/crs/node/ignition_files_crs.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,eAAO,MAAM,YAAY,QAAmE,CAAC;AAC7F,eAAO,MAAM,qBAAqB,QAAmE,CAAC;AAEtG;;GAEG;AACH,qBAAa,gBAAgB;IAKzB;;OAEG;aACa,SAAS,EAAE,MAAM;IACjC,OAAO,CAAC,IAAI;IARd,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,MAAM,CAAc;;IAG1B;;OAEG;IACa,SAAS,EAAE,MAAM,EACzB,IAAI,SAAe;IAG7B,UAAU;IAIV;;OAEG;IACG,IAAI;IAeV;;;OAGG;IACH,SAAS,IAAI,UAAU;IAIvB;;;OAGG;IACH,SAAS,IAAI,UAAU;CAGxB"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IgnitionFilesCrs = exports.GRUMPKIN_SRS_DEV_PATH = exports.SRS_DEV_PATH = void 0;
4
- const fs_1 = require("fs");
5
- const promises_1 = require("fs/promises");
6
- const path_1 = require("path");
7
- const url_1 = require("url");
8
- function getCurrentDir() {
9
- if (typeof __dirname !== 'undefined') {
10
- return __dirname;
11
- }
12
- else {
13
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
- // @ts-ignore
15
- return (0, path_1.dirname)((0, url_1.fileURLToPath)(""));
16
- }
17
- }
18
- /**
19
- * The path to our SRS object, assuming that we are in e.g. barretenberg/ts/dest/node/crs/node folder.
20
- */
21
- exports.SRS_DEV_PATH = getCurrentDir() + '/../../../../../cpp/srs_db/ignition/monomial';
22
- exports.GRUMPKIN_SRS_DEV_PATH = getCurrentDir() + '/../../../../../cpp/srs_db/grumpkin/monomial';
23
- /**
24
- * Downloader for CRS from a local file (for Node).
25
- */
26
- class IgnitionFilesCrs {
27
- constructor(
28
- /**
29
- * The number of circuit gates.
30
- */
31
- numPoints, path = exports.SRS_DEV_PATH) {
32
- this.numPoints = numPoints;
33
- this.path = path;
34
- }
35
- pathExists() {
36
- return (0, fs_1.existsSync)(this.path);
37
- }
38
- /**
39
- * Read the data file.
40
- */
41
- async init() {
42
- // We need this.numPoints number of g1 points.
43
- // numPoints should be circuitSize + 1.
44
- const g1Start = 28;
45
- const g1End = g1Start + this.numPoints * 64;
46
- const data = await (0, promises_1.readFile)(this.path + '/transcript00.dat');
47
- this.data = data.subarray(g1Start, g1End);
48
- // TODO(https://github.com/AztecProtocol/barretenberg/issues/811): proper abstraction from Grumpkin which does not have g2
49
- if ((0, fs_1.existsSync)(this.path + '/g2.dat')) {
50
- this.g2Data = await (0, promises_1.readFile)(this.path + '/g2.dat');
51
- }
52
- }
53
- /**
54
- * G1 points data for prover key.
55
- * @returns The points data.
56
- */
57
- getG1Data() {
58
- return this.data;
59
- }
60
- /**
61
- * G2 points data for verification key.
62
- * @returns The points data.
63
- */
64
- getG2Data() {
65
- return this.g2Data;
66
- }
67
- }
68
- exports.IgnitionFilesCrs = IgnitionFilesCrs;
69
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWduaXRpb25fZmlsZXNfY3JzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2Nycy9ub2RlL2lnbml0aW9uX2ZpbGVzX2Nycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwyQkFBZ0M7QUFDaEMsMENBQXVDO0FBQ3ZDLCtCQUErQjtBQUMvQiw2QkFBb0M7QUFFcEMsU0FBUyxhQUFhO0lBQ3BCLElBQUksT0FBTyxTQUFTLEtBQUssV0FBVyxFQUFFLENBQUM7UUFDckMsT0FBTyxTQUFTLENBQUM7SUFDbkIsQ0FBQztTQUFNLENBQUM7UUFDTiw2REFBNkQ7UUFDN0QsYUFBYTtRQUNiLE9BQU8sSUFBQSxjQUFPLEVBQUMsSUFBQSxtQkFBYSxFQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztJQUNqRCxDQUFDO0FBQ0gsQ0FBQztBQUVEOztH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