@devtion/backend 0.0.0-5d170d3 → 0.0.0-7cfaa5d

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @module @p0tion/backend
3
- * @version 1.0.5
2
+ * @module @devtion/backend
3
+ * @version 1.0.8
4
4
  * @file MPC Phase 2 backend for Firebase services management
5
5
  * @copyright Ethereum Foundation 2022
6
6
  * @license MIT
@@ -9,7 +9,7 @@
9
9
  import admin from 'firebase-admin';
10
10
  import * as functions from 'firebase-functions';
11
11
  import dotenv from 'dotenv';
12
- import { getCircuitsCollectionPath, getTimeoutsCollectionPath, commonTerms, finalContributionIndex, getContributionsCollectionPath, githubReputation, getBucketName, vmBootstrapCommand, vmDependenciesAndCacheArtifactsCommand, vmBootstrapScriptFilename, computeDiskSizeForVM, createEC2Instance, getParticipantsCollectionPath, terminateEC2Instance, formatZkeyIndex, getTranscriptStorageFilePath, getZkeyStorageFilePath, startEC2Instance, vmContributionVerificationCommand, runCommandUsingSSM, getPotStorageFilePath, genesisZkeyIndex, createCustomLoggerForFile, blake512FromPath, getVerificationKeyStorageFilePath, getVerifierContractStorageFilePath, computeSHA256ToHex, retrieveCommandStatus, checkIfRunning, retrieveCommandOutput, stopEC2Instance, verificationKeyAcronym, verifierSmartContractAcronym } from '@p0tion/actions';
12
+ import { getCircuitsCollectionPath, getTimeoutsCollectionPath, commonTerms, finalContributionIndex, getContributionsCollectionPath, githubReputation, getBucketName, vmBootstrapCommand, vmDependenciesAndCacheArtifactsCommand, vmBootstrapScriptFilename, computeDiskSizeForVM, createEC2Instance, getParticipantsCollectionPath, terminateEC2Instance, formatZkeyIndex, getTranscriptStorageFilePath, getZkeyStorageFilePath, startEC2Instance, vmContributionVerificationCommand, runCommandUsingSSM, getPotStorageFilePath, genesisZkeyIndex, createCustomLoggerForFile, blake512FromPath, getVerificationKeyStorageFilePath, getVerifierContractStorageFilePath, computeSHA256ToHex, checkIfRunning, retrieveCommandOutput, stopEC2Instance, verificationKeyAcronym, verifierSmartContractAcronym, retrieveCommandStatus } from '@devtion/actions';
13
13
  import { encode } from 'html-entities';
14
14
  import { Timestamp, FieldValue } from 'firebase-admin/firestore';
15
15
  import { S3Client, GetObjectCommand, PutObjectCommand, DeleteObjectCommand, HeadBucketCommand, CreateBucketCommand, PutPublicAccessBlockCommand, PutBucketCorsCommand, HeadObjectCommand, CreateMultipartUploadCommand, UploadPartCommand, CompleteMultipartUploadCommand } from '@aws-sdk/client-s3';
@@ -121,7 +121,8 @@ const SPECIFIC_ERRORS = {
121
121
  SE_VM_FAILED_COMMAND_EXECUTION: makeError("failed-precondition", "VM command execution failed", "Please, contact the coordinator if this error persists."),
122
122
  SE_VM_TIMEDOUT_COMMAND_EXECUTION: makeError("deadline-exceeded", "VM command execution took too long and has been timed-out", "Please, contact the coordinator if this error persists."),
123
123
  SE_VM_CANCELLED_COMMAND_EXECUTION: makeError("cancelled", "VM command execution has been cancelled", "Please, contact the coordinator if this error persists."),
124
- SE_VM_DELAYED_COMMAND_EXECUTION: makeError("unavailable", "VM command execution has been delayed since there were no available instance at the moment", "Please, contact the coordinator if this error persists.")
124
+ SE_VM_DELAYED_COMMAND_EXECUTION: makeError("unavailable", "VM command execution has been delayed since there were no available instance at the moment", "Please, contact the coordinator if this error persists."),
125
+ SE_VM_UNKNOWN_COMMAND_STATUS: makeError("unavailable", "VM command execution has failed due to an unknown status code", "Please, contact the coordinator if this error persists.")
125
126
  };
