@devtion/devcli 0.0.0-36caea1 → 0.0.0-3c7b092

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/.env CHANGED
@@ -29,9 +29,9 @@ AUTH_GITHUB_CLIENT_ID=e9f8a5fabdfe0d95618c
29
29
  ### AWS S3 bucket used as storage for ceremony artifacts.
30
30
 
31
31
  # The chunk size to be used when executing multi-part upload or downloads.
32
- # default 50 MBs.
33
- # (e.g. a 200 MB file setting a stream chunk size of 50 MB is going to be splitted and uploaded/downloaded in 4 chunks).
34
- CONFIG_STREAM_CHUNK_SIZE_IN_MB=50
32
+ # default 25 MBs.
33
+ # (e.g. a 200 MB file setting a stream chunk size of 25 MB is going to be splitted and uploaded/downloaded in 4 chunks).
34
+ CONFIG_STREAM_CHUNK_SIZE_IN_MB=25
35
35
  # The postfix string for each ceremony bucket.
36
36
  # default -ph2-ceremony
37
37
  CONFIG_CEREMONY_BUCKET_POSTFIX=-p0tion-development-environment
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @module @devtion/devcli
5
- * @version 1.0.6
5
+ * @version 1.0.8
6
6
  * @file All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies
7
7
  * @copyright Ethereum Foundation 2022
8
8
  * @license MIT
