@agoric/swingset-vat 0.32.3-dev-8358d20.0 → 0.32.3-dev-5eb596e.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-vat",
3
- "version": "0.32.3-dev-8358d20.0+8358d20",
3
+ "version": "0.32.3-dev-5eb596e.0+5eb596e",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,16 +27,16 @@
27
27
  "@types/yargs-parser": "^21.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@agoric/assert": "0.6.1-dev-8358d20.0+8358d20",
31
- "@agoric/internal": "0.3.3-dev-8358d20.0+8358d20",
32
- "@agoric/store": "0.9.3-dev-8358d20.0+8358d20",
33
- "@agoric/swing-store": "0.9.2-dev-8358d20.0+8358d20",
34
- "@agoric/swingset-liveslots": "0.10.3-dev-8358d20.0+8358d20",
35
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-8358d20.0+8358d20",
36
- "@agoric/time": "0.3.3-dev-8358d20.0+8358d20",
37
- "@agoric/vat-data": "0.5.3-dev-8358d20.0+8358d20",
38
- "@agoric/xsnap": "0.14.3-dev-8358d20.0+8358d20",
39
- "@agoric/xsnap-lockdown": "0.14.1-dev-8358d20.0+8358d20",
30
+ "@agoric/assert": "0.6.1-dev-5eb596e.0+5eb596e",
31
+ "@agoric/internal": "0.3.3-dev-5eb596e.0+5eb596e",
32
+ "@agoric/store": "0.9.3-dev-5eb596e.0+5eb596e",
33
+ "@agoric/swing-store": "0.9.2-dev-5eb596e.0+5eb596e",
34
+ "@agoric/swingset-liveslots": "0.10.3-dev-5eb596e.0+5eb596e",
35
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-5eb596e.0+5eb596e",
36
+ "@agoric/time": "0.3.3-dev-5eb596e.0+5eb596e",
37
+ "@agoric/vat-data": "0.5.3-dev-5eb596e.0+5eb596e",
38
+ "@agoric/xsnap": "0.14.3-dev-5eb596e.0+5eb596e",
39
+ "@agoric/xsnap-lockdown": "0.14.1-dev-5eb596e.0+5eb596e",
40
40
  "@endo/base64": "^0.2.32",
41
41
  "@endo/bundle-source": "^2.5.2",
42
42
  "@endo/captp": "^3.1.2",
@@ -93,5 +93,5 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "gitHead": "8358d208a105af24bc267ba4ef928ca7ecf6a4e3"
96
+ "gitHead": "5eb596e63bf4d5b416d4eff187e87af366b34928"
97
97
  }
@@ -1,4 +1,3 @@
1
- /* global globalThis */
2
1
  /**
3
2
  * Prepare Agoric SwingSet vat global environment for testing.
4
3
  *
@@ -6,44 +5,10 @@
6
5
  * and stores.
7
6
  */
8
7
 
9
- import '@endo/init/pre-bundle-source.js';
8
+ import '@endo/init/pre.js';
10
9
 
11
10
  import './install-ses-debug.js';
12
- import { makeFakeVirtualStuff } from '@agoric/swingset-liveslots/tools/fakeVirtualSupport.js';
11
+ import { reincarnate } from './setup-vat-data.js';
13
12
 
14
- const { vom, cm, wpm } = makeFakeVirtualStuff();
15
-
16
- const {
17
- defineKind,
18
- defineKindMulti,
19
- defineDurableKind,
20
- defineDurableKindMulti,
21
- makeKindHandle,
22
- canBeDurable,
23
- } = vom;
24
-
25
- const {
26
- makeScalarBigMapStore,
27
- makeScalarBigWeakMapStore,
28
- makeScalarBigSetStore,
29
- makeScalarBigWeakSetStore,
30
- } = cm;
31
-
32
- const { watchPromise, providePromiseWatcher } = wpm;
33
-
34
- const VatData = harden({
35
- defineKind,
36
- defineKindMulti,
37
- defineDurableKind,
38
- defineDurableKindMulti,
39
- makeKindHandle,
40
- providePromiseWatcher,
41
- watchPromise,
42
- makeScalarBigMapStore,
43
- makeScalarBigWeakMapStore,
44
- makeScalarBigSetStore,
45
- makeScalarBigWeakSetStore,
46
- canBeDurable,
47
- });
48
-
49
- globalThis.VatData = VatData;
13
+ // Install the VatData globals.
14
+ reincarnate();
@@ -0,0 +1,54 @@
1
+ // @ts-check
2
+ /* global globalThis */
3
+ // This file produces the globalThis.VatData property outside of a running
4
+ // SwingSet so that it can be used by '@agoric/vat-data' (which only *consumes*
5
+ // `globalThis.VatData`) in code under test.
6
+ import { makeFakeVirtualStuff } from '@agoric/swingset-liveslots/tools/fakeVirtualSupport.js';
7
+
8
+ const { WeakMap, WeakSet } = globalThis;
9
+
10
+ /** @type {ReturnType<makeFakeVirtualStuff>} */
11
+ let fakeVomKit;
12
+
13
+ globalThis.VatData = harden({
14
+ defineKind: (...args) => fakeVomKit.vom.defineKind(...args),
15
+ defineKindMulti: (...args) => fakeVomKit.vom.defineKindMulti(...args),
16
+ defineDurableKind: (...args) => fakeVomKit.vom.defineDurableKind(...args),
17
+ defineDurableKindMulti: (...args) =>
18
+ fakeVomKit.vom.defineDurableKindMulti(...args),
19
+ makeKindHandle: (...args) => fakeVomKit.vom.makeKindHandle(...args),
20
+ canBeDurable: (...args) => fakeVomKit.vom.canBeDurable(...args),
21
+ providePromiseWatcher: (...args) =>
22
+ fakeVomKit.wpm.providePromiseWatcher(...args),
23
+ watchPromise: (...args) => fakeVomKit.wpm.watchPromise(...args),
24
+ makeScalarBigMapStore: (...args) =>
25
+ fakeVomKit.cm.makeScalarBigMapStore(...args),
26
+ makeScalarBigWeakMapStore: (...args) =>
27
+ fakeVomKit.cm.makeScalarBigWeakMapStore(...args),
28
+ makeScalarBigSetStore: (...args) =>
29
+ fakeVomKit.cm.makeScalarBigSetStore(...args),
30
+ makeScalarBigWeakSetStore: (...args) =>
31
+ fakeVomKit.cm.makeScalarBigWeakSetStore(...args),
32
+ });
33
+
34
+ export const reincarnate = (options = {}) => {
35
+ const { fakeStore = new Map(), fakeVomKit: fvk } = options;
36
+
37
+ if (options.fakeVomKit) {
38
+ fvk.vom.flushStateCache();
39
+ fvk.cm.flushSchemaCache();
40
+ fvk.vrm.flushIDCounters();
41
+ }
42
+
43
+ fakeVomKit = makeFakeVirtualStuff({
44
+ ...options,
45
+ fakeStore,
46
+ WeakMap,
47
+ WeakSet,
48
+ });
49
+
50
+ globalThis.WeakMap = fakeVomKit.vom.VirtualObjectAwareWeakMap;
51
+ globalThis.WeakSet = fakeVomKit.vom.VirtualObjectAwareWeakSet;
52
+
53
+ return { ...options, fakeStore, fakeVomKit };
54
+ };