@agoric/vats 0.15.2-dev-fbb1e85.0.fbb1e85 → 0.15.2-dev-486919f.0.486919f

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 CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@agoric/vats",
3
- "version": "0.15.2-dev-fbb1e85.0.fbb1e85",
3
+ "version": "0.15.2-dev-486919f.0.486919f",
4
4
  "description": "Agoric's Vat library",
5
5
  "type": "module",
6
6
  "main": "./index.js",
7
7
  "repository": "https://github.com/Agoric/agoric-sdk",
8
8
  "scripts": {
9
- "build": "yarn build:bundles",
10
- "build:bundles": "node scripts/build-bundles.js",
11
9
  "prepack": "yarn run -T prepack-package",
12
10
  "postpack": "yarn run -T postpack-package",
13
11
  "test": "ava",
@@ -22,19 +20,19 @@
22
20
  "author": "Agoric",
23
21
  "license": "Apache-2.0",
24
22
  "dependencies": {
25
- "@agoric/cosmic-proto": "0.4.1-dev-fbb1e85.0.fbb1e85",
26
- "@agoric/ertp": "0.16.3-dev-fbb1e85.0.fbb1e85",
27
- "@agoric/governance": "0.10.4-dev-fbb1e85.0.fbb1e85",
28
- "@agoric/internal": "0.3.3-dev-fbb1e85.0.fbb1e85",
29
- "@agoric/network": "0.1.1-dev-fbb1e85.0.fbb1e85",
30
- "@agoric/notifier": "0.6.3-dev-fbb1e85.0.fbb1e85",
31
- "@agoric/store": "0.9.3-dev-fbb1e85.0.fbb1e85",
32
- "@agoric/swingset-vat": "0.32.3-dev-fbb1e85.0.fbb1e85",
33
- "@agoric/time": "0.3.3-dev-fbb1e85.0.fbb1e85",
34
- "@agoric/vat-data": "0.5.3-dev-fbb1e85.0.fbb1e85",
35
- "@agoric/vow": "0.1.1-dev-fbb1e85.0.fbb1e85",
36
- "@agoric/zoe": "0.26.3-dev-fbb1e85.0.fbb1e85",
37
- "@agoric/zone": "0.2.3-dev-fbb1e85.0.fbb1e85",
23
+ "@agoric/cosmic-proto": "0.4.1-dev-486919f.0.486919f",
24
+ "@agoric/ertp": "0.16.3-dev-486919f.0.486919f",
25
+ "@agoric/governance": "0.10.4-dev-486919f.0.486919f",
26
+ "@agoric/internal": "0.3.3-dev-486919f.0.486919f",
27
+ "@agoric/network": "0.1.1-dev-486919f.0.486919f",
28
+ "@agoric/notifier": "0.6.3-dev-486919f.0.486919f",
29
+ "@agoric/store": "0.9.3-dev-486919f.0.486919f",
30
+ "@agoric/swingset-vat": "0.32.3-dev-486919f.0.486919f",
31
+ "@agoric/time": "0.3.3-dev-486919f.0.486919f",
32
+ "@agoric/vat-data": "0.5.3-dev-486919f.0.486919f",
33
+ "@agoric/vow": "0.1.1-dev-486919f.0.486919f",
34
+ "@agoric/zoe": "0.26.3-dev-486919f.0.486919f",
35
+ "@agoric/zone": "0.2.3-dev-486919f.0.486919f",
38
36
  "@endo/errors": "^1.2.13",
39
37
  "@endo/far": "^1.1.14",
40
38
  "@endo/import-bundle": "^1.5.2",
@@ -47,7 +45,7 @@
47
45
  "jessie.js": "^0.3.4"
48
46
  },
49
47
  "devDependencies": {
50
- "@agoric/swingset-liveslots": "0.10.3-dev-fbb1e85.0.fbb1e85",
48
+ "@agoric/swingset-liveslots": "0.10.3-dev-486919f.0.486919f",
51
49
  "@endo/bundle-source": "^4.1.2",
52
50
  "@endo/init": "^1.1.12",
53
51
  "ava": "^6.4.1",
@@ -57,6 +55,7 @@
57
55
  "CHANGELOG.md",
58
56
  "src/",
59
57
  "scripts/",
58
+ "source-spec-registry.*",
60
59
  "tools/",
61
60
  "index.*"
62
61
  ],
@@ -78,5 +77,5 @@
78
77
  "typeCoverage": {
79
78
  "atLeast": 90.6
80
79
  },
81
- "gitHead": "fbb1e85663733915182c4f3480c8d16f6ec4b4f1"
80
+ "gitHead": "486919f1291219236846e56cb4544d24972302c4"
82
81
  }