126
127
  /**
127
128
  * A set of common errors.
@@ -305,7 +306,7 @@ const downloadArtifactFromS3Bucket = async (bucketName, objectKey, localFilePath
305
306
  const writeStream = createWriteStream(localFilePath);
306
307
  const streamPipeline = promisify(pipeline);
307
308
  await streamPipeline(response.body, writeStream);
308
- writeStream.on('finish', () => {
309
+ writeStream.on("finish", () => {
309
310
  writeStream.end();
310
311
  });
311
312
  };
@@ -521,8 +522,10 @@ const registerAuthUser = functions
521
522
  const { uid } = user;
522
523
  // Reference to a document using uid.
523
524
  const userRef = firestore.collection(commonTerms.collections.users.name).doc(uid);
524
- // html encode the display name
525
- const encodedDisplayName = encode(displayName);
525
+ // html encode the display name (or put the ID if the name is not displayed)
526
+ const encodedDisplayName = user.displayName === "Null" || user.displayName === null ? user.uid : encode(displayName);
527
+ // store the avatar URL of a contributor
528
+ let avatarUrl = "";
526
529
  // we only do reputation check if the user is not a coordinator
527
530
  if (!(email?.endsWith(`@${process.env.CUSTOM_CLAIMS_COORDINATOR_EMAIL_ADDRESS_OR_DOMAIN}`) ||
528
531
  email === process.env.CUSTOM_CLAIMS_COORDINATOR_EMAIL_ADDRESS_OR_DOMAIN)) {
@@ -532,14 +535,18 @@ const registerAuthUser = functions
532
535
  const vars = getGitHubVariables();
533
536
  // this return true or false
534
537
  try {
535
- const res = await githubReputation(user.providerData[0].uid, vars.minimumFollowing, vars.minimumFollowers, vars.minimumPublicRepos);
536
- if (!res) {
538
+ const { reputable, avatarUrl: avatarURL } = await githubReputation(user.providerData[0].uid, vars.minimumFollowing, vars.minimumFollowers, vars.minimumPublicRepos);
539
+ if (!reputable) {
537
540
  // Delete user
538
541
  await auth.deleteUser(user.uid);
539
542
  // Throw error
540
- logAndThrowError(makeError("permission-denied", "The user is not allowed to sign up because their Github reputation is not high enough.", `The user ${user.displayName} is not allowed to sign up because their Github reputation is not high enough. Please contact the administrator if you think this is a mistake.`));
543
+ logAndThrowError(makeError("permission-denied", "The user is not allowed to sign up because their Github reputation is not high enough.", `The user ${user.displayName === "Null" || user.displayName === null
544
+ ? user.uid
545
+ : user.displayName} is not allowed to sign up because their Github reputation is not high enough. Please contact the administrator if you think this is a mistake.`));
541
546
  }
542
- printLog(`Github reputation check passed for user ${user.displayName}`, LogLevel.DEBUG);
547
+ // store locally
548
+ avatarUrl = avatarURL;
549
+ printLog(`Github reputation check passed for user ${user.displayName === "Null" || user.displayName === null ? user.uid : user.displayName}`, LogLevel.DEBUG);
543
550
  }
544
551
  catch (error) {
545
552
  // Delete user
@@ -549,6 +556,8 @@ const registerAuthUser = functions
549
556
  }
550
557
  }
551
558
  // Set document (nb. we refer to providerData[0] because we use Github OAuth provider only).
559
+ // In future releases we might want to loop through the providerData array as we support
560
+ // more providers.
552
561
  await userRef.set({
553
562
  name: encodedDisplayName,
554
563
  encodedDisplayName,
@@ -561,7 +570,13 @@ const registerAuthUser = functions
561
570
  photoURL: photoURL || "",
562
571
  lastUpdated: getCurrentServerTimestampInMillis()
563
572
  });
573
+ // we want to create a new collection for the users to store the avatars
574
+ const avatarRef = firestore.collection(commonTerms.collections.avatars.name).doc(uid);
575
+ await avatarRef.set({
576
+ avatarUrl: avatarUrl || ""
577
+ });
564
578
  printLog(`Authenticated user document with identifier ${uid} has been correctly stored`, LogLevel.DEBUG);
579
+ printLog(`Authenticated user avatar with identifier ${uid} has been correctly stored`, LogLevel.DEBUG);
565
580
  });
566
581
  /**
567
582
  * Set custom claims for role-based access control on the newly created user.
@@ -698,7 +713,7 @@ const setupCeremony = functions
698
713
  // Check if using the VM approach for contribution verification.
699
714
  if (circuit.verification.cfOrVm === "VM" /* CircuitContributionVerificationMechanism.VM */) {
700
715
  // VM command to be run at the startup.
701
- const startupCommand = vmBootstrapCommand(bucketName);
716
+ const startupCommand = vmBootstrapCommand(`${bucketName}/circuits/${circuit.name}`);
702
717
  // Get EC2 client.
703
718
  const ec2Client = await createEC2Client();
704
719
  // Get AWS variables.
@@ -707,7 +722,8 @@ const setupCeremony = functions
707
722
  const vmCommands = vmDependenciesAndCacheArtifactsCommand(`${bucketName}/${circuit.files?.initialZkeyStoragePath}`, `${bucketName}/${circuit.files?.potStoragePath}`, snsTopic, region);
708
723
  printLog(`Check VM dependencies and cache artifacts commands ${vmCommands.join("\n")}`, LogLevel.DEBUG);
709
724
  // Upload the post-startup commands script file.
710
- await uploadFileToBucketNoFile(bucketName, vmBootstrapScriptFilename, vmCommands.join("\n"));
725
+ printLog(`Uploading VM post-startup commands script file ${vmBootstrapScriptFilename}`, LogLevel.DEBUG);
726
+ await uploadFileToBucketNoFile(bucketName, `circuits/${circuit.name}/${vmBootstrapScriptFilename}`, vmCommands.join("\n"));
711
727
  // Compute the VM disk space requirement (in GB).
712
728
  const vmDiskSize = computeDiskSizeForVM(circuit.zKeySizeInBytes, circuit.metadata?.pot);
713
729
  printLog(`Check VM startup commands ${startupCommand.join("\n")}`, LogLevel.DEBUG);
@@ -854,7 +870,7 @@ dotenv.config();
854
870
  * @dev true when the participant can participate (1.A, 3.B, 1.D); otherwise false.
855
871
  */
856
872
  const checkParticipantForCeremony = functions
857
- .region('europe-west1')
873
+ .region("europe-west1")
858
874
  .runWith({
859
875
  memory: "512MB"
860
876
  })
@@ -958,7 +974,7 @@ const checkParticipantForCeremony = functions
958
974
  * 2) the participant has just finished the contribution for a circuit (contributionProgress != 0 && status = CONTRIBUTED && contributionStep = COMPLETED).
