-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add extractVkToFile function to cli command
- Loading branch information
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { extractVk } from "maci-circuits"; | ||
|
||
import fs from "fs"; | ||
|
||
import { ExtractVkToFileArgs } from "../utils"; | ||
|
||
/** | ||
* Command to confirm that the verifying keys in the contract match the | ||
* local ones | ||
* @note see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing | ||
* @param CheckVerifyingKeysArgs - The arguments for the checkVerifyingKeys command | ||
* @returns Whether the verifying keys match or not | ||
*/ | ||
export const extractVkToFile = async ({ | ||
processMessagesZkeyPathQv, | ||
tallyVotesZkeyPathQv, | ||
processMessagesZkeyPathNonQv, | ||
tallyVotesZkeyPathNonQv, | ||
outputFilePath, | ||
}: ExtractVkToFileArgs): Promise<void> => { | ||
const [processVkQv, tallyVkQv, processVkNonQv, tallyVkNonQv] = await Promise.all([ | ||
extractVk(processMessagesZkeyPathQv), | ||
extractVk(tallyVotesZkeyPathQv), | ||
extractVk(processMessagesZkeyPathNonQv), | ||
extractVk(tallyVotesZkeyPathNonQv), | ||
]); | ||
|
||
await fs.promises.writeFile(outputFilePath, JSON.stringify({ processVkQv, tallyVkQv, processVkNonQv, tallyVkNonQv })); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters