@aztec/bb-prover 1.0.0-staging.2 → 1.0.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/prover/server/bb_prover.d.ts +1 -2
- package/dest/prover/server/bb_prover.d.ts.map +1 -1
- package/dest/prover/server/bb_prover.js +1 -7
- package/dest/stats.d.ts +1 -0
- package/dest/stats.d.ts.map +1 -1
- package/dest/stats.js +23 -2
- package/dest/test/delay_values.d.ts.map +1 -1
- package/dest/test/delay_values.js +0 -2
- package/dest/test/test_circuit_prover.d.ts +1 -2
- package/dest/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/test/test_circuit_prover.js +1 -7
- package/dest/verification_key/verification_key_data.d.ts.map +1 -1
- package/dest/verification_key/verification_key_data.js +6 -2
- package/dest/verifier/queued_ivc_verifier.d.ts +1 -4
- package/dest/verifier/queued_ivc_verifier.d.ts.map +1 -1
- package/dest/verifier/queued_ivc_verifier.js +3 -112
- package/package.json +16 -16
- package/src/prover/server/bb_prover.ts +0 -23
- package/src/stats.ts +23 -2
- package/src/test/delay_values.ts +0 -2
- package/src/test/test_circuit_prover.ts +0 -20
- package/src/verification_key/verification_key_data.ts +6 -2
- package/src/verifier/queued_ivc_verifier.ts +2 -111
|
@@ -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 { BaseParityInputs, ParityPublicInputs, RootParityInputs } from '@aztec/stdlib/parity';
|
|
6
6
|
import { Proof } from '@aztec/stdlib/proofs';
|
|
7
|
-
import { type BaseOrMergeRollupPublicInputs, type BlockMergeRollupInputs, type BlockRootOrBlockMergePublicInputs, type BlockRootRollupInputs, type EmptyBlockRootRollupInputs, type MergeRollupInputs,
|
|
7
|
+
import { type BaseOrMergeRollupPublicInputs, type BlockMergeRollupInputs, type BlockRootOrBlockMergePublicInputs, type BlockRootRollupInputs, type EmptyBlockRootRollupInputs, type MergeRollupInputs, type PrivateBaseRollupInputs, PublicBaseRollupInputs, type RootRollupInputs, type RootRollupPublicInputs, type SingleTxBlockRootRollupInputs, type TubeInputs } 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';
|
|
@@ -70,7 +70,6 @@ export declare class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
70
70
|
* @returns The public inputs as outputs of the simulation.
|
|
71
71
|
*/
|
|
72
72
|
getEmptyBlockRootRollupProof(input: EmptyBlockRootRollupInputs): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
73
|
-
getPaddingBlockRootRollupProof(input: PaddingBlockRootRollupInputs): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
74
73
|
/**
|
|
75
74
|
* Simulates the block merge rollup circuit from its inputs.
|
|
76
75
|
* @param input - 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,EACtB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,KAAK,sBAAsB,
|
|
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,EAEz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C,CAAC,CACnH;IAgBD;;;;OAIG;IACU,wBAAwB,CACnC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,CAAC,CACnH;IAgBD;;;;OAIG;IACU,kBAAkB,CAC7B,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,6BAA6B,CAAC,sBAAsB,CAAC,CAAC;YAkBnD,mBAAmB;YAoEnB,WAAW;YAyCX,sBAAsB;YAatB,uBAAuB;YAsBvB,cAAc;IAsCf,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,uBAAuB,CAAC,OAAO,iBAAiB,CAAC,CAAC;IA6BxG;;;;;;;;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;IAwBlC,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 { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertBlockRootRollupInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap,
|
|
12
|
+
import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertBlockRootRollupInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap, convertPrivateBaseRollupInputsToWitnessMap, convertPrivateBaseRollupOutputsFromWitnessMap, convertPublicBaseRollupInputsToWitnessMap, convertPublicBaseRollupOutputsFromWitnessMap, convertRootParityInputsToWitnessMap, convertRootParityOutputsFromWitnessMap, convertRootRollupInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap, convertSingleTxBlockRootRollupInputsToWitnessMap, convertSingleTxBlockRootRollupOutputsFromWitnessMap, getServerCircuitArtifact } from '@aztec/noir-protocol-circuits-types/server';
|
|
13
13
|
import { ServerCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
14
14
|
import { NativeACVMSimulator } from '@aztec/simulator/server';
|
|
15
15
|
import { ProvingError } from '@aztec/stdlib/errors';
|
|
@@ -144,12 +144,6 @@ const SERVER_CIRCUIT_RECURSIVE = true;
|
|
|
144
144
|
await this.verifyProof('EmptyBlockRootRollupArtifact', proof.binaryProof);
|
|
145
145
|
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
146
146
|
}
|
|
147
|
-
async getPaddingBlockRootRollupProof(input) {
|
|
148
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(input, 'PaddingBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap);
|
|
149
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
|
|
150
|
-
await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
|
|
151
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
152
|
-
}
|
|
153
147
|
/**
|
|
154
148
|
* Simulates the block merge rollup circuit from its inputs.
|
|
155
149
|
* @param input - Inputs to the circuit.
|
package/dest/stats.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProtocolArtifact } from '@aztec/noir-protocol-circuits-types/types';
|
|
2
2
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
3
3
|
export declare function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact): CircuitName;
|
|
4
|
+
export declare function isProtocolArtifactRecursive(artifact: ProtocolArtifact): boolean;
|
|
4
5
|
//# sourceMappingURL=stats.d.ts.map
|
package/dest/stats.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,gBAAgB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../src/stats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,gBAAgB,GAAG,WAAW,CAqC5F;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAqB/E"}
|
package/dest/stats.js
CHANGED
|
@@ -16,8 +16,6 @@ export function mapProtocolArtifactNameToCircuitName(artifact) {
|
|
|
16
16
|
return 'single-tx-block-root-rollup';
|
|
17
17
|
case 'EmptyBlockRootRollupArtifact':
|
|
18
18
|
return 'empty-block-root-rollup';
|
|
19
|
-
case 'PaddingBlockRootRollupArtifact':
|
|
20
|
-
return 'padding-block-root-rollup';
|
|
21
19
|
case 'BlockMergeRollupArtifact':
|
|
22
20
|
return 'block-merge-rollup';
|
|
23
21
|
case 'RootRollupArtifact':
|
|
@@ -39,3 +37,26 @@ export function mapProtocolArtifactNameToCircuitName(artifact) {
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
}
|
|
40
|
+
export function isProtocolArtifactRecursive(artifact) {
|
|
41
|
+
switch(artifact){
|
|
42
|
+
case 'BaseParityArtifact':
|
|
43
|
+
case 'RootParityArtifact':
|
|
44
|
+
case 'PrivateBaseRollupArtifact':
|
|
45
|
+
case 'PublicBaseRollupArtifact':
|
|
46
|
+
case 'MergeRollupArtifact':
|
|
47
|
+
case 'BlockRootRollupArtifact':
|
|
48
|
+
case 'SingleTxBlockRootRollupArtifact':
|
|
49
|
+
case 'EmptyBlockRootRollupArtifact':
|
|
50
|
+
case 'BlockMergeRollupArtifact':
|
|
51
|
+
case 'RootRollupArtifact':
|
|
52
|
+
return true;
|
|
53
|
+
default:
|
|
54
|
+
{
|
|
55
|
+
if (artifact.startsWith('PrivateKernel')) {
|
|
56
|
+
// The kernel prover, where these are used, eventually calls `createClientIvcProof`, which is recursive.
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Unknown circuit type: ${artifact}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay_values.d.ts","sourceRoot":"","sources":["../../src/test/delay_values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"delay_values.d.ts","sourceRoot":"","sources":["../../src/test/delay_values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAa9D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAa7D,CAAC"}
|
|
@@ -4,7 +4,6 @@ export const WITGEN_DELAY_MS = {
|
|
|
4
4
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
|
|
5
5
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 60_000,
|
|
6
6
|
[ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
|
|
7
|
-
[ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
|
|
8
7
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
9
8
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
|
|
10
9
|
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0,
|
|
@@ -19,7 +18,6 @@ export const PROOF_DELAY_MS = {
|
|
|
19
18
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
|
|
20
19
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 55_000,
|
|
21
20
|
[ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
|
|
22
|
-
[ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
|
|
23
21
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
24
22
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
|
|
25
23
|
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0,
|
|
@@ -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 { BaseParityInputs, ParityPublicInputs, RootParityInputs } from '@aztec/stdlib/parity';
|
|
7
7
|
import { type Proof } from '@aztec/stdlib/proofs';
|
|
8
|
-
import type { BaseOrMergeRollupPublicInputs, BlockMergeRollupInputs, BlockRootOrBlockMergePublicInputs, BlockRootRollupInputs, EmptyBlockRootRollupInputs, MergeRollupInputs,
|
|
8
|
+
import type { BaseOrMergeRollupPublicInputs, BlockMergeRollupInputs, BlockRootOrBlockMergePublicInputs, BlockRootRollupInputs, EmptyBlockRootRollupInputs, MergeRollupInputs, PrivateBaseRollupInputs, PublicBaseRollupInputs, RootRollupInputs, RootRollupPublicInputs, SingleTxBlockRootRollupInputs, TubeInputs } from '@aztec/stdlib/rollup';
|
|
9
9
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
10
10
|
type TestDelay = {
|
|
11
11
|
proverTestDelayType: 'fixed';
|
|
@@ -60,7 +60,6 @@ export declare class TestCircuitProver implements ServerCircuitProver {
|
|
|
60
60
|
* @returns The public inputs as outputs of the simulation.
|
|
61
61
|
*/
|
|
62
62
|
getEmptyBlockRootRollupProof(input: EmptyBlockRootRollupInputs): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
63
|
-
getPaddingBlockRootRollupProof(input: PaddingBlockRootRollupInputs): Promise<PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
|
64
63
|
/**
|
|
65
64
|
* Simulates the block merge rollup circuit from its inputs.
|
|
66
65
|
* @param input - Inputs to the circuit.
|
|
@@ -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,EACtB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,KAAK,sBAAsB,
|
|
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,EACtB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,KAAK,sBAAsB,EAuB5B,MAAM,4CAA4C,CAAC;AAGpD,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,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,KAAK,EAAmE,MAAM,sBAAsB,CAAC;AACnH,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,6BAA6B,EAC7B,UAAU,EACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,eAAe,EAAiC,MAAM,yBAAyB,CAAC;AAM9F,KAAK,SAAS,GACV;IACE,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACD;IACE,mBAAmB,EAAE,WAAW,CAAC;IACjC,qBAAqB,CAAC,EAAE,MAAM,CA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OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,CAAC,CACnH;IAYD;;;;OAIG;IAEI,4BAA4B,CACjC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,CAAC,CACnH;IAYD;;;;OAIG;IAEI,wBAAwB,CAC7B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,CAAC,CACnH;IAYD;;;;OAIG;IAEI,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,6BAA6B,CAAC,sBAAsB,CAAC,CAAC;IAY3G,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;CA8CvB"}
|
|
@@ -8,7 +8,7 @@ import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, AVM_V2_VERIFICATION_KEY_LENGTH_IN
|
|
|
8
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
9
9
|
import { sleep } from '@aztec/foundation/sleep';
|
|
10
10
|
import { Timer } from '@aztec/foundation/timer';
|
|
11
|
-
import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap,
|
|
11
|
+
import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap, convertRootParityInputsToWitnessMap, convertRootParityOutputsFromWitnessMap, convertRootRollupInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap, convertSimulatedBlockRootRollupInputsToWitnessMap, convertSimulatedBlockRootRollupOutputsFromWitnessMap, convertSimulatedPrivateBaseRollupInputsToWitnessMap, convertSimulatedPrivateBaseRollupOutputsFromWitnessMap, convertSimulatedPublicBaseRollupInputsToWitnessMap, convertSimulatedPublicBaseRollupOutputsFromWitnessMap, convertSimulatedSingleTxBlockRootRollupInputsToWitnessMap, convertSimulatedSingleTxBlockRootRollupOutputsFromWitnessMap, foreignCallHandler, getSimulatedServerCircuitArtifact } from '@aztec/noir-protocol-circuits-types/server';
|
|
12
12
|
import { ProtocolCircuitVks } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
13
13
|
import { WASMSimulatorWithBlobs, emitCircuitSimulationStats } from '@aztec/simulator/server';
|
|
14
14
|
import { makeProofAndVerificationKey, makePublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
@@ -87,9 +87,6 @@ import { PROOF_DELAY_MS, WITGEN_DELAY_MS } from './delay_values.js';
|
|
|
87
87
|
*/ getEmptyBlockRootRollupProof(input) {
|
|
88
88
|
return this.applyDelay(ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP, ()=>this.simulate(input, 'EmptyBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap));
|
|
89
89
|
}
|
|
90
|
-
getPaddingBlockRootRollupProof(input) {
|
|
91
|
-
return this.applyDelay(ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP, ()=>this.simulate(input, 'PaddingBlockRootRollupArtifact', NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap));
|
|
92
|
-
}
|
|
93
90
|
/**
|
|
94
91
|
* Simulates the block merge rollup circuit from its inputs.
|
|
95
92
|
* @param input - Inputs to the circuit.
|
|
@@ -172,9 +169,6 @@ _ts_decorate([
|
|
|
172
169
|
_ts_decorate([
|
|
173
170
|
trackSpan('TestCircuitProver.getEmptyBlockRootRollupProof')
|
|
174
171
|
], TestCircuitProver.prototype, "getEmptyBlockRootRollupProof", null);
|
|
175
|
-
_ts_decorate([
|
|
176
|
-
trackSpan('TestCircuitProver.getPaddingBlockRootRollupProof')
|
|
177
|
-
], TestCircuitProver.prototype, "getPaddingBlockRootRollupProof", null);
|
|
178
172
|
_ts_decorate([
|
|
179
173
|
trackSpan('TestCircuitProver.getBlockMergeRollupProof')
|
|
180
174
|
], TestCircuitProver.prototype, "getBlockMergeRollupProof", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification_key_data.d.ts","sourceRoot":"","sources":["../../src/verification_key/verification_key_data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verification_key_data.d.ts","sourceRoot":"","sources":["../../src/verification_key/verification_key_data.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2B,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQjF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAWzF;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAe5F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
|
+
import { hashVK } from '@aztec/stdlib/hash';
|
|
4
5
|
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
5
6
|
import { strict as assert } from 'assert';
|
|
6
7
|
import { promises as fs } from 'fs';
|
|
@@ -19,7 +20,9 @@ import { VK_FIELDS_FILENAME, VK_FILENAME } from '../bb/execute.js';
|
|
|
19
20
|
]);
|
|
20
21
|
const fieldsJson = JSON.parse(rawFields);
|
|
21
22
|
const fields = fieldsJson.map(Fr.fromHexString);
|
|
22
|
-
|
|
23
|
+
// The hash is not included in the BB response
|
|
24
|
+
const vkHash = await hashVK(fields);
|
|
25
|
+
const vkAsFields = new VerificationKeyAsFields(fields, vkHash);
|
|
23
26
|
return new VerificationKeyData(vkAsFields, rawBinary);
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
@@ -34,7 +37,8 @@ import { VK_FIELDS_FILENAME, VK_FILENAME } from '../bb/execute.js';
|
|
|
34
37
|
const reader = BufferReader.asReader(rawBinary);
|
|
35
38
|
const fieldsArray = reader.readArray(numFields, Fr);
|
|
36
39
|
const fieldsArrayPadded = fieldsArray.concat(Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)));
|
|
37
|
-
|
|
40
|
+
// Currently, we do not need the vk hash for the AVM as we are not adding in the vk tree.
|
|
41
|
+
const vkAsFields = new VerificationKeyAsFields(fieldsArrayPadded, new Fr(0));
|
|
38
42
|
const vk = new VerificationKeyData(vkAsFields, rawBinary);
|
|
39
43
|
return vk;
|
|
40
44
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
|
|
2
2
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
3
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
4
3
|
import type { BBConfig } from '../config.js';
|
|
5
4
|
export declare class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
|
|
6
5
|
private verifier;
|
|
7
|
-
private telemetry;
|
|
8
6
|
private logger;
|
|
9
7
|
private queue;
|
|
10
|
-
|
|
11
|
-
constructor(config: BBConfig, verifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, logger?: import("@aztec/foundation/log").Logger);
|
|
8
|
+
constructor(config: BBConfig, verifier: ClientProtocolCircuitVerifier, logger?: import("@aztec/foundation/log").Logger);
|
|
12
9
|
verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
|
|
13
10
|
stop(): Promise<void>;
|
|
14
11
|
}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,qBAAa,iBAAkB,YAAW,6BAA6B;IAKnE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,KAAK,CAAc;gBAGzB,MAAM,EAAE,QAAQ,EACR,QAAQ,EAAE,6BAA6B,EACvC,MAAM,yCAAgD;IAOzD,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAI/D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB"}
|
|
@@ -1,127 +1,18 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
3
|
-
import { Attributes, Metrics, ValueType, getTelemetryClient } from '@aztec/telemetry-client';
|
|
4
|
-
import { createHistogram } from 'node:perf_hooks';
|
|
5
|
-
class IVCVerifierMetrics {
|
|
6
|
-
ivcVerificationHistogram;
|
|
7
|
-
ivcTotalVerificationHistogram;
|
|
8
|
-
ivcFailureCount;
|
|
9
|
-
localHistogramOk = createHistogram({
|
|
10
|
-
min: 1,
|
|
11
|
-
max: 5 * 60 * 1000
|
|
12
|
-
});
|
|
13
|
-
localHistogramFails = createHistogram({
|
|
14
|
-
min: 1,
|
|
15
|
-
max: 5 * 60 * 1000
|
|
16
|
-
});
|
|
17
|
-
aggDurationMetrics;
|
|
18
|
-
constructor(client, name = 'QueuedIVCVerifier'){
|
|
19
|
-
const meter = client.getMeter(name);
|
|
20
|
-
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
|
|
21
|
-
unit: 'ms',
|
|
22
|
-
description: 'Duration to verify client IVC proofs',
|
|
23
|
-
valueType: ValueType.INT
|
|
24
|
-
});
|
|
25
|
-
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
|
|
26
|
-
unit: 'ms',
|
|
27
|
-
description: 'Total duration to verify client IVC proofs, including serde',
|
|
28
|
-
valueType: ValueType.INT
|
|
29
|
-
});
|
|
30
|
-
this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
|
|
31
|
-
description: 'Count of failed IVC proof verifications',
|
|
32
|
-
valueType: ValueType.INT
|
|
33
|
-
});
|
|
34
|
-
this.aggDurationMetrics = {
|
|
35
|
-
avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG, {
|
|
36
|
-
valueType: ValueType.DOUBLE,
|
|
37
|
-
description: 'AVG ivc verification',
|
|
38
|
-
unit: 'ms'
|
|
39
|
-
}),
|
|
40
|
-
max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX, {
|
|
41
|
-
valueType: ValueType.DOUBLE,
|
|
42
|
-
description: 'MAX ivc verification',
|
|
43
|
-
unit: 'ms'
|
|
44
|
-
}),
|
|
45
|
-
min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN, {
|
|
46
|
-
valueType: ValueType.DOUBLE,
|
|
47
|
-
description: 'MIN ivc verification',
|
|
48
|
-
unit: 'ms'
|
|
49
|
-
}),
|
|
50
|
-
p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50, {
|
|
51
|
-
valueType: ValueType.DOUBLE,
|
|
52
|
-
description: 'P50 ivc verification',
|
|
53
|
-
unit: 'ms'
|
|
54
|
-
}),
|
|
55
|
-
p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90, {
|
|
56
|
-
valueType: ValueType.DOUBLE,
|
|
57
|
-
description: 'P90 ivc verification',
|
|
58
|
-
unit: 'ms'
|
|
59
|
-
})
|
|
60
|
-
};
|
|
61
|
-
meter.addBatchObservableCallback(this.aggregate, Object.values(this.aggDurationMetrics));
|
|
62
|
-
}
|
|
63
|
-
recordIVCVerification(result) {
|
|
64
|
-
this.ivcVerificationHistogram.record(Math.ceil(result.durationMs), {
|
|
65
|
-
[Attributes.OK]: result.valid
|
|
66
|
-
});
|
|
67
|
-
this.ivcTotalVerificationHistogram.record(Math.ceil(result.totalDurationMs), {
|
|
68
|
-
[Attributes.OK]: result.valid
|
|
69
|
-
});
|
|
70
|
-
if (!result.valid) {
|
|
71
|
-
this.ivcFailureCount.add(1);
|
|
72
|
-
this.localHistogramFails.record(Math.max(Math.ceil(result.durationMs), 1));
|
|
73
|
-
} else {
|
|
74
|
-
this.localHistogramOk.record(Math.max(Math.ceil(result.durationMs), 1));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
aggregate = (res)=>{
|
|
78
|
-
for (const [histogram, ok] of [
|
|
79
|
-
[
|
|
80
|
-
this.localHistogramOk,
|
|
81
|
-
true
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
this.localHistogramFails,
|
|
85
|
-
false
|
|
86
|
-
]
|
|
87
|
-
]){
|
|
88
|
-
res.observe(this.aggDurationMetrics.avg, histogram.mean, {
|
|
89
|
-
[Attributes.OK]: ok
|
|
90
|
-
});
|
|
91
|
-
res.observe(this.aggDurationMetrics.max, histogram.max, {
|
|
92
|
-
[Attributes.OK]: ok
|
|
93
|
-
});
|
|
94
|
-
res.observe(this.aggDurationMetrics.min, histogram.min, {
|
|
95
|
-
[Attributes.OK]: ok
|
|
96
|
-
});
|
|
97
|
-
res.observe(this.aggDurationMetrics.p50, histogram.percentile(50), {
|
|
98
|
-
[Attributes.OK]: ok
|
|
99
|
-
});
|
|
100
|
-
res.observe(this.aggDurationMetrics.p90, histogram.percentile(90), {
|
|
101
|
-
[Attributes.OK]: ok
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
3
|
export class QueuedIVCVerifier {
|
|
107
4
|
verifier;
|
|
108
|
-
telemetry;
|
|
109
5
|
logger;
|
|
110
6
|
queue;
|
|
111
|
-
|
|
112
|
-
constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:queued_ivc_verifier')){
|
|
7
|
+
constructor(config, verifier, logger = createLogger('bb-prover:queued_ivc_verifier')){
|
|
113
8
|
this.verifier = verifier;
|
|
114
|
-
this.telemetry = telemetry;
|
|
115
9
|
this.logger = logger;
|
|
116
|
-
this.metrics = new IVCVerifierMetrics(this.telemetry, 'QueuedIVCVerifier');
|
|
117
10
|
this.queue = new SerialQueue();
|
|
118
11
|
this.logger.info(`Starting QueuedIVCVerifier with ${config.numConcurrentIVCVerifiers} concurrent verifiers`);
|
|
119
12
|
this.queue.start(config.numConcurrentIVCVerifiers);
|
|
120
13
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.metrics.recordIVCVerification(result);
|
|
124
|
-
return result;
|
|
14
|
+
verifyProof(tx) {
|
|
15
|
+
return this.queue.put(()=>this.verifier.verifyProof(tx));
|
|
125
16
|
}
|
|
126
17
|
stop() {
|
|
127
18
|
return this.queue.end();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bb-prover",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -70,27 +70,27 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb.js": "1.0.0
|
|
74
|
-
"@aztec/constants": "1.0.0
|
|
75
|
-
"@aztec/foundation": "1.0.0
|
|
76
|
-
"@aztec/noir-noirc_abi": "1.0.0
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0
|
|
78
|
-
"@aztec/noir-types": "1.0.0
|
|
79
|
-
"@aztec/simulator": "1.0.0
|
|
80
|
-
"@aztec/stdlib": "1.0.0
|
|
81
|
-
"@aztec/telemetry-client": "1.0.0
|
|
82
|
-
"@aztec/world-state": "1.0.0
|
|
73
|
+
"@aztec/bb.js": "1.0.0",
|
|
74
|
+
"@aztec/constants": "1.0.0",
|
|
75
|
+
"@aztec/foundation": "1.0.0",
|
|
76
|
+
"@aztec/noir-noirc_abi": "1.0.0",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0",
|
|
78
|
+
"@aztec/noir-types": "1.0.0",
|
|
79
|
+
"@aztec/simulator": "1.0.0",
|
|
80
|
+
"@aztec/stdlib": "1.0.0",
|
|
81
|
+
"@aztec/telemetry-client": "1.0.0",
|
|
82
|
+
"@aztec/world-state": "1.0.0",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"pako": "^2.1.0",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
86
86
|
"tslib": "^2.4.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@aztec/ethereum": "1.0.0
|
|
90
|
-
"@aztec/kv-store": "1.0.0
|
|
91
|
-
"@aztec/noir-contracts.js": "1.0.0
|
|
92
|
-
"@aztec/noir-test-contracts.js": "1.0.0
|
|
93
|
-
"@aztec/protocol-contracts": "1.0.0
|
|
89
|
+
"@aztec/ethereum": "1.0.0",
|
|
90
|
+
"@aztec/kv-store": "1.0.0",
|
|
91
|
+
"@aztec/noir-contracts.js": "1.0.0",
|
|
92
|
+
"@aztec/noir-test-contracts.js": "1.0.0",
|
|
93
|
+
"@aztec/protocol-contracts": "1.0.0",
|
|
94
94
|
"@jest/globals": "^30.0.0",
|
|
95
95
|
"@types/jest": "^30.0.0",
|
|
96
96
|
"@types/node": "^22.15.17",
|
|
@@ -22,8 +22,6 @@ import {
|
|
|
22
22
|
convertEmptyBlockRootRollupOutputsFromWitnessMap,
|
|
23
23
|
convertMergeRollupInputsToWitnessMap,
|
|
24
24
|
convertMergeRollupOutputsFromWitnessMap,
|
|
25
|
-
convertPaddingBlockRootRollupInputsToWitnessMap,
|
|
26
|
-
convertPaddingBlockRootRollupOutputsFromWitnessMap,
|
|
27
25
|
convertPrivateBaseRollupInputsToWitnessMap,
|
|
28
26
|
convertPrivateBaseRollupOutputsFromWitnessMap,
|
|
29
27
|
convertPublicBaseRollupInputsToWitnessMap,
|
|
@@ -57,7 +55,6 @@ import {
|
|
|
57
55
|
type BlockRootRollupInputs,
|
|
58
56
|
type EmptyBlockRootRollupInputs,
|
|
59
57
|
type MergeRollupInputs,
|
|
60
|
-
PaddingBlockRootRollupInputs,
|
|
61
58
|
type PrivateBaseRollupInputs,
|
|
62
59
|
PublicBaseRollupInputs,
|
|
63
60
|
type RootRollupInputs,
|
|
@@ -348,26 +345,6 @@ export class BBNativeRollupProver implements ServerCircuitProver {
|
|
|
348
345
|
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
349
346
|
}
|
|
350
347
|
|
|
351
|
-
public async getPaddingBlockRootRollupProof(
|
|
352
|
-
input: PaddingBlockRootRollupInputs,
|
|
353
|
-
): Promise<
|
|
354
|
-
PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
355
|
-
> {
|
|
356
|
-
const { circuitOutput, proof } = await this.createRecursiveProof(
|
|
357
|
-
input,
|
|
358
|
-
'PaddingBlockRootRollupArtifact',
|
|
359
|
-
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
360
|
-
convertPaddingBlockRootRollupInputsToWitnessMap,
|
|
361
|
-
convertPaddingBlockRootRollupOutputsFromWitnessMap,
|
|
362
|
-
);
|
|
363
|
-
|
|
364
|
-
const verificationKey = this.getVerificationKeyDataForCircuit('PaddingBlockRootRollupArtifact');
|
|
365
|
-
|
|
366
|
-
await this.verifyProof('PaddingBlockRootRollupArtifact', proof.binaryProof);
|
|
367
|
-
|
|
368
|
-
return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
348
|
/**
|
|
372
349
|
* Simulates the block merge rollup circuit from its inputs.
|
|
373
350
|
* @param input - Inputs to the circuit.
|
package/src/stats.ts
CHANGED
|
@@ -19,8 +19,6 @@ export function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact)
|
|
|
19
19
|
return 'single-tx-block-root-rollup';
|
|
20
20
|
case 'EmptyBlockRootRollupArtifact':
|
|
21
21
|
return 'empty-block-root-rollup';
|
|
22
|
-
case 'PaddingBlockRootRollupArtifact':
|
|
23
|
-
return 'padding-block-root-rollup';
|
|
24
22
|
case 'BlockMergeRollupArtifact':
|
|
25
23
|
return 'block-merge-rollup';
|
|
26
24
|
case 'RootRollupArtifact':
|
|
@@ -41,3 +39,26 @@ export function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact)
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
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
|
+
}
|
package/src/test/delay_values.ts
CHANGED
|
@@ -5,7 +5,6 @@ export const WITGEN_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
5
5
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 650,
|
|
6
6
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 60_000,
|
|
7
7
|
[ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
|
|
8
|
-
[ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
|
|
9
8
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
10
9
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
|
|
11
10
|
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
|
|
@@ -21,7 +20,6 @@ export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
|
|
|
21
20
|
[ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
|
|
22
21
|
[ProvingRequestType.BLOCK_ROOT_ROLLUP]: 55_000,
|
|
23
22
|
[ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
|
|
24
|
-
[ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
|
|
25
23
|
[ProvingRequestType.MERGE_ROLLUP]: 0,
|
|
26
24
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
|
|
27
25
|
[ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
|
|
@@ -19,8 +19,6 @@ import {
|
|
|
19
19
|
convertEmptyBlockRootRollupOutputsFromWitnessMap,
|
|
20
20
|
convertMergeRollupInputsToWitnessMap,
|
|
21
21
|
convertMergeRollupOutputsFromWitnessMap,
|
|
22
|
-
convertPaddingBlockRootRollupInputsToWitnessMap,
|
|
23
|
-
convertPaddingBlockRootRollupOutputsFromWitnessMap,
|
|
24
22
|
convertRootParityInputsToWitnessMap,
|
|
25
23
|
convertRootParityOutputsFromWitnessMap,
|
|
26
24
|
convertRootRollupInputsToWitnessMap,
|
|
@@ -56,7 +54,6 @@ import type {
|
|
|
56
54
|
BlockRootRollupInputs,
|
|
57
55
|
EmptyBlockRootRollupInputs,
|
|
58
56
|
MergeRollupInputs,
|
|
59
|
-
PaddingBlockRootRollupInputs,
|
|
60
57
|
PrivateBaseRollupInputs,
|
|
61
58
|
PublicBaseRollupInputs,
|
|
62
59
|
RootRollupInputs,
|
|
@@ -265,23 +262,6 @@ export class TestCircuitProver implements ServerCircuitProver {
|
|
|
265
262
|
);
|
|
266
263
|
}
|
|
267
264
|
|
|
268
|
-
@trackSpan('TestCircuitProver.getPaddingBlockRootRollupProof')
|
|
269
|
-
public getPaddingBlockRootRollupProof(
|
|
270
|
-
input: PaddingBlockRootRollupInputs,
|
|
271
|
-
): Promise<
|
|
272
|
-
PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
273
|
-
> {
|
|
274
|
-
return this.applyDelay(ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP, () =>
|
|
275
|
-
this.simulate(
|
|
276
|
-
input,
|
|
277
|
-
'PaddingBlockRootRollupArtifact',
|
|
278
|
-
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
279
|
-
convertPaddingBlockRootRollupInputsToWitnessMap,
|
|
280
|
-
convertPaddingBlockRootRollupOutputsFromWitnessMap,
|
|
281
|
-
),
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
265
|
/**
|
|
286
266
|
* Simulates the block merge rollup circuit from its inputs.
|
|
287
267
|
* @param input - Inputs to the circuit.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
4
|
+
import { hashVK } from '@aztec/stdlib/hash';
|
|
4
5
|
import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
|
|
5
6
|
|
|
6
7
|
import { strict as assert } from 'assert';
|
|
@@ -21,7 +22,9 @@ export async function extractVkData(vkDirectoryPath: string): Promise<Verificati
|
|
|
21
22
|
]);
|
|
22
23
|
const fieldsJson = JSON.parse(rawFields);
|
|
23
24
|
const fields = fieldsJson.map(Fr.fromHexString);
|
|
24
|
-
|
|
25
|
+
// The hash is not included in the BB response
|
|
26
|
+
const vkHash = await hashVK(fields);
|
|
27
|
+
const vkAsFields = new VerificationKeyAsFields(fields, vkHash);
|
|
25
28
|
return new VerificationKeyData(vkAsFields, rawBinary);
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -42,7 +45,8 @@ export async function extractAvmVkData(vkDirectoryPath: string): Promise<Verific
|
|
|
42
45
|
const fieldsArrayPadded = fieldsArray.concat(
|
|
43
46
|
Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)),
|
|
44
47
|
);
|
|
45
|
-
|
|
48
|
+
// Currently, we do not need the vk hash for the AVM as we are not adding in the vk tree.
|
|
49
|
+
const vkAsFields = new VerificationKeyAsFields(fieldsArrayPadded, new Fr(0));
|
|
46
50
|
const vk = new VerificationKeyData(vkAsFields, rawBinary);
|
|
47
51
|
return vk;
|
|
48
52
|
}
|
|
@@ -2,133 +2,24 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
3
3
|
import type { ClientProtocolCircuitVerifier, IVCProofVerificationResult } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
5
|
-
import {
|
|
6
|
-
Attributes,
|
|
7
|
-
type BatchObservableResult,
|
|
8
|
-
type Histogram,
|
|
9
|
-
Metrics,
|
|
10
|
-
type ObservableGauge,
|
|
11
|
-
type TelemetryClient,
|
|
12
|
-
type UpDownCounter,
|
|
13
|
-
ValueType,
|
|
14
|
-
getTelemetryClient,
|
|
15
|
-
} from '@aztec/telemetry-client';
|
|
16
|
-
|
|
17
|
-
import { createHistogram } from 'node:perf_hooks';
|
|
18
5
|
|
|
19
6
|
import type { BBConfig } from '../config.js';
|
|
20
7
|
|
|
21
|
-
class IVCVerifierMetrics {
|
|
22
|
-
private ivcVerificationHistogram: Histogram;
|
|
23
|
-
private ivcTotalVerificationHistogram: Histogram;
|
|
24
|
-
private ivcFailureCount: UpDownCounter;
|
|
25
|
-
private localHistogramOk = createHistogram({
|
|
26
|
-
min: 1,
|
|
27
|
-
max: 5 * 60 * 1000, // 5 min
|
|
28
|
-
});
|
|
29
|
-
private localHistogramFails = createHistogram({
|
|
30
|
-
min: 1,
|
|
31
|
-
max: 5 * 60 * 1000, // 5 min
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
private aggDurationMetrics: Record<'min' | 'max' | 'p50' | 'p90' | 'avg', ObservableGauge>;
|
|
35
|
-
|
|
36
|
-
constructor(client: TelemetryClient, name = 'QueuedIVCVerifier') {
|
|
37
|
-
const meter = client.getMeter(name);
|
|
38
|
-
|
|
39
|
-
this.ivcVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TIME, {
|
|
40
|
-
unit: 'ms',
|
|
41
|
-
description: 'Duration to verify client IVC proofs',
|
|
42
|
-
valueType: ValueType.INT,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.ivcTotalVerificationHistogram = meter.createHistogram(Metrics.IVC_VERIFIER_TOTAL_TIME, {
|
|
46
|
-
unit: 'ms',
|
|
47
|
-
description: 'Total duration to verify client IVC proofs, including serde',
|
|
48
|
-
valueType: ValueType.INT,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
this.ivcFailureCount = meter.createUpDownCounter(Metrics.IVC_VERIFIER_FAILURE_COUNT, {
|
|
52
|
-
description: 'Count of failed IVC proof verifications',
|
|
53
|
-
valueType: ValueType.INT,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
this.aggDurationMetrics = {
|
|
57
|
-
avg: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_AVG, {
|
|
58
|
-
valueType: ValueType.DOUBLE,
|
|
59
|
-
description: 'AVG ivc verification',
|
|
60
|
-
unit: 'ms',
|
|
61
|
-
}),
|
|
62
|
-
max: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MAX, {
|
|
63
|
-
valueType: ValueType.DOUBLE,
|
|
64
|
-
description: 'MAX ivc verification',
|
|
65
|
-
unit: 'ms',
|
|
66
|
-
}),
|
|
67
|
-
min: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_MIN, {
|
|
68
|
-
valueType: ValueType.DOUBLE,
|
|
69
|
-
description: 'MIN ivc verification',
|
|
70
|
-
unit: 'ms',
|
|
71
|
-
}),
|
|
72
|
-
p50: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P50, {
|
|
73
|
-
valueType: ValueType.DOUBLE,
|
|
74
|
-
description: 'P50 ivc verification',
|
|
75
|
-
unit: 'ms',
|
|
76
|
-
}),
|
|
77
|
-
p90: meter.createObservableGauge(Metrics.IVC_VERIFIER_AGG_DURATION_P90, {
|
|
78
|
-
valueType: ValueType.DOUBLE,
|
|
79
|
-
description: 'P90 ivc verification',
|
|
80
|
-
unit: 'ms',
|
|
81
|
-
}),
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
meter.addBatchObservableCallback(this.aggregate, Object.values(this.aggDurationMetrics));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
recordIVCVerification(result: IVCProofVerificationResult) {
|
|
88
|
-
this.ivcVerificationHistogram.record(Math.ceil(result.durationMs), { [Attributes.OK]: result.valid });
|
|
89
|
-
this.ivcTotalVerificationHistogram.record(Math.ceil(result.totalDurationMs), { [Attributes.OK]: result.valid });
|
|
90
|
-
if (!result.valid) {
|
|
91
|
-
this.ivcFailureCount.add(1);
|
|
92
|
-
this.localHistogramFails.record(Math.max(Math.ceil(result.durationMs), 1));
|
|
93
|
-
} else {
|
|
94
|
-
this.localHistogramOk.record(Math.max(Math.ceil(result.durationMs), 1));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private aggregate = (res: BatchObservableResult) => {
|
|
99
|
-
for (const [histogram, ok] of [
|
|
100
|
-
[this.localHistogramOk, true],
|
|
101
|
-
[this.localHistogramFails, false],
|
|
102
|
-
] as const) {
|
|
103
|
-
res.observe(this.aggDurationMetrics.avg, histogram.mean, { [Attributes.OK]: ok });
|
|
104
|
-
res.observe(this.aggDurationMetrics.max, histogram.max, { [Attributes.OK]: ok });
|
|
105
|
-
res.observe(this.aggDurationMetrics.min, histogram.min, { [Attributes.OK]: ok });
|
|
106
|
-
res.observe(this.aggDurationMetrics.p50, histogram.percentile(50), { [Attributes.OK]: ok });
|
|
107
|
-
res.observe(this.aggDurationMetrics.p90, histogram.percentile(90), { [Attributes.OK]: ok });
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
8
|
export class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
|
|
113
9
|
private queue: SerialQueue;
|
|
114
|
-
private metrics: IVCVerifierMetrics;
|
|
115
10
|
|
|
116
11
|
public constructor(
|
|
117
12
|
config: BBConfig,
|
|
118
13
|
private verifier: ClientProtocolCircuitVerifier,
|
|
119
|
-
private telemetry: TelemetryClient = getTelemetryClient(),
|
|
120
14
|
private logger = createLogger('bb-prover:queued_ivc_verifier'),
|
|
121
15
|
) {
|
|
122
|
-
this.metrics = new IVCVerifierMetrics(this.telemetry, 'QueuedIVCVerifier');
|
|
123
16
|
this.queue = new SerialQueue();
|
|
124
17
|
this.logger.info(`Starting QueuedIVCVerifier with ${config.numConcurrentIVCVerifiers} concurrent verifiers`);
|
|
125
18
|
this.queue.start(config.numConcurrentIVCVerifiers);
|
|
126
19
|
}
|
|
127
20
|
|
|
128
|
-
public
|
|
129
|
-
|
|
130
|
-
this.metrics.recordIVCVerification(result);
|
|
131
|
-
return result;
|
|
21
|
+
public verifyProof(tx: Tx): Promise<IVCProofVerificationResult> {
|
|
22
|
+
return this.queue.put(() => this.verifier.verifyProof(tx));
|
|
132
23
|
}
|
|
133
24
|
|
|
134
25
|
stop(): Promise<void> {
|