959
975
  */
960
976
  const progressToNextCircuitForContribution = functions
961
- .region('europe-west1')
977
+ .region("europe-west1")
962
978
  .runWith({
963
979
  memory: "512MB"
964
980
  })
@@ -1005,7 +1021,7 @@ const progressToNextCircuitForContribution = functions
1005
1021
  * 5) Completed contribution computation and verification.
1006
1022
  */
1007
1023
  const progressToNextContributionStep = functions
1008
- .region('europe-west1')
1024
+ .region("europe-west1")
1009
1025
  .runWith({
1010
1026
  memory: "512MB"
1011
1027
  })
@@ -1056,7 +1072,7 @@ const progressToNextContributionStep = functions
1056
1072
  * @dev enable the current contributor to resume a contribution from where it had left off.
1057
1073
  */
1058
1074
  const permanentlyStoreCurrentContributionTimeAndHash = functions
1059
- .region('europe-west1')
1075
+ .region("europe-west1")
1060
1076
  .runWith({
1061
1077
  memory: "512MB"
1062
1078
  })
@@ -1098,7 +1114,7 @@ const permanentlyStoreCurrentContributionTimeAndHash = functions
1098
1114
  * @dev enable the current contributor to resume a multi-part upload from where it had left off.
1099
1115
  */
1100
1116
  const temporaryStoreCurrentContributionMultiPartUploadId = functions
1101
- .region('europe-west1')
1117
+ .region("europe-west1")
1102
1118
  .runWith({
1103
1119
  memory: "512MB"
1104
1120
  })
@@ -1136,7 +1152,7 @@ const temporaryStoreCurrentContributionMultiPartUploadId = functions
1136
1152
  * @dev enable the current contributor to resume a multi-part upload from where it had left off.
1137
1153
  */
1138
1154
  const temporaryStoreCurrentContributionUploadedChunkData = functions
1139
- .region('europe-west1')
1155
+ .region("europe-west1")
1140
1156
  .runWith({
1141
1157
  memory: "512MB"
1142
1158
  })
@@ -1178,7 +1194,7 @@ const temporaryStoreCurrentContributionUploadedChunkData = functions
1178
1194
  * contributed to every selected ceremony circuits (= DONE).
1179
1195
  */
1180
1196
  const checkAndPrepareCoordinatorForFinalization = functions
1181
- .region('europe-west1')
1197
+ .region("europe-west1")
1182
1198
  .runWith({
1183
1199
  memory: "512MB"
1184
1200
  })
@@ -1269,6 +1285,7 @@ const coordinate = async (participant, circuit, isSingleParticipantCoordination,
1269
1285
  printLog(`Coordinate - executing scenario A - single - participantResumingAfterTimeoutExpiration`, LogLevel.DEBUG);
1270
1286
  newParticipantStatus = "CONTRIBUTING" /* ParticipantStatus.CONTRIBUTING */;
1271
1287
  newContributionStep = "DOWNLOADING" /* ParticipantContributionStep.DOWNLOADING */;
1288
+ newCurrentContributorId = participant.id;
1272
1289
  }
1273
1290
  // Scenario (B).
