Skip to content

Commit

Permalink
fix(vms): removed stdin/stdout redirection in VM command and added re…
Browse files Browse the repository at this point in the history
…gex match for blake3 hash
ctrlc03 committed Jun 28, 2023

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
1 parent 218340d commit 0bf3034
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/actions/src/helpers/vm.ts
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ export const vmContributionVerificationCommand = (
lastZkeyStoragePath: string,
verificationTranscriptStoragePathAndFilename: string
): Array<string> => [
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey &>/dev/null`,
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey`,
`snarkjs zkvi /var/tmp/genesisZkey.zkey /var/tmp/pot.ptau /var/tmp/lastZKey.zkey > /var/tmp/verification_transcript.log`,
`aws s3 cp /var/tmp/verification_transcript.log s3://${bucketName}/${verificationTranscriptStoragePathAndFilename} &>/dev/null`,
`/var/tmp/blake3.bin /var/tmp/verification_transcript.log | awk '{print $1}'`,
5 changes: 5 additions & 0 deletions packages/backend/src/functions/circuit.ts
Original file line number Diff line number Diff line change
@@ -613,13 +613,18 @@ export const verifycontribution = functionsV2.https.onCall(
} else {
// Retrieve the contribution hash from the command output.
lastZkeyBlake2bHash = await retrieveCommandOutput(await createSSMClient(), commandId, vmInstanceId)
const hashRegex = /[a-fA-F0-9]{64}/;
const match = lastZkeyBlake2bHash.match(hashRegex);
lastZkeyBlake2bHash = match![0]

// re upload the formatted verification transcript
await uploadFileToBucket(
bucketName,
verificationTranscriptStoragePathAndFilename,
verificationTranscriptTemporaryLocalPath,
true
)
// remove the local file
fs.unlinkSync(verificationTranscriptTemporaryLocalPath)
}

0 comments on commit 0bf3034

Please sign in to comment.