@aztec/bb-prover 1.0.0 → 1.1.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.
@@ -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, type PrivateBaseRollupInputs, PublicBaseRollupInputs, type RootRollupInputs, type RootRollupPublicInputs, type SingleTxBlockRootRollupInputs, type TubeInputs } from '@aztec/stdlib/rollup';
7
+ import { type BaseOrMergeRollupPublicInputs, type BlockMergeRollupInputs, type BlockRootOrBlockMergePublicInputs, type BlockRootRollupInputs, type EmptyBlockRootRollupInputs, type MergeRollupInputs, PaddingBlockRootRollupInputs, 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,6 +70,7 @@ 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>>;
73
74
  /**
74
75
  * Simulates the block merge rollup circuit from its inputs.
75
76
  * @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,EAsB5B,MAAM,4CAA4C,CAAC;AAIpD,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,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAgD,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,iCAAiC,EACtC,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAc,KAAK,eAAe,EAAiC,MAAM,yBAAyB,CAAC;AAmB1G,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AA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B,CACvC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,CAAC,CACnH;IAgBY,8BAA8B,CACzC,KAAK,EAAE,4BAA4B,GAClC,OAAO,CACR,6BAA6B,CAAC,iCAAiC,EAAE,OAAO,yCAAyC,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, convertPrivateBaseRollupInputsToWitnessMap, convertPrivateBaseRollupOutputsFromWitnessMap, convertPublicBaseRollupInputsToWitnessMap, convertPublicBaseRollupOutputsFromWitnessMap, convertRootParityInputsToWitnessMap, convertRootParityOutputsFromWitnessMap, convertRootRollupInputsToWitnessMap, convertRootRollupOutputsFromWitnessMap, convertSingleTxBlockRootRollupInputsToWitnessMap, convertSingleTxBlockRootRollupOutputsFromWitnessMap, getServerCircuitArtifact } from '@aztec/noir-protocol-circuits-types/server';
12
+ import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertBlockRootRollupInputsToWitnessMap, convertBlockRootRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap, 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,6 +144,12 @@ 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
+ }
147
153
  /**
148
154
  * Simulates the block merge rollup circuit from its inputs.
149
155
  * @param input - Inputs to the circuit.
package/dest/stats.d.ts CHANGED
@@ -1,5 +1,4 @@
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;
5
4
  //# sourceMappingURL=stats.d.ts.map
@@ -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,CAqC5F;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAqB/E"}
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,CAuC5F"}
package/dest/stats.js CHANGED
@@ -16,6 +16,8 @@ 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';
19
21
  case 'BlockMergeRollupArtifact':
20
22
  return 'block-merge-rollup';
21
23
  case 'RootRollupArtifact':
@@ -37,26 +39,3 @@ export function mapProtocolArtifactNameToCircuitName(artifact) {
37
39
  }
38
40
  }
39
41
  }
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,CAa9D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAa7D,CAAC"}
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,CAc9D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAc7D,CAAC"}
@@ -4,6 +4,7 @@ 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,
7
8
  [ProvingRequestType.MERGE_ROLLUP]: 0,
8
9
  [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
9
10
  [ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0,
@@ -18,6 +19,7 @@ export const PROOF_DELAY_MS = {
18
19
  [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
19
20
  [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 55_000,
20
21
  [ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
22
+ [ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
21
23
  [ProvingRequestType.MERGE_ROLLUP]: 0,
22
24
  [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
23
25
  [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, PrivateBaseRollupInputs, PublicBaseRollupInputs, RootRollupInputs, RootRollupPublicInputs, SingleTxBlockRootRollupInputs, TubeInputs } from '@aztec/stdlib/rollup';
8
+ import type { BaseOrMergeRollupPublicInputs, BlockMergeRollupInputs, BlockRootOrBlockMergePublicInputs, BlockRootRollupInputs, EmptyBlockRootRollupInputs, MergeRollupInputs, PaddingBlockRootRollupInputs, 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,6 +60,7 @@ 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>>;
63
64
  /**
64
65
  * Simulates the block merge rollup circuit from its inputs.
65
66
  * @param input - Inputs to the circuit.
@@ -1 +1 @@
1
- {"version":3,"file":"test_circuit_prover.d.ts","sourceRoot":"","sources":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sleep } from '@aztec/foundation/sleep';
10
10
  import { Timer } from '@aztec/foundation/timer';
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';
11
+ import { convertBaseParityInputsToWitnessMap, convertBaseParityOutputsFromWitnessMap, convertBlockMergeRollupInputsToWitnessMap, convertBlockMergeRollupOutputsFromWitnessMap, convertEmptyBlockRootRollupInputsToWitnessMap, convertEmptyBlockRootRollupOutputsFromWitnessMap, convertMergeRollupInputsToWitnessMap, convertMergeRollupOutputsFromWitnessMap, convertPaddingBlockRootRollupInputsToWitnessMap, convertPaddingBlockRootRollupOutputsFromWitnessMap, 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,6 +87,9 @@ 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
+ }
90
93
  /**
91
94
  * Simulates the block merge rollup circuit from its inputs.
92
95
  * @param input - Inputs to the circuit.
@@ -169,6 +172,9 @@ _ts_decorate([
169
172
  _ts_decorate([
170
173
  trackSpan('TestCircuitProver.getEmptyBlockRootRollupProof')
171
174
  ], TestCircuitProver.prototype, "getEmptyBlockRootRollupProof", null);
175
+ _ts_decorate([
176
+ trackSpan('TestCircuitProver.getPaddingBlockRootRollupProof')
177
+ ], TestCircuitProver.prototype, "getPaddingBlockRootRollupProof", null);
172
178
  _ts_decorate([
173
179
  trackSpan('TestCircuitProver.getBlockMergeRollupProof')
174
180
  ], 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":"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
+ {"version":3,"file":"verification_key_data.d.ts","sourceRoot":"","sources":["../../src/verification_key/verification_key_data.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQjF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CASzF;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAc5F"}
@@ -1,7 +1,6 @@
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';
5
4
  import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
6
5
  import { strict as assert } from 'assert';
7
6
  import { promises as fs } from 'fs';
@@ -20,9 +19,7 @@ import { VK_FIELDS_FILENAME, VK_FILENAME } from '../bb/execute.js';
20
19
  ]);
21
20
  const fieldsJson = JSON.parse(rawFields);
22
21
  const fields = fieldsJson.map(Fr.fromHexString);
23
- // The hash is not included in the BB response
24
- const vkHash = await hashVK(fields);
25
- const vkAsFields = new VerificationKeyAsFields(fields, vkHash);
22
+ const vkAsFields = await VerificationKeyAsFields.fromKey(fields);
26
23
  return new VerificationKeyData(vkAsFields, rawBinary);
27
24
  }
28
25
  /**
@@ -37,8 +34,7 @@ import { VK_FIELDS_FILENAME, VK_FILENAME } from '../bb/execute.js';
37
34
  const reader = BufferReader.asReader(rawBinary);
38
35
  const fieldsArray = reader.readArray(numFields, Fr);
39
36
  const fieldsArrayPadded = fieldsArray.concat(Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)));
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));
37
+ const vkAsFields = await VerificationKeyAsFields.fromKey(fieldsArrayPadded);
42
38
  const vk = new VerificationKeyData(vkAsFields, rawBinary);
43
39
  return vk;
44
40
  }
@@ -1,11 +1,14 @@
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';
3
4
  import type { BBConfig } from '../config.js';
4
5
  export declare class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
5
6
  private verifier;
7
+ private telemetry;
6
8
  private logger;
7
9
  private queue;
8
- constructor(config: BBConfig, verifier: ClientProtocolCircuitVerifier, logger?: import("@aztec/foundation/log").Logger);
10
+ private metrics;
11
+ constructor(config: BBConfig, verifier: ClientProtocolCircuitVerifier, telemetry?: TelemetryClient, logger?: import("@aztec/foundation/log").Logger);
9
12
  verifyProof(tx: Tx): Promise<IVCProofVerificationResult>;
10
13
  stop(): Promise<void>;
11
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"queued_ivc_verifier.d.ts","sourceRoot":"","sources":["../../src/verifier/queued_ivc_verifier.ts"],"names":[],"mappings":"AAEA,OAAO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1,18 +1,130 @@
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
+ if (histogram.count === 0) {
89
+ continue;
90
+ }
91
+ res.observe(this.aggDurationMetrics.avg, histogram.mean, {
92
+ [Attributes.OK]: ok
93
+ });
94
+ res.observe(this.aggDurationMetrics.max, histogram.max, {
95
+ [Attributes.OK]: ok
96
+ });
97
+ res.observe(this.aggDurationMetrics.min, histogram.min, {
98
+ [Attributes.OK]: ok
99
+ });
100
+ res.observe(this.aggDurationMetrics.p50, histogram.percentile(50), {
101
+ [Attributes.OK]: ok
102
+ });
103
+ res.observe(this.aggDurationMetrics.p90, histogram.percentile(90), {
104
+ [Attributes.OK]: ok
105
+ });
106
+ }
107
+ };
108
+ }
3
109
  export class QueuedIVCVerifier {
4
110
  verifier;
111
+ telemetry;
5
112
  logger;
6
113
  queue;
7
- constructor(config, verifier, logger = createLogger('bb-prover:queued_ivc_verifier')){
114
+ metrics;
115
+ constructor(config, verifier, telemetry = getTelemetryClient(), logger = createLogger('bb-prover:queued_ivc_verifier')){
8
116
  this.verifier = verifier;
117
+ this.telemetry = telemetry;
9
118
  this.logger = logger;
119
+ this.metrics = new IVCVerifierMetrics(this.telemetry, 'QueuedIVCVerifier');
10
120
  this.queue = new SerialQueue();
11
121
  this.logger.info(`Starting QueuedIVCVerifier with ${config.numConcurrentIVCVerifiers} concurrent verifiers`);
12
122
  this.queue.start(config.numConcurrentIVCVerifiers);
13
123
  }
14
- verifyProof(tx) {
15
- return this.queue.put(()=>this.verifier.verifyProof(tx));
124
+ async verifyProof(tx) {
125
+ const result = await this.queue.put(()=>this.verifier.verifyProof(tx));
126
+ this.metrics.recordIVCVerification(result);
127
+ return result;
16
128
  }
17
129
  stop() {
18
130
  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.1.2",
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.1.2",
74
+ "@aztec/constants": "1.1.2",
75
+ "@aztec/foundation": "1.1.2",
76
+ "@aztec/noir-noirc_abi": "1.1.2",
77
+ "@aztec/noir-protocol-circuits-types": "1.1.2",
78
+ "@aztec/noir-types": "1.1.2",
79
+ "@aztec/simulator": "1.1.2",
80
+ "@aztec/stdlib": "1.1.2",
81
+ "@aztec/telemetry-client": "1.1.2",
82
+ "@aztec/world-state": "1.1.2",
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.1.2",
90
+ "@aztec/kv-store": "1.1.2",
91
+ "@aztec/noir-contracts.js": "1.1.2",
92
+ "@aztec/noir-test-contracts.js": "1.1.2",
93
+ "@aztec/protocol-contracts": "1.1.2",
94
94
  "@jest/globals": "^30.0.0",
95
95
  "@types/jest": "^30.0.0",
96
96
  "@types/node": "^22.15.17",
@@ -22,6 +22,8 @@ import {
22
22
  convertEmptyBlockRootRollupOutputsFromWitnessMap,
23
23
  convertMergeRollupInputsToWitnessMap,
24
24
  convertMergeRollupOutputsFromWitnessMap,
25
+ convertPaddingBlockRootRollupInputsToWitnessMap,
26
+ convertPaddingBlockRootRollupOutputsFromWitnessMap,
25
27
  convertPrivateBaseRollupInputsToWitnessMap,
26
28
  convertPrivateBaseRollupOutputsFromWitnessMap,
27
29
  convertPublicBaseRollupInputsToWitnessMap,
@@ -55,6 +57,7 @@ import {
55
57
  type BlockRootRollupInputs,
56
58
  type EmptyBlockRootRollupInputs,
57
59
  type MergeRollupInputs,
60
+ PaddingBlockRootRollupInputs,
58
61
  type PrivateBaseRollupInputs,
59
62
  PublicBaseRollupInputs,
60
63
  type RootRollupInputs,
@@ -345,6 +348,26 @@ export class BBNativeRollupProver implements ServerCircuitProver {
345
348
  return makePublicInputsAndRecursiveProof(circuitOutput, proof, verificationKey);
346
349
  }
347
350
 
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
+
348
371
  /**
349
372
  * Simulates the block merge rollup circuit from its inputs.
350
373
  * @param input - Inputs to the circuit.
package/src/stats.ts CHANGED
@@ -19,6 +19,8 @@ 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';
22
24
  case 'BlockMergeRollupArtifact':
23
25
  return 'block-merge-rollup';
24
26
  case 'RootRollupArtifact':
@@ -39,26 +41,3 @@ export function mapProtocolArtifactNameToCircuitName(artifact: ProtocolArtifact)
39
41
  }
40
42
  }
41
43
  }
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
- }
@@ -5,6 +5,7 @@ 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,
8
9
  [ProvingRequestType.MERGE_ROLLUP]: 0,
9
10
  [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 400_000,
10
11
  [ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
@@ -20,6 +21,7 @@ export const PROOF_DELAY_MS: Record<ProvingRequestType, number> = {
20
21
  [ProvingRequestType.BLOCK_MERGE_ROLLUP]: 15_000,
21
22
  [ProvingRequestType.BLOCK_ROOT_ROLLUP]: 55_000,
22
23
  [ProvingRequestType.EMPTY_BLOCK_ROOT_ROLLUP]: 0,
24
+ [ProvingRequestType.PADDING_BLOCK_ROOT_ROLLUP]: 0,
23
25
  [ProvingRequestType.MERGE_ROLLUP]: 0,
24
26
  [ProvingRequestType.PRIVATE_BASE_ROLLUP]: 145_000,
25
27
  [ProvingRequestType.SINGLE_TX_BLOCK_ROOT_ROLLUP]: 0, // TBD
@@ -19,6 +19,8 @@ import {
19
19
  convertEmptyBlockRootRollupOutputsFromWitnessMap,
20
20
  convertMergeRollupInputsToWitnessMap,
21
21
  convertMergeRollupOutputsFromWitnessMap,
22
+ convertPaddingBlockRootRollupInputsToWitnessMap,
23
+ convertPaddingBlockRootRollupOutputsFromWitnessMap,
22
24
  convertRootParityInputsToWitnessMap,
23
25
  convertRootParityOutputsFromWitnessMap,
24
26
  convertRootRollupInputsToWitnessMap,
@@ -54,6 +56,7 @@ import type {
54
56
  BlockRootRollupInputs,
55
57
  EmptyBlockRootRollupInputs,
56
58
  MergeRollupInputs,
59
+ PaddingBlockRootRollupInputs,
57
60
  PrivateBaseRollupInputs,
58
61
  PublicBaseRollupInputs,
59
62
  RootRollupInputs,
@@ -262,6 +265,23 @@ export class TestCircuitProver implements ServerCircuitProver {
262
265
  );
263
266
  }
264
267
 
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
+
265
285
  /**
266
286
  * Simulates the block merge rollup circuit from its inputs.
267
287
  * @param input - Inputs to the circuit.
@@ -1,7 +1,6 @@
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';
5
4
  import { VerificationKeyAsFields, VerificationKeyData } from '@aztec/stdlib/vks';
6
5
 
7
6
  import { strict as assert } from 'assert';
@@ -22,9 +21,7 @@ export async function extractVkData(vkDirectoryPath: string): Promise<Verificati
22
21
  ]);
23
22
  const fieldsJson = JSON.parse(rawFields);
24
23
  const fields = fieldsJson.map(Fr.fromHexString);
25
- // The hash is not included in the BB response
26
- const vkHash = await hashVK(fields);
27
- const vkAsFields = new VerificationKeyAsFields(fields, vkHash);
24
+ const vkAsFields = await VerificationKeyAsFields.fromKey(fields);
28
25
  return new VerificationKeyData(vkAsFields, rawBinary);
29
26
  }
30
27
 
@@ -45,8 +42,7 @@ export async function extractAvmVkData(vkDirectoryPath: string): Promise<Verific
45
42
  const fieldsArrayPadded = fieldsArray.concat(
46
43
  Array(AVM_V2_VERIFICATION_KEY_LENGTH_IN_FIELDS_PADDED - fieldsArray.length).fill(new Fr(0)),
47
44
  );
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));
45
+ const vkAsFields = await VerificationKeyAsFields.fromKey(fieldsArrayPadded);
50
46
  const vk = new VerificationKeyData(vkAsFields, rawBinary);
51
47
  return vk;
52
48
  }
@@ -2,24 +2,136 @@ 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';
5
18
 
6
19
  import type { BBConfig } from '../config.js';
7
20
 
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
+ if (histogram.count === 0) {
104
+ continue;
105
+ }
106
+ res.observe(this.aggDurationMetrics.avg, histogram.mean, { [Attributes.OK]: ok });
107
+ res.observe(this.aggDurationMetrics.max, histogram.max, { [Attributes.OK]: ok });
108
+ res.observe(this.aggDurationMetrics.min, histogram.min, { [Attributes.OK]: ok });
109
+ res.observe(this.aggDurationMetrics.p50, histogram.percentile(50), { [Attributes.OK]: ok });
110
+ res.observe(this.aggDurationMetrics.p90, histogram.percentile(90), { [Attributes.OK]: ok });
111
+ }
112
+ };
113
+ }
114
+
8
115
  export class QueuedIVCVerifier implements ClientProtocolCircuitVerifier {
9
116
  private queue: SerialQueue;
117
+ private metrics: IVCVerifierMetrics;
10
118
 
11
119
  public constructor(
12
120
  config: BBConfig,
13
121
  private verifier: ClientProtocolCircuitVerifier,
122
+ private telemetry: TelemetryClient = getTelemetryClient(),
14
123
  private logger = createLogger('bb-prover:queued_ivc_verifier'),
15
124
  ) {
125
+ this.metrics = new IVCVerifierMetrics(this.telemetry, 'QueuedIVCVerifier');
16
126
  this.queue = new SerialQueue();
17
127
  this.logger.info(`Starting QueuedIVCVerifier with ${config.numConcurrentIVCVerifiers} concurrent verifiers`);
18
128
  this.queue.start(config.numConcurrentIVCVerifiers);
19
129
  }
20
130
 
21
- public verifyProof(tx: Tx): Promise<IVCProofVerificationResult> {
22
- return this.queue.put(() => this.verifier.verifyProof(tx));
131
+ public async verifyProof(tx: Tx): Promise<IVCProofVerificationResult> {
132
+ const result = await this.queue.put(() => this.verifier.verifyProof(tx));
133
+ this.metrics.recordIVCVerification(result);
134
+ return result;
23
135
  }
24
136
 
25
137
  stop(): Promise<void> {