@aztec/bb-prover 0.80.0 → 0.82.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/avm_proving_tests/avm_proving_tester.d.ts +3 -3
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +7 -9
- package/dest/bb/execute.d.ts +4 -8
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +28 -14
- package/dest/prover/bb_native_private_kernel_prover.d.ts +3 -2
- package/dest/prover/bb_native_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/bb_native_private_kernel_prover.js +18 -7
- package/dest/prover/bb_private_kernel_prover.d.ts +2 -2
- package/dest/prover/bb_private_kernel_prover.d.ts.map +1 -1
- package/dest/prover/bb_private_kernel_prover.js +4 -4
- package/dest/prover/bb_prover.d.ts.map +1 -1
- package/dest/prover/bb_prover.js +7 -5
- package/dest/prover/client_ivc_proof_utils.d.ts +6 -14
- package/dest/prover/client_ivc_proof_utils.d.ts.map +1 -1
- package/dest/prover/client_ivc_proof_utils.js +10 -31
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +9 -7
- package/dest/verifier/bb_verifier.d.ts +2 -0
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +7 -2
- package/dest/wasm/bb_wasm_private_kernel_prover.d.ts +2 -2
- package/dest/wasm/bb_wasm_private_kernel_prover.d.ts.map +1 -1
- package/dest/wasm/bb_wasm_private_kernel_prover.js +7 -6
- package/package.json +16 -15
- package/src/avm_proving_tests/avm_proving_tester.ts +6 -10
- package/src/bb/execute.ts +25 -13
- package/src/prover/bb_native_private_kernel_prover.ts +20 -12
- package/src/prover/bb_private_kernel_prover.ts +13 -8
- package/src/prover/bb_prover.ts +13 -8
- package/src/prover/client_ivc_proof_utils.ts +10 -24
- package/src/test/test_circuit_prover.ts +21 -10
- package/src/verifier/bb_verifier.ts +9 -2
- package/src/wasm/bb_wasm_private_kernel_prover.ts +7 -6
|
@@ -10,6 +10,7 @@ import type { VerificationKeyData } from '@aztec/stdlib/vks';
|
|
|
10
10
|
|
|
11
11
|
import { promises as fs } from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
13
14
|
|
|
14
15
|
import { BB_RESULT, PROOF_FILENAME, VK_FILENAME, verifyClientIvcProof, verifyProof } from '../bb/execute.js';
|
|
15
16
|
import type { BBConfig } from '../config.js';
|
|
@@ -17,6 +18,12 @@ import { getUltraHonkFlavorForCircuit } from '../honk.js';
|
|
|
17
18
|
import { writeToOutputDirectory } from '../prover/client_ivc_proof_utils.js';
|
|
18
19
|
import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
|
|
19
20
|
|
|
21
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
|
|
23
|
+
// Built by yarn generate
|
|
24
|
+
export const PRIVATE_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/private-civc-vk');
|
|
25
|
+
export const PUBLIC_TAIL_CIVC_VK = path.join(__dirname, '../../artifacts/public-civc-vk');
|
|
26
|
+
|
|
20
27
|
export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
21
28
|
private constructor(private config: BBConfig, private logger: Logger) {}
|
|
22
29
|
|
|
@@ -88,7 +95,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
88
95
|
const result = await verifyClientIvcProof(
|
|
89
96
|
this.config.bbBinaryPath,
|
|
90
97
|
bbWorkingDirectory.concat('/proof'),
|
|
91
|
-
|
|
98
|
+
tx.data.forPublic ? PUBLIC_TAIL_CIVC_VK : PRIVATE_TAIL_CIVC_VK,
|
|
92
99
|
logFunction,
|
|
93
100
|
);
|
|
94
101
|
|
|
@@ -107,7 +114,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
|
|
|
107
114
|
await runInDirectory(this.config.bbWorkingDirectory, operation, this.config.bbSkipCleanup, this.logger);
|
|
108
115
|
return true;
|
|
109
116
|
} catch (err) {
|
|
110
|
-
this.logger.warn(`Failed to verify ClientIVC proof for tx ${Tx.getHash(tx)}: ${String(err)}`);
|
|
117
|
+
this.logger.warn(`Failed to verify ClientIVC proof for tx ${await Tx.getHash(tx)}: ${String(err)}`);
|
|
111
118
|
return false;
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -3,8 +3,8 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
3
3
|
import { Timer } from '@aztec/foundation/timer';
|
|
4
4
|
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
5
5
|
import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
|
|
6
|
-
import type { WitnessMap } from '@aztec/noir-types';
|
|
7
6
|
import type { SimulationProvider } from '@aztec/simulator/client';
|
|
7
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
8
8
|
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
9
9
|
|
|
10
10
|
import { ungzip } from 'pako';
|
|
@@ -21,23 +21,24 @@ export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
|
21
21
|
super(artifactProvider, simulationProvider, log);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
public override async createClientIvcProof(
|
|
24
|
+
public override async createClientIvcProof(executionSteps: PrivateExecutionStep[]): Promise<ClientIvcProof> {
|
|
25
25
|
const timer = new Timer();
|
|
26
26
|
this.log.info(`Generating ClientIVC 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 },
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1297): the vk is not provided to the network anymore.
|
|
33
|
+
// Move this sanity check inside the wasm code and remove the vk from the return value.
|
|
34
|
+
const [proof, _vk] = await backend.prove(executionSteps.map(step => ungzip(serializeWitness(step.witness))));
|
|
33
35
|
await backend.destroy();
|
|
34
36
|
this.log.info(`Generated ClientIVC proof`, {
|
|
35
37
|
eventName: 'client-ivc-proof-generation',
|
|
36
38
|
duration: timer.ms(),
|
|
37
39
|
proofSize: proof.length,
|
|
38
|
-
vkSize: vk.length,
|
|
39
40
|
});
|
|
40
|
-
return new ClientIvcProof(Buffer.from(proof)
|
|
41
|
+
return new ClientIvcProof(Buffer.from(proof));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
public override async computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
|