@devtion/devcli 0.0.0-36caea1 → 0.0.0-4088679
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -4
- package/dist/types/commands/finalize.d.ts +1 -1
- package/package.json +2 -2
- package/src/commands/finalize.ts +7 -6
- package/src/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -365,6 +365,12 @@ const getVerificationKeyLocalFilePath = (completeFilename) => `${verificationKey
|
|
|
365
365
|
* @returns <string> - the complete final verifier contract path to the file.
|
|
366
366
|
*/
|
|
367
367
|
const getVerifierContractLocalFilePath = (completeFilename) => `${verifierContractsLocalFolderPath}/${completeFilename}`;
|
|
368
|
+
/**
|
|
369
|
+
* Get the complete final attestation file path.
|
|
370
|
+
* @param completeFilename <string> - the complete filename of the file (name.ext).
|
|
371
|
+
* @returns <string> - the complete final final attestation path to the file.
|
|
372
|
+
*/
|
|
373
|
+
const getFinalAttestationLocalFilePath = (completeFilename) => `${finalAttestationsLocalFolderPath}/${completeFilename}`;
|
|
368
374
|
/**
|
|
369
375
|
* Get the final transcript file path.
|
|
370
376
|
* @param completeFilename <string> - the complete filename of the file (name.ext).
|
|
@@ -2902,7 +2908,7 @@ const handleVerifierSmartContract = async (cloudFunctions, bucketName, finalZkey
|
|
|
2902
2908
|
const packagePath = `${dirname(fileURLToPath(import.meta.url))}`;
|
|
2903
2909
|
const verifierPath = packagePath.includes(`src/commands`)
|
|
2904
2910
|
? `${dirname(fileURLToPath(import.meta.url))}/../../../../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`
|
|
2905
|
-
: `${dirname(fileURLToPath(import.meta.url))}
|
|
2911
|
+
: `${dirname(fileURLToPath(import.meta.url))}/../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`;
|
|
2906
2912
|
// Export the Solidity verifier smart contract.
|
|
2907
2913
|
const verifierCode = await exportVerifierContract(finalZkeyLocalFilePath, verifierPath);
|
|
2908
2914
|
spinner.text = `Writing verifier smart contract...`;
|
|
@@ -2967,10 +2973,11 @@ const handleCircuitFinalization = async (cloudFunctions, firestoreDatabase, cere
|
|
|
2967
2973
|
* @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
|
|
2968
2974
|
* handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
|
|
2969
2975
|
*/
|
|
2970
|
-
const finalize = async () => {
|
|
2976
|
+
const finalize = async (opt) => {
|
|
2971
2977
|
const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices();
|
|
2972
2978
|
// Check for authentication.
|
|
2973
|
-
const
|
|
2979
|
+
const auth = opt.auth;
|
|
2980
|
+
const { user, providerUserId, token: coordinatorAccessToken } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp);
|
|
2974
2981
|
// Preserve command execution only for coordinators.
|
|
2975
2982
|
if (!(await isCoordinator(user)))
|
|
2976
2983
|
showError(COMMAND_ERRORS.COMMAND_NOT_COORDINATOR, true);
|
|
@@ -3020,7 +3027,7 @@ const finalize = async () => {
|
|
|
3020
3027
|
// Generate attestation with final contributions.
|
|
3021
3028
|
const publicAttestation = await generateValidContributionsAttestation(firestoreDatabase, circuits, selectedCeremony.id, participant.id, contributions, providerUserId, ceremonyName, true);
|
|
3022
3029
|
// Write public attestation locally.
|
|
3023
|
-
writeFile(
|
|
3030
|
+
writeFile(getFinalAttestationLocalFilePath(`${prefix}_${finalContributionIndex}_${commonTerms.foldersAndPathsTerms.attestation}.log`), Buffer.from(publicAttestation));
|
|
3024
3031
|
await sleep(3000); // workaround for file descriptor unexpected close.
|
|
3025
3032
|
const gistUrl = await publishGist(coordinatorAccessToken, publicAttestation, ceremonyName, prefix);
|
|
3026
3033
|
console.log(`\n${theme.symbols.info} Your public final attestation has been successfully posted as Github Gist (${theme.text.bold(theme.text.underlined(gistUrl))})`);
|
|
@@ -3191,5 +3198,6 @@ ceremony
|
|
|
3191
3198
|
ceremony
|
|
3192
3199
|
.command("finalize")
|
|
3193
3200
|
.description("finalize a Phase2 Trusted Setup ceremony by applying a beacon, exporting verification key and verifier contract")
|
|
3201
|
+
.option("-a, --auth <string>", "the Github OAuth 2.0 token", "")
|
|
3194
3202
|
.action(finalize);
|
|
3195
3203
|
program.parseAsync(process.argv);
|
|
@@ -47,5 +47,5 @@ export declare const handleCircuitFinalization: (cloudFunctions: Functions, fire
|
|
|
47
47
|
* @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
|
|
48
48
|
* handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
|
|
49
49
|
*/
|
|
50
|
-
declare const finalize: () => Promise<void>;
|
|
50
|
+
declare const finalize: (opt: any) => Promise<void>;
|
|
51
51
|
export default finalize;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtion/devcli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-4088679",
|
|
5
5
|
"description": "All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies",
|
|
6
6
|
"repository": "git@github.com:privacy-scaling-explorations/p0tion.git",
|
|
7
7
|
"homepage": "https://github.com/privacy-scaling-explorations/p0tion",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "29b7f515737e345691adf023491fe9930fbe861a"
|
|
101
101
|
}
|
package/src/commands/finalize.ts
CHANGED
|
@@ -36,9 +36,9 @@ import {
|
|
|
36
36
|
sleep,
|
|
37
37
|
terminate
|
|
38
38
|
} from "../lib/utils.js"
|
|
39
|
-
import { bootstrapCommandExecutionAndServices, checkAuth } from "../lib/services.js"
|
|
39
|
+
import { authWithToken, bootstrapCommandExecutionAndServices, checkAuth } from "../lib/services.js"
|
|
40
40
|
import {
|
|
41
|
-
|
|
41
|
+
getFinalAttestationLocalFilePath,
|
|
42
42
|
getFinalZkeyLocalFilePath,
|
|
43
43
|
getVerificationKeyLocalFilePath,
|
|
44
44
|
getVerifierContractLocalFilePath,
|
|
@@ -112,7 +112,7 @@ export const handleVerifierSmartContract = async (
|
|
|
112
112
|
? `${dirname(
|
|
113
113
|
fileURLToPath(import.meta.url)
|
|
114
114
|
)}/../../../../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`
|
|
115
|
-
: `${dirname(fileURLToPath(import.meta.url))}
|
|
115
|
+
: `${dirname(fileURLToPath(import.meta.url))}/../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`
|
|
116
116
|
|
|
117
117
|
// Export the Solidity verifier smart contract.
|
|
118
118
|
const verifierCode = await exportVerifierContract(finalZkeyLocalFilePath, verifierPath)
|
|
@@ -241,11 +241,12 @@ export const handleCircuitFinalization = async (
|
|
|
241
241
|
* @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
|
|
242
242
|
* handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
|
|
243
243
|
*/
|
|
244
|
-
const finalize = async () => {
|
|
244
|
+
const finalize = async (opt: any) => {
|
|
245
245
|
const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices()
|
|
246
246
|
|
|
247
247
|
// Check for authentication.
|
|
248
|
-
const
|
|
248
|
+
const auth = opt.auth
|
|
249
|
+
const { user, providerUserId, token: coordinatorAccessToken } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp)
|
|
249
250
|
|
|
250
251
|
// Preserve command execution only for coordinators.
|
|
251
252
|
if (!(await isCoordinator(user))) showError(COMMAND_ERRORS.COMMAND_NOT_COORDINATOR, true)
|
|
@@ -344,7 +345,7 @@ const finalize = async () => {
|
|
|
344
345
|
|
|
345
346
|
// Write public attestation locally.
|
|
346
347
|
writeFile(
|
|
347
|
-
|
|
348
|
+
getFinalAttestationLocalFilePath(
|
|
348
349
|
`${prefix}_${finalContributionIndex}_${commonTerms.foldersAndPathsTerms.attestation}.log`
|
|
349
350
|
),
|
|
350
351
|
Buffer.from(publicAttestation)
|
package/src/index.ts
CHANGED
|
@@ -62,6 +62,7 @@ ceremony
|
|
|
62
62
|
.description(
|
|
63
63
|
"finalize a Phase2 Trusted Setup ceremony by applying a beacon, exporting verification key and verifier contract"
|
|
64
64
|
)
|
|
65
|
+
.option("-a, --auth <string>", "the Github OAuth 2.0 token", "")
|
|
65
66
|
.action(finalize)
|
|
66
67
|
|
|
67
68
|
program.parseAsync(process.argv)
|