@agoric/swingset-vat 0.32.3-dev-0dccf64.0.0dccf64 → 0.32.3-dev-3dacdc3.0.3dacdc3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-vat",
3
- "version": "0.32.3-dev-0dccf64.0.0dccf64",
3
+ "version": "0.32.3-dev-3dacdc3.0.3dacdc3",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -22,7 +22,7 @@
22
22
  "lint:eslint": "yarn run -T eslint ."
23
23
  },
24
24
  "devDependencies": {
25
- "@agoric/xsnap": "0.14.3-dev-0dccf64.0.0dccf64",
25
+ "@agoric/xsnap": "0.14.3-dev-3dacdc3.0.3dacdc3",
26
26
  "@types/better-sqlite3": "^7.6.13",
27
27
  "@types/microtime": "^2.1.0",
28
28
  "@types/tmp": "^0.2.0",
@@ -30,15 +30,15 @@
30
30
  "ava": "^6.4.1"
31
31
  },
32
32
  "dependencies": {
33
- "@agoric/internal": "0.3.3-dev-0dccf64.0.0dccf64",
34
- "@agoric/kmarshal": "0.1.1-dev-0dccf64.0.0dccf64",
35
- "@agoric/store": "0.9.3-dev-0dccf64.0.0dccf64",
36
- "@agoric/swing-store": "0.9.2-dev-0dccf64.0.0dccf64",
37
- "@agoric/swingset-liveslots": "0.10.3-dev-0dccf64.0.0dccf64",
38
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-0dccf64.0.0dccf64",
39
- "@agoric/time": "0.3.3-dev-0dccf64.0.0dccf64",
40
- "@agoric/vat-data": "0.5.3-dev-0dccf64.0.0dccf64",
41
- "@agoric/xsnap-lockdown": "0.14.1-dev-0dccf64.0.0dccf64",
33
+ "@agoric/internal": "0.3.3-dev-3dacdc3.0.3dacdc3",
34
+ "@agoric/kmarshal": "0.1.1-dev-3dacdc3.0.3dacdc3",
35
+ "@agoric/store": "0.9.3-dev-3dacdc3.0.3dacdc3",
36
+ "@agoric/swing-store": "0.9.2-dev-3dacdc3.0.3dacdc3",
37
+ "@agoric/swingset-liveslots": "0.10.3-dev-3dacdc3.0.3dacdc3",
38
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-3dacdc3.0.3dacdc3",
39
+ "@agoric/time": "0.3.3-dev-3dacdc3.0.3dacdc3",
40
+ "@agoric/vat-data": "0.5.3-dev-3dacdc3.0.3dacdc3",
41
+ "@agoric/xsnap-lockdown": "0.14.1-dev-3dacdc3.0.3dacdc3",
42
42
  "@endo/base64": "^1.0.12",
43
43
  "@endo/bundle-source": "^4.1.2",
44
44
  "@endo/captp": "^4.4.8",
@@ -105,5 +105,5 @@
105
105
  "typeCoverage": {
106
106
  "atLeast": 76.72
107
107
  },
108
- "gitHead": "0dccf64926ac58da475a8eb599300841f55ee84f"
108
+ "gitHead": "3dacdc33b578ee52258e5771192bf8e57beb603b"
109
109
  }
@@ -321,10 +321,30 @@ harden(provideBundleCache);
321
321
  export const unsafeMakeBundleCache = dest =>
322
322
  makeNodeBundleCache(dest, {}, s => import(s));
323
323
 
324
- const sharedBundleCachePath = fileURLToPath(
324
+ /**
325
+ * This is a hack to share bundles across multiple SwingSet instances. It is
326
+ * not safe to use in general, as it does not coordinate access to the shared
327
+ * cache. It is only safe if all users are cooperative and use the same locking
328
+ * mechanism, which is currently only this module's `withBundleLock`. Even then,
329
+ * there is a risk of lock contention and timeouts if multiple users are trying
330
+ * to build the same bundle at the same time. Use with caution.
331
+ *
332
+ * Also note that assumes bundles are stored in a `bundles` directory at the
333
+ * root of the project, which is not guaranteed to be the case in all
334
+ * environments.
335
+ */
336
+ export const sharedBundleCachePath = fileURLToPath(
325
337
  new URL('../../../bundles', import.meta.url),
326
338
  );
327
339
 
340
+ /**
341
+ * "Unsafe" because it entails ambient authority.
342
+ *
343
+ * Also note that it uses the shared bundle cache path, which is exported
344
+ * separately for use in other contexts that need to know where the shared
345
+ * bundles are located, but that also makes it more likely to cause conflicts if
346
+ * used in multiple places at once.
347
+ */
328
348
  export const unsafeSharedBundleCache = unsafeMakeBundleCache(
329
349
  sharedBundleCachePath,
330
350
  );
@@ -1,13 +1,11 @@
1
1
  /* eslint-env node */
2
- import fs from 'fs';
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
2
  import { makeReadJsonFile } from '@agoric/internal/src/node/read-json.js';
6
- import { provideBundleCache } from './bundleTool.js';
3
+ import fs from 'fs';
7
4
  import {
8
5
  buildSwingsetKernelConfig,
9
6
  initializeSwingsetKernel,
10
7
  } from '../src/controller/initializeSwingset.js';
8
+ import { unsafeSharedBundleCache } from './bundleTool.js';
11
9
 
12
10
  /**
13
11
  * @import {SwingSetConfig} from '../src/types-external.js';
@@ -18,14 +16,10 @@ import {
18
16
 
19
17
  const readBundleSpecFile = makeReadJsonFile(fs.promises);
20
18
 
21
- const sharedBundleCachePath = fileURLToPath(
22
- new URL('../../../bundles', import.meta.url),
23
- );
24
-
25
19
  /**
26
20
  * Test-only wrapper that supplies ambient-powered bundleSpec loading.
27
21
  *
28
- * @param {SwingSetConfig} config
22
+ * @param {Omit<SwingSetConfig, 'bundleCachePath' | 'bundleFormat' | 'includeDevDependencies'>} config
29
23
  * @param {unknown} bootstrapArgs
30
24
  * @param {SwingStoreKernelStorage} kernelStorage
31
25
  * @param {InitializationOptions} initializationOptions
@@ -38,20 +32,7 @@ export const initializeTestSwingset = async (
38
32
  initializationOptions = {},
39
33
  runtimeOptions = {},
40
34
  ) => {
41
- const {
42
- bundleCachePath = sharedBundleCachePath,
43
- includeDevDependencies,
44
- bundleFormat,
45
- } = config;
46
- const cache = await provideBundleCache(
47
- path.resolve(bundleCachePath),
48
- {
49
- dev: includeDevDependencies,
50
- format: bundleFormat,
51
- byteLimit: Infinity,
52
- },
53
- spec => import(spec),
54
- );
35
+ const cache = await unsafeSharedBundleCache;
55
36
 
56
37
  const kernelConfig = await buildSwingsetKernelConfig(
57
38
  config,