@@ -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).
@@ -579,8 +585,8 @@ const publishGist = async (token, content, ceremonyTitle, ceremonyPrefix) => {
579
585
  * @returns <string> - the ready to share tweet url.
580
586
  */
581
587
  const generateCustomUrlToTweetAboutParticipation = (ceremonyName, gistUrl, isFinalizing) => isFinalizing
582
- ? `https://twitter.com/intent/tweet?text=I%20have%20finalized%20the%20${ceremonyName}%20Phase%202%20Trusted%20Setup%20ceremony!%20You%20can%20view%20my%20final%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP%20#PSE`
583
- : `https://twitter.com/intent/tweet?text=I%20contributed%20to%20the%20${ceremonyName}%20Phase%202%20Trusted%20Setup%20ceremony!%20You%20can%20contribute%20here:%20https://github.com/privacy-scaling-explorations/p0tion%20You%20can%20view%20my%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP`;
588
+ ? `https://twitter.com/intent/tweet?text=I%20have%20finalized%20the%20${ceremonyName}${ceremonyName.toLowerCase().includes("trusted") || ceremonyName.toLowerCase().includes("setup") || ceremonyName.toLowerCase().includes("phase2") || ceremonyName.toLowerCase().includes("ceremony") ? "!" : "%20Phase%202%20Trusted%20Setup%20ceremony!"}%20You%20can%20view%20my%20final%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP%20#PSE`
589
+ : `https://twitter.com/intent/tweet?text=I%20contributed%20to%20the%20${ceremonyName}${ceremonyName.toLowerCase().includes("trusted") || ceremonyName.toLowerCase().includes("setup") || ceremonyName.toLowerCase().includes("phase2") || ceremonyName.toLowerCase().includes("ceremony") ? "!" : "%20Phase%202%20Trusted%20Setup%20ceremony!"}%20You%20can%20view%20the%20steps%20to%20contribute%20here:%20https://ceremony.pse.dev%20You%20can%20view%20my%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP`;
584
590
  /**
585
591
  * Return a custom progress bar.
586
592
  * @param type <ProgressBarType> - the type of the progress bar.
@@ -708,13 +714,14 @@ const getLatestUpdatesFromParticipant = async (firestoreDatabase, ceremonyId, pa
708
714
  * @param entropyOrBeaconHash <string> - the entropy or beacon hash (only when finalizing) for the contribution.
709
715
  * @param contributorOrCoordinatorIdentifier <string> - the identifier of the contributor or coordinator (only when finalizing).
710
716
  * @param isFinalizing <boolean> - flag to discriminate between ceremony finalization (true) and contribution (false).
717
+ * @param circuitsLength <number> - the total number of circuits in the ceremony.
711
718
  */
712
- const handleStartOrResumeContribution = async (cloudFunctions, firestoreDatabase, ceremony, circuit, participant, entropyOrBeaconHash, contributorOrCoordinatorIdentifier, isFinalizing) => {
719
+ const handleStartOrResumeContribution = async (cloudFunctions, firestoreDatabase, ceremony, circuit, participant, entropyOrBeaconHash, contributorOrCoordinatorIdentifier, isFinalizing, circuitsLength) => {
713
720
  // Extract data.
714
721
  const { prefix: ceremonyPrefix } = ceremony.data;
715
722
  const { waitingQueue, avgTimings, prefix: circuitPrefix, sequencePosition } = circuit.data;
716
723
  const { completedContributions } = waitingQueue; // = current progress.
717
- console.log(`${theme.text.bold(`\n- Circuit # ${theme.colors.magenta(`${sequencePosition}`)}`)} (Contribution Steps)`);
724
+ console.log(`${theme.text.bold(`\n- Circuit # ${theme.colors.magenta(`${sequencePosition}/${circuitsLength}`)}`)} (Contribution Steps)`);
718
725
  // Get most up-to-date data from the participant document.
719
726
  let participantData = await getLatestUpdatesFromParticipant(firestoreDatabase, ceremony.id, participant.id);
720
727
  const spinner = customSpinner(`${participantData.contributionStep === "DOWNLOADING" /* ParticipantContributionStep.DOWNLOADING */
@@ -2553,8 +2560,8 @@ const listenToParticipantDocumentChanges = async (firestoreDatabase, cloudFuncti
2553
2560
  // Communicate resume / start of the contribution to participant.
2554
2561
  await simpleLoader(`${changedContributionStep === "DOWNLOADING" /* ParticipantContributionStep.DOWNLOADING */ ? `Starting` : `Resuming`} your contribution...`, `clock`, 3000);
2555
2562
  // Start / Resume the contribution for the participant.
2556
- await handleStartOrResumeContribution(cloudFunctions, firestoreDatabase, ceremony, circuit, participant, entropy, providerUserId, false // not finalizing.
2557
- );
2563
+ await handleStartOrResumeContribution(cloudFunctions, firestoreDatabase, ceremony, circuit, participant, entropy, providerUserId, false, // not finalizing.
2564
+ circuits.length);
2558
2565
  }
2559
2566
  // Scenario (3.A).
2560
2567
  else if (isWaitingForContribution)
@@ -2682,7 +2689,7 @@ const contribute = async (opt) => {
2682
2689
  const userDoc = await getDocumentById(firestoreDatabase, commonTerms.collections.users.name, user.uid);
2683
2690
  const userData = userDoc.data();
2684
2691
  if (!userData) {
2685
- spinner.fail(`Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. Please contact the coordinator if you believe this to be an error.`);
2692
+ spinner.fail(`Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`);
2686
2693
  process.exit(0);
2687
2694
  }
2688
2695
  // Check the user's current participant readiness for contribution status (eligible, already contributed, timed out).
@@ -2902,7 +2909,7 @@ const handleVerifierSmartContract = async (cloudFunctions, bucketName, finalZkey
2902
2909
  const packagePath = `${dirname(fileURLToPath(import.meta.url))}`;
2903
2910
  const verifierPath = packagePath.includes(`src/commands`)
2904
2911
  ? `${dirname(fileURLToPath(import.meta.url))}/../../../../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`
2905
- : `${dirname(fileURLToPath(import.meta.url))}/../../../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`;
2912
+ : `${dirname(fileURLToPath(import.meta.url))}/../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`;
2906
2913
  // Export the Solidity verifier smart contract.
2907
2914
  const verifierCode = await exportVerifierContract(finalZkeyLocalFilePath, verifierPath);
2908
2915
  spinner.text = `Writing verifier smart contract...`;
@@ -2929,10 +2936,11 @@ const handleVerifierSmartContract = async (cloudFunctions, bucketName, finalZkey
2929
2936
  * @param participant <FirebaseDocumentInfo> - the Firestore document of the participant (coordinator).
2930
2937
  * @param beacon <string> - the value used to compute the final contribution while finalizing the ceremony.
2931
2938
  * @param coordinatorIdentifier <string> - the identifier of the coordinator.
2939
+ * @param circuitsLength <number> - the number of circuits in the ceremony.
2932
2940
  */
2933
- const handleCircuitFinalization = async (cloudFunctions, firestoreDatabase, ceremony, circuit, participant, beacon, coordinatorIdentifier) => {
2941
+ const handleCircuitFinalization = async (cloudFunctions, firestoreDatabase, ceremony, circuit, participant, beacon, coordinatorIdentifier, circuitsLength) => {
2934
2942
  // Step (1).
2935
- await handleStartOrResumeContribution(cloudFunctions, firestoreDatabase, ceremony, circuit, participant, computeSHA256ToHex(beacon), coordinatorIdentifier, true);
2943
+ await handleStartOrResumeContribution(cloudFunctions, firestoreDatabase, ceremony, circuit, participant, computeSHA256ToHex(beacon), coordinatorIdentifier, true, circuitsLength);
2936
2944
  await sleep(2000); // workaound for descriptors.
2937
2945
  // Extract data.
2938
2946
  const { prefix: circuitPrefix } = circuit.data;
@@ -2967,10 +2975,11 @@ const handleCircuitFinalization = async (cloudFunctions, firestoreDatabase, cere
2967
2975
  * @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
2968
2976
  * handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
2969
2977
  */
2970
- const finalize = async () => {
2978
+ const finalize = async (opt) => {
2971
2979
  const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices();
2972
2980
  // Check for authentication.
2973
- const { user, providerUserId, token: coordinatorAccessToken } = await checkAuth(firebaseApp);
2981
+ const auth = opt.auth;
2982
+ const { user, providerUserId, token: coordinatorAccessToken } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp);
2974
2983
  // Preserve command execution only for coordinators.
2975
2984
  if (!(await isCoordinator(user)))
2976
2985
  showError(COMMAND_ERRORS.COMMAND_NOT_COORDINATOR, true);
@@ -3005,7 +3014,7 @@ const finalize = async () => {
3005
3014
  const circuits = await getCeremonyCircuits(firestoreDatabase, selectedCeremony.id);
3006
3015
  // Handle finalization for each ceremony circuit.
3007
3016
  for await (const circuit of circuits)
3008
- await handleCircuitFinalization(firebaseFunctions, firestoreDatabase, selectedCeremony, circuit, participant, beacon, providerUserId);
3017
+ await handleCircuitFinalization(firebaseFunctions, firestoreDatabase, selectedCeremony, circuit, participant, beacon, providerUserId, circuits.length);
3009
3018
  process.stdout.write(`\n`);
3010
3019
  const spinner = customSpinner(`Wrapping up the finalization of the ceremony...`, "clock");
3011
3020
  spinner.start();
@@ -3020,7 +3029,7 @@ const finalize = async () => {
3020
3029
  // Generate attestation with final contributions.
3021
3030
  const publicAttestation = await generateValidContributionsAttestation(firestoreDatabase, circuits, selectedCeremony.id, participant.id, contributions, providerUserId, ceremonyName, true);
3022
3031
  // Write public attestation locally.
3023
- writeFile(getAttestationLocalFilePath(`${prefix}_${finalContributionIndex}_${commonTerms.foldersAndPathsTerms.attestation}.log`), Buffer.from(publicAttestation));
3032
+ writeFile(getFinalAttestationLocalFilePath(`${prefix}_${finalContributionIndex}_${commonTerms.foldersAndPathsTerms.attestation}.log`), Buffer.from(publicAttestation));
3024
3033
  await sleep(3000); // workaround for file descriptor unexpected close.
3025
3034
  const gistUrl = await publishGist(coordinatorAccessToken, publicAttestation, ceremonyName, prefix);
3026
3035
  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 +3200,6 @@ ceremony
3191
3200
  ceremony
3192
3201
  .command("finalize")
3193
3202
  .description("finalize a Phase2 Trusted Setup ceremony by applying a beacon, exporting verification key and verifier contract")
3203
+ .option("-a, --auth <string>", "the Github OAuth 2.0 token", "")
3194
3204
  .action(finalize);
3195
3205
  program.parseAsync(process.argv);
@@ -36,8 +36,9 @@ export declare const handleVerifierSmartContract: (cloudFunctions: Functions, bu
36
36
  * @param participant <FirebaseDocumentInfo> - the Firestore document of the participant (coordinator).
37
37
  * @param beacon <string> - the value used to compute the final contribution while finalizing the ceremony.
38
38
  * @param coordinatorIdentifier <string> - the identifier of the coordinator.
39
+ * @param circuitsLength <number> - the number of circuits in the ceremony.
39
40
  */
40
- export declare const handleCircuitFinalization: (cloudFunctions: Functions, firestoreDatabase: Firestore, ceremony: FirebaseDocumentInfo, circuit: FirebaseDocumentInfo, participant: FirebaseDocumentInfo, beacon: string, coordinatorIdentifier: string) => Promise<void>;
41
+ export declare const handleCircuitFinalization: (cloudFunctions: Functions, firestoreDatabase: Firestore, ceremony: FirebaseDocumentInfo, circuit: FirebaseDocumentInfo, participant: FirebaseDocumentInfo, beacon: string, coordinatorIdentifier: string, circuitsLength: number) => Promise<void>;
41
42
  /**
42
43
  * Finalize command.
43
44
  * @notice The finalize command allows a coordinator to finalize a Trusted Setup Phase 2 ceremony by providing the final beacon,
@@ -47,5 +48,5 @@ export declare const handleCircuitFinalization: (cloudFunctions: Functions, fire
47
48
  * @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
48
49
  * handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
49
50
  */
50
- declare const finalize: () => Promise<void>;
51
+ declare const finalize: (opt: any) => Promise<void>;
51
52
  export default finalize;
@@ -154,5 +154,6 @@ export declare const getLatestUpdatesFromParticipant: (firestoreDatabase: Firest
154
154
  * @param entropyOrBeaconHash <string> - the entropy or beacon hash (only when finalizing) for the contribution.
155
155
  * @param contributorOrCoordinatorIdentifier <string> - the identifier of the contributor or coordinator (only when finalizing).
156
156
  * @param isFinalizing <boolean> - flag to discriminate between ceremony finalization (true) and contribution (false).
157
+ * @param circuitsLength <number> - the total number of circuits in the ceremony.
157
158
  */
158
- export declare const handleStartOrResumeContribution: (cloudFunctions: Functions, firestoreDatabase: Firestore, ceremony: FirebaseDocumentInfo, circuit: FirebaseDocumentInfo, participant: FirebaseDocumentInfo, entropyOrBeaconHash: any, contributorOrCoordinatorIdentifier: string, isFinalizing: boolean) => Promise<void>;
159
+ export declare const handleStartOrResumeContribution: (cloudFunctions: Functions, firestoreDatabase: Firestore, ceremony: FirebaseDocumentInfo, circuit: FirebaseDocumentInfo, participant: FirebaseDocumentInfo, entropyOrBeaconHash: any, contributorOrCoordinatorIdentifier: string, isFinalizing: boolean, circuitsLength: number) => Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devtion/devcli",
3
3
  "type": "module",
4
- "version": "0.0.0-36caea1",
4
+ "version": "0.0.0-3c7b092",
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": "2390beae56f741cf791760fbc5e84775e7bc7474"
100
+ "gitHead": "04a0a07eddaf6db530ae3ff3c4c61f8a12b98f91"
101
101
  }
@@ -724,7 +724,8 @@ export const listenToParticipantDocumentChanges = async (
724
724
  participant,
725
725
  entropy,
726
726
  providerUserId,
727
- false // not finalizing.
727
+ false, // not finalizing.
728
+ circuits.length
728
729
  )
729
730
  }
730
731
  // Scenario (3.A).
@@ -949,7 +950,7 @@ const contribute = async (opt: any) => {
949
950
  const userData = userDoc.data()
950
951
  if (!userData) {
951
952
  spinner.fail(
952
- `Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. Please contact the coordinator if you believe this to be an error.`
953
+ `Unfortunately we could not find a user document with your information. This likely means that you did not pass the GitHub reputation checks and therefore are not elegible to contribute to any ceremony. If you believe you pass the requirements, it might be possible that your profile is private and we were not able to fetch your real statistics, in this case please consider making your profile public for the duration of the contribution. Please contact the coordinator if you believe this to be an error.`
953
954
  )
954
955
  process.exit(0)
955
956
  }
@@ -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
- getAttestationLocalFilePath,
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))}/../../../node_modules/snarkjs/templates/verifier_groth16.sol.ejs`
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)
@@ -152,6 +152,7 @@ export const handleVerifierSmartContract = async (
152
152
  * @param participant <FirebaseDocumentInfo> - the Firestore document of the participant (coordinator).
153
153
  * @param beacon <string> - the value used to compute the final contribution while finalizing the ceremony.
154
154
  * @param coordinatorIdentifier <string> - the identifier of the coordinator.
155
+ * @param circuitsLength <number> - the number of circuits in the ceremony.
155
156
  */
156
157
  export const handleCircuitFinalization = async (
157
158
  cloudFunctions: Functions,
@@ -160,7 +161,8 @@ export const handleCircuitFinalization = async (
160
161
  circuit: FirebaseDocumentInfo,
161
162
  participant: FirebaseDocumentInfo,
162
163
  beacon: string,
163
- coordinatorIdentifier: string
164
+ coordinatorIdentifier: string,
165
+ circuitsLength: number
164
166
  ) => {
165
167
  // Step (1).
166
168
  await handleStartOrResumeContribution(
@@ -171,7 +173,8 @@ export const handleCircuitFinalization = async (
171
173
  participant,
172
174
  computeSHA256ToHex(beacon),
173
175
  coordinatorIdentifier,
174
- true
176
+ true,
177
+ circuitsLength
175
178
  )
176
179
 
177
180
  await sleep(2000) // workaound for descriptors.
@@ -241,11 +244,12 @@ export const handleCircuitFinalization = async (
241
244
  * @dev For proper execution, the command requires the coordinator to be authenticated with a GitHub account (run auth command first) in order to
242
245
  * handle sybil-resistance and connect to GitHub APIs to publish the gist containing the final public attestation.
243
246
  */
244
- const finalize = async () => {
247
+ const finalize = async (opt: any) => {
245
248
  const { firebaseApp, firebaseFunctions, firestoreDatabase } = await bootstrapCommandExecutionAndServices()
246
249
 
247
250
  // Check for authentication.
248
- const { user, providerUserId, token: coordinatorAccessToken } = await checkAuth(firebaseApp)
251
+ const auth = opt.auth
252
+ const { user, providerUserId, token: coordinatorAccessToken } = auth ? await authWithToken(firebaseApp, auth) : await checkAuth(firebaseApp)
249
253
 
250
254
  // Preserve command execution only for coordinators.
251
255
  if (!(await isCoordinator(user))) showError(COMMAND_ERRORS.COMMAND_NOT_COORDINATOR, true)
@@ -306,7 +310,8 @@ const finalize = async () => {
306
310
  circuit,
307
311
  participant,
308
312
  beacon,
309
- providerUserId
313
+ providerUserId,
314
+ circuits.length
310
315
  )
311
316
 
312
317
  process.stdout.write(`\n`)
@@ -344,7 +349,7 @@ const finalize = async () => {
344
349
 
345
350
  // Write public attestation locally.
346
351
  writeFile(
347
- getAttestationLocalFilePath(
352
+ getFinalAttestationLocalFilePath(
348
353
  `${prefix}_${finalContributionIndex}_${commonTerms.foldersAndPathsTerms.attestation}.log`
349
354
  ),
350
355
  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)
package/src/lib/utils.ts CHANGED
@@ -311,8 +311,8 @@ export const generateCustomUrlToTweetAboutParticipation = (
311
311
  isFinalizing: boolean
312
312
  ) =>
313
313
  isFinalizing
314
- ? `https://twitter.com/intent/tweet?text=I%20have%20finalized%20the%20${ceremonyName}%20Phase%202%20Trusted%20Setup%20ceremony!%20You%20can%20view%20my%20final%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP%20#PSE`
315
- : `https://twitter.com/intent/tweet?text=I%20contributed%20to%20the%20${ceremonyName}%20Phase%202%20Trusted%20Setup%20ceremony!%20You%20can%20contribute%20here:%20https://github.com/privacy-scaling-explorations/p0tion%20You%20can%20view%20my%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP`
314
+ ? `https://twitter.com/intent/tweet?text=I%20have%20finalized%20the%20${ceremonyName}${ceremonyName.toLowerCase().includes("trusted") || ceremonyName.toLowerCase().includes("setup") || ceremonyName.toLowerCase().includes("phase2") || ceremonyName.toLowerCase().includes("ceremony") ? "!" : "%20Phase%202%20Trusted%20Setup%20ceremony!"}%20You%20can%20view%20my%20final%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP%20#PSE`
315
+ : `https://twitter.com/intent/tweet?text=I%20contributed%20to%20the%20${ceremonyName}${ceremonyName.toLowerCase().includes("trusted") || ceremonyName.toLowerCase().includes("setup") || ceremonyName.toLowerCase().includes("phase2") || ceremonyName.toLowerCase().includes("ceremony") ? "!" : "%20Phase%202%20Trusted%20Setup%20ceremony!"}%20You%20can%20view%20the%20steps%20to%20contribute%20here:%20https://ceremony.pse.dev%20You%20can%20view%20my%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP`
316
316
 
317
317
  /**
318
318
  * Return a custom progress bar.
@@ -521,6 +521,7 @@ export const getLatestUpdatesFromParticipant = async (
521
521
  * @param entropyOrBeaconHash <string> - the entropy or beacon hash (only when finalizing) for the contribution.
522
522
  * @param contributorOrCoordinatorIdentifier <string> - the identifier of the contributor or coordinator (only when finalizing).
523
523
  * @param isFinalizing <boolean> - flag to discriminate between ceremony finalization (true) and contribution (false).
524
+ * @param circuitsLength <number> - the total number of circuits in the ceremony.
524
525
  */
525
526
  export const handleStartOrResumeContribution = async (
526
527
  cloudFunctions: Functions,
@@ -530,7 +531,8 @@ export const handleStartOrResumeContribution = async (
530
531
  participant: FirebaseDocumentInfo,
531
532
  entropyOrBeaconHash: any,
532
533
  contributorOrCoordinatorIdentifier: string,
533
- isFinalizing: boolean
534
+ isFinalizing: boolean,
535
+ circuitsLength: number
534
536
  ): Promise<void> => {
535
537
  // Extract data.
536
538
  const { prefix: ceremonyPrefix } = ceremony.data
@@ -538,7 +540,7 @@ export const handleStartOrResumeContribution = async (
538
540
  const { completedContributions } = waitingQueue // = current progress.
539
541
 
540
542
  console.log(
541
- `${theme.text.bold(`\n- Circuit # ${theme.colors.magenta(`${sequencePosition}`)}`)} (Contribution Steps)`
543
+ `${theme.text.bold(`\n- Circuit # ${theme.colors.magenta(`${sequencePosition}/${circuitsLength}`)}`)} (Contribution Steps)`
542
544
  )
543
545
 
544
546
  // Get most up-to-date data from the participant document.