@aztec/bb-prover 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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 (93) hide show
  1. package/dest/avm_proving_tests/avm_proving_tester.d.ts +7 -6
  2. package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
  3. package/dest/avm_proving_tests/avm_proving_tester.js +33 -13
  4. package/dest/bb/cli.d.ts +1 -1
  5. package/dest/bb/execute.d.ts +5 -13
  6. package/dest/bb/execute.d.ts.map +1 -1
  7. package/dest/bb/execute.js +30 -92
  8. package/dest/bb/index.d.ts +1 -1
  9. package/dest/config.d.ts +1 -1
  10. package/dest/honk.d.ts +2 -2
  11. package/dest/honk.js +2 -2
  12. package/dest/index.d.ts +1 -1
  13. package/dest/instrumentation.d.ts +3 -3
  14. package/dest/instrumentation.d.ts.map +1 -1
  15. package/dest/prover/client/bb_private_kernel_prover.d.ts +12 -6
  16. package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
  17. package/dest/prover/client/bb_private_kernel_prover.js +36 -7
  18. package/dest/prover/client/bundle.d.ts +6 -0
  19. package/dest/prover/client/bundle.d.ts.map +1 -0
  20. package/dest/prover/client/bundle.js +7 -0
  21. package/dest/prover/client/lazy.d.ts +6 -0
  22. package/dest/prover/client/lazy.d.ts.map +1 -0
  23. package/dest/prover/client/lazy.js +7 -0
  24. package/dest/prover/index.d.ts +1 -1
  25. package/dest/prover/proof_utils.d.ts +9 -9
  26. package/dest/prover/proof_utils.d.ts.map +1 -1
  27. package/dest/prover/proof_utils.js +42 -25
  28. package/dest/prover/server/bb_prover.d.ts +23 -43
  29. package/dest/prover/server/bb_prover.d.ts.map +1 -1
  30. package/dest/prover/server/bb_prover.js +464 -165
  31. package/dest/test/delay_values.d.ts +1 -1
  32. package/dest/test/delay_values.d.ts.map +1 -1
  33. package/dest/test/delay_values.js +37 -25
  34. package/dest/test/index.d.ts +2 -1
  35. package/dest/test/index.d.ts.map +1 -1
  36. package/dest/test/index.js +1 -0
  37. package/dest/test/test_circuit_prover.d.ts +21 -31
  38. package/dest/test/test_circuit_prover.d.ts.map +1 -1
  39. package/dest/test/test_circuit_prover.js +503 -81
  40. package/dest/test/test_verifier.d.ts +3 -1
  41. package/dest/test/test_verifier.d.ts.map +1 -1
  42. package/dest/test/test_verifier.js +15 -0
  43. package/dest/verification_key/verification_key_data.d.ts +1 -1
  44. package/dest/verification_key/verification_key_data.js +1 -1
  45. package/dest/verifier/bb_verifier.d.ts +3 -5
  46. package/dest/verifier/bb_verifier.d.ts.map +1 -1
  47. package/dest/verifier/bb_verifier.js +24 -26
  48. package/dest/verifier/index.d.ts +2 -2
  49. package/dest/verifier/index.d.ts.map +1 -1
  50. package/dest/verifier/index.js +1 -1
  51. package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
  52. package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
  53. package/dest/verifier/{queued_ivc_verifier.js → queued_chonk_verifier.js} +3 -3
  54. package/package.json +23 -23
  55. package/src/avm_proving_tests/avm_proving_tester.ts +43 -19
  56. package/src/bb/execute.ts +20 -90
  57. package/src/honk.ts +1 -1
  58. package/src/instrumentation.ts +2 -2
  59. package/src/prover/client/bb_private_kernel_prover.ts +49 -10
  60. package/src/prover/client/bundle.ts +10 -0
  61. package/src/prover/client/lazy.ts +10 -0
  62. package/src/prover/proof_utils.ts +53 -31
  63. package/src/prover/server/bb_prover.ts +231 -293
  64. package/src/test/delay_values.ts +38 -24
  65. package/src/test/index.ts +1 -0
  66. package/src/test/test_circuit_prover.ts +219 -142
  67. package/src/test/test_verifier.ts +8 -0
  68. package/src/verification_key/verification_key_data.ts +1 -1
  69. package/src/verifier/bb_verifier.ts +34 -33
  70. package/src/verifier/index.ts +1 -1
  71. package/src/verifier/{queued_ivc_verifier.ts → queued_chonk_verifier.ts} +3 -3
  72. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +0 -23
  73. package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +0 -1
  74. package/dest/prover/client/native/bb_native_private_kernel_prover.js +0 -66
  75. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +0 -15
  76. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
  77. package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +0 -48
  78. package/dest/prover/client/wasm/bundle.d.ts +0 -6
  79. package/dest/prover/client/wasm/bundle.d.ts.map +0 -1
  80. package/dest/prover/client/wasm/bundle.js +0 -8
  81. package/dest/prover/client/wasm/lazy.d.ts +0 -6
  82. package/dest/prover/client/wasm/lazy.d.ts.map +0 -1
  83. package/dest/prover/client/wasm/lazy.js +0 -8
  84. package/dest/stats.d.ts +0 -4
  85. package/dest/stats.d.ts.map +0 -1
  86. package/dest/stats.js +0 -45
  87. package/dest/verifier/queued_ivc_verifier.d.ts +0 -15
  88. package/dest/verifier/queued_ivc_verifier.d.ts.map +0 -1
  89. package/src/prover/client/native/bb_native_private_kernel_prover.ts +0 -105
  90. package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +0 -60
  91. package/src/prover/client/wasm/bundle.ts +0 -11
  92. package/src/prover/client/wasm/lazy.ts +0 -11
  93. package/src/stats.ts +0 -47
