@agoric/swingset-liveslots 0.10.3-dev-d6fae11.0.d6fae11 → 0.10.3-dev-7b17bb6.0.7b17bb6
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/capdata.d.ts +4 -2
- package/src/capdata.d.ts.map +1 -1
- package/src/capdata.js +2 -1
- package/src/collectionManager.d.ts +3 -2
- package/src/collectionManager.d.ts.map +1 -1
- package/src/collectionManager.js +4 -2
- package/src/liveslots.d.ts +3 -2
- package/src/liveslots.d.ts.map +1 -1
- package/src/liveslots.js +12 -7
- package/src/message.d.ts +16 -8
- package/src/message.d.ts.map +1 -1
- package/src/message.js +8 -4
- package/src/types.d.ts +2 -1
- package/src/types.d.ts.map +1 -1
- package/src/types.js +5 -1
- package/src/virtualObjectManager.d.ts +3 -1
- package/src/virtualObjectManager.d.ts.map +1 -1
- package/src/virtualObjectManager.js +11 -7
- package/src/watchedPromises.d.ts +26 -12
- package/src/watchedPromises.d.ts.map +1 -1
- package/src/watchedPromises.js +18 -9
- package/test/dummyMeterControl.d.ts +5 -1
- package/test/dummyMeterControl.d.ts.map +1 -1
- package/test/dummyMeterControl.js +5 -1
- package/test/liveslots-helpers.d.ts +7 -3
- package/test/liveslots-helpers.d.ts.map +1 -1
- package/test/liveslots-helpers.js +5 -1
- package/test/virtual-objects/state-shape.test.js +5 -2
- package/tools/fakeVirtualSupport.d.ts.map +1 -1
- package/tools/setup-vat-data.d.ts +2 -1
- package/tools/setup-vat-data.d.ts.map +1 -1
- package/tools/setup-vat-data.js +5 -1
- package/tools/vo-test-harness.d.ts +2 -1
- package/tools/vo-test-harness.d.ts.map +1 -1
- package/tools/vo-test-harness.js +5 -1
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-7b17bb6.0.7b17bb6",
|
|
4
4
|
"description": "SwingSet ocap support layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"postpack": "git clean -f ':!src/types-index.d.ts' '*.d.ts*' '*.tsbuildinfo'"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agoric/internal": "0.3.3-dev-
|
|
23
|
-
"@agoric/store": "0.9.3-dev-
|
|
22
|
+
"@agoric/internal": "0.3.3-dev-7b17bb6.0.7b17bb6",
|
|
23
|
+
"@agoric/store": "0.9.3-dev-7b17bb6.0.7b17bb6",
|
|
24
24
|
"@endo/env-options": "^1.1.11",
|
|
25
25
|
"@endo/errors": "^1.2.13",
|
|
26
26
|
"@endo/eventual-send": "^1.3.4",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@endo/promise-kit": "^1.1.13"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
37
|
+
"@agoric/kmarshal": "0.1.1-dev-7b17bb6.0.7b17bb6",
|
|
38
38
|
"ava": "^5.3.0"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"typeCoverage": {
|
|
69
69
|
"atLeast": 75.22
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "7b17bb64b1ba5357d073027fb7457c7378d744b7"
|
|
72
72
|
}
|
package/src/capdata.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {assertCapData} from '@agoric/internal/src/marshal/cap-data.js';
|
|
3
|
+
* @import {SwingSetCapData} from './types.js';
|
|
3
4
|
*/
|
|
4
5
|
/**
|
|
5
6
|
* Assert function to ensure that something expected to be a capdata object
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
* @param {any} specimen The object to be tested
|
|
11
12
|
* @throws {Error} if, upon inspection, the parameter does not satisfy the above
|
|
12
13
|
* criteria.
|
|
13
|
-
* @returns {asserts specimen is
|
|
14
|
+
* @returns {asserts specimen is SwingSetCapData}
|
|
14
15
|
*/
|
|
15
|
-
export function insistCapData(specimen: any): asserts specimen is
|
|
16
|
+
export function insistCapData(specimen: any): asserts specimen is SwingSetCapData;
|
|
17
|
+
import type { SwingSetCapData } from './types.js';
|
|
16
18
|
//# sourceMappingURL=capdata.d.ts.map
|
package/src/capdata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capdata.d.ts","sourceRoot":"","sources":["capdata.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"capdata.d.ts","sourceRoot":"","sources":["capdata.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,wCALW,GAAG,GAGD,QAAQ,QAAQ,IAAI,eAAe,CAW/C;qCAvBiC,YAAY"}
|
package/src/capdata.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Fail } from '@endo/errors';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @import {assertCapData} from '@agoric/internal/src/marshal/cap-data.js';
|
|
5
|
+
* @import {SwingSetCapData} from './types.js';
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -13,7 +14,7 @@ import { Fail } from '@endo/errors';
|
|
|
13
14
|
* @param {any} specimen The object to be tested
|
|
14
15
|
* @throws {Error} if, upon inspection, the parameter does not satisfy the above
|
|
15
16
|
* criteria.
|
|
16
|
-
* @returns {asserts specimen is
|
|
17
|
+
* @returns {asserts specimen is SwingSetCapData}
|
|
17
18
|
*/
|
|
18
19
|
export function insistCapData(specimen) {
|
|
19
20
|
typeof specimen.body === 'string' ||
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {*} syscall
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {VirtualReferenceManager} vrm
|
|
4
4
|
* @param {() => number} allocateExportID
|
|
5
5
|
* @param {() => number} allocateCollectionID
|
|
6
6
|
* @param {(val: any) => string | undefined} convertValToSlot
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @param {FromCapData<string>} unserialize
|
|
11
11
|
* @param {(capDatas: any) => void} assertAcceptableSyscallCapdataSize
|
|
12
12
|
*/
|
|
13
|
-
export function makeCollectionManager(syscall: any, vrm:
|
|
13
|
+
export function makeCollectionManager(syscall: any, vrm: VirtualReferenceManager, allocateExportID: () => number, allocateCollectionID: () => number, convertValToSlot: (val: any) => string | undefined, convertSlotToVal: any, registerValue: any, serialize: ToCapData<string>, unserialize: FromCapData<string>, assertAcceptableSyscallCapdataSize: (capDatas: any) => void): {
|
|
14
14
|
initializeStoreKindInfo: () => void;
|
|
15
15
|
makeScalarBigMapStore: <K, V>(label?: string, options?: StoreOptions) => MapStore<K, V>;
|
|
16
16
|
makeScalarBigWeakMapStore: <K, V>(label?: string, options?: StoreOptions) => WeakMapStore<K, V>;
|
|
@@ -41,6 +41,7 @@ export type SchemaCacheValue = {
|
|
|
41
41
|
label: string;
|
|
42
42
|
schemataCapData: object;
|
|
43
43
|
};
|
|
44
|
+
import type { VirtualReferenceManager } from './virtualReferences.js';
|
|
44
45
|
import type { ToCapData } from '@endo/marshal';
|
|
45
46
|
import type { FromCapData } from '@endo/marshal';
|
|
46
47
|
import type { Pattern } from '@endo/patterns';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectionManager.d.ts","sourceRoot":"","sources":["collectionManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collectionManager.d.ts","sourceRoot":"","sources":["collectionManager.js"],"names":[],"mappings":"AAsHA;;;;;;;;;;;GAWG;AACH,+CAXW,GAAC,OACD,uBAAuB,oBACvB,MAAM,MAAM,wBACZ,MAAM,MAAM,oBACZ,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,SAAS,oBAChC,GAAC,iBACD,GAAC,aACD,UAAU,MAAM,CAAC,eACjB,YAAY,MAAM,CAAC,sCACnB,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI;;4BAs+BnB,CAAC,EAAC,CAAC,UACL,MAAM,YACN,YAAY,KACV,QAAQ,CAAC,CAAC,EAAC,CAAC,CAAC;gCASb,CAAC,EAAC,CAAC,UACL,MAAM,YACN,YAAY,KACV,YAAY,CAAC,CAAC,EAAC,CAAC,CAAC;4BASjB,CAAC,UACH,MAAM,YACN,YAAY,KACV,QAAQ,CAAC,CAAC,CAAC;gCASX,CAAC,UACH,MAAM,YACN,YAAY,KACV,YAAY,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;EAsB7B;AA7lCD,6CAIG;;cAIW,OAAO;gBACP,OAAO;WACP,MAAM;qBACN,MAAM;;6CAnDsB,wBAAwB;+BAFzB,eAAe;iCAAf,eAAe;6BAC9B,gBAAgB"}
|
package/src/collectionManager.js
CHANGED
|
@@ -28,6 +28,8 @@ import { makeCache } from './cache.js';
|
|
|
28
28
|
/**
|
|
29
29
|
* @import {ToCapData, FromCapData} from '@endo/marshal';
|
|
30
30
|
* @import {Pattern} from '@endo/patterns';
|
|
31
|
+
* @import {VirtualReferenceManager} from './virtualReferences.js';
|
|
32
|
+
* @import {Cache} from './cache.js';
|
|
31
33
|
*/
|
|
32
34
|
|
|
33
35
|
// XXX TODO: The following key length limit was put in place due to limitations
|
|
@@ -116,7 +118,7 @@ function makeSchemaCache(syscall, unserialize) {
|
|
|
116
118
|
|
|
117
119
|
/**
|
|
118
120
|
* @param {*} syscall
|
|
119
|
-
* @param {
|
|
121
|
+
* @param {VirtualReferenceManager} vrm
|
|
120
122
|
* @param {() => number} allocateExportID
|
|
121
123
|
* @param {() => number} allocateCollectionID
|
|
122
124
|
* @param {(val: any) => string | undefined} convertValToSlot
|
|
@@ -140,7 +142,7 @@ export function makeCollectionManager(
|
|
|
140
142
|
) {
|
|
141
143
|
const storeKindIDToName = new Map();
|
|
142
144
|
|
|
143
|
-
/** @type {
|
|
145
|
+
/** @type { Cache<SchemaCacheValue>} */
|
|
144
146
|
const schemaCache = makeSchemaCache(syscall, unserialize);
|
|
145
147
|
|
|
146
148
|
const storeKindInfo = {
|
package/src/liveslots.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {*} syscall Kernel syscall interface that the vat will have access to
|
|
6
6
|
* @param {*} forVatID Vat ID label, for use in debug diagostics
|
|
7
7
|
* @param {*} vatPowers
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {LiveSlotsOptions} liveSlotsOptions
|
|
9
9
|
* @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent }
|
|
10
10
|
* @param {LimitedConsole} [liveSlotsConsole]
|
|
11
11
|
* @param {*} [buildVatNamespace]
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
* (using, once again, the kernel syscall interface). D(x).foo(args) will
|
|
35
35
|
* perform an immediate syscall.callNow on the device node.
|
|
36
36
|
*/
|
|
37
|
-
export function makeLiveSlots(syscall: any, forVatID: any | undefined, vatPowers: any | undefined, liveSlotsOptions:
|
|
37
|
+
export function makeLiveSlots(syscall: any, forVatID: any | undefined, vatPowers: any | undefined, liveSlotsOptions: LiveSlotsOptions, gcTools: any, liveSlotsConsole?: LimitedConsole, buildVatNamespace?: any): any;
|
|
38
38
|
export function makeMarshaller(syscall: any, gcTools: any, vatID?: string): {
|
|
39
39
|
m: any;
|
|
40
40
|
};
|
|
41
|
+
import type { LiveSlotsOptions } from './types.js';
|
|
41
42
|
import type { LimitedConsole } from '@agoric/internal/src/js-utils.js';
|
|
42
43
|
//# sourceMappingURL=liveslots.d.ts.map
|
package/src/liveslots.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveslots.d.ts","sourceRoot":"","sources":["liveslots.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"liveslots.d.ts","sourceRoot":"","sources":["liveslots.js"],"names":[],"mappings":"AAw9CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,uCAhCW,GAAC,YACD,GAAC,yBACD,GAAC,gCACD,gBAAgB,WAChB,GAAC,qBACD,cAAc,sBACd,GAAC,GAEC,GAAC,CAgDb;AAGD;;EAIC;sCAzgDkC,YAAY;oCADd,kCAAkC"}
|
package/src/liveslots.js
CHANGED
|
@@ -14,7 +14,12 @@ import { makeCollectionManager } from './collectionManager.js';
|
|
|
14
14
|
import { makeWatchedPromiseManager } from './watchedPromises.js';
|
|
15
15
|
import { makeBOYDKit } from './boyd-gc.js';
|
|
16
16
|
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @import {LimitedConsole} from '@agoric/internal/src/js-utils.js';
|
|
19
|
+
* @import {LiveSlotsOptions} from './types.js';
|
|
20
|
+
* @import {VatDeliveryObject} from './types.js';
|
|
21
|
+
* @import {SwingSetCapData} from './types.js';
|
|
22
|
+
*/
|
|
18
23
|
|
|
19
24
|
const SYSCALL_CAPDATA_BODY_SIZE_LIMIT = 10_000_000;
|
|
20
25
|
const SYSCALL_CAPDATA_SLOTS_LENGTH_LIMIT = 10_000;
|
|
@@ -31,7 +36,7 @@ const SYSCALL_CAPDATA_SLOTS_LENGTH_LIMIT = 10_000;
|
|
|
31
36
|
* @param {*} syscall Kernel syscall interface that the vat will have access to
|
|
32
37
|
* @param {*} forVatID Vat ID label, for use in debug diagnostics
|
|
33
38
|
* @param {*} vatPowers
|
|
34
|
-
* @param {
|
|
39
|
+
* @param {LiveSlotsOptions} liveSlotsOptions
|
|
35
40
|
* @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent, gcAndFinalize,
|
|
36
41
|
* meterControl }
|
|
37
42
|
* @param {LimitedConsole} console
|
|
@@ -1320,8 +1325,8 @@ function build(
|
|
|
1320
1325
|
}
|
|
1321
1326
|
|
|
1322
1327
|
/**
|
|
1323
|
-
* @param {
|
|
1324
|
-
* @returns {undefined | ReturnType<startVat>}
|
|
1328
|
+
* @param {VatDeliveryObject} delivery
|
|
1329
|
+
* @returns {undefined | ReturnType<typeof startVat>}
|
|
1325
1330
|
*/
|
|
1326
1331
|
function dispatchToUserspace(delivery) {
|
|
1327
1332
|
let result;
|
|
@@ -1384,7 +1389,7 @@ function build(
|
|
|
1384
1389
|
});
|
|
1385
1390
|
|
|
1386
1391
|
/**
|
|
1387
|
-
* @param {
|
|
1392
|
+
* @param { SwingSetCapData } _disconnectObjectCapData
|
|
1388
1393
|
* @returns {Promise<void>}
|
|
1389
1394
|
*/
|
|
1390
1395
|
async function stopVat(_disconnectObjectCapData) {
|
|
@@ -1446,7 +1451,7 @@ function build(
|
|
|
1446
1451
|
* terminate the vat). Userspace should not be able to cause the delivery
|
|
1447
1452
|
* to fail: only a bug in liveslots should trigger a failure.
|
|
1448
1453
|
*
|
|
1449
|
-
* @param {
|
|
1454
|
+
* @param {VatDeliveryObject} delivery
|
|
1450
1455
|
* @returns {Promise<void>}
|
|
1451
1456
|
*/
|
|
1452
1457
|
async function dispatch(delivery) {
|
|
@@ -1496,7 +1501,7 @@ function build(
|
|
|
1496
1501
|
* @param {*} syscall Kernel syscall interface that the vat will have access to
|
|
1497
1502
|
* @param {*} forVatID Vat ID label, for use in debug diagostics
|
|
1498
1503
|
* @param {*} vatPowers
|
|
1499
|
-
* @param {
|
|
1504
|
+
* @param {LiveSlotsOptions} liveSlotsOptions
|
|
1500
1505
|
* @param {*} gcTools { WeakRef, FinalizationRegistry, waitUntilQuiescent }
|
|
1501
1506
|
* @param {LimitedConsole} [liveSlotsConsole]
|
|
1502
1507
|
* @param {*} [buildVatNamespace]
|
package/src/message.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {VatDeliveryResult} from './types.js';
|
|
3
|
+
* @import {SwingSetCapData} from './types.js';
|
|
4
|
+
* @import {VatDeliveryObject} from './types.js';
|
|
5
|
+
* @import {VatSyscallObject} from './types.js';
|
|
6
|
+
* @import {VatSyscallResult} from './types.js';
|
|
3
7
|
*/
|
|
4
8
|
/**
|
|
5
9
|
* @typedef {{
|
|
6
|
-
* methargs:
|
|
10
|
+
* methargs: SwingSetCapData, // of [method, args]
|
|
7
11
|
* result: string | undefined | null,
|
|
8
12
|
* }} Message
|
|
9
13
|
*/
|
|
@@ -23,9 +27,9 @@
|
|
|
23
27
|
export function insistMessage(message: any): asserts message is Message;
|
|
24
28
|
/**
|
|
25
29
|
* @param {unknown} vdo
|
|
26
|
-
* @returns {asserts vdo is
|
|
30
|
+
* @returns {asserts vdo is VatDeliveryObject}
|
|
27
31
|
*/
|
|
28
|
-
export function insistVatDeliveryObject(vdo: unknown): asserts vdo is
|
|
32
|
+
export function insistVatDeliveryObject(vdo: unknown): asserts vdo is VatDeliveryObject;
|
|
29
33
|
/**
|
|
30
34
|
* @param {unknown} vdr
|
|
31
35
|
* @returns {asserts vdr is VatDeliveryResult}
|
|
@@ -33,17 +37,21 @@ export function insistVatDeliveryObject(vdo: unknown): asserts vdo is import("./
|
|
|
33
37
|
export function insistVatDeliveryResult(vdr: unknown): asserts vdr is VatDeliveryResult;
|
|
34
38
|
/**
|
|
35
39
|
* @param {unknown} vso
|
|
36
|
-
* @returns {asserts vso is
|
|
40
|
+
* @returns {asserts vso is VatSyscallObject}
|
|
37
41
|
*/
|
|
38
|
-
export function insistVatSyscallObject(vso: unknown): asserts vso is
|
|
42
|
+
export function insistVatSyscallObject(vso: unknown): asserts vso is VatSyscallObject;
|
|
39
43
|
/**
|
|
40
44
|
* @param {unknown} vsr
|
|
41
|
-
* @returns {asserts vsr is
|
|
45
|
+
* @returns {asserts vsr is VatSyscallResult}
|
|
42
46
|
*/
|
|
43
|
-
export function insistVatSyscallResult(vsr: unknown): asserts vsr is
|
|
47
|
+
export function insistVatSyscallResult(vsr: unknown): asserts vsr is VatSyscallResult;
|
|
44
48
|
export type Message = {
|
|
45
|
-
methargs:
|
|
49
|
+
methargs: SwingSetCapData;
|
|
46
50
|
result: string | undefined | null;
|
|
47
51
|
};
|
|
52
|
+
import type { VatDeliveryObject } from './types.js';
|
|
48
53
|
import type { VatDeliveryResult } from './types.js';
|
|
54
|
+
import type { VatSyscallObject } from './types.js';
|
|
55
|
+
import type { VatSyscallResult } from './types.js';
|
|
56
|
+
import type { SwingSetCapData } from './types.js';
|
|
49
57
|
//# sourceMappingURL=message.d.ts.map
|
package/src/message.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["message.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["message.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH,uCARW,GAAG,GAKD,QAAQ,OAAO,IAAI,OAAO,CAStC;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,iBAAiB,CAwD5C;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,iBAAiB,CAkB5C;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,gBAAgB,CA4E3C;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,gBAAgB,CAkB3C;sBAlNY;IACV,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACjC;uCATgC,YAAY;uCAFZ,YAAY;sCAGb,YAAY;sCACZ,YAAY;qCAHb,YAAY"}
|
package/src/message.js
CHANGED
|
@@ -3,11 +3,15 @@ import { insistCapData } from './capdata.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @import {VatDeliveryResult} from './types.js';
|
|
6
|
+
* @import {SwingSetCapData} from './types.js';
|
|
7
|
+
* @import {VatDeliveryObject} from './types.js';
|
|
8
|
+
* @import {VatSyscallObject} from './types.js';
|
|
9
|
+
* @import {VatSyscallResult} from './types.js';
|
|
6
10
|
*/
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* @typedef {{
|
|
10
|
-
* methargs:
|
|
14
|
+
* methargs: SwingSetCapData, // of [method, args]
|
|
11
15
|
* result: string | undefined | null,
|
|
12
16
|
* }} Message
|
|
13
17
|
*/
|
|
@@ -36,7 +40,7 @@ export function insistMessage(message) {
|
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* @param {unknown} vdo
|
|
39
|
-
* @returns {asserts vdo is
|
|
43
|
+
* @returns {asserts vdo is VatDeliveryObject}
|
|
40
44
|
*/
|
|
41
45
|
|
|
42
46
|
export function insistVatDeliveryObject(vdo) {
|
|
@@ -118,7 +122,7 @@ export function insistVatDeliveryResult(vdr) {
|
|
|
118
122
|
|
|
119
123
|
/**
|
|
120
124
|
* @param {unknown} vso
|
|
121
|
-
* @returns {asserts vso is
|
|
125
|
+
* @returns {asserts vso is VatSyscallObject}
|
|
122
126
|
*/
|
|
123
127
|
|
|
124
128
|
export function insistVatSyscallObject(vso) {
|
|
@@ -198,7 +202,7 @@ export function insistVatSyscallObject(vso) {
|
|
|
198
202
|
|
|
199
203
|
/**
|
|
200
204
|
* @param {unknown} vsr
|
|
201
|
-
* @returns {asserts vsr is
|
|
205
|
+
* @returns {asserts vsr is VatSyscallResult}
|
|
202
206
|
*/
|
|
203
207
|
|
|
204
208
|
export function insistVatSyscallResult(vsr) {
|
package/src/types.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type LiveSlotsOptions = {
|
|
|
36
36
|
*/
|
|
37
37
|
allowStateShapeChanges?: boolean | undefined;
|
|
38
38
|
};
|
|
39
|
-
export type SwingSetCapData =
|
|
39
|
+
export type SwingSetCapData = CapData<string>;
|
|
40
40
|
export type Message = {
|
|
41
41
|
methargs: SwingSetCapData;
|
|
42
42
|
result: string | undefined | null;
|
|
@@ -78,4 +78,5 @@ export type PromiseWatcher<V, A extends any[] = unknown[]> = {
|
|
|
78
78
|
onFulfilled?: (value: V, ...args: A) => void;
|
|
79
79
|
onRejected?: (reason: unknown, ...args: A) => void;
|
|
80
80
|
};
|
|
81
|
+
import type { CapData } from '@endo/marshal';
|
|
81
82
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":"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"}
|
package/src/types.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Ensure this is a module.
|
|
2
2
|
export {};
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {CapData} from '@endo/marshal';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* @callback makeLiveSlots
|
|
6
10
|
*/
|
|
@@ -29,7 +33,7 @@ export {};
|
|
|
29
33
|
* relates to *arbitrary* changes (per #10200, a non-true value still permits
|
|
30
34
|
* backwards-compatible addition of new optional fields)
|
|
31
35
|
*
|
|
32
|
-
* @typedef {
|
|
36
|
+
* @typedef {CapData<string>} SwingSetCapData
|
|
33
37
|
*
|
|
34
38
|
* @typedef {{
|
|
35
39
|
* methargs: SwingSetCapData, // of [method, args]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function makeVirtualObjectManager(syscall: any, vrm:
|
|
1
|
+
export function makeVirtualObjectManager(syscall: any, vrm: VirtualReferenceManager, allocateExportID: () => number, getSlotForVal: (val: object) => string | undefined, requiredValForSlot: (slot: string) => object, registerValue: any, serialize: ToCapData<string>, unserialize: FromCapData<string>, assertAcceptableSyscallCapdataSize: any, liveSlotsOptions?: LiveSlotsOptions, { WeakMap, WeakSet }?: {
|
|
2
2
|
WeakMap: typeof globalThis.WeakMap;
|
|
3
3
|
WeakSet: typeof globalThis.WeakSet;
|
|
4
4
|
}): {
|
|
@@ -37,8 +37,10 @@ export function makeVirtualObjectManager(syscall: any, vrm: import("./virtualRef
|
|
|
37
37
|
canBeDurable: (specimen: any) => boolean;
|
|
38
38
|
};
|
|
39
39
|
export type VirtualObjectManager = ReturnType<typeof makeVirtualObjectManager>;
|
|
40
|
+
import type { VirtualReferenceManager } from './virtualReferences.js';
|
|
40
41
|
import type { ToCapData } from '@endo/marshal';
|
|
41
42
|
import type { FromCapData } from '@endo/marshal';
|
|
43
|
+
import type { LiveSlotsOptions } from './types.js';
|
|
42
44
|
import type { DefineKindOptions } from '@agoric/swingset-liveslots';
|
|
43
45
|
import type { DurableKindHandle } from '@agoric/swingset-liveslots';
|
|
44
46
|
//# sourceMappingURL=virtualObjectManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualObjectManager.d.ts","sourceRoot":"","sources":["virtualObjectManager.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtualObjectManager.d.ts","sourceRoot":"","sources":["virtualObjectManager.js"],"names":[],"mappings":"AAqWO,kDApDI,GAAC,OACD,uBAAuB,oBAEvB,MAAM,MAAM,iBAEZ,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,sBAGnC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,iBACxB,GAAC,aAED,UAAU,MAAM,CAAC,eACjB,YAAY,MAAM,CAAC,sCACnB,GAAC,qBAED,gBAAgB,yBAChB;IAAE,OAAO,EAAE,yBAAc,CAAC;IAAC,OAAO,EAAE,yBAAc,CAAA;CAAE;;iEA9KS,GAAG,kHAEnE,GAAG;sEAG+B,GAAG,0HAGE,GAAG;0FAK/C,GAAE,kHACqC,GAAG;+FAIU,GAAG,0HAEvD,GAAG;0BAimCO,MAAM,KACJ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqI/B;mCAEa,UAAU,CAAC,OAAO,wBAAwB,CAAC;6CAv3Cf,wBAAwB;+BAHzB,eAAe;iCAAf,eAAe;sCAIrB,YAAY;uCANX,4BAA4B;uCAD5B,4BAA4B"}
|
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
* @import {ToCapData, FromCapData} from '@endo/marshal';
|
|
24
24
|
* @import {Pattern} from '@endo/patterns';
|
|
25
25
|
* @import {SwingSetCapData} from './types.js';
|
|
26
|
+
* @import {VirtualReferenceManager} from './virtualReferences.js';
|
|
27
|
+
* @import {LiveSlotsOptions} from './types.js';
|
|
28
|
+
* @import {Cache} from './cache.js';
|
|
29
|
+
* @import {VatData} from './vatDataTypes.js';
|
|
26
30
|
*/
|
|
27
31
|
|
|
28
32
|
const {
|
|
@@ -300,7 +304,7 @@ const insistCompatibleShapeCapData = (
|
|
|
300
304
|
* Create a new virtual object manager. There is one of these for each vat.
|
|
301
305
|
*
|
|
302
306
|
* @param {*} syscall Vat's syscall object, used to access the vatstore operations.
|
|
303
|
-
* @param {
|
|
307
|
+
* @param {VirtualReferenceManager} vrm Virtual reference manager, to handle reference counting and GC
|
|
304
308
|
* of virtual references.
|
|
305
309
|
* @param {() => number} allocateExportID Function to allocate the next object
|
|
306
310
|
* export ID for the enclosing vat.
|
|
@@ -314,7 +318,7 @@ const insistCompatibleShapeCapData = (
|
|
|
314
318
|
* @param {FromCapData<string>} unserialize Unserializer for this vat
|
|
315
319
|
* @param {*} assertAcceptableSyscallCapdataSize Function to check for oversized
|
|
316
320
|
* syscall params
|
|
317
|
-
* @param {
|
|
321
|
+
* @param {LiveSlotsOptions} [liveSlotsOptions]
|
|
318
322
|
* @param {{ WeakMap: typeof WeakMap, WeakSet: typeof WeakSet }} [powers]
|
|
319
323
|
* Specifying the underlying WeakMap/WeakSet objects to wrap with
|
|
320
324
|
* VirtualObjectAwareWeakMap/Set. By default, capture the ones currently
|
|
@@ -877,7 +881,7 @@ export const makeVirtualObjectManager = (
|
|
|
877
881
|
// (capdata) contents of the virtual-object state record.
|
|
878
882
|
// dataCache[baseRef] -> { capdatas, valueMap }
|
|
879
883
|
// valueCD=capdatas[prop], value=valueMap.get(prop)
|
|
880
|
-
/** @type {
|
|
884
|
+
/** @type { Cache<{ capdatas: any, valueMap: Map<string, any> }>} */
|
|
881
885
|
const dataCache = makeDataCache(syscall);
|
|
882
886
|
allCaches.push(dataCache);
|
|
883
887
|
|
|
@@ -1248,7 +1252,7 @@ export const makeVirtualObjectManager = (
|
|
|
1248
1252
|
return id;
|
|
1249
1253
|
};
|
|
1250
1254
|
|
|
1251
|
-
/** @type {
|
|
1255
|
+
/** @type {VatData['defineKind']} */
|
|
1252
1256
|
const defineKind = (tag, init, behavior, options) => {
|
|
1253
1257
|
const kindID = `${allocateExportID()}`;
|
|
1254
1258
|
saveVirtualKindDescriptor(kindID, { kindID, tag });
|
|
@@ -1264,7 +1268,7 @@ export const makeVirtualObjectManager = (
|
|
|
1264
1268
|
);
|
|
1265
1269
|
};
|
|
1266
1270
|
|
|
1267
|
-
/** @type {
|
|
1271
|
+
/** @type {VatData['defineKindMulti']} */
|
|
1268
1272
|
const defineKindMulti = (tag, init, behavior, options) => {
|
|
1269
1273
|
const kindID = `${allocateExportID()}`;
|
|
1270
1274
|
saveVirtualKindDescriptor(kindID, { kindID, tag });
|
|
@@ -1304,7 +1308,7 @@ export const makeVirtualObjectManager = (
|
|
|
1304
1308
|
return kindHandle;
|
|
1305
1309
|
};
|
|
1306
1310
|
|
|
1307
|
-
/** @type {
|
|
1311
|
+
/** @type {VatData['defineDurableKind']} */
|
|
1308
1312
|
const defineDurableKind = (kindHandle, init, behavior, options) => {
|
|
1309
1313
|
kindHandleToID.has(kindHandle) || Fail`unknown handle ${kindHandle}`;
|
|
1310
1314
|
const kindID = kindHandleToID.get(kindHandle);
|
|
@@ -1327,7 +1331,7 @@ export const makeVirtualObjectManager = (
|
|
|
1327
1331
|
return maker;
|
|
1328
1332
|
};
|
|
1329
1333
|
|
|
1330
|
-
/** @type {
|
|
1334
|
+
/** @type {VatData['defineDurableKindMulti']} */
|
|
1331
1335
|
const defineDurableKindMulti = (kindHandle, init, behavior, options) => {
|
|
1332
1336
|
kindHandleToID.has(kindHandle) || Fail`unknown handle ${kindHandle}`;
|
|
1333
1337
|
const kindID = kindHandleToID.get(kindHandle);
|
package/src/watchedPromises.d.ts
CHANGED
|
@@ -1,31 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {PromiseWatcher} from './types.js';
|
|
3
|
+
* @import {VirtualReferenceManager} from './virtualReferences.js';
|
|
4
|
+
* @import {VirtualObjectManager} from './virtualObjectManager.js';
|
|
5
|
+
* @import {ConvertValToSlot} from '@endo/marshal';
|
|
6
|
+
* @import {ConvertSlotToVal} from '@endo/marshal';
|
|
7
|
+
* @import {DurableKindHandle} from './vatDataTypes.js';
|
|
8
|
+
*/
|
|
1
9
|
/**
|
|
2
10
|
* @template V
|
|
3
11
|
* @template {any[]} [A=unknown[]]
|
|
4
|
-
* @typedef {[watcher:
|
|
12
|
+
* @typedef {[watcher: PromiseWatcher<V, A>, ...args: A]} PromiseWatcherTuple
|
|
5
13
|
*/
|
|
6
14
|
/**
|
|
7
15
|
* @param {object} options
|
|
8
16
|
* @param {*} options.syscall
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
17
|
+
* @param {VirtualReferenceManager} options.vrm
|
|
18
|
+
* @param {VirtualObjectManager} options.vom
|
|
11
19
|
* @param {*} options.collectionManager
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
20
|
+
* @param {ConvertValToSlot<any>} options.convertValToSlot
|
|
21
|
+
* @param {ConvertSlotToVal<any>} options.convertSlotToVal
|
|
14
22
|
* @param {(vref: any) => boolean} options.maybeExportPromise
|
|
15
23
|
*/
|
|
16
24
|
export function makeWatchedPromiseManager({ syscall, vrm, vom, collectionManager, convertValToSlot, convertSlotToVal, maybeExportPromise, }: {
|
|
17
25
|
syscall: any;
|
|
18
|
-
vrm:
|
|
19
|
-
vom:
|
|
26
|
+
vrm: VirtualReferenceManager;
|
|
27
|
+
vom: VirtualObjectManager;
|
|
20
28
|
collectionManager: any;
|
|
21
|
-
convertValToSlot:
|
|
22
|
-
convertSlotToVal:
|
|
29
|
+
convertValToSlot: ConvertValToSlot<any>;
|
|
30
|
+
convertSlotToVal: ConvertSlotToVal<any>;
|
|
23
31
|
maybeExportPromise: (vref: any) => boolean;
|
|
24
32
|
}): {
|
|
25
33
|
preparePromiseWatcherTables: () => void;
|
|
26
34
|
loadWatchedPromiseTable: (revivePromise: (vref: any) => Promise<any>) => void;
|
|
27
|
-
providePromiseWatcher: <V, A extends any[]>(kindHandle:
|
|
28
|
-
watchPromise: <P extends Promise<any>, A extends any[]>(p: P, watcher:
|
|
35
|
+
providePromiseWatcher: <V, A extends any[]>(kindHandle: DurableKindHandle, fulfillHandler?: (value: V, ...args: A) => void, rejectHandler?: (reason: any, ...args: A) => void) => PromiseWatcher<V, A>;
|
|
36
|
+
watchPromise: <P extends Promise<any>, A extends any[]>(p: P, watcher: PromiseWatcher<Awaited<P>, A>, ...args: A) => void;
|
|
29
37
|
};
|
|
30
|
-
export type PromiseWatcherTuple<V, A extends any[] = unknown[]> = [watcher:
|
|
38
|
+
export type PromiseWatcherTuple<V, A extends any[] = unknown[]> = [watcher: PromiseWatcher<V, A>, ...args: A];
|
|
39
|
+
import type { VirtualReferenceManager } from './virtualReferences.js';
|
|
40
|
+
import type { VirtualObjectManager } from './virtualObjectManager.js';
|
|
41
|
+
import type { ConvertValToSlot } from '@endo/marshal';
|
|
42
|
+
import type { ConvertSlotToVal } from '@endo/marshal';
|
|
43
|
+
import type { DurableKindHandle } from './vatDataTypes.js';
|
|
44
|
+
import type { PromiseWatcher } from './types.js';
|
|
31
45
|
//# sourceMappingURL=watchedPromises.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchedPromises.d.ts","sourceRoot":"","sources":["watchedPromises.js"],"names":[],"mappings":"AASA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,6IARG;IAAmB,OAAO,EAAlB,GAAC;
|
|
1
|
+
{"version":3,"file":"watchedPromises.d.ts","sourceRoot":"","sources":["watchedPromises.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,6IARG;IAAmB,OAAO,EAAlB,GAAC;IACgC,GAAG,EAApC,uBAAuB;IACO,GAAG,EAAjC,oBAAoB;IACT,iBAAiB,EAA5B,GAAC;IAC8B,gBAAgB,EAA/C,iBAAiB,GAAG,CAAC;IACU,gBAAgB,EAA/C,iBAAiB,GAAG,CAAC;IACW,kBAAkB,EAAlD,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO;CAChC;;6CA+GY,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,KACzB,IAAI;4BAiBJ,CAAC,EACO,CAAC,SAAR,GAAG,EAAG,cACT,iBAAiB,mBACjB,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,kBAC9B,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,KAC/B,eAAe,CAAC,EAAE,CAAC,CAAC;mBAmCtB,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,KAAK,CAAC,WAAW,eAAe,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI;EAoEtH;gCA3PY,CAAC,EACQ,CAAC,SAAT,GAAG,EAAG,gBACP,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;6CAVd,wBAAwB;0CAC3B,2BAA2B;sCAC/B,eAAe;sCACf,eAAe;uCACd,mBAAmB;oCALtB,YAAY"}
|
package/src/watchedPromises.js
CHANGED
|
@@ -7,20 +7,29 @@ import { E } from '@endo/eventual-send';
|
|
|
7
7
|
import { initEmpty, M } from '@agoric/store';
|
|
8
8
|
import { parseVatSlot } from './parseVatSlots.js';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @import {PromiseWatcher} from './types.js';
|
|
12
|
+
* @import {VirtualReferenceManager} from './virtualReferences.js';
|
|
13
|
+
* @import {VirtualObjectManager} from './virtualObjectManager.js';
|
|
14
|
+
* @import {ConvertValToSlot} from '@endo/marshal';
|
|
15
|
+
* @import {ConvertSlotToVal} from '@endo/marshal';
|
|
16
|
+
* @import {DurableKindHandle} from './vatDataTypes.js';
|
|
17
|
+
*/
|
|
18
|
+
|
|
10
19
|
/**
|
|
11
20
|
* @template V
|
|
12
21
|
* @template {any[]} [A=unknown[]]
|
|
13
|
-
* @typedef {[watcher:
|
|
22
|
+
* @typedef {[watcher: PromiseWatcher<V, A>, ...args: A]} PromiseWatcherTuple
|
|
14
23
|
*/
|
|
15
24
|
|
|
16
25
|
/**
|
|
17
26
|
* @param {object} options
|
|
18
27
|
* @param {*} options.syscall
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
28
|
+
* @param {VirtualReferenceManager} options.vrm
|
|
29
|
+
* @param {VirtualObjectManager} options.vom
|
|
21
30
|
* @param {*} options.collectionManager
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
31
|
+
* @param {ConvertValToSlot<any>} options.convertValToSlot
|
|
32
|
+
* @param {ConvertSlotToVal<any>} options.convertSlotToVal
|
|
24
33
|
* @param {(vref: any) => boolean} options.maybeExportPromise
|
|
25
34
|
*/
|
|
26
35
|
export function makeWatchedPromiseManager({
|
|
@@ -54,7 +63,7 @@ export function makeWatchedPromiseManager({
|
|
|
54
63
|
/**
|
|
55
64
|
* defined promise watcher objects indexed by kindHandle
|
|
56
65
|
*
|
|
57
|
-
* @type {MapStore<
|
|
66
|
+
* @type {MapStore<DurableKindHandle, PromiseWatcher<unknown>>}
|
|
58
67
|
*/
|
|
59
68
|
let promiseWatcherByKindTable;
|
|
60
69
|
|
|
@@ -153,10 +162,10 @@ export function makeWatchedPromiseManager({
|
|
|
153
162
|
/**
|
|
154
163
|
* @template V
|
|
155
164
|
* @template {any[]} A]
|
|
156
|
-
* @param {
|
|
165
|
+
* @param {DurableKindHandle} kindHandle
|
|
157
166
|
* @param {(value: V, ...args: A) => void} fulfillHandler
|
|
158
167
|
* @param {(reason: any, ...args: A) => void} rejectHandler
|
|
159
|
-
* @returns {
|
|
168
|
+
* @returns {PromiseWatcher<V, A>}
|
|
160
169
|
*/
|
|
161
170
|
function providePromiseWatcher(
|
|
162
171
|
kindHandle,
|
|
@@ -191,7 +200,7 @@ export function makeWatchedPromiseManager({
|
|
|
191
200
|
}
|
|
192
201
|
|
|
193
202
|
/**
|
|
194
|
-
* @type {<P extends Promise<any>, A extends any[]>(p: P, watcher:
|
|
203
|
+
* @type {<P extends Promise<any>, A extends any[]>(p: P, watcher: PromiseWatcher<Awaited<P>, A>, ...args: A) => void}
|
|
195
204
|
*/
|
|
196
205
|
function watchPromise(p, watcher, ...args) {
|
|
197
206
|
// The following wrapping defers setting up the promise watcher itself to a
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @import {MeterControl} from '../src/types.js';
|
|
3
|
+
*/
|
|
4
|
+
export function makeDummyMeterControl(): MeterControl;
|
|
5
|
+
import type { MeterControl } from '../src/types.js';
|
|
2
6
|
//# sourceMappingURL=dummyMeterControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dummyMeterControl.d.ts","sourceRoot":"","sources":["dummyMeterControl.js"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"dummyMeterControl.d.ts","sourceRoot":"","sources":["dummyMeterControl.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH,sDAmDC;kCAtD8B,iBAAiB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { assert } from '@endo/errors';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @import {MeterControl} from '../src/types.js';
|
|
5
|
+
*/
|
|
6
|
+
|
|
3
7
|
export function makeDummyMeterControl() {
|
|
4
8
|
let meteringDisabled = 0;
|
|
5
9
|
|
|
@@ -41,7 +45,7 @@ export function makeDummyMeterControl() {
|
|
|
41
45
|
return harden(wrapped);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
/** @type {
|
|
48
|
+
/** @type { MeterControl } */
|
|
45
49
|
const meterControl = {
|
|
46
50
|
isMeteringDisabled,
|
|
47
51
|
assertIsMetered,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ExecutionContext} from 'ava';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* @param {object} [options]
|
|
3
6
|
* @param {boolean} [options.skipLogging]
|
|
@@ -28,7 +31,7 @@ export function makeDispatch(syscall: any, build: any, vatID?: string, liveSlots
|
|
|
28
31
|
testHooks: any;
|
|
29
32
|
}>;
|
|
30
33
|
/**
|
|
31
|
-
* @param {
|
|
34
|
+
* @param {ExecutionContext} t
|
|
32
35
|
* @param {Function} buildRootObject
|
|
33
36
|
* @param {string} vatName
|
|
34
37
|
* @param {object} [options]
|
|
@@ -38,7 +41,7 @@ export function makeDispatch(syscall: any, build: any, vatID?: string, liveSlots
|
|
|
38
41
|
* @param {boolean} [options.skipLogging]
|
|
39
42
|
* @param {any} [options.vatParameters]
|
|
40
43
|
*/
|
|
41
|
-
export function setupTestLiveslots(t:
|
|
44
|
+
export function setupTestLiveslots(t: ExecutionContext, buildRootObject: Function, vatName: string, options?: {
|
|
42
45
|
forceGC?: boolean | undefined;
|
|
43
46
|
kvStore?: Map<string, string> | undefined;
|
|
44
47
|
nextPromiseImportNumber?: number | undefined;
|
|
@@ -46,7 +49,7 @@ export function setupTestLiveslots(t: import("ava").ExecutionContext, buildRootO
|
|
|
46
49
|
vatParameters?: any;
|
|
47
50
|
}): Promise<{
|
|
48
51
|
v: {
|
|
49
|
-
t:
|
|
52
|
+
t: ExecutionContext;
|
|
50
53
|
log: any[];
|
|
51
54
|
fakestore: Map<any, any>;
|
|
52
55
|
dumpFakestore: () => void;
|
|
@@ -61,4 +64,5 @@ export function setupTestLiveslots(t: import("ava").ExecutionContext, buildRootO
|
|
|
61
64
|
testHooks: any;
|
|
62
65
|
}>;
|
|
63
66
|
export function findSyscallsByType(log: any, type: any): any;
|
|
67
|
+
import type { ExecutionContext } from 'ava';
|
|
64
68
|
//# sourceMappingURL=liveslots-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveslots-helpers.d.ts","sourceRoot":"","sources":["liveslots-helpers.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,uCAHG;IAA0B,WAAW;IACC,OAAO;CAAC;;;;;;;;;;;;;;;;EA2GhD;AAED;;;GA2BC;AAUD;;;;;;;;;;GAUG;AACH,sCAVW,
|
|
1
|
+
{"version":3,"file":"liveslots-helpers.d.ts","sourceRoot":"","sources":["liveslots-helpers.js"],"names":[],"mappings":"AAgBA;;GAEG;AAEH;;;;GAIG;AACH,uCAHG;IAA0B,WAAW;IACC,OAAO;CAAC;;;;;;;;;;;;;;;;EA2GhD;AAED;;;GA2BC;AAUD;;;;;;;;;;GAUG;AACH,sCAVW,gBAAgB,sCAEhB,MAAM,YAEd;IAA0B,OAAO;IACK,OAAO;IACpB,uBAAuB;IACtB,WAAW;IACf,aAAa,GAA3B,GAAG;CAAyB;;;;;;;;;;;;;;;GA6GtC;AAED,6DAEC;sCAlRkC,KAAK"}
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
makeBringOutYourDead,
|
|
15
15
|
} from './util.js';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @import {ExecutionContext} from 'ava';
|
|
19
|
+
*/
|
|
20
|
+
|
|
17
21
|
/**
|
|
18
22
|
* @param {object} [options]
|
|
19
23
|
* @param {boolean} [options.skipLogging]
|
|
@@ -164,7 +168,7 @@ function makeRPMaker(nextNumber = 1) {
|
|
|
164
168
|
}
|
|
165
169
|
|
|
166
170
|
/**
|
|
167
|
-
* @param {
|
|
171
|
+
* @param {ExecutionContext} t
|
|
168
172
|
* @param {Function} buildRootObject
|
|
169
173
|
* @param {string} vatName
|
|
170
174
|
* @param {object} [options]
|
|
@@ -11,7 +11,10 @@ import { makeStartVat, makeMessage } from '../util.js';
|
|
|
11
11
|
import { makeMockGC } from '../mock-gc.js';
|
|
12
12
|
import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js';
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @import {VatOneResolution} from '../../src/types.js';
|
|
16
|
+
* @import {Pattern} from '@endo/patterns';
|
|
17
|
+
*/
|
|
15
18
|
/** @import {VatData} from '../../src/vatDataTypes.js'; */
|
|
16
19
|
|
|
17
20
|
let lastPnum = 100;
|
|
@@ -63,7 +66,7 @@ const holderMethods = {
|
|
|
63
66
|
* @template {VatData.defineKind | VatData.defineDurableKind} D
|
|
64
67
|
* @param {D} defineKind
|
|
65
68
|
* @param {Parameters<D>[0]} kindIdentifier
|
|
66
|
-
* @param {
|
|
69
|
+
* @param {Pattern} stateShape
|
|
67
70
|
*/
|
|
68
71
|
const defineHolder = (defineKind, kindIdentifier, stateShape) =>
|
|
69
72
|
defineKind(kindIdentifier, initHolder, holderMethods, { stateShape });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeVirtualSupport.d.ts","sourceRoot":"","sources":["fakeVirtualSupport.js"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuQC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcC;AAED;;;
|
|
1
|
+
{"version":3,"file":"fakeVirtualSupport.d.ts","sourceRoot":"","sources":["fakeVirtualSupport.js"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuQC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcC;AAED;;;4IAtHM,GAAC,gDACyB,GAAI;;EAoInC;AAED;;;;;;;;;;GAUG;AACH,+CAPG;IAAyB,SAAS;IACR,oBAAoB;IACR,SAAS;IACV,OAAO;IACP,OAAO;IAClB,IAAI;CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAjFH,GAC9B,+IAKuB,GAAG;0EAQd,GAAG,uJAKV,GAAG;+HAeL,GAAG,+IAKiB,GAAG;oIAOA,GAC1B,uJAGG,GAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gJAjHA,GAAC,gDACyB,GAAI;;;EAgKnC;AAED;;;;;;;;iEApG+B,GAC9B,+IAKuB,GAAG;sEAQd,GAAG,uJAKV,GAAG;2HAeL,GAAG,+IAKiB,GAAG;gIAOA,GAC1B,uJAGG,GAAE;;;;;;;;;;;;;;;;;;;EA0DL;AAED;;;;;;;;;;;;EAMC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export function flushIncarnation(options?: Partial<ReincarnateOptions>): Omit<ReincarnateOptions, "fakeVomKit">;
|
|
2
2
|
export function reincarnate(options?: Partial<ReincarnateOptions>): ReincarnateOptions;
|
|
3
3
|
export type FakeVomKit = ReturnType<typeof makeFakeVirtualStuff>;
|
|
4
|
-
export type ReincarnateOptions =
|
|
4
|
+
export type ReincarnateOptions = Simplify<Omit<NonNullable<Parameters<typeof makeFakeVirtualStuff>[0]>, "WeakMap" | "WeakSet"> & {
|
|
5
5
|
fakeVomKit: FakeVomKit;
|
|
6
6
|
fakeStore: Map<string, string>;
|
|
7
7
|
}>;
|
|
8
8
|
import { makeFakeVirtualStuff } from './fakeVirtualSupport.js';
|
|
9
|
+
import type { Simplify } from '@agoric/internal';
|
|
9
10
|
//# sourceMappingURL=setup-vat-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-vat-data.d.ts","sourceRoot":"","sources":["setup-vat-data.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-vat-data.d.ts","sourceRoot":"","sources":["setup-vat-data.js"],"names":[],"mappings":"AA+DO,2CAHI,OAAO,CAAC,kBAAkB,CAAC,GACzB,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAelD;AAOM,sCAHI,OAAO,CAAC,kBAAkB,CAAC,GACzB,kBAAkB,CAiB9B;yBAjFa,UAAU,CAAC,OAAO,oBAAoB,CAAC;iCAmCxC,SACR,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC,GACxF;IAAM,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAC3D;qCA9CiC,yBAAyB;8BAGnC,kBAAkB"}
|
package/tools/setup-vat-data.js
CHANGED
|
@@ -9,6 +9,10 @@ import { passStyleOf } from '@endo/pass-style';
|
|
|
9
9
|
import { PassStyleOfEndowmentSymbol } from '@endo/pass-style/endow.js';
|
|
10
10
|
import { makeFakeVirtualStuff } from './fakeVirtualSupport.js';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @import {Simplify} from '@agoric/internal';
|
|
14
|
+
*/
|
|
15
|
+
|
|
12
16
|
const { WeakMap, WeakSet } = globalThis;
|
|
13
17
|
|
|
14
18
|
/** @typedef {ReturnType<typeof makeFakeVirtualStuff>} FakeVomKit */
|
|
@@ -46,7 +50,7 @@ globalThis.VatData = harden({
|
|
|
46
50
|
globalThis[PassStyleOfEndowmentSymbol] = passStyleOf;
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
|
-
* @typedef {
|
|
53
|
+
* @typedef {Simplify<
|
|
50
54
|
* Omit<NonNullable<Parameters<typeof makeFakeVirtualStuff>[0]>, 'WeakMap' | 'WeakSet'> &
|
|
51
55
|
* { fakeVomKit: FakeVomKit; fakeStore: Map<string, string> }
|
|
52
56
|
* >} ReincarnateOptions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function runVOTest(t: any, prepare: any, makeTestObject: any, testTestObject: any): Promise<void>;
|
|
2
|
-
export function makeSpy(t:
|
|
2
|
+
export function makeSpy(t: ExecutionContext): {
|
|
3
3
|
fail: (msg: any) => void;
|
|
4
4
|
falsy: (check: any, msg: any) => void;
|
|
5
5
|
failureMessage: string;
|
|
@@ -30,4 +30,5 @@ export function makeSpy(t: import("ava").ExecutionContext): {
|
|
|
30
30
|
true: import("ava").TrueAssertion;
|
|
31
31
|
truthy: import("ava").TruthyAssertion;
|
|
32
32
|
};
|
|
33
|
+
import type { ExecutionContext } from 'ava';
|
|
33
34
|
//# sourceMappingURL=vo-test-harness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vo-test-harness.d.ts","sourceRoot":"","sources":["vo-test-harness.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vo-test-harness.d.ts","sourceRoot":"","sources":["vo-test-harness.js"],"names":[],"mappings":"AAkGA,yGAqEC;AAxJM,2BAFI,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB1B;sCA1BkC,KAAK"}
|
package/tools/vo-test-harness.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Far } from '@endo/marshal';
|
|
2
2
|
import { setupTestLiveslots } from '../test/liveslots-helpers.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {ExecutionContext} from 'ava';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
// This file contains a test harness for virtual objects. runVOTest()
|
|
5
9
|
// is to to help verify that a VO can be garbage collected and then
|
|
6
10
|
// reloaded from persistent storage while maintaining functionality.
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* A spy wrapping Ava's t for tests that are testing the harness itself.
|
|
10
|
-
* @param {
|
|
14
|
+
* @param {ExecutionContext} t
|
|
11
15
|
*/
|
|
12
16
|
export const makeSpy = t => {
|
|
13
17
|
const tSpy = {
|