1274
1291
  else if (participantIsNotCurrentContributor) {
@@ -1329,39 +1346,54 @@ const coordinate = async (participant, circuit, isSingleParticipantCoordination,
1329
1346
  * Wait until the command has completed its execution inside the VM.
1330
1347
  * @dev this method implements a custom interval to check 5 times after 1 minute if the command execution
1331
1348
  * has been completed or not by calling the `retrieveCommandStatus` method.
1332
- * @param {any} resolve the promise.
1333
- * @param {any} reject the promise.
1334
1349
  * @param {SSMClient} ssm the SSM client.
1335
1350
  * @param {string} vmInstanceId the unique identifier of the VM instance.
1336
1351
  * @param {string} commandId the unique identifier of the VM command.
1337
1352
  * @returns <Promise<void>> true when the command execution succeed; otherwise false.
1338
1353
  */
1339
- const waitForVMCommandExecution = (resolve, reject, ssm, vmInstanceId, commandId) => {
1340
- const interval = setInterval(async () => {
1354
+ const waitForVMCommandExecution = (ssm, vmInstanceId, commandId) => new Promise((resolve, reject) => {
1355
+ const poll = async () => {
1341
1356
  try {
1342
1357
  // Get command status.
1343
1358
  const cmdStatus = await retrieveCommandStatus(ssm, vmInstanceId, commandId);
1344
1359
  printLog(`Checking command ${commandId} status => ${cmdStatus}`, LogLevel.DEBUG);
1345
- if (cmdStatus === CommandInvocationStatus.SUCCESS) {
1346
- printLog(`Command ${commandId} successfully completed`, LogLevel.DEBUG);
1347
- // Resolve the promise.
1348
- resolve();
1349
- }
1350
- else if (cmdStatus === CommandInvocationStatus.FAILED) {
1351
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_FAILED_COMMAND_EXECUTION);
1352
- reject();
1353
- }
1354
- else if (cmdStatus === CommandInvocationStatus.TIMED_OUT) {
1355
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_TIMEDOUT_COMMAND_EXECUTION);
1356
- reject();
1357
- }
1358
- else if (cmdStatus === CommandInvocationStatus.CANCELLED) {
1359
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_CANCELLED_COMMAND_EXECUTION);
1360
- reject();
1360
+ let error;
1361
+ switch (cmdStatus) {
1362
+ case CommandInvocationStatus.CANCELLING:
1363
+ case CommandInvocationStatus.CANCELLED: {
1364
+ error = SPECIFIC_ERRORS.SE_VM_CANCELLED_COMMAND_EXECUTION;
1365
+ break;
1366
+ }
1367
+ case CommandInvocationStatus.DELAYED: {
1368
+ error = SPECIFIC_ERRORS.SE_VM_DELAYED_COMMAND_EXECUTION;
1369
+ break;
1370
+ }
1371
+ case CommandInvocationStatus.FAILED: {
1372
+ error = SPECIFIC_ERRORS.SE_VM_FAILED_COMMAND_EXECUTION;
1373
+ break;
1374
+ }
1375
+ case CommandInvocationStatus.TIMED_OUT: {
1376
+ error = SPECIFIC_ERRORS.SE_VM_TIMEDOUT_COMMAND_EXECUTION;
1377
+ break;
1378
+ }
1379
+ case CommandInvocationStatus.IN_PROGRESS:
1380
+ case CommandInvocationStatus.PENDING: {
1381
+ // wait a minute and poll again
1382
+ setTimeout(poll, 60000);
1383
+ return;
1384
+ }
1385
+ case CommandInvocationStatus.SUCCESS: {
1386
+ printLog(`Command ${commandId} successfully completed`, LogLevel.DEBUG);
1387
+ // Resolve the promise.
1388
+ resolve();
1389
+ return;
1390
+ }
1391
+ default: {
1392
+ logAndThrowError(SPECIFIC_ERRORS.SE_VM_UNKNOWN_COMMAND_STATUS);
1393
+ }
1361
1394
  }
1362
- else if (cmdStatus === CommandInvocationStatus.DELAYED) {
1363
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_DELAYED_COMMAND_EXECUTION);
1364
- reject();
1395
+ if (error) {
1396
+ logAndThrowError(error);
1365
1397
  }
1366
1398
  }
1367
1399
  catch (error) {
@@ -1371,59 +1403,9 @@ const waitForVMCommandExecution = (resolve, reject, ssm, vmInstanceId, commandId
1371
1403
  // Reject the promise.
1372
1404
  reject();
1373
1405
  }
1374
- finally {
1375
- // Clear the interval.
1376
- clearInterval(interval);
1377
- }
1378
- }, 60000); // 1 minute.
1379
- };
1380
- /**
1381
- * Wait until the artifacts have been downloaded.
1382
- * @param {any} resolve the promise.
1383
- * @param {any} reject the promise.
1384
- * @param {string} potTempFilePath the tmp path to the locally downloaded pot file.
1385
- * @param {string} firstZkeyTempFilePath the tmp path to the locally downloaded first zkey file.
1386
- * @param {string} lastZkeyTempFilePath the tmp path to the locally downloaded last zkey file.
1387
- */
1388
- const waitForFileDownload = (resolve, reject, potTempFilePath, firstZkeyTempFilePath, lastZkeyTempFilePath, circuitId, participantId) => {
1389
- const maxWaitTime = 5 * 60 * 1000; // 5 minutes
1390
- // every second check if the file download was completed
1391
- const interval = setInterval(async () => {
1392
- printLog(`Verifying that the artifacts were downloaded for circuit ${circuitId} and participant ${participantId}`, LogLevel.DEBUG);
1393
- try {
1394
- // check if files have been downloaded
1395
- if (!fs.existsSync(potTempFilePath)) {
1396
- printLog(`Pot file not found at ${potTempFilePath}`, LogLevel.DEBUG);
1397
- }
1398
- if (!fs.existsSync(firstZkeyTempFilePath)) {
1399
- printLog(`First zkey file not found at ${firstZkeyTempFilePath}`, LogLevel.DEBUG);
1400
- }
1401
- if (!fs.existsSync(lastZkeyTempFilePath)) {
1402
- printLog(`Last zkey file not found at ${lastZkeyTempFilePath}`, LogLevel.DEBUG);
1403
- }
1404
- // if all files were downloaded
1405
- if (fs.existsSync(potTempFilePath) && fs.existsSync(firstZkeyTempFilePath) && fs.existsSync(lastZkeyTempFilePath)) {
1406
- printLog(`All required files are present on disk.`, LogLevel.INFO);
1407
- // resolve the promise
1408
- resolve();
1409
- }
1410
- }
1411
- catch (error) {
1412
- // if we have an error then we print it as a warning and reject
1413
- printLog(`Error while downloading files: ${error}`, LogLevel.WARN);
1414
- reject();
1415
- }
1416
- finally {
1417
- printLog(`Clearing the interval for file download. Circuit ${circuitId} and participant ${participantId}`, LogLevel.DEBUG);
1418
- clearInterval(interval);
1419
- }
1420
- }, 5000);
1421
- // we want to clean in 5 minutes in case
1422
- setTimeout(() => {
1423
- clearInterval(interval);
1424
- reject(new Error('Timeout exceeded while waiting for files to be downloaded.'));
1425
- }, maxWaitTime);
1426
- };
1406
+ };
1407
+ setTimeout(poll, 60000);
1408
+ });
1427
1409
  /**
1428
1410
  * This method is used to coordinate the waiting queues of ceremony circuits.
1429
1411
  * @dev this cloud function is triggered whenever an update of a document related to a participant of a ceremony occurs.
@@ -1444,7 +1426,7 @@ const waitForFileDownload = (resolve, reject, potTempFilePath, firstZkeyTempFile
1444
1426
  * - Just completed a contribution or all contributions for each circuit. If yes, coordinate (multi-participant scenario).
1445
1427
  */
1446
1428
  const coordinateCeremonyParticipant = functionsV1
1447
- .region('europe-west1')
1429
+ .region("europe-west1")
1448
1430
  .runWith({
1449
1431
  memory: "512MB"
1450
1432
  })
@@ -1547,7 +1529,7 @@ const checkIfVMRunning = async (ec2, vmInstanceId, attempts = 5) => {
1547
1529
  * 1.A.4.C.1) If true, update circuit waiting for queue and average timings accordingly to contribution verification results;
1548
1530
  * 2) Send all updates atomically to the Firestore database.
