@devtion/actions 0.0.0-3df1645 → 0.0.0-477457c

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.
Files changed (51) hide show
  1. package/README.md +2 -2
  2. package/dist/index.mjs +353 -262
  3. package/dist/index.node.js +354 -261
  4. package/dist/types/src/helpers/authentication.d.ts.map +1 -1
  5. package/dist/types/src/helpers/constants.d.ts +5 -2
  6. package/dist/types/src/helpers/constants.d.ts.map +1 -1
  7. package/dist/types/src/helpers/contracts.d.ts.map +1 -1
  8. package/dist/types/src/helpers/crypto.d.ts.map +1 -1
  9. package/dist/types/src/helpers/database.d.ts +8 -0
  10. package/dist/types/src/helpers/database.d.ts.map +1 -1
  11. package/dist/types/src/helpers/functions.d.ts +2 -1
  12. package/dist/types/src/helpers/functions.d.ts.map +1 -1
  13. package/dist/types/src/helpers/security.d.ts +1 -1
  14. package/dist/types/src/helpers/security.d.ts.map +1 -1
  15. package/dist/types/src/helpers/services.d.ts.map +1 -1
  16. package/dist/types/src/helpers/storage.d.ts +1 -1
  17. package/dist/types/src/helpers/storage.d.ts.map +1 -1
  18. package/dist/types/src/helpers/utils.d.ts +33 -21
  19. package/dist/types/src/helpers/utils.d.ts.map +1 -1
  20. package/dist/types/src/helpers/verification.d.ts +3 -2
  21. package/dist/types/src/helpers/verification.d.ts.map +1 -1
  22. package/dist/types/src/helpers/vm.d.ts.map +1 -1
  23. package/dist/types/src/index.d.ts +2 -2
  24. package/dist/types/src/index.d.ts.map +1 -1
  25. package/dist/types/src/types/index.d.ts +9 -4
  26. package/dist/types/src/types/index.d.ts.map +1 -1
  27. package/dist/types/test/data/generators.d.ts +32 -0
  28. package/dist/types/test/data/generators.d.ts.map +1 -0
  29. package/dist/types/test/data/samples.d.ts +40 -0
  30. package/dist/types/test/data/samples.d.ts.map +1 -0
  31. package/dist/types/test/utils/authentication.d.ts +72 -0
  32. package/dist/types/test/utils/authentication.d.ts.map +1 -0
  33. package/dist/types/test/utils/configs.d.ts +52 -0
  34. package/dist/types/test/utils/configs.d.ts.map +1 -0
  35. package/dist/types/test/utils/index.d.ts +4 -0
  36. package/dist/types/test/utils/index.d.ts.map +1 -0
  37. package/dist/types/test/utils/storage.d.ts +126 -0
  38. package/dist/types/test/utils/storage.d.ts.map +1 -0
  39. package/package.json +7 -8
  40. package/src/helpers/constants.ts +40 -32
  41. package/src/helpers/contracts.ts +3 -3
  42. package/src/helpers/crypto.ts +5 -1
  43. package/src/helpers/database.ts +13 -0
  44. package/src/helpers/security.ts +8 -5
  45. package/src/helpers/services.ts +2 -2
  46. package/src/helpers/storage.ts +3 -3
  47. package/src/helpers/utils.ts +320 -255
  48. package/src/helpers/verification.ts +6 -6
  49. package/src/helpers/vm.ts +19 -4
  50. package/src/index.ts +3 -1
  51. package/src/types/index.ts +23 -3
@@ -1,4 +1,4 @@
1
- import { groth16, zKey } from "snarkjs"
1
+ import { CircuitSignals, Groth16Proof, PublicSignals, groth16, zKey } from "snarkjs"
2
2
  import fs from "fs"
3
3
  import { Firestore, where } from "firebase/firestore"
4
4
  import { Functions } from "firebase/functions"
