@agoric/swingset-liveslots 0.10.3-u19.2 → 0.10.3-u20.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 +16 -16
- package/src/collectionManager.d.ts +1 -0
- package/src/collectionManager.d.ts.map +1 -1
- package/src/collectionManager.js +1 -0
- package/src/liveslots.js +2 -2
- package/src/message.d.ts +10 -6
- package/src/message.d.ts.map +1 -1
- package/src/message.js +7 -3
- package/src/types.d.ts +8 -3
- package/src/types.d.ts.map +1 -1
- package/src/types.js +6 -5
- package/src/virtualObjectManager.d.ts.map +1 -1
- package/src/virtualObjectManager.js +70 -14
- package/src/watchedPromises.d.ts.map +1 -1
- package/src/watchedPromises.js +10 -13
- package/test/gc-helpers.js +2 -2
- package/test/handled-promises.test.js +529 -163
- package/test/initial-vrefs.test.js +12 -18
- package/test/liveslots-helpers.d.ts +1 -0
- package/test/liveslots-helpers.d.ts.map +1 -1
- package/test/liveslots-helpers.js +1 -0
- package/test/liveslots-real-gc.test.js +2 -2
- package/test/liveslots.test.js +3 -3
- package/test/storeGC/lifecycle.test.js +13 -12
- package/test/util.d.ts +1 -1
- package/test/util.d.ts.map +1 -1
- package/test/util.js +2 -2
- package/test/virtual-objects/state-shape.test.js +312 -221
- package/test/virtual-objects/virtualObjectGC.test.js +37 -36
- package/test/virtual-objects/virtualObjectManager.test.js +41 -63
- package/test/vo-test-harness.test.js +13 -9
- package/tools/fakeVirtualSupport.d.ts.map +1 -1
- package/tools/setup-vat-data.d.ts.map +1 -1
- package/tools/setup-vat-data.js +0 -1
- package/tools/vo-test-harness.d.ts +31 -0
- package/tools/vo-test-harness.d.ts.map +1 -1
- package/tools/vo-test-harness.js +21 -0
- package/test/watch-promise.test.js +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swingset-liveslots",
|
|
3
|
-
"version": "0.10.3-
|
|
3
|
+
"version": "0.10.3-u20.0",
|
|
4
4
|
"description": "SwingSet ocap support layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
"postpack": "git clean -f ':!src/types-index.d.ts' '*.d.ts*' '*.tsbuildinfo'"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@agoric/internal": "^0.4.0-
|
|
23
|
-
"@agoric/store": "^0.9.3-
|
|
22
|
+
"@agoric/internal": "^0.4.0-u20.0",
|
|
23
|
+
"@agoric/store": "^0.9.3-u20.0",
|
|
24
24
|
"@endo/env-options": "^1.1.8",
|
|
25
|
-
"@endo/errors": "^1.2.
|
|
26
|
-
"@endo/eventual-send": "^1.3.
|
|
27
|
-
"@endo/exo": "^1.5.
|
|
28
|
-
"@endo/far": "^1.1.
|
|
29
|
-
"@endo/init": "^1.1.
|
|
30
|
-
"@endo/marshal": "^1.6.
|
|
31
|
-
"@endo/nat": "^5.0
|
|
32
|
-
"@endo/pass-style": "^1.
|
|
33
|
-
"@endo/patterns": "^1.
|
|
34
|
-
"@endo/promise-kit": "^1.1.
|
|
25
|
+
"@endo/errors": "^1.2.10",
|
|
26
|
+
"@endo/eventual-send": "^1.3.1",
|
|
27
|
+
"@endo/exo": "^1.5.9",
|
|
28
|
+
"@endo/far": "^1.1.11",
|
|
29
|
+
"@endo/init": "^1.1.9",
|
|
30
|
+
"@endo/marshal": "^1.6.4",
|
|
31
|
+
"@endo/nat": "^5.1.0",
|
|
32
|
+
"@endo/pass-style": "^1.5.0",
|
|
33
|
+
"@endo/patterns": "^1.5.0",
|
|
34
|
+
"@endo/promise-kit": "^1.1.10"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@agoric/kmarshal": "^0.1.1-
|
|
37
|
+
"@agoric/kmarshal": "^0.1.1-u20.0",
|
|
38
38
|
"ava": "^5.3.0"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"typeCoverage": {
|
|
69
|
-
"atLeast": 75.
|
|
69
|
+
"atLeast": 75.24
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "8e4207fa19dabf76c1f91f8779b5b5b93570ecea"
|
|
72
72
|
}
|
|
@@ -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":"AAoHA;;;;;;;;;;;GAWG;AACH,+CAXW,GAAC,OACD,OAAO,wBAAwB,EAAE,uBAAuB,oBACxD,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;;+BAnDqB,eAAe;iCAAf,eAAe;6BAC9B,gBAAgB"}
|
package/src/collectionManager.js
CHANGED
package/src/liveslots.js
CHANGED
|
@@ -797,6 +797,7 @@ function build(
|
|
|
797
797
|
for (const resolution of resolutions) {
|
|
798
798
|
const [xvpid] = resolution;
|
|
799
799
|
maybeNewVPIDs.delete(xvpid);
|
|
800
|
+
unregisterUnreferencedVPID(xvpid);
|
|
800
801
|
}
|
|
801
802
|
}
|
|
802
803
|
for (const newVPID of Array.from(maybeNewVPIDs).sort()) {
|
|
@@ -1012,14 +1013,13 @@ function build(
|
|
|
1012
1013
|
for (const resolution of resolutions) {
|
|
1013
1014
|
const [xvpid] = resolution;
|
|
1014
1015
|
maybeNewVPIDs.delete(xvpid);
|
|
1016
|
+
unregisterUnreferencedVPID(xvpid);
|
|
1015
1017
|
}
|
|
1016
1018
|
// track everything that's left
|
|
1017
1019
|
for (const newVPID of Array.from(maybeNewVPIDs).sort()) {
|
|
1018
1020
|
maybeExportPromise(newVPID);
|
|
1019
1021
|
}
|
|
1020
1022
|
|
|
1021
|
-
// only the primary can possibly be newly resolved
|
|
1022
|
-
unregisterUnreferencedVPID(vpid);
|
|
1023
1023
|
exportedVPIDs.delete(vpid);
|
|
1024
1024
|
}
|
|
1025
1025
|
|
package/src/message.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {VatDeliveryResult} from './types.js';
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* @typedef {{
|
|
3
6
|
* methargs: import('./types.js').SwingSetCapData, // of [method, args]
|
|
@@ -20,9 +23,9 @@
|
|
|
20
23
|
export function insistMessage(message: any): asserts message is Message;
|
|
21
24
|
/**
|
|
22
25
|
* @param {unknown} vdo
|
|
23
|
-
* @returns {asserts vdo is import('./types').VatDeliveryObject}
|
|
26
|
+
* @returns {asserts vdo is import('./types.js').VatDeliveryObject}
|
|
24
27
|
*/
|
|
25
|
-
export function insistVatDeliveryObject(vdo: unknown): asserts vdo is import("./types").VatDeliveryObject;
|
|
28
|
+
export function insistVatDeliveryObject(vdo: unknown): asserts vdo is import("./types.js").VatDeliveryObject;
|
|
26
29
|
/**
|
|
27
30
|
* @param {unknown} vdr
|
|
28
31
|
* @returns {asserts vdr is VatDeliveryResult}
|
|
@@ -30,16 +33,17 @@ export function insistVatDeliveryObject(vdo: unknown): asserts vdo is import("./
|
|
|
30
33
|
export function insistVatDeliveryResult(vdr: unknown): asserts vdr is VatDeliveryResult;
|
|
31
34
|
/**
|
|
32
35
|
* @param {unknown} vso
|
|
33
|
-
* @returns {asserts vso is import('./types').VatSyscallObject}
|
|
36
|
+
* @returns {asserts vso is import('./types.js').VatSyscallObject}
|
|
34
37
|
*/
|
|
35
|
-
export function insistVatSyscallObject(vso: unknown): asserts vso is import("./types").VatSyscallObject;
|
|
38
|
+
export function insistVatSyscallObject(vso: unknown): asserts vso is import("./types.js").VatSyscallObject;
|
|
36
39
|
/**
|
|
37
40
|
* @param {unknown} vsr
|
|
38
|
-
* @returns {asserts vsr is import('./types').VatSyscallResult}
|
|
41
|
+
* @returns {asserts vsr is import('./types.js').VatSyscallResult}
|
|
39
42
|
*/
|
|
40
|
-
export function insistVatSyscallResult(vsr: unknown): asserts vsr is import("./types").VatSyscallResult;
|
|
43
|
+
export function insistVatSyscallResult(vsr: unknown): asserts vsr is import("./types.js").VatSyscallResult;
|
|
41
44
|
export type Message = {
|
|
42
45
|
methargs: import("./types.js").SwingSetCapData;
|
|
43
46
|
result: string | undefined | null;
|
|
44
47
|
};
|
|
48
|
+
import type { VatDeliveryResult } from './types.js';
|
|
45
49
|
//# 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;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH,uCARW,GAAG,GAKD,QAAQ,OAAO,IAAI,OAAO,CAStC;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["message.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH,uCARW,GAAG,GAKD,QAAQ,OAAO,IAAI,OAAO,CAStC;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,iBAAiB,CAwDjE;AAED;;;GAGG;AAEH,6CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,iBAAiB,CAkB5C;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,gBAAgB,CA4EhE;AAED;;;GAGG;AAEH,4CAJW,OAAO,GACL,QAAQ,GAAG,IAAI,OAAO,YAAY,EAAE,gBAAgB,CAkBhE;sBAlNY;IACV,QAAQ,EAAE,OAAO,YAAY,EAAE,eAAe,CAAC;IAC/C,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CACjC;uCAPgC,YAAY"}
|
package/src/message.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { assert, Fail } from '@endo/errors';
|
|
2
2
|
import { insistCapData } from './capdata.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @import {VatDeliveryResult} from './types.js';
|
|
6
|
+
*/
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* @typedef {{
|
|
6
10
|
* methargs: import('./types.js').SwingSetCapData, // of [method, args]
|
|
@@ -32,7 +36,7 @@ export function insistMessage(message) {
|
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* @param {unknown} vdo
|
|
35
|
-
* @returns {asserts vdo is import('./types').VatDeliveryObject}
|
|
39
|
+
* @returns {asserts vdo is import('./types.js').VatDeliveryObject}
|
|
36
40
|
*/
|
|
37
41
|
|
|
38
42
|
export function insistVatDeliveryObject(vdo) {
|
|
@@ -114,7 +118,7 @@ export function insistVatDeliveryResult(vdr) {
|
|
|
114
118
|
|
|
115
119
|
/**
|
|
116
120
|
* @param {unknown} vso
|
|
117
|
-
* @returns {asserts vso is import('./types').VatSyscallObject}
|
|
121
|
+
* @returns {asserts vso is import('./types.js').VatSyscallObject}
|
|
118
122
|
*/
|
|
119
123
|
|
|
120
124
|
export function insistVatSyscallObject(vso) {
|
|
@@ -194,7 +198,7 @@ export function insistVatSyscallObject(vso) {
|
|
|
194
198
|
|
|
195
199
|
/**
|
|
196
200
|
* @param {unknown} vsr
|
|
197
|
-
* @returns {asserts vsr is import('./types').VatSyscallResult}
|
|
201
|
+
* @returns {asserts vsr is import('./types.js').VatSyscallResult}
|
|
198
202
|
*/
|
|
199
203
|
|
|
200
204
|
export function insistVatSyscallResult(vsr) {
|
package/src/types.d.ts
CHANGED
|
@@ -27,9 +27,14 @@ export type MeterControl = {
|
|
|
27
27
|
unmetered: any;
|
|
28
28
|
};
|
|
29
29
|
export type LiveSlotsOptions = {
|
|
30
|
-
enableDisavow?: boolean;
|
|
31
|
-
relaxDurabilityRules?: boolean;
|
|
32
|
-
|
|
30
|
+
enableDisavow?: boolean | undefined;
|
|
31
|
+
relaxDurabilityRules?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* somewhat misnamed; this actually
|
|
34
|
+
* relates to *arbitrary* changes (per #10200, a non-true value still permits
|
|
35
|
+
* backwards-compatible addition of new optional fields)
|
|
36
|
+
*/
|
|
37
|
+
allowStateShapeChanges?: boolean | undefined;
|
|
33
38
|
};
|
|
34
39
|
export type SwingSetCapData = import("@endo/marshal").CapData<string>;
|
|
35
40
|
export type Message = {
|
package/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;;;;wBAec,MAAM,OAAO;qBACb,GAAC;sBACD,GAAC;;;;wBACD,GAAC;;;;6BACD,GAAC;;;;eACD,GAAC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;;;;;;;;;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uB,GAAG,wBAAwB;iCAGtE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAE;oCAC9D,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAE;+BAC5B,kBAAkB,GAAG,qBAAqB;gCAE1C,CAAC,GAAG,EAAE,gBAAgB,KAAK,gBAAgB;2BAK5C,CAAC,EACQ,CAAC,SAAT,GAAG,EAAG,gBACN;IAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAAC"}
|
package/src/types.js
CHANGED
|
@@ -22,11 +22,12 @@ export {};
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* @typedef {
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* @typedef {object} LiveSlotsOptions
|
|
26
|
+
* @property {boolean} [enableDisavow]
|
|
27
|
+
* @property {boolean} [relaxDurabilityRules]
|
|
28
|
+
* @property {boolean} [allowStateShapeChanges] somewhat misnamed; this actually
|
|
29
|
+
* relates to *arbitrary* changes (per #10200, a non-true value still permits
|
|
30
|
+
* backwards-compatible addition of new optional fields)
|
|
30
31
|
*
|
|
31
32
|
* @typedef {import('@endo/marshal').CapData<string>} SwingSetCapData
|
|
32
33
|
*
|
|
@@ -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":"AAiWO,kDApDI,GAAC,OACD,OAAO,wBAAwB,EAAE,uBAAuB,oBAExD,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,OAAO,YAAY,EAAE,gBAAgB,yBACrC;IAAE,OAAO,EAAE,yBAAc,CAAC;IAAC,OAAO,EAAE,yBAAc,CAAA;CAAE;;iEA3KtB,GAAG,kHA+C5C,GA5CG;sEAIe,GAAE,0HAEb,GAAG;0FAK4C,GAAG,kHACU,GAAG;+FAKhC,GAAG,0HACgB,GAAG;0BA6lC/C,MAAM,KACJ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqI/B;mCAEa,UAAU,CAAC,OAAO,wBAAwB,CAAC;+BAt3ChB,eAAe;iCAAf,eAAe;uCAFpB,4BAA4B;uCAD5B,4BAA4B"}
|
|
@@ -7,6 +7,7 @@ import { assertPattern, mustMatch } from '@agoric/store';
|
|
|
7
7
|
import { defendPrototype, defendPrototypeKit } from '@endo/exo/tools.js';
|
|
8
8
|
import { Far, passStyleOf } from '@endo/marshal';
|
|
9
9
|
import { Nat } from '@endo/nat';
|
|
10
|
+
import { kindOf } from '@endo/patterns';
|
|
10
11
|
import { parseVatSlot, makeBaseRef } from './parseVatSlots.js';
|
|
11
12
|
import { enumerateKeysWithPrefix } from './vatstore-iterators.js';
|
|
12
13
|
import { makeCache } from './cache.js';
|
|
@@ -20,6 +21,8 @@ import {
|
|
|
20
21
|
* @import {DefineKindOptions} from '@agoric/swingset-liveslots'
|
|
21
22
|
* @import {ClassContextProvider, KitContextProvider} from '@endo/exo'
|
|
22
23
|
* @import {ToCapData, FromCapData} from '@endo/marshal';
|
|
24
|
+
* @import {Pattern} from '@endo/patterns';
|
|
25
|
+
* @import {SwingSetCapData} from './types.js';
|
|
23
26
|
*/
|
|
24
27
|
|
|
25
28
|
const {
|
|
@@ -241,12 +244,47 @@ const insistDurableCapdata = (vrm, what, capdata, valueFor) => {
|
|
|
241
244
|
}
|
|
242
245
|
};
|
|
243
246
|
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
const isUndefinedPatt = patt =>
|
|
248
|
+
patt === undefined ||
|
|
249
|
+
(kindOf(patt) === 'match:kind' && patt.payload === 'undefined');
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Assert that a new stateShape either matches the old, or only differs in the
|
|
253
|
+
* addition of new clearly-optional top-level fields as conveyed by an
|
|
254
|
+
* [Endo `M.or`]{@link https://endojs.github.io/endo/interfaces/_endo_patterns.PatternMatchers.html#or}
|
|
255
|
+
* Pattern with at least one `undefined` alternative.
|
|
256
|
+
*
|
|
257
|
+
* @param {SwingSetCapData} oldCD
|
|
258
|
+
* @param {SwingSetCapData} newCD
|
|
259
|
+
* @param {{ newShape: Record<string, Pattern>, serialize: ToCapData<string>, unserialize: FromCapData<string> }} powers
|
|
260
|
+
*/
|
|
261
|
+
const insistCompatibleShapeCapData = (
|
|
262
|
+
oldCD,
|
|
263
|
+
newCD,
|
|
264
|
+
{ newShape, serialize, unserialize },
|
|
265
|
+
) => {
|
|
248
266
|
if (oldCD.body !== newCD.body) {
|
|
249
|
-
|
|
267
|
+
// Allow introduction of any clearly-optional new field at top level.
|
|
268
|
+
const oldShape =
|
|
269
|
+
unserialize(oldCD) ||
|
|
270
|
+
Fail`durable Kind stateShape mismatch (no old shape)`;
|
|
271
|
+
passStyleOf(oldShape) === 'copyRecord' ||
|
|
272
|
+
Fail`durable Kind stateShape mismatch (invalid old shape)`;
|
|
273
|
+
assertPattern(oldShape);
|
|
274
|
+
for (const [name, oldPatt] of Object.entries(oldShape)) {
|
|
275
|
+
// Assert presence and CapData shape, but save slots for their own clause.
|
|
276
|
+
(Object.hasOwn(newShape, name) &&
|
|
277
|
+
serialize(newShape[name]).body === serialize(oldPatt).body) ||
|
|
278
|
+
Fail`durable Kind stateShape mismatch (body ${name})`;
|
|
279
|
+
}
|
|
280
|
+
for (const [name, newPatt] of Object.entries(newShape)) {
|
|
281
|
+
if (Object.hasOwn(oldShape, name)) continue;
|
|
282
|
+
kindOf(newPatt) === 'match:or' ||
|
|
283
|
+
Fail`durable Kind stateShape mismatch (body new field ${name})`;
|
|
284
|
+
// @ts-expect-error A "match:or" pattern has a `payload` array of Patterns
|
|
285
|
+
newPatt.payload.some(patt => isUndefinedPatt(patt)) ||
|
|
286
|
+
Fail`durable Kind stateShape mismatch (body ${name})`;
|
|
287
|
+
}
|
|
250
288
|
}
|
|
251
289
|
if (oldCD.slots.length !== newCD.slots.length) {
|
|
252
290
|
Fail`durable Kind stateShape mismatch (slots.length)`;
|
|
@@ -532,7 +570,7 @@ export const makeVirtualObjectManager = (
|
|
|
532
570
|
* tag: string,
|
|
533
571
|
* unfaceted?: boolean,
|
|
534
572
|
* facets?: string[],
|
|
535
|
-
* stateShapeCapData?:
|
|
573
|
+
* stateShapeCapData?: SwingSetCapData
|
|
536
574
|
* }} DurableKindDescriptor
|
|
537
575
|
*/
|
|
538
576
|
|
|
@@ -803,7 +841,11 @@ export const makeVirtualObjectManager = (
|
|
|
803
841
|
|
|
804
842
|
const oldStateShapeSlots = oldShapeCD ? oldShapeCD.slots : [];
|
|
805
843
|
if (oldShapeCD && !allowStateShapeChanges) {
|
|
806
|
-
|
|
844
|
+
insistCompatibleShapeCapData(oldShapeCD, newShapeCD, {
|
|
845
|
+
newShape: /** @type {Record<string, Pattern>} */ (stateShape),
|
|
846
|
+
serialize,
|
|
847
|
+
unserialize,
|
|
848
|
+
});
|
|
807
849
|
}
|
|
808
850
|
const newStateShapeSlots = newShapeCD.slots;
|
|
809
851
|
vrm.updateReferenceCounts(oldStateShapeSlots, newStateShapeSlots);
|
|
@@ -859,9 +901,11 @@ export const makeVirtualObjectManager = (
|
|
|
859
901
|
const baseRef = getBaseRef(this);
|
|
860
902
|
const record = dataCache.get(baseRef);
|
|
861
903
|
assert(record !== undefined);
|
|
862
|
-
const {
|
|
904
|
+
const { capdatas, valueMap } = record;
|
|
863
905
|
if (!valueMap.has(prop)) {
|
|
864
|
-
const value =
|
|
906
|
+
const value = hasOwn(capdatas, prop)
|
|
907
|
+
? harden(unserialize(capdatas[prop]))
|
|
908
|
+
: undefined;
|
|
865
909
|
checkStatePropertyValue(value, prop);
|
|
866
910
|
valueMap.set(prop, value);
|
|
867
911
|
}
|
|
@@ -877,12 +921,19 @@ export const makeVirtualObjectManager = (
|
|
|
877
921
|
}
|
|
878
922
|
const record = dataCache.get(baseRef); // mutable
|
|
879
923
|
assert(record !== undefined);
|
|
880
|
-
const
|
|
924
|
+
const { capdatas, valueMap } = record;
|
|
925
|
+
const oldSlots = hasOwn(capdatas, prop) ? capdatas[prop].slots : [];
|
|
881
926
|
const newSlots = capdata.slots;
|
|
882
927
|
vrm.updateReferenceCounts(oldSlots, newSlots);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
928
|
+
// modify in place, but mark as dirty
|
|
929
|
+
defineProperty(capdatas, prop, {
|
|
930
|
+
value: capdata,
|
|
931
|
+
writable: true,
|
|
932
|
+
enumerable: true,
|
|
933
|
+
configurable: false,
|
|
934
|
+
});
|
|
935
|
+
valueMap.set(prop, value);
|
|
936
|
+
dataCache.set(baseRef, record);
|
|
886
937
|
},
|
|
887
938
|
enumerable: true,
|
|
888
939
|
configurable: false,
|
|
@@ -1073,7 +1124,12 @@ export const makeVirtualObjectManager = (
|
|
|
1073
1124
|
}
|
|
1074
1125
|
// eslint-disable-next-line github/array-foreach
|
|
1075
1126
|
valueCD.slots.forEach(vrm.addReachableVref);
|
|
1076
|
-
capdatas
|
|
1127
|
+
defineProperty(capdatas, prop, {
|
|
1128
|
+
value: valueCD,
|
|
1129
|
+
writable: true,
|
|
1130
|
+
enumerable: true,
|
|
1131
|
+
configurable: false,
|
|
1132
|
+
});
|
|
1077
1133
|
valueMap.set(prop, value);
|
|
1078
1134
|
}
|
|
1079
1135
|
// dataCache contents remain mutable: state setter modifies in-place
|
|
@@ -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;IACiE,GAAG,EAArE,OAAO,wBAAwB,EAAE,uBAAuB;IACU,GAAG,EAArE,OAAO,2BAA2B,EAAE,oBAAoB;IAC7C,iBAAiB,EAA5B,GAAC;IACsD,gBAAgB,EAAvE,OAAO,eAAe,EAAE,gBAAgB,CAAC,GAAG,CAAC;IACU,gBAAgB,EAAvE,OAAO,eAAe,EAAE,gBAAgB,CAAC,GAAG,CAAC;IACb,kBAAkB,EAAlD,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO;CAChC;;
|
|
1
|
+
{"version":3,"file":"watchedPromises.d.ts","sourceRoot":"","sources":["watchedPromises.js"],"names":[],"mappings":"AASA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,6IARG;IAAmB,OAAO,EAAlB,GAAC;IACiE,GAAG,EAArE,OAAO,wBAAwB,EAAE,uBAAuB;IACU,GAAG,EAArE,OAAO,2BAA2B,EAAE,oBAAoB;IAC7C,iBAAiB,EAA5B,GAAC;IACsD,gBAAgB,EAAvE,OAAO,eAAe,EAAE,gBAAgB,CAAC,GAAG,CAAC;IACU,gBAAgB,EAAvE,OAAO,eAAe,EAAE,gBAAgB,CAAC,GAAG,CAAC;IACb,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,OAAO,mBAAmB,EAAE,iBAAiB,mBAC7C,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,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;mBAmC3C,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,KAAK,CAAC,WAAW,OAAO,YAAY,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI;EAoE3I;gCA3PY,CAAC,EACQ,CAAC,SAAT,GAAG,EAAG,gBACP,CAAC,OAAO,EAAE,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC"}
|
package/src/watchedPromises.js
CHANGED
|
@@ -36,13 +36,12 @@ export function makeWatchedPromiseManager({
|
|
|
36
36
|
const { defineDurableKind } = vom;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* this, slotToVal would forget local Promises that aren't exported.
|
|
39
|
+
* Track promises watched in `buildRootObject` so `loadWatchedPromiseTable`
|
|
40
|
+
* can differentiate them from promises watched in a previous incarnation.
|
|
42
41
|
*
|
|
43
|
-
* @type {
|
|
42
|
+
* @type {Set<string> | null}
|
|
44
43
|
*/
|
|
45
|
-
let
|
|
44
|
+
let buildRootObjectWatchedPromiseRefs;
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
* watched promises by vpid: each entry is an array of watches on the
|
|
@@ -60,7 +59,7 @@ export function makeWatchedPromiseManager({
|
|
|
60
59
|
let promiseWatcherByKindTable;
|
|
61
60
|
|
|
62
61
|
function preparePromiseWatcherTables() {
|
|
63
|
-
|
|
62
|
+
buildRootObjectWatchedPromiseRefs = new Set();
|
|
64
63
|
let watcherTableID = syscall.vatstoreGet('watcherTableID');
|
|
65
64
|
if (watcherTableID) {
|
|
66
65
|
promiseWatcherByKindTable = convertSlotToVal(watcherTableID);
|
|
@@ -105,7 +104,7 @@ export function makeWatchedPromiseManager({
|
|
|
105
104
|
function settle(value, wasFulfilled) {
|
|
106
105
|
const watches = watchedPromiseTable.get(vpid);
|
|
107
106
|
watchedPromiseTable.delete(vpid);
|
|
108
|
-
|
|
107
|
+
buildRootObjectWatchedPromiseRefs?.delete(vpid);
|
|
109
108
|
for (const watch of watches) {
|
|
110
109
|
const [watcher, ...args] = watch;
|
|
111
110
|
void Promise.resolve().then(() => {
|
|
@@ -139,16 +138,16 @@ export function makeWatchedPromiseManager({
|
|
|
139
138
|
*/
|
|
140
139
|
function loadWatchedPromiseTable(revivePromise) {
|
|
141
140
|
for (const vpid of watchedPromiseTable.keys()) {
|
|
142
|
-
if (
|
|
141
|
+
if (buildRootObjectWatchedPromiseRefs?.has(vpid)) {
|
|
143
142
|
// We're only interested in reconnecting the promises from the previous
|
|
144
143
|
// incarnation. Any promise watched during buildRootObject would have
|
|
145
144
|
// already created a registration.
|
|
146
145
|
continue;
|
|
147
146
|
}
|
|
148
147
|
const p = revivePromise(vpid);
|
|
149
|
-
promiseRegistrations.init(vpid, p);
|
|
150
148
|
pseudoThen(p, vpid);
|
|
151
149
|
}
|
|
150
|
+
buildRootObjectWatchedPromiseRefs = null;
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
/**
|
|
@@ -235,11 +234,9 @@ export function makeWatchedPromiseManager({
|
|
|
235
234
|
} else {
|
|
236
235
|
watchedPromiseTable.init(vpid, harden([[watcher, ...args]]));
|
|
237
236
|
|
|
238
|
-
|
|
237
|
+
buildRootObjectWatchedPromiseRefs?.add(vpid);
|
|
239
238
|
|
|
240
|
-
//
|
|
241
|
-
// this promise from promiseRegistrations and
|
|
242
|
-
// watchedPromiseTable. To avoid triggering
|
|
239
|
+
// To avoid triggering
|
|
243
240
|
// https://github.com/Agoric/agoric-sdk/issues/10757 and
|
|
244
241
|
// preventing slotToVal cleanup, the `pseudoThen()` should
|
|
245
242
|
// precede `maybeExportPromise()`. This isn't foolproof, but
|
package/test/gc-helpers.js
CHANGED
|
@@ -9,8 +9,8 @@ import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
|
9
9
|
let aWeakMapStore;
|
|
10
10
|
let aWeakSetStore;
|
|
11
11
|
|
|
12
|
-
export const mainHolderIdx =
|
|
13
|
-
export const mainHeldIdx =
|
|
12
|
+
export const mainHolderIdx = 4;
|
|
13
|
+
export const mainHeldIdx = 5;
|
|
14
14
|
|
|
15
15
|
export function buildRootObject(vatPowers) {
|
|
16
16
|
const { VatData } = vatPowers;
|