1
1
/* eslint-disable require-await */
2
2
import {
3
- type ProofAndVerificationKey ,
3
+ type AvmProofAndVerificationKey ,
4
4
type PublicInputsAndRecursiveProof ,
5
5
type PublicKernelNonTailRequest ,
6
6
type PublicKernelTailRequest ,
@@ -11,6 +11,7 @@ import { type CircuitProvingStats, type CircuitWitnessGenerationStats } from '@a
11
11
import {
12
12
AGGREGATION_OBJECT_LENGTH ,
13
13
type AvmCircuitInputs ,
14
+ type AvmVerificationKeyData ,
14
15
type BaseOrMergeRollupPublicInputs ,
15
16
type BaseParityInputs ,
16
17
type BaseRollupInputs ,
@@ -94,7 +95,7 @@ import type { ACVMConfig, BBConfig } from '../config.js';
94
95
import { ProverInstrumentation } from '../instrumentation.js' ;
95
96
import { PublicKernelArtifactMapping } from '../mappings/mappings.js' ;
96
97
import { mapProtocolArtifactNameToCircuitName } from '../stats.js' ;
97
- import { extractVkData } from '../verification_key/verification_key_data.js' ;
98
+ import { extractAvmVkData , extractVkData } from '../verification_key/verification_key_data.js' ;
98
99
99
100
const logger = createDebugLogger ( 'aztec:bb-prover' ) ;
100
101
@@ -202,7 +203,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
202
203
@trackSpan ( 'BBNativeRollupProver.getAvmProof' , inputs => ( {
203
204
[ Attributes . APP_CIRCUIT_NAME ] : inputs . functionName ,
204
205
} ) )
205
- public async getAvmProof ( inputs : AvmCircuitInputs ) : Promise < ProofAndVerificationKey > {
206
+ public async getAvmProof ( inputs : AvmCircuitInputs ) : Promise < AvmProofAndVerificationKey > {
206
207
const proofAndVk = await this . createAvmProof ( inputs ) ;
207
208
await this . verifyAvmProof ( proofAndVk . proof , proofAndVk . verificationKey ) ;
208
209
return proofAndVk ;
@@ -626,14 +627,14 @@ export class BBNativeRollupProver implements ServerCircuitProver {
626
627
return provingResult ;
627
628
}
628
629
629
- private async createAvmProof ( input : AvmCircuitInputs ) : Promise < ProofAndVerificationKey > {
630
- const operation = async ( bbWorkingDirectory : string ) : Promise < ProofAndVerificationKey > => {
630
+ private async createAvmProof ( input : AvmCircuitInputs ) : Promise < AvmProofAndVerificationKey > {
631
+ const operation = async ( bbWorkingDirectory : string ) : Promise < AvmProofAndVerificationKey > => {
631
632
const provingResult = await this . generateAvmProofWithBB ( input , bbWorkingDirectory ) ;
632
633
633
634
const rawProof = await fs . readFile ( provingResult . proofPath ! ) ;
634
635
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6773): this VK data format is wrong.
635
636
// In particular, the number of public inputs, etc will be wrong.
636
- const verificationKey = await extractVkData ( provingResult . vkPath ! ) ;
637
+ const verificationKey = await extractAvmVkData ( provingResult . vkPath ! ) ;
637
638
const proof = new Proof ( rawProof , verificationKey . numPublicInputs ) ;
638
639
639
640
const circuitType = 'avm-circuit' as const ;
@@ -765,7 +766,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
765
766
return await this . verifyWithKey ( verificationKey , proof ) ;
766
767
}
767
768
768
- public async verifyAvmProof ( proof : Proof , verificationKey : VerificationKeyData ) {
769
+ public async verifyAvmProof ( proof : Proof , verificationKey : AvmVerificationKeyData ) {
769
770
return await this . verifyWithKeyInternal ( proof , verificationKey , verifyAvmProof ) ;
770
771
}
771
772
@@ -775,7 +776,7 @@ export class BBNativeRollupProver implements ServerCircuitProver {
775
776
776
777
private async verifyWithKeyInternal (
777
778
proof : Proof ,
778
- verificationKey : VerificationKeyData ,
779
+ verificationKey : { keyAsBytes : Buffer } ,
779
780
verificationFunction : VerificationFunction ,
780
781
) {
781
782
const operation = async ( bbWorkingDirectory : string ) => {
0 commit comments