@@ -549,7 +549,7 @@ export const verifycontribution = functionsV2.https.onCall(
549
549
printLog ( `Starting the execution of command ${ commandId } ` , LogLevel . DEBUG )
550
550
551
551
// Step (1.A.3.3).
552
- return new Promise < void > ( ( resolve , reject ) =>
552
+ new Promise < void > ( ( resolve , reject ) =>
553
553
waitForVMCommandExecution ( resolve , reject , ssm , vmInstanceId , commandId )
554
554
)
555
555
. then ( async ( ) => {
@@ -562,52 +562,55 @@ export const verifycontribution = functionsV2.https.onCall(
562
562
563
563
logAndThrowError ( COMMON_ERRORS . CM_INVALID_COMMAND_EXECUTION )
564
564
} )
565
- }
566
- // CF approach.
567
- printLog ( `CF mechanism` , LogLevel . DEBUG )
568
-
569
- const potStoragePath = getPotStorageFilePath ( files . potFilename )
570
- const firstZkeyStoragePath = getZkeyStorageFilePath ( prefix , `${ prefix } _${ genesisZkeyIndex } .zkey` )
571
- // Prepare temporary file paths.
572
- // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
573
- verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath ( verificationTranscriptCompleteFilename )
574
- const potTempFilePath = createTemporaryLocalPath ( files . potFilename )
575
- const firstZkeyTempFilePath = createTemporaryLocalPath ( firstZkeyFilename )
576
- const lastZkeyTempFilePath = createTemporaryLocalPath ( lastZkeyFilename )
577
-
578
- // Create and populate transcript.
579
- const transcriptLogger = createCustomLoggerForFile ( verificationTranscriptTemporaryLocalPath )
580
- transcriptLogger . info (
581
- `${
582
- isFinalizing ? `Final verification` : `Verification`
583
- } transcript for ${ prefix } circuit Phase 2 contribution.\n${
584
- isFinalizing ? `Coordinator ` : `Contributor # ${ Number ( lastZkeyIndex ) } `
585
- } (${ contributorOrCoordinatorIdentifier } )\n`
586
- )
565
+ } else {
566
+ // CF approach.
567
+ printLog ( `CF mechanism` , LogLevel . DEBUG )
568
+
569
+ const potStoragePath = getPotStorageFilePath ( files . potFilename )
570
+ const firstZkeyStoragePath = getZkeyStorageFilePath ( prefix , `${ prefix } _${ genesisZkeyIndex } .zkey` )
571
+ // Prepare temporary file paths.
572
+ // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
573
+ verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath (
574
+ verificationTranscriptCompleteFilename
575
+ )
576
+ const potTempFilePath = createTemporaryLocalPath ( files . potFilename )
577
+ const firstZkeyTempFilePath = createTemporaryLocalPath ( firstZkeyFilename )
578
+ const lastZkeyTempFilePath = createTemporaryLocalPath ( lastZkeyFilename )
579
+
580
+ // Create and populate transcript.
581
+ const transcriptLogger = createCustomLoggerForFile ( verificationTranscriptTemporaryLocalPath )
582
+ transcriptLogger . info (
583
+ `${
584
+ isFinalizing ? `Final verification` : `Verification`
585
+ } transcript for ${ prefix } circuit Phase 2 contribution.\n${
586
+ isFinalizing ? `Coordinator ` : `Contributor # ${ Number ( lastZkeyIndex ) } `
587
+ } (${ contributorOrCoordinatorIdentifier } )\n`
588
+ )
587
589
588
- // Step (1.A.2).
589
- await downloadArtifactFromS3Bucket ( bucketName , potStoragePath , potTempFilePath )
590
- await downloadArtifactFromS3Bucket ( bucketName , firstZkeyStoragePath , firstZkeyTempFilePath )
591
- await downloadArtifactFromS3Bucket ( bucketName , lastZkeyStoragePath , lastZkeyTempFilePath )
590
+ // Step (1.A.2).
591
+ await downloadArtifactFromS3Bucket ( bucketName , potStoragePath , potTempFilePath )
592
+ await downloadArtifactFromS3Bucket ( bucketName , firstZkeyStoragePath , firstZkeyTempFilePath )
593
+ await downloadArtifactFromS3Bucket ( bucketName , lastZkeyStoragePath , lastZkeyTempFilePath )
592
594
593
- printLog ( `Downloads from AWS S3 bucket completed - ceremony ${ ceremonyId } ` , LogLevel . DEBUG )
595
+ printLog ( `Downloads from AWS S3 bucket completed - ceremony ${ ceremonyId } ` , LogLevel . DEBUG )
594
596
595
- // Step (1.A.4).
596
- isContributionValid = await zKey . verifyFromInit (
597
- firstZkeyTempFilePath ,
598
- potTempFilePath ,
599
- lastZkeyTempFilePath ,
600
- transcriptLogger
601
- )
597
+ // Step (1.A.4).
598
+ isContributionValid = await zKey . verifyFromInit (
599
+ firstZkeyTempFilePath ,
600
+ potTempFilePath ,
601
+ lastZkeyTempFilePath ,
602
+ transcriptLogger
603
+ )
602
604
603
- // Compute contribution hash.
604
- lastZkeyBlake2bHash = await blake512FromPath ( lastZkeyTempFilePath )
605
+ // Compute contribution hash.
606
+ lastZkeyBlake2bHash = await blake512FromPath ( lastZkeyTempFilePath )
605
607
606
- // Free resources by unlinking temporary folders.
607
- // Do not free-up verification transcript path here.
608
- fs . unlinkSync ( potTempFilePath )
609
- fs . unlinkSync ( firstZkeyTempFilePath )
610
- fs . unlinkSync ( lastZkeyTempFilePath )
608
+ // Free resources by unlinking temporary folders.
609
+ // Do not free-up verification transcript path here.
610
+ fs . unlinkSync ( potTempFilePath )
611
+ fs . unlinkSync ( firstZkeyTempFilePath )
612
+ fs . unlinkSync ( lastZkeyTempFilePath )
613
+ }
611
614
612
615
// Stop verification task timer.
613
616
verificationTaskTimer . stop ( )
0 commit comments