agoric 0.21.2-other-dev-8f8782b.0 → 0.21.2-other-dev-3eb1a1d.0

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/src/publish.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
- /// <reference types="ses"/>
2
+ /// <reference types="ses" />
3
3
 
4
+ import { X, q, Fail } from '@endo/errors';
4
5
  import { E } from '@endo/far';
5
6
 
6
7
  import {
@@ -14,7 +15,6 @@ import { defaultRegistryTypes } from '@cosmjs/stargate';
14
15
  import { stringToPath } from '@cosmjs/crypto';
15
16
  import { Decimal } from '@cosmjs/math';
16
17
  import { fromBech32 } from '@cosmjs/encoding';
17
-
18
18
  import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js';
19
19
 
20
20
  // https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go
@@ -38,6 +38,7 @@ const Agoric = {
38
38
  const hdPath = (coinType = 118, account = 0) =>
39
39
  stringToPath(`m/44'/${coinType}'/${account}'/0/0`);
40
40
 
41
+ // @ts-expect-error difference in private property _push
41
42
  const registry = new Registry([
42
43
  ...defaultRegistryTypes,
43
44
  [Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle],
@@ -82,8 +83,6 @@ const registry = new Registry([
82
83
  * @typedef {SourceBundle | HashBundle} Bundle
83
84
  */
84
85
 
85
- const { details: X, quote: q, Fail } = assert;
86
-
87
86
  /**
88
87
  * @template T
89
88
  * @param {Array<T>} array
@@ -96,7 +95,6 @@ const choose = (array, randomNumber) => {
96
95
  return array[index];
97
96
  };
98
97
 
99
- // eslint-disable-next-line jsdoc/require-returns-check
100
98
  /**
101
99
  * @param {unknown} connectionSpec
102
100
  * @returns {asserts connectionSpec is HttpConnectionSpec}
@@ -124,7 +122,6 @@ const assertHttpConnectionSpec = connectionSpec => {
124
122
  Fail`Expected integer "port" on "http" type connectionSpec, ${connectionSpec}`;
125
123
  };
126
124
 
127
- // eslint-disable-next-line jsdoc/require-returns-check
128
125
  /**
129
126
  * @param {unknown} connectionSpec
130
127
  * @returns {asserts connectionSpec is CosmosConnectionSpec}
@@ -289,14 +286,12 @@ export const makeCosmosBundlePublisher = ({
289
286
  const endpoint = urlForRpcAddress(rpcAddress);
290
287
 
291
288
  // AWAIT
292
- // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
293
289
  const stargateClient = await connectWithSigner(endpoint, wallet, {
294
290
  gasPrice: Agoric.gasPrice,
295
291
  registry,
296
292
  });
297
293
 
298
294
  // AWAIT
299
- // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
300
295
  const result = await stargateClient
301
296
  .signAndBroadcast(from.address, encodeObjects, Agoric.fee)
302
297
  .catch(error => {
@@ -312,7 +307,6 @@ export const makeCosmosBundlePublisher = ({
312
307
  }
313
308
 
314
309
  // AWAIT
315
- // eslint-disable-next-line no-await-in-loop,@jessie.js/no-nested-await
316
310
  await E(leader).jitter('agoric CLI deploy');
317
311
  }
318
312
 
@@ -426,6 +420,7 @@ const publishBundle = async (
426
420
  )}, publishBundle supports only "endoZipBase64" with "endoZipBase64Sha512"`;
427
421
  }
428
422
 
423
+ await null;
429
424
  if (connectionSpec === undefined && getDefaultConnection !== undefined) {
430
425
  connectionSpec = await getDefaultConnection();
431
426
  }
package/src/scripts.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- /* global process */
2
+ /* eslint-env node */
3
3
  import bundleSource from '@endo/bundle-source';
4
4
  import { E } from '@endo/captp';
5
5
  import { search as readContainingPackageDescriptor } from '@endo/compartment-mapper';
@@ -56,7 +56,7 @@ export const makeLookup =
56
56
 
57
57
  /**
58
58
  * @param {string[]} scripts
59
- * @param {{ allowUnsafePlugins: boolean, progname: string, rawArgs: string[], endowments?: Record<string, any> }} opts
59
+ * @param {{ allowUnsafePlugins?: boolean, progname: string, rawArgs: string[], endowments?: Record<string, any> }} opts
60
60
  * @param {{ fs: import('fs/promises'), console: Console }} powers
61
61
  */
62
62
  export const makeScriptLoader =
@@ -161,8 +161,17 @@ export { bootPlugin } from ${JSON.stringify(absPath)};
161
161
 
162
162
  const allEndowments = harden({
163
163
  home: bootP,
164
- bundleSource: (file, options = undefined) =>
165
- bundleSource(pathResolve(file), options),
164
+ /**
165
+ * @template {import('@endo/bundle-source').ModuleFormat} ModuleFormat
166
+ * @param {string} file
167
+ * @param {import('@endo/bundle-source').BundleOptions<ModuleFormat>} options
168
+ * @returns {Promise<import('@endo/bundle-source').BundleSourceResult<ModuleFormat>>}
169
+ */
170
+ bundleSource: (file, options = {}) =>
171
+ bundleSource(pathResolve(file), {
172
+ elideComments: true,
173
+ ...options,
174
+ }),
166
175
  ...endowments,
167
176
  pathResolve,
168
177
  installUnsafePlugin,
@@ -1,26 +1,33 @@
1
1
  // DO NOT EDIT - automatically generated by get-sdk-package-names.js
2
- /* eslint-disable comma-dangle,quotes */
3
2
  // prettier-ignore
4
3
  export default [
5
4
  "@agoric/access-token",
6
- "@agoric/assert",
5
+ "@agoric/async-flow",
6
+ "@agoric/base-zone",
7
+ "@agoric/benchmark",
8
+ "@agoric/boot",
9
+ "@agoric/builders",
7
10
  "@agoric/cache",
8
11
  "@agoric/casting",
12
+ "@agoric/client-utils",
9
13
  "@agoric/cosmic-proto",
10
14
  "@agoric/cosmic-swingset",
11
15
  "@agoric/cosmos",
16
+ "@agoric/create-dapp",
12
17
  "@agoric/deploy-script-support",
13
18
  "@agoric/deployment",
14
19
  "@agoric/ertp",
15
20
  "@agoric/eslint-config",
21
+ "@agoric/fast-usdc",
16
22
  "@agoric/governance",
17
23
  "@agoric/import-manager",
18
24
  "@agoric/inter-protocol",
19
25
  "@agoric/internal",
26
+ "@agoric/kmarshal",
27
+ "@agoric/network",
20
28
  "@agoric/notifier",
29
+ "@agoric/orchestration",
21
30
  "@agoric/pegasus",
22
- "@agoric/same-structure",
23
- "@agoric/sharing-service",
24
31
  "@agoric/smart-wallet",
25
32
  "@agoric/solo",
26
33
  "@agoric/sparse-ints",
@@ -34,13 +41,12 @@ export default [
34
41
  "@agoric/swingset-xsnap-supervisor",
35
42
  "@agoric/telemetry",
36
43
  "@agoric/time",
37
- "@agoric/ui-components",
38
44
  "@agoric/vat-data",
39
45
  "@agoric/vats",
46
+ "@agoric/vm-config",
47
+ "@agoric/vow",
40
48
  "@agoric/wallet",
41
49
  "@agoric/wallet-backend",
42
- "@agoric/wallet-connection",
43
- "@agoric/web-components",
44
50
  "@agoric/xsnap",
45
51
  "@agoric/xsnap-lockdown",
46
52
  "@agoric/zoe",
@@ -1,5 +1,5 @@
1
1
  import { basename } from 'path';
2
- import { Fail } from '@agoric/assert';
2
+ import { Fail } from '@endo/errors';
3
3
  import {
4
4
  finishCosmosApp,
5
5
  finishTendermintConfig,
@@ -42,6 +42,7 @@ export default async function setDefaultsMain(progname, rawArgs, powers, opts) {
42
42
  return fs.writeFile(fileName, contents);
43
43
  };
44
44
 
45
+ await null;
45
46
  if (appFile) {
46
47
  log(`read ${appFile}`);
47
48
  const appToml = await fs.readFile(appFile, 'utf-8');
package/src/start.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global process setTimeout */
1
+ /* eslint-env node */
2
2
  import chalk from 'chalk';
3
3
  import { createHash } from 'crypto';
4
4
  import path from 'path';
@@ -40,6 +40,7 @@ const DELEGATE0_COINS = `50000000${STAKING_DENOM}`;
40
40
  const SOLO_COINS = `13000000${STAKING_DENOM},500000000${CENTRAL_DENOM}`;
41
41
  const CHAIN_ID = 'agoriclocal';
42
42
 
43
+ const SERVERS_ROOT_DIR = '_agstate/agoric-servers';
43
44
  const FAKE_CHAIN_DELAY =
44
45
  process.env.FAKE_CHAIN_DELAY === undefined
45
46
  ? 0
@@ -69,10 +70,10 @@ export default async function startMain(progname, rawArgs, powers, opts) {
69
70
  const pspawnEnv = { ...process.env };
70
71
  if (opts.verbose > 1) {
71
72
  // Loudly verbose logs (nondeterministic).
72
- pspawnEnv.DEBUG = 'agoric,SwingSet:vat,SwingSet:ls';
73
+ pspawnEnv.DEBUG = 'agoric:debug,SwingSet:vat,SwingSet:ls';
73
74
  } else if (opts.verbose) {
74
75
  // Verbose vat logs (nondeterministic).
75
- pspawnEnv.DEBUG = 'SwingSet:vat,SwingSet:ls';
76
+ pspawnEnv.DEBUG = 'agoric:info,SwingSet:vat,SwingSet:ls';
76
77
  }
77
78
 
78
79
  const pspawn = makePspawn({ env: pspawnEnv, spawn, log, chalk });
@@ -151,6 +152,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
151
152
  ]);
152
153
 
153
154
  const exists = async file => {
155
+ await null;
154
156
  try {
155
157
  await fs.stat(file);
156
158
  return true;
@@ -159,6 +161,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
159
161
  }
160
162
  };
161
163
 
164
+ const rmVerbose = async filePath => {
165
+ log(chalk.green(`removing ${filePath}`));
166
+ // rm is available on all the unix-likes, so use it for speed.
167
+ await pspawn('rm', ['-rf', filePath]);
168
+ };
169
+
162
170
  let agSolo;
163
171
  let agSoloBuild;
164
172
  if (opts.dockerTag) {
@@ -171,12 +179,11 @@ export default async function startMain(progname, rawArgs, powers, opts) {
171
179
  const fakeDelay =
172
180
  popts.delay === undefined ? FAKE_CHAIN_DELAY : Number(popts.delay);
173
181
 
174
- const agServer = `_agstate/agoric-servers/${profileName}`;
182
+ const serverDir = `${SERVERS_ROOT_DIR}/${profileName}`;
175
183
 
184
+ await null;
176
185
  if (popts.reset) {
177
- log(chalk.green(`removing ${agServer}`));
178
- // rm is available on all the unix-likes, so use it for speed.
179
- await pspawn('rm', ['-rf', agServer]);
186
+ await rmVerbose(serverDir);
180
187
  }
181
188
 
182
189
  if (!opts.dockerTag) {
@@ -197,14 +204,14 @@ export default async function startMain(progname, rawArgs, powers, opts) {
197
204
  }
198
205
 
199
206
  const fakeGCI = 'sim-chain';
200
- const serverExists = await exists(agServer);
207
+ const serverExists = await exists(serverDir);
201
208
  if (!serverExists) {
202
209
  log(chalk.yellow(`initializing ${profileName}`));
203
210
  await pspawn(
204
211
  agSolo,
205
212
  ['init', profileName, '--egresses=fake', `--webport=${HOST_PORT}`],
206
213
  {
207
- cwd: '_agstate/agoric-servers',
214
+ cwd: SERVERS_ROOT_DIR,
208
215
  },
209
216
  );
210
217
  }
@@ -215,7 +222,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
215
222
  agSolo,
216
223
  ['set-fake-chain', `--delay=${fakeDelay}`, fakeGCI],
217
224
  {
218
- cwd: agServer,
225
+ cwd: serverDir,
219
226
  },
220
227
  );
221
228
  }
@@ -226,7 +233,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
226
233
  }
227
234
 
228
235
  const ps = pspawn(agSolo, [...debugOpts, 'start'], {
229
- cwd: agServer,
236
+ cwd: serverDir,
230
237
  env: nodeDebugEnv,
231
238
  });
232
239
  process.on('SIGINT', () => ps.childProcess.kill('SIGINT'));
@@ -246,6 +253,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
246
253
  }
247
254
 
248
255
  const { cosmosChain, cosmosChainBuild } = getSDKBinaries(sdkPrefixes);
256
+ await null;
249
257
  if (popts.pull || popts.rebuild) {
250
258
  if (popts.dockerTag) {
251
259
  const exitStatus = await pspawn('docker', ['pull', SDK_IMAGE]);
@@ -263,20 +271,18 @@ export default async function startMain(progname, rawArgs, powers, opts) {
263
271
  }
264
272
  }
265
273
 
266
- const agServer = `_agstate/agoric-servers/${profileName}-${portNum}`;
274
+ const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
267
275
  if (popts.reset) {
268
- log(chalk.green(`removing ${agServer}`));
269
- // rm is available on all the unix-likes, so use it for speed.
270
- await pspawn('rm', ['-rf', agServer]);
276
+ await rmVerbose(serverDir);
271
277
  }
272
278
 
279
+ /** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
273
280
  let chainSpawn;
274
281
  if (!popts.dockerTag) {
275
- chainSpawn = (args, spawnOpts = undefined) => {
276
- return pspawn(cosmosChain, [...args, `--home=${agServer}`], spawnOpts);
277
- };
282
+ chainSpawn = (args, spawnOpts) =>
283
+ pspawn(cosmosChain, [...args, `--home=${serverDir}`], spawnOpts);
278
284
  } else {
279
- chainSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
285
+ chainSpawn = (args, spawnOpts, dockerArgs = []) =>
280
286
  pspawn(
281
287
  'docker',
282
288
  [
@@ -287,13 +293,13 @@ export default async function startMain(progname, rawArgs, powers, opts) {
287
293
  ...terminalOnlyFlags(`-it`),
288
294
  SDK_IMAGE,
289
295
  ...args,
290
- `--home=/usr/src/dapp/${agServer}`,
296
+ `--home=/usr/src/dapp/${serverDir}`,
291
297
  ],
292
298
  spawnOpts,
293
299
  );
294
300
  }
295
301
 
296
- const serverExists = await exists(agServer);
302
+ const serverExists = await exists(serverDir);
297
303
  if (!serverExists) {
298
304
  const exitStatus = await chainSpawn([
299
305
  'init',
@@ -308,7 +314,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
308
314
  // Get or create the essential addresses.
309
315
  const addrs = {};
310
316
  for (const keyName of ['provision', 'delegate0']) {
311
- /* eslint-disable no-await-in-loop */
312
317
  let statusOut = showKey(keyName);
313
318
  const exitStatusOut = await statusOut[0];
314
319
  if (exitStatusOut) {
@@ -328,10 +333,9 @@ export default async function startMain(progname, rawArgs, powers, opts) {
328
333
  }
329
334
  }
330
335
  addrs[keyName] = statusOut[1].trimRight();
331
- /* eslint-enable no-await-in-loop */
332
336
  }
333
337
 
334
- const genesisFile = `${agServer}/config/genesis.json`;
338
+ const genesisFile = `${serverDir}/config/genesis.json`;
335
339
  const stampExists = await exists(`${genesisFile}.stamp`);
336
340
  if (!stampExists) {
337
341
  let exitStatus;
@@ -361,7 +365,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
361
365
  `--keyring-dir=${keysHome}`,
362
366
  '--keyring-backend=test',
363
367
  `--chain-id=${CHAIN_ID}`,
364
- `${DELEGATE0_COINS}`,
368
+ DELEGATE0_COINS,
365
369
  ]);
366
370
  if (exitStatus) {
367
371
  return exitStatus;
@@ -382,8 +386,8 @@ export default async function startMain(progname, rawArgs, powers, opts) {
382
386
 
383
387
  // Complete the genesis file and launch the chain.
384
388
  log('read ag-chain-cosmos config');
385
- const configFile = `${agServer}/config/config.toml`;
386
- const appFile = `${agServer}/config/app.toml`;
389
+ const configFile = `${serverDir}/config/config.toml`;
390
+ const appFile = `${serverDir}/config/app.toml`;
387
391
  const [genesisJson, configToml, appToml] = await Promise.all([
388
392
  fs.readFile(genesisFile, 'utf-8'),
389
393
  fs.readFile(configFile, 'utf-8'),
@@ -446,9 +450,10 @@ export default async function startMain(progname, rawArgs, powers, opts) {
446
450
  return 1;
447
451
  }
448
452
 
449
- const agServer = `_agstate/agoric-servers/${profileName}-${portNum}`;
453
+ const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
450
454
 
451
455
  const { cosmosClientBuild } = getSDKBinaries(sdkPrefixes);
456
+ await null;
452
457
  if (popts.pull || popts.rebuild) {
453
458
  if (popts.dockerTag) {
454
459
  const exitStatus = await pspawn('docker', ['pull', SDK_IMAGE]);
@@ -474,24 +479,22 @@ export default async function startMain(progname, rawArgs, powers, opts) {
474
479
  }
475
480
 
476
481
  if (popts.reset) {
477
- log(chalk.green(`removing ${agServer}`));
478
- // rm is available on all the unix-likes, so use it for speed.
479
- await pspawn('rm', ['-rf', agServer]);
482
+ await rmVerbose(serverDir);
480
483
  }
481
484
 
485
+ /** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
482
486
  let soloSpawn;
483
487
  if (!popts.dockerTag) {
484
- soloSpawn = (args, spawnOpts = undefined) =>
485
- pspawn(agSolo, args, spawnOpts);
488
+ soloSpawn = (args, spawnOpts) => pspawn(agSolo, args, spawnOpts);
486
489
  } else {
487
- soloSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
490
+ soloSpawn = (args, spawnOpts, dockerArgs = []) =>
488
491
  pspawn(
489
492
  'docker',
490
493
  [
491
494
  'run',
492
495
  `--volume=${process.cwd()}:/usr/src/dapp`,
493
496
  `--volume=${process.env.HOME}/.agoric:/root/.agoric`,
494
- `-eAG_SOLO_BASEDIR=/usr/src/dapp/${agServer}`,
497
+ `-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
495
498
  `--rm`,
496
499
  ...terminalOnlyFlags(`-it`),
497
500
  `--entrypoint=ag-solo`,
@@ -503,7 +506,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
503
506
  );
504
507
  }
505
508
 
506
- const serverExists = await exists(agServer);
509
+ const serverExists = await exists(serverDir);
507
510
  // Initialise the solo directory and key.
508
511
  if (!serverExists) {
509
512
  const initArgs = [`--webport=${portNum}`];
@@ -511,7 +514,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
511
514
  initArgs.push(`--webhost=0.0.0.0`);
512
515
  }
513
516
  const exitStatus = await soloSpawn(
514
- ['init', agServer, ...initArgs],
517
+ ['init', serverDir, ...initArgs],
515
518
  undefined,
516
519
  [`--workdir=/usr/src/dapp`],
517
520
  );
@@ -522,15 +525,15 @@ export default async function startMain(progname, rawArgs, powers, opts) {
522
525
 
523
526
  // Create the full economy chain config.
524
527
  const agServerResolve = spec =>
525
- require.resolve(spec, { paths: [agServer] });
528
+ require.resolve(spec, { paths: [serverDir] });
526
529
  const coreConfigPath = agServerResolve(
527
- '@agoric/vats/decentral-core-config.json',
530
+ '@agoric/vm-config/decentral-core-config.json',
528
531
  );
529
532
  const economyTemplPath = agServerResolve(
530
533
  '@agoric/cosmic-swingset/economy-template.json',
531
534
  );
532
535
  const [rawSoloAddr, coreConfigJson, economyTemplJson] = await Promise.all([
533
- fs.readFile(`${agServer}/ag-cosmos-helper-address`, 'utf-8'),
536
+ fs.readFile(`${serverDir}/ag-cosmos-helper-address`, 'utf-8'),
534
537
  fs.readFile(coreConfigPath, 'utf-8'),
535
538
  fs.readFile(economyTemplPath, 'utf-8'),
536
539
  ]);
@@ -541,7 +544,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
541
544
  const economyConfig = JSON.parse(coreConfigJson);
542
545
  economyConfig.coreProposals = economyProposals;
543
546
  await fs.writeFile(
544
- `${agServer}/decentral-economy-config.json`,
547
+ `${serverDir}/decentral-economy-config.json`,
545
548
  JSON.stringify(economyConfig, null, 2),
546
549
  );
547
550
 
@@ -549,13 +552,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
549
552
  return 0;
550
553
  }
551
554
 
552
- const gciFile = `_agstate/agoric-servers/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`;
555
+ const gciFile = `${SERVERS_ROOT_DIR}/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`;
553
556
  process.stdout.write(`Waiting for local-chain-${CHAIN_PORT} to start...`);
554
557
  let hasGci = false;
555
558
  for await (const _ of untilTrue(() => hasGci)) {
556
559
  process.stdout.write('.');
557
560
 
558
- // eslint-disable-next-line no-await-in-loop
559
561
  await new Promise((resolve, reject) => {
560
562
  fs.stat(gciFile).then(
561
563
  _2 => {
@@ -576,7 +578,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
576
578
 
577
579
  const spawnOpts = {};
578
580
  if (!popts.dockerTag) {
579
- spawnOpts.cwd = agServer;
581
+ spawnOpts.cwd = serverDir;
580
582
  }
581
583
 
582
584
  const rpcAddrs = [`localhost:${CHAIN_PORT}`];
@@ -590,7 +592,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
590
592
  let bestRpcAddr;
591
593
  for await (const _ of untilTrue(() => bestRpcAddr)) {
592
594
  for await (const rpcAddr of rpcAddrs) {
593
- // eslint-disable-next-line no-await-in-loop
594
595
  exitStatus = await keysSpawn([
595
596
  'query',
596
597
  'swingset',
@@ -639,7 +640,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
639
640
  ];
640
641
  for (/* await */ const cmd of provCmds) {
641
642
  const statusOut = capture(keysSpawn, cmd, true);
642
- // eslint-disable-next-line no-await-in-loop
643
643
  exitStatus = await statusOut[0];
644
644
  if (!exitStatus) {
645
645
  const json = statusOut[1].replace(/^gas estimate: \d+$/m, '');
@@ -664,7 +664,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
664
664
  }
665
665
  }
666
666
  if (!bestRpcAddr) {
667
- // eslint-disable-next-line no-await-in-loop
668
667
  await delay(2000);
669
668
  }
670
669
  }
@@ -690,6 +689,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
690
689
  }
691
690
 
692
691
  async function startTestnetDocker(profileName, startArgs, popts) {
692
+ await null;
693
693
  if (popts.dockerTag && popts.pull) {
694
694
  const exitStatus = await pspawn('docker', ['pull', SOLO_IMAGE]);
695
695
  if (exitStatus) {
@@ -699,12 +699,10 @@ export default async function startMain(progname, rawArgs, powers, opts) {
699
699
 
700
700
  const port = startArgs[0] || PORT;
701
701
  const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
702
- const agServer = `_agstate/agoric-servers/${profileName}-${port}`;
702
+ const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
703
703
 
704
704
  if (popts.reset) {
705
- log(chalk.green(`removing ${agServer}`));
706
- // rm is available on all the unix-likes, so use it for speed.
707
- await pspawn('rm', ['-rf', agServer]);
705
+ await rmVerbose(serverDir);
708
706
  }
709
707
 
710
708
  const setupRun = (...bonusArgs) =>
@@ -712,7 +710,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
712
710
  'run',
713
711
  `-p127.0.0.1:${HOST_PORT}:${port}`,
714
712
  `--volume=${process.cwd()}:/usr/src/dapp`,
715
- `-eAG_SOLO_BASEDIR=/usr/src/dapp/${agServer}`,
713
+ `-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
716
714
  `--rm`,
717
715
  ...terminalOnlyFlags(`-it`),
718
716
  SOLO_IMAGE,
@@ -727,44 +725,38 @@ export default async function startMain(progname, rawArgs, powers, opts) {
727
725
  async function startTestnetSdk(profileName, startArgs, popts) {
728
726
  const port = startArgs[0] || PORT;
729
727
  const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
730
- const agServer = `_agstate/agoric-servers/${profileName}-${port}`;
728
+ const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
731
729
 
730
+ await null;
732
731
  if (popts.reset) {
733
- log(chalk.green(`removing ${agServer}`));
734
- // rm is available on all the unix-likes, so use it for speed.
735
- await pspawn('rm', ['-rf', agServer]);
732
+ await rmVerbose(serverDir);
736
733
  }
737
734
 
738
735
  const setupRun = (...bonusArgs) =>
739
736
  pspawn(agSolo, [`--webport=${port}`, ...bonusArgs], {
740
- env: { ...pspawnEnv, AG_SOLO_BASEDIR: agServer },
737
+ env: { ...pspawnEnv, AG_SOLO_BASEDIR: serverDir },
741
738
  });
742
739
 
743
740
  return setupRun('setup', `--netconfig=${netconfig}`);
744
741
  }
745
742
 
746
743
  const profiles = {
744
+ __proto__: null,
747
745
  dev: startFakeChain,
748
746
  'local-chain': startLocalChain,
749
747
  'local-solo': startLocalSolo,
750
748
  testnet: opts.dockerTag ? startTestnetDocker : startTestnetSdk,
751
749
  };
752
750
 
753
- const popts = opts;
754
-
755
- const args = rawArgs.slice(1);
756
- const profileName = args[0] || 'dev';
751
+ const [_command = 'start', profileName = 'dev', ...args] = rawArgs;
757
752
  const startFn = profiles[profileName];
758
753
  if (!startFn) {
754
+ const profileNames = Object.keys(profiles).join(', ');
759
755
  log.error(
760
- `unrecognized profile name ${profileName}; use one of: ${Object.keys(
761
- profiles,
762
- )
763
- .sort()
764
- .join(', ')}`,
756
+ `unrecognized profile name ${profileName}; use one of: ${profileNames}`,
765
757
  );
766
758
  return 1;
767
759
  }
768
760
 
769
- return startFn(profileName, args[0] ? args.slice(1) : args, popts);
761
+ return startFn(profileName, args, opts);
770
762
  }