@@ -0,0 +1,115 @@
1
+ export namespace vatsSourceSpecRegistry {
2
+ namespace bootChain {
3
+ let packagePath: string;
4
+ let sourceSpec: string;
5
+ }
6
+ namespace bootSim {
7
+ let packagePath_1: string;
8
+ export { packagePath_1 as packagePath };
9
+ let sourceSpec_1: string;
10
+ export { sourceSpec_1 as sourceSpec };
11
+ }
12
+ namespace vatAgoricNames {
13
+ let packagePath_2: string;
14
+ export { packagePath_2 as packagePath };
15
+ let sourceSpec_2: string;
16
+ export { sourceSpec_2 as sourceSpec };
17
+ }
18
+ namespace vatBank {
19
+ let packagePath_3: string;
20
+ export { packagePath_3 as packagePath };
21
+ let sourceSpec_3: string;
22
+ export { sourceSpec_3 as sourceSpec };
23
+ }
24
+ namespace vatBoard {
25
+ let packagePath_4: string;
26
+ export { packagePath_4 as packagePath };
27
+ let sourceSpec_4: string;
28
+ export { sourceSpec_4 as sourceSpec };
29
+ }
30
+ namespace vatBridge {
31
+ let packagePath_5: string;
32
+ export { packagePath_5 as packagePath };
33
+ let sourceSpec_5: string;
34
+ export { sourceSpec_5 as sourceSpec };
35
+ }
36
+ namespace centralSupply {
37
+ export let bundleName: string;
38
+ let packagePath_6: string;
39
+ export { packagePath_6 as packagePath };
40
+ let sourceSpec_6: string;
41
+ export { sourceSpec_6 as sourceSpec };
42
+ }
43
+ namespace mintHolder {
44
+ let bundleName_1: string;
45
+ export { bundleName_1 as bundleName };
46
+ let packagePath_7: string;
47
+ export { packagePath_7 as packagePath };
48
+ let sourceSpec_7: string;
49
+ export { sourceSpec_7 as sourceSpec };
50
+ }
51
+ namespace vatMints {
52
+ let packagePath_8: string;
53
+ export { packagePath_8 as packagePath };
54
+ let sourceSpec_8: string;
55
+ export { sourceSpec_8 as sourceSpec };
56
+ }
57
+ namespace vatPriceAuthority {
58
+ let packagePath_9: string;
59
+ export { packagePath_9 as packagePath };
60
+ let sourceSpec_9: string;
61
+ export { sourceSpec_9 as sourceSpec };
62
+ }
63
+ namespace vatProvisioning {
64
+ let packagePath_10: string;
65
+ export { packagePath_10 as packagePath };
66
+ let sourceSpec_10: string;
67
+ export { sourceSpec_10 as sourceSpec };
68
+ }
69
+ namespace vatZoe {
70
+ let packagePath_11: string;
71
+ export { packagePath_11 as packagePath };
72
+ let sourceSpec_11: string;
73
+ export { sourceSpec_11 as sourceSpec };
74
+ }
75
+ }
76
+ export function getVatsSourceSpec(name: keyof typeof vatsSourceSpecRegistry): {
77
+ packagePath: string;
78
+ sourceSpec: string;
79
+ } | {
80
+ packagePath: string;
81
+ sourceSpec: string;
82
+ } | {
83
+ packagePath: string;
84
+ sourceSpec: string;
85
+ } | {
86
+ packagePath: string;
87
+ sourceSpec: string;
88
+ } | {
89
+ packagePath: string;
90
+ sourceSpec: string;
91
+ } | {
92
+ packagePath: string;
93
+ sourceSpec: string;
94
+ } | {
95
+ bundleName: string;
96
+ packagePath: string;
97
+ sourceSpec: string;
98
+ } | {
99
+ bundleName: string;
100
+ packagePath: string;
101
+ sourceSpec: string;
102
+ } | {
103
+ packagePath: string;
104
+ sourceSpec: string;
105
+ } | {
106
+ packagePath: string;
107
+ sourceSpec: string;
108
+ } | {
109
+ packagePath: string;
110
+ sourceSpec: string;
111
+ } | {
112
+ packagePath: string;
113
+ sourceSpec: string;
114
+ };
115
+ //# sourceMappingURL=source-spec-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-spec-registry.d.ts","sourceRoot":"","sources":["source-spec-registry.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEO,wCADK,MAAM,OAAO,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EACsB"}
@@ -0,0 +1,66 @@
1
+ import { fileURLToPath } from 'url';
2
+
3
+ /** @param {string} packagePath */
4
+ const resolveSourceSpec = packagePath =>
5
+ fileURLToPath(import.meta.resolve(packagePath));
6
+
7
+ /**
8
+ * Stable registry of `@agoric/vats` source specs used by configs and tests.
9
+ *
10
+ * The `packagePath` field is intended for static config validation.
11
+ */
12
+ export const vatsSourceSpecRegistry = {
13
+ bootChain: {
14
+ packagePath: '@agoric/vats/src/core/boot-chain.js',
15
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/core/boot-chain.js'),
16
+ },
17
+ bootSim: {
18
+ packagePath: '@agoric/vats/src/core/boot-sim.js',
19
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/core/boot-sim.js'),
20
+ },
21
+ vatAgoricNames: {
22
+ packagePath: '@agoric/vats/src/vat-agoricNames.js',
23
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-agoricNames.js'),
24
+ },
25
+ vatBank: {
26
+ packagePath: '@agoric/vats/src/vat-bank.js',
27
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-bank.js'),
28
+ },
29
+ vatBoard: {
30
+ packagePath: '@agoric/vats/src/vat-board.js',
31
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-board.js'),
32
+ },
33
+ vatBridge: {
34
+ packagePath: '@agoric/vats/src/vat-bridge.js',
35
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-bridge.js'),
36
+ },
37
+ centralSupply: {
38
+ bundleName: 'centralSupply',
39
+ packagePath: '@agoric/vats/src/centralSupply.js',
40
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/centralSupply.js'),
41
+ },
42
+ mintHolder: {
43
+ bundleName: 'mintHolder',
44
+ packagePath: '@agoric/vats/src/mintHolder.js',
45
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/mintHolder.js'),
46
+ },
47
+ vatMints: {
48
+ packagePath: '@agoric/vats/src/vat-mints.js',
49
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-mints.js'),
50
+ },
51
+ vatPriceAuthority: {
52
+ packagePath: '@agoric/vats/src/vat-priceAuthority.js',
53
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-priceAuthority.js'),
54
+ },
55
+ vatProvisioning: {
56
+ packagePath: '@agoric/vats/src/vat-provisioning.js',
57
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-provisioning.js'),
58
+ },
59
+ vatZoe: {
60
+ packagePath: '@agoric/vats/src/vat-zoe.js',
61
+ sourceSpec: resolveSourceSpec('@agoric/vats/src/vat-zoe.js'),
62
+ },
63
+ };
64
+
65
+ /** @param {keyof typeof vatsSourceSpecRegistry} name */
66
+ export const getVatsSourceSpec = name => vatsSourceSpecRegistry[name];
@@ -11,13 +11,8 @@ export namespace vatRoots {
11
11
  }
