@agoric/swingset-liveslots 0.10.3-dev-279e654.0 → 0.10.3-dev-b6c58f2.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 +5 -5
- package/src/liveslots.js +4 -6
- package/test/vat-environment.test.js +62 -0
- package/tools/setup-vat-data.js +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swingset-liveslots",
|
|
3
|
-
"version": "0.10.3-dev-
|
|
3
|
+
"version": "0.10.3-dev-b6c58f2.0+b6c58f2",
|
|
4
4
|
"description": "SwingSet ocap support layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"lint:eslint": "eslint ."
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@agoric/internal": "0.3.3-dev-
|
|
21
|
-
"@agoric/store": "0.9.3-dev-
|
|
20
|
+
"@agoric/internal": "0.3.3-dev-b6c58f2.0+b6c58f2",
|
|
21
|
+
"@agoric/store": "0.9.3-dev-b6c58f2.0+b6c58f2",
|
|
22
22
|
"@endo/env-options": "^1.1.5",
|
|
23
23
|
"@endo/errors": "^1.2.4",
|
|
24
24
|
"@endo/eventual-send": "^1.2.4",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@endo/promise-kit": "^1.1.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
35
|
+
"@agoric/kmarshal": "0.1.1-dev-b6c58f2.0+b6c58f2",
|
|
36
36
|
"ava": "^5.3.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"typeCoverage": {
|
|
69
69
|
"atLeast": 75.35
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "b6c58f297e8f902f046cc2c71fe7f6162fe0c76d"
|
|
72
72
|
}
|
package/src/liveslots.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { annotateError, assert, Fail, makeError, X } from '@endo/errors';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
getInterfaceOf,
|
|
6
|
-
makeMarshal,
|
|
7
|
-
} from '@endo/marshal';
|
|
2
|
+
import { passStyleOf } from '@endo/pass-style';
|
|
3
|
+
import { PassStyleOfEndowmentSymbol } from '@endo/pass-style/endow.js';
|
|
4
|
+
import { Remotable, getInterfaceOf, makeMarshal } from '@endo/marshal';
|
|
8
5
|
import { isPromise } from '@endo/promise-kit';
|
|
9
6
|
import { E, HandledPromise } from '@endo/eventual-send';
|
|
10
7
|
import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js';
|
|
@@ -1363,6 +1360,7 @@ function build(
|
|
|
1363
1360
|
makeScalarBigSetStore: collectionManager.makeScalarBigSetStore,
|
|
1364
1361
|
makeScalarBigWeakSetStore: collectionManager.makeScalarBigWeakSetStore,
|
|
1365
1362
|
},
|
|
1363
|
+
[PassStyleOfEndowmentSymbol]: passStyleOf,
|
|
1366
1364
|
});
|
|
1367
1365
|
|
|
1368
1366
|
const inescapableGlobalProperties = harden({
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
|
+
import test from 'ava';
|
|
4
|
+
import { Far } from '@endo/marshal';
|
|
5
|
+
import { kser } from '@agoric/kmarshal';
|
|
6
|
+
import { passStyleOf } from '@endo/pass-style';
|
|
7
|
+
import { PassStyleOfEndowmentSymbol } from '@endo/pass-style/endow.js';
|
|
8
|
+
import { makeLiveSlots } from '../src/index.js';
|
|
9
|
+
import { makeStartVat } from './util.js';
|
|
10
|
+
import { buildSyscall } from './liveslots-helpers.js';
|
|
11
|
+
import { makeMockGC } from './mock-gc.js';
|
|
12
|
+
|
|
13
|
+
test('vat globals', async t => {
|
|
14
|
+
const { syscall } = buildSyscall();
|
|
15
|
+
const gcTools = makeMockGC();
|
|
16
|
+
const buildRootObject = () => Far('root', {});
|
|
17
|
+
let called = 0;
|
|
18
|
+
let vatGlobals;
|
|
19
|
+
let inescapableGlobalProperties;
|
|
20
|
+
const vatNS = harden({ buildRootObject });
|
|
21
|
+
// buildVatNamespace
|
|
22
|
+
const bVN = async (vG, iGP) => {
|
|
23
|
+
called += 1;
|
|
24
|
+
vatGlobals = vG;
|
|
25
|
+
inescapableGlobalProperties = iGP;
|
|
26
|
+
return vatNS;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const ls = makeLiveSlots(syscall, 'vatA', {}, {}, gcTools, undefined, bVN);
|
|
30
|
+
t.is(called, 0); // not called yet
|
|
31
|
+
await ls.dispatch(makeStartVat(kser()));
|
|
32
|
+
t.is(called, 1);
|
|
33
|
+
t.truthy(vatGlobals);
|
|
34
|
+
|
|
35
|
+
// 'harden' is provided by SES (installed by the lockdown bundle),
|
|
36
|
+
// not liveslots
|
|
37
|
+
t.is(typeof vatGlobals.harden, 'undefined');
|
|
38
|
+
|
|
39
|
+
// but liveslots provides VatData
|
|
40
|
+
t.is(typeof vatGlobals.VatData, 'object');
|
|
41
|
+
t.is(typeof vatGlobals.VatData, 'object');
|
|
42
|
+
t.is(typeof vatGlobals.VatData.defineKind, 'function');
|
|
43
|
+
t.is(typeof vatGlobals.VatData.defineKindMulti, 'function');
|
|
44
|
+
t.is(typeof vatGlobals.VatData.defineDurableKind, 'function');
|
|
45
|
+
t.is(typeof vatGlobals.VatData.defineDurableKindMulti, 'function');
|
|
46
|
+
t.is(typeof vatGlobals.VatData.makeKindHandle, 'function');
|
|
47
|
+
t.is(typeof vatGlobals.VatData.canBeDurable, 'function');
|
|
48
|
+
t.is(typeof vatGlobals.VatData.providePromiseWatcher, 'function');
|
|
49
|
+
t.is(typeof vatGlobals.VatData.watchPromise, 'function');
|
|
50
|
+
t.is(typeof vatGlobals.VatData.makeScalarBigMapStore, 'function');
|
|
51
|
+
t.is(typeof vatGlobals.VatData.makeScalarBigWeakMapStore, 'function');
|
|
52
|
+
t.is(typeof vatGlobals.VatData.makeScalarBigSetStore, 'function');
|
|
53
|
+
t.is(typeof vatGlobals.VatData.makeScalarBigWeakSetStore, 'function');
|
|
54
|
+
t.is(typeof vatGlobals[PassStyleOfEndowmentSymbol], 'function');
|
|
55
|
+
// this is the passStyleOf created by liveslots, with a real WeakMap
|
|
56
|
+
t.is(vatGlobals[PassStyleOfEndowmentSymbol], passStyleOf);
|
|
57
|
+
|
|
58
|
+
t.is(typeof inescapableGlobalProperties.WeakMap, 'function');
|
|
59
|
+
t.not(inescapableGlobalProperties.WeakMap, WeakMap);
|
|
60
|
+
t.is(typeof inescapableGlobalProperties.WeakSet, 'function');
|
|
61
|
+
t.not(inescapableGlobalProperties.WeakSet, WeakSet);
|
|
62
|
+
});
|
package/tools/setup-vat-data.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* global globalThis */
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
|
|
4
|
+
// This file produces the globalThis.VatData property outside of a
|
|
5
|
+
// running SwingSet so that it can be used by '@agoric/vat-data'
|
|
6
|
+
// (which only *consumes* `globalThis.VatData`) in code under test. It
|
|
7
|
+
// also populates the passStyleOf symbol-named property.
|
|
8
|
+
|
|
9
|
+
import { passStyleOf } from '@endo/pass-style';
|
|
10
|
+
import { PassStyleOfEndowmentSymbol } from '@endo/pass-style/endow.js';
|
|
6
11
|
import { makeFakeVirtualStuff } from './fakeVirtualSupport.js';
|
|
7
12
|
|
|
8
13
|
const { WeakMap, WeakSet } = globalThis;
|
|
@@ -37,6 +42,8 @@ globalThis.VatData = harden({
|
|
|
37
42
|
fakeVomKit.cm.makeScalarBigWeakSetStore(...args),
|
|
38
43
|
});
|
|
39
44
|
|
|
45
|
+
globalThis[PassStyleOfEndowmentSymbol] = passStyleOf;
|
|
46
|
+
|
|
40
47
|
export const reincarnate = (options = {}) => {
|
|
41
48
|
const { fakeStore = new Map(), fakeVomKit: fvk } = options;
|
|
42
49
|
|