Skip to content

Commit 0bf3034

Browse files
committed
fix(vms): removed stdin/stdout redirection in VM command and added regex match for blake3 hash
1 parent 218340d commit 0bf3034

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/actions/src/helpers/vm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const vmContributionVerificationCommand = (
9999
lastZkeyStoragePath: string,
100100
verificationTranscriptStoragePathAndFilename: string
101101
): Array<string> => [
102-
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey &>/dev/null`,
102+
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey`,
103103
`snarkjs zkvi /var/tmp/genesisZkey.zkey /var/tmp/pot.ptau /var/tmp/lastZKey.zkey > /var/tmp/verification_transcript.log`,
104104
`aws s3 cp /var/tmp/verification_transcript.log s3://${bucketName}/${verificationTranscriptStoragePathAndFilename} &>/dev/null`,
105105
`/var/tmp/blake3.bin /var/tmp/verification_transcript.log | awk '{print $1}'`,

packages/backend/src/functions/circuit.ts

+5
Original file line numberDiff line numberDiff line change
@@ -613,13 +613,18 @@ export const verifycontribution = functionsV2.https.onCall(
613613
} else {
614614
// Retrieve the contribution hash from the command output.
615615
lastZkeyBlake2bHash = await retrieveCommandOutput(await createSSMClient(), commandId, vmInstanceId)
616+
const hashRegex = /[a-fA-F0-9]{64}/;
617+
const match = lastZkeyBlake2bHash.match(hashRegex);
618+
lastZkeyBlake2bHash = match![0]
619+
616620
// re upload the formatted verification transcript
617621
await uploadFileToBucket(
618622
bucketName,
619623
verificationTranscriptStoragePathAndFilename,
620624
verificationTranscriptTemporaryLocalPath,
621625
true
622626
)
627+
// remove the local file
623628
fs.unlinkSync(verificationTranscriptTemporaryLocalPath)
624629
}
625630

0 commit comments

Comments
 (0)