12
12
  export function noop(): void;
13
13
  export const mockDProxy: DProxy;
14
- export function makeMock(log: any): {
14
+ export function makeMock(log: any): Promise<{
15
15
  devices: {
16
- vatAdmin: {
17
- getNamedBundleCap: (name: any) => {
18
- getBundle: () => any;
19
- };
20
- };
21
16
  command: any;
22
17
  mailbox: any;
23
18
  timer: any;
@@ -69,12 +64,12 @@ export function makeMock(log: any): {
69
64
  makeLoopbackProtocolHandler: () => void;
70
65
  }>;
71
66
  };
72
- };
73
- export function makePopulatedFakeVatAdmin(): {
67
+ }>;
68
+ export function makePopulatedFakeVatAdmin(): Promise<{
74
69
  vatAdminService: any;
75
70
  vatAdminRoot: any;
76
- };
77
- export function mockSwingsetVats(mock: any): any;
71
+ }>;
72
+ export function mockSwingsetVats(mock: any): Promise<any>;
78
73
  import { buildRootObject as agoricNamesRoot } from '../src/vat-agoricNames.js';
79
74
  import { buildRootObject as bankRoot } from '../src/vat-bank.js';
80
75
  import { buildRootObject as boardRoot } from '../src/vat-board.js';