@@ -1,40 +1,431 @@
1
- function _ts_decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ function applyDecs2203RFactory() {
2
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
3
+ return function addInitializer(initializer) {
4
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
5
+ assertCallable(initializer, "An initializer");
6
+ initializers.push(initializer);
7
+ };
8
+ }
9
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
10
+ var kindStr;
11
+ switch(kind){
12
+ case 1:
13
+ kindStr = "accessor";
14
+ break;
15
+ case 2:
16
+ kindStr = "method";
17
+ break;
18
+ case 3:
19
+ kindStr = "getter";
20
+ break;
21
+ case 4:
22
+ kindStr = "setter";
23
+ break;
24
+ default:
25
+ kindStr = "field";
26
+ }
27
+ var ctx = {
28
+ kind: kindStr,
29
+ name: isPrivate ? "#" + name : name,
30
+ static: isStatic,
31
+ private: isPrivate,
32
+ metadata: metadata
33
+ };
34
+ var decoratorFinishedRef = {
35
+ v: false
36
+ };
37
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
38
+ var get, set;
39
+ if (kind === 0) {
40
+ if (isPrivate) {
41
+ get = desc.get;
42
+ set = desc.set;
43
+ } else {
44
+ get = function() {
45
+ return this[name];
46
+ };
47
+ set = function(v) {
48
+ this[name] = v;
49
+ };
50
+ }
51
+ } else if (kind === 2) {
52
+ get = function() {
53
+ return desc.value;
54
+ };
55
+ } else {
56
+ if (kind === 1 || kind === 3) {
57
+ get = function() {
58
+ return desc.get.call(this);
59
+ };
60
+ }
61
+ if (kind === 1 || kind === 4) {
62
+ set = function(v) {
63
+ desc.set.call(this, v);
64
+ };
65
+ }
66
+ }
67
+ ctx.access = get && set ? {
68
+ get: get,
69
+ set: set
70
+ } : get ? {
71
+ get: get
72
+ } : {
73
+ set: set
74
+ };
75
+ try {
76
+ return dec(value, ctx);
77
+ } finally{
78
+ decoratorFinishedRef.v = true;
79
+ }
80
+ }
81
+ function assertNotFinished(decoratorFinishedRef, fnName) {
82
+ if (decoratorFinishedRef.v) {
83
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
84
+ }
85
+ }
86
+ function assertCallable(fn, hint) {
87
+ if (typeof fn !== "function") {
88
+ throw new TypeError(hint + " must be a function");
89
+ }
90
+ }
91
+ function assertValidReturnValue(kind, value) {
92
+ var type = typeof value;
93
+ if (kind === 1) {
94
+ if (type !== "object" || value === null) {
95
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
96
+ }
97
+ if (value.get !== undefined) {
98
+ assertCallable(value.get, "accessor.get");
99
+ }
100
+ if (value.set !== undefined) {
101
+ assertCallable(value.set, "accessor.set");
102
+ }
103
+ if (value.init !== undefined) {
104
+ assertCallable(value.init, "accessor.init");
105
+ }
106
+ } else if (type !== "function") {
107
+ var hint;
108
+ if (kind === 0) {
109
+ hint = "field";
110
+ } else if (kind === 10) {
111
+ hint = "class";
112
+ } else {
113
+ hint = "method";
114
+ }
115
+ throw new TypeError(hint + " decorators must return a function or void 0");
116
+ }
117
+ }
118
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
119
+ var decs = decInfo[0];
120
+ var desc, init, value;
121
+ if (isPrivate) {
122
+ if (kind === 0 || kind === 1) {
123
+ desc = {
124
+ get: decInfo[3],
125
+ set: decInfo[4]
126
+ };
127
+ } else if (kind === 3) {
128
+ desc = {
129
+ get: decInfo[3]
130
+ };
131
+ } else if (kind === 4) {
132
+ desc = {
133
+ set: decInfo[3]
134
+ };
135
+ } else {
136
+ desc = {
137
+ value: decInfo[3]
138
+ };
139
+ }
140
+ } else if (kind !== 0) {
141
+ desc = Object.getOwnPropertyDescriptor(base, name);
142
+ }
143
+ if (kind === 1) {
144
+ value = {
145
+ get: desc.get,
146
+ set: desc.set
147
+ };
148
+ } else if (kind === 2) {
149
+ value = desc.value;
150
+ } else if (kind === 3) {
151
+ value = desc.get;
152
+ } else if (kind === 4) {
153
+ value = desc.set;
154
+ }
155
+ var newValue, get, set;
156
+ if (typeof decs === "function") {
157
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
158
+ if (newValue !== void 0) {
159
+ assertValidReturnValue(kind, newValue);
160
+ if (kind === 0) {
161
+ init = newValue;
162
+ } else if (kind === 1) {
163
+ init = newValue.init;
164
+ get = newValue.get || value.get;
165
+ set = newValue.set || value.set;
166
+ value = {
167
+ get: get,
168
+ set: set
169
+ };
170
+ } else {
171
+ value = newValue;
172
+ }
173
+ }
174
+ } else {
175
+ for(var i = decs.length - 1; i >= 0; i--){
176
+ var dec = decs[i];
177
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
178
+ if (newValue !== void 0) {
179
+ assertValidReturnValue(kind, newValue);
180
+ var newInit;
181
+ if (kind === 0) {
182
+ newInit = newValue;
183
+ } else if (kind === 1) {
184
+ newInit = newValue.init;
185
+ get = newValue.get || value.get;
186
+ set = newValue.set || value.set;
187
+ value = {
188
+ get: get,
189
+ set: set
190
+ };
191
+ } else {
192
+ value = newValue;
193
+ }
194
+ if (newInit !== void 0) {
195
+ if (init === void 0) {
196
+ init = newInit;
197
+ } else if (typeof init === "function") {
198
+ init = [
199
+ init,
200
+ newInit
201
+ ];
202
+ } else {
203
+ init.push(newInit);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ if (kind === 0 || kind === 1) {
210
+ if (init === void 0) {
211
+ init = function(instance, init) {
212
+ return init;
213
+ };
214
+ } else if (typeof init !== "function") {
215
+ var ownInitializers = init;
216
+ init = function(instance, init) {
217
+ var value = init;
218
+ for(var i = 0; i < ownInitializers.length; i++){
219
+ value = ownInitializers[i].call(instance, value);
220
+ }
221
+ return value;
222
+ };
223
+ } else {
224
+ var originalInitializer = init;
225
+ init = function(instance, init) {
226
+ return originalInitializer.call(instance, init);
227
+ };
228
+ }
229
+ ret.push(init);
230
+ }
231
+ if (kind !== 0) {
232
+ if (kind === 1) {
233
+ desc.get = value.get;
234
+ desc.set = value.set;
235
+ } else if (kind === 2) {
236
+ desc.value = value;
237
+ } else if (kind === 3) {
238
+ desc.get = value;
239
+ } else if (kind === 4) {
240
+ desc.set = value;
241
+ }
242
+ if (isPrivate) {
243
+ if (kind === 1) {
244
+ ret.push(function(instance, args) {
245
+ return value.get.call(instance, args);
246
+ });
247
+ ret.push(function(instance, args) {
248
+ return value.set.call(instance, args);
249
+ });
250
+ } else if (kind === 2) {
251
+ ret.push(value);
252
+ } else {
253
+ ret.push(function(instance, args) {
254
+ return value.call(instance, args);
255
+ });
256
+ }
257
+ } else {
258
+ Object.defineProperty(base, name, desc);
259
+ }
260
+ }
261
+ }
262
+ function applyMemberDecs(Class, decInfos, metadata) {
263
+ var ret = [];
264
+ var protoInitializers;
265
+ var staticInitializers;
266
+ var existingProtoNonFields = new Map();
267
+ var existingStaticNonFields = new Map();
268
+ for(var i = 0; i < decInfos.length; i++){
269
+ var decInfo = decInfos[i];
270
+ if (!Array.isArray(decInfo)) continue;
271
+ var kind = decInfo[1];
272
+ var name = decInfo[2];
273
+ var isPrivate = decInfo.length > 3;
274
+ var isStatic = kind >= 5;
275
+ var base;
276
+ var initializers;
277
+ if (isStatic) {
278
+ base = Class;
279
+ kind = kind - 5;
280
+ staticInitializers = staticInitializers || [];
281
+ initializers = staticInitializers;
282
+ } else {
283
+ base = Class.prototype;
284
+ protoInitializers = protoInitializers || [];
285
+ initializers = protoInitializers;
286
+ }
287
+ if (kind !== 0 && !isPrivate) {
288
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
289
+ var existingKind = existingNonFields.get(name) || 0;
290
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
291
+ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
292
+ } else if (!existingKind && kind > 2) {
293
+ existingNonFields.set(name, kind);
294
+ } else {
295
+ existingNonFields.set(name, true);
296
+ }
297
+ }
298
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
299
+ }
300
+ pushInitializers(ret, protoInitializers);
301
+ pushInitializers(ret, staticInitializers);
302
+ return ret;
303
+ }
304
+ function pushInitializers(ret, initializers) {
305
+ if (initializers) {
306
+ ret.push(function(instance) {
307
+ for(var i = 0; i < initializers.length; i++){
308
+ initializers[i].call(instance);
309
+ }
310
+ return instance;
311
+ });
312
+ }
313
+ }
314
+ function applyClassDecs(targetClass, classDecs, metadata) {
315
+ if (classDecs.length > 0) {
316
+ var initializers = [];
317
+ var newClass = targetClass;
318
+ var name = targetClass.name;
319
+ for(var i = classDecs.length - 1; i >= 0; i--){
320
+ var decoratorFinishedRef = {
321
+ v: false
322
+ };
323
+ try {
324
+ var nextNewClass = classDecs[i](newClass, {
325
+ kind: "class",
326
+ name: name,
327
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
328
+ metadata
329
+ });
330
+ } finally{
331
+ decoratorFinishedRef.v = true;
332
+ }
333
+ if (nextNewClass !== undefined) {
334
+ assertValidReturnValue(10, nextNewClass);
335
+ newClass = nextNewClass;
336
+ }
337
+ }
338
+ return [
339
+ defineMetadata(newClass, metadata),
340
+ function() {
341
+ for(var i = 0; i < initializers.length; i++){
342
+ initializers[i].call(newClass);
343
+ }
344
+ }
345
+ ];
346
+ }
347
+ }
348
+ function defineMetadata(Class, metadata) {
349
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
350
+ configurable: true,
351
+ enumerable: true,
352
+ value: metadata
353
+ });
354
+ }
355
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
356
+ if (parentClass !== void 0) {
357
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
358
+ }
359
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
360
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
361
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
362
+ return {
363
+ e: e,
364
+ get c () {
365
+ return applyClassDecs(targetClass, classDecs, metadata);
366
+ }
367
+ };
368
+ };
369
+ }
370
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
371
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
6
372
  }
