@aztec/bb-prover 3.0.0-nightly.20251026 → 3.0.0-nightly.20251030-2
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/avm_proving_tests/avm_proving_tester.js +1 -1
- package/dest/bb/execute.d.ts +3 -3
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +6 -6
- package/dest/prover/client/bb_private_kernel_prover.d.ts +2 -2
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/bb_private_kernel_prover.js +1 -1
- package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts +3 -3
- package/dest/prover/client/native/bb_native_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/native/bb_native_private_kernel_prover.js +10 -10
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts +2 -2
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/client/wasm/bb_wasm_private_kernel_prover.js +6 -6
- package/dest/prover/proof_utils.d.ts +7 -7
- package/dest/prover/proof_utils.d.ts.map +1 -1
- package/dest/prover/proof_utils.js +17 -17
- package/dest/prover/server/bb_prover.d.ts +2 -2
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +5 -5
- package/dest/test/delay_values.js +2 -2
- package/dest/test/test_circuit_prover.d.ts +2 -2
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +3 -3
- package/dest/verifier/bb_verifier.js +6 -6
- package/dest/verifier/index.d.ts +1 -1
- package/dest/verifier/index.d.ts.map +1 -1
- package/dest/verifier/index.js +1 -1
- package/dest/verifier/{queued_ivc_verifier.d.ts → queued_chonk_verifier.d.ts} +1 -1
- package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
- package/dest/verifier/{queued_ivc_verifier.js → queued_chonk_verifier.js} +3 -3
- package/package.json +16 -16
- package/src/avm_proving_tests/avm_proving_tester.ts +1 -1
- package/src/bb/execute.ts +6 -6
- package/src/prover/client/bb_private_kernel_prover.ts +2 -2
- package/src/prover/client/native/bb_native_private_kernel_prover.ts +12 -12
- package/src/prover/client/wasm/bb_wasm_private_kernel_prover.ts +6 -6
- package/src/prover/proof_utils.ts +17 -17
- package/src/prover/server/bb_prover.ts +13 -11
- package/src/test/delay_values.ts +2 -2
- package/src/test/test_circuit_prover.ts +10 -8
- package/src/verifier/bb_verifier.ts +6 -6
- package/src/verifier/index.ts +1 -1
- package/src/verifier/{queued_ivc_verifier.ts → queued_chonk_verifier.ts} +3 -3
- package/dest/verifier/queued_ivc_verifier.d.ts.map +0 -1
|
@@ -5,7 +5,7 @@ import fs from 'node:fs/promises';
|
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { BB_RESULT, VK_FILENAME, generateAvmProof, verifyAvmProof } from '../bb/execute.js';
|
|
8
|
-
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
|
|
8
|
+
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
|
|
9
9
|
// An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
|
|
10
10
|
class InterceptingLogger {
|
|
11
11
|
logs = [];
|
package/dest/bb/execute.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ type BBExecResult = {
|
|
|
48
48
|
* @returns The completed partial witness outputted from the circuit
|
|
49
49
|
*/
|
|
50
50
|
export declare function executeBB(pathToBB: string, command: string, args: string[], logger: LogFn, concurrency?: number, timeout?: number, resultParser?: (code: number) => code is 0): Promise<BBExecResult>;
|
|
51
|
-
export declare function
|
|
51
|
+
export declare function executeBbChonkProof(pathToBB: string, workingDirectory: string, inputsPath: string, log: LogFn, writeVk?: boolean): Promise<BBFailure | BBSuccess>;
|
|
52
52
|
/**
|
|
53
53
|
* Used for generating proofs of noir circuits.
|
|
54
54
|
* It is assumed that the working directory is a temporary and/or random directory used solely for generating this proof.
|
|
@@ -83,7 +83,7 @@ export declare function generateAvmProof(pathToBB: string, workingDirectory: str
|
|
|
83
83
|
export declare function verifyProof(pathToBB: string, proofFullPath: string, verificationKeyPath: string, ultraHonkFlavor: UltraHonkFlavor, log: Logger): Promise<BBFailure | BBSuccess>;
|
|
84
84
|
export declare function verifyAvmProof(pathToBB: string, workingDirectory: string, proofFullPath: string, publicInputs: AvmCircuitPublicInputs, verificationKeyPath: string, logger: Logger): Promise<BBFailure | BBSuccess>;
|
|
85
85
|
/**
|
|
86
|
-
* Verifies a
|
|
86
|
+
* Verifies a ChonkProof
|
|
87
87
|
* TODO(#7370) The verification keys should be supplied separately
|
|
88
88
|
* @param pathToBB - The full path to the bb binary
|
|
89
89
|
* @param targetPath - The path to the folder with the proof, accumulator, and verification keys
|
|
@@ -91,7 +91,7 @@ export declare function verifyAvmProof(pathToBB: string, workingDirectory: strin
|
|
|
91
91
|
* @param concurrency - The number of threads to use for the verification
|
|
92
92
|
* @returns An object containing a result indication and duration taken
|
|
93
93
|
*/
|
|
94
|
-
export declare function
|
|
94
|
+
export declare function verifyChonkProof(pathToBB: string, proofPath: string, keyPath: string, log: LogFn, concurrency?: number): Promise<BBFailure | BBSuccess>;
|
|
95
95
|
export declare function generateContractForVerificationKey(pathToBB: string, vkFilePath: string, contractPath: string, log: LogFn): Promise<BBFailure | BBSuccess>;
|
|
96
96
|
/**
|
|
97
97
|
* Compute bb gate count for a given circuit
|
package/dest/bb/execute.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/bb/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAMlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD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AAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAShC;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,sBAAsB,EACpC,mBAAmB,EAAE,MAAM,EAC3B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAmBhC;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,KAAK,EACV,WAAW,SAAI,GACd,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA4BhC;AAqED,wBAAsB,kCAAkC,CACtD,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA8ChC;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GAAG,WAAW,EACrC,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA0DhC"}
|
package/dest/bb/execute.js
CHANGED
|
@@ -89,7 +89,7 @@ export var BB_RESULT = /*#__PURE__*/ function(BB_RESULT) {
|
|
|
89
89
|
signal: undefined
|
|
90
90
|
}));
|
|
91
91
|
}
|
|
92
|
-
export async function
|
|
92
|
+
export async function executeBbChonkProof(pathToBB, workingDirectory, inputsPath, log, writeVk = false) {
|
|
93
93
|
// Check that the working directory exists
|
|
94
94
|
try {
|
|
95
95
|
await fs.access(workingDirectory);
|
|
@@ -122,7 +122,7 @@ export async function executeBbClientIvcProof(pathToBB, workingDirectory, inputs
|
|
|
122
122
|
inputsPath,
|
|
123
123
|
'-v',
|
|
124
124
|
'--scheme',
|
|
125
|
-
'
|
|
125
|
+
'chonk'
|
|
126
126
|
];
|
|
127
127
|
if (writeVk) {
|
|
128
128
|
args.push('--write_vk');
|
|
@@ -384,14 +384,14 @@ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath,
|
|
|
384
384
|
]);
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
387
|
-
* Verifies a
|
|
387
|
+
* Verifies a ChonkProof
|
|
388
388
|
* TODO(#7370) The verification keys should be supplied separately
|
|
389
389
|
* @param pathToBB - The full path to the bb binary
|
|
390
390
|
* @param targetPath - The path to the folder with the proof, accumulator, and verification keys
|
|
391
391
|
* @param log - A logging function
|
|
392
392
|
* @param concurrency - The number of threads to use for the verification
|
|
393
393
|
* @returns An object containing a result indication and duration taken
|
|
394
|
-
*/ export async function
|
|
394
|
+
*/ export async function verifyChonkProof(pathToBB, proofPath, keyPath, log, concurrency = 1) {
|
|
395
395
|
const binaryPresent = await fs.access(pathToBB, fs.constants.R_OK).then((_)=>true).catch((_)=>false);
|
|
396
396
|
if (!binaryPresent) {
|
|
397
397
|
return {
|
|
@@ -402,7 +402,7 @@ export async function verifyAvmProof(pathToBB, workingDirectory, proofFullPath,
|
|
|
402
402
|
try {
|
|
403
403
|
const args = [
|
|
404
404
|
'--scheme',
|
|
405
|
-
'
|
|
405
|
+
'chonk',
|
|
406
406
|
'-p',
|
|
407
407
|
proofPath,
|
|
408
408
|
'-k',
|
|
@@ -604,7 +604,7 @@ export async function generateContractForVerificationKey(pathToBB, vkFilePath, c
|
|
|
604
604
|
const timer = new Timer();
|
|
605
605
|
const result = await executeBB(pathToBB, 'gates', [
|
|
606
606
|
'--scheme',
|
|
607
|
-
flavor === 'mega_honk' ? '
|
|
607
|
+
flavor === 'mega_honk' ? 'chonk' : 'ultra_honk',
|
|
608
608
|
'-b',
|
|
609
609
|
bytecodePath,
|
|
610
610
|
'-v'
|
|
@@ -3,7 +3,7 @@ import type { Abi, WitnessMap } from '@aztec/noir-types';
|
|
|
3
3
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
4
4
|
import type { PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { HidingKernelToPublicPrivateInputs, HidingKernelToRollupPrivateInputs, PrivateExecutionStep, PrivateKernelCircuitPublicInputs, PrivateKernelInitCircuitPrivateInputs, PrivateKernelInnerCircuitPrivateInputs, PrivateKernelResetCircuitPrivateInputs, PrivateKernelSimulateOutput, PrivateKernelTailCircuitPrivateInputs, PrivateKernelTailCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
7
7
|
export declare abstract class BBPrivateKernelProver implements PrivateKernelProver {
|
|
8
8
|
protected artifactProvider: ArtifactProvider;
|
|
9
9
|
protected simulator: CircuitSimulator;
|
|
@@ -26,7 +26,7 @@ export declare abstract class BBPrivateKernelProver implements PrivateKernelProv
|
|
|
26
26
|
toBuffer: () => Buffer;
|
|
27
27
|
}, O extends PrivateKernelCircuitPublicInputs | PrivateKernelTailCircuitPublicInputs>(inputs: I, circuitType: ClientProtocolArtifact, convertInputs: (inputs: I, abi: Abi) => WitnessMap, convertOutputs: (outputs: WitnessMap, abi: Abi) => O): Promise<PrivateKernelSimulateOutput<O>>;
|
|
28
28
|
makeEmptyKernelSimulateOutput<PublicInputsType extends PrivateKernelTailCircuitPublicInputs | PrivateKernelCircuitPublicInputs>(publicInputs: PublicInputsType, circuitType: ClientProtocolArtifact): Promise<PrivateKernelSimulateOutput<PublicInputsType>>;
|
|
29
|
-
|
|
29
|
+
createChonkProof(_executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
|
|
30
30
|
computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number>;
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=bb_private_kernel_prover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bb_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../src/prover/client/bb_private_kernel_prover.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EACV,iCAAiC,EACjC,iCAAiC,EACjC,oBAAoB,EACpB,gCAAgC,EAChC,qCAAqC,EACrC,sCAAsC,EACtC,sCAAsC,EACtC,2BAA2B,EAC3B,qCAAqC,EACrC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"bb_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../src/prover/client/bb_private_kernel_prover.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EACV,iCAAiC,EACjC,iCAAiC,EACjC,oBAAoB,EACpB,gCAAgC,EAChC,qCAAqC,EACrC,sCAAsC,EACtC,sCA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|
106
|
-
|
|
106
|
+
createChonkProof(_executionSteps) {
|
|
107
107
|
throw new Error('Not implemented');
|
|
108
108
|
}
|
|
109
109
|
computeGateCountForCircuit(_bytecode, _circuitName) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Logger } from '@aztec/foundation/log';
|
|
2
2
|
import type { CircuitSimulator } from '@aztec/simulator/server';
|
|
3
3
|
import { type PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
5
5
|
import type { BBConfig } from '../../../config.js';
|
|
6
6
|
import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
7
7
|
/**
|
|
@@ -15,8 +15,8 @@ export declare class BBNativePrivateKernelProver extends BBPrivateKernelProver {
|
|
|
15
15
|
protected log: Logger;
|
|
16
16
|
private constructor();
|
|
17
17
|
static new(config: BBConfig, simulator: CircuitSimulator, log?: Logger): Promise<BBNativePrivateKernelProver>;
|
|
18
|
-
private
|
|
19
|
-
|
|
18
|
+
private _createChonkProof;
|
|
19
|
+
createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
|
|
20
20
|
computeGateCountForCircuit(bytecode: Buffer, circuitName: string): Promise<number>;
|
|
21
21
|
private runInDirectory;
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bb_native_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/native/bb_native_private_kernel_prover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,KAAK,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"bb_native_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/native/bb_native_private_kernel_prover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,KAAK,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAMvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,qBAAqB;IAElE,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,WAAW;cACA,SAAS,EAAE,gBAAgB;cAC3B,GAAG;IALxB,OAAO;WAUa,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,MAAM;YAWrE,iBAAiB;IAuBT,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQ7F,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBxG,OAAO,CAAC,cAAc;CAavB"}
|
|
@@ -4,8 +4,8 @@ import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/clie
|
|
|
4
4
|
import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
5
5
|
import { promises as fs } from 'fs';
|
|
6
6
|
import path from 'path';
|
|
7
|
-
import { BB_RESULT, computeGateCountForCircuit,
|
|
8
|
-
import {
|
|
7
|
+
import { BB_RESULT, computeGateCountForCircuit, executeBbChonkProof } from '../../../bb/execute.js';
|
|
8
|
+
import { readChonkProofFromOutputDirectory } from '../../proof_utils.js';
|
|
9
9
|
import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
10
10
|
/**
|
|
11
11
|
* This proof creator implementation uses the native bb binary.
|
|
@@ -24,25 +24,25 @@ import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
|
24
24
|
});
|
|
25
25
|
return new BBNativePrivateKernelProver(config.bbBinaryPath, config.bbWorkingDirectory, !!config.bbSkipCleanup, simulator, log);
|
|
26
26
|
}
|
|
27
|
-
async
|
|
27
|
+
async _createChonkProof(directory, executionSteps) {
|
|
28
28
|
const inputsPath = path.join(directory, 'ivc-inputs.msgpack');
|
|
29
29
|
await fs.writeFile(inputsPath, serializePrivateExecutionSteps(executionSteps));
|
|
30
|
-
const provingResult = await
|
|
30
|
+
const provingResult = await executeBbChonkProof(this.bbBinaryPath, directory, inputsPath, this.log.info);
|
|
31
31
|
if (provingResult.status === BB_RESULT.FAILURE) {
|
|
32
|
-
this.log.error(`Failed to generate
|
|
32
|
+
this.log.error(`Failed to generate chonk proof`);
|
|
33
33
|
throw new Error(provingResult.reason);
|
|
34
34
|
}
|
|
35
|
-
const proof = await
|
|
36
|
-
this.log.info(`Generated
|
|
35
|
+
const proof = await readChonkProofFromOutputDirectory(directory);
|
|
36
|
+
this.log.info(`Generated Chonk proof`, {
|
|
37
37
|
duration: provingResult.durationMs,
|
|
38
38
|
eventName: 'circuit-proving'
|
|
39
39
|
});
|
|
40
40
|
return proof;
|
|
41
41
|
}
|
|
42
|
-
async
|
|
43
|
-
this.log.info(`Generating
|
|
42
|
+
async createChonkProof(executionSteps) {
|
|
43
|
+
this.log.info(`Generating Chonk proof`);
|
|
44
44
|
const operation = async (directory)=>{
|
|
45
|
-
return await this.
|
|
45
|
+
return await this._createChonkProof(directory, executionSteps);
|
|
46
46
|
};
|
|
47
47
|
return await this.runInDirectory(operation);
|
|
48
48
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
|
|
2
2
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
3
3
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
4
|
-
import {
|
|
4
|
+
import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
5
5
|
import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
6
6
|
export declare abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
7
7
|
protected artifactProvider: ArtifactProvider;
|
|
@@ -9,7 +9,7 @@ export declare abstract class BBWASMPrivateKernelProver extends BBPrivateKernelP
|
|
|
9
9
|
private threads;
|
|
10
10
|
protected log: import("@aztec/foundation/log").Logger;
|
|
11
11
|
constructor(artifactProvider: ArtifactProvider, simulator: CircuitSimulator, threads?: number, log?: import("@aztec/foundation/log").Logger);
|
|
12
|
-
|
|
12
|
+
createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs>;
|
|
13
13
|
computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=bb_wasm_private_kernel_prover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bb_wasm_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/wasm/bb_wasm_private_kernel_prover.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bb_wasm_private_kernel_prover.d.ts","sourceRoot":"","sources":["../../../../src/prover/client/wasm/bb_wasm_private_kernel_prover.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,8BAAsB,yBAA0B,SAAQ,qBAAqB;cAEtD,gBAAgB,EAAE,gBAAgB;cAClC,SAAS,EAAE,gBAAgB;IAC9C,OAAO,CAAC,OAAO;cACI,GAAG;gBAHH,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,gBAAgB,EACtC,OAAO,GAAE,MAAU,EACR,GAAG,yCAAiC;IAKnC,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAqB7F,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAa3G"}
|
|
@@ -2,7 +2,7 @@ import { AztecClientBackend } from '@aztec/bb.js';
|
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
4
|
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
5
|
-
import {
|
|
5
|
+
import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
6
6
|
import { ungzip } from 'pako';
|
|
7
7
|
import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
8
8
|
export class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
@@ -13,9 +13,9 @@ export class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
|
13
13
|
constructor(artifactProvider, simulator, threads = 1, log = createLogger('bb-prover:wasm')){
|
|
14
14
|
super(artifactProvider, simulator, log), this.artifactProvider = artifactProvider, this.simulator = simulator, this.threads = threads, this.log = log;
|
|
15
15
|
}
|
|
16
|
-
async
|
|
16
|
+
async createChonkProof(executionSteps) {
|
|
17
17
|
const timer = new Timer();
|
|
18
|
-
this.log.info(`Generating
|
|
18
|
+
this.log.info(`Generating Chonk proof...`);
|
|
19
19
|
const backend = new AztecClientBackend(executionSteps.map((step)=>ungzip(step.bytecode)), {
|
|
20
20
|
threads: this.threads,
|
|
21
21
|
logger: this.log.verbose,
|
|
@@ -23,12 +23,12 @@ export class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
|
23
23
|
});
|
|
24
24
|
const [proof] = await backend.prove(executionSteps.map((step)=>ungzip(serializeWitness(step.witness))), executionSteps.map((step)=>step.vk));
|
|
25
25
|
await backend.destroy();
|
|
26
|
-
this.log.info(`Generated
|
|
27
|
-
eventName: '
|
|
26
|
+
this.log.info(`Generated Chonk proof`, {
|
|
27
|
+
eventName: 'chonk-proof-generation',
|
|
28
28
|
duration: timer.ms(),
|
|
29
29
|
proofSize: proof.length
|
|
30
30
|
});
|
|
31
|
-
return
|
|
31
|
+
return ChonkProofWithPublicInputs.fromBufferArray(proof);
|
|
32
32
|
}
|
|
33
33
|
async computeGateCountForCircuit(_bytecode, _circuitName) {
|
|
34
34
|
// Note we do not pass the vk to the backend. This is unneeded for gate counts.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
-
import {
|
|
2
|
+
import { ChonkProofWithPublicInputs, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
3
3
|
import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
4
4
|
/**
|
|
5
|
-
* Create a
|
|
5
|
+
* Create a ChonkProof proof file.
|
|
6
6
|
*
|
|
7
7
|
* @param directory the directory to read the proof from.
|
|
8
|
-
* @returns the encapsulated
|
|
8
|
+
* @returns the encapsulated chonk proof
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function readChonkProofFromOutputDirectory(directory: string): Promise<ChonkProofWithPublicInputs>;
|
|
11
11
|
/**
|
|
12
|
-
* Serialize a
|
|
12
|
+
* Serialize a ChonkProof to a proof file.
|
|
13
13
|
*
|
|
14
|
-
* @param proof the
|
|
14
|
+
* @param proof the ChonkProof from object
|
|
15
15
|
* @param directory the directory to write in
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function writeChonkProofToPath(chonkProof: ChonkProofWithPublicInputs, outputPath: string): Promise<void>;
|
|
18
18
|
export declare function readProofsFromOutputDirectory<PROOF_LENGTH extends number>(directory: string, vkData: VerificationKeyData, proofLength: PROOF_LENGTH, logger: Logger): Promise<RecursiveProof<PROOF_LENGTH>>;
|
|
19
19
|
//# sourceMappingURL=proof_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof_utils.d.ts","sourceRoot":"","sources":["../../src/prover/proof_utils.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"proof_utils.d.ts","sourceRoot":"","sources":["../../src/prover/proof_utils.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAS,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQ7D;;;;;GAKG;AACH,wBAAsB,iCAAiC,CAAC,SAAS,EAAE,MAAM,uCAKxE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,iBAIrG;AAuBD,wBAAsB,6BAA6B,CAAC,YAAY,SAAS,MAAM,EAC7E,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CA2CvC"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CHONK_PROOF_LENGTH, HIDING_KERNEL_IO_PUBLIC_INPUTS_SIZE, IPA_CLAIM_SIZE, NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, PAIRING_POINTS_SIZE, ULTRA_KECCAK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import {
|
|
3
|
+
import { ChonkProofWithPublicInputs, Proof, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
4
4
|
import assert from 'assert';
|
|
5
5
|
import { promises as fs } from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import { PROOF_FILENAME, PUBLIC_INPUTS_FILENAME } from '../bb/execute.js';
|
|
8
8
|
/**
|
|
9
|
-
* Create a
|
|
9
|
+
* Create a ChonkProof proof file.
|
|
10
10
|
*
|
|
11
11
|
* @param directory the directory to read the proof from.
|
|
12
|
-
* @returns the encapsulated
|
|
13
|
-
*/ export async function
|
|
12
|
+
* @returns the encapsulated chonk proof
|
|
13
|
+
*/ export async function readChonkProofFromOutputDirectory(directory) {
|
|
14
14
|
const proofFilename = path.join(directory, PROOF_FILENAME);
|
|
15
15
|
const binaryProof = await fs.readFile(proofFilename);
|
|
16
16
|
const proofFields = splitBufferIntoFields(binaryProof);
|
|
17
|
-
return new
|
|
17
|
+
return new ChonkProofWithPublicInputs(proofFields);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Serialize a
|
|
20
|
+
* Serialize a ChonkProof to a proof file.
|
|
21
21
|
*
|
|
22
|
-
* @param proof the
|
|
22
|
+
* @param proof the ChonkProof from object
|
|
23
23
|
* @param directory the directory to write in
|
|
24
|
-
*/ export async function
|
|
25
|
-
// NB: Don't use
|
|
26
|
-
const fieldsBuf = Buffer.concat(
|
|
24
|
+
*/ export async function writeChonkProofToPath(chonkProof, outputPath) {
|
|
25
|
+
// NB: Don't use chonkProof.toBuffer here because it will include the proof length.
|
|
26
|
+
const fieldsBuf = Buffer.concat(chonkProof.fieldsWithPublicInputs.map((field)=>field.toBuffer()));
|
|
27
27
|
await fs.writeFile(outputPath, fieldsBuf);
|
|
28
28
|
}
|
|
29
29
|
function getNumCustomPublicInputs(proofLength, vkData) {
|
|
30
30
|
let numPublicInputs = vkData.numPublicInputs;
|
|
31
|
-
if (proofLength ==
|
|
31
|
+
if (proofLength == CHONK_PROOF_LENGTH) {
|
|
32
32
|
numPublicInputs -= HIDING_KERNEL_IO_PUBLIC_INPUTS_SIZE;
|
|
33
33
|
} else {
|
|
34
34
|
numPublicInputs -= PAIRING_POINTS_SIZE;
|
|
@@ -46,18 +46,18 @@ function splitBufferIntoFields(buffer) {
|
|
|
46
46
|
return fields;
|
|
47
47
|
}
|
|
48
48
|
export async function readProofsFromOutputDirectory(directory, vkData, proofLength, logger) {
|
|
49
|
-
assert(proofLength ==
|
|
49
|
+
assert(proofLength == CHONK_PROOF_LENGTH || proofLength == NESTED_RECURSIVE_PROOF_LENGTH || proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH || proofLength == ULTRA_KECCAK_PROOF_LENGTH, `Proof length must be one of the expected proof lengths, received ${proofLength}`);
|
|
50
50
|
const publicInputsFilename = path.join(directory, PUBLIC_INPUTS_FILENAME);
|
|
51
51
|
const proofFilename = path.join(directory, PROOF_FILENAME);
|
|
52
|
-
// Handle
|
|
53
|
-
const
|
|
52
|
+
// Handle CHONK separately because bb outputs the proof fields with public inputs for CHONK.
|
|
53
|
+
const isChonk = proofLength == CHONK_PROOF_LENGTH;
|
|
54
54
|
const [binaryPublicInputs, binaryProof] = await Promise.all([
|
|
55
|
-
|
|
55
|
+
isChonk ? Buffer.alloc(0) : fs.readFile(publicInputsFilename),
|
|
56
56
|
fs.readFile(proofFilename)
|
|
57
57
|
]);
|
|
58
58
|
const numPublicInputs = getNumCustomPublicInputs(proofLength, vkData);
|
|
59
59
|
let fieldsWithoutPublicInputs = splitBufferIntoFields(binaryProof);
|
|
60
|
-
if (
|
|
60
|
+
if (isChonk) {
|
|
61
61
|
fieldsWithoutPublicInputs = fieldsWithoutPublicInputs.slice(numPublicInputs);
|
|
62
62
|
}
|
|
63
63
|
assert(fieldsWithoutPublicInputs.length == proofLength, `Proof fields length mismatch: ${fieldsWithoutPublicInputs.length} != ${proofLength}`);
|
|
@@ -4,7 +4,7 @@ import type { AvmCircuitInputs, AvmCircuitPublicInputs } from '@aztec/stdlib/avm
|
|
|
4
4
|
import { type ProofAndVerificationKey, type PublicInputsAndRecursiveProof, type ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
5
5
|
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
6
6
|
import { Proof } from '@aztec/stdlib/proofs';
|
|
7
|
-
import { BlockMergeRollupPrivateInputs, BlockRollupPublicInputs, BlockRootEmptyTxFirstRollupPrivateInputs, BlockRootFirstRollupPrivateInputs, BlockRootRollupPrivateInputs, BlockRootSingleTxFirstRollupPrivateInputs, BlockRootSingleTxRollupPrivateInputs, CheckpointMergeRollupPrivateInputs, CheckpointPaddingRollupPrivateInputs, CheckpointRollupPublicInputs, CheckpointRootRollupPrivateInputs, CheckpointRootSingleBlockRollupPrivateInputs, type PrivateTxBaseRollupPrivateInputs,
|
|
7
|
+
import { BlockMergeRollupPrivateInputs, BlockRollupPublicInputs, BlockRootEmptyTxFirstRollupPrivateInputs, BlockRootFirstRollupPrivateInputs, BlockRootRollupPrivateInputs, BlockRootSingleTxFirstRollupPrivateInputs, BlockRootSingleTxRollupPrivateInputs, CheckpointMergeRollupPrivateInputs, CheckpointPaddingRollupPrivateInputs, CheckpointRollupPublicInputs, CheckpointRootRollupPrivateInputs, CheckpointRootSingleBlockRollupPrivateInputs, type PrivateTxBaseRollupPrivateInputs, PublicChonkVerifierPrivateInputs, PublicChonkVerifierPublicInputs, PublicTxBaseRollupPrivateInputs, type RootRollupPrivateInputs, type RootRollupPublicInputs, type TxMergeRollupPrivateInputs, type TxRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
8
8
|
import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
9
9
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
10
10
|
import type { ACVMConfig, BBConfig } from '../../config.js';
|
|
@@ -39,7 +39,7 @@ export declare class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
39
39
|
* @returns The proof.
|
|
40
40
|
*/
|
|
41
41
|
getAvmProof(inputs: AvmCircuitInputs, skipPublicInputsValidation?: boolean): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>>;
|
|
42
|
-
|
|
42
|
+
getPublicChonkVerifierProof(inputs: PublicChonkVerifierPrivateInputs): Promise<PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
43
43
|
/**
|
|
44
44
|
* Simulates the base rollup circuit from its inputs.
|
|
45
45
|
* @param inputs - Inputs to the circuit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bb_prover.d.ts","sourceRoot":"","sources":["../../../src/prover/server/bb_prover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,6BAA6B,EAC7B,yCAAyC,EAEzC,sBAAsB,EAEvB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,KAAK,sBAAsB,EAoC5B,MAAM,4CAA4C,CAAC;AAKpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,E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,CAAC,CAC9G;IAUM,+BAA+B,CACpC,KAAK,EAAE,oCAAoC,GAC1C,OAAO,CACR,6BAA6B,CAAC,4BAA4B,EAAE,OAAO,yCAAyC,CAAC,CAC9G;IAUM,6BAA6B,CAClC,KAAK,EAAE,kCAAkC,GACxC,OAAO,CACR,6BAA6B,CAAC,4BAA4B,EAAE,OAAO,yCAAyC,CAAC,CAC9G;IAUD;;;;OAIG;IACU,kBAAkB,CAC7B,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,6BAA6B,CAAC,sBAAsB,EAAE,OAAO,6BAA6B,CAAC,CAAC;YAgBzF,6BAA6B;YA0B7B,mBAAmB;YAoEnB,sBAAsB;YAatB,cAAc;IAkC5B;;;;;;;;OAQG;YACW,oBAAoB;IAqDlC;;;;OAIG;IACU,WAAW,CAAC,WAAW,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK;IAK7D,cAAc,CACzB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,mBAAmB,EACpC,YAAY,EAAE,sBAAsB;IAOzB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK;YAMxF,qBAAqB;IA2BnC;;;;OAIG;IACH,OAAO,CAAC,gCAAgC;YAQ1B,oBAAoB;IAuBlC,OAAO,CAAC,cAAc;CAYvB"}
|
|
@@ -9,7 +9,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
9
9
|
import { runInDirectory } from '@aztec/foundation/fs';
|
|
10
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
11
11
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
12
|
-
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,
|
|
12
|
+
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
13
|
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
14
14
|
import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
|
|
15
15
|
import { NativeACVMSimulator } from '@aztec/simulator/server';
|
|
@@ -76,9 +76,9 @@ const logger = createLogger('bb-prover');
|
|
|
76
76
|
proofAndVk.proof.proof = enhanceProofWithPiValidationFlag(proofAndVk.proof.proof, skipPublicInputsValidation);
|
|
77
77
|
return proofAndVk;
|
|
78
78
|
}
|
|
79
|
-
async
|
|
80
|
-
const artifactName = '
|
|
81
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(inputs, artifactName, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
79
|
+
async getPublicChonkVerifierProof(inputs) {
|
|
80
|
+
const artifactName = 'PublicChonkVerifier';
|
|
81
|
+
const { circuitOutput, proof } = await this.createRecursiveProof(inputs, artifactName, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPublicChonkVerifierPrivateInputsToWitnessMap, convertPublicChonkVerifierOutputsFromWitnessMap);
|
|
82
82
|
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
83
83
|
await this.verifyProof(artifactName, proof.binaryProof);
|
|
84
84
|
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
@@ -231,7 +231,7 @@ const logger = createLogger('bb-prover');
|
|
|
231
231
|
* @param convertOutput - Function for parsing the output witness to it's corresponding object
|
|
232
232
|
* @returns The circuits output object and it's proof
|
|
233
233
|
*/ async createRecursiveProof(input, circuitType, proofLength, convertInput, convertOutput) {
|
|
234
|
-
// this probably is gonna need to call
|
|
234
|
+
// this probably is gonna need to call chonk
|
|
235
235
|
const operation = async (bbWorkingDirectory)=>{
|
|
236
236
|
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(input, circuitType, convertInput, convertOutput, bbWorkingDirectory);
|
|
237
237
|
const vkData = this.getVerificationKeyDataForCircuit(circuitType);
|
|
@@ -16,7 +16,7 @@ export const WITGEN_DELAY_MS = {
|
|
|
16
16
|
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 470_000,
|
|
17
17
|
[ProvingRequestType.PARITY_ROOT]: 100,
|
|
18
18
|
[ProvingRequestType.ROOT_ROLLUP]: 650,
|
|
19
|
-
[ProvingRequestType.
|
|
19
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 0,
|
|
20
20
|
[ProvingRequestType.PUBLIC_VM]: 0
|
|
21
21
|
};
|
|
22
22
|
export const PROOF_DELAY_MS = {
|
|
@@ -36,6 +36,6 @@ export const PROOF_DELAY_MS = {
|
|
|
36
36
|
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 160_000,
|
|
37
37
|
[ProvingRequestType.PARITY_ROOT]: 30_000,
|
|
38
38
|
[ProvingRequestType.ROOT_ROLLUP]: 15_000,
|
|
39
|
-
[ProvingRequestType.
|
|
39
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 30_000,
|
|
40
40
|
[ProvingRequestType.PUBLIC_VM]: 0
|
|
41
41
|
};
|
|
@@ -5,7 +5,7 @@ import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
|
5
5
|
import { type ProofAndVerificationKey, type PublicInputsAndRecursiveProof, type ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
6
6
|
import type { ParityBasePrivateInputs, ParityPublicInputs, ParityRootPrivateInputs } from '@aztec/stdlib/parity';
|
|
7
7
|
import { type Proof } from '@aztec/stdlib/proofs';
|
|
8
|
-
import { type BlockMergeRollupPrivateInputs, type BlockRollupPublicInputs, type BlockRootEmptyTxFirstRollupPrivateInputs, type BlockRootFirstRollupPrivateInputs, type BlockRootRollupPrivateInputs, type BlockRootSingleTxFirstRollupPrivateInputs, type BlockRootSingleTxRollupPrivateInputs, type CheckpointMergeRollupPrivateInputs, type CheckpointPaddingRollupPrivateInputs, type CheckpointRollupPublicInputs, type CheckpointRootRollupPrivateInputs, type CheckpointRootSingleBlockRollupPrivateInputs, type PrivateTxBaseRollupPrivateInputs, type
|
|
8
|
+
import { type BlockMergeRollupPrivateInputs, type BlockRollupPublicInputs, type BlockRootEmptyTxFirstRollupPrivateInputs, type BlockRootFirstRollupPrivateInputs, type BlockRootRollupPrivateInputs, type BlockRootSingleTxFirstRollupPrivateInputs, type BlockRootSingleTxRollupPrivateInputs, type CheckpointMergeRollupPrivateInputs, type CheckpointPaddingRollupPrivateInputs, type CheckpointRollupPublicInputs, type CheckpointRootRollupPrivateInputs, type CheckpointRootSingleBlockRollupPrivateInputs, type PrivateTxBaseRollupPrivateInputs, type PublicChonkVerifierPrivateInputs, PublicChonkVerifierPublicInputs, type PublicTxBaseRollupPrivateInputs, type RootRollupPrivateInputs, type RootRollupPublicInputs, type TxMergeRollupPrivateInputs, type TxRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
9
9
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
10
10
|
type TestDelay = {
|
|
11
11
|
proverTestDelayType: 'fixed';
|
|
@@ -38,7 +38,7 @@ export declare class TestCircuitProver implements ServerCircuitProver {
|
|
|
38
38
|
* @returns The public inputs of the parity circuit.
|
|
39
39
|
*/
|
|
40
40
|
getRootParityProof(inputs: ParityRootPrivateInputs): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>>;
|
|
41
|
-
|
|
41
|
+
getPublicChonkVerifierProof(inputs: PublicChonkVerifierPrivateInputs): Promise<PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
42
42
|
getPrivateTxBaseRollupProof(inputs: PrivateTxBaseRollupPrivateInputs): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
43
43
|
getPublicTxBaseRollupProof(inputs: PublicTxBaseRollupPrivateInputs): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
44
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_circuit_prover.d.ts","sourceRoot":"","sources":["../../src/test/test_circuit_prover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EAEpC,6BAA6B,EAC7B,yCAAyC,EACzC,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,KAAK,sBAAsB,EAmC5B,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EAAE,KAAK,gBAAgB,EAAsD,MAAM,yBAAyB,CAAC;AACpH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,KAAK,KAAK,EAAmE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,wCAAwC,EAC7C,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,yCAAyC,EAC9C,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,oCAAoC,EACzC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,4CAA4C,EACjD,KAAK,gCAAgC,EACrC,KAAK,
|
|
1
|
+
{"version":3,"file":"test_circuit_prover.d.ts","sourceRoot":"","sources":["../../src/test/test_circuit_prover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EAEpC,6BAA6B,EAC7B,yCAAyC,EACzC,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,KAAK,sBAAsB,EAmC5B,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EAAE,KAAK,gBAAgB,EAAsD,MAAM,yBAAyB,CAAC;AACpH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EAGzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,KAAK,KAAK,EAAmE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,wCAAwC,EAC7C,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,yCAAyC,EAC9C,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,oCAAoC,EACzC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EAC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AAK,EAAE,oCAAoC,GAC1C,OAAO,CACR,6BAA6B,CAAC,4BAA4B,EAAE,OAAO,yCAAyC,CAAC,CAC9G;IAaM,6BAA6B,CAClC,KAAK,EAAE,kCAAkC,GACxC,OAAO,CACR,6BAA6B,CAAC,4BAA4B,EAAE,OAAO,yCAAyC,CAAC,CAC9G;IAYD;;;;OAIG;IAEI,kBAAkB,CACvB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,6BAA6B,CAAC,sBAAsB,CAAC,CAAC;IAY1D,WAAW,CAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,uBAAuB,CAAC,OAAO,oCAAoC,CAAC,CAAC;YAYlE,UAAU;IAejB,WAAW,CAAC,EAAE,EAAE,sBAAsB,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;YAI1D,QAAQ;CA6CvB"}
|
|
@@ -14,7 +14,7 @@ import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circu
|
|
|
14
14
|
import { WASMSimulatorWithBlobs, emitCircuitSimulationStats } from '@aztec/simulator/server';
|
|
15
15
|
import { makeProofAndVerificationKey, makePublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
16
16
|
import { ProvingRequestType, makeEmptyRecursiveProof, makeRecursiveProof } from '@aztec/stdlib/proofs';
|
|
17
|
-
import {
|
|
17
|
+
import { PublicChonkVerifierPublicInputs } from '@aztec/stdlib/rollup';
|
|
18
18
|
import { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
19
19
|
import { getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
20
20
|
import { ProverInstrumentation } from '../instrumentation.js';
|
|
@@ -55,8 +55,8 @@ import { PROOF_DELAY_MS, WITGEN_DELAY_MS } from './delay_values.js';
|
|
|
55
55
|
*/ getRootParityProof(inputs) {
|
|
56
56
|
return this.applyDelay(ProvingRequestType.PARITY_ROOT, ()=>this.simulate(inputs, 'ParityRootArtifact', NESTED_RECURSIVE_PROOF_LENGTH, convertParityRootPrivateInputsToWitnessMap, convertParityRootOutputsFromWitnessMap));
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
return this.applyDelay(ProvingRequestType.
|
|
58
|
+
getPublicChonkVerifierProof(inputs) {
|
|
59
|
+
return this.applyDelay(ProvingRequestType.PUBLIC_CHONK_VERIFIER, ()=>makePublicInputsAndRecursiveProof(new PublicChonkVerifierPublicInputs(inputs.hidingKernelProofData.publicInputs, inputs.proverId), makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH), ProtocolCircuitVks.PublicChonkVerifier));
|
|
60
60
|
}
|
|
61
61
|
getPrivateTxBaseRollupProof(inputs) {
|
|
62
62
|
return this.applyDelay(ProvingRequestType.PRIVATE_TX_BASE_ROLLUP, ()=>this.simulate(inputs, 'PrivateTxBaseRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPrivateTxBaseRollupPrivateInputsToWitnessMap, convertPrivateTxBaseRollupOutputsFromWitnessMap));
|
|
@@ -5,9 +5,9 @@ import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types/server/v
|
|
|
5
5
|
import { mapProtocolArtifactNameToCircuitName } from '@aztec/noir-protocol-circuits-types/types';
|
|
6
6
|
import { promises as fs } from 'fs';
|
|
7
7
|
import * as path from 'path';
|
|
8
|
-
import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME,
|
|
8
|
+
import { BB_RESULT, PROOF_FILENAME, PUBLIC_INPUTS_FILENAME, VK_FILENAME, verifyChonkProof, verifyProof } from '../bb/execute.js';
|
|
9
9
|
import { getUltraHonkFlavorForCircuit } from '../honk.js';
|
|
10
|
-
import {
|
|
10
|
+
import { writeChonkProofToPath } from '../prover/proof_utils.js';
|
|
11
11
|
export class BBCircuitVerifier {
|
|
12
12
|
config;
|
|
13
13
|
logger;
|
|
@@ -57,7 +57,7 @@ export class BBCircuitVerifier {
|
|
|
57
57
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
|
58
58
|
}
|
|
59
59
|
async verifyProof(tx) {
|
|
60
|
-
const proofType = '
|
|
60
|
+
const proofType = 'Chonk';
|
|
61
61
|
try {
|
|
62
62
|
const totalTimer = new Timer();
|
|
63
63
|
let verificationDuration = 0;
|
|
@@ -68,12 +68,12 @@ export class BBCircuitVerifier {
|
|
|
68
68
|
this.logger.debug(`${proofType} BB out - ${message}`);
|
|
69
69
|
};
|
|
70
70
|
const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
|
|
71
|
-
await
|
|
71
|
+
await writeChonkProofToPath(tx.chonkProof.attachPublicInputs(tx.data.publicInputs().toFields()), proofPath);
|
|
72
72
|
const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
|
|
73
73
|
const verificationKey = this.getVerificationKeyData(circuit);
|
|
74
74
|
await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
|
|
75
75
|
const timer = new Timer();
|
|
76
|
-
const result = await
|
|
76
|
+
const result = await verifyChonkProof(this.config.bbBinaryPath, proofPath, verificationKeyPath, logFunction, this.config.bbIVCConcurrency);
|
|
77
77
|
verificationDuration = timer.ms();
|
|
78
78
|
if (result.status === BB_RESULT.FAILURE) {
|
|
79
79
|
const errorMessage = `Failed to verify ${proofType} proof for ${circuit}!`;
|
|
@@ -83,7 +83,7 @@ export class BBCircuitVerifier {
|
|
|
83
83
|
circuitName: mapProtocolArtifactNameToCircuitName(circuit),
|
|
84
84
|
duration: result.durationMs,
|
|
85
85
|
eventName: 'circuit-verification',
|
|
86
|
-
proofType: '
|
|
86
|
+
proofType: 'chonk'
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
package/dest/verifier/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC"}
|
package/dest/verifier/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './bb_verifier.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './queued_chonk_verifier.js';
|
|
@@ -12,4 +12,4 @@ export declare class QueuedIVCVerifier implements ClientProtocolCircuitVerifier
|
|
|
12
12
|
verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
|
|
13
13
|
stop(): Promise<void>;
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=queued_chonk_verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queued_chonk_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/queued_chonk_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAML,KAAK,eAAe,EAIrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAgG7C,qBAAa,iBAAkB,YAAW,6BAA6B;IAMnE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAPhB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAqB;gBAGlC,MAAM,EAAE,QAAQ,EACR,QAAQ,EAAE,6BAA6B,EACvC,SAAS,GAAE,eAAsC,EACjD,MAAM,yCAAkD;IAQrD,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAMrE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB"}
|
|
@@ -19,12 +19,12 @@ class IVCVerifierMetrics {
|
|
|
19
19
|
const meter = client.getMeter(name);
|
|
20
20
|
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
|
|
21
21
|
unit: 'ms',
|
|
22
|
-
description: 'Duration to verify
|
|
22
|
+
description: 'Duration to verify chonk proofs',
|
|
23
23
|
valueType: ValueType.INT
|
|
24
24
|
});
|
|
25
25
|
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
|
|
26
26
|
unit: 'ms',
|
|
27
|
-
description: 'Total duration to verify
|
|
27
|
+
description: 'Total duration to verify chonk proofs, including serde',
|
|
28
28
|
valueType: ValueType.INT
|
|
29
29
|
});
|
|
30
30
|
this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
|
|
@@ -112,7 +112,7 @@ export class QueuedIVCVerifier {
|
|
|
112
112
|
logger;
|
|
113
113
|
queue;
|
|
114
114
|
metrics;
|
|
115
|
-
constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:
|
|
115
|
+
constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:queued_chonk_verifier')){
|
|
116
116
|
this.verifier = verifier;
|
|
117
117
|
this.telemetry = telemetry;
|
|
118
118
|
this.logger = logger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bb-prover",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251030-2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -69,27 +69,27 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
73
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
74
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
75
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
77
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
78
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
79
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
80
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
81
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
72
|
+
"@aztec/bb.js": "3.0.0-nightly.20251030-2",
|
|
73
|
+
"@aztec/constants": "3.0.0-nightly.20251030-2",
|
|
74
|
+
"@aztec/foundation": "3.0.0-nightly.20251030-2",
|
|
75
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251030-2",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251030-2",
|
|
77
|
+
"@aztec/noir-types": "3.0.0-nightly.20251030-2",
|
|
78
|
+
"@aztec/simulator": "3.0.0-nightly.20251030-2",
|
|
79
|
+
"@aztec/stdlib": "3.0.0-nightly.20251030-2",
|
|
80
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251030-2",
|
|
81
|
+
"@aztec/world-state": "3.0.0-nightly.20251030-2",
|
|
82
82
|
"commander": "^12.1.0",
|
|
83
83
|
"pako": "^2.1.0",
|
|
84
84
|
"source-map-support": "^0.5.21",
|
|
85
85
|
"tslib": "^2.4.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
89
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
90
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
91
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
92
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
88
|
+
"@aztec/ethereum": "3.0.0-nightly.20251030-2",
|
|
89
|
+
"@aztec/kv-store": "3.0.0-nightly.20251030-2",
|
|
90
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251030-2",
|
|
91
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251030-2",
|
|
92
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251030-2",
|
|
93
93
|
"@jest/globals": "^30.0.0",
|
|
94
94
|
"@types/jest": "^30.0.0",
|
|
95
95
|
"@types/node": "^22.15.17",
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
verifyAvmProof,
|
|
28
28
|
} from '../bb/execute.js';
|
|
29
29
|
|
|
30
|
-
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb');
|
|
30
|
+
const BB_PATH = path.resolve('../../barretenberg/cpp/build/bin/bb-avm');
|
|
31
31
|
|
|
32
32
|
// An InterceptingLogger that records all log messages and forwards them to a wrapped logger.
|
|
33
33
|
class InterceptingLogger implements Logger {
|
package/src/bb/execute.ts
CHANGED
|
@@ -120,7 +120,7 @@ export function executeBB(
|
|
|
120
120
|
}).catch(_ => ({ status: BB_RESULT.FAILURE, exitCode: -1, signal: undefined }));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
export async function
|
|
123
|
+
export async function executeBbChonkProof(
|
|
124
124
|
pathToBB: string,
|
|
125
125
|
workingDirectory: string,
|
|
126
126
|
inputsPath: string,
|
|
@@ -153,7 +153,7 @@ export async function executeBbClientIvcProof(
|
|
|
153
153
|
log(`bb - ${message}`);
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
-
const args = ['-o', outputPath, '--ivc_inputs_path', inputsPath, '-v', '--scheme', '
|
|
156
|
+
const args = ['-o', outputPath, '--ivc_inputs_path', inputsPath, '-v', '--scheme', 'chonk'];
|
|
157
157
|
if (writeVk) {
|
|
158
158
|
args.push('--write_vk');
|
|
159
159
|
}
|
|
@@ -424,7 +424,7 @@ export async function verifyAvmProof(
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/**
|
|
427
|
-
* Verifies a
|
|
427
|
+
* Verifies a ChonkProof
|
|
428
428
|
* TODO(#7370) The verification keys should be supplied separately
|
|
429
429
|
* @param pathToBB - The full path to the bb binary
|
|
430
430
|
* @param targetPath - The path to the folder with the proof, accumulator, and verification keys
|
|
@@ -432,7 +432,7 @@ export async function verifyAvmProof(
|
|
|
432
432
|
* @param concurrency - The number of threads to use for the verification
|
|
433
433
|
* @returns An object containing a result indication and duration taken
|
|
434
434
|
*/
|
|
435
|
-
export async function
|
|
435
|
+
export async function verifyChonkProof(
|
|
436
436
|
pathToBB: string,
|
|
437
437
|
proofPath: string,
|
|
438
438
|
keyPath: string,
|
|
@@ -448,7 +448,7 @@ export async function verifyClientIvcProof(
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
try {
|
|
451
|
-
const args = ['--scheme', '
|
|
451
|
+
const args = ['--scheme', 'chonk', '-p', proofPath, '-k', keyPath, '-v'];
|
|
452
452
|
const timer = new Timer();
|
|
453
453
|
const command = 'verify';
|
|
454
454
|
|
|
@@ -638,7 +638,7 @@ export async function computeGateCountForCircuit(
|
|
|
638
638
|
const result = await executeBB(
|
|
639
639
|
pathToBB,
|
|
640
640
|
'gates',
|
|
641
|
-
['--scheme', flavor === 'mega_honk' ? '
|
|
641
|
+
['--scheme', flavor === 'mega_honk' ? 'chonk' : 'ultra_honk', '-b', bytecodePath, '-v'],
|
|
642
642
|
logHandler,
|
|
643
643
|
);
|
|
644
644
|
const duration = timer.ms();
|
|
@@ -37,7 +37,7 @@ import type {
|
|
|
37
37
|
PrivateKernelTailCircuitPublicInputs,
|
|
38
38
|
} from '@aztec/stdlib/kernel';
|
|
39
39
|
import type { NoirCompiledCircuitWithName } from '@aztec/stdlib/noir';
|
|
40
|
-
import type {
|
|
40
|
+
import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
41
41
|
import type { CircuitSimulationStats, CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
42
42
|
|
|
43
43
|
export abstract class BBPrivateKernelProver implements PrivateKernelProver {
|
|
@@ -263,7 +263,7 @@ export abstract class BBPrivateKernelProver implements PrivateKernelProver {
|
|
|
263
263
|
return kernelProofOutput;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
public
|
|
266
|
+
public createChonkProof(_executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
|
|
267
267
|
throw new Error('Not implemented');
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -3,14 +3,14 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
3
3
|
import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
|
|
4
4
|
import type { CircuitSimulator } from '@aztec/simulator/server';
|
|
5
5
|
import { type PrivateExecutionStep, serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
7
7
|
|
|
8
8
|
import { promises as fs } from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
|
|
11
|
-
import { BB_RESULT, computeGateCountForCircuit,
|
|
11
|
+
import { BB_RESULT, computeGateCountForCircuit, executeBbChonkProof } from '../../../bb/execute.js';
|
|
12
12
|
import type { BBConfig } from '../../../config.js';
|
|
13
|
-
import {
|
|
13
|
+
import { readChonkProofFromOutputDirectory } from '../../proof_utils.js';
|
|
14
14
|
import { BBPrivateKernelProver } from '../bb_private_kernel_prover.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -38,22 +38,22 @@ export class BBNativePrivateKernelProver extends BBPrivateKernelProver {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
private async
|
|
41
|
+
private async _createChonkProof(
|
|
42
42
|
directory: string,
|
|
43
43
|
executionSteps: PrivateExecutionStep[],
|
|
44
|
-
): Promise<
|
|
44
|
+
): Promise<ChonkProofWithPublicInputs> {
|
|
45
45
|
const inputsPath = path.join(directory, 'ivc-inputs.msgpack');
|
|
46
46
|
await fs.writeFile(inputsPath, serializePrivateExecutionSteps(executionSteps));
|
|
47
|
-
const provingResult = await
|
|
47
|
+
const provingResult = await executeBbChonkProof(this.bbBinaryPath, directory, inputsPath, this.log.info);
|
|
48
48
|
|
|
49
49
|
if (provingResult.status === BB_RESULT.FAILURE) {
|
|
50
|
-
this.log.error(`Failed to generate
|
|
50
|
+
this.log.error(`Failed to generate chonk proof`);
|
|
51
51
|
throw new Error(provingResult.reason);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const proof = await
|
|
54
|
+
const proof = await readChonkProofFromOutputDirectory(directory);
|
|
55
55
|
|
|
56
|
-
this.log.info(`Generated
|
|
56
|
+
this.log.info(`Generated Chonk proof`, {
|
|
57
57
|
duration: provingResult.durationMs,
|
|
58
58
|
eventName: 'circuit-proving',
|
|
59
59
|
});
|
|
@@ -61,10 +61,10 @@ export class BBNativePrivateKernelProver extends BBPrivateKernelProver {
|
|
|
61
61
|
return proof;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
public override async
|
|
65
|
-
this.log.info(`Generating
|
|
64
|
+
public override async createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
|
|
65
|
+
this.log.info(`Generating Chonk proof`);
|
|
66
66
|
const operation = async (directory: string) => {
|
|
67
|
-
return await this.
|
|
67
|
+
return await this._createChonkProof(directory, executionSteps);
|
|
68
68
|
};
|
|
69
69
|
return await this.runInDirectory(operation);
|
|
70
70
|
}
|
|
@@ -5,7 +5,7 @@ import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
|
5
5
|
import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
|
|
6
6
|
import type { CircuitSimulator } from '@aztec/simulator/client';
|
|
7
7
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
8
|
-
import {
|
|
8
|
+
import { ChonkProofWithPublicInputs } from '@aztec/stdlib/proofs';
|
|
9
9
|
|
|
10
10
|
import { ungzip } from 'pako';
|
|
11
11
|
|
|
@@ -21,9 +21,9 @@ export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
|
21
21
|
super(artifactProvider, simulator, log);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
public override async
|
|
24
|
+
public override async createChonkProof(executionSteps: PrivateExecutionStep[]): Promise<ChonkProofWithPublicInputs> {
|
|
25
25
|
const timer = new Timer();
|
|
26
|
-
this.log.info(`Generating
|
|
26
|
+
this.log.info(`Generating Chonk proof...`);
|
|
27
27
|
const backend = new AztecClientBackend(
|
|
28
28
|
executionSteps.map(step => ungzip(step.bytecode)),
|
|
29
29
|
{ threads: this.threads, logger: this.log.verbose, wasmPath: process.env.BB_WASM_PATH },
|
|
@@ -34,12 +34,12 @@ export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
|
34
34
|
executionSteps.map(step => step.vk),
|
|
35
35
|
);
|
|
36
36
|
await backend.destroy();
|
|
37
|
-
this.log.info(`Generated
|
|
38
|
-
eventName: '
|
|
37
|
+
this.log.info(`Generated Chonk proof`, {
|
|
38
|
+
eventName: 'chonk-proof-generation',
|
|
39
39
|
duration: timer.ms(),
|
|
40
40
|
proofSize: proof.length,
|
|
41
41
|
});
|
|
42
|
-
return
|
|
42
|
+
return ChonkProofWithPublicInputs.fromBufferArray(proof);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public override async computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CHONK_PROOF_LENGTH,
|
|
3
3
|
HIDING_KERNEL_IO_PUBLIC_INPUTS_SIZE,
|
|
4
4
|
IPA_CLAIM_SIZE,
|
|
5
5
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@aztec/constants';
|
|
10
10
|
import { Fr } from '@aztec/foundation/fields';
|
|
11
11
|
import type { Logger } from '@aztec/foundation/log';
|
|
12
|
-
import {
|
|
12
|
+
import { ChonkProofWithPublicInputs, Proof, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
13
13
|
import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
14
14
|
|
|
15
15
|
import assert from 'assert';
|
|
@@ -19,33 +19,33 @@ import * as path from 'path';
|
|
|
19
19
|
import { PROOF_FILENAME, PUBLIC_INPUTS_FILENAME } from '../bb/execute.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Create a
|
|
22
|
+
* Create a ChonkProof proof file.
|
|
23
23
|
*
|
|
24
24
|
* @param directory the directory to read the proof from.
|
|
25
|
-
* @returns the encapsulated
|
|
25
|
+
* @returns the encapsulated chonk proof
|
|
26
26
|
*/
|
|
27
|
-
export async function
|
|
27
|
+
export async function readChonkProofFromOutputDirectory(directory: string) {
|
|
28
28
|
const proofFilename = path.join(directory, PROOF_FILENAME);
|
|
29
29
|
const binaryProof = await fs.readFile(proofFilename);
|
|
30
30
|
const proofFields = splitBufferIntoFields(binaryProof);
|
|
31
|
-
return new
|
|
31
|
+
return new ChonkProofWithPublicInputs(proofFields);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Serialize a
|
|
35
|
+
* Serialize a ChonkProof to a proof file.
|
|
36
36
|
*
|
|
37
|
-
* @param proof the
|
|
37
|
+
* @param proof the ChonkProof from object
|
|
38
38
|
* @param directory the directory to write in
|
|
39
39
|
*/
|
|
40
|
-
export async function
|
|
41
|
-
// NB: Don't use
|
|
42
|
-
const fieldsBuf = Buffer.concat(
|
|
40
|
+
export async function writeChonkProofToPath(chonkProof: ChonkProofWithPublicInputs, outputPath: string) {
|
|
41
|
+
// NB: Don't use chonkProof.toBuffer here because it will include the proof length.
|
|
42
|
+
const fieldsBuf = Buffer.concat(chonkProof.fieldsWithPublicInputs.map(field => field.toBuffer()));
|
|
43
43
|
await fs.writeFile(outputPath, fieldsBuf);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function getNumCustomPublicInputs(proofLength: number, vkData: VerificationKeyData) {
|
|
47
47
|
let numPublicInputs = vkData.numPublicInputs;
|
|
48
|
-
if (proofLength ==
|
|
48
|
+
if (proofLength == CHONK_PROOF_LENGTH) {
|
|
49
49
|
numPublicInputs -= HIDING_KERNEL_IO_PUBLIC_INPUTS_SIZE;
|
|
50
50
|
} else {
|
|
51
51
|
numPublicInputs -= PAIRING_POINTS_SIZE;
|
|
@@ -71,7 +71,7 @@ export async function readProofsFromOutputDirectory<PROOF_LENGTH extends number>
|
|
|
71
71
|
logger: Logger,
|
|
72
72
|
): Promise<RecursiveProof<PROOF_LENGTH>> {
|
|
73
73
|
assert(
|
|
74
|
-
proofLength ==
|
|
74
|
+
proofLength == CHONK_PROOF_LENGTH ||
|
|
75
75
|
proofLength == NESTED_RECURSIVE_PROOF_LENGTH ||
|
|
76
76
|
proofLength == NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH ||
|
|
77
77
|
proofLength == ULTRA_KECCAK_PROOF_LENGTH,
|
|
@@ -81,17 +81,17 @@ export async function readProofsFromOutputDirectory<PROOF_LENGTH extends number>
|
|
|
81
81
|
const publicInputsFilename = path.join(directory, PUBLIC_INPUTS_FILENAME);
|
|
82
82
|
const proofFilename = path.join(directory, PROOF_FILENAME);
|
|
83
83
|
|
|
84
|
-
// Handle
|
|
85
|
-
const
|
|
84
|
+
// Handle CHONK separately because bb outputs the proof fields with public inputs for CHONK.
|
|
85
|
+
const isChonk = proofLength == CHONK_PROOF_LENGTH;
|
|
86
86
|
|
|
87
87
|
const [binaryPublicInputs, binaryProof] = await Promise.all([
|
|
88
|
-
|
|
88
|
+
isChonk ? Buffer.alloc(0) : fs.readFile(publicInputsFilename),
|
|
89
89
|
fs.readFile(proofFilename),
|
|
90
90
|
]);
|
|
91
91
|
|
|
92
92
|
const numPublicInputs = getNumCustomPublicInputs(proofLength, vkData);
|
|
93
93
|
let fieldsWithoutPublicInputs = splitBufferIntoFields(binaryProof);
|
|
94
|
-
if (
|
|
94
|
+
if (isChonk) {
|
|
95
95
|
fieldsWithoutPublicInputs = fieldsWithoutPublicInputs.slice(numPublicInputs);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -38,8 +38,8 @@ import {
|
|
|
38
38
|
convertParityRootPrivateInputsToWitnessMap,
|
|
39
39
|
convertPrivateTxBaseRollupOutputsFromWitnessMap,
|
|
40
40
|
convertPrivateTxBaseRollupPrivateInputsToWitnessMap,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
convertPublicChonkVerifierOutputsFromWitnessMap,
|
|
42
|
+
convertPublicChonkVerifierPrivateInputsToWitnessMap,
|
|
43
43
|
convertPublicTxBaseRollupOutputsFromWitnessMap,
|
|
44
44
|
convertPublicTxBaseRollupPrivateInputsToWitnessMap,
|
|
45
45
|
convertRootRollupOutputsFromWitnessMap,
|
|
@@ -77,8 +77,8 @@ import {
|
|
|
77
77
|
CheckpointRootRollupPrivateInputs,
|
|
78
78
|
CheckpointRootSingleBlockRollupPrivateInputs,
|
|
79
79
|
type PrivateTxBaseRollupPrivateInputs,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
PublicChonkVerifierPrivateInputs,
|
|
81
|
+
PublicChonkVerifierPublicInputs,
|
|
82
82
|
PublicTxBaseRollupPrivateInputs,
|
|
83
83
|
type RootRollupPrivateInputs,
|
|
84
84
|
type RootRollupPublicInputs,
|
|
@@ -202,17 +202,19 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
202
202
|
return proofAndVk;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
public async
|
|
206
|
-
inputs:
|
|
207
|
-
): Promise<
|
|
208
|
-
|
|
205
|
+
public async getPublicChonkVerifierProof(
|
|
206
|
+
inputs: PublicChonkVerifierPrivateInputs,
|
|
207
|
+
): Promise<
|
|
208
|
+
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
209
|
+
> {
|
|
210
|
+
const artifactName = 'PublicChonkVerifier';
|
|
209
211
|
|
|
210
212
|
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
211
213
|
inputs,
|
|
212
214
|
artifactName,
|
|
213
215
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
+
convertPublicChonkVerifierPrivateInputsToWitnessMap,
|
|
217
|
+
convertPublicChonkVerifierOutputsFromWitnessMap,
|
|
216
218
|
);
|
|
217
219
|
|
|
218
220
|
const verificationKey = this.getVerificationKeyDataForCircuit(artifactName);
|
|
@@ -585,7 +587,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
585
587
|
convertInput: (input: CircuitInputType) => WitnessMap,
|
|
586
588
|
convertOutput: (outputWitness: WitnessMap) => CircuitOutputType,
|
|
587
589
|
): Promise<{ circuitOutput: CircuitOutputType; proof: RecursiveProof<PROOF_LENGTH> }> {
|
|
588
|
-
// this probably is gonna need to call
|
|
590
|
+
// this probably is gonna need to call chonk
|
|
589
591
|
const operation = async (bbWorkingDirectory: string) => {
|
|
590
592
|
const { provingResult, circuitOutput: output } = await this.generateProofWithBB(
|
|
591
593
|
input,
|
package/src/test/delay_values.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
17
17
|
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 470_000,
|
|
18
18
|
[ProvingRequestType.PARITY_ROOT]: 100,
|
|
19
19
|
[ProvingRequestType.ROOT_ROLLUP]: 650,
|
|
20
|
-
[ProvingRequestType.
|
|
20
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 0,
|
|
21
21
|
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -38,6 +38,6 @@ export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
38
38
|
[ProvingRequestType.PUBLIC_TX_BASE_ROLLUP]: 160_000,
|
|
39
39
|
[ProvingRequestType.PARITY_ROOT]: 30_000,
|
|
40
40
|
[ProvingRequestType.ROOT_ROLLUP]: 15_000,
|
|
41
|
-
[ProvingRequestType.
|
|
41
|
+
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: 30_000,
|
|
42
42
|
[ProvingRequestType.PUBLIC_VM]: 0,
|
|
43
43
|
};
|
|
@@ -73,8 +73,8 @@ import {
|
|
|
73
73
|
type CheckpointRootRollupPrivateInputs,
|
|
74
74
|
type CheckpointRootSingleBlockRollupPrivateInputs,
|
|
75
75
|
type PrivateTxBaseRollupPrivateInputs,
|
|
76
|
-
type
|
|
77
|
-
|
|
76
|
+
type PublicChonkVerifierPrivateInputs,
|
|
77
|
+
PublicChonkVerifierPublicInputs,
|
|
78
78
|
type PublicTxBaseRollupPrivateInputs,
|
|
79
79
|
type RootRollupPrivateInputs,
|
|
80
80
|
type RootRollupPublicInputs,
|
|
@@ -158,14 +158,16 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
public
|
|
162
|
-
inputs:
|
|
163
|
-
): Promise<
|
|
164
|
-
|
|
161
|
+
public getPublicChonkVerifierProof(
|
|
162
|
+
inputs: PublicChonkVerifierPrivateInputs,
|
|
163
|
+
): Promise<
|
|
164
|
+
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
165
|
+
> {
|
|
166
|
+
return this.applyDelay(ProvingRequestType.PUBLIC_CHONK_VERIFIER, () =>
|
|
165
167
|
makePublicInputsAndRecursiveProof(
|
|
166
|
-
new
|
|
168
|
+
new PublicChonkVerifierPublicInputs(inputs.hidingKernelProofData.publicInputs, inputs.proverId),
|
|
167
169
|
makeEmptyRecursiveProof(NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH),
|
|
168
|
-
ProtocolCircuitVks.
|
|
170
|
+
ProtocolCircuitVks.PublicChonkVerifier,
|
|
169
171
|
),
|
|
170
172
|
);
|
|
171
173
|
}
|
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
PROOF_FILENAME,
|
|
23
23
|
PUBLIC_INPUTS_FILENAME,
|
|
24
24
|
VK_FILENAME,
|
|
25
|
-
|
|
25
|
+
verifyChonkProof,
|
|
26
26
|
verifyProof,
|
|
27
27
|
} from '../bb/execute.js';
|
|
28
28
|
import type { BBConfig } from '../config.js';
|
|
29
29
|
import { getUltraHonkFlavorForCircuit } from '../honk.js';
|
|
30
|
-
import {
|
|
30
|
+
import { writeChonkProofToPath } from '../prover/proof_utils.js';
|
|
31
31
|
|
|
32
32
|
export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
33
33
|
private constructor(
|
|
@@ -90,7 +90,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
public async verifyProof(tx: Tx): Promise<IVCProofVerificationResult> {
|
|
93
|
-
const proofType = '
|
|
93
|
+
const proofType = 'Chonk';
|
|
94
94
|
try {
|
|
95
95
|
const totalTimer = new Timer();
|
|
96
96
|
let verificationDuration = 0;
|
|
@@ -104,14 +104,14 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
const proofPath = path.join(bbWorkingDirectory, PROOF_FILENAME);
|
|
107
|
-
await
|
|
107
|
+
await writeChonkProofToPath(tx.chonkProof.attachPublicInputs(tx.data.publicInputs().toFields()), proofPath);
|
|
108
108
|
|
|
109
109
|
const verificationKeyPath = path.join(bbWorkingDirectory, VK_FILENAME);
|
|
110
110
|
const verificationKey = this.getVerificationKeyData(circuit);
|
|
111
111
|
await fs.writeFile(verificationKeyPath, verificationKey.keyAsBytes);
|
|
112
112
|
|
|
113
113
|
const timer = new Timer();
|
|
114
|
-
const result = await
|
|
114
|
+
const result = await verifyChonkProof(
|
|
115
115
|
this.config.bbBinaryPath,
|
|
116
116
|
proofPath,
|
|
117
117
|
verificationKeyPath,
|
|
@@ -129,7 +129,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
129
129
|
circuitName: mapProtocolArtifactNameToCircuitName(circuit),
|
|
130
130
|
duration: result.durationMs,
|
|
131
131
|
eventName: 'circuit-verification',
|
|
132
|
-
proofType: '
|
|
132
|
+
proofType: 'chonk',
|
|
133
133
|
} satisfies CircuitVerificationStats);
|
|
134
134
|
};
|
|
135
135
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
package/src/verifier/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './bb_verifier.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './queued_chonk_verifier.js';
|
|
@@ -38,13 +38,13 @@ class IVCVerifierMetrics {
|
|
|
38
38
|
|
|
39
39
|
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
|
|
40
40
|
unit: 'ms',
|
|
41
|
-
description: 'Duration to verify
|
|
41
|
+
description: 'Duration to verify chonk proofs',
|
|
42
42
|
valueType: ValueType.INT,
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
|
|
46
46
|
unit: 'ms',
|
|
47
|
-
description: 'Total duration to verify
|
|
47
|
+
description: 'Total duration to verify chonk proofs, including serde',
|
|
48
48
|
valueType: ValueType.INT,
|
|
49
49
|
});
|
|
50
50
|
|
|
@@ -120,7 +120,7 @@ export class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
|
|
|
120
120
|
config: BBConfig,
|
|
121
121
|
private verifier: ClientProtocolCircuitVerifier,
|
|
122
122
|
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
123
|
-
private logger = createLogger('bb-prover:
|
|
123
|
+
private logger = createLogger('bb-prover:queued_chonk_verifier'),
|
|
124
124
|
) {
|
|
125
125
|
this.metrics = new IVCVerifierMetrics(this.telemetry, 'QueuedIVCVerifier');
|
|
126
126
|
this.queue = new SerialQueue();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queued_ivc_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/queued_ivc_verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACjH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAML,KAAK,eAAe,EAIrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAgG7C,qBAAa,iBAAkB,YAAW,6BAA6B;IAMnE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAPhB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAqB;gBAGlC,MAAM,EAAE,QAAQ,EACR,QAAQ,EAAE,6BAA6B,EACvC,SAAS,GAAE,eAAsC,EACjD,MAAM,yCAAgD;IAQnD,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAMrE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB"}
|