@@ -1 +1 @@
1
- {"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;AAsCO,6BAAqB;AAE5B,yBAAqC,MAAM,CAAc;AAElD;;;;;;;iBAGmB,GAAG;iBACH,GAAG;eAGL,GAAG;gBACF,GAAG;;;eAIJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BvB;AAEG;;;EAmEN;AAEM,iDAON;mDApJkD,2BAA2B;4CAClC,oBAAoB;6CACnB,qBAAqB;2CACvB,mBAAmB;6CACjB,qBAAqB;+CACnB,uBAAuB;sDAChB,8BAA8B;oDAChC,4BAA4B;2CACrC,mBAAmB;4BAGtB,sBAAsB"}
1
+ {"version":3,"file":"boot-test-utils.d.ts","sourceRoot":"","sources":["boot-test-utils.js"],"names":[],"mappings":";;;;;;;;;;;AAmCO,6BAAqB;AAE5B,yBAAqC,MAAM,CAAc;AAgDlD;;iBAImB,GAAG;iBACH,GAAG;eAGL,GAAG;gBACF,GAAG;;;eAIJ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6B1B;AAEM;;;GAuEN;AAEM,0DAON;mDAxMkD,2BAA2B;4CAClC,oBAAoB;6CACnB,qBAAqB;2CACvB,mBAAmB;6CACjB,qBAAqB;+CACnB,uBAAuB;sDAChB,8BAA8B;oDAChC,4BAA4B;2CACrC,mBAAmB;4BAGtB,sBAAsB"}
@@ -2,13 +2,10 @@ import { Fail } from '@endo/errors';
2
2
  import { E } from '@endo/far';
3
3
  import { Far } from '@endo/marshal';
4
4
 
5
- import {
6
- makeFakeVatAdmin,
7
- zcfBundleCap,
8
- } from '@agoric/zoe/tools/fakeVatAdmin.js';
9
5
  import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js';
10
6
  import { makeScalarBigMapStore } from '@agoric/vat-data';
