@devtion/actions 0.0.0-c749be4 → 0.0.0-e312890
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +122 -54
- package/dist/index.node.js +123 -53
- package/dist/types/src/helpers/constants.d.ts +5 -2
- package/dist/types/src/helpers/constants.d.ts.map +1 -1
- package/dist/types/src/helpers/contracts.d.ts.map +1 -1
- package/dist/types/src/helpers/crypto.d.ts +1 -0
- package/dist/types/src/helpers/crypto.d.ts.map +1 -1
- package/dist/types/src/helpers/database.d.ts +8 -0
- package/dist/types/src/helpers/database.d.ts.map +1 -1
- package/dist/types/src/helpers/utils.d.ts +15 -1
- package/dist/types/src/helpers/utils.d.ts.map +1 -1
- package/dist/types/src/helpers/verification.d.ts +3 -2
- package/dist/types/src/helpers/verification.d.ts.map +1 -1
- package/dist/types/src/helpers/vm.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +7 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/helpers/constants.ts +40 -32
- package/src/helpers/contracts.ts +3 -3
- package/src/helpers/database.ts +13 -0
- package/src/helpers/utils.ts +58 -13
- package/src/helpers/verification.ts +6 -6
- package/src/helpers/vm.ts +17 -2
- package/src/index.ts +3 -1
- package/src/types/index.ts +21 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module @p0tion/actions
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.2.5
|
|
4
4
|
* @file A set of actions and helpers for CLI commands
|
|
5
5
|
* @copyright Ethereum Foundation 2022
|
|
6
6
|
* @license MIT
|
|
@@ -15,7 +15,6 @@ import { onSnapshot, query, collection, getDocs, doc, getDoc, where, Timestamp,
|
|
|
15
15
|
import { zKey, groth16 } from 'snarkjs';
|
|
16
16
|
import crypto from 'crypto';
|
|
17
17
|
import blake from 'blakejs';
|
|
18
|
-
import { utils } from 'ffjavascript';
|
|
19
18
|
import winston from 'winston';
|
|
20
19
|
import { pipeline } from 'stream';
|
|
21
20
|
import { promisify } from 'util';
|
|
@@ -27,10 +26,10 @@ import { EC2Client, RunInstancesCommand, DescribeInstanceStatusCommand, StartIns
|
|
|
27
26
|
import { SSMClient, SendCommandCommand, GetCommandInvocationCommand } from '@aws-sdk/client-ssm';
|
|
28
27
|
import dotenv from 'dotenv';
|
|
29
28
|
|
|
30
|
-
// Main part for the
|
|
31
|
-
const potFileDownloadMainUrl = `https://
|
|
32
|
-
// Main part for the
|
|
33
|
-
const potFilenameTemplate = `
|
|
29
|
+
// Main part for the PPoT Phase 1 Trusted Setup URLs to download PoT files.
|
|
30
|
+
const potFileDownloadMainUrl = `https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/`;
|
|
31
|
+
// Main part for the PPoT Phase 1 Trusted Setup PoT files to be downloaded.
|
|
32
|
+
const potFilenameTemplate = `ppot_0080_`;
|
|
34
33
|
// The genesis zKey index.
|
|
35
34
|
const genesisZkeyIndex = `00000`;
|
|
36
35
|
// The number of exponential iterations to be executed by SnarkJS when finalizing the ceremony.
|
|
@@ -47,6 +46,8 @@ const verifierSmartContractAcronym = "verifier";
|
|
|
47
46
|
const ec2InstanceTag = "p0tionec2instance";
|
|
48
47
|
// The name of the VM startup script file.
|
|
49
48
|
const vmBootstrapScriptFilename = "bootstrap.sh";
|
|
49
|
+
// Match hash output by snarkjs in transcript log
|
|
50
|
+
const contribHashRegex = new RegExp("Contribution.+Hash.+\n\t\t.+\n\t\t.+\n.+\n\t\t.+\r?\n");
|
|
50
51
|
/**
|
|
51
52
|
* Define the supported VM configuration types.
|
|
52
53
|
* @dev the VM configurations can be retrieved at https://aws.amazon.com/ec2/instance-types/
|
|
@@ -104,112 +105,116 @@ const vmConfigurationTypes = {
|
|
|
104
105
|
*/
|
|
105
106
|
const powersOfTauFiles = [
|
|
106
107
|
{
|
|
107
|
-
ref: "https://
|
|
108
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_01.ptau",
|
|
108
109
|
size: 0.000084
|
|
109
110
|
},
|
|
110
111
|
{
|
|
111
|
-
ref: "https://
|
|
112
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_02.ptau",
|
|
112
113
|
size: 0.000086
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
|
-
ref: "https://
|
|
116
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_03.ptau",
|
|
116
117
|
size: 0.000091
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
|
-
ref: "https://
|
|
120
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_04.ptau",
|
|
120
121
|
size: 0.0001
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
|
-
ref: "https://
|
|
124
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_05.ptau",
|
|
124
125
|
size: 0.000117
|
|
125
126
|
},
|
|
126
127
|
{
|
|
127
|
-
ref: "https://
|
|
128
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_06.ptau",
|
|
128
129
|
size: 0.000153
|
|
129
130
|
},
|
|
130
131
|
{
|
|
131
|
-
ref: "https://
|
|
132
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_07.ptau",
|
|
132
133
|
size: 0.000225
|
|
133
134
|
},
|
|
134
135
|
{
|
|
135
|
-
ref: "https://
|
|
136
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_08.ptau",
|
|
136
137
|
size: 0.0004
|
|
137
138
|
},
|
|
138
139
|
{
|
|
139
|
-
ref: "https://
|
|
140
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_09.ptau",
|
|
140
141
|
size: 0.000658
|
|
141
142
|
},
|
|
142
143
|
{
|
|
143
|
-
ref: "https://
|
|
144
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_10.ptau",
|
|
144
145
|
size: 0.0013
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
|
-
ref: "https://
|
|
148
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_11.ptau",
|
|
148
149
|
size: 0.0023
|
|
149
150
|
},
|
|
150
151
|
{
|
|
151
|
-
ref: "https://
|
|
152
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_12.ptau",
|
|
152
153
|
size: 0.0046
|
|
153
154
|
},
|
|
154
155
|
{
|
|
155
|
-
ref: "https://
|
|
156
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_13.ptau",
|
|
156
157
|
size: 0.0091
|
|
157
158
|
},
|
|
158
159
|
{
|
|
159
|
-
ref: "https://
|
|
160
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_14.ptau",
|
|
160
161
|
size: 0.0181
|
|
161
162
|
},
|
|
162
163
|
{
|
|
163
|
-
ref: "https://
|
|
164
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_15.ptau",
|
|
164
165
|
size: 0.0361
|
|
165
166
|
},
|
|
166
167
|
{
|
|
167
|
-
ref: "https://
|
|
168
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_16.ptau",
|
|
168
169
|
size: 0.0721
|
|
169
170
|
},
|
|
170
171
|
{
|
|
171
|
-
ref: "https://
|
|
172
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_17.ptau",
|
|
172
173
|
size: 0.144
|
|
173
174
|
},
|
|
174
175
|
{
|
|
175
|
-
ref: "https://
|
|
176
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_18.ptau",
|
|
176
177
|
size: 0.288
|
|
177
178
|
},
|
|
178
179
|
{
|
|
179
|
-
ref: "https://
|
|
180
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_19.ptau",
|
|
180
181
|
size: 0.576
|
|
181
182
|
},
|
|
182
183
|
{
|
|
183
|
-
ref: "https://
|
|
184
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_20.ptau",
|
|
184
185
|
size: 1.1
|
|
185
186
|
},
|
|
186
187
|
{
|
|
187
|
-
ref: "https://
|
|
188
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_21.ptau",
|
|
188
189
|
size: 2.3
|
|
189
190
|
},
|
|
190
191
|
{
|
|
191
|
-
ref: "https://
|
|
192
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_22.ptau",
|
|
192
193
|
size: 4.5
|
|
193
194
|
},
|
|
194
195
|
{
|
|
195
|
-
ref: "https://
|
|
196
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_23.ptau",
|
|
196
197
|
size: 9.0
|
|
197
198
|
},
|
|
198
199
|
{
|
|
199
|
-
ref: "https://
|
|
200
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_24.ptau",
|
|
200
201
|
size: 18.0
|
|
201
202
|
},
|
|
202
203
|
{
|
|
203
|
-
ref: "https://
|
|
204
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_25.ptau",
|
|
204
205
|
size: 36.0
|
|
205
206
|
},
|
|
206
207
|
{
|
|
207
|
-
ref: "https://
|
|
208
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_26.ptau",
|
|
208
209
|
size: 72.0
|
|
209
210
|
},
|
|
210
211
|
{
|
|
211
|
-
ref: "https://
|
|
212
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_27.ptau",
|
|
212
213
|
size: 144.0
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
ref: "https://pse-trusted-setup-ppot.s3.eu-central-1.amazonaws.com/pot28_0080/ppot_0080_final.ptau",
|
|
217
|
+
size: 288.0
|
|
213
218
|
}
|
|
214
219
|
];
|
|
215
220
|
/**
|
|
@@ -339,7 +344,9 @@ const commonTerms = {
|
|
|
339
344
|
finalizeCircuit: "finalizeCircuit",
|
|
340
345
|
finalizeCeremony: "finalizeCeremony",
|
|
341
346
|
downloadCircuitArtifacts: "downloadCircuitArtifacts",
|
|
342
|
-
transferObject: "transferObject"
|
|
347
|
+
transferObject: "transferObject",
|
|
348
|
+
bandadaValidateProof: "bandadaValidateProof",
|
|
349
|
+
checkNonceOfSIWEAddress: "checkNonceOfSIWEAddress"
|
|
343
350
|
}
|
|
344
351
|
};
|
|
345
352
|
|
|
@@ -705,8 +712,8 @@ const uploadParts = async (chunksWithUrls, contentType, cloudFunctions, ceremony
|
|
|
705
712
|
// @ts-ignore
|
|
706
713
|
const response = await fetch(chunksWithUrls[i].preSignedUrl, {
|
|
707
714
|
retryOptions: {
|
|
708
|
-
retryInitialDelay: 500,
|
|
709
|
-
socketTimeout: 60000,
|
|
715
|
+
retryInitialDelay: 500, // 500 ms.
|
|
716
|
+
socketTimeout: 60000, // 60 seconds.
|
|
710
717
|
retryMaxDuration: 300000 // 5 minutes.
|
|
711
718
|
},
|
|
712
719
|
method: "PUT",
|
|
@@ -1003,6 +1010,17 @@ const getClosedCeremonies = async (firestoreDatabase) => {
|
|
|
1003
1010
|
]);
|
|
1004
1011
|
return fromQueryToFirebaseDocumentInfo(closedCeremoniesQuerySnap.docs);
|
|
1005
1012
|
};
|
|
1013
|
+
/**
|
|
1014
|
+
* Query all ceremonies
|
|
1015
|
+
* @notice get all ceremonies from the database.
|
|
1016
|
+
* @dev this is a helper for the CLI ceremony methods.
|
|
1017
|
+
* @param firestoreDatabase <Firestore> - the Firestore service instance associated to the current Firebase application.
|
|
1018
|
+
* @returns <Promise<Array<FirebaseDocumentInfo>>> - the list of all ceremonies.
|
|
1019
|
+
*/
|
|
1020
|
+
const getAllCeremonies = async (firestoreDatabase) => {
|
|
1021
|
+
const ceremoniesQuerySnap = await queryCollection(firestoreDatabase, commonTerms.collections.ceremonies.name, []);
|
|
1022
|
+
return fromQueryToFirebaseDocumentInfo(ceremoniesQuerySnap.docs);
|
|
1023
|
+
};
|
|
1006
1024
|
|
|
1007
1025
|
/**
|
|
1008
1026
|
* @hidden
|
|
@@ -1262,6 +1280,41 @@ const readBytesFromFile = (localFilePath, offset, length, position) => {
|
|
|
1262
1280
|
// Return the read bytes.
|
|
1263
1281
|
return buffer;
|
|
1264
1282
|
};
|
|
1283
|
+
/**
|
|
1284
|
+
* Given a buffer in little endian format, convert it to bigint
|
|
1285
|
+
* @param buffer
|
|
1286
|
+
* @returns
|
|
1287
|
+
*/
|
|
1288
|
+
function leBufferToBigint(buffer) {
|
|
1289
|
+
return BigInt(`0x${buffer.reverse().toString("hex")}`);
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Given an input containing string values, convert them
|
|
1293
|
+
* to bigint
|
|
1294
|
+
* @param input - The input to convert
|
|
1295
|
+
* @returns the input with string values converted to bigint
|
|
1296
|
+
*/
|
|
1297
|
+
const unstringifyBigInts = (input) => {
|
|
1298
|
+
if (typeof input === "string" && /^[0-9]+$/.test(input)) {
|
|
1299
|
+
return BigInt(input);
|
|
1300
|
+
}
|
|
1301
|
+
if (typeof input === "string" && /^0x[0-9a-fA-F]+$/.test(input)) {
|
|
1302
|
+
return BigInt(input);
|
|
1303
|
+
}
|
|
1304
|
+
if (Array.isArray(input)) {
|
|
1305
|
+
return input.map(unstringifyBigInts);
|
|
1306
|
+
}
|
|
1307
|
+
if (input === null) {
|
|
1308
|
+
return null;
|
|
1309
|
+
}
|
|
1310
|
+
if (typeof input === "object") {
|
|
1311
|
+
return Object.entries(input).reduce((acc, [key, value]) => {
|
|
1312
|
+
acc[key] = unstringifyBigInts(value);
|
|
1313
|
+
return acc;
|
|
1314
|
+
}, {});
|
|
1315
|
+
}
|
|
1316
|
+
return input;
|
|
1317
|
+
};
|
|
1265
1318
|
/**
|
|
1266
1319
|
* Return the info about the R1CS file.ù
|
|
1267
1320
|
* @dev this method was built taking inspiration from
|
|
@@ -1322,17 +1375,17 @@ const getR1CSInfo = (localR1CSFilePath) => {
|
|
|
1322
1375
|
let constraints = 0;
|
|
1323
1376
|
try {
|
|
1324
1377
|
// Get 'number of section' (jump magic r1cs and version1 data).
|
|
1325
|
-
const numberOfSections =
|
|
1378
|
+
const numberOfSections = leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, 8));
|
|
1326
1379
|
// Jump to first section.
|
|
1327
1380
|
pointer = 12;
|
|
1328
1381
|
// For each section
|
|
1329
1382
|
for (let i = 0; i < numberOfSections; i++) {
|
|
1330
1383
|
// Read section type.
|
|
1331
|
-
const sectionType =
|
|
1384
|
+
const sectionType = leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer));
|
|
1332
1385
|
// Jump to section size.
|
|
1333
1386
|
pointer += 4;
|
|
1334
1387
|
// Read section size
|
|
1335
|
-
const sectionSize = Number(
|
|
1388
|
+
const sectionSize = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 8, pointer)));
|
|
1336
1389
|
// If at header section (0x00000001 : Header Section).
|
|
1337
1390
|
if (sectionType === BigInt(1)) {
|
|
1338
1391
|
// Read info from header section.
|
|
@@ -1364,22 +1417,22 @@ const getR1CSInfo = (localR1CSFilePath) => {
|
|
|
1364
1417
|
*/
|
|
1365
1418
|
pointer += sectionSize - 20;
|
|
1366
1419
|
// Read R1CS info.
|
|
1367
|
-
wires = Number(
|
|
1420
|
+
wires = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)));
|
|
1368
1421
|
pointer += 4;
|
|
1369
|
-
publicOutputs = Number(
|
|
1422
|
+
publicOutputs = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)));
|
|
1370
1423
|
pointer += 4;
|
|
1371
|
-
publicInputs = Number(
|
|
1424
|
+
publicInputs = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)));
|
|
1372
1425
|
pointer += 4;
|
|
1373
|
-
privateInputs = Number(
|
|
1426
|
+
privateInputs = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)));
|
|
1374
1427
|
pointer += 4;
|
|
1375
|
-
labels = Number(
|
|
1428
|
+
labels = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 8, pointer)));
|
|
1376
1429
|
pointer += 8;
|
|
1377
|
-
constraints = Number(
|
|
1430
|
+
constraints = Number(leBufferToBigint(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)));
|
|
1378
1431
|
}
|
|
1379
1432
|
pointer += 8 + Number(sectionSize);
|
|
1380
1433
|
}
|
|
1381
1434
|
return {
|
|
1382
|
-
curve: "bn-128",
|
|
1435
|
+
curve: "bn-128", /// @note currently default to bn-128 as we support only Groth16 proving system.
|
|
1383
1436
|
wires,
|
|
1384
1437
|
constraints,
|
|
1385
1438
|
privateInputs,
|
|
@@ -1558,9 +1611,10 @@ const parseCeremonyFile = async (path, cleanup = false) => {
|
|
|
1558
1611
|
}
|
|
1559
1612
|
circuits.push(circuit);
|
|
1560
1613
|
// remove the local r1cs and wasm downloads (if used for verifying the config only vs setup)
|
|
1561
|
-
if (cleanup)
|
|
1614
|
+
if (cleanup) {
|
|
1562
1615
|
fs.unlinkSync(localR1csPath);
|
|
1563
|
-
|
|
1616
|
+
fs.unlinkSync(localWasmPath);
|
|
1617
|
+
}
|
|
1564
1618
|
}
|
|
1565
1619
|
const setupData = {
|
|
1566
1620
|
ceremonyInputData: {
|
|
@@ -1926,11 +1980,11 @@ const p256 = (proofPart) => {
|
|
|
1926
1980
|
*/
|
|
1927
1981
|
const formatSolidityCalldata = (circuitInput, _proof) => {
|
|
1928
1982
|
try {
|
|
1929
|
-
const proof =
|
|
1983
|
+
const proof = unstringifyBigInts(_proof);
|
|
1930
1984
|
// format the public inputs to the circuit
|
|
1931
1985
|
const formattedCircuitInput = [];
|
|
1932
1986
|
for (const cInput of circuitInput) {
|
|
1933
|
-
formattedCircuitInput.push(p256(
|
|
1987
|
+
formattedCircuitInput.push(p256(unstringifyBigInts(cInput)));
|
|
1934
1988
|
}
|
|
1935
1989
|
// construct calldata
|
|
1936
1990
|
const calldata = {
|
|
@@ -2312,8 +2366,8 @@ const createSSMClient = async () => {
|
|
|
2312
2366
|
* @returns <Array<string>> - the list of startup commands to be executed.
|
|
2313
2367
|
*/
|
|
2314
2368
|
const vmBootstrapCommand = (bucketName) => [
|
|
2315
|
-
"#!/bin/bash",
|
|
2316
|
-
`aws s3 cp s3://${bucketName}/${vmBootstrapScriptFilename} ${vmBootstrapScriptFilename}`,
|
|
2369
|
+
"#!/bin/bash", // shabang.
|
|
2370
|
+
`aws s3 cp s3://${bucketName}/${vmBootstrapScriptFilename} ${vmBootstrapScriptFilename}`, // copy file from S3 bucket to VM.
|
|
2317
2371
|
`chmod +x ${vmBootstrapScriptFilename} && bash ${vmBootstrapScriptFilename}` // grant permission and execute.
|
|
2318
2372
|
];
|
|
2319
2373
|
/**
|
|
@@ -2388,6 +2442,7 @@ const createEC2Instance = async (ec2, commands, instanceType, volumeSize, diskTy
|
|
|
2388
2442
|
// Get the AWS variables.
|
|
2389
2443
|
const { amiId, instanceProfileArn } = getAWSVariables();
|
|
2390
2444
|
// Parametrize the VM EC2 instance.
|
|
2445
|
+
console.log("\nLAUNCHING AWS EC2 INSTANCE\n");
|
|
2391
2446
|
const params = {
|
|
2392
2447
|
ImageId: amiId,
|
|
2393
2448
|
InstanceType: instanceType,
|
|
@@ -2404,7 +2459,7 @@ const createEC2Instance = async (ec2, commands, instanceType, volumeSize, diskTy
|
|
|
2404
2459
|
DeviceName: "/dev/xvda",
|
|
2405
2460
|
Ebs: {
|
|
2406
2461
|
DeleteOnTermination: true,
|
|
2407
|
-
VolumeSize: volumeSize,
|
|
2462
|
+
VolumeSize: volumeSize, // disk size in GB.
|
|
2408
2463
|
VolumeType: diskType
|
|
2409
2464
|
}
|
|
2410
2465
|
}
|
|
@@ -2421,6 +2476,19 @@ const createEC2Instance = async (ec2, commands, instanceType, volumeSize, diskTy
|
|
|
2421
2476
|
{
|
|
2422
2477
|
Key: "Initialized",
|
|
2423
2478
|
Value: "false"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
Key: "ProjectName",
|
|
2482
|
+
Value: "trusted-setup"
|
|
2483
|
+
}
|
|
2484
|
+
]
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
ResourceType: "volume",
|
|
2488
|
+
Tags: [
|
|
2489
|
+
{
|
|
2490
|
+
Key: "ProjectName",
|
|
2491
|
+
Value: "trusted-setup"
|
|
2424
2492
|
}
|
|
2425
2493
|
]
|
|
2426
2494
|
}
|
|
@@ -2590,4 +2658,4 @@ const retrieveCommandStatus = async (ssm, instanceId, commandId) => {
|
|
|
2590
2658
|
}
|
|
2591
2659
|
};
|
|
2592
2660
|
|
|
2593
|
-
export { CeremonyState, CeremonyTimeoutType, CeremonyType, CircuitContributionVerificationMechanism, DiskTypeForVM, ParticipantContributionStep, ParticipantStatus, RequestType, TestingEnvironment, TimeoutType, autoGenerateEntropy, blake512FromPath, checkAndPrepareCoordinatorForFinalization, checkIfObjectExist, checkIfRunning, checkParticipantForCeremony, commonTerms, compareCeremonyArtifacts, compareHashes, compileContract, completeMultiPartUpload, computeDiskSizeForVM, computeSHA256ToHex, computeSmallestPowersOfTauForCircuit, convertBytesOrKbToGb, convertToDoubleDigits, createCustomLoggerForFile, createEC2Client, createEC2Instance, createS3Bucket, createSSMClient, downloadAllCeremonyArtifacts, downloadCeremonyArtifact, ec2InstanceTag, exportVerifierAndVKey, exportVerifierContract, exportVkey, extractPoTFromFilename, extractPrefix, extractR1CSInfoValueForGivenKey, finalContributionIndex, finalizeCeremony, finalizeCircuit, formatSolidityCalldata, formatZkeyIndex, fromQueryToFirebaseDocumentInfo, generateGROTH16Proof, generateGetObjectPreSignedUrl, generatePreSignedUrlsParts, generateValidContributionsAttestation, generateZkeyFromScratch, genesisZkeyIndex, getAllCollectionDocs, getBucketName, getCeremonyCircuits, getCircuitBySequencePosition, getCircuitContributionsFromContributor, getCircuitsCollectionPath, getClosedCeremonies, getContributionsCollectionPath, getContributionsValidityForContributor, getCurrentActiveParticipantTimeout, getCurrentFirebaseAuthUser, getDocumentById, getOpenedCeremonies, getParticipantsCollectionPath, getPotStorageFilePath, getPublicAttestationPreambleForContributor, getR1CSInfo, getR1csStorageFilePath, getTimeoutsCollectionPath, getTranscriptStorageFilePath, getVerificationKeyStorageFilePath, getVerifierContractStorageFilePath, getWasmStorageFilePath, getZkeyStorageFilePath, githubReputation, initializeFirebaseCoreServices, isCoordinator, multiPartUpload, numExpIterations, p256, parseCeremonyFile, permanentlyStoreCurrentContributionTimeAndHash, potFileDownloadMainUrl, potFilenameTemplate, powersOfTauFiles, progressToNextCircuitForContribution, progressToNextContributionStep, queryCollection, resumeContributionAfterTimeoutExpiration, retrieveCommandOutput, retrieveCommandStatus, runCommandUsingSSM, setupCeremony, signInToFirebaseWithCredentials, solidityVersion, startEC2Instance, stopEC2Instance, temporaryStoreCurrentContributionMultiPartUploadId, temporaryStoreCurrentContributionUploadedChunkData, terminateEC2Instance, toHex, verificationKeyAcronym, verifierSmartContractAcronym, verifyCeremony, verifyContribution, verifyGROTH16Proof, verifyGROTH16ProofOnChain, verifyZKey, vmBootstrapCommand, vmBootstrapScriptFilename, vmConfigurationTypes, vmContributionVerificationCommand, vmDependenciesAndCacheArtifactsCommand };
|
|
2661
|
+
export { CeremonyState, CeremonyTimeoutType, CeremonyType, CircuitContributionVerificationMechanism, DiskTypeForVM, ParticipantContributionStep, ParticipantStatus, RequestType, TestingEnvironment, TimeoutType, autoGenerateEntropy, blake512FromPath, checkAndPrepareCoordinatorForFinalization, checkIfObjectExist, checkIfRunning, checkParticipantForCeremony, commonTerms, compareCeremonyArtifacts, compareHashes, compileContract, completeMultiPartUpload, computeDiskSizeForVM, computeSHA256ToHex, computeSmallestPowersOfTauForCircuit, contribHashRegex, convertBytesOrKbToGb, convertToDoubleDigits, createCustomLoggerForFile, createEC2Client, createEC2Instance, createS3Bucket, createSSMClient, downloadAllCeremonyArtifacts, downloadCeremonyArtifact, ec2InstanceTag, exportVerifierAndVKey, exportVerifierContract, exportVkey, extractPoTFromFilename, extractPrefix, extractR1CSInfoValueForGivenKey, finalContributionIndex, finalizeCeremony, finalizeCircuit, formatSolidityCalldata, formatZkeyIndex, fromQueryToFirebaseDocumentInfo, generateGROTH16Proof, generateGetObjectPreSignedUrl, generatePreSignedUrlsParts, generateValidContributionsAttestation, generateZkeyFromScratch, genesisZkeyIndex, getAllCeremonies, getAllCollectionDocs, getBucketName, getCeremonyCircuits, getCircuitBySequencePosition, getCircuitContributionsFromContributor, getCircuitsCollectionPath, getClosedCeremonies, getContributionsCollectionPath, getContributionsValidityForContributor, getCurrentActiveParticipantTimeout, getCurrentFirebaseAuthUser, getDocumentById, getOpenedCeremonies, getParticipantsCollectionPath, getPotStorageFilePath, getPublicAttestationPreambleForContributor, getR1CSInfo, getR1csStorageFilePath, getTimeoutsCollectionPath, getTranscriptStorageFilePath, getVerificationKeyStorageFilePath, getVerifierContractStorageFilePath, getWasmStorageFilePath, getZkeyStorageFilePath, githubReputation, initializeFirebaseCoreServices, isCoordinator, multiPartUpload, numExpIterations, p256, parseCeremonyFile, permanentlyStoreCurrentContributionTimeAndHash, potFileDownloadMainUrl, potFilenameTemplate, powersOfTauFiles, progressToNextCircuitForContribution, progressToNextContributionStep, queryCollection, resumeContributionAfterTimeoutExpiration, retrieveCommandOutput, retrieveCommandStatus, runCommandUsingSSM, setupCeremony, signInToFirebaseWithCredentials, solidityVersion, startEC2Instance, stopEC2Instance, temporaryStoreCurrentContributionMultiPartUploadId, temporaryStoreCurrentContributionUploadedChunkData, terminateEC2Instance, toHex, verificationKeyAcronym, verifierSmartContractAcronym, verifyCeremony, verifyContribution, verifyGROTH16Proof, verifyGROTH16ProofOnChain, verifyZKey, vmBootstrapCommand, vmBootstrapScriptFilename, vmConfigurationTypes, vmContributionVerificationCommand, vmDependenciesAndCacheArtifactsCommand };
|