@devtion/devcli 0.0.0-101d43f → 0.0.0-36caea1
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 +7 -5
- package/dist/types/commands/contribute.d.ts +1 -1
- package/dist/types/commands/finalize.d.ts +1 -1
- package/dist/types/commands/observe.d.ts +1 -1
- package/dist/types/commands/setup.d.ts +1 -1
- package/dist/types/lib/prompts.d.ts +1 -1
- package/dist/types/lib/utils.d.ts +1 -1
- package/package.json +3 -3
- package/src/commands/contribute.ts +6 -5
- package/src/commands/finalize.ts +1 -1
- package/src/commands/listCeremonies.ts +1 -1
- package/src/commands/observe.ts +1 -1
- package/src/commands/setup.ts +1 -3
- package/src/commands/validate.ts +1 -1
- package/src/index.ts +1 -0
- package/src/lib/localConfigs.ts +1 -1
- package/src/lib/prompts.ts +1 -1
- package/src/lib/services.ts +1 -1
- package/src/lib/utils.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @module @
|
|
4
|
+
* @module @devtion/devcli
|
|
5
5
|
* @version 1.0.6
|
|
6
6
|
* @file All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies
|
|
7
7
|
* @copyright Ethereum Foundation 2022
|
|
@@ -17,7 +17,7 @@ import boxen from 'boxen';
|
|
|
17
17
|
import { pipeline } from 'node:stream';
|
|
18
18
|
import { promisify } from 'node:util';
|
|
19
19
|
import fetch$1 from 'node-fetch';
|
|
20
|
-
import { commonTerms, formatZkeyIndex, getZkeyStorageFilePath, finalContributionIndex, createCustomLoggerForFile, getBucketName, progressToNextContributionStep, permanentlyStoreCurrentContributionTimeAndHash, convertToDoubleDigits, multiPartUpload, verifyContribution, generateGetObjectPreSignedUrl, convertBytesOrKbToGb, numExpIterations, getDocumentById, getParticipantsCollectionPath, fromQueryToFirebaseDocumentInfo, getAllCollectionDocs, extractPrefix, autoGenerateEntropy, vmConfigurationTypes, initializeFirebaseCoreServices, signInToFirebaseWithCredentials, getCurrentFirebaseAuthUser, isCoordinator, parseCeremonyFile, blake512FromPath, checkIfObjectExist, setupCeremony, genesisZkeyIndex, getR1csStorageFilePath, getWasmStorageFilePath, getPotStorageFilePath, extractPoTFromFilename, potFileDownloadMainUrl, createS3Bucket, potFilenameTemplate, getR1CSInfo, getOpenedCeremonies, getCeremonyCircuits, checkParticipantForCeremony, getCurrentActiveParticipantTimeout, getCircuitBySequencePosition, getCircuitContributionsFromContributor, progressToNextCircuitForContribution, resumeContributionAfterTimeoutExpiration, generateValidContributionsAttestation, getContributionsValidityForContributor, getClosedCeremonies, checkAndPrepareCoordinatorForFinalization, computeSHA256ToHex, finalizeCeremony, getVerificationKeyStorageFilePath, verificationKeyAcronym, getVerifierContractStorageFilePath, verifierSmartContractAcronym, finalizeCircuit, exportVkey, exportVerifierContract } from '@
|
|
20
|
+
import { commonTerms, formatZkeyIndex, getZkeyStorageFilePath, finalContributionIndex, createCustomLoggerForFile, getBucketName, progressToNextContributionStep, permanentlyStoreCurrentContributionTimeAndHash, convertToDoubleDigits, multiPartUpload, verifyContribution, generateGetObjectPreSignedUrl, convertBytesOrKbToGb, numExpIterations, getDocumentById, getParticipantsCollectionPath, fromQueryToFirebaseDocumentInfo, getAllCollectionDocs, extractPrefix, autoGenerateEntropy, vmConfigurationTypes, initializeFirebaseCoreServices, signInToFirebaseWithCredentials, getCurrentFirebaseAuthUser, isCoordinator, parseCeremonyFile, blake512FromPath, checkIfObjectExist, setupCeremony, genesisZkeyIndex, getR1csStorageFilePath, getWasmStorageFilePath, getPotStorageFilePath, extractPoTFromFilename, potFileDownloadMainUrl, createS3Bucket, potFilenameTemplate, getR1CSInfo, getOpenedCeremonies, getCeremonyCircuits, checkParticipantForCeremony, getCurrentActiveParticipantTimeout, getCircuitBySequencePosition, getCircuitContributionsFromContributor, progressToNextCircuitForContribution, resumeContributionAfterTimeoutExpiration, generateValidContributionsAttestation, getContributionsValidityForContributor, getClosedCeremonies, checkAndPrepareCoordinatorForFinalization, computeSHA256ToHex, finalizeCeremony, getVerificationKeyStorageFilePath, verificationKeyAcronym, getVerifierContractStorageFilePath, verifierSmartContractAcronym, finalizeCircuit, exportVkey, exportVerifierContract } from '@devtion/actions';
|
|
21
21
|
import fetch from '@adobe/node-fetch-retry';
|
|
22
22
|
import { request } from '@octokit/request';
|
|
23
23
|
import { SingleBar, Presets } from 'cli-progress';
|
|
@@ -807,7 +807,7 @@ const handleStartOrResumeContribution = async (cloudFunctions, firestoreDatabase
|
|
|
807
807
|
console.log(`${theme.symbols.success} Contribution ${theme.text.bold(`#${nextZkeyIndex}`)} already computed`);
|
|
808
808
|
// Contribution step = UPLOADING.
|
|
809
809
|
if (isFinalizing || participantData.contributionStep === "UPLOADING" /* ParticipantContributionStep.UPLOADING */) {
|
|
810
|
-
spinner.text = `Uploading ${isFinalizing ? "final" : "your"} contribution ${!isFinalizing ? theme.text.bold(`#${nextZkeyIndex}`) : ""} to storage.\n${theme.symbols.warning} This step may take a while based on circuit size and your
|
|
810
|
+
spinner.text = `Uploading ${isFinalizing ? "final" : "your"} contribution ${!isFinalizing ? theme.text.bold(`#${nextZkeyIndex}`) : ""} to storage.\n${theme.symbols.warning} This step may take a while based on circuit size and your internet speed. Everything's fine, just be patient.`;
|
|
811
811
|
spinner.start();
|
|
812
812
|
if (!isFinalizing)
|
|
813
813
|
await multiPartUpload(cloudFunctions, bucketName, nextZkeyStorageFilePath, nextZkeyLocalFilePath, Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB), ceremony.id, participantData.tempContributionData);
|
|
@@ -2641,11 +2641,12 @@ const listenToParticipantDocumentChanges = async (firestoreDatabase, cloudFuncti
|
|
|
2641
2641
|
*/
|
|
2642
2642
|
const contribute = async (opt) => {
|
|
2643
2643
|
const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices();
|
|
2644
|
-
// Check for authentication.
|
|
2645
|
-
const { user, providerUserId, token } = await checkAuth(firebaseApp);
|
|
2646
2644
|
// Get options.
|
|
2647
2645
|
const ceremonyOpt = opt.ceremony;
|
|
2648
2646
|
const entropyOpt = opt.entropy;
|
|
2647
|
+
const auth = opt.auth;
|
|
2648
|
+
// Check for authentication.
|
|
2649
|
+
const { user, providerUserId, token } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp);
|
|
2649
2650
|
// Prepare data.
|
|
2650
2651
|
let selectedCeremony;
|
|
2651
2652
|
// Retrieve the opened ceremonies.
|
|
@@ -3155,6 +3156,7 @@ program
|
|
|
3155
3156
|
.description("compute contributions for a Phase2 Trusted Setup ceremony circuits")
|
|
3156
3157
|
.option("-c, --ceremony <string>", "the prefix of the ceremony you want to contribute for", "")
|
|
3157
3158
|
.option("-e, --entropy <string>", "the entropy (aka toxic waste) of your contribution", "")
|
|
3159
|
+
.option("-a, --auth <string>", "the Github OAuth 2.0 token", "")
|
|
3158
3160
|
.action(contribute);
|
|
3159
3161
|
program
|
|
3160
3162
|
.command("clean")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Contribution, ContributionValidity, FirebaseDocumentInfo } from "@
|
|
2
|
+
import { Contribution, ContributionValidity, FirebaseDocumentInfo } from "@devtion/actions";
|
|
3
3
|
import { DocumentSnapshot, DocumentData, Firestore } from "firebase/firestore";
|
|
4
4
|
import { Functions } from "firebase/functions";
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Functions } from "firebase/functions";
|
|
3
|
-
import { CeremonyTimeoutType, CircomCompilerData, CircuitInputData, CeremonyInputData, CircuitDocument } from "@
|
|
3
|
+
import { CeremonyTimeoutType, CircomCompilerData, CircuitInputData, CeremonyInputData, CircuitDocument } from "@devtion/actions";
|
|
4
4
|
/**
|
|
5
5
|
* Handle whatever is needed to obtain the input data for a circuit that the coordinator would like to add to the ceremony.
|
|
6
6
|
* @param choosenCircuitFilename <string> - the name of the circuit to add.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Answers } from "prompts";
|
|
2
2
|
import { Firestore } from "firebase/firestore";
|
|
3
|
-
import { CeremonyInputData, FirebaseDocumentInfo, CircomCompilerData, CircuitInputData, CeremonyTimeoutType, DiskTypeForVM } from "@
|
|
3
|
+
import { CeremonyInputData, FirebaseDocumentInfo, CircomCompilerData, CircuitInputData, CeremonyTimeoutType, DiskTypeForVM } from "@devtion/actions";
|
|
4
4
|
/**
|
|
5
5
|
* Ask a binary (yes/no or true/false) customizable question.
|
|
6
6
|
* @param question <string> - the question to be answered.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FirebaseDocumentInfo } from "@
|
|
1
|
+
import { FirebaseDocumentInfo } from "@devtion/actions";
|
|
2
2
|
import { OAuthCredential } from "firebase/auth";
|
|
3
3
|
import { DocumentData, Firestore } from "firebase/firestore";
|
|
4
4
|
import { Functions } from "firebase/functions";
|
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-36caea1",
|
|
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",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@adobe/node-fetch-retry": "^2.2.0",
|
|
67
67
|
"@aws-sdk/client-s3": "^3.329.0",
|
|
68
|
+
"@devtion/actions": "latest",
|
|
68
69
|
"@octokit/auth-oauth-app": "^5.0.5",
|
|
69
70
|
"@octokit/auth-oauth-device": "^4.0.4",
|
|
70
71
|
"@octokit/request": "^6.2.3",
|
|
71
|
-
"@p0tion/actions": "^1.0.6",
|
|
72
72
|
"blakejs": "^1.2.1",
|
|
73
73
|
"boxen": "^7.1.0",
|
|
74
74
|
"chalk": "^5.2.0",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "2390beae56f741cf791760fbc5e84775e7bc7474"
|
|
101
101
|
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
generateValidContributionsAttestation,
|
|
23
23
|
commonTerms,
|
|
24
24
|
convertToDoubleDigits
|
|
25
|
-
} from "@
|
|
25
|
+
} from "@devtion/actions"
|
|
26
26
|
import { DocumentSnapshot, DocumentData, Firestore, onSnapshot, Timestamp } from "firebase/firestore"
|
|
27
27
|
import { Functions } from "firebase/functions"
|
|
28
28
|
import open from "open"
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
estimateParticipantFreeGlobalDiskSpace
|
|
41
41
|
} from "../lib/utils.js"
|
|
42
42
|
import { COMMAND_ERRORS, showError } from "../lib/errors.js"
|
|
43
|
-
import { bootstrapCommandExecutionAndServices, checkAuth } from "../lib/services.js"
|
|
43
|
+
import { authWithToken, bootstrapCommandExecutionAndServices, checkAuth } from "../lib/services.js"
|
|
44
44
|
import { getAttestationLocalFilePath, localPaths } from "../lib/localConfigs.js"
|
|
45
45
|
import theme from "../lib/theme.js"
|
|
46
46
|
import { checkAndMakeNewDirectoryIfNonexistent, writeFile } from "../lib/files.js"
|
|
@@ -891,12 +891,13 @@ export const listenToParticipantDocumentChanges = async (
|
|
|
891
891
|
const contribute = async (opt: any) => {
|
|
892
892
|
const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices()
|
|
893
893
|
|
|
894
|
-
// Check for authentication.
|
|
895
|
-
const { user, providerUserId, token } = await checkAuth(firebaseApp)
|
|
896
|
-
|
|
897
894
|
// Get options.
|
|
898
895
|
const ceremonyOpt = opt.ceremony
|
|
899
896
|
const entropyOpt = opt.entropy
|
|
897
|
+
const auth = opt.auth
|
|
898
|
+
|
|
899
|
+
// Check for authentication.
|
|
900
|
+
const { user, providerUserId, token } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp)
|
|
900
901
|
|
|
901
902
|
// Prepare data.
|
|
902
903
|
let selectedCeremony: FirebaseDocumentInfo
|
package/src/commands/finalize.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
exportVerifierContract,
|
|
23
23
|
FirebaseDocumentInfo,
|
|
24
24
|
exportVkey
|
|
25
|
-
} from "@
|
|
25
|
+
} from "@devtion/actions"
|
|
26
26
|
import { Functions } from "firebase/functions"
|
|
27
27
|
import { Firestore } from "firebase/firestore"
|
|
28
28
|
import { dirname } from "path"
|
package/src/commands/observe.ts
CHANGED
package/src/commands/setup.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { pipeline } from "node:stream"
|
|
|
7
7
|
import { promisify } from "node:util"
|
|
8
8
|
import fetch from "node-fetch"
|
|
9
9
|
import { Functions } from "firebase/functions"
|
|
10
|
-
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3"
|
|
11
10
|
import {
|
|
12
11
|
CeremonyTimeoutType,
|
|
13
12
|
CircomCompilerData,
|
|
@@ -37,7 +36,7 @@ import {
|
|
|
37
36
|
setupCeremony,
|
|
38
37
|
parseCeremonyFile,
|
|
39
38
|
CircuitContributionVerificationMechanism
|
|
40
|
-
} from "@
|
|
39
|
+
} from "@devtion/actions"
|
|
41
40
|
import { customSpinner, simpleLoader, sleep, terminate } from "../lib/utils.js"
|
|
42
41
|
import {
|
|
43
42
|
promptCeremonyInputData,
|
|
@@ -63,7 +62,6 @@ import {
|
|
|
63
62
|
getFileStats,
|
|
64
63
|
checkAndMakeNewDirectoryIfNonexistent
|
|
65
64
|
} from "../lib/files.js"
|
|
66
|
-
import { Readable } from "stream"
|
|
67
65
|
|
|
68
66
|
/**
|
|
69
67
|
* Handle whatever is needed to obtain the input data for a circuit that the coordinator would like to add to the ceremony.
|
package/src/commands/validate.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ program
|
|
|
21
21
|
.description("compute contributions for a Phase2 Trusted Setup ceremony circuits")
|
|
22
22
|
.option("-c, --ceremony <string>", "the prefix of the ceremony you want to contribute for", "")
|
|
23
23
|
.option("-e, --entropy <string>", "the entropy (aka toxic waste) of your contribution", "")
|
|
24
|
+
.option("-a, --auth <string>", "the Github OAuth 2.0 token", "")
|
|
24
25
|
.action(contribute)
|
|
25
26
|
program
|
|
26
27
|
.command("clean")
|
package/src/lib/localConfigs.ts
CHANGED
package/src/lib/prompts.ts
CHANGED
package/src/lib/services.ts
CHANGED
package/src/lib/utils.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
permanentlyStoreCurrentContributionTimeAndHash,
|
|
20
20
|
progressToNextContributionStep,
|
|
21
21
|
verifyContribution
|
|
22
|
-
} from "@
|
|
22
|
+
} from "@devtion/actions"
|
|
23
23
|
import { Presets, SingleBar } from "cli-progress"
|
|
24
24
|
import dotenv from "dotenv"
|
|
25
25
|
import { GithubAuthProvider, OAuthCredential } from "firebase/auth"
|
|
@@ -696,7 +696,7 @@ export const handleStartOrResumeContribution = async (
|
|
|
696
696
|
!isFinalizing ? theme.text.bold(`#${nextZkeyIndex}`) : ""
|
|
697
697
|
} to storage.\n${
|
|
698
698
|
theme.symbols.warning
|
|
699
|
-
} This step may take a while based on circuit size and your
|
|
699
|
+
} This step may take a while based on circuit size and your internet speed. Everything's fine, just be patient.`
|
|
700
700
|
spinner.start()
|
|
701
701
|
|
|
702
702
|
if (!isFinalizing)
|