7
- import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, RECURSIVE_PROOF_LENGTH, TUBE_PROOF_LENGTH, ULTRA_KECCAK_PROOF_LENGTH } from '@aztec/constants';
8
- import { Fr } from '@aztec/foundation/fields';
373
+ var _dec, _dec1, _dec2, _initProto;
374
+ import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, RECURSIVE_PROOF_LENGTH, ULTRA_KECCAK_PROOF_LENGTH } from '@aztec/constants';
375
+ import { Fr } from '@aztec/foundation/curves/bn254';
9
376
  import { runInDirectory } from '@aztec/foundation/fs';
10
377
  import { createLogger } from '@aztec/foundation/log';
11
378
  import { BufferReader } from '@aztec/foundation/serialize';
12
- import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertBlockRootRollupInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap, convertPrivateBaseRollupInputsToWitnessMap, convertPrivateBaseRollupOutputsFromWitnessMap, convertPublicBaseRollupInputsToWitnessMap, convertPublicBaseRollupOutputsFromWitnessMap, convertRootParityInputsToWitnessMap, convertRootParityOutputsFromWitnessMap, convertRootRollupInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap, convertSingleTxBlockRootRollupInputsToWitnessMap, convertSingleTxBlockRootRollupOutputsFromWitnessMap, getServerCircuitArtifact } from '@aztec/noir-protocol-circuits-types/server';
379
+ import { convertBlockMergeRollupOutputsFromWitnessMap, convertBlockMergeRollupPrivateInputsToWitnessMap, convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap, convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap, convertBlockRootFirstRollupOutputsFromWitnessMap, convertBlockRootFirstRollupPrivateInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap, convertBlockRootRollupPrivateInputsToWitnessMap, convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap, convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap, convertBlockRootSingleTxRollupOutputsFromWitnessMap, convertBlockRootSingleTxRollupPrivateInputsToWitnessMap, convertCheckpointMergeRollupOutputsFromWitnessMap, convertCheckpointMergeRollupPrivateInputsToWitnessMap, convertCheckpointPaddingRollupOutputsFromWitnessMap, convertCheckpointPaddingRollupPrivateInputsToWitnessMap, convertCheckpointRootRollupOutputsFromWitnessMap, convertCheckpointRootRollupPrivateInputsToWitnessMap, convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap, convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap, convertParityBaseOutputsFromWitnessMap, convertParityBasePrivateInputsToWitnessMap, convertParityRootOutputsFromWitnessMap, convertParityRootPrivateInputsToWitnessMap, convertPrivateTxBaseRollupOutputsFromWitnessMap, convertPrivateTxBaseRollupPrivateInputsToWitnessMap, convertPublicChonkVerifierOutputsFromWitnessMap, convertPublicChonkVerifierPrivateInputsToWitnessMap, convertPublicTxBaseRollupOutputsFromWitnessMap, convertPublicTxBaseRollupPrivateInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap, convertRootRollupPrivateInputsToWitnessMap, convertTxMergeRollupOutputsFromWitnessMap, convertTxMergeRollupPrivateInputsToWitnessMap, getServerCircuitArtifact } from '@aztec/noir-protocol-circuits-types/server';
13
380
  import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