11
- import { bundles, devices } from '../test/devices.js';
7
+ import { unsafeSharedBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js';
8
+ import { vatsSourceSpecRegistry } from '../source-spec-registry.js';
12
9
 
13
10
  import { buildRootObject as agoricNamesRoot } from '../src/vat-agoricNames.js';
14
11
  import { buildRootObject as bankRoot } from '../src/vat-bank.js';
@@ -40,8 +37,55 @@ export const noop = () => {};
40
37
 
41
38
  export const mockDProxy = /** @type {DProxy} */ (d => d);
42
39
 
43
- export const makeMock = log =>
44
- harden({
40
+ /** @type {Promise<typeof import('@agoric/zoe/tools/fakeVatAdmin.js')> | undefined} */
41
+ let fakeVatAdminToolsP;
42
+ const getFakeVatAdminTools = () => {
43
+ if (!fakeVatAdminToolsP) {
44
+ fakeVatAdminToolsP = import('@agoric/zoe/tools/fakeVatAdmin.js');
45
+ }
46
+ return fakeVatAdminToolsP;
47
+ };
48
+
49
+ /** @type {Promise<{bundles: Record<string, any>; devices: Record<string, any>}> | undefined} */
50
+ let bootTestBundlesP;
51
+ const getBootTestBundles = () => {
52
+ if (!bootTestBundlesP) {
53
+ bootTestBundlesP = (async () => {
54
+ const bundleCache = await unsafeSharedBundleCache;
55
+ const [centralSupply, mintHolder] = await Promise.all([
56
+ bundleCache.load(
57
+ vatsSourceSpecRegistry.centralSupply.sourceSpec,
58
+ vatsSourceSpecRegistry.centralSupply.bundleName,
59
+ ),
60
+ bundleCache.load(
61
+ vatsSourceSpecRegistry.mintHolder.sourceSpec,
62
+ vatsSourceSpecRegistry.mintHolder.bundleName,
63
+ ),
64
+ ]);
65
+ const bundles = harden({
66
+ centralSupply,
67
+ mintHolder,
68
+ });
69
+ const devices = harden({
70
+ vatAdmin: {
71
+ getNamedBundleCap: name => ({
72
+ getBundle: () => {
73
+ const bundle = bundles[name];
74
+ assert(bundle, `unknown bundle ${name}`);
75
+ return bundle;
76
+ },
77
+ }),
78
+ },
79
+ });
80
+ return harden({ bundles, devices });
81
+ })();
82
+ }
83
+ return bootTestBundlesP;
84
+ };
85
+
86
+ export const makeMock = async log => {
87
+ const { devices } = await getBootTestBundles();
88
+ return harden({
45
89
  devices: {
46
90
  command: /** @type {any} */ ({ registerInboundHandler: noop }),
47
91
  mailbox: /** @type {any} */ ({
@@ -81,12 +125,17 @@ export const makeMock = log =>
81
125
  }),
82
126
  },
83
127
  });
128
+ };
84
129
 
85
- export const makePopulatedFakeVatAdmin = () => {
130
+ export const makePopulatedFakeVatAdmin = async () => {
86
131
  // The .createVat() from zoe/tools/fakeVatAdmin.js only knows how to
87
132
  // make ZCF vats, so wrap it in a form that can create the other
88
133
  // vats too. We have two types.
89
134
 
135
+ const [{ bundles }, { makeFakeVatAdmin, zcfBundleCap }] = await Promise.all([
136
+ getBootTestBundles(),
137
+ getFakeVatAdminTools(),
138
+ ]);
90
139
  const fakeCapToName = new Map(); // cap -> name
91
140
  const fakeNameToCap = new Map(); // name -> cap
92
141
  const { admin: fakeVatAdmin, vatAdminState } = makeFakeVatAdmin();
@@ -151,8 +200,8 @@ export const makePopulatedFakeVatAdmin = () => {
151
200
  return { vatAdminService, vatAdminRoot };
152
201
  };
153
202
 
154
- export const mockSwingsetVats = mock => {
155
- const { vatAdminRoot } = makePopulatedFakeVatAdmin();
203
+ export const mockSwingsetVats = async mock => {
204
+ const { vatAdminRoot } = await makePopulatedFakeVatAdmin();
156
205
  const vats = {
157
206
  ...mock.vats,
158
207
  vatAdmin: vatAdminRoot,
@@ -1,3 +0,0 @@
1
- #! /usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=build-bundles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-bundles.d.ts","sourceRoot":"","sources":["build-bundles.js"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- #! /usr/bin/env node
2
- import '@endo/init';
3
- import { createBundles } from '@agoric/internal/src/node/createBundles.js';
4
- import url from 'url';
5
-
6
- const dirname = url.fileURLToPath(new URL('.', import.meta.url));
7
-
8
- // TODO end inter-package filesystem references https://github.com/Agoric/agoric-sdk/issues/8178
9
-
10
- const sourceToBundle = [
11
- ['@agoric/vats/src/centralSupply.js', '../bundles/bundle-centralSupply.js'],
12
- ['@agoric/vats/src/mintHolder.js', '../bundles/bundle-mintHolder.js'],
13
- [
14
- '@agoric/inter-protocol/src/provisionPool.js',
15
- '../bundles/bundle-provisionPool.js',
16
- ],
17
- ];
18
-
19
- await createBundles(sourceToBundle, dirname);