@devtion/devcli 0.0.0-56491a8 → 0.0.0-56ecf35
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/README.md +1 -1
- package/dist/.env +3 -3
- package/dist/index.js +120 -69
- package/dist/types/commands/finalize.d.ts +3 -2
- package/dist/types/commands/setup.d.ts +1 -1
- package/dist/types/lib/prompts.d.ts +5 -5
- package/dist/types/lib/utils.d.ts +2 -1
- package/package.json +2 -2
- package/src/commands/auth.ts +18 -8
- package/src/commands/contribute.ts +11 -7
- package/src/commands/finalize.ts +21 -12
- package/src/commands/index.ts +1 -1
- package/src/commands/listCeremonies.ts +1 -2
- package/src/commands/observe.ts +2 -2
- package/src/commands/setup.ts +59 -27
- package/src/commands/validate.ts +1 -2
- package/src/index.ts +17 -8
- package/src/lib/errors.ts +1 -1
- package/src/lib/prompts.ts +19 -19
- package/src/lib/services.ts +0 -2
- package/src/lib/utils.ts +41 -8
package/src/lib/utils.ts
CHANGED
|
@@ -311,8 +311,22 @@ 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}
|
|
315
|
-
|
|
314
|
+
? `https://twitter.com/intent/tweet?text=I%20have%20finalized%20the%20${ceremonyName}${
|
|
315
|
+
ceremonyName.toLowerCase().includes("trusted") ||
|
|
316
|
+
ceremonyName.toLowerCase().includes("setup") ||
|
|
317
|
+
ceremonyName.toLowerCase().includes("phase2") ||
|
|
318
|
+
ceremonyName.toLowerCase().includes("ceremony")
|
|
319
|
+
? "!"
|
|
320
|
+
: "%20Phase%202%20Trusted%20Setup%20ceremony!"
|
|
321
|
+
}%20You%20can%20view%20my%20final%20attestation%20here:%20${gistUrl}%20#Ethereum%20#ZKP%20#PSE`
|
|
322
|
+
: `https://twitter.com/intent/tweet?text=I%20contributed%20to%20the%20${ceremonyName}${
|
|
323
|
+
ceremonyName.toLowerCase().includes("trusted") ||
|
|
324
|
+
ceremonyName.toLowerCase().includes("setup") ||
|
|
325
|
+
ceremonyName.toLowerCase().includes("phase2") ||
|
|
326
|
+
ceremonyName.toLowerCase().includes("ceremony")
|
|
327
|
+
? "!"
|
|
328
|
+
: "%20Phase%202%20Trusted%20Setup%20ceremony!"
|
|
329
|
+
}%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
330
|
|
|
317
331
|
/**
|
|
318
332
|
* Return a custom progress bar.
|
|
@@ -521,6 +535,7 @@ export const getLatestUpdatesFromParticipant = async (
|
|
|
521
535
|
* @param entropyOrBeaconHash <string> - the entropy or beacon hash (only when finalizing) for the contribution.
|
|
522
536
|
* @param contributorOrCoordinatorIdentifier <string> - the identifier of the contributor or coordinator (only when finalizing).
|
|
523
537
|
* @param isFinalizing <boolean> - flag to discriminate between ceremony finalization (true) and contribution (false).
|
|
538
|
+
* @param circuitsLength <number> - the total number of circuits in the ceremony.
|
|
524
539
|
*/
|
|
525
540
|
export const handleStartOrResumeContribution = async (
|
|
526
541
|
cloudFunctions: Functions,
|
|
@@ -530,7 +545,8 @@ export const handleStartOrResumeContribution = async (
|
|
|
530
545
|
participant: FirebaseDocumentInfo,
|
|
531
546
|
entropyOrBeaconHash: any,
|
|
532
547
|
contributorOrCoordinatorIdentifier: string,
|
|
533
|
-
isFinalizing: boolean
|
|
548
|
+
isFinalizing: boolean,
|
|
549
|
+
circuitsLength: number
|
|
534
550
|
): Promise<void> => {
|
|
535
551
|
// Extract data.
|
|
536
552
|
const { prefix: ceremonyPrefix } = ceremony.data
|
|
@@ -538,7 +554,9 @@ export const handleStartOrResumeContribution = async (
|
|
|
538
554
|
const { completedContributions } = waitingQueue // = current progress.
|
|
539
555
|
|
|
540
556
|
console.log(
|
|
541
|
-
`${theme.text.bold(
|
|
557
|
+
`${theme.text.bold(
|
|
558
|
+
`\n- Circuit # ${theme.colors.magenta(`${sequencePosition}/${circuitsLength}`)}`
|
|
559
|
+
)} (Contribution Steps)`
|
|
542
560
|
)
|
|
543
561
|
|
|
544
562
|
// Get most up-to-date data from the participant document.
|
|
@@ -607,6 +625,8 @@ export const handleStartOrResumeContribution = async (
|
|
|
607
625
|
`${theme.symbols.success} Contribution ${theme.text.bold(`#${lastZkeyIndex}`)} correctly downloaded`
|
|
608
626
|
)
|
|
609
627
|
|
|
628
|
+
await sleep(3000)
|
|
629
|
+
|
|
610
630
|
// Advance to next contribution step (COMPUTING) if not finalizing.
|
|
611
631
|
if (!isFinalizing) {
|
|
612
632
|
spinner.text = `Preparing for contribution computation...`
|
|
@@ -650,6 +670,8 @@ export const handleStartOrResumeContribution = async (
|
|
|
650
670
|
// Format contribution hash.
|
|
651
671
|
const contributionHash = matchContributionHash?.at(0)?.replace("\n\t\t", "")!
|
|
652
672
|
|
|
673
|
+
await sleep(500)
|
|
674
|
+
|
|
653
675
|
// Make request to cloud functions to permanently store the information.
|
|
654
676
|
await permanentlyStoreCurrentContributionTimeAndHash(
|
|
655
677
|
cloudFunctions,
|
|
@@ -675,6 +697,9 @@ export const handleStartOrResumeContribution = async (
|
|
|
675
697
|
)}`
|
|
676
698
|
)
|
|
677
699
|
|
|
700
|
+
// ensure the previous step is completed
|
|
701
|
+
await sleep(5000)
|
|
702
|
+
|
|
678
703
|
// Advance to next contribution step (UPLOADING) if not finalizing.
|
|
679
704
|
if (!isFinalizing) {
|
|
680
705
|
spinner.text = `Preparing for uploading the contribution...`
|
|
@@ -696,10 +721,12 @@ export const handleStartOrResumeContribution = async (
|
|
|
696
721
|
!isFinalizing ? theme.text.bold(`#${nextZkeyIndex}`) : ""
|
|
697
722
|
} to storage.\n${
|
|
698
723
|
theme.symbols.warning
|
|
699
|
-
} This step may take a while based on circuit size and your
|
|
724
|
+
} This step may take a while based on circuit size and your internet speed. Everything's fine, just be patient.`
|
|
700
725
|
spinner.start()
|
|
701
726
|
|
|
702
|
-
|
|
727
|
+
const progressBar = customProgressBar(ProgressBarType.UPLOAD, `your contribution`)
|
|
728
|
+
|
|
729
|
+
if (!isFinalizing) {
|
|
703
730
|
await multiPartUpload(
|
|
704
731
|
cloudFunctions,
|
|
705
732
|
bucketName,
|
|
@@ -707,9 +734,12 @@ export const handleStartOrResumeContribution = async (
|
|
|
707
734
|
nextZkeyLocalFilePath,
|
|
708
735
|
Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB),
|
|
709
736
|
ceremony.id,
|
|
710
|
-
participantData.tempContributionData
|
|
737
|
+
participantData.tempContributionData,
|
|
738
|
+
progressBar
|
|
711
739
|
)
|
|
712
|
-
|
|
740
|
+
|
|
741
|
+
progressBar.stop()
|
|
742
|
+
} else
|
|
713
743
|
await multiPartUpload(
|
|
714
744
|
cloudFunctions,
|
|
715
745
|
bucketName,
|
|
@@ -718,6 +748,9 @@ export const handleStartOrResumeContribution = async (
|
|
|
718
748
|
Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB)
|
|
719
749
|
)
|
|
720
750
|
|
|
751
|
+
// small sleep to ensure the previous step is completed
|
|
752
|
+
await sleep(5000)
|
|
753
|
+
|
|
721
754
|
spinner.succeed(
|
|
722
755
|
`${
|
|
723
756
|
isFinalizing ? `Contribution` : `Contribution ${theme.text.bold(`#${nextZkeyIndex}`)}`
|