@aztec/bb-prover 0.62.0 → 0.63.1

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.
@@ -19,14 +19,13 @@ import {
19
19
  type KernelCircuitPublicInputs,
20
20
  type MergeRollupInputs,
21
21
  NESTED_RECURSIVE_PROOF_LENGTH,
22
+ type ParityPublicInputs,
22
23
  type PrivateBaseRollupInputs,
23
24
  type PrivateKernelEmptyInputData,
24
25
  PrivateKernelEmptyInputs,
25
26
  type Proof,
26
27
  type PublicBaseRollupInputs,
27
28
  RECURSIVE_PROOF_LENGTH,
28
- type RecursiveProof,
29
- RootParityInput,
30
29
  type RootParityInputs,
31
30
  type RootRollupInputs,
32
31
  type RootRollupPublicInputs,
@@ -40,7 +39,6 @@ import { createDebugLogger } from '@aztec/foundation/log';
40
39
  import { sleep } from '@aztec/foundation/sleep';
41
40
  import { Timer } from '@aztec/foundation/timer';
42
41
  import {
43
- ProtocolCircuitVkIndexes,
44
42
  ProtocolCircuitVks,
45
43
  type ServerProtocolArtifact,
46
44
  SimulatedServerCircuitArtifacts,
@@ -55,7 +53,6 @@ import {
55
53
  convertMergeRollupInputsToWitnessMap,
56
54
  convertMergeRollupOutputsFromWitnessMap,
57
55
  convertPrivateKernelEmptyInputsToWitnessMap,
58
- convertPrivateKernelEmptyOutputsFromWitnessMap,
59
56
  convertRootParityInputsToWitnessMap,
60
57
  convertRootParityOutputsFromWitnessMap,
61
58
  convertRootRollupInputsToWitnessMap,
@@ -65,7 +62,6 @@ import {
65
62
  convertSimulatedPrivateKernelEmptyOutputsFromWitnessMap,
66
63
  convertSimulatedPublicBaseRollupInputsToWitnessMap,
67
64
  convertSimulatedPublicBaseRollupOutputsFromWitnessMap,
68
- getVKSiblingPath,
69
65
  } from '@aztec/noir-protocol-circuits-types';
70
66
  import { type SimulationProvider, WASMSimulator, emitCircuitSimulationStats } from '@aztec/simulator';
71
67
  import { type TelemetryClient, trackSpan } from '@aztec/telemetry-client';
@@ -121,52 +117,22 @@ export class TestCircuitProver implements ServerCircuitProver {
121
117
  );
122
118
  }
123
119
 
124
- public async getEmptyTubeProof(
125
- inputs: PrivateKernelEmptyInputData,
126
- ): Promise<PublicInputsAndRecursiveProof<KernelCircuitPublicInputs>> {
127
- const emptyNested = new EmptyNestedData(
128
- makeRecursiveProof(RECURSIVE_PROOF_LENGTH),
129
- ProtocolCircuitVks['EmptyNestedArtifact'].keyAsFields,
130
- );
131
- const kernelInputs = new PrivateKernelEmptyInputs(
132
- emptyNested,
133
- inputs.header,
134
- inputs.chainId,
135
- inputs.version,
136
- inputs.vkTreeRoot,
137
- inputs.protocolContractTreeRoot,
138
- );
139
-
140
- return await this.simulate(
141
- kernelInputs,
142
- 'EmptyNestedArtifact',
143
- NESTED_RECURSIVE_PROOF_LENGTH,
144
- convertPrivateKernelEmptyInputsToWitnessMap,
145
- convertPrivateKernelEmptyOutputsFromWitnessMap,
146
- );
147
- }
148
-
149
120
  /**
150
121
  * Simulates the base parity circuit from its inputs.
151
122
  * @param inputs - Inputs to the circuit.
152
123
  * @returns The public inputs of the parity circuit.
153
124
  */
154
125
  @trackSpan('TestCircuitProver.getBaseParityProof')
155
- public async getBaseParityProof(inputs: BaseParityInputs): Promise<RootParityInput<typeof RECURSIVE_PROOF_LENGTH>> {
156
- const result = await this.simulate(
126
+ public async getBaseParityProof(
127
+ inputs: BaseParityInputs,
128
+ ): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
129
+ return await this.simulate(
157
130
  inputs,
158
131
  'BaseParityArtifact',
159
132
  RECURSIVE_PROOF_LENGTH,
160
133
  convertBaseParityInputsToWitnessMap,
161
134
  convertBaseParityOutputsFromWitnessMap,
162
135
  );
163
-
164
- return new RootParityInput(
165
- result.proof,
166
- result.verificationKey.keyAsFields,
167
- getVKSiblingPath(ProtocolCircuitVkIndexes['BaseParityArtifact']),
168
- result.inputs,
169
- );
170
136
  }
171
137
 
172
138
  /**
@@ -177,26 +143,17 @@ export class TestCircuitProver implements ServerCircuitProver {
177
143
  @trackSpan('TestCircuitProver.getRootParityProof')
178
144
  public async getRootParityProof(
179
145
  inputs: RootParityInputs,
180
- ): Promise<RootParityInput<typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
181
- const result = await this.simulate(
146
+ ): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
147
+ return await this.simulate(
182
148
  inputs,
183
149
  'RootParityArtifact',
184
150
  NESTED_RECURSIVE_PROOF_LENGTH,
185
151
  convertRootParityInputsToWitnessMap,
186
152
  convertRootParityOutputsFromWitnessMap,
187
153
  );
188
-
189
- return new RootParityInput(
190
- result.proof,
191
- result.verificationKey.keyAsFields,
192
- getVKSiblingPath(ProtocolCircuitVkIndexes['RootParityArtifact']),
193
- result.inputs,
194
- );
195
154
  }
196
155
 
197
- public async getTubeProof(
198
- _tubeInput: TubeInputs,
199
- ): Promise<ProofAndVerificationKey<RecursiveProof<typeof TUBE_PROOF_LENGTH>>> {
156
+ public async getTubeProof(_tubeInput: TubeInputs): Promise<ProofAndVerificationKey<typeof TUBE_PROOF_LENGTH>> {
200
157
  await this.delay();
201
158
  return makeProofAndVerificationKey(makeEmptyRecursiveProof(TUBE_PROOF_LENGTH), VerificationKeyData.makeFakeHonk());
202
159
  }
@@ -319,7 +276,7 @@ export class TestCircuitProver implements ServerCircuitProver {
319
276
 
320
277
  public async getAvmProof(
321
278
  _inputs: AvmCircuitInputs,
322
- ): Promise<ProofAndVerificationKey<RecursiveProof<typeof AVM_PROOF_LENGTH_IN_FIELDS>>> {
279
+ ): Promise<ProofAndVerificationKey<typeof AVM_PROOF_LENGTH_IN_FIELDS>> {
323
280
  // We can't simulate the AVM because we don't have enough context to do so (e.g., DBs).
324
281
  // We just return an empty proof and VK data.
325
282
  this.logger.debug('Skipping AVM simulation in TestCircuitProver.');
@@ -4,7 +4,7 @@ import {
4
4
  VerificationKeyAsFields,
5
5
  VerificationKeyData,
6
6
  } from '@aztec/circuits.js';
7
- import { hashVk } from '@aztec/noir-protocol-circuits-types';
7
+ import { hashVK } from '@aztec/circuits.js/hash';
8
8
 
9
9
  import { strict as assert } from 'assert';
10
10
  import * as fs from 'fs/promises';
@@ -25,7 +25,7 @@ export async function extractVkData(vkDirectoryPath: string): Promise<Verificati
25
25
  const fieldsJson = JSON.parse(rawFields);
26
26
  const fields = fieldsJson.map(Fr.fromString);
27
27
  // The hash is not included in the BB response
28
- const vkHash = hashVk(fields);
28
+ const vkHash = hashVK(fields);
29
29
  const vkAsFields = new VerificationKeyAsFields(fields, vkHash);
30
30
  return new VerificationKeyData(vkAsFields, rawBinary);
31
31
  }
@@ -23,7 +23,7 @@ import {
23
23
  } from '../bb/execute.js';
24
24
  import { type BBConfig } from '../config.js';
25
25
  import { type UltraKeccakHonkProtocolArtifact, getUltraHonkFlavorForCircuit } from '../honk.js';
26
- import { mapProtocolArtifactNameToCircuitName } from '../stats.js';
26
+ import { isProtocolArtifactRecursive, mapProtocolArtifactNameToCircuitName } from '../stats.js';
27
27
  import { extractVkData } from '../verification_key/verification_key_data.js';
28
28
 
29
29
  export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
@@ -63,6 +63,7 @@ export class BBCircuitVerifier implements ClientProtocolCircuitVerifier {
63
63
  workingDirectory,
64
64
  circuit,
65
65
  ProtocolCircuitArtifacts[circuit],
66
+ isProtocolArtifactRecursive(circuit),
66
67
  getUltraHonkFlavorForCircuit(circuit),
67
68
  logFn,
68
69
  ).then(result => {