agoric 0.21.2-dev-5382a55.0 → 0.21.2-dev-55ccfd2.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/package.json +17 -17
- package/src/start.js +43 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agoric",
|
|
3
|
-
"version": "0.21.2-dev-
|
|
3
|
+
"version": "0.21.2-dev-55ccfd2.0+55ccfd2",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -28,25 +28,25 @@
|
|
|
28
28
|
"lint:eslint": "eslint ."
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
31
|
+
"@agoric/deploy-script-support": "0.10.4-dev-55ccfd2.0+55ccfd2",
|
|
32
32
|
"ava": "^5.3.0",
|
|
33
33
|
"c8": "^7.13.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/access-token": "0.4.22-dev-
|
|
37
|
-
"@agoric/assert": "0.6.1-dev-
|
|
38
|
-
"@agoric/cache": "0.3.3-dev-
|
|
39
|
-
"@agoric/casting": "0.4.3-dev-
|
|
40
|
-
"@agoric/cosmic-proto": "0.3.1-dev-
|
|
41
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
42
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
43
|
-
"@agoric/internal": "0.3.3-dev-
|
|
44
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
45
|
-
"@agoric/store": "0.9.3-dev-
|
|
46
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
47
|
-
"@agoric/vats": "0.15.2-dev-
|
|
48
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
49
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/access-token": "0.4.22-dev-55ccfd2.0+55ccfd2",
|
|
37
|
+
"@agoric/assert": "0.6.1-dev-55ccfd2.0+55ccfd2",
|
|
38
|
+
"@agoric/cache": "0.3.3-dev-55ccfd2.0+55ccfd2",
|
|
39
|
+
"@agoric/casting": "0.4.3-dev-55ccfd2.0+55ccfd2",
|
|
40
|
+
"@agoric/cosmic-proto": "0.3.1-dev-55ccfd2.0+55ccfd2",
|
|
41
|
+
"@agoric/ertp": "0.16.3-dev-55ccfd2.0+55ccfd2",
|
|
42
|
+
"@agoric/inter-protocol": "0.16.2-dev-55ccfd2.0+55ccfd2",
|
|
43
|
+
"@agoric/internal": "0.3.3-dev-55ccfd2.0+55ccfd2",
|
|
44
|
+
"@agoric/smart-wallet": "0.5.4-dev-55ccfd2.0+55ccfd2",
|
|
45
|
+
"@agoric/store": "0.9.3-dev-55ccfd2.0+55ccfd2",
|
|
46
|
+
"@agoric/swingset-vat": "0.32.3-dev-55ccfd2.0+55ccfd2",
|
|
47
|
+
"@agoric/vats": "0.15.2-dev-55ccfd2.0+55ccfd2",
|
|
48
|
+
"@agoric/zoe": "0.26.3-dev-55ccfd2.0+55ccfd2",
|
|
49
|
+
"@agoric/zone": "0.2.3-dev-55ccfd2.0+55ccfd2",
|
|
50
50
|
"@confio/relayer": "^0.9.0",
|
|
51
51
|
"@cosmjs/crypto": "^0.30.1",
|
|
52
52
|
"@cosmjs/encoding": "^0.30.1",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"timeout": "2m",
|
|
93
93
|
"workerThreads": false
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "55ccfd2c76fbd9160bbbd9154632bb859f5ae3fa"
|
|
96
96
|
}
|
package/src/start.js
CHANGED
|
@@ -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
|
|
@@ -160,6 +161,12 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
160
161
|
}
|
|
161
162
|
};
|
|
162
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
|
+
|
|
163
170
|
let agSolo;
|
|
164
171
|
let agSoloBuild;
|
|
165
172
|
if (opts.dockerTag) {
|
|
@@ -172,13 +179,11 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
172
179
|
const fakeDelay =
|
|
173
180
|
popts.delay === undefined ? FAKE_CHAIN_DELAY : Number(popts.delay);
|
|
174
181
|
|
|
175
|
-
const
|
|
182
|
+
const serverDir = `${SERVERS_ROOT_DIR}/${profileName}`;
|
|
176
183
|
|
|
177
184
|
await null;
|
|
178
185
|
if (popts.reset) {
|
|
179
|
-
|
|
180
|
-
// rm is available on all the unix-likes, so use it for speed.
|
|
181
|
-
await pspawn('rm', ['-rf', agServer]);
|
|
186
|
+
rmVerbose(serverDir);
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
if (!opts.dockerTag) {
|
|
@@ -199,14 +204,14 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
const fakeGCI = 'sim-chain';
|
|
202
|
-
const serverExists = await exists(
|
|
207
|
+
const serverExists = await exists(serverDir);
|
|
203
208
|
if (!serverExists) {
|
|
204
209
|
log(chalk.yellow(`initializing ${profileName}`));
|
|
205
210
|
await pspawn(
|
|
206
211
|
agSolo,
|
|
207
212
|
['init', profileName, '--egresses=fake', `--webport=${HOST_PORT}`],
|
|
208
213
|
{
|
|
209
|
-
cwd:
|
|
214
|
+
cwd: SERVERS_ROOT_DIR,
|
|
210
215
|
},
|
|
211
216
|
);
|
|
212
217
|
}
|
|
@@ -217,7 +222,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
217
222
|
agSolo,
|
|
218
223
|
['set-fake-chain', `--delay=${fakeDelay}`, fakeGCI],
|
|
219
224
|
{
|
|
220
|
-
cwd:
|
|
225
|
+
cwd: serverDir,
|
|
221
226
|
},
|
|
222
227
|
);
|
|
223
228
|
}
|
|
@@ -228,7 +233,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
228
233
|
}
|
|
229
234
|
|
|
230
235
|
const ps = pspawn(agSolo, [...debugOpts, 'start'], {
|
|
231
|
-
cwd:
|
|
236
|
+
cwd: serverDir,
|
|
232
237
|
env: nodeDebugEnv,
|
|
233
238
|
});
|
|
234
239
|
process.on('SIGINT', () => ps.childProcess.kill('SIGINT'));
|
|
@@ -266,17 +271,15 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
266
271
|
}
|
|
267
272
|
}
|
|
268
273
|
|
|
269
|
-
const
|
|
274
|
+
const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
|
|
270
275
|
if (popts.reset) {
|
|
271
|
-
|
|
272
|
-
// rm is available on all the unix-likes, so use it for speed.
|
|
273
|
-
await pspawn('rm', ['-rf', agServer]);
|
|
276
|
+
rmVerbose(serverDir);
|
|
274
277
|
}
|
|
275
278
|
|
|
276
279
|
let chainSpawn;
|
|
277
280
|
if (!popts.dockerTag) {
|
|
278
281
|
chainSpawn = (args, spawnOpts = undefined) => {
|
|
279
|
-
return pspawn(cosmosChain, [...args, `--home=${
|
|
282
|
+
return pspawn(cosmosChain, [...args, `--home=${serverDir}`], spawnOpts);
|
|
280
283
|
};
|
|
281
284
|
} else {
|
|
282
285
|
chainSpawn = (args, spawnOpts = undefined, dockerArgs = []) =>
|
|
@@ -290,13 +293,13 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
290
293
|
...terminalOnlyFlags(`-it`),
|
|
291
294
|
SDK_IMAGE,
|
|
292
295
|
...args,
|
|
293
|
-
`--home=/usr/src/dapp/${
|
|
296
|
+
`--home=/usr/src/dapp/${serverDir}`,
|
|
294
297
|
],
|
|
295
298
|
spawnOpts,
|
|
296
299
|
);
|
|
297
300
|
}
|
|
298
301
|
|
|
299
|
-
const serverExists = await exists(
|
|
302
|
+
const serverExists = await exists(serverDir);
|
|
300
303
|
if (!serverExists) {
|
|
301
304
|
const exitStatus = await chainSpawn([
|
|
302
305
|
'init',
|
|
@@ -333,7 +336,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
333
336
|
/* eslint-enable no-await-in-loop */
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
const genesisFile = `${
|
|
339
|
+
const genesisFile = `${serverDir}/config/genesis.json`;
|
|
337
340
|
const stampExists = await exists(`${genesisFile}.stamp`);
|
|
338
341
|
if (!stampExists) {
|
|
339
342
|
let exitStatus;
|
|
@@ -363,7 +366,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
363
366
|
`--keyring-dir=${keysHome}`,
|
|
364
367
|
'--keyring-backend=test',
|
|
365
368
|
`--chain-id=${CHAIN_ID}`,
|
|
366
|
-
|
|
369
|
+
DELEGATE0_COINS,
|
|
367
370
|
]);
|
|
368
371
|
if (exitStatus) {
|
|
369
372
|
return exitStatus;
|
|
@@ -384,8 +387,8 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
384
387
|
|
|
385
388
|
// Complete the genesis file and launch the chain.
|
|
386
389
|
log('read ag-chain-cosmos config');
|
|
387
|
-
const configFile = `${
|
|
388
|
-
const appFile = `${
|
|
390
|
+
const configFile = `${serverDir}/config/config.toml`;
|
|
391
|
+
const appFile = `${serverDir}/config/app.toml`;
|
|
389
392
|
const [genesisJson, configToml, appToml] = await Promise.all([
|
|
390
393
|
fs.readFile(genesisFile, 'utf-8'),
|
|
391
394
|
fs.readFile(configFile, 'utf-8'),
|
|
@@ -448,7 +451,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
448
451
|
return 1;
|
|
449
452
|
}
|
|
450
453
|
|
|
451
|
-
const
|
|
454
|
+
const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${portNum}`;
|
|
452
455
|
|
|
453
456
|
const { cosmosClientBuild } = getSDKBinaries(sdkPrefixes);
|
|
454
457
|
await null;
|
|
@@ -477,9 +480,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
477
480
|
}
|
|
478
481
|
|
|
479
482
|
if (popts.reset) {
|
|
480
|
-
|
|
481
|
-
// rm is available on all the unix-likes, so use it for speed.
|
|
482
|
-
await pspawn('rm', ['-rf', agServer]);
|
|
483
|
+
rmVerbose(serverDir);
|
|
483
484
|
}
|
|
484
485
|
|
|
485
486
|
let soloSpawn;
|
|
@@ -494,7 +495,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
494
495
|
'run',
|
|
495
496
|
`--volume=${process.cwd()}:/usr/src/dapp`,
|
|
496
497
|
`--volume=${process.env.HOME}/.agoric:/root/.agoric`,
|
|
497
|
-
`-eAG_SOLO_BASEDIR=/usr/src/dapp/${
|
|
498
|
+
`-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
|
|
498
499
|
`--rm`,
|
|
499
500
|
...terminalOnlyFlags(`-it`),
|
|
500
501
|
`--entrypoint=ag-solo`,
|
|
@@ -506,7 +507,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
506
507
|
);
|
|
507
508
|
}
|
|
508
509
|
|
|
509
|
-
const serverExists = await exists(
|
|
510
|
+
const serverExists = await exists(serverDir);
|
|
510
511
|
// Initialise the solo directory and key.
|
|
511
512
|
if (!serverExists) {
|
|
512
513
|
const initArgs = [`--webport=${portNum}`];
|
|
@@ -514,7 +515,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
514
515
|
initArgs.push(`--webhost=0.0.0.0`);
|
|
515
516
|
}
|
|
516
517
|
const exitStatus = await soloSpawn(
|
|
517
|
-
['init',
|
|
518
|
+
['init', serverDir, ...initArgs],
|
|
518
519
|
undefined,
|
|
519
520
|
[`--workdir=/usr/src/dapp`],
|
|
520
521
|
);
|
|
@@ -525,7 +526,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
525
526
|
|
|
526
527
|
// Create the full economy chain config.
|
|
527
528
|
const agServerResolve = spec =>
|
|
528
|
-
require.resolve(spec, { paths: [
|
|
529
|
+
require.resolve(spec, { paths: [serverDir] });
|
|
529
530
|
const coreConfigPath = agServerResolve(
|
|
530
531
|
'@agoric/vats/decentral-core-config.json',
|
|
531
532
|
);
|
|
@@ -533,7 +534,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
533
534
|
'@agoric/cosmic-swingset/economy-template.json',
|
|
534
535
|
);
|
|
535
536
|
const [rawSoloAddr, coreConfigJson, economyTemplJson] = await Promise.all([
|
|
536
|
-
fs.readFile(`${
|
|
537
|
+
fs.readFile(`${serverDir}/ag-cosmos-helper-address`, 'utf-8'),
|
|
537
538
|
fs.readFile(coreConfigPath, 'utf-8'),
|
|
538
539
|
fs.readFile(economyTemplPath, 'utf-8'),
|
|
539
540
|
]);
|
|
@@ -544,7 +545,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
544
545
|
const economyConfig = JSON.parse(coreConfigJson);
|
|
545
546
|
economyConfig.coreProposals = economyProposals;
|
|
546
547
|
await fs.writeFile(
|
|
547
|
-
`${
|
|
548
|
+
`${serverDir}/decentral-economy-config.json`,
|
|
548
549
|
JSON.stringify(economyConfig, null, 2),
|
|
549
550
|
);
|
|
550
551
|
|
|
@@ -552,7 +553,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
552
553
|
return 0;
|
|
553
554
|
}
|
|
554
555
|
|
|
555
|
-
const gciFile =
|
|
556
|
+
const gciFile = `${SERVERS_ROOT_DIR}/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`;
|
|
556
557
|
process.stdout.write(`Waiting for local-chain-${CHAIN_PORT} to start...`);
|
|
557
558
|
let hasGci = false;
|
|
558
559
|
for await (const _ of untilTrue(() => hasGci)) {
|
|
@@ -578,7 +579,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
578
579
|
|
|
579
580
|
const spawnOpts = {};
|
|
580
581
|
if (!popts.dockerTag) {
|
|
581
|
-
spawnOpts.cwd =
|
|
582
|
+
spawnOpts.cwd = serverDir;
|
|
582
583
|
}
|
|
583
584
|
|
|
584
585
|
const rpcAddrs = [`localhost:${CHAIN_PORT}`];
|
|
@@ -699,12 +700,10 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
699
700
|
|
|
700
701
|
const port = startArgs[0] || PORT;
|
|
701
702
|
const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
|
|
702
|
-
const
|
|
703
|
+
const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
|
|
703
704
|
|
|
704
705
|
if (popts.reset) {
|
|
705
|
-
|
|
706
|
-
// rm is available on all the unix-likes, so use it for speed.
|
|
707
|
-
await pspawn('rm', ['-rf', agServer]);
|
|
706
|
+
rmVerbose(serverDir);
|
|
708
707
|
}
|
|
709
708
|
|
|
710
709
|
const setupRun = (...bonusArgs) =>
|
|
@@ -712,7 +711,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
712
711
|
'run',
|
|
713
712
|
`-p127.0.0.1:${HOST_PORT}:${port}`,
|
|
714
713
|
`--volume=${process.cwd()}:/usr/src/dapp`,
|
|
715
|
-
`-eAG_SOLO_BASEDIR=/usr/src/dapp/${
|
|
714
|
+
`-eAG_SOLO_BASEDIR=/usr/src/dapp/${serverDir}`,
|
|
716
715
|
`--rm`,
|
|
717
716
|
...terminalOnlyFlags(`-it`),
|
|
718
717
|
SOLO_IMAGE,
|
|
@@ -727,45 +726,38 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
727
726
|
async function startTestnetSdk(profileName, startArgs, popts) {
|
|
728
727
|
const port = startArgs[0] || PORT;
|
|
729
728
|
const netconfig = startArgs[1] || DEFAULT_NETCONFIG;
|
|
730
|
-
const
|
|
729
|
+
const serverDir = `${SERVERS_ROOT_DIR}/${profileName}-${port}`;
|
|
731
730
|
|
|
732
731
|
await null;
|
|
733
732
|
if (popts.reset) {
|
|
734
|
-
|
|
735
|
-
// rm is available on all the unix-likes, so use it for speed.
|
|
736
|
-
await pspawn('rm', ['-rf', agServer]);
|
|
733
|
+
rmVerbose(serverDir);
|
|
737
734
|
}
|
|
738
735
|
|
|
739
736
|
const setupRun = (...bonusArgs) =>
|
|
740
737
|
pspawn(agSolo, [`--webport=${port}`, ...bonusArgs], {
|
|
741
|
-
env: { ...pspawnEnv, AG_SOLO_BASEDIR:
|
|
738
|
+
env: { ...pspawnEnv, AG_SOLO_BASEDIR: serverDir },
|
|
742
739
|
});
|
|
743
740
|
|
|
744
741
|
return setupRun('setup', `--netconfig=${netconfig}`);
|
|
745
742
|
}
|
|
746
743
|
|
|
747
744
|
const profiles = {
|
|
745
|
+
__proto__: null,
|
|
748
746
|
dev: startFakeChain,
|
|
749
747
|
'local-chain': startLocalChain,
|
|
750
748
|
'local-solo': startLocalSolo,
|
|
751
749
|
testnet: opts.dockerTag ? startTestnetDocker : startTestnetSdk,
|
|
752
750
|
};
|
|
753
751
|
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
const args = rawArgs.slice(1);
|
|
757
|
-
const profileName = args[0] || 'dev';
|
|
752
|
+
const [_command = 'start', profileName = 'dev', ...args] = rawArgs;
|
|
758
753
|
const startFn = profiles[profileName];
|
|
759
754
|
if (!startFn) {
|
|
755
|
+
const profileNames = Object.keys(profiles).join(', ');
|
|
760
756
|
log.error(
|
|
761
|
-
`unrecognized profile name ${profileName}; use one of: ${
|
|
762
|
-
profiles,
|
|
763
|
-
)
|
|
764
|
-
.sort()
|
|
765
|
-
.join(', ')}`,
|
|
757
|
+
`unrecognized profile name ${profileName}; use one of: ${profileNames}`,
|
|
766
758
|
);
|
|
767
759
|
return 1;
|
|
768
760
|
}
|
|
769
761
|
|
|
770
|
-
return startFn(profileName, args
|
|
762
|
+
return startFn(profileName, args, opts);
|
|
771
763
|
}
|