1549
1531
  */
1550
- const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSeconds: 3600, region: 'europe-west1' }, async (request) => {
1532
+ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSeconds: 3600, region: "europe-west1" }, async (request) => {
1551
1533
  if (!request.auth || (!request.auth.token.participant && !request.auth.token.coordinator))
1552
1534
  logAndThrowError(SPECIFIC_ERRORS.SE_AUTH_NO_CURRENT_AUTH_USER);
1553
1535
  if (!request.data.ceremonyId ||
@@ -1658,8 +1640,6 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1658
1640
  lastZkeyBlake2bHash = match.at(0);
1659
1641
  // re upload the formatted verification transcript
1660
1642
  await uploadFileToBucket(bucketName, verificationTranscriptStoragePathAndFilename, verificationTranscriptTemporaryLocalPath, true);
1661
- // Stop VM instance.
1662
- await stopEC2Instance(ec2, vmInstanceId);
1663
1643
  }
1664
1644
  else {
1665
1645
  // Upload verification transcript.
@@ -1720,6 +1700,9 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1720
1700
  lastUpdated: getCurrentServerTimestampInMillis()
1721
1701
  });
1722
1702
  }
1703
+ // Stop VM instance
1704
+ if (isUsingVM)
1705
+ await stopEC2Instance(ec2, vmInstanceId);
1723
1706
  // Step (1.A.4.C)
