@aztec/bb.js 0.84.0 → 0.85.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.
- package/dest/browser/barretenberg/backend.d.ts +1 -2
- package/dest/browser/barretenberg/backend.d.ts.map +1 -1
- package/dest/browser/barretenberg-threads.js +1 -1
- package/dest/browser/barretenberg.js +1 -1
- package/dest/browser/barretenberg_api/index.d.ts +10 -12
- package/dest/browser/barretenberg_api/index.d.ts.map +1 -1
- package/dest/browser/index.d.ts +1 -1
- package/dest/browser/index.d.ts.map +1 -1
- package/dest/browser/index.js +33 -60
- package/dest/browser/proof/index.d.ts +1 -10
- package/dest/browser/proof/index.d.ts.map +1 -1
- package/dest/node/barretenberg/backend.d.ts +1 -2
- package/dest/node/barretenberg/backend.d.ts.map +1 -1
- package/dest/node/barretenberg/backend.js +11 -31
- package/dest/node/barretenberg_api/index.d.ts +10 -12
- package/dest/node/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node/barretenberg_api/index.js +21 -35
- package/dest/node/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/dest/node/index.d.ts +1 -1
- package/dest/node/index.d.ts.map +1 -1
- package/dest/node/index.js +2 -2
- package/dest/node/main.d.ts +4 -5
- package/dest/node/main.d.ts.map +1 -1
- package/dest/node/main.js +30 -61
- package/dest/node/proof/index.d.ts +1 -10
- package/dest/node/proof/index.d.ts.map +1 -1
- package/dest/node/proof/index.js +2 -1
- package/dest/node-cjs/barretenberg/backend.d.ts +1 -2
- package/dest/node-cjs/barretenberg/backend.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg/backend.js +10 -30
- package/dest/node-cjs/barretenberg_api/index.d.ts +10 -12
- package/dest/node-cjs/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_api/index.js +21 -35
- package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm.gz +0 -0
- package/dest/node-cjs/index.d.ts +1 -1
- package/dest/node-cjs/index.d.ts.map +1 -1
- package/dest/node-cjs/index.js +3 -2
- package/dest/node-cjs/main.d.ts +4 -5
- package/dest/node-cjs/main.d.ts.map +1 -1
- package/dest/node-cjs/main.js +31 -63
- package/dest/node-cjs/proof/index.d.ts +1 -10
- package/dest/node-cjs/proof/index.d.ts.map +1 -1
- package/dest/node-cjs/proof/index.js +3 -2
- package/package.json +1 -1
- package/src/barretenberg/backend.ts +10 -50
- package/src/barretenberg_api/index.ts +18 -48
- package/src/index.ts +1 -1
- package/src/main.ts +25 -67
- package/src/proof/index.ts +1 -10
|
@@ -447,10 +447,9 @@ export class BarretenbergApi {
|
|
|
447
447
|
|
|
448
448
|
async acirProveAndVerifyUltraHonk(
|
|
449
449
|
constraintSystemBuf: Uint8Array,
|
|
450
|
-
recursive: boolean,
|
|
451
450
|
witnessBuf: Uint8Array,
|
|
452
451
|
): Promise<boolean> {
|
|
453
|
-
const inArgs = [constraintSystemBuf,
|
|
452
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
454
453
|
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
455
454
|
const result = await this.wasm.callWasmExport(
|
|
456
455
|
'acir_prove_and_verify_ultra_honk',
|
|
@@ -463,10 +462,9 @@ export class BarretenbergApi {
|
|
|
463
462
|
|
|
464
463
|
async acirProveAndVerifyMegaHonk(
|
|
465
464
|
constraintSystemBuf: Uint8Array,
|
|
466
|
-
recursive: boolean,
|
|
467
465
|
witnessBuf: Uint8Array,
|
|
468
466
|
): Promise<boolean> {
|
|
469
|
-
const inArgs = [constraintSystemBuf,
|
|
467
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
470
468
|
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
471
469
|
const result = await this.wasm.callWasmExport(
|
|
472
470
|
'acir_prove_and_verify_mega_honk',
|
|
@@ -477,22 +475,6 @@ export class BarretenbergApi {
|
|
|
477
475
|
return out[0];
|
|
478
476
|
}
|
|
479
477
|
|
|
480
|
-
async acirFoldAndVerifyProgramStack(
|
|
481
|
-
constraintSystemBuf: Uint8Array,
|
|
482
|
-
recursive: boolean,
|
|
483
|
-
witnessBuf: Uint8Array,
|
|
484
|
-
): Promise<boolean> {
|
|
485
|
-
const inArgs = [constraintSystemBuf, recursive, witnessBuf].map(serializeBufferable);
|
|
486
|
-
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
487
|
-
const result = await this.wasm.callWasmExport(
|
|
488
|
-
'acir_fold_and_verify_program_stack',
|
|
489
|
-
inArgs,
|
|
490
|
-
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
491
|
-
);
|
|
492
|
-
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
493
|
-
return out[0];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
478
|
async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
|
|
497
479
|
const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
|
|
498
480
|
const outTypes: OutputType[] = [];
|
|
@@ -629,8 +611,8 @@ export class BarretenbergApi {
|
|
|
629
611
|
return out[0];
|
|
630
612
|
}
|
|
631
613
|
|
|
632
|
-
async acirProveUltraHonk(acirVec: Uint8Array,
|
|
633
|
-
const inArgs = [acirVec,
|
|
614
|
+
async acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
|
|
615
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
634
616
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
635
617
|
const result = await this.wasm.callWasmExport(
|
|
636
618
|
'acir_prove_ultra_honk',
|
|
@@ -641,8 +623,8 @@ export class BarretenbergApi {
|
|
|
641
623
|
return out[0];
|
|
642
624
|
}
|
|
643
625
|
|
|
644
|
-
async acirProveUltraKeccakHonk(acirVec: Uint8Array,
|
|
645
|
-
const inArgs = [acirVec,
|
|
626
|
+
async acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Promise<Uint8Array> {
|
|
627
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
646
628
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
647
629
|
const result = await this.wasm.callWasmExport(
|
|
648
630
|
'acir_prove_ultra_keccak_honk',
|
|
@@ -677,8 +659,8 @@ export class BarretenbergApi {
|
|
|
677
659
|
return out[0];
|
|
678
660
|
}
|
|
679
661
|
|
|
680
|
-
async acirWriteVkUltraHonk(acirVec: Uint8Array
|
|
681
|
-
const inArgs = [acirVec
|
|
662
|
+
async acirWriteVkUltraHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
663
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
682
664
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
683
665
|
const result = await this.wasm.callWasmExport(
|
|
684
666
|
'acir_write_vk_ultra_honk',
|
|
@@ -689,8 +671,8 @@ export class BarretenbergApi {
|
|
|
689
671
|
return out[0];
|
|
690
672
|
}
|
|
691
673
|
|
|
692
|
-
async acirWriteVkUltraKeccakHonk(acirVec: Uint8Array
|
|
693
|
-
const inArgs = [acirVec
|
|
674
|
+
async acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Promise<Uint8Array> {
|
|
675
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
694
676
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
695
677
|
const result = await this.wasm.callWasmExport(
|
|
696
678
|
'acir_write_vk_ultra_keccak_honk',
|
|
@@ -1146,8 +1128,8 @@ export class BarretenbergApiSync {
|
|
|
1146
1128
|
return out[0];
|
|
1147
1129
|
}
|
|
1148
1130
|
|
|
1149
|
-
acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array,
|
|
1150
|
-
const inArgs = [constraintSystemBuf,
|
|
1131
|
+
acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
|
|
1132
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
1151
1133
|
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1152
1134
|
const result = this.wasm.callWasmExport(
|
|
1153
1135
|
'acir_prove_and_verify_ultra_honk',
|
|
@@ -1158,8 +1140,8 @@ export class BarretenbergApiSync {
|
|
|
1158
1140
|
return out[0];
|
|
1159
1141
|
}
|
|
1160
1142
|
|
|
1161
|
-
acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array,
|
|
1162
|
-
const inArgs = [constraintSystemBuf,
|
|
1143
|
+
acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
|
|
1144
|
+
const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
|
|
1163
1145
|
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1164
1146
|
const result = this.wasm.callWasmExport(
|
|
1165
1147
|
'acir_prove_and_verify_mega_honk',
|
|
@@ -1170,18 +1152,6 @@ export class BarretenbergApiSync {
|
|
|
1170
1152
|
return out[0];
|
|
1171
1153
|
}
|
|
1172
1154
|
|
|
1173
|
-
acirFoldAndVerifyProgramStack(constraintSystemBuf: Uint8Array, recursive: boolean, witnessBuf: Uint8Array): boolean {
|
|
1174
|
-
const inArgs = [constraintSystemBuf, recursive, witnessBuf].map(serializeBufferable);
|
|
1175
|
-
const outTypes: OutputType[] = [BoolDeserializer()];
|
|
1176
|
-
const result = this.wasm.callWasmExport(
|
|
1177
|
-
'acir_fold_and_verify_program_stack',
|
|
1178
|
-
inArgs,
|
|
1179
|
-
outTypes.map(t => t.SIZE_IN_BYTES),
|
|
1180
|
-
);
|
|
1181
|
-
const out = result.map((r, i) => outTypes[i].fromBuffer(r));
|
|
1182
|
-
return out[0];
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
1155
|
acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
|
|
1186
1156
|
const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
|
|
1187
1157
|
const outTypes: OutputType[] = [];
|
|
@@ -1278,8 +1248,8 @@ export class BarretenbergApiSync {
|
|
|
1278
1248
|
return out as any;
|
|
1279
1249
|
}
|
|
1280
1250
|
|
|
1281
|
-
acirProveUltraHonk(acirVec: Uint8Array,
|
|
1282
|
-
const inArgs = [acirVec,
|
|
1251
|
+
acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
|
|
1252
|
+
const inArgs = [acirVec, witnessVec].map(serializeBufferable);
|
|
1283
1253
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1284
1254
|
const result = this.wasm.callWasmExport(
|
|
1285
1255
|
'acir_prove_ultra_honk',
|
|
@@ -1302,8 +1272,8 @@ export class BarretenbergApiSync {
|
|
|
1302
1272
|
return out[0];
|
|
1303
1273
|
}
|
|
1304
1274
|
|
|
1305
|
-
acirWriteVkUltraHonk(acirVec: Uint8Array
|
|
1306
|
-
const inArgs = [acirVec
|
|
1275
|
+
acirWriteVkUltraHonk(acirVec: Uint8Array): Uint8Array {
|
|
1276
|
+
const inArgs = [acirVec].map(serializeBufferable);
|
|
1307
1277
|
const outTypes: OutputType[] = [BufferDeserializer()];
|
|
1308
1278
|
const result = this.wasm.callWasmExport(
|
|
1309
1279
|
'acir_write_vk_ultra_honk',
|
package/src/index.ts
CHANGED
|
@@ -10,4 +10,4 @@ export {
|
|
|
10
10
|
} from './barretenberg/index.js';
|
|
11
11
|
|
|
12
12
|
export { RawBuffer, Fr } from './types/index.js';
|
|
13
|
-
export { splitHonkProof, reconstructHonkProof, ProofData } from './proof/index.js';
|
|
13
|
+
export { splitHonkProof, reconstructHonkProof, deflattenFields, ProofData } from './proof/index.js';
|
package/src/main.ts
CHANGED
|
@@ -108,12 +108,13 @@ async function initUltraPlonk(
|
|
|
108
108
|
return { api, acirComposer, circuitSize, subgroupSize };
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async function initUltraHonk(bytecodePath: string,
|
|
111
|
+
async function initUltraHonk(bytecodePath: string, crsPath: string) {
|
|
112
112
|
const api = await Barretenberg.new({ threads });
|
|
113
113
|
|
|
114
114
|
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1248): Get rid of this call to avoid building the circuit twice.
|
|
115
115
|
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1126): use specific UltraHonk function
|
|
116
|
-
|
|
116
|
+
// recursive here is useless for UH, as it does not affect anything
|
|
117
|
+
const circuitSize = await getGatesUltra(bytecodePath, /*recursive=*/ false, /*honkRecursion=*/ true, api);
|
|
117
118
|
// TODO(https://github.com/AztecProtocol/barretenberg/issues/811): remove subgroupSizeOverride hack for goblin
|
|
118
119
|
const dyadicCircuitSize = Math.pow(2, Math.ceil(Math.log2(circuitSize)));
|
|
119
120
|
|
|
@@ -185,17 +186,16 @@ export async function proveAndVerify(bytecodePath: string, recursive: boolean, w
|
|
|
185
186
|
|
|
186
187
|
export async function proveAndVerifyUltraHonk(
|
|
187
188
|
bytecodePath: string,
|
|
188
|
-
recursive: boolean,
|
|
189
189
|
witnessPath: string,
|
|
190
190
|
crsPath: string,
|
|
191
191
|
) {
|
|
192
192
|
/* eslint-disable camelcase */
|
|
193
|
-
const { api } = await initUltraHonk(bytecodePath,
|
|
193
|
+
const { api } = await initUltraHonk(bytecodePath, crsPath);
|
|
194
194
|
try {
|
|
195
195
|
const bytecode = getBytecode(bytecodePath);
|
|
196
196
|
const witness = getWitness(witnessPath);
|
|
197
197
|
|
|
198
|
-
const verified = await api.acirProveAndVerifyUltraHonk(bytecode,
|
|
198
|
+
const verified = await api.acirProveAndVerifyUltraHonk(bytecode, witness);
|
|
199
199
|
return verified;
|
|
200
200
|
} finally {
|
|
201
201
|
await api.destroy();
|
|
@@ -205,7 +205,6 @@ export async function proveAndVerifyUltraHonk(
|
|
|
205
205
|
|
|
206
206
|
export async function proveAndVerifyMegaHonk(
|
|
207
207
|
bytecodePath: string,
|
|
208
|
-
recursive: boolean,
|
|
209
208
|
witnessPath: string,
|
|
210
209
|
crsPath: string,
|
|
211
210
|
) {
|
|
@@ -215,7 +214,7 @@ export async function proveAndVerifyMegaHonk(
|
|
|
215
214
|
const bytecode = getBytecode(bytecodePath);
|
|
216
215
|
const witness = getWitness(witnessPath);
|
|
217
216
|
|
|
218
|
-
const verified = await api.acirProveAndVerifyMegaHonk(bytecode,
|
|
217
|
+
const verified = await api.acirProveAndVerifyMegaHonk(bytecode, witness);
|
|
219
218
|
return verified;
|
|
220
219
|
} finally {
|
|
221
220
|
await api.destroy();
|
|
@@ -239,27 +238,6 @@ export async function proveAndVerifyAztecClient(bytecodePath: string, witnessPat
|
|
|
239
238
|
/* eslint-enable camelcase */
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
export async function foldAndVerifyProgram(
|
|
243
|
-
bytecodePath: string,
|
|
244
|
-
recursive: boolean,
|
|
245
|
-
witnessPath: string,
|
|
246
|
-
crsPath: string,
|
|
247
|
-
) {
|
|
248
|
-
/* eslint-disable camelcase */
|
|
249
|
-
const { api } = await initClientIVC(crsPath);
|
|
250
|
-
try {
|
|
251
|
-
const bytecode = getBytecode(bytecodePath);
|
|
252
|
-
const witness = getWitness(witnessPath);
|
|
253
|
-
|
|
254
|
-
const verified = await api.acirFoldAndVerifyProgramStack(bytecode, recursive, witness);
|
|
255
|
-
debug(`Verification ${verified ? 'successful' : 'failed'}`);
|
|
256
|
-
return verified;
|
|
257
|
-
} finally {
|
|
258
|
-
await api.destroy();
|
|
259
|
-
}
|
|
260
|
-
/* eslint-enable camelcase */
|
|
261
|
-
}
|
|
262
|
-
|
|
263
241
|
export async function prove(
|
|
264
242
|
bytecodePath: string,
|
|
265
243
|
recursive: boolean,
|
|
@@ -335,7 +313,7 @@ export async function contract(outputPath: string, vkPath: string, crsPath: stri
|
|
|
335
313
|
}
|
|
336
314
|
|
|
337
315
|
export async function contractUltraHonk(bytecodePath: string, vkPath: string, crsPath: string, outputPath: string) {
|
|
338
|
-
const { api } = await initUltraHonk(bytecodePath,
|
|
316
|
+
const { api } = await initUltraHonk(bytecodePath, crsPath);
|
|
339
317
|
try {
|
|
340
318
|
debug(`Creating UltraHonk verifier contract bytecode=${bytecodePath} vk=${vkPath}`);
|
|
341
319
|
const bytecode = getBytecode(bytecodePath);
|
|
@@ -444,22 +422,21 @@ export async function vkAsFields(vkPath: string, vkeyOutputPath: string, crsPath
|
|
|
444
422
|
|
|
445
423
|
export async function proveUltraHonk(
|
|
446
424
|
bytecodePath: string,
|
|
447
|
-
recursive: boolean,
|
|
448
425
|
witnessPath: string,
|
|
449
426
|
crsPath: string,
|
|
450
427
|
outputPath: string,
|
|
451
428
|
options?: UltraHonkBackendOptions,
|
|
452
429
|
) {
|
|
453
|
-
const { api } = await initUltraHonk(bytecodePath,
|
|
430
|
+
const { api } = await initUltraHonk(bytecodePath, crsPath);
|
|
454
431
|
try {
|
|
455
|
-
debug(`Creating UltraHonk proof bytecode=${bytecodePath}
|
|
432
|
+
debug(`Creating UltraHonk proof bytecode=${bytecodePath}`);
|
|
456
433
|
const bytecode = getBytecode(bytecodePath);
|
|
457
434
|
const witness = getWitness(witnessPath);
|
|
458
435
|
|
|
459
436
|
const acirProveUltraHonk = options?.keccak
|
|
460
437
|
? api.acirProveUltraKeccakHonk.bind(api)
|
|
461
438
|
: api.acirProveUltraHonk.bind(api);
|
|
462
|
-
const proof = await acirProveUltraHonk(bytecode,
|
|
439
|
+
const proof = await acirProveUltraHonk(bytecode, witness);
|
|
463
440
|
|
|
464
441
|
if (outputPath === '-') {
|
|
465
442
|
process.stdout.write(proof);
|
|
@@ -475,20 +452,19 @@ export async function proveUltraHonk(
|
|
|
475
452
|
|
|
476
453
|
export async function writeVkUltraHonk(
|
|
477
454
|
bytecodePath: string,
|
|
478
|
-
recursive: boolean,
|
|
479
455
|
crsPath: string,
|
|
480
456
|
outputPath: string,
|
|
481
457
|
options?: UltraHonkBackendOptions,
|
|
482
458
|
) {
|
|
483
|
-
const { api } = await initUltraHonk(bytecodePath,
|
|
459
|
+
const { api } = await initUltraHonk(bytecodePath, crsPath);
|
|
484
460
|
try {
|
|
485
461
|
const bytecode = getBytecode(bytecodePath);
|
|
486
|
-
debug(`Initializing UltraHonk verification key bytecode=${bytecodePath}
|
|
462
|
+
debug(`Initializing UltraHonk verification key bytecode=${bytecodePath}`);
|
|
487
463
|
|
|
488
464
|
const acirWriteVkUltraHonk = options?.keccak
|
|
489
465
|
? api.acirWriteVkUltraKeccakHonk.bind(api)
|
|
490
466
|
: api.acirWriteVkUltraHonk.bind(api);
|
|
491
|
-
const vk = await acirWriteVkUltraHonk(bytecode
|
|
467
|
+
const vk = await acirWriteVkUltraHonk(bytecode);
|
|
492
468
|
|
|
493
469
|
if (outputPath === '-') {
|
|
494
470
|
process.stdout.write(vk);
|
|
@@ -592,11 +568,10 @@ program
|
|
|
592
568
|
.command('prove_and_verify_ultra_honk')
|
|
593
569
|
.description('Generate an UltraHonk proof and verify it. Process exits with success or failure code.')
|
|
594
570
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
595
|
-
.option('-r, --recursive', 'Whether to use a SNARK friendly proof', false)
|
|
596
571
|
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
|
|
597
|
-
.action(async ({ bytecodePath,
|
|
572
|
+
.action(async ({ bytecodePath, witnessPath }) => {
|
|
598
573
|
const { crsPath } = handleGlobalOptions();
|
|
599
|
-
const result = await proveAndVerifyUltraHonk(bytecodePath,
|
|
574
|
+
const result = await proveAndVerifyUltraHonk(bytecodePath, witnessPath, crsPath);
|
|
600
575
|
process.exit(result ? 0 : 1);
|
|
601
576
|
});
|
|
602
577
|
|
|
@@ -604,11 +579,10 @@ program
|
|
|
604
579
|
.command('prove_and_verify_mega_honk')
|
|
605
580
|
.description('Generate a MegaHonk proof and verify it. Process exits with success or failure code.')
|
|
606
581
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
607
|
-
.option('-r, --recursive', 'Whether to use a SNARK friendly proof', false)
|
|
608
582
|
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
|
|
609
|
-
.action(async ({ bytecodePath,
|
|
583
|
+
.action(async ({ bytecodePath, witnessPath }) => {
|
|
610
584
|
const { crsPath } = handleGlobalOptions();
|
|
611
|
-
const result = await proveAndVerifyMegaHonk(bytecodePath,
|
|
585
|
+
const result = await proveAndVerifyMegaHonk(bytecodePath, witnessPath, crsPath);
|
|
612
586
|
process.exit(result ? 0 : 1);
|
|
613
587
|
});
|
|
614
588
|
|
|
@@ -623,18 +597,6 @@ program
|
|
|
623
597
|
process.exit(result ? 0 : 1);
|
|
624
598
|
});
|
|
625
599
|
|
|
626
|
-
program
|
|
627
|
-
.command('fold_and_verify_program')
|
|
628
|
-
.description('Accumulate a set of circuits using ClientIvc then verify. Process exits with success or failure code.')
|
|
629
|
-
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
630
|
-
.option('-r, --recursive', 'Create a SNARK friendly proof', false)
|
|
631
|
-
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
|
|
632
|
-
.action(async ({ bytecodePath, recursive, witnessPath }) => {
|
|
633
|
-
const { crsPath } = handleGlobalOptions();
|
|
634
|
-
const result = await foldAndVerifyProgram(bytecodePath, recursive, witnessPath, crsPath);
|
|
635
|
-
process.exit(result ? 0 : 1);
|
|
636
|
-
});
|
|
637
|
-
|
|
638
600
|
program
|
|
639
601
|
.command('prove')
|
|
640
602
|
.description('Generate a proof and write it to a file.')
|
|
@@ -738,46 +700,42 @@ program
|
|
|
738
700
|
.command('prove_ultra_honk')
|
|
739
701
|
.description('Generate a proof and write it to a file.')
|
|
740
702
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
741
|
-
.option('-r, --recursive', 'Create a SNARK friendly proof', false)
|
|
742
703
|
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
|
|
743
704
|
.option('-o, --output-path <path>', 'Specify the proof output path', './proofs/proof')
|
|
744
|
-
.action(async ({ bytecodePath,
|
|
705
|
+
.action(async ({ bytecodePath, witnessPath, outputPath }) => {
|
|
745
706
|
const { crsPath } = handleGlobalOptions();
|
|
746
|
-
await proveUltraHonk(bytecodePath,
|
|
707
|
+
await proveUltraHonk(bytecodePath, witnessPath, crsPath, outputPath);
|
|
747
708
|
});
|
|
748
709
|
|
|
749
710
|
program
|
|
750
711
|
.command('prove_ultra_keccak_honk')
|
|
751
712
|
.description('Generate a proof and write it to a file.')
|
|
752
713
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
753
|
-
.option('-r, --recursive', 'Create a SNARK friendly proof', false)
|
|
754
714
|
.option('-w, --witness-path <path>', 'Specify the witness path', './target/witness.gz')
|
|
755
715
|
.option('-o, --output-path <path>', 'Specify the proof output path', './proofs/proof')
|
|
756
|
-
.action(async ({ bytecodePath,
|
|
716
|
+
.action(async ({ bytecodePath, witnessPath, outputPath, crsPath }) => {
|
|
757
717
|
handleGlobalOptions();
|
|
758
|
-
await proveUltraHonk(bytecodePath,
|
|
718
|
+
await proveUltraHonk(bytecodePath, witnessPath, crsPath, outputPath, { keccak: true });
|
|
759
719
|
});
|
|
760
720
|
|
|
761
721
|
program
|
|
762
722
|
.command('write_vk_ultra_honk')
|
|
763
723
|
.description('Output verification key.')
|
|
764
724
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
765
|
-
.option('-r, --recursive', 'Create a SNARK friendly proof', false)
|
|
766
725
|
.requiredOption('-o, --output-path <path>', 'Specify the path to write the key')
|
|
767
|
-
.action(async ({ bytecodePath,
|
|
726
|
+
.action(async ({ bytecodePath, outputPath }) => {
|
|
768
727
|
const { crsPath } = handleGlobalOptions();
|
|
769
|
-
await writeVkUltraHonk(bytecodePath,
|
|
728
|
+
await writeVkUltraHonk(bytecodePath, crsPath, outputPath);
|
|
770
729
|
});
|
|
771
730
|
|
|
772
731
|
program
|
|
773
732
|
.command('write_vk_ultra_keccak_honk')
|
|
774
733
|
.description('Output verification key.')
|
|
775
734
|
.option('-b, --bytecode-path <path>', 'Specify the bytecode path', './target/program.json')
|
|
776
|
-
.option('-r, --recursive', 'Create a SNARK friendly proof', false)
|
|
777
735
|
.requiredOption('-o, --output-path <path>', 'Specify the path to write the key')
|
|
778
|
-
.action(async ({ bytecodePath,
|
|
736
|
+
.action(async ({ bytecodePath, outputPath, crsPath }) => {
|
|
779
737
|
handleGlobalOptions();
|
|
780
|
-
await writeVkUltraHonk(bytecodePath,
|
|
738
|
+
await writeVkUltraHonk(bytecodePath, crsPath, outputPath, { keccak: true });
|
|
781
739
|
});
|
|
782
740
|
|
|
783
741
|
program
|
package/src/proof/index.ts
CHANGED
|
@@ -11,16 +11,7 @@ export type ProofData = {
|
|
|
11
11
|
proof: Uint8Array;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
* @description
|
|
16
|
-
* The representation of a proof
|
|
17
|
-
* */
|
|
18
|
-
export type ProofDataForRecursion = {
|
|
19
|
-
/** @description Public inputs of a proof */
|
|
20
|
-
publicInputs: string[];
|
|
21
|
-
/** @description An byte array representing the proof */
|
|
22
|
-
proof: string[];
|
|
23
|
-
};
|
|
14
|
+
export const AGGREGATION_OBJECT_LENGTH = 16;
|
|
24
15
|
|
|
25
16
|
// Fields are 32 bytes
|
|
26
17
|
const fieldByteSize = 32;
|