381
+ import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
14
382
  import { NativeACVMSimulator } from '@aztec/simulator/server';
15
383
  import { ProvingError } from '@aztec/stdlib/errors';
16
384
  import { makeProofAndVerificationKey, makePublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
17
385
  import { Proof, RecursiveProof, makeRecursiveProofFromBinary } from '@aztec/stdlib/proofs';
18
- import { enhanceProofWithPiValidationFlag } from '@aztec/stdlib/rollup';
19
386
  import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
20
- import crypto from 'crypto';
21
387
  import { promises as fs } from 'fs';
22
388
  import * as path from 'path';
23
- import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME, generateAvmProof, generateProof, generateTubeProof, verifyAvmProof, verifyProof } from '../../bb/execute.js';
389
+ import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME, generateAvmProof, generateProof, verifyAvmProof, verifyProof } from '../../bb/execute.js';
24
390
  import { getUltraHonkFlavorForCircuit } from '../../honk.js';
25
391
  import { ProverInstrumentation } from '../../instrumentation.js';
26
- import { mapProtocolArtifactNameToCircuitName } from '../../stats.js';
27
- import { extractAvmVkData, extractVkData } from '../../verification_key/verification_key_data.js';
28
- import { PRIVATE_TAIL_CIVC_VK, PUBLIC_TAIL_CIVC_VK } from '../../verifier/bb_verifier.js';
29
- import { readProofAsFields, writeClientIVCProofToOutputDirectory } from '../proof_utils.js';
392
+ import { extractAvmVkData } from '../../verification_key/verification_key_data.js';
393
+ import { readProofsFromOutputDirectory } from '../proof_utils.js';
30
394
  const logger = createLogger('bb-prover');