1724
1707
  if (!isFinalizing) {
1725
1708
  // Step (1.A.4.C.1)
@@ -1735,6 +1718,8 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1735
1718
  ? (avgVerifyCloudFunctionTime + verifyCloudFunctionTime) / 2
1736
1719
  : verifyCloudFunctionTime;
1737
1720
  // Prepare tx to update circuit average contribution/verification time.
1721
+ const updatedCircuitDoc = await getDocumentById(getCircuitsCollectionPath(ceremonyId), circuitId);
1722
+ const { waitingQueue: updatedWaitingQueue } = updatedCircuitDoc.data();
1738
1723
  /// @dev this must happen only for valid contributions.
1739
1724
  batch.update(circuitDoc.ref, {
1740
1725
  avgTimings: {
@@ -1747,7 +1732,7 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1747
1732
  : avgVerifyCloudFunctionTime
1748
1733
  },
1749
1734
  waitingQueue: {
1750
- ...waitingQueue,
1735
+ ...updatedWaitingQueue,
1751
1736
  completedContributions: isContributionValid
1752
1737
  ? completedContributions + 1
1753
1738
  : completedContributions,
@@ -1782,7 +1767,7 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1782
1767
  commandId = await runCommandUsingSSM(ssm, vmInstanceId, verificationCommand);
1783
1768
  printLog(`Starting the execution of command ${commandId}`, LogLevel.DEBUG);
1784
1769
  // Step (1.A.3.3).
1785
- return new Promise((resolve, reject) => waitForVMCommandExecution(resolve, reject, ssm, vmInstanceId, commandId))
1770
+ return waitForVMCommandExecution(ssm, vmInstanceId, commandId)
1786
1771
  .then(async () => {
1787
1772
  // Command execution successfully completed.
1788
1773
  printLog(`Command ${commandId} execution has been successfully completed`, LogLevel.DEBUG);
@@ -1794,52 +1779,38 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1794
1779
  logAndThrowError(COMMON_ERRORS.CM_INVALID_COMMAND_EXECUTION);
1795
1780
  });
1796
1781
  }
1797
- else {
1798
- // CF approach.
1799
- printLog(`CF mechanism`, LogLevel.DEBUG);
1800
- const potStoragePath = getPotStorageFilePath(files.potFilename);
1801
- const firstZkeyStoragePath = getZkeyStorageFilePath(prefix, `${prefix}_${genesisZkeyIndex}.zkey`);
1802
- // Prepare temporary file paths.
1803
- // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
1804
- verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath(verificationTranscriptCompleteFilename);
1805
- const potTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}.pot`);
1806
- const firstZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_genesis.zkey`);
1807
- const lastZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_last.zkey`);
1808
- // Create and populate transcript.
1809
- const transcriptLogger = createCustomLoggerForFile(verificationTranscriptTemporaryLocalPath);
1810
- transcriptLogger.info(`${isFinalizing ? `Final verification` : `Verification`} transcript for ${prefix} circuit Phase 2 contribution.\n${isFinalizing ? `Coordinator ` : `Contributor # ${Number(lastZkeyIndex)}`} (${contributorOrCoordinatorIdentifier})\n`);
1811
- // Step (1.A.2).
1812
- await downloadArtifactFromS3Bucket(bucketName, potStoragePath, potTempFilePath);
1813
- await downloadArtifactFromS3Bucket(bucketName, firstZkeyStoragePath, firstZkeyTempFilePath);
1814
- await downloadArtifactFromS3Bucket(bucketName, lastZkeyStoragePath, lastZkeyTempFilePath);
1815
- await sleep(6000);
1816
- // wait until the files are actually downloaded
1817
- return new Promise((resolve, reject) => waitForFileDownload(resolve, reject, potTempFilePath, firstZkeyTempFilePath, lastZkeyTempFilePath, circuitId, participantDoc.id))
1818
- .then(async () => {
1819
- printLog(`Downloads from AWS S3 bucket completed - ceremony ${ceremonyId} circuit ${circuitId}`, LogLevel.DEBUG);
1820
- // Step (1.A.4).
1821
- isContributionValid = await zKey.verifyFromInit(firstZkeyTempFilePath, potTempFilePath, lastZkeyTempFilePath, transcriptLogger);
1822
- // Compute contribution hash.
1823
- lastZkeyBlake2bHash = await blake512FromPath(lastZkeyTempFilePath);
1824
- // Free resources by unlinking temporary folders.
1825
- // Do not free-up verification transcript path here.
1826
- try {
1827
- fs.unlinkSync(potTempFilePath);
1828
- fs.unlinkSync(firstZkeyTempFilePath);
1829
- fs.unlinkSync(lastZkeyTempFilePath);
1830
- }
1831
- catch (error) {
1832
- printLog(`Error while unlinking temporary files - Error ${error}`, LogLevel.WARN);
1833
- }
1834
- await completeVerification();
1835
- })
1836
- .catch((error) => {
1837
- // Throw the new error
1838
- const commonError = COMMON_ERRORS.CM_INVALID_REQUEST;
1839
- const additionalDetails = error.toString();
1840
- logAndThrowError(makeError(commonError.code, commonError.message, additionalDetails));
1841
- });
1782
+ // CF approach.
1783
+ printLog(`CF mechanism`, LogLevel.DEBUG);
1784
+ const potStoragePath = getPotStorageFilePath(files.potFilename);
1785
+ const firstZkeyStoragePath = getZkeyStorageFilePath(prefix, `${prefix}_${genesisZkeyIndex}.zkey`);
1786
+ // Prepare temporary file paths.
1787
+ // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
1788
+ verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath(verificationTranscriptCompleteFilename);
1789
+ const potTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}.pot`);
1790
+ const firstZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_genesis.zkey`);
1791
+ const lastZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_last.zkey`);
1792
+ // Create and populate transcript.
1793
+ const transcriptLogger = createCustomLoggerForFile(verificationTranscriptTemporaryLocalPath);
1794
+ transcriptLogger.info(`${isFinalizing ? `Final verification` : `Verification`} transcript for ${prefix} circuit Phase 2 contribution.\n${isFinalizing ? `Coordinator ` : `Contributor # ${Number(lastZkeyIndex)}`} (${contributorOrCoordinatorIdentifier})\n`);
1795
+ // Step (1.A.2).
1796
+ await downloadArtifactFromS3Bucket(bucketName, potStoragePath, potTempFilePath);
1797
+ await downloadArtifactFromS3Bucket(bucketName, firstZkeyStoragePath, firstZkeyTempFilePath);
1798
+ await downloadArtifactFromS3Bucket(bucketName, lastZkeyStoragePath, lastZkeyTempFilePath);
1799
+ // Step (1.A.4).
1800
+ isContributionValid = await zKey.verifyFromInit(firstZkeyTempFilePath, potTempFilePath, lastZkeyTempFilePath, transcriptLogger);
1801
+ // Compute contribution hash.
1802
+ lastZkeyBlake2bHash = await blake512FromPath(lastZkeyTempFilePath);
1803
+ // Free resources by unlinking temporary folders.
1804
+ // Do not free-up verification transcript path here.
1805
+ try {
1806
+ fs.unlinkSync(potTempFilePath);
1807
+ fs.unlinkSync(firstZkeyTempFilePath);
1808
+ fs.unlinkSync(lastZkeyTempFilePath);
1809
+ }
1810
+ catch (error) {
1811
+ printLog(`Error while unlinking temporary files - Error ${error}`, LogLevel.WARN);
1842
1812
  }
1813
+ await completeVerification();
1843
1814
  }
