@devtion/actions 0.0.0-8b5a17f → 0.0.0-8bb9489
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/index.mjs +32 -15
- package/dist/index.node.js +31 -14
- package/dist/types/src/helpers/storage.d.ts +5 -2
- package/dist/types/src/helpers/storage.d.ts.map +1 -1
- package/dist/types/src/helpers/utils.d.ts.map +1 -1
- package/dist/types/src/helpers/vm.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/helpers/constants.ts +1 -1
- package/src/helpers/functions.ts +1 -1
- package/src/helpers/security.ts +3 -3
- package/src/helpers/services.ts +1 -1
- package/src/helpers/storage.ts +15 -3
- package/src/helpers/utils.ts +62 -55
- package/src/helpers/vm.ts +9 -3
- package/src/index.ts +2 -2
- package/src/types/index.ts +9 -5
package/README.md
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module @
|
|
3
|
-
* @version 1.0.
|
|
2
|
+
* @module @p0tion/actions
|
|
3
|
+
* @version 1.0.9
|
|
4
4
|
* @file A set of actions and helpers for CLI commands
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -339,7 +339,7 @@ const commonTerms = {
|
|
|
339
339
|
finalizeCircuit: "finalizeCircuit",
|
|
340
340
|
finalizeCeremony: "finalizeCeremony",
|
|
341
341
|
downloadCircuitArtifacts: "downloadCircuitArtifacts",
|
|
342
|
-
transferObject: "transferObject"
|
|
342
|
+
transferObject: "transferObject"
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
345
|
|
|
@@ -690,11 +690,15 @@ const getChunksAndPreSignedUrls = async (cloudFunctions, bucketName, objectKey,
|
|
|
690
690
|
* @param cloudFunctions <Functions> - the Firebase Cloud Functions service instance.
|
|
691
691
|
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
692
692
|
* @param alreadyUploadedChunks Array<ETagWithPartNumber> - the temporary information about the already uploaded chunks.
|
|
693
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
693
694
|
* @returns <Promise<Array<ETagWithPartNumber>>> - the completed (uploaded) chunks information.
|
|
694
695
|
*/
|
|
695
|
-
const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremonyId, alreadyUploadedChunks) => {
|
|
696
|
+
const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremonyId, alreadyUploadedChunks, logger) => {
|
|
696
697
|
// Keep track of uploaded chunks.
|
|
697
698
|
const uploadedChunks = alreadyUploadedChunks || [];
|
|
699
|
+
// if we were passed a logger, start it
|
|
700
|
+
if (logger)
|
|
701
|
+
logger.start(chunksWithUrls.length, 0);
|
|
698
702
|
// Loop through remaining chunks.
|
|
699
703
|
for (let i = alreadyUploadedChunks ? alreadyUploadedChunks.length : 0; i < chunksWithUrls.length; i += 1) {
|
|
700
704
|
// Consume the pre-signed url to upload the chunk.
|
|
@@ -726,6 +730,9 @@ const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremony
|
|
|
726
730
|
// nb. this must be done only when contributing (not finalizing).
|
|
727
731
|
if (!!ceremonyId && !!cloudFunctions)
|
|
728
732
|
await temporaryStoreCurrentContributionUploadedChunkData(cloudFunctions, ceremonyId, chunk);
|
|
733
|
+
// increment the count on the logger
|
|
734
|
+
if (logger)
|
|
735
|
+
logger.increment();
|
|
729
736
|
}
|
|
730
737
|
return uploadedChunks;
|
|
731
738
|
};
|
|
@@ -746,8 +753,9 @@ const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremony
|
|
|
746
753
|
* @param configStreamChunkSize <number> - size of each chunk into which the artifact is going to be splitted (nb. will be converted in MB).
|
|
747
754
|
* @param [ceremonyId] <string> - the unique identifier of the ceremony (used as a double-edge sword - as identifier and as a check if current contributor is the coordinator finalizing the ceremony).
|
|
748
755
|
* @param [temporaryDataToResumeMultiPartUpload] <TemporaryParticipantContributionData> - the temporary information necessary to resume an already started multi-part upload.
|
|
756
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
749
757
|
*/
|
|
750
|
-
const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFilePath, configStreamChunkSize, ceremonyId, temporaryDataToResumeMultiPartUpload) => {
|
|
758
|
+
const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFilePath, configStreamChunkSize, ceremonyId, temporaryDataToResumeMultiPartUpload, logger) => {
|
|
751
759
|
// The unique identifier of the multi-part upload.
|
|
752
760
|
let multiPartUploadId = "";
|
|
753
761
|
// The list of already uploaded chunks.
|
|
@@ -771,7 +779,7 @@ const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFileP
|
|
|
771
779
|
const chunksWithUrlsZkey = await getChunksAndPreSignedUrls(cloudFunctions, bucketName, objectKey, localFilePath, multiPartUploadId, configStreamChunkSize, ceremonyId);
|
|
772
780
|
// Step (2).
|
|
773
781
|
const partNumbersAndETagsZkey = await uploadParts(chunksWithUrlsZkey, mime.lookup(localFilePath), // content-type.
|
|
774
|
-
cloudFunctions, ceremonyId, alreadyUploadedChunks);
|
|
782
|
+
cloudFunctions, ceremonyId, alreadyUploadedChunks, logger);
|
|
775
783
|
// Step (3).
|
|
776
784
|
await completeMultiPartUpload(cloudFunctions, bucketName, objectKey, multiPartUploadId, partNumbersAndETagsZkey, ceremonyId);
|
|
777
785
|
};
|
|
@@ -1057,7 +1065,8 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1057
1065
|
// read the data
|
|
1058
1066
|
const data = JSON.parse(fs.readFileSync(path).toString());
|
|
1059
1067
|
// verify that the data is correct
|
|
1060
|
-
if (data[
|
|
1068
|
+
if (data["timeoutMechanismType"] !== "DYNAMIC" /* CeremonyTimeoutType.DYNAMIC */ &&
|
|
1069
|
+
data["timeoutMechanismType"] !== "FIXED" /* CeremonyTimeoutType.FIXED */)
|
|
1061
1070
|
throw new Error("Invalid timeout type. Please choose between DYNAMIC and FIXED.");
|
|
1062
1071
|
// validate that we have at least 1 circuit input data
|
|
1063
1072
|
if (!data.circuits || data.circuits.length === 0)
|
|
@@ -1127,7 +1136,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1127
1136
|
const wasmCompleteFilename = `${circuitData.name}.wasm`;
|
|
1128
1137
|
const smallestPowersOfTauCompleteFilenameForCircuit = `${potFilenameTemplate}${doubleDigitsPowers}.ptau`;
|
|
1129
1138
|
const firstZkeyCompleteFilename = `${circuitPrefix}_${genesisZkeyIndex}.zkey`;
|
|
1130
|
-
// storage paths
|
|
1139
|
+
// storage paths
|
|
1131
1140
|
const r1csStorageFilePath = getR1csStorageFilePath(circuitPrefix, r1csCompleteFilename);
|
|
1132
1141
|
const wasmStorageFilePath = getWasmStorageFilePath(circuitPrefix, wasmCompleteFilename);
|
|
1133
1142
|
const potStorageFilePath = getPotStorageFilePath(smallestPowersOfTauCompleteFilenameForCircuit);
|
|
@@ -1143,7 +1152,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1143
1152
|
initialZkeyStoragePath: zkeyStorageFilePath,
|
|
1144
1153
|
r1csBlake2bHash: r1csBlake2bHash
|
|
1145
1154
|
};
|
|
1146
|
-
// validate that the compiler hash is a valid hash
|
|
1155
|
+
// validate that the compiler hash is a valid hash
|
|
1147
1156
|
const compiler = circuitData.compiler;
|
|
1148
1157
|
const compilerHashMatch = compiler.commitHash.match(commitHashPattern);
|
|
1149
1158
|
if (!compilerHashMatch || compilerHashMatch.length === 0 || compilerHashMatch.length > 1)
|
|
@@ -1178,7 +1187,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1178
1187
|
contributionComputation: 0,
|
|
1179
1188
|
fullContribution: 0,
|
|
1180
1189
|
verifyCloudFunction: 0
|
|
1181
|
-
}
|
|
1190
|
+
}
|
|
1182
1191
|
};
|
|
1183
1192
|
}
|
|
1184
1193
|
if (data.timeoutMechanismType === "FIXED" /* CeremonyTimeoutType.FIXED */) {
|
|
@@ -1201,7 +1210,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1201
1210
|
contributionComputation: 0,
|
|
1202
1211
|
fullContribution: 0,
|
|
1203
1212
|
verifyCloudFunction: 0
|
|
1204
|
-
}
|
|
1213
|
+
}
|
|
1205
1214
|
};
|
|
1206
1215
|
}
|
|
1207
1216
|
circuits.push(circuit);
|
|
@@ -1362,7 +1371,9 @@ const getContributionsValidityForContributor = async (firestoreDatabase, circuit
|
|
|
1362
1371
|
* @param isFinalizing <boolean> - true when the coordinator is finalizing the ceremony, otherwise false.
|
|
1363
1372
|
* @returns <string> - the public attestation preamble.
|
|
1364
1373
|
*/
|
|
1365
|
-
const getPublicAttestationPreambleForContributor = (contributorIdentifier, ceremonyName, isFinalizing) => `Hey, I'm ${contributorIdentifier} and I have ${isFinalizing ? "finalized" : "contributed to"} the ${ceremonyName}
|
|
1374
|
+
const getPublicAttestationPreambleForContributor = (contributorIdentifier, ceremonyName, isFinalizing) => `Hey, I'm ${contributorIdentifier} and I have ${isFinalizing ? "finalized" : "contributed to"} the ${ceremonyName}${ceremonyName.toLowerCase().includes("trusted setup") || ceremonyName.toLowerCase().includes("ceremony")
|
|
1375
|
+
? "."
|
|
1376
|
+
: " MPC Phase2 Trusted Setup ceremony."}\nThe following are my contribution signatures:`;
|
|
1366
1377
|
/**
|
|
1367
1378
|
* Check and prepare public attestation for the contributor made only of its valid contributions.
|
|
1368
1379
|
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
@@ -1818,7 +1829,7 @@ const getFirestoreDatabase = (app) => getFirestore(app);
|
|
|
1818
1829
|
* @param app <FirebaseApp> - the Firebase application.
|
|
1819
1830
|
* @returns <Functions> - the Cloud Functions associated to the application.
|
|
1820
1831
|
*/
|
|
1821
|
-
const getFirebaseFunctions = (app) => getFunctions(app,
|
|
1832
|
+
const getFirebaseFunctions = (app) => getFunctions(app, "europe-west1");
|
|
1822
1833
|
/**
|
|
1823
1834
|
* Retrieve the configuration variables for the AWS services (S3, EC2).
|
|
1824
1835
|
* @returns <AWSVariables> - the values of the AWS services configuration variables.
|
|
@@ -2321,8 +2332,13 @@ const vmDependenciesAndCacheArtifactsCommand = (zKeyPath, potPath, snsTopic, reg
|
|
|
2321
2332
|
// eslint-disable-next-line no-template-curly-in-string
|
|
2322
2333
|
"touch ${MARKER_FILE}",
|
|
2323
2334
|
"sudo yum update -y",
|
|
2324
|
-
"curl -
|
|
2325
|
-
"
|
|
2335
|
+
"curl -O https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz",
|
|
2336
|
+
"tar -xf node-v16.13.0-linux-x64.tar.xz",
|
|
2337
|
+
"mv node-v16.13.0-linux-x64 nodejs",
|
|
2338
|
+
"sudo mv nodejs /opt/",
|
|
2339
|
+
"echo 'export NODEJS_HOME=/opt/nodejs' >> /etc/profile",
|
|
2340
|
+
"echo 'export PATH=$NODEJS_HOME/bin:$PATH' >> /etc/profile",
|
|
2341
|
+
"source /etc/profile",
|
|
2326
2342
|
"npm install -g snarkjs",
|
|
2327
2343
|
`aws s3 cp s3://${zKeyPath} /var/tmp/genesisZkey.zkey`,
|
|
2328
2344
|
`aws s3 cp s3://${potPath} /var/tmp/pot.ptau`,
|
|
@@ -2341,6 +2357,7 @@ const vmDependenciesAndCacheArtifactsCommand = (zKeyPath, potPath, snsTopic, reg
|
|
|
2341
2357
|
* @returns Array<string> - the list of commands for contribution verification.
|
|
2342
2358
|
*/
|
|
2343
2359
|
const vmContributionVerificationCommand = (bucketName, lastZkeyStoragePath, verificationTranscriptStoragePathAndFilename) => [
|
|
2360
|
+
`source /etc/profile`,
|
|
2344
2361
|
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey > /var/tmp/log.txt`,
|
|
2345
2362
|
`snarkjs zkvi /var/tmp/genesisZkey.zkey /var/tmp/pot.ptau /var/tmp/lastZKey.zkey > /var/tmp/verification_transcript.log`,
|
|
2346
2363
|
`aws s3 cp /var/tmp/verification_transcript.log s3://${bucketName}/${verificationTranscriptStoragePathAndFilename} &>/dev/null`,
|
package/dist/index.node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @devtion/actions
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.9
|
|
4
4
|
* @file A set of actions and helpers for CLI commands
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -341,7 +341,7 @@ const commonTerms = {
|
|
|
341
341
|
finalizeCircuit: "finalizeCircuit",
|
|
342
342
|
finalizeCeremony: "finalizeCeremony",
|
|
343
343
|
downloadCircuitArtifacts: "downloadCircuitArtifacts",
|
|
344
|
-
transferObject: "transferObject"
|
|
344
|
+
transferObject: "transferObject"
|
|
345
345
|
}
|
|
346
346
|
};
|
|
347
347
|
|
|
@@ -692,11 +692,15 @@ const getChunksAndPreSignedUrls = async (cloudFunctions, bucketName, objectKey,
|
|
|
692
692
|
* @param cloudFunctions <Functions> - the Firebase Cloud Functions service instance.
|
|
693
693
|
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
694
694
|
* @param alreadyUploadedChunks Array<ETagWithPartNumber> - the temporary information about the already uploaded chunks.
|
|
695
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
695
696
|
* @returns <Promise<Array<ETagWithPartNumber>>> - the completed (uploaded) chunks information.
|
|
696
697
|
*/
|
|
697
|
-
const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremonyId, alreadyUploadedChunks) => {
|
|
698
|
+
const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremonyId, alreadyUploadedChunks, logger) => {
|
|
698
699
|
// Keep track of uploaded chunks.
|
|
699
700
|
const uploadedChunks = alreadyUploadedChunks || [];
|
|
701
|
+
// if we were passed a logger, start it
|
|
702
|
+
if (logger)
|
|
703
|
+
logger.start(chunksWithUrls.length, 0);
|
|
700
704
|
// Loop through remaining chunks.
|
|
701
705
|
for (let i = alreadyUploadedChunks ? alreadyUploadedChunks.length : 0; i < chunksWithUrls.length; i += 1) {
|
|
702
706
|
// Consume the pre-signed url to upload the chunk.
|
|
@@ -728,6 +732,9 @@ const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremony
|
|
|
728
732
|
// nb. this must be done only when contributing (not finalizing).
|
|
729
733
|
if (!!ceremonyId && !!cloudFunctions)
|
|
730
734
|
await temporaryStoreCurrentContributionUploadedChunkData(cloudFunctions, ceremonyId, chunk);
|
|
735
|
+
// increment the count on the logger
|
|
736
|
+
if (logger)
|
|
737
|
+
logger.increment();
|
|
731
738
|
}
|
|
732
739
|
return uploadedChunks;
|
|
733
740
|
};
|
|
@@ -748,8 +755,9 @@ const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremony
|
|
|
748
755
|
* @param configStreamChunkSize <number> - size of each chunk into which the artifact is going to be splitted (nb. will be converted in MB).
|
|
749
756
|
* @param [ceremonyId] <string> - the unique identifier of the ceremony (used as a double-edge sword - as identifier and as a check if current contributor is the coordinator finalizing the ceremony).
|
|
750
757
|
* @param [temporaryDataToResumeMultiPartUpload] <TemporaryParticipantContributionData> - the temporary information necessary to resume an already started multi-part upload.
|
|
758
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
751
759
|
*/
|
|
752
|
-
const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFilePath, configStreamChunkSize, ceremonyId, temporaryDataToResumeMultiPartUpload) => {
|
|
760
|
+
const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFilePath, configStreamChunkSize, ceremonyId, temporaryDataToResumeMultiPartUpload, logger) => {
|
|
753
761
|
// The unique identifier of the multi-part upload.
|
|
754
762
|
let multiPartUploadId = "";
|
|
755
763
|
// The list of already uploaded chunks.
|
|
@@ -773,7 +781,7 @@ const multiPartUpload = async (cloudFunctions, bucketName, objectKey, localFileP
|
|
|
773
781
|
const chunksWithUrlsZkey = await getChunksAndPreSignedUrls(cloudFunctions, bucketName, objectKey, localFilePath, multiPartUploadId, configStreamChunkSize, ceremonyId);
|
|
774
782
|
// Step (2).
|
|
775
783
|
const partNumbersAndETagsZkey = await uploadParts(chunksWithUrlsZkey, mime.lookup(localFilePath), // content-type.
|
|
776
|
-
cloudFunctions, ceremonyId, alreadyUploadedChunks);
|
|
784
|
+
cloudFunctions, ceremonyId, alreadyUploadedChunks, logger);
|
|
777
785
|
// Step (3).
|
|
778
786
|
await completeMultiPartUpload(cloudFunctions, bucketName, objectKey, multiPartUploadId, partNumbersAndETagsZkey, ceremonyId);
|
|
779
787
|
};
|
|
@@ -1059,7 +1067,8 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1059
1067
|
// read the data
|
|
1060
1068
|
const data = JSON.parse(fs.readFileSync(path).toString());
|
|
1061
1069
|
// verify that the data is correct
|
|
1062
|
-
if (data[
|
|
1070
|
+
if (data["timeoutMechanismType"] !== "DYNAMIC" /* CeremonyTimeoutType.DYNAMIC */ &&
|
|
1071
|
+
data["timeoutMechanismType"] !== "FIXED" /* CeremonyTimeoutType.FIXED */)
|
|
1063
1072
|
throw new Error("Invalid timeout type. Please choose between DYNAMIC and FIXED.");
|
|
1064
1073
|
// validate that we have at least 1 circuit input data
|
|
1065
1074
|
if (!data.circuits || data.circuits.length === 0)
|
|
@@ -1129,7 +1138,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1129
1138
|
const wasmCompleteFilename = `${circuitData.name}.wasm`;
|
|
1130
1139
|
const smallestPowersOfTauCompleteFilenameForCircuit = `${potFilenameTemplate}${doubleDigitsPowers}.ptau`;
|
|
1131
1140
|
const firstZkeyCompleteFilename = `${circuitPrefix}_${genesisZkeyIndex}.zkey`;
|
|
1132
|
-
// storage paths
|
|
1141
|
+
// storage paths
|
|
1133
1142
|
const r1csStorageFilePath = getR1csStorageFilePath(circuitPrefix, r1csCompleteFilename);
|
|
1134
1143
|
const wasmStorageFilePath = getWasmStorageFilePath(circuitPrefix, wasmCompleteFilename);
|
|
1135
1144
|
const potStorageFilePath = getPotStorageFilePath(smallestPowersOfTauCompleteFilenameForCircuit);
|
|
@@ -1145,7 +1154,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1145
1154
|
initialZkeyStoragePath: zkeyStorageFilePath,
|
|
1146
1155
|
r1csBlake2bHash: r1csBlake2bHash
|
|
1147
1156
|
};
|
|
1148
|
-
// validate that the compiler hash is a valid hash
|
|
1157
|
+
// validate that the compiler hash is a valid hash
|
|
1149
1158
|
const compiler = circuitData.compiler;
|
|
1150
1159
|
const compilerHashMatch = compiler.commitHash.match(commitHashPattern);
|
|
1151
1160
|
if (!compilerHashMatch || compilerHashMatch.length === 0 || compilerHashMatch.length > 1)
|
|
@@ -1180,7 +1189,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1180
1189
|
contributionComputation: 0,
|
|
1181
1190
|
fullContribution: 0,
|
|
1182
1191
|
verifyCloudFunction: 0
|
|
1183
|
-
}
|
|
1192
|
+
}
|
|
1184
1193
|
};
|
|
1185
1194
|
}
|
|
1186
1195
|
if (data.timeoutMechanismType === "FIXED" /* CeremonyTimeoutType.FIXED */) {
|
|
@@ -1203,7 +1212,7 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1203
1212
|
contributionComputation: 0,
|
|
1204
1213
|
fullContribution: 0,
|
|
1205
1214
|
verifyCloudFunction: 0
|
|
1206
|
-
}
|
|
1215
|
+
}
|
|
1207
1216
|
};
|
|
1208
1217
|
}
|
|
1209
1218
|
circuits.push(circuit);
|
|
@@ -1364,7 +1373,9 @@ const getContributionsValidityForContributor = async (firestoreDatabase, circuit
|
|
|
1364
1373
|
* @param isFinalizing <boolean> - true when the coordinator is finalizing the ceremony, otherwise false.
|
|
1365
1374
|
* @returns <string> - the public attestation preamble.
|
|
1366
1375
|
*/
|
|
1367
|
-
const getPublicAttestationPreambleForContributor = (contributorIdentifier, ceremonyName, isFinalizing) => `Hey, I'm ${contributorIdentifier} and I have ${isFinalizing ? "finalized" : "contributed to"} the ${ceremonyName}
|
|
1376
|
+
const getPublicAttestationPreambleForContributor = (contributorIdentifier, ceremonyName, isFinalizing) => `Hey, I'm ${contributorIdentifier} and I have ${isFinalizing ? "finalized" : "contributed to"} the ${ceremonyName}${ceremonyName.toLowerCase().includes("trusted setup") || ceremonyName.toLowerCase().includes("ceremony")
|
|
1377
|
+
? "."
|
|
1378
|
+
: " MPC Phase2 Trusted Setup ceremony."}\nThe following are my contribution signatures:`;
|
|
1368
1379
|
/**
|
|
1369
1380
|
* Check and prepare public attestation for the contributor made only of its valid contributions.
|
|
1370
1381
|
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
@@ -1820,7 +1831,7 @@ const getFirestoreDatabase = (app) => firestore.getFirestore(app);
|
|
|
1820
1831
|
* @param app <FirebaseApp> - the Firebase application.
|
|
1821
1832
|
* @returns <Functions> - the Cloud Functions associated to the application.
|
|
1822
1833
|
*/
|
|
1823
|
-
const getFirebaseFunctions = (app) => functions.getFunctions(app,
|
|
1834
|
+
const getFirebaseFunctions = (app) => functions.getFunctions(app, "europe-west1");
|
|
1824
1835
|
/**
|
|
1825
1836
|
* Retrieve the configuration variables for the AWS services (S3, EC2).
|
|
1826
1837
|
* @returns <AWSVariables> - the values of the AWS services configuration variables.
|
|
@@ -2323,8 +2334,13 @@ const vmDependenciesAndCacheArtifactsCommand = (zKeyPath, potPath, snsTopic, reg
|
|
|
2323
2334
|
// eslint-disable-next-line no-template-curly-in-string
|
|
2324
2335
|
"touch ${MARKER_FILE}",
|
|
2325
2336
|
"sudo yum update -y",
|
|
2326
|
-
"curl -
|
|
2327
|
-
"
|
|
2337
|
+
"curl -O https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz",
|
|
2338
|
+
"tar -xf node-v16.13.0-linux-x64.tar.xz",
|
|
2339
|
+
"mv node-v16.13.0-linux-x64 nodejs",
|
|
2340
|
+
"sudo mv nodejs /opt/",
|
|
2341
|
+
"echo 'export NODEJS_HOME=/opt/nodejs' >> /etc/profile",
|
|
2342
|
+
"echo 'export PATH=$NODEJS_HOME/bin:$PATH' >> /etc/profile",
|
|
2343
|
+
"source /etc/profile",
|
|
2328
2344
|
"npm install -g snarkjs",
|
|
2329
2345
|
`aws s3 cp s3://${zKeyPath} /var/tmp/genesisZkey.zkey`,
|
|
2330
2346
|
`aws s3 cp s3://${potPath} /var/tmp/pot.ptau`,
|
|
@@ -2343,6 +2359,7 @@ const vmDependenciesAndCacheArtifactsCommand = (zKeyPath, potPath, snsTopic, reg
|
|
|
2343
2359
|
* @returns Array<string> - the list of commands for contribution verification.
|
|
2344
2360
|
*/
|
|
2345
2361
|
const vmContributionVerificationCommand = (bucketName, lastZkeyStoragePath, verificationTranscriptStoragePathAndFilename) => [
|
|
2362
|
+
`source /etc/profile`,
|
|
2346
2363
|
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey > /var/tmp/log.txt`,
|
|
2347
2364
|
`snarkjs zkvi /var/tmp/genesisZkey.zkey /var/tmp/pot.ptau /var/tmp/lastZKey.zkey > /var/tmp/verification_transcript.log`,
|
|
2348
2365
|
`aws s3 cp /var/tmp/verification_transcript.log s3://${bucketName}/${verificationTranscriptStoragePathAndFilename} &>/dev/null`,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Functions } from "firebase/functions";
|
|
2
2
|
import { ETagWithPartNumber, ChunkWithUrl, TemporaryParticipantContributionData } from "../types/index";
|
|
3
|
+
import { GenericBar } from "cli-progress";
|
|
3
4
|
/**
|
|
4
5
|
* Return the bucket name based on ceremony prefix.
|
|
5
6
|
* @param ceremonyPrefix <string> - the ceremony prefix.
|
|
@@ -26,9 +27,10 @@ export declare const getChunksAndPreSignedUrls: (cloudFunctions: Functions, buck
|
|
|
26
27
|
* @param cloudFunctions <Functions> - the Firebase Cloud Functions service instance.
|
|
27
28
|
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
28
29
|
* @param alreadyUploadedChunks Array<ETagWithPartNumber> - the temporary information about the already uploaded chunks.
|
|
30
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
29
31
|
* @returns <Promise<Array<ETagWithPartNumber>>> - the completed (uploaded) chunks information.
|
|
30
32
|
*/
|
|
31
|
-
export declare const uploadParts: (chunksWithUrls: Array<ChunkWithUrl>, contentType: string | false, cloudFunctions?: Functions, ceremonyId?: string, alreadyUploadedChunks?: Array<ETagWithPartNumber
|
|
33
|
+
export declare const uploadParts: (chunksWithUrls: Array<ChunkWithUrl>, contentType: string | false, cloudFunctions?: Functions, ceremonyId?: string, alreadyUploadedChunks?: Array<ETagWithPartNumber>, logger?: GenericBar) => Promise<Array<ETagWithPartNumber>>;
|
|
32
34
|
/**
|
|
33
35
|
* Upload a ceremony artifact to the corresponding bucket.
|
|
34
36
|
* @notice this method implements the multi-part upload using pre-signed urls, optimal for large files.
|
|
@@ -46,8 +48,9 @@ export declare const uploadParts: (chunksWithUrls: Array<ChunkWithUrl>, contentT
|
|
|
46
48
|
* @param configStreamChunkSize <number> - size of each chunk into which the artifact is going to be splitted (nb. will be converted in MB).
|
|
47
49
|
* @param [ceremonyId] <string> - the unique identifier of the ceremony (used as a double-edge sword - as identifier and as a check if current contributor is the coordinator finalizing the ceremony).
|
|
48
50
|
* @param [temporaryDataToResumeMultiPartUpload] <TemporaryParticipantContributionData> - the temporary information necessary to resume an already started multi-part upload.
|
|
51
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
49
52
|
*/
|
|
50
|
-
export declare const multiPartUpload: (cloudFunctions: Functions, bucketName: string, objectKey: string, localFilePath: string, configStreamChunkSize: number, ceremonyId?: string, temporaryDataToResumeMultiPartUpload?: TemporaryParticipantContributionData) => Promise<void>;
|
|
53
|
+
export declare const multiPartUpload: (cloudFunctions: Functions, bucketName: string, objectKey: string, localFilePath: string, configStreamChunkSize: number, ceremonyId?: string, temporaryDataToResumeMultiPartUpload?: TemporaryParticipantContributionData, logger?: GenericBar) => Promise<void>;
|
|
51
54
|
/**
|
|
52
55
|
* Download an artifact from S3 (only for authorized users)
|
|
53
56
|
* @param cloudFunctions <Functions> Firebase cloud functions instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/helpers/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAK9C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/helpers/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAK9C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAA;AAUvG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,mBAAoB,MAAM,mBAAmB,MAAM,KAAG,MACvC,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,mBAClB,SAAS,cACb,MAAM,aACP,MAAM,iBACF,MAAM,YACX,MAAM,yBACO,MAAM,eAChB,MAAM,KACpB,QAAQ,MAAM,YAAY,CAAC,CA6B7B,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,mBACJ,MAAM,YAAY,CAAC,eACtB,MAAM,GAAG,KAAK,mBACV,SAAS,eACb,MAAM,0BACK,MAAM,kBAAkB,CAAC,WACxC,UAAU,KACpB,QAAQ,MAAM,kBAAkB,CAAC,CAiDnC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,mBACR,SAAS,cACb,MAAM,aACP,MAAM,iBACF,MAAM,yBACE,MAAM,eAChB,MAAM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AAS,EAAE;QACP,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;QACd,eAAe,EAAE,MAAM,CAAA;QACvB,eAAe,EAAE,MAAM,CAAA;KAC1B,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAC9C,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,oBAAoB,EAAE,mBAAmB,CAAA;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,KAAK,CACX,eAAe,GACX,qCAAqC,GACrC,mCAAmC,GACnC,gCAAgC,CACvC,CAAA;CACJ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtion/actions",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-8bb9489",
|
|
4
4
|
"description": "A set of actions and helpers for CLI commands",
|
|
5
5
|
"repository": "git@github.com:privacy-scaling-explorations/p0tion.git",
|
|
6
6
|
"homepage": "https://github.com/privacy-scaling-explorations/p0tion",
|
|
@@ -55,10 +55,6 @@
|
|
|
55
55
|
"firebase": "^9.21.0",
|
|
56
56
|
"firebase-admin": "^11.8.0",
|
|
57
57
|
"googleapis": "^118.0.0",
|
|
58
|
-
"puppeteer": "^20.1.2",
|
|
59
|
-
"puppeteer-extra": "^3.3.6",
|
|
60
|
-
"puppeteer-extra-plugin-anonymize-ua": "^2.4.6",
|
|
61
|
-
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
62
58
|
"rimraf": "^5.0.0",
|
|
63
59
|
"rollup": "^3.21.6",
|
|
64
60
|
"snarkjs": "^0.6.11",
|
|
@@ -83,5 +79,5 @@
|
|
|
83
79
|
"publishConfig": {
|
|
84
80
|
"access": "public"
|
|
85
81
|
},
|
|
86
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "183d8a9e86db61fe1c713898c0abce990a7e6004"
|
|
87
83
|
}
|
package/src/helpers/constants.ts
CHANGED
package/src/helpers/functions.ts
CHANGED
package/src/helpers/security.ts
CHANGED
|
@@ -16,14 +16,14 @@ const getGitHubStats = async (user: string): Promise<any> => {
|
|
|
16
16
|
|
|
17
17
|
const jsonData: any = await response.json()
|
|
18
18
|
|
|
19
|
-
const data
|
|
19
|
+
const data = {
|
|
20
20
|
following: jsonData.following,
|
|
21
21
|
followers: jsonData.followers,
|
|
22
22
|
publicRepos: jsonData.public_repos,
|
|
23
23
|
avatarUrl: jsonData.avatar_url
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
return data
|
|
26
|
+
return data
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -56,7 +56,7 @@ export const githubReputation = async (
|
|
|
56
56
|
reputable: false,
|
|
57
57
|
avatarUrl: ""
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
return {
|
|
61
61
|
reputable: true,
|
|
62
62
|
avatarUrl: avatarUrl
|
package/src/helpers/services.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const getFirestoreDatabase = (app: FirebaseApp): Firestore => getFirestor
|
|
|
22
22
|
* @param app <FirebaseApp> - the Firebase application.
|
|
23
23
|
* @returns <Functions> - the Cloud Functions associated to the application.
|
|
24
24
|
*/
|
|
25
|
-
export const getFirebaseFunctions = (app: FirebaseApp): Functions => getFunctions(app,
|
|
25
|
+
export const getFirebaseFunctions = (app: FirebaseApp): Functions => getFunctions(app, "europe-west1")
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Retrieve the configuration variables for the AWS services (S3, EC2).
|
package/src/helpers/storage.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
temporaryStoreCurrentContributionMultiPartUploadId,
|
|
14
14
|
temporaryStoreCurrentContributionUploadedChunkData
|
|
15
15
|
} from "./functions"
|
|
16
|
+
import { GenericBar } from "cli-progress"
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Return the bucket name based on ceremony prefix.
|
|
@@ -80,6 +81,7 @@ export const getChunksAndPreSignedUrls = async (
|
|
|
80
81
|
* @param cloudFunctions <Functions> - the Firebase Cloud Functions service instance.
|
|
81
82
|
* @param ceremonyId <string> - the unique identifier of the ceremony.
|
|
82
83
|
* @param alreadyUploadedChunks Array<ETagWithPartNumber> - the temporary information about the already uploaded chunks.
|
|
84
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
83
85
|
* @returns <Promise<Array<ETagWithPartNumber>>> - the completed (uploaded) chunks information.
|
|
84
86
|
*/
|
|
85
87
|
export const uploadParts = async (
|
|
@@ -87,11 +89,15 @@ export const uploadParts = async (
|
|
|
87
89
|
contentType: string | false,
|
|
88
90
|
cloudFunctions?: Functions,
|
|
89
91
|
ceremonyId?: string,
|
|
90
|
-
alreadyUploadedChunks?: Array<ETagWithPartNumber
|
|
92
|
+
alreadyUploadedChunks?: Array<ETagWithPartNumber>,
|
|
93
|
+
logger?: GenericBar
|
|
91
94
|
): Promise<Array<ETagWithPartNumber>> => {
|
|
92
95
|
// Keep track of uploaded chunks.
|
|
93
96
|
const uploadedChunks: Array<ETagWithPartNumber> = alreadyUploadedChunks || []
|
|
94
97
|
|
|
98
|
+
// if we were passed a logger, start it
|
|
99
|
+
if (logger) logger.start(chunksWithUrls.length, 0)
|
|
100
|
+
|
|
95
101
|
// Loop through remaining chunks.
|
|
96
102
|
for (let i = alreadyUploadedChunks ? alreadyUploadedChunks.length : 0; i < chunksWithUrls.length; i += 1) {
|
|
97
103
|
// Consume the pre-signed url to upload the chunk.
|
|
@@ -128,6 +134,9 @@ export const uploadParts = async (
|
|
|
128
134
|
// nb. this must be done only when contributing (not finalizing).
|
|
129
135
|
if (!!ceremonyId && !!cloudFunctions)
|
|
130
136
|
await temporaryStoreCurrentContributionUploadedChunkData(cloudFunctions, ceremonyId, chunk)
|
|
137
|
+
|
|
138
|
+
// increment the count on the logger
|
|
139
|
+
if (logger) logger.increment()
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
return uploadedChunks
|
|
@@ -150,6 +159,7 @@ export const uploadParts = async (
|
|
|
150
159
|
* @param configStreamChunkSize <number> - size of each chunk into which the artifact is going to be splitted (nb. will be converted in MB).
|
|
151
160
|
* @param [ceremonyId] <string> - the unique identifier of the ceremony (used as a double-edge sword - as identifier and as a check if current contributor is the coordinator finalizing the ceremony).
|
|
152
161
|
* @param [temporaryDataToResumeMultiPartUpload] <TemporaryParticipantContributionData> - the temporary information necessary to resume an already started multi-part upload.
|
|
162
|
+
* @param logger <GenericBar> - an optional logger to show progress.
|
|
153
163
|
*/
|
|
154
164
|
export const multiPartUpload = async (
|
|
155
165
|
cloudFunctions: Functions,
|
|
@@ -158,7 +168,8 @@ export const multiPartUpload = async (
|
|
|
158
168
|
localFilePath: string,
|
|
159
169
|
configStreamChunkSize: number,
|
|
160
170
|
ceremonyId?: string,
|
|
161
|
-
temporaryDataToResumeMultiPartUpload?: TemporaryParticipantContributionData
|
|
171
|
+
temporaryDataToResumeMultiPartUpload?: TemporaryParticipantContributionData,
|
|
172
|
+
logger?: GenericBar
|
|
162
173
|
) => {
|
|
163
174
|
// The unique identifier of the multi-part upload.
|
|
164
175
|
let multiPartUploadId: string = ""
|
|
@@ -198,7 +209,8 @@ export const multiPartUpload = async (
|
|
|
198
209
|
mime.lookup(localFilePath), // content-type.
|
|
199
210
|
cloudFunctions,
|
|
200
211
|
ceremonyId,
|
|
201
|
-
alreadyUploadedChunks
|
|
212
|
+
alreadyUploadedChunks,
|
|
213
|
+
logger
|
|
202
214
|
)
|
|
203
215
|
|
|
204
216
|
// Step (3).
|
package/src/helpers/utils.ts
CHANGED
|
@@ -3,16 +3,16 @@ import fs, { ReadPosition, createWriteStream } from "fs"
|
|
|
3
3
|
import { utils as ffUtils } from "ffjavascript"
|
|
4
4
|
import winston, { Logger } from "winston"
|
|
5
5
|
import fetch from "@adobe/node-fetch-retry"
|
|
6
|
-
import {
|
|
7
|
-
CircuitMetadata,
|
|
8
|
-
Contribution,
|
|
9
|
-
CircuitDocument,
|
|
6
|
+
import {
|
|
7
|
+
CircuitMetadata,
|
|
8
|
+
Contribution,
|
|
9
|
+
CircuitDocument,
|
|
10
10
|
CircuitInputData,
|
|
11
|
-
ContributionValidity,
|
|
12
|
-
FirebaseDocumentInfo,
|
|
13
|
-
SetupCeremonyData,
|
|
11
|
+
ContributionValidity,
|
|
12
|
+
FirebaseDocumentInfo,
|
|
13
|
+
SetupCeremonyData,
|
|
14
14
|
CeremonySetupTemplate,
|
|
15
|
-
CeremonySetupTemplateCircuitArtifacts
|
|
15
|
+
CeremonySetupTemplateCircuitArtifacts
|
|
16
16
|
} from "../types/index"
|
|
17
17
|
import { finalContributionIndex, genesisZkeyIndex, potFilenameTemplate } from "./constants"
|
|
18
18
|
import {
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
getContributionsCollectionPath
|
|
23
23
|
} from "./database"
|
|
24
24
|
import { CeremonyTimeoutType } from "../types/enums"
|
|
25
|
-
import {
|
|
26
|
-
getPotStorageFilePath,
|
|
27
|
-
getR1csStorageFilePath,
|
|
28
|
-
getWasmStorageFilePath,
|
|
25
|
+
import {
|
|
26
|
+
getPotStorageFilePath,
|
|
27
|
+
getR1csStorageFilePath,
|
|
28
|
+
getWasmStorageFilePath,
|
|
29
29
|
getZkeyStorageFilePath
|
|
30
30
|
} from "./storage"
|
|
31
31
|
import { blake512FromPath } from "./crypto"
|
|
@@ -41,23 +41,29 @@ import { promisify } from "util"
|
|
|
41
41
|
*/
|
|
42
42
|
export const parseCeremonyFile = async (path: string, cleanup: boolean = false): Promise<SetupCeremonyData> => {
|
|
43
43
|
// check that the path exists
|
|
44
|
-
if (!fs.existsSync(path))
|
|
45
|
-
|
|
44
|
+
if (!fs.existsSync(path))
|
|
45
|
+
throw new Error(
|
|
46
|
+
"The provided path to the configuration file does not exist. Please provide an absolute path and try again."
|
|
47
|
+
)
|
|
48
|
+
|
|
46
49
|
try {
|
|
47
50
|
// read the data
|
|
48
51
|
const data: CeremonySetupTemplate = JSON.parse(fs.readFileSync(path).toString())
|
|
49
52
|
|
|
50
53
|
// verify that the data is correct
|
|
51
|
-
if (
|
|
54
|
+
if (
|
|
55
|
+
data["timeoutMechanismType"] !== CeremonyTimeoutType.DYNAMIC &&
|
|
56
|
+
data["timeoutMechanismType"] !== CeremonyTimeoutType.FIXED
|
|
57
|
+
)
|
|
52
58
|
throw new Error("Invalid timeout type. Please choose between DYNAMIC and FIXED.")
|
|
53
|
-
|
|
59
|
+
|
|
54
60
|
// validate that we have at least 1 circuit input data
|
|
55
|
-
if (!data.circuits || data.circuits.length === 0)
|
|
61
|
+
if (!data.circuits || data.circuits.length === 0)
|
|
56
62
|
throw new Error("You need to provide the data for at least 1 circuit.")
|
|
57
63
|
|
|
58
64
|
// validate that the end date is in the future
|
|
59
|
-
let endDate: Date
|
|
60
|
-
let startDate: Date
|
|
65
|
+
let endDate: Date
|
|
66
|
+
let startDate: Date
|
|
61
67
|
try {
|
|
62
68
|
endDate = new Date(data.endDate)
|
|
63
69
|
startDate = new Date(data.startDate)
|
|
@@ -66,12 +72,12 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
if (endDate <= startDate) throw new Error("The end date should be greater than the start date.")
|
|
69
|
-
|
|
75
|
+
|
|
70
76
|
const currentDate = new Date()
|
|
71
77
|
|
|
72
|
-
if (endDate <= currentDate || startDate <= currentDate)
|
|
78
|
+
if (endDate <= currentDate || startDate <= currentDate)
|
|
73
79
|
throw new Error("The start and end dates should be in the future.")
|
|
74
|
-
|
|
80
|
+
|
|
75
81
|
// validate penalty
|
|
76
82
|
if (data.penalty <= 0) throw new Error("The penalty should be greater than zero.")
|
|
77
83
|
|
|
@@ -100,30 +106,36 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
100
106
|
const responseR1CS = await fetch(artifacts.r1csStoragePath)
|
|
101
107
|
|
|
102
108
|
// Handle errors.
|
|
103
|
-
if (!responseR1CS.ok && responseR1CS.status !== 200)
|
|
104
|
-
throw new Error(
|
|
109
|
+
if (!responseR1CS.ok && responseR1CS.status !== 200)
|
|
110
|
+
throw new Error(
|
|
111
|
+
`There was an error while trying to download the r1cs file for circuit ${circuitData.name}. Please check that the file has the correct permissions (public) set.`
|
|
112
|
+
)
|
|
105
113
|
|
|
106
114
|
await streamPipeline(responseR1CS.body!, createWriteStream(localR1csPath))
|
|
107
115
|
// Write the file locally
|
|
108
|
-
|
|
116
|
+
|
|
109
117
|
// extract the metadata from the r1cs
|
|
110
118
|
const metadata = getR1CSInfo(localR1csPath)
|
|
111
119
|
|
|
112
120
|
// download wasm too to ensure it's available
|
|
113
121
|
const responseWASM = await fetch(artifacts.wasmStoragePath)
|
|
114
|
-
if (!responseWASM.ok && responseWASM.status !== 200)
|
|
115
|
-
throw new Error(
|
|
122
|
+
if (!responseWASM.ok && responseWASM.status !== 200)
|
|
123
|
+
throw new Error(
|
|
124
|
+
`There was an error while trying to download the WASM file for circuit ${circuitData.name}. Please check that the file has the correct permissions (public) set.`
|
|
125
|
+
)
|
|
116
126
|
await streamPipeline(responseWASM.body!, createWriteStream(localWasmPath))
|
|
117
127
|
|
|
118
128
|
// validate that the circuit hash and template links are valid
|
|
119
129
|
const template = circuitData.template
|
|
120
130
|
|
|
121
131
|
const URLMatch = template.source.match(urlPattern)
|
|
122
|
-
if (!URLMatch || URLMatch.length === 0 || URLMatch.length > 1)
|
|
132
|
+
if (!URLMatch || URLMatch.length === 0 || URLMatch.length > 1)
|
|
133
|
+
throw new Error("You should provide the URL to the circuits templates on GitHub.")
|
|
123
134
|
|
|
124
135
|
const hashMatch = template.commitHash.match(commitHashPattern)
|
|
125
|
-
if (!hashMatch || hashMatch.length === 0 || hashMatch.length > 1)
|
|
126
|
-
|
|
136
|
+
if (!hashMatch || hashMatch.length === 0 || hashMatch.length > 1)
|
|
137
|
+
throw new Error("You should provide a valid commit hash of the circuit templates.")
|
|
138
|
+
|
|
127
139
|
// calculate the hash of the r1cs file
|
|
128
140
|
const r1csBlake2bHash = await blake512FromPath(localR1csPath)
|
|
129
141
|
|
|
@@ -136,12 +148,12 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
136
148
|
const smallestPowersOfTauCompleteFilenameForCircuit = `${potFilenameTemplate}${doubleDigitsPowers}.ptau`
|
|
137
149
|
const firstZkeyCompleteFilename = `${circuitPrefix}_${genesisZkeyIndex}.zkey`
|
|
138
150
|
|
|
139
|
-
// storage paths
|
|
151
|
+
// storage paths
|
|
140
152
|
const r1csStorageFilePath = getR1csStorageFilePath(circuitPrefix, r1csCompleteFilename)
|
|
141
153
|
const wasmStorageFilePath = getWasmStorageFilePath(circuitPrefix, wasmCompleteFilename)
|
|
142
154
|
const potStorageFilePath = getPotStorageFilePath(smallestPowersOfTauCompleteFilenameForCircuit)
|
|
143
155
|
const zkeyStorageFilePath = getZkeyStorageFilePath(circuitPrefix, firstZkeyCompleteFilename)
|
|
144
|
-
|
|
156
|
+
|
|
145
157
|
const files: any = {
|
|
146
158
|
potFilename: smallestPowersOfTauCompleteFilenameForCircuit,
|
|
147
159
|
r1csFilename: r1csCompleteFilename,
|
|
@@ -154,14 +166,15 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
154
166
|
r1csBlake2bHash: r1csBlake2bHash
|
|
155
167
|
}
|
|
156
168
|
|
|
157
|
-
// validate that the compiler hash is a valid hash
|
|
169
|
+
// validate that the compiler hash is a valid hash
|
|
158
170
|
const compiler = circuitData.compiler
|
|
159
171
|
const compilerHashMatch = compiler.commitHash.match(commitHashPattern)
|
|
160
|
-
if (!compilerHashMatch || compilerHashMatch.length === 0 || compilerHashMatch.length > 1)
|
|
172
|
+
if (!compilerHashMatch || compilerHashMatch.length === 0 || compilerHashMatch.length > 1)
|
|
173
|
+
throw new Error("You should provide a valid commit hash of the circuit compiler.")
|
|
161
174
|
|
|
162
175
|
// validate that the verification options are valid
|
|
163
176
|
const verification = circuitData.verification
|
|
164
|
-
if (verification.cfOrVm !== "CF" && verification.cfOrVm !== "VM")
|
|
177
|
+
if (verification.cfOrVm !== "CF" && verification.cfOrVm !== "VM")
|
|
165
178
|
throw new Error("Please enter a valid verification mechanism: either CF or VM")
|
|
166
179
|
|
|
167
180
|
// @todo VM parameters verification
|
|
@@ -174,8 +187,7 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
174
187
|
let circuit: CircuitDocument | CircuitInputData = {} as CircuitDocument | CircuitInputData
|
|
175
188
|
|
|
176
189
|
if (data.timeoutMechanismType === CeremonyTimeoutType.DYNAMIC) {
|
|
177
|
-
if (circuitData.dynamicThreshold <= 0)
|
|
178
|
-
throw new Error("The dynamic threshold should be > 0.")
|
|
190
|
+
if (circuitData.dynamicThreshold <= 0) throw new Error("The dynamic threshold should be > 0.")
|
|
179
191
|
dynamicThreshold = circuitData.dynamicThreshold
|
|
180
192
|
|
|
181
193
|
// the Circuit data for the ceremony setup
|
|
@@ -183,7 +195,7 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
183
195
|
name: circuitData.name,
|
|
184
196
|
description: circuitData.description,
|
|
185
197
|
prefix: circuitPrefix,
|
|
186
|
-
sequencePosition: i+1,
|
|
198
|
+
sequencePosition: i + 1,
|
|
187
199
|
metadata: metadata,
|
|
188
200
|
files: files,
|
|
189
201
|
template: template,
|
|
@@ -194,23 +206,20 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
194
206
|
contributionComputation: 0,
|
|
195
207
|
fullContribution: 0,
|
|
196
208
|
verifyCloudFunction: 0
|
|
197
|
-
}
|
|
198
|
-
|
|
209
|
+
}
|
|
199
210
|
}
|
|
200
211
|
}
|
|
201
212
|
|
|
202
213
|
if (data.timeoutMechanismType === CeremonyTimeoutType.FIXED) {
|
|
203
|
-
if (circuitData.fixedTimeWindow <= 0)
|
|
204
|
-
throw new Error("The fixed time window threshold should be > 0.")
|
|
214
|
+
if (circuitData.fixedTimeWindow <= 0) throw new Error("The fixed time window threshold should be > 0.")
|
|
205
215
|
fixedTimeWindow = circuitData.fixedTimeWindow
|
|
206
216
|
|
|
207
|
-
|
|
208
217
|
// the Circuit data for the ceremony setup
|
|
209
218
|
circuit = {
|
|
210
219
|
name: circuitData.name,
|
|
211
220
|
description: circuitData.description,
|
|
212
221
|
prefix: circuitPrefix,
|
|
213
|
-
sequencePosition: i+1,
|
|
222
|
+
sequencePosition: i + 1,
|
|
214
223
|
metadata: metadata,
|
|
215
224
|
files: files,
|
|
216
225
|
template: template,
|
|
@@ -221,18 +230,15 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
221
230
|
contributionComputation: 0,
|
|
222
231
|
fullContribution: 0,
|
|
223
232
|
verifyCloudFunction: 0
|
|
224
|
-
}
|
|
225
|
-
|
|
233
|
+
}
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
236
|
|
|
229
|
-
|
|
230
237
|
circuits.push(circuit)
|
|
231
238
|
|
|
232
239
|
// remove the local r1cs and wasm downloads (if used for verifying the config only vs setup)
|
|
233
|
-
if (cleanup)
|
|
234
|
-
|
|
235
|
-
fs.unlinkSync(localWasmPath)
|
|
240
|
+
if (cleanup) fs.unlinkSync(localR1csPath)
|
|
241
|
+
fs.unlinkSync(localWasmPath)
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
const setupData: SetupCeremonyData = {
|
|
@@ -250,7 +256,6 @@ export const parseCeremonyFile = async (path: string, cleanup: boolean = false):
|
|
|
250
256
|
}
|
|
251
257
|
|
|
252
258
|
return setupData
|
|
253
|
-
|
|
254
259
|
} catch (error: any) {
|
|
255
260
|
throw new Error(`Error while parsing up the ceremony setup file. ${error.message}`)
|
|
256
261
|
}
|
|
@@ -444,9 +449,11 @@ export const getPublicAttestationPreambleForContributor = (
|
|
|
444
449
|
ceremonyName: string,
|
|
445
450
|
isFinalizing: boolean
|
|
446
451
|
) =>
|
|
447
|
-
`Hey, I'm ${contributorIdentifier} and I have ${
|
|
448
|
-
|
|
449
|
-
|
|
452
|
+
`Hey, I'm ${contributorIdentifier} and I have ${isFinalizing ? "finalized" : "contributed to"} the ${ceremonyName}${
|
|
453
|
+
ceremonyName.toLowerCase().includes("trusted setup") || ceremonyName.toLowerCase().includes("ceremony")
|
|
454
|
+
? "."
|
|
455
|
+
: " MPC Phase2 Trusted Setup ceremony."
|
|
456
|
+
}\nThe following are my contribution signatures:`
|
|
450
457
|
|
|
451
458
|
/**
|
|
452
459
|
* Check and prepare public attestation for the contributor made only of its valid contributions.
|
|
@@ -727,4 +734,4 @@ export const getR1CSInfo = (localR1CSFilePath: string): CircuitMetadata => {
|
|
|
727
734
|
* @param in <number> - the input number to be converted.
|
|
728
735
|
* @returns <string> - the two digits stringified number derived from the conversion.
|
|
729
736
|
*/
|
|
730
|
-
export const convertToDoubleDigits = (amount: number): string => (amount < 10 ? `0${amount}` : amount.toString())
|
|
737
|
+
export const convertToDoubleDigits = (amount: number): string => (amount < 10 ? `0${amount}` : amount.toString())
|
package/src/helpers/vm.ts
CHANGED
|
@@ -82,7 +82,7 @@ export const vmDependenciesAndCacheArtifactsCommand = (
|
|
|
82
82
|
zKeyPath: string,
|
|
83
83
|
potPath: string,
|
|
84
84
|
snsTopic: string,
|
|
85
|
-
region: string
|
|
85
|
+
region: string
|
|
86
86
|
): Array<string> => [
|
|
87
87
|
"#!/bin/bash",
|
|
88
88
|
'MARKER_FILE="/var/run/my_script_ran"',
|
|
@@ -93,8 +93,13 @@ export const vmDependenciesAndCacheArtifactsCommand = (
|
|
|
93
93
|
// eslint-disable-next-line no-template-curly-in-string
|
|
94
94
|
"touch ${MARKER_FILE}",
|
|
95
95
|
"sudo yum update -y",
|
|
96
|
-
"curl -
|
|
97
|
-
"
|
|
96
|
+
"curl -O https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz",
|
|
97
|
+
"tar -xf node-v16.13.0-linux-x64.tar.xz",
|
|
98
|
+
"mv node-v16.13.0-linux-x64 nodejs",
|
|
99
|
+
"sudo mv nodejs /opt/",
|
|
100
|
+
"echo 'export NODEJS_HOME=/opt/nodejs' >> /etc/profile",
|
|
101
|
+
"echo 'export PATH=$NODEJS_HOME/bin:$PATH' >> /etc/profile",
|
|
102
|
+
"source /etc/profile",
|
|
98
103
|
"npm install -g snarkjs",
|
|
99
104
|
`aws s3 cp s3://${zKeyPath} /var/tmp/genesisZkey.zkey`,
|
|
100
105
|
`aws s3 cp s3://${potPath} /var/tmp/pot.ptau`,
|
|
@@ -118,6 +123,7 @@ export const vmContributionVerificationCommand = (
|
|
|
118
123
|
lastZkeyStoragePath: string,
|
|
119
124
|
verificationTranscriptStoragePathAndFilename: string
|
|
120
125
|
): Array<string> => [
|
|
126
|
+
`source /etc/profile`,
|
|
121
127
|
`aws s3 cp s3://${bucketName}/${lastZkeyStoragePath} /var/tmp/lastZKey.zkey > /var/tmp/log.txt`,
|
|
122
128
|
`snarkjs zkvi /var/tmp/genesisZkey.zkey /var/tmp/pot.ptau /var/tmp/lastZKey.zkey > /var/tmp/verification_transcript.log`,
|
|
123
129
|
`aws s3 cp /var/tmp/verification_transcript.log s3://${bucketName}/${verificationTranscriptStoragePathAndFilename} &>/dev/null`,
|
package/src/index.ts
CHANGED
|
@@ -87,7 +87,7 @@ export {
|
|
|
87
87
|
verifyContribution,
|
|
88
88
|
checkAndPrepareCoordinatorForFinalization,
|
|
89
89
|
finalizeCircuit,
|
|
90
|
-
finalizeCeremony
|
|
90
|
+
finalizeCeremony
|
|
91
91
|
} from "./helpers/functions"
|
|
92
92
|
export { toHex, blake512FromPath, computeSHA256ToHex, compareHashes } from "./helpers/crypto"
|
|
93
93
|
export {
|
|
@@ -159,4 +159,4 @@ export {
|
|
|
159
159
|
createEC2Client,
|
|
160
160
|
vmContributionVerificationCommand,
|
|
161
161
|
retrieveCommandStatus
|
|
162
|
-
} from "./helpers/vm"
|
|
162
|
+
} from "./helpers/vm"
|
package/src/types/index.ts
CHANGED
|
@@ -620,7 +620,6 @@ export type SetupCeremonyData = {
|
|
|
620
620
|
circuitArtifacts: Array<CeremonySetupTemplateCircuitArtifacts>
|
|
621
621
|
}
|
|
622
622
|
|
|
623
|
-
|
|
624
623
|
export type CeremonySetupTemplateCircuitArtifacts = {
|
|
625
624
|
artifacts: {
|
|
626
625
|
bucket: string
|
|
@@ -640,11 +639,16 @@ export type CeremonySetupTemplateCircuitName = {
|
|
|
640
639
|
}
|
|
641
640
|
|
|
642
641
|
export type CeremonySetupTemplate = {
|
|
643
|
-
title: string
|
|
642
|
+
title: string
|
|
644
643
|
description: string
|
|
645
644
|
startDate: string
|
|
646
645
|
endDate: string
|
|
647
646
|
timeoutMechanismType: CeremonyTimeoutType
|
|
648
|
-
penalty: number
|
|
649
|
-
circuits: Array<
|
|
650
|
-
|
|
647
|
+
penalty: number
|
|
648
|
+
circuits: Array<
|
|
649
|
+
CircuitDocument &
|
|
650
|
+
CeremonySetupTemplateCircuitArtifacts &
|
|
651
|
+
CeremonySetupTemplateCircuitTimeout &
|
|
652
|
+
CeremonySetupTemplateCircuitName
|
|
653
|
+
>
|
|
654
|
+
}
|