agoric 0.21.2-upgrade-16-dev-f908f89.0 → 0.21.2-upgrade-16-dev-d45b478.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 +20 -21
- package/src/main.js +47 -49
- package/src/lib/bundles.js +0 -102
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agoric",
|
|
3
|
-
"version": "0.21.2-upgrade-16-dev-
|
|
3
|
+
"version": "0.21.2-upgrade-16-dev-d45b478.0+d45b478",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -29,29 +29,29 @@
|
|
|
29
29
|
"lint:eslint": "eslint ."
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@agoric/cosmic-swingset": "0.41.4-upgrade-16-dev-
|
|
33
|
-
"@agoric/deploy-script-support": "0.10.4-upgrade-16-dev-
|
|
32
|
+
"@agoric/cosmic-swingset": "0.41.4-upgrade-16-dev-d45b478.0+d45b478",
|
|
33
|
+
"@agoric/deploy-script-support": "0.10.4-upgrade-16-dev-d45b478.0+d45b478",
|
|
34
34
|
"ava": "^5.3.0",
|
|
35
35
|
"c8": "^9.1.0",
|
|
36
36
|
"dd-trace": "^4.11.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@agoric/access-token": "0.4.22-upgrade-16-dev-
|
|
40
|
-
"@agoric/assert": "0.6.1-upgrade-16-dev-
|
|
41
|
-
"@agoric/cache": "0.3.3-upgrade-16-dev-
|
|
42
|
-
"@agoric/casting": "0.4.3-upgrade-16-dev-
|
|
43
|
-
"@agoric/cosmic-proto": "0.4.1-upgrade-16-dev-
|
|
44
|
-
"@agoric/ertp": "0.16.3-upgrade-16-dev-
|
|
45
|
-
"@agoric/governance": "0.10.4-upgrade-16-dev-
|
|
46
|
-
"@agoric/inter-protocol": "0.16.2-upgrade-16-dev-
|
|
47
|
-
"@agoric/internal": "0.3.3-upgrade-16-dev-
|
|
48
|
-
"@agoric/network": "0.1.1-upgrade-16-dev-
|
|
49
|
-
"@agoric/smart-wallet": "0.5.4-upgrade-16-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-upgrade-16-dev-
|
|
51
|
-
"@agoric/swingset-vat": "0.32.3-upgrade-16-dev-
|
|
52
|
-
"@agoric/vats": "0.15.2-upgrade-16-dev-
|
|
53
|
-
"@agoric/zoe": "0.26.3-upgrade-16-dev-
|
|
54
|
-
"@agoric/zone": "0.2.3-upgrade-16-dev-
|
|
39
|
+
"@agoric/access-token": "0.4.22-upgrade-16-dev-d45b478.0+d45b478",
|
|
40
|
+
"@agoric/assert": "0.6.1-upgrade-16-dev-d45b478.0+d45b478",
|
|
41
|
+
"@agoric/cache": "0.3.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
42
|
+
"@agoric/casting": "0.4.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
43
|
+
"@agoric/cosmic-proto": "0.4.1-upgrade-16-dev-d45b478.0+d45b478",
|
|
44
|
+
"@agoric/ertp": "0.16.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
45
|
+
"@agoric/governance": "0.10.4-upgrade-16-dev-d45b478.0+d45b478",
|
|
46
|
+
"@agoric/inter-protocol": "0.16.2-upgrade-16-dev-d45b478.0+d45b478",
|
|
47
|
+
"@agoric/internal": "0.3.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
48
|
+
"@agoric/network": "0.1.1-upgrade-16-dev-d45b478.0+d45b478",
|
|
49
|
+
"@agoric/smart-wallet": "0.5.4-upgrade-16-dev-d45b478.0+d45b478",
|
|
50
|
+
"@agoric/store": "0.9.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
51
|
+
"@agoric/swingset-vat": "0.32.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
52
|
+
"@agoric/vats": "0.15.2-upgrade-16-dev-d45b478.0+d45b478",
|
|
53
|
+
"@agoric/zoe": "0.26.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
54
|
+
"@agoric/zone": "0.2.3-upgrade-16-dev-d45b478.0+d45b478",
|
|
55
55
|
"@confio/relayer": "^0.11.3",
|
|
56
56
|
"@cosmjs/crypto": "^0.32.3",
|
|
57
57
|
"@cosmjs/encoding": "^0.32.3",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"@endo/nat": "^5.0.7",
|
|
69
69
|
"@endo/patterns": "^1.4.0",
|
|
70
70
|
"@endo/promise-kit": "^1.1.2",
|
|
71
|
-
"@endo/zip": "^1.0.5",
|
|
72
71
|
"@iarna/toml": "^2.2.3",
|
|
73
72
|
"anylogger": "^0.21.0",
|
|
74
73
|
"chalk": "^5.2.0",
|
|
@@ -101,5 +100,5 @@
|
|
|
101
100
|
"typeCoverage": {
|
|
102
101
|
"atLeast": 76.99
|
|
103
102
|
},
|
|
104
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "d45b478fe2dd21ff463660522e1998ab3e8bbe65"
|
|
105
104
|
}
|
package/src/main.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/* global process */
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import url from 'url';
|
|
2
5
|
import { assert, details as X } from '@agoric/assert';
|
|
3
6
|
import {
|
|
4
|
-
DEFAULT_JITTER_SECONDS,
|
|
5
7
|
DEFAULT_KEEP_POLLING_SECONDS,
|
|
8
|
+
DEFAULT_JITTER_SECONDS,
|
|
6
9
|
} from '@agoric/casting';
|
|
7
|
-
import { Command } from 'commander';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import url from 'url';
|
|
10
|
-
import { makeWalletCommand } from './commands/wallet.js';
|
|
11
10
|
import cosmosMain from './cosmos.js';
|
|
12
11
|
import deployMain from './deploy.js';
|
|
13
|
-
import
|
|
12
|
+
import runMain from './run.js';
|
|
13
|
+
import publishMain from './main-publish.js';
|
|
14
14
|
import initMain from './init.js';
|
|
15
15
|
import installMain from './install.js';
|
|
16
|
-
import { statPlans } from './lib/bundles.js';
|
|
17
|
-
import publishMain from './main-publish.js';
|
|
18
|
-
import walletMain from './open.js';
|
|
19
|
-
import runMain from './run.js';
|
|
20
16
|
import setDefaultsMain from './set-defaults.js';
|
|
21
17
|
import startMain from './start.js';
|
|
18
|
+
import followMain from './follow.js';
|
|
19
|
+
import walletMain from './open.js';
|
|
20
|
+
import { makeWalletCommand } from './commands/wallet.js';
|
|
22
21
|
|
|
23
22
|
const DEFAULT_DAPP_TEMPLATE = 'dapp-offer-up';
|
|
24
23
|
const DEFAULT_DAPP_URL_BASE = 'https://github.com/Agoric/';
|
|
@@ -47,7 +46,6 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
47
46
|
return true;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
// XXX exits process when fn resolves
|
|
51
49
|
function subMain(fn, args, options) {
|
|
52
50
|
return fn(progname, args, powers, options).then(
|
|
53
51
|
// This seems to be the only way to propagate the exit code.
|
|
@@ -282,6 +280,29 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
282
280
|
return subMain(followMain, ['follow', ...pathSpecs], opts);
|
|
283
281
|
});
|
|
284
282
|
|
|
283
|
+
const addRunOptions = cmd =>
|
|
284
|
+
cmd
|
|
285
|
+
.option(
|
|
286
|
+
'--allow-unsafe-plugins',
|
|
287
|
+
`CAREFUL: installed Agoric VM plugins will also have all your user's privileges`,
|
|
288
|
+
false,
|
|
289
|
+
)
|
|
290
|
+
.option(
|
|
291
|
+
'--hostport <host:port>',
|
|
292
|
+
'host and port to connect to VM',
|
|
293
|
+
'127.0.0.1:8000',
|
|
294
|
+
)
|
|
295
|
+
.option(
|
|
296
|
+
'--need <subsystems>',
|
|
297
|
+
'comma-separated names of subsystems to wait for',
|
|
298
|
+
'local,agoric,wallet',
|
|
299
|
+
)
|
|
300
|
+
.option(
|
|
301
|
+
'--provide <subsystems>',
|
|
302
|
+
'comma-separated names of subsystems this script initializes',
|
|
303
|
+
'',
|
|
304
|
+
);
|
|
305
|
+
|
|
285
306
|
baseCmd('run <script> [script-args...]')
|
|
286
307
|
.description(
|
|
287
308
|
'run a script with all your user privileges and some Agoric endowments',
|
|
@@ -289,46 +310,23 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
289
310
|
.passThroughOptions(true)
|
|
290
311
|
.action(async (script, scriptArgs, _options, cmd) => {
|
|
291
312
|
const opts = { ...program.opts(), ...cmd.opts(), ...cmdOpts, scriptArgs };
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (opts.verbose) {
|
|
295
|
-
await statPlans(process.cwd());
|
|
296
|
-
}
|
|
313
|
+
return subMain(runMain, ['run', script], opts);
|
|
297
314
|
});
|
|
298
315
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
'127.0.0.1:8000',
|
|
314
|
-
)
|
|
315
|
-
.option(
|
|
316
|
-
'--need <subsystems>',
|
|
317
|
-
'comma-separated names of subsystems to wait for',
|
|
318
|
-
'local,agoric,wallet',
|
|
319
|
-
)
|
|
320
|
-
.option(
|
|
321
|
-
'--provide <subsystems>',
|
|
322
|
-
'comma-separated names of subsystems this script initializes',
|
|
323
|
-
'',
|
|
324
|
-
)
|
|
325
|
-
.description(
|
|
326
|
-
'run multiple scripts with all your user privileges against the local Agoric VM',
|
|
327
|
-
)
|
|
328
|
-
.action(async (scripts, _options, cmd) => {
|
|
329
|
-
const opts = { ...program.opts(), ...cmd.opts() };
|
|
330
|
-
return subMain(deployMain, ['deploy', ...scripts], opts);
|
|
331
|
-
});
|
|
316
|
+
addRunOptions(
|
|
317
|
+
baseCmd('deploy [script...]')
|
|
318
|
+
.option(
|
|
319
|
+
'--target <target>',
|
|
320
|
+
'One of agoric, local, cosmos, or sim',
|
|
321
|
+
'agoric',
|
|
322
|
+
)
|
|
323
|
+
.description(
|
|
324
|
+
'run multiple scripts with all your user privileges against the local Agoric VM',
|
|
325
|
+
),
|
|
326
|
+
).action(async (scripts, _options, cmd) => {
|
|
327
|
+
const opts = { ...program.opts(), ...cmd.opts() };
|
|
328
|
+
return subMain(deployMain, ['deploy', ...scripts], opts);
|
|
329
|
+
});
|
|
332
330
|
|
|
333
331
|
baseCmd('publish [bundle...]')
|
|
334
332
|
.option(
|
package/src/lib/bundles.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/* global Buffer */
|
|
4
|
-
|
|
5
|
-
import assert from 'node:assert/strict';
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
|
|
9
|
-
import { ZipReader } from '@endo/zip';
|
|
10
|
-
|
|
11
|
-
/** @import {Bundle} from '@agoric/swingset-vat'; */
|
|
12
|
-
/** @import {CoreEvalPlan} from '@agoric/deploy-script-support/src/writeCoreEvalParts.js' */
|
|
13
|
-
|
|
14
|
-
const PACKAGE_NAME_RE = /(?<packageName>.*-v[\d.]+)\//;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {{ name: string, label: string, location: string, modules: Record<string, {compartment: string, module: string}>}} Compartment
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @typedef CompartmentMap
|
|
22
|
-
* @property {string[]} tags
|
|
23
|
-
* @property {{compartment: string, module: string}} entry
|
|
24
|
-
* @property {Record<string, Compartment>} compartments
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/** @param {Bundle} bundleObj*/
|
|
28
|
-
export const extractBundleInfo = async bundleObj => {
|
|
29
|
-
if (bundleObj.moduleFormat !== 'endoZipBase64') {
|
|
30
|
-
throw new Error('only endoZipBase64 is supported');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const contents = Buffer.from(bundleObj.endoZipBase64, 'base64');
|
|
34
|
-
|
|
35
|
-
const zipReader = new ZipReader(contents);
|
|
36
|
-
const { files } = zipReader;
|
|
37
|
-
|
|
38
|
-
const cmapEntry = files.get('compartment-map.json');
|
|
39
|
-
/** @type {CompartmentMap} */
|
|
40
|
-
const compartmentMap = JSON.parse(Buffer.from(cmapEntry.content).toString());
|
|
41
|
-
|
|
42
|
-
// XXX mapIter better but requires SES
|
|
43
|
-
const fileSizes = Object.fromEntries(
|
|
44
|
-
Array.from(files.values()).map(f => [
|
|
45
|
-
f.name,
|
|
46
|
-
// bundle contents are not compressed
|
|
47
|
-
f.content.length,
|
|
48
|
-
]),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return { compartmentMap, fileSizes };
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// UNTIL https://github.com/endojs/endo/issues/1656
|
|
55
|
-
/** @param {string} bundleFilename */
|
|
56
|
-
export const statBundle = async bundleFilename => {
|
|
57
|
-
const bundle = fs.readFileSync(bundleFilename, 'utf8');
|
|
58
|
-
/** @type {Bundle} */
|
|
59
|
-
const bundleObj = JSON.parse(bundle);
|
|
60
|
-
console.log('\nBUNDLE', bundleObj.moduleFormat, bundleFilename);
|
|
61
|
-
|
|
62
|
-
const info = await extractBundleInfo(bundleObj);
|
|
63
|
-
assert(info, 'no bundle info');
|
|
64
|
-
|
|
65
|
-
/** @type {Record<string, number>} */
|
|
66
|
-
const byPackage = {};
|
|
67
|
-
let totalSize = 0;
|
|
68
|
-
for (const [filename, size] of Object.entries(info.fileSizes)) {
|
|
69
|
-
totalSize += size;
|
|
70
|
-
if (filename === 'compartment-map.json') {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
const { packageName } = filename.match(PACKAGE_NAME_RE)?.groups ?? {};
|
|
74
|
-
assert(packageName, `invalid filename ${filename}`);
|
|
75
|
-
byPackage[packageName] ||= 0;
|
|
76
|
-
byPackage[packageName] += size;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.log('Sum of file sizes in each package:');
|
|
80
|
-
console.table(byPackage);
|
|
81
|
-
|
|
82
|
-
console.log('total size:', totalSize);
|
|
83
|
-
console.log('\nTo explore the contents:\n');
|
|
84
|
-
console.log(
|
|
85
|
-
` DIR=$(mktemp -d); cat ${bundleFilename} | jq -r .endoZipBase64 | base64 -d | tar xC $DIR; open $DIR`,
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/** @param {string} path */
|
|
90
|
-
export const statPlans = async path => {
|
|
91
|
-
const files = await fs.promises.readdir(path);
|
|
92
|
-
const planfiles = files.filter(f => f.endsWith('plan.json'));
|
|
93
|
-
|
|
94
|
-
for (const planfile of planfiles) {
|
|
95
|
-
/** @type {CoreEvalPlan} */
|
|
96
|
-
const plan = JSON.parse(fs.readFileSync(join(path, planfile), 'utf8'));
|
|
97
|
-
console.log('\n**\nPLAN', plan.name);
|
|
98
|
-
for (const bundle of plan.bundles) {
|
|
99
|
-
await statBundle(bundle.fileName);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|