1844
1815
  });
1845
1816
  /**
@@ -1848,7 +1819,7 @@ const verifycontribution = functionsV2.https.onCall({ memory: "16GiB", timeoutSe
1848
1819
  * this does not happen if the participant is actually the coordinator who is finalizing the ceremony.
1849
1820
  */
1850
1821
  const refreshParticipantAfterContributionVerification = functionsV1
1851
- .region('europe-west1')
1822
+ .region("europe-west1")
1852
1823
  .runWith({
1853
1824
  memory: "512MB"
1854
1825
  })
@@ -1909,7 +1880,7 @@ const refreshParticipantAfterContributionVerification = functionsV1
1909
1880
  * and verification key extracted from the circuit final contribution (as part of the ceremony finalization process).
1910
1881
  */
1911
1882
  const finalizeCircuit = functionsV1
1912
- .region('europe-west1')
1883
+ .region("europe-west1")
1913
1884
  .runWith({
1914
1885
  memory: "512MB"
1915
1886
  })
@@ -2106,8 +2077,10 @@ const createBucket = functions
2106
2077
  CORSConfiguration: {
2107
2078
  CORSRules: [
2108
2079
  {
2109
- AllowedMethods: ["GET"],
2110
- AllowedOrigins: ["*"]
2080
+ AllowedMethods: ["GET", "PUT"],
2081
+ AllowedOrigins: ["*"],
2082
+ ExposeHeaders: ["ETag", "Content-Length"],
2083
+ AllowedHeaders: ["*"]
2111
2084
  }
2112
2085
  ]
2113
2086
  }
@@ -2500,7 +2473,7 @@ const checkAndRemoveBlockingContributor = functions
2500
2473
  // Prepare Firestore batch of txs.
2501
2474
  const batch = firestore.batch();
2502
2475
  // Remove current contributor from waiting queue.
2503
- contributors.shift(1);
2476
+ contributors.shift();
2504
2477
  // Check if someone else is ready to start the contribution.