395
+ _dec = trackSpan('BBNativeRollupProver.getBaseParityProof', {
396
+ [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-base'
397
+ }), _dec1 = trackSpan('BBNativeRollupProver.getRootParityProof', {
398
+ [Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-root'
399
+ }), _dec2 = trackSpan('BBNativeRollupProver.getAvmProof', (inputs)=>({
400
+ [Attributes.APP_CIRCUIT_NAME]: inputs.hints.tx.hash
401
+ }));
31
402
  /**
32
403
  * Prover implementation that uses barretenberg native proving
33
404
  */ export class BBNativeRollupProver {
34
405
  config;
406
+ static{
407
+ ({ e: [_initProto] } = _apply_decs_2203_r(this, [
408
+ [
409
+ _dec,
410
+ 2,
411
+ "getBaseParityProof"
412
+ ],
413
+ [
414
+ _dec1,
415
+ 2,
416
+ "getRootParityProof"
417
+ ],
418
+ [
419
+ _dec2,
420
+ 2,
421
+ "getAvmProof"
422
+ ]
423
+ ], []));
424
+ }
35
425
  instrumentation;
36
426
  constructor(config, telemetry){
37
427
  this.config = config;
428
+ _initProto(this);
38
429
  this.instrumentation = new ProverInstrumentation(telemetry, 'BBNativeRollupProver');
39
430
  }
40
431
  get tracer() {
@@ -57,119 +448,102 @@ const logger = createLogger('bb-prover');
57
448
  * Simulates the base parity circuit from its inputs.
58
449
  * @param inputs - Inputs to the circuit.
59
450
  * @returns The public inputs of the parity circuit.
60
- */ async getBaseParityProof(inputs) {
61
- const { circuitOutput, proof } = await this.createRecursiveProof(inputs, 'BaseParityArtifact', RECURSIVE_PROOF_LENGTH, convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap);
62
- const verificationKey = this.getVerificationKeyDataForCircuit('BaseParityArtifact');
63
- await this.verifyProof('BaseParityArtifact', proof.binaryProof);
64
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
451
+ */ getBaseParityProof(inputs) {
452
+ return this.createRecursiveProofAndVerify(inputs, 'ParityBaseArtifact', RECURSIVE_PROOF_LENGTH, convertParityBasePrivateInputsToWitnessMap, convertParityBaseOutputsFromWitnessMap);
65
453
  }
66
454
  /**
67
455
  * Simulates the root parity circuit from its inputs.
68
456
  * @param inputs - Inputs to the circuit.
69
457
  * @returns The public inputs of the parity circuit.
70
- */ async getRootParityProof(inputs) {
71
- const { circuitOutput, proof } = await this.createRecursiveProof(inputs, 'RootParityArtifact', NESTED_RECURSIVE_PROOF_LENGTH, convertRootParityInputsToWitnessMap, convertRootParityOutputsFromWitnessMap);
72
- const verificationKey = this.getVerificationKeyDataForCircuit('RootParityArtifact');
73
- await this.verifyProof('RootParityArtifact', proof.binaryProof);
74
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
458
+ */ getRootParityProof(inputs) {
459
+ return this.createRecursiveProofAndVerify(inputs, 'ParityRootArtifact', NESTED_RECURSIVE_PROOF_LENGTH, convertParityRootPrivateInputsToWitnessMap, convertParityRootOutputsFromWitnessMap);
75
460
  }
76
461
  /**
77
462
  * Creates an AVM proof and verifies it.
78
463
  * @param inputs - The inputs to the AVM circuit.
79
464
  * @returns The proof.
80
- */ async getAvmProof(inputs, skipPublicInputsValidation = false) {
465
+ */ async getAvmProof(inputs) {
81
466
  const proofAndVk = await this.createAvmProof(inputs);
82
467
  await this.verifyAvmProof(proofAndVk.proof.binaryProof, proofAndVk.verificationKey, inputs.publicInputs);
83
- // TODO(#14234)[Unconditional PIs validation]: remove next lines and directly return proofAndVk
84
- proofAndVk.proof.proof = enhanceProofWithPiValidationFlag(proofAndVk.proof.proof, skipPublicInputsValidation);
85
468
  return proofAndVk;
86
469
  }
470
+ async getPublicChonkVerifierProof(inputs) {
471
+ const artifactName = 'PublicChonkVerifier';
472
+ const { circuitOutput, proof } = await this.createRecursiveProof(inputs, artifactName, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPublicChonkVerifierPrivateInputsToWitnessMap, convertPublicChonkVerifierOutputsFromWitnessMap);
473
+ const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
474
+ await this.verifyProof(artifactName, proof.binaryProof);
475
+ return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
476
+ }
87
477
  /**
88
478
  * Simulates the base rollup circuit from its inputs.
89
479
  * @param inputs - Inputs to the circuit.
90
480
  * @returns The public inputs as outputs of the simulation.
91
- */ async getPrivateBaseRollupProof(inputs) {
92
- const artifactName = 'PrivateBaseRollupArtifact';
93
- const { circuitOutput, proof } = await this.createRecursiveProof(inputs, artifactName, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPrivateBaseRollupInputsToWitnessMap, convertPrivateBaseRollupOutputsFromWitnessMap);
94
- const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
95
- await this.verifyProof(artifactName, proof.binaryProof);
96
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
481
+ */ getPrivateTxBaseRollupProof(inputs) {
482
+ return this.createRecursiveProofAndVerify(inputs, 'PrivateTxBaseRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPrivateTxBaseRollupPrivateInputsToWitnessMap, convertPrivateTxBaseRollupOutputsFromWitnessMap);
97
483
  }
98
484
  /**
99
485
  * Requests that the public kernel tail circuit be executed and the proof generated
100
486
  * @param kernelRequest - The object encapsulating the request for a proof
101
487
  * @returns The requested circuit's public inputs and proof
102
- */ async getPublicBaseRollupProof(inputs) {
103
- const artifactName = 'PublicBaseRollupArtifact';
104
- const { circuitOutput, proof } = await this.createRecursiveProof(inputs, artifactName, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPublicBaseRollupInputsToWitnessMap, convertPublicBaseRollupOutputsFromWitnessMap);
105
- const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
106
- await this.verifyProof(artifactName, proof.binaryProof);
107
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
488
+ */ getPublicTxBaseRollupProof(inputs) {
489
+ return this.createRecursiveProofAndVerify(inputs, 'PublicTxBaseRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPublicTxBaseRollupPrivateInputsToWitnessMap, convertPublicTxBaseRollupOutputsFromWitnessMap);
108
490
  }
109
491
  /**
110
492
  * Simulates the merge rollup circuit from its inputs.
111
493
  * @param input - Inputs to the circuit.
112
494
  * @returns The public inputs as outputs of the simulation.
113
- */ async getMergeRollupProof(input) {
114
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'MergeRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap);
115
- const verificationKey = this.getVerificationKeyDataForCircuit('MergeRollupArtifact');
116
- await this.verifyProof('MergeRollupArtifact', proof.binaryProof);
117
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
495
+ */ getTxMergeRollupProof(input) {
496
+ return this.createRecursiveProofAndVerify(input, 'TxMergeRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertTxMergeRollupPrivateInputsToWitnessMap, convertTxMergeRollupOutputsFromWitnessMap);
118
497
  }
119
- /**
120
- * Simulates the block root rollup circuit from its inputs.
121
- * @param input - Inputs to the circuit.
122
- * @returns The public inputs as outputs of the simulation.
123
- */ async getBlockRootRollupProof(input) {
124
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'BlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootRollupInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap);
125
- const verificationKey = this.getVerificationKeyDataForCircuit('BlockRootRollupArtifact');
126
- await this.verifyProof('BlockRootRollupArtifact', proof.binaryProof);
127
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
498
+ getBlockRootFirstRollupProof(input) {
499
+ return this.createRecursiveProofAndVerify(input, 'BlockRootFirstRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootFirstRollupPrivateInputsToWitnessMap, convertBlockRootFirstRollupOutputsFromWitnessMap);
128
500
  }
129
- async getSingleTxBlockRootRollupProof(input) {
130
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'SingleTxBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertSingleTxBlockRootRollupInputsToWitnessMap, convertSingleTxBlockRootRollupOutputsFromWitnessMap);
131
- const verificationKey = this.getVerificationKeyDataForCircuit('SingleTxBlockRootRollupArtifact');
132
- await this.verifyProof('SingleTxBlockRootRollupArtifact', proof.binaryProof);
133
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
501
+ getBlockRootSingleTxFirstRollupProof(input) {
502
+ return this.createRecursiveProofAndVerify(input, 'BlockRootSingleTxFirstRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootSingleTxFirstRollupPrivateInputsToWitnessMap, convertBlockRootSingleTxFirstRollupOutputsFromWitnessMap);
134
503
  }
135
- /**
136
- * Simulates the empty block root rollup circuit from its inputs.
137
- * @param input - Inputs to the circuit.
138
- * @returns The public inputs as outputs of the simulation.
139
- */ async getEmptyBlockRootRollupProof(input) {
140
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'EmptyBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap);
141
- const verificationKey = this.getVerificationKeyDataForCircuit('EmptyBlockRootRollupArtifact');
142
- await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
143
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
504
+ getBlockRootEmptyTxFirstRollupProof(input) {
505
+ return this.createRecursiveProofAndVerify(input, 'BlockRootEmptyTxFirstRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootEmptyTxFirstRollupPrivateInputsToWitnessMap, convertBlockRootEmptyTxFirstRollupOutputsFromWitnessMap);
144
506
  }
145
- async getPaddingBlockRootRollupProof(input) {
146
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'PaddingBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap);
147
- const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
148
- await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
149
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
507
+ getBlockRootRollupProof(input) {
508
+ return this.createRecursiveProofAndVerify(input, 'BlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootRollupPrivateInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap);
150
509
  }
151
- /**
152
- * Simulates the block merge rollup circuit from its inputs.
153
- * @param input - Inputs to the circuit.
154
- * @returns The public inputs as outputs of the simulation.
155
- */ async getBlockMergeRollupProof(input) {
156
- const { circuitOutput, proof } = await this.createRecursiveProof(input, 'BlockMergeRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap);
157
- const verificationKey = this.getVerificationKeyDataForCircuit('BlockMergeRollupArtifact');
158
- await this.verifyProof('BlockMergeRollupArtifact', proof.binaryProof);
159
- return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
510
+ getBlockRootSingleTxRollupProof(input) {
511
+ return this.createRecursiveProofAndVerify(input, 'BlockRootSingleTxRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockRootSingleTxRollupPrivateInputsToWitnessMap, convertBlockRootSingleTxRollupOutputsFromWitnessMap);
512
+ }
513
+ getBlockMergeRollupProof(input) {
514
+ return this.createRecursiveProofAndVerify(input, 'BlockMergeRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertBlockMergeRollupPrivateInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap);
515
+ }
516
+ getCheckpointRootRollupProof(input) {
517
+ return this.createRecursiveProofAndVerify(input, 'CheckpointRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertCheckpointRootRollupPrivateInputsToWitnessMap, convertCheckpointRootRollupOutputsFromWitnessMap);
518
+ }
519
+ getCheckpointRootSingleBlockRollupProof(input) {
520
+ return this.createRecursiveProofAndVerify(input, 'CheckpointRootSingleBlockRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertCheckpointRootSingleBlockRollupPrivateInputsToWitnessMap, convertCheckpointRootSingleBlockRollupOutputsFromWitnessMap);
521
+ }
522
+ getCheckpointPaddingRollupProof(input) {
523
+ return this.createRecursiveProofAndVerify(input, 'CheckpointPaddingRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertCheckpointPaddingRollupPrivateInputsToWitnessMap, convertCheckpointPaddingRollupOutputsFromWitnessMap);
524
+ }
525
+ getCheckpointMergeRollupProof(input) {
526
+ return this.createRecursiveProofAndVerify(input, 'CheckpointMergeRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertCheckpointMergeRollupPrivateInputsToWitnessMap, convertCheckpointMergeRollupOutputsFromWitnessMap);
160
527
  }
161
528
  /**
162
529
  * Simulates the root rollup circuit from its inputs.
163
530
  * @param input - Inputs to the circuit.
164
531
  * @returns The public inputs as outputs of the simulation.
165
532
  */ async getRootRollupProof(input) {
166
- const { circuitOutput, proof } = await this.createProof(input, 'RootRollupArtifact', convertRootRollupInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap);
167
- const recursiveProof = makeRecursiveProofFromBinary(proof, NESTED_RECURSIVE_PROOF_LENGTH);
168
- const verificationKey = this.getVerificationKeyDataForCircuit('RootRollupArtifact');
169
- await this.verifyProof('RootRollupArtifact', proof);
533
+ const { proof, ...output } = await this.createRecursiveProofAndVerify(input, 'RootRollupArtifact', ULTRA_KECCAK_PROOF_LENGTH, convertRootRollupPrivateInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap);
534
+ const recursiveProof = makeRecursiveProofFromBinary(proof.binaryProof, NESTED_RECURSIVE_PROOF_LENGTH);
170
535
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/13188): Remove this hack.
171
536
  recursiveProof.binaryProof.numPublicInputs += PAIRING_POINTS_SIZE;
172
- return makePublicInputsAndRecursiveProof(circuitOutput, recursiveProof, verificationKey);
537
+ return {
538
+ ...output,
539
+ proof: recursiveProof
540
+ };
541
+ }
542
+ async createRecursiveProofAndVerify(input, artifactName, proofLength, convertInput, convertOutput) {
543
+ const { circuitOutput, proof } = await this.createRecursiveProof(input, artifactName, proofLength, convertInput, convertOutput);
544
+ await this.verifyProof(artifactName, proof.binaryProof);
545
+ const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
546
+ return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
173
547
  }
174
548
  async generateProofWithBB(input, circuitType, convertInput, convertOutput, workingDirectory) {
175
549
  // Have the ACVM write the partial witness here
@@ -196,7 +570,7 @@ const logger = createLogger('bb-prover');
196
570
  });
197
571
  // Now prove the circuit from the generated witness
198
572
  logger.debug(`Proving ${circuitType}...`);
199
- const provingResult = await generateProof(this.config.bbBinaryPath, workingDirectory, circuitType, Buffer.from(artifact.bytecode, 'base64'), outputWitnessFile, getUltraHonkFlavorForCircuit(circuitType), logger);
573
+ const provingResult = await generateProof(this.config.bbBinaryPath, workingDirectory, circuitType, Buffer.from(artifact.bytecode, 'base64'), this.getVerificationKeyDataForCircuit(circuitType).keyAsBytes, outputWitnessFile, getUltraHonkFlavorForCircuit(circuitType), logger);
200
574
  if (provingResult.status === BB_RESULT.FAILURE) {
201
575
  logger.error(`Failed to generate proof for ${circuitType}: ${provingResult.reason}`);
202
576
  throw new ProvingError(provingResult.reason, provingResult, provingResult.retry);
@@ -206,35 +580,6 @@ const logger = createLogger('bb-prover');
206
580
  provingResult
207
581
  };
208
582
  }
209
- async createProof(input, circuitType, convertInput, convertOutput) {
210
- const operation = async (bbWorkingDirectory)=>{
211
- const { provingResult, circuitOutput: output } = await this.generateProofWithBB(input, circuitType, convertInput, convertOutput, bbWorkingDirectory);
212
- const vkData = this.getVerificationKeyDataForCircuit(circuitType);
213
- const PROOF_LENGTH = circuitType == 'RootRollupArtifact' ? ULTRA_KECCAK_PROOF_LENGTH : RECURSIVE_PROOF_LENGTH;
214
- const proof = await readProofAsFields(provingResult.proofPath, vkData, PROOF_LENGTH, logger);
215
- const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
216
- this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
217
- this.instrumentation.recordSize('proofSize', circuitName, proof.binaryProof.buffer.length);
218
- this.instrumentation.recordSize('circuitPublicInputCount', circuitName, vkData.numPublicInputs);
219
- this.instrumentation.recordSize('circuitSize', circuitName, vkData.circuitSize);
220
- logger.info(`Generated proof for ${circuitType} in ${Math.ceil(provingResult.durationMs)} ms`, {
221
- circuitName,
222
- // does not include reading the proof from disk
223
- duration: provingResult.durationMs,
224
- proofSize: proof.binaryProof.buffer.length,
225
- eventName: 'circuit-proving',
226
- // circuitOutput is the partial witness that became the input to the proof
227
- inputSize: output.toBuffer().length,
228
- circuitSize: vkData.circuitSize,
229
- numPublicInputs: vkData.numPublicInputs
230
- });
231
- return {
232
- circuitOutput: output,
233
- proof: proof.binaryProof
234
- };
235
- };
236
- return await this.runInDirectory(operation);
237
- }
238
583
  async generateAvmProofWithBB(input, workingDirectory) {
239
584
  logger.info(`Proving avm-circuit for TX ${input.hints.tx.hash}...`);
240
585
  const provingResult = await generateAvmProof(this.config.bbBinaryPath, workingDirectory, input, logger);
@@ -244,18 +589,6 @@ const logger = createLogger('bb-prover');
244
589
  }
245
590
  return provingResult;
246
591
  }
247
- async generateTubeProofWithBB(bbWorkingDirectory, input) {
248
- logger.debug(`Proving tube...`);
249
- const hasher = crypto.createHash('sha256');
250
- hasher.update(input.toBuffer());
251
- await writeClientIVCProofToOutputDirectory(input.clientIVCData, bbWorkingDirectory);
252
- const provingResult = await generateTubeProof(this.config.bbBinaryPath, bbWorkingDirectory, input.usePublicTailVk ? PUBLIC_TAIL_CIVC_VK : PRIVATE_TAIL_CIVC_VK, logger.verbose);
253
- if (provingResult.status === BB_RESULT.FAILURE) {
254
- logger.error(`Failed to generate proof for tube circuit: ${provingResult.reason}`);
255
- throw new ProvingError(provingResult.reason, provingResult, provingResult.retry);
256
- }
257
- return provingResult;
258
- }
259
592
  async createAvmProof(input) {
260
593
  const operation = async (bbWorkingDirectory)=>{
261
594
  const provingResult = await this.generateAvmProofWithBB(input, bbWorkingDirectory);
@@ -280,25 +613,6 @@ const logger = createLogger('bb-prover');
280
613
  };
281
614
  return await this.runInDirectory(operation);
282
615
  }
283
- async getTubeProof(input) {
284
- const operation = async (bbWorkingDirectory)=>{
285
- logger.debug(`createTubeProof: ${bbWorkingDirectory}`);
286
- const provingResult = await this.generateTubeProofWithBB(bbWorkingDirectory, input);
287
- // Read the proof as fields
288
- // TODO(AD): this is the only remaining use of extractVkData.
289
- const tubeVK = await extractVkData(provingResult.vkDirectoryPath);
290
- const tubeProof = await readProofAsFields(provingResult.proofPath, tubeVK, TUBE_PROOF_LENGTH, logger);
291
- this.instrumentation.recordDuration('provingDuration', 'tubeCircuit', provingResult.durationMs);
292
- this.instrumentation.recordSize('proofSize', 'tubeCircuit', tubeProof.binaryProof.buffer.length);
293
- this.instrumentation.recordSize('circuitPublicInputCount', 'tubeCircuit', tubeVK.numPublicInputs);
294
- this.instrumentation.recordSize('circuitSize', 'tubeCircuit', tubeVK.circuitSize);
295
- // Sanity check the tube proof (can be removed later)
296
- await this.verifyWithKey('ultra_rollup_honk', tubeVK, tubeProof.binaryProof);
297
- logger.info(`Generated proof for tubeCircuit in ${Math.ceil(provingResult.durationMs)} ms, size: ${tubeProof.proof.length} fields`);
298
- return makeProofAndVerificationKey(tubeProof, tubeVK);
299
- };
300
- return await this.runInDirectory(operation);
301
- }
302
616
  /**
303
617
  * Executes a circuit and returns its outputs and corresponding proof with embedded aggregation object
304
618
  * @param witnessMap - The input witness
@@ -308,12 +622,12 @@ const logger = createLogger('bb-prover');
308
622
  * @param convertOutput - Function for parsing the output witness to it's corresponding object
309
623
  * @returns The circuits output object and it's proof
310
624
  */ async createRecursiveProof(input, circuitType, proofLength, convertInput, convertOutput) {
311
- // this probably is gonna need to call client ivc
625
+ // this probably is gonna need to call chonk
312
626
  const operation = async (bbWorkingDirectory)=>{
313
627
  const { provingResult, circuitOutput: output } = await this.generateProofWithBB(input, circuitType, convertInput, convertOutput, bbWorkingDirectory);
314
628
  const vkData = this.getVerificationKeyDataForCircuit(circuitType);
315
629
  // Read the proof as fields
316
- const proof = await readProofAsFields(provingResult.proofPath, vkData, proofLength, logger);
630
+ const proof = await readProofsFromOutputDirectory(provingResult.proofPath, vkData, proofLength, logger);
317
631
  const circuitName = mapProtocolArtifactNameToCircuitName(circuitType);
318
632
  this.instrumentation.recordDuration('provingDuration', circuitName, provingResult.durationMs);
319
633
  this.instrumentation.recordSize('proofSize', circuitName, proof.binaryProof.buffer.length);
@@ -399,18 +713,3 @@ const logger = createLogger('bb-prover');
399
713
  }), this.config.bbSkipCleanup, logger);
400
714
  }
401
715
  }
402
- _ts_decorate([
403
- trackSpan('BBNativeRollupProver.getBaseParityProof', {
404
- [Attributes.PROTOCOL_CIRCUIT_NAME]: 'base-parity'
405
- })
406
- ], BBNativeRollupProver.prototype, "getBaseParityProof", null);
407
- _ts_decorate([
408
- trackSpan('BBNativeRollupProver.getRootParityProof', {
409
- [Attributes.PROTOCOL_CIRCUIT_NAME]: 'root-parity'
410
- })
411
- ], BBNativeRollupProver.prototype, "getRootParityProof", null);
412
- _ts_decorate([
413
- trackSpan('BBNativeRollupProver.getAvmProof', (inputs)=>({
414
- [Attributes.APP_CIRCUIT_NAME]: inputs.hints.tx.hash
415
- }))
416
- ], BBNativeRollupProver.prototype, "getAvmProof", null);