@@ -61,7 +61,7 @@ export const verifyZKey = async (
61
61
  * @returns <Promise<object>> The proof
62
62
  */
63
63
  export const generateGROTH16Proof = async (
64
- circuitInput: object,
64
+ circuitInput: CircuitSignals,
65
65
  zkeyFilePath: string,
66
66
  wasmFilePath: string,
67
67
  logger?: any
@@ -88,8 +88,8 @@ export const generateGROTH16Proof = async (
88
88
  */
89
89
  export const verifyGROTH16Proof = async (
90
90
  verificationKeyPath: string,
91
- publicSignals: object,
92
- proof: object
91
+ publicSignals: PublicSignals,
92
+ proof: Groth16Proof
93
93
  ): Promise<boolean> => {
94
94
  const verificationKey = JSON.parse(fs.readFileSync(verificationKeyPath).toString())
95
95
  const success = await groth16.verify(verificationKey, publicSignals, proof)
@@ -182,8 +182,8 @@ export const generateZkeyFromScratch = async (
182
182
  await zKey.beacon(
183
183
  finalContributionZKeyLocalPath,
184
184
  zkeyLocalPath,
185
- coordinatorIdentifier,
186
- beacon,
185
+ coordinatorIdentifier!,
186
+ beacon!,
187
187
  numExpIterations,
188
188
  logger
189
189
  )
package/src/helpers/vm.ts CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  StopInstancesCommand,
6
6
  TerminateInstancesCommand,
7
7
  EC2Client,
8
- RunInstancesCommandInput
8
+ RunInstancesCommandInput,
9
+ _InstanceType
9
10
  } from "@aws-sdk/client-ec2"
10
11
  import {
11
12
  GetCommandInvocationCommand,
@@ -159,17 +160,18 @@ export const createEC2Instance = async (
159
160
  diskType: DiskTypeForVM
160
161
  ): Promise<EC2Instance> => {
161
162
  // Get the AWS variables.
162
- const { amiId, roleArn } = getAWSVariables()
163
+ const { amiId, instanceProfileArn } = getAWSVariables()
163
164
 
164
165
  // Parametrize the VM EC2 instance.
166
+ console.log("\nLAUNCHING AWS EC2 INSTANCE\n")
165
167
  const params: RunInstancesCommandInput = {
166
168
  ImageId: amiId,
167
- InstanceType: instanceType,
169
+ InstanceType: instanceType as _InstanceType,
168
170
  MaxCount: 1,
169
171
  MinCount: 1,
170
172
  // nb. to find this: iam -> roles -> role_name.
171
173
  IamInstanceProfile: {
172
- Arn: roleArn
174
+ Arn: instanceProfileArn
173
175
  },
174
176
  // nb. for running commands at the startup.
175
177
  UserData: Buffer.from(commands.join("\n")).toString("base64"),
@@ -195,6 +197,19 @@ export const createEC2Instance = async (
195
197
  {
196
198
  Key: "Initialized",
197
199
  Value: "false"
200
+ },
201
+ {
202
+ Key: "Project",
203
+ Value: "trusted-setup"
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ ResourceType: "volume",
209
+ Tags: [
210
+ {
211
+ Key: "Project",
212
+ Value: "trusted-setup"
198
213
  }
199
214
  ]
200
215
  }
package/src/index.ts CHANGED
@@ -23,6 +23,7 @@ export {
23
23
  getContributionsCollectionPath,
24
24
  getTimeoutsCollectionPath,
25
25
  getOpenedCeremonies,
26
+ getAllCeremonies,
26
27
  getCeremonyCircuits
27
28
  } from "./helpers/database"
28
29
  export {
@@ -51,7 +52,8 @@ export {
51
52
  ec2InstanceTag,
52
53
  vmConfigurationTypes,
53
54
  vmBootstrapScriptFilename,
54
- powersOfTauFiles
55
+ powersOfTauFiles,
56
+ contribHashRegex
55
57
  } from "./helpers/constants"
56
58
  export {
57
59
  extractPrefix,
@@ -17,14 +17,14 @@ import {
17
17
  * @property {string} accessKeyId - the key identifier related to S3 APIs.
18
18
  * @property {string} secretAccessKey - the secret access key related to S3 APIs.
19
19
  * @property {string} region - the region where your buckets are located.
20
- * @property {string} roleArn - the EC2 instance role to access S3.
20
+ * @property {string} instanceProfileArn - the EC2 instance profile the VM should use to access S3.
21
21
  * @property {string} amiId - the AWS AMI ID (default to Amazon Linux 2).
22
22
  */
23
23
  export type AWSVariables = {
24
24
  accessKeyId: string
25
25
  secretAccessKey: string
26
26
  region: string
27
- roleArn: string
27
+ instanceProfileArn: string
28
28
  amiId: string
29
29
  }
30
30
 
@@ -190,7 +190,7 @@ export type VMConfiguration = {
190
190
  /**
191
191
  * Group information about the circuit contribution verification mechanism.
192
192
  * @typedef {Object} CircuitContributionVerification
193
- * @property {CircuitContributionVerificationMechanism} cfOrVm - the mechanism choosen by the coordinator.
193
+ * @property {CircuitContributionVerificationMechanism} cfOrVm - the mechanism chosen by the coordinator.
194
194
  * @property {VMConfiguration} [vm] - the VM configuration specs.
195
195
  */
196
196
  export type CircuitContributionVerification = {
@@ -652,3 +652,23 @@ export type CeremonySetupTemplate = {
652
652
  CeremonySetupTemplateCircuitName
653
653
  >
654
654
  }
655
+
656
+ export type StringifiedBigInts =
657
+ | StringifiedBigInts[]
658
+ | string
659
+ | string[]
660
+ | string[][]
661
+ | string[][][]
662
+ | { [key: string]: StringifiedBigInts }
663
+ | null
664
+
665
+ export type BigIntVariants =
666
+ | BigIntVariants[]
667
+ | StringifiedBigInts
668
+ | bigint
669
+ | bigint[]
670
+ | bigint[][]
671
+ | bigint[][][]
672
+ | { [key: string]: BigIntVariants }
673
+ | Uint8Array
674
+ | null