2505
2478
  if (contributors.length > 0) {
2506
2479
  // Step (E.1).
@@ -2584,7 +2557,8 @@ const resumeContributionAfterTimeoutExpiration = functions
2584
2557
  if (status === "EXHUMED" /* ParticipantStatus.EXHUMED */)
2585
2558
  await participantDoc.ref.update({
2586
2559
  status: "READY" /* ParticipantStatus.READY */,
2587
- lastUpdated: getCurrentServerTimestampInMillis()
2560
+ lastUpdated: getCurrentServerTimestampInMillis(),
2561
+ tempContributionData: {}
2588
2562
  });
2589
2563
  else
2590
2564
  logAndThrowError(SPECIFIC_ERRORS.SE_CONTRIBUTE_CANNOT_PROGRESS_TO_NEXT_CIRCUIT);
@@ -1 +1 @@
1
- {"version":3,"file":"ceremony.d.ts","sourceRoot":"","sources":["../../../src/functions/ceremony.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAuC/C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,kCAiBpB,CAAA;AAEN;;;;;GAKG;AACH,eAAO,MAAM,YAAY,kCAkBnB,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,aAAa,mDAyHpB,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,+BAA+B,oEAsCtC,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,mDAiEvB,CAAA"}
1
+ {"version":3,"file":"ceremony.d.ts","sourceRoot":"","sources":["../../../src/functions/ceremony.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAuC/C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,kCAiBpB,CAAA;AAEN;;;;;GAKG;AACH,eAAO,MAAM,YAAY,kCAkBnB,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,aAAa,mDA8HpB,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,+BAA+B,oEAsCtC,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,mDAiEvB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"circuit.d.ts","sourceRoot":"","sources":["../../../src/functions/circuit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAA;AACpD,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAA;AAyCpD,OAAO,EAAuB,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAyR5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,4FAoGpC,CAAA;AA8BN;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,kBAAkB,0EAya9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,+CAA+C,wEA4EtD,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,eAAe,uDA8EtB,CAAA"}
1
+ {"version":3,"file":"circuit.d.ts","sourceRoot":"","sources":["../../../src/functions/circuit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAA;AACpD,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAA;AAyCpD,OAAO,EAAuB,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAiP5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,4FAoGpC,CAAA;AAyBN;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,kBAAkB,0EAsZ9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,+CAA+C,wEA4EtD,CAAA;AAEN;;;;GAIG;AACH,eAAO,MAAM,eAAe,uDA8EtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/functions/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAiI/C;;;GAGG;AACH,eAAO,MAAM,YAAY,mDAgGnB,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mDAgDzB,CAAA;AAEN;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,mDAyCpC,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mDA2D3B,CAAA;AAEN;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,mDAuElC,CAAA;AAEL;;;GAGG;AACH,eAAO,MAAM,uBAAuB,mDAgE9B,CAAA"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/functions/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAiI/C;;;GAGG;AACH,eAAO,MAAM,YAAY,mDAkGnB,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mDAgDzB,CAAA;AAEN;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,mDAyCpC,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mDA2D3B,CAAA;AAEN;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,mDAuElC,CAAA;AAEL;;;GAGG;AACH,eAAO,MAAM,uBAAuB,mDAgE9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/functions/timeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAuB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iCAAiC,kCA6MxC,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,wCAAwC,mDAyC/C,CAAA"}
1
+ {"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/functions/timeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAuB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iCAAiC,kCA6MxC,CAAA;AAEN;;;GAGG;AACH,eAAO,MAAM,wCAAwC,mDA0C/C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/functions/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAW/C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,mEAuFvB,CAAA;AACN;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,mEA+BpC,CAAA"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/functions/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAW/C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,mEA+GvB,CAAA;AACN;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,mEA+BpC,CAAA"}
@@ -55,6 +55,7 @@ export declare const SPECIFIC_ERRORS: {
55
55
  SE_VM_TIMEDOUT_COMMAND_EXECUTION: functions.auth.HttpsError;
56
56
  SE_VM_CANCELLED_COMMAND_EXECUTION: functions.auth.HttpsError;
57
57
  SE_VM_DELAYED_COMMAND_EXECUTION: functions.auth.HttpsError;
58
+ SE_VM_UNKNOWN_COMMAND_STATUS: functions.auth.HttpsError;
58
59
  };
59
60
  /**
60
61
  * A set of common errors.
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,cAAe,kBAAkB,WAAW,MAAM,YAAY,MAAM,KAAG,UAC9B,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,YAAY,QAAQ,SAqB3D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,UAAU,UAGjD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkI3B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;CA2CzB,CAAA"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,cAAe,kBAAkB,WAAW,MAAM,YAAY,MAAM,KAAG,UAC9B,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,YAAY,QAAQ,SAqB3D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,UAAU,UAGjD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuI3B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;CA2CzB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { DocumentData, QuerySnapshot, DocumentSnapshot, QueryDocumentSnapshot, WhereFilterOp } from "firebase-admin/firestore";
2
2
  import admin from "firebase-admin";
3
- import { CircuitDocument } from "@p0tion/actions";
3
+ import { CircuitDocument } from "@devtion/actions";
4
4
  import { SSMClient } from "@aws-sdk/client-ssm";
5
5
  import { EC2Client } from "@aws-sdk/client-ec2";
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EAErB,aAAa,EAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAWlC,OAAO,EAOH,eAAe,EACl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MG;AACH,eAAO,MAAM,6BAA6B,UAC/B,MAAM,wBACS,OAAO,SACtB,aAAa,KACrB,QAAQ,MAAM,SAAS,cAAc,CAAC,MAAM,SAAS,aAAa,CAAC,CAYxD,CAAA;AAEd;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,eACjB,MAAM,aACP,MAAM,KAClB,QAAQ,sBAAsB,YAAY,CAAC,CAgB7C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,oBAAqB,eAAe,KAAG,eAKvE,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAO,GAarC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,GAkBlC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,QAAQ,SAAS,CAYzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,QAAQ,SAAS,CAYzD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,cAAqB,MAAM,KAAG,QAAQ,MAAM,CAQxE,CAAA"}
@@ -1,4 +1,4 @@
1
- import { CeremonyInputData, CircuitDocument, ETagWithPartNumber } from "@p0tion/actions";
1
+ import { CeremonyInputData, CircuitDocument, ETagWithPartNumber } from "@devtion/actions";
2
2
  /**
3
3
  * Group all the necessary data needed for running the `setupCeremony` cloud function.
4
4
  * @typedef {Object} SetupCeremonyData
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAExF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;CACnC,CAAA;AAED;;;;GAIG;AACH,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ED;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IACzD,UAAU,EAAE,MAAM,CAAA;IAClB,2BAA2B,EAAE,MAAM,CAAA;IACnC,gBAAgB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,kDAAkD,GAAG;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,kBAAkB,CAAA;CAC5B,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,kCAAkC,EAAE,MAAM,CAAA;CAC7C,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtion/backend",
3
- "version": "0.0.0-5d170d3",
3
+ "version": "0.0.0-7cfaa5d",
4
4
  "description": "MPC Phase 2 backend for Firebase services management",
5
5
  "repository": "git@github.com:privacy-scaling-explorations/p0tion.git",
6
6
  "homepage": "https://github.com/privacy-scaling-explorations/p0tion",
@@ -67,7 +67,7 @@
67
67
  "@aws-sdk/client-ssm": "^3.357.0",
68
68
  "@aws-sdk/middleware-endpoint": "^3.329.0",
69
69
  "@aws-sdk/s3-request-presigner": "^3.329.0",
70
- "@p0tion/actions": "^1.0.5",
70
+ "@devtion/actions": "latest",
71
71
  "blakejs": "^1.2.1",
72
72
  "dotenv": "^16.0.3",
73
73
  "ethers": "5.7.2",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "ff032e8717f4aac3f66730e0a256660c2e741505"
88
+ "gitHead": "53164d43af65410911da5fa33f1ac0cade724872"
89
89
  }