@aztec/bb-prover 0.0.0-test.1 → 0.0.1-commit.21caa21
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 +14 -18
- package/dest/avm_proving_tests/avm_proving_tester.d.ts.map +1 -1
- package/dest/avm_proving_tests/avm_proving_tester.js +130 -79
- package/dest/bb/cli.d.ts +1 -1
- package/dest/bb/execute.d.ts +14 -47
- package/dest/bb/execute.d.ts.map +1 -1
- package/dest/bb/execute.js +132 -236
- package/dest/bb/index.d.ts +1 -1
- package/dest/config.d.ts +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/honk.d.ts +3 -3
- package/dest/honk.d.ts.map +1 -1
- package/dest/honk.js +3 -2
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/instrumentation.d.ts +3 -3
- package/dest/instrumentation.d.ts.map +1 -1
- package/dest/instrumentation.js +2 -4
- package/dest/prover/client/bb_private_kernel_prover.d.ts +32 -0
- package/dest/prover/client/bb_private_kernel_prover.d.ts.map +1 -0
- package/dest/prover/{bb_private_kernel_prover.js → client/bb_private_kernel_prover.js} +42 -20
- package/dest/prover/client/bundle.d.ts +6 -0
- package/dest/prover/client/bundle.d.ts.map +1 -0
- package/dest/prover/client/bundle.js +8 -0
- package/dest/prover/client/lazy.d.ts +6 -0
- package/dest/prover/client/lazy.d.ts.map +1 -0
- package/dest/prover/client/lazy.js +8 -0
- package/dest/prover/index.d.ts +3 -4
- package/dest/prover/index.d.ts.map +1 -1
- package/dest/prover/index.js +2 -3
- package/dest/prover/proof_utils.d.ts +19 -0
- package/dest/prover/proof_utils.d.ts.map +1 -0
- package/dest/prover/proof_utils.js +72 -0
- package/dest/prover/server/bb_prover.d.ts +100 -0
- package/dest/prover/server/bb_prover.d.ts.map +1 -0
- package/dest/prover/server/bb_prover.js +339 -0
- package/dest/test/delay_values.d.ts +1 -1
- package/dest/test/delay_values.d.ts.map +1 -1
- package/dest/test/delay_values.js +33 -21
- package/dest/test/index.d.ts +1 -1
- package/dest/test/test_circuit_prover.d.ts +25 -34
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +85 -59
- package/dest/test/test_verifier.d.ts +6 -3
- package/dest/test/test_verifier.d.ts.map +1 -1
- package/dest/test/test_verifier.js +23 -1
- package/dest/verification_key/verification_key_data.d.ts +7 -1
- package/dest/verification_key/verification_key_data.d.ts.map +1 -1
- package/dest/verification_key/verification_key_data.js +23 -29
- package/dest/verifier/bb_verifier.d.ts +6 -5
- package/dest/verifier/bb_verifier.d.ts.map +1 -1
- package/dest/verifier/bb_verifier.js +46 -25
- package/dest/verifier/index.d.ts +2 -1
- package/dest/verifier/index.d.ts.map +1 -1
- package/dest/verifier/index.js +1 -0
- package/dest/verifier/queued_chonk_verifier.d.ts +15 -0
- package/dest/verifier/queued_chonk_verifier.d.ts.map +1 -0
- package/dest/verifier/queued_chonk_verifier.js +132 -0
- package/package.json +35 -33
- package/src/avm_proving_tests/avm_proving_tester.ts +210 -104
- package/src/bb/execute.ts +103 -250
- package/src/config.ts +2 -0
- package/src/honk.ts +3 -2
- package/src/index.ts +1 -0
- package/src/instrumentation.ts +2 -4
- package/src/prover/{bb_private_kernel_prover.ts → client/bb_private_kernel_prover.ts} +78 -30
- package/src/prover/client/bundle.ts +11 -0
- package/src/prover/client/lazy.ts +11 -0
- package/src/prover/index.ts +2 -3
- package/src/prover/proof_utils.ts +115 -0
- package/src/prover/server/bb_prover.ts +733 -0
- package/src/test/delay_values.ts +33 -21
- package/src/test/test_circuit_prover.ts +260 -147
- package/src/test/test_verifier.ts +15 -3
- package/src/verification_key/verification_key_data.ts +29 -24
- package/src/verifier/bb_verifier.ts +63 -32
- package/src/verifier/index.ts +1 -0
- package/src/verifier/queued_chonk_verifier.ts +140 -0
- package/dest/prover/bb_native_private_kernel_prover.d.ts +0 -25
- package/dest/prover/bb_native_private_kernel_prover.d.ts.map +0 -1
- package/dest/prover/bb_native_private_kernel_prover.js +0 -69
- package/dest/prover/bb_private_kernel_prover.d.ts +0 -32
- package/dest/prover/bb_private_kernel_prover.d.ts.map +0 -1
- package/dest/prover/bb_prover.d.ts +0 -120
- package/dest/prover/bb_prover.d.ts.map +0 -1
- package/dest/prover/bb_prover.js +0 -423
- package/dest/prover/client_ivc_proof_utils.d.ts +0 -25
- package/dest/prover/client_ivc_proof_utils.d.ts.map +0 -1
- package/dest/prover/client_ivc_proof_utils.js +0 -43
- package/dest/stats.d.ts +0 -5
- package/dest/stats.d.ts.map +0 -1
- package/dest/stats.js +0 -62
- package/dest/wasm/bb_wasm_private_kernel_prover.d.ts +0 -17
- package/dest/wasm/bb_wasm_private_kernel_prover.d.ts.map +0 -1
- package/dest/wasm/bb_wasm_private_kernel_prover.js +0 -46
- package/dest/wasm/bundle.d.ts +0 -6
- package/dest/wasm/bundle.d.ts.map +0 -1
- package/dest/wasm/bundle.js +0 -8
- package/dest/wasm/lazy.d.ts +0 -6
- package/dest/wasm/lazy.d.ts.map +0 -1
- package/dest/wasm/lazy.js +0 -8
- package/src/prover/bb_native_private_kernel_prover.ts +0 -119
- package/src/prover/bb_prover.ts +0 -781
- package/src/prover/client_ivc_proof_utils.ts +0 -42
- package/src/stats.ts +0 -64
- package/src/wasm/bb_wasm_private_kernel_prover.ts +0 -55
- package/src/wasm/bundle.ts +0 -11
- package/src/wasm/lazy.ts +0 -11
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
2
|
-
|
|
3
|
-
import { promises as fs } from 'fs';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
|
|
6
|
-
export const CLIENT_IVC_VK_FILE_NAME = 'vk';
|
|
7
|
-
export const CLIENT_IVC_PROOF_FILE_NAME = 'proof';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* TODO(#7371): eventually remove client_ivc_prove_output_all_msgpack and properly handle these accumulators and VKs
|
|
11
|
-
* Create a ClientIvcProof from the result of client_ivc_prove_output_all or client_ivc_prove_output_all_msgpack
|
|
12
|
-
* @param directory the directory of results
|
|
13
|
-
* @returns the encapsulated client ivc proof
|
|
14
|
-
*/
|
|
15
|
-
export async function readFromOutputDirectory(directory: string) {
|
|
16
|
-
const [clientIvcVkBuffer, clientIvcProofBuffer] = await Promise.all(
|
|
17
|
-
[CLIENT_IVC_VK_FILE_NAME, CLIENT_IVC_PROOF_FILE_NAME].map(fileName => fs.readFile(join(directory, fileName))),
|
|
18
|
-
);
|
|
19
|
-
return new ClientIvcProof(clientIvcProofBuffer, clientIvcVkBuffer);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* TODO(#7371): eventually remove client_ivc_prove_output_all_msgpack and properly handle these accumulators and VKs
|
|
24
|
-
* Serialize a ClientIvcProof to the files expected by prove_tube
|
|
25
|
-
*
|
|
26
|
-
* Example usage:
|
|
27
|
-
* await runInDirectory(bbWorkingDirectory, async (dir: string) => {
|
|
28
|
-
* await privateTx.clientIvcProof!.writeToOutputDirectory(bbWorkingDirectory);
|
|
29
|
-
* const result = await generateTubeProof(bbPath, dir, logger.info)
|
|
30
|
-
* expect(result.status).toBe(BB_RESULT.SUCCESS)
|
|
31
|
-
* });
|
|
32
|
-
* @param proof the ClientIvcProof from readFromOutputDirectory
|
|
33
|
-
* @param directory the directory of results
|
|
34
|
-
*/
|
|
35
|
-
export async function writeToOutputDirectory(clientIvcProof: ClientIvcProof, directory: string) {
|
|
36
|
-
const { clientIvcProofBuffer, clientIvcVkBuffer } = clientIvcProof;
|
|
37
|
-
const fileData = [
|
|
38
|
-
[CLIENT_IVC_PROOF_FILE_NAME, clientIvcProofBuffer],
|
|
39
|
-
[CLIENT_IVC_VK_FILE_NAME, clientIvcVkBuffer],
|
|
40
|
-
] as const;
|
|
41
|
-
await Promise.all(fileData.map(([fileName, buffer]) => fs.writeFile(join(directory, fileName), buffer)));
|
|
42
|
-
}
|
package/src/stats.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { ProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
|
|
2
|
-
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
3
|
-
|
|
4
|
-
export function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact): CircuitName {
|
|
5
|
-
switch (artifact) {
|
|
6
|
-
case 'BaseParityArtifact':
|
|
7
|
-
return 'base-parity';
|
|
8
|
-
case 'RootParityArtifact':
|
|
9
|
-
return 'root-parity';
|
|
10
|
-
case 'PrivateBaseRollupArtifact':
|
|
11
|
-
return 'private-base-rollup';
|
|
12
|
-
case 'PublicBaseRollupArtifact':
|
|
13
|
-
return 'public-base-rollup';
|
|
14
|
-
case 'MergeRollupArtifact':
|
|
15
|
-
return 'merge-rollup';
|
|
16
|
-
case 'BlockRootRollupArtifact':
|
|
17
|
-
return 'block-root-rollup';
|
|
18
|
-
case 'SingleTxBlockRootRollupArtifact':
|
|
19
|
-
return 'single-tx-block-root-rollup';
|
|
20
|
-
case 'EmptyBlockRootRollupArtifact':
|
|
21
|
-
return 'empty-block-root-rollup';
|
|
22
|
-
case 'BlockMergeRollupArtifact':
|
|
23
|
-
return 'block-merge-rollup';
|
|
24
|
-
case 'RootRollupArtifact':
|
|
25
|
-
return 'root-rollup';
|
|
26
|
-
case 'PrivateKernelInitArtifact':
|
|
27
|
-
return 'private-kernel-init';
|
|
28
|
-
case 'PrivateKernelInnerArtifact':
|
|
29
|
-
return 'private-kernel-inner';
|
|
30
|
-
case 'PrivateKernelTailArtifact':
|
|
31
|
-
return 'private-kernel-tail';
|
|
32
|
-
case 'PrivateKernelTailToPublicArtifact':
|
|
33
|
-
return 'private-kernel-tail-to-public';
|
|
34
|
-
default: {
|
|
35
|
-
if (artifact.startsWith('PrivateKernelReset')) {
|
|
36
|
-
return 'private-kernel-reset';
|
|
37
|
-
}
|
|
38
|
-
throw new Error(`Unknown circuit type: ${artifact}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function isProtocolArtifactRecursive(artifact: ProtocolArtifact): boolean {
|
|
44
|
-
switch (artifact) {
|
|
45
|
-
case 'BaseParityArtifact':
|
|
46
|
-
case 'RootParityArtifact':
|
|
47
|
-
case 'PrivateBaseRollupArtifact':
|
|
48
|
-
case 'PublicBaseRollupArtifact':
|
|
49
|
-
case 'MergeRollupArtifact':
|
|
50
|
-
case 'BlockRootRollupArtifact':
|
|
51
|
-
case 'SingleTxBlockRootRollupArtifact':
|
|
52
|
-
case 'EmptyBlockRootRollupArtifact':
|
|
53
|
-
case 'BlockMergeRollupArtifact':
|
|
54
|
-
case 'RootRollupArtifact':
|
|
55
|
-
return true;
|
|
56
|
-
default: {
|
|
57
|
-
if (artifact.startsWith('PrivateKernel')) {
|
|
58
|
-
// The kernel prover, where these are used, eventually calls `createClientIvcProof`, which is recursive.
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
throw new Error(`Unknown circuit type: ${artifact}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { AztecClientBackend } from '@aztec/bb.js';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
4
|
-
import type { ArtifactProvider } from '@aztec/noir-protocol-circuits-types/types';
|
|
5
|
-
import type { SimulationProvider } from '@aztec/simulator/client';
|
|
6
|
-
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
7
|
-
|
|
8
|
-
import { serializeWitness } from '@noir-lang/noirc_abi';
|
|
9
|
-
import type { WitnessMap } from '@noir-lang/types';
|
|
10
|
-
import { ungzip } from 'pako';
|
|
11
|
-
|
|
12
|
-
import { BBPrivateKernelProver } from '../prover/bb_private_kernel_prover.js';
|
|
13
|
-
|
|
14
|
-
export abstract class BBWASMPrivateKernelProver extends BBPrivateKernelProver {
|
|
15
|
-
constructor(
|
|
16
|
-
protected override artifactProvider: ArtifactProvider,
|
|
17
|
-
protected override simulationProvider: SimulationProvider,
|
|
18
|
-
private threads: number = 1,
|
|
19
|
-
protected override log = createLogger('bb-prover:wasm'),
|
|
20
|
-
) {
|
|
21
|
-
super(artifactProvider, simulationProvider, log);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public override async createClientIvcProof(acirs: Buffer[], witnessStack: WitnessMap[]): Promise<ClientIvcProof> {
|
|
25
|
-
const timer = new Timer();
|
|
26
|
-
this.log.info(`Generating ClientIVC proof...`);
|
|
27
|
-
const backend = new AztecClientBackend(
|
|
28
|
-
acirs.map(acir => ungzip(acir)),
|
|
29
|
-
{ threads: this.threads, logger: this.log.verbose, wasmPath: process.env.BB_WASM_PATH },
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const [proof, vk] = await backend.prove(witnessStack.map(witnessMap => ungzip(serializeWitness(witnessMap))));
|
|
33
|
-
await backend.destroy();
|
|
34
|
-
this.log.info(`Generated ClientIVC proof`, {
|
|
35
|
-
eventName: 'client-ivc-proof-generation',
|
|
36
|
-
duration: timer.ms(),
|
|
37
|
-
proofSize: proof.length,
|
|
38
|
-
vkSize: vk.length,
|
|
39
|
-
});
|
|
40
|
-
return new ClientIvcProof(Buffer.from(proof), Buffer.from(vk));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public override async computeGateCountForCircuit(_bytecode: Buffer, _circuitName: string): Promise<number> {
|
|
44
|
-
const backend = new AztecClientBackend([ungzip(_bytecode)], {
|
|
45
|
-
threads: this.threads,
|
|
46
|
-
logger: this.log.verbose,
|
|
47
|
-
wasmPath: process.env.BB_WASM_PATH,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const gateCount = await backend.gates();
|
|
51
|
-
await backend.destroy();
|
|
52
|
-
|
|
53
|
-
return gateCount[0];
|
|
54
|
-
}
|
|
55
|
-
}
|
package/src/wasm/bundle.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { BundleArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/bundle';
|
|
3
|
-
import type { SimulationProvider } from '@aztec/simulator/client';
|
|
4
|
-
|
|
5
|
-
import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
|
|
6
|
-
|
|
7
|
-
export class BBWASMBundlePrivateKernelProver extends BBWASMPrivateKernelProver {
|
|
8
|
-
constructor(simulationProvider: SimulationProvider, threads = 1, log = createLogger('bb-prover:wasm:bundle')) {
|
|
9
|
-
super(new BundleArtifactProvider(), simulationProvider, threads, log);
|
|
10
|
-
}
|
|
11
|
-
}
|
package/src/wasm/lazy.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { LazyArtifactProvider } from '@aztec/noir-protocol-circuits-types/client/lazy';
|
|
3
|
-
import type { SimulationProvider } from '@aztec/simulator/client';
|
|
4
|
-
|
|
5
|
-
import { BBWASMPrivateKernelProver } from './bb_wasm_private_kernel_prover.js';
|
|
6
|
-
|
|
7
|
-
export class BBWASMLazyPrivateKernelProver extends BBWASMPrivateKernelProver {
|
|
8
|
-
constructor(simulationProvider: SimulationProvider, threads = 1, log = createLogger('bb-prover:wasm:lazy')) {
|
|
9
|
-
super(new LazyArtifactProvider(), simulationProvider, threads, log);
|
|
10
|
-
}
|
|
11
|
-
}
|