@agoric/swingset-liveslots 0.10.3-u19.1 → 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.
Files changed (38) hide show
  1. package/package.json +16 -16
  2. package/src/collectionManager.d.ts +1 -0
  3. package/src/collectionManager.d.ts.map +1 -1
  4. package/src/collectionManager.js +1 -0
  5. package/src/liveslots.js +2 -2
  6. package/src/message.d.ts +10 -6
  7. package/src/message.d.ts.map +1 -1
  8. package/src/message.js +7 -3
  9. package/src/types.d.ts +8 -3
  10. package/src/types.d.ts.map +1 -1
  11. package/src/types.js +6 -5
  12. package/src/virtualObjectManager.d.ts.map +1 -1
  13. package/src/virtualObjectManager.js +70 -14
  14. package/src/watchedPromises.d.ts.map +1 -1
  15. package/src/watchedPromises.js +10 -13
  16. package/test/gc-helpers.js +2 -2
  17. package/test/handled-promises.test.js +529 -163
  18. package/test/initial-vrefs.test.js +12 -18
  19. package/test/liveslots-helpers.d.ts +1 -0
  20. package/test/liveslots-helpers.d.ts.map +1 -1
  21. package/test/liveslots-helpers.js +1 -0
  22. package/test/liveslots-real-gc.test.js +2 -2
  23. package/test/liveslots.test.js +3 -3
  24. package/test/storeGC/lifecycle.test.js +13 -12
  25. package/test/util.d.ts +1 -1
  26. package/test/util.d.ts.map +1 -1
  27. package/test/util.js +2 -2
  28. package/test/virtual-objects/state-shape.test.js +312 -221
  29. package/test/virtual-objects/virtualObjectGC.test.js +37 -36
  30. package/test/virtual-objects/virtualObjectManager.test.js +41 -63
  31. package/test/vo-test-harness.test.js +13 -9
  32. package/tools/fakeVirtualSupport.d.ts.map +1 -1
  33. package/tools/setup-vat-data.d.ts.map +1 -1
  34. package/tools/setup-vat-data.js +0 -1
  35. package/tools/vo-test-harness.d.ts +31 -0
  36. package/tools/vo-test-harness.d.ts.map +1 -1
  37. package/tools/vo-test-harness.js +21 -0
  38. package/test/watch-promise.test.js +0 -42
@@ -70,34 +70,28 @@ test('initial vatstore contents', async t => {
70
70
  t.deepEqual(kunser(JSON.parse(get(`vc.1.|schemata`))), stringSchema);
71
71
 
72
72
  // then three tables for the promise watcher (one virtual, two durable)
73
- t.is(getLabel(`vc.3.|schemata`), 'promiseWatcherByKind'); // durable
74
- t.is(getLabel(`vc.4.|schemata`), 'watchedPromises'); // durable
75
- // the promiseRegistrations table is not durable, and only gets vc.2
76
- // on the first incarnation: it will get a new ID on subsequent
77
- // incarnations
78
- t.is(getLabel(`vc.2.|schemata`), `promiseRegistrations`); // virtual
73
+ t.is(getLabel(`vc.2.|schemata`), 'promiseWatcherByKind'); // durable
74
+ t.is(getLabel(`vc.3.|schemata`), 'watchedPromises'); // durable
79
75
 
80
76
  const watcherTableVref = get('watcherTableID');
81
77
  const watchedPromiseTableVref = get('watchedPromiseTableID');
82
- t.is(watcherTableVref, `${dmsBase}/3`);
83
- t.is(watchedPromiseTableVref, `${dmsBase}/4`);
78
+ t.is(watcherTableVref, `${dmsBase}/2`);
79
+ t.is(watchedPromiseTableVref, `${dmsBase}/3`);
84
80
 
85
81
  // baggage and the two durable promise-watcher tables are pinned
86
82
  t.is(get(`vom.rc.${baggageVref}`), '1');
87
83
  t.is(get(`vom.rc.${watcherTableVref}`), '1');
88
84
  t.is(get(`vom.rc.${watchedPromiseTableVref}`), '1');
89
85
 
90
- // promiseRegistrations and promiseWatcherByKind arbitrary scalars as keys
91
- const scalarSchema2 = { label: 'promiseRegistrations', keyShape: M.scalar() };
86
+ // promiseWatcherByKind arbitrary scalars as keys
92
87
  const scalarSchema3 = { label: 'promiseWatcherByKind', keyShape: M.scalar() };
93
- t.deepEqual(kunser(JSON.parse(get(`vc.2.|schemata`))), scalarSchema2);
94
- t.deepEqual(kunser(JSON.parse(get(`vc.3.|schemata`))), scalarSchema3);
88
+ t.deepEqual(kunser(JSON.parse(get(`vc.2.|schemata`))), scalarSchema3);
95
89
  // watchedPromises uses vref (string) keys
96
90
  const scalarStringSchema = {
97
91
  label: 'watchedPromises',
98
92
  keyShape: M.and(M.scalar(), M.string()),
99
93
  };
100
- t.deepEqual(kunser(JSON.parse(get(`vc.4.|schemata`))), scalarStringSchema);
94
+ t.deepEqual(kunser(JSON.parse(get(`vc.3.|schemata`))), scalarStringSchema);
101
95
  });
102
96
 
103
97
  test('vrefs', async t => {
@@ -141,11 +135,11 @@ test('vrefs', async t => {
141
135
  const dh2Vref = (await run('getDinstance2')).slots[0];
142
136
  t.is(dh2Vref, expectedDH2Vref);
143
137
 
144
- // the liveslots-created collections consume vc.1 through vc.4,
145
- // leaving vc.5 for the first user-created collection
146
- t.is(getLabel('vc.5.|schemata'), 'store1');
147
- const expectedStore1Vref = `o+v${initialKindIDs.scalarMapStore}/5`;
138
+ // the liveslots-created collections consume vc.1 through vc.3,
139
+ // leaving vc.4 for the first user-created collection
140
+ t.is(getLabel('vc.4.|schemata'), 'store1');
141
+ const expectedStore1Vref = `o+v${initialKindIDs.scalarMapStore}/4`;
148
142
  const store1Vref = (await run('getStore1')).slots[0];
149
143
  t.is(store1Vref, expectedStore1Vref);
150
- t.is(kunser(JSON.parse(fakestore.get(`vc.5.s${'key'}`))), 'value');
144
+ t.is(kunser(JSON.parse(fakestore.get(`vc.4.s${'key'}`))), 'value');
151
145
  });
@@ -57,6 +57,7 @@ export function setupTestLiveslots(t: import("ava").ExecutionContext, buildRootO
57
57
  dispatchDropExports: (...vrefs: any[]) => Promise<void>;
58
58
  dispatchRetireExports: (...vrefs: any[]) => Promise<void>;
59
59
  dispatchRetireImports: (...vrefs: any[]) => Promise<void>;
60
+ nextPImport: () => string;
60
61
  testHooks: any;
61
62
  }>;
62
63
  export function findSyscallsByType(log: any, type: any): any;
@@ -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,OAAO,KAAK,EAAE,gBAAgB,sCAE9B,MAAM,YAEd;IAA0B,OAAO;IACK,OAAO;IACpB,uBAAuB;IACtB,WAAW;IACf,aAAa,GAA3B,GAAG;CAAyB;;;;;;;;;;;;;;GA4GtC;AAED,6DAEC"}
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,OAAO,KAAK,EAAE,gBAAgB,sCAE9B,MAAM,YAEd;IAA0B,OAAO;IACK,OAAO;IACpB,uBAAuB;IACtB,WAAW;IACf,aAAa,GAA3B,GAAG;CAAyB;;;;;;;;;;;;;;;GA6GtC;AAED,6DAEC"}
@@ -278,6 +278,7 @@ export async function setupTestLiveslots(
278
278
  dispatchDropExports,
279
279
  dispatchRetireExports,
280
280
  dispatchRetireImports,
281
+ nextPImport: nextRP,
281
282
  testHooks,
282
283
  };
283
284
  }
@@ -289,7 +289,7 @@ avaRetry(test.serial, 'GC dispatch.dropExports', async t => {
289
289
  t.deepEqual(log.shift(), {
290
290
  type: 'vatstoreSet',
291
291
  key: 'idCounters',
292
- value: '{"exportID":11,"collectionID":5,"promiseID":5}',
292
+ value: '{"exportID":11,"collectionID":4,"promiseID":5}',
293
293
  });
294
294
  t.deepEqual(log, []);
295
295
 
@@ -369,7 +369,7 @@ avaRetry(
369
369
  t.deepEqual(log.shift(), {
370
370
  type: 'vatstoreSet',
371
371
  key: 'idCounters',
372
- value: '{"exportID":11,"collectionID":5,"promiseID":5}',
372
+ value: '{"exportID":11,"collectionID":4,"promiseID":5}',
373
373
  });
374
374
  t.deepEqual(log, []);
375
375
 
@@ -713,7 +713,7 @@ test('capdata size limit on syscalls', async t => {
713
713
  const label = 'test';
714
714
  t.deepEqual(log.shift(), {
715
715
  type: 'vatstoreGet',
716
- key: 'vc.5.|schemata',
716
+ key: 'vc.4.|schemata',
717
717
  result: JSON.stringify(kser({ label, keyShape: M.scalar() })),
718
718
  });
719
719
  };
@@ -723,7 +723,7 @@ test('capdata size limit on syscalls', async t => {
723
723
  gotSchema();
724
724
  t.deepEqual(log.shift(), {
725
725
  type: 'vatstoreGet',
726
- key: 'vc.5.skey',
726
+ key: 'vc.4.skey',
727
727
  result: undefined,
728
728
  });
729
729
  expectFail();
@@ -735,7 +735,7 @@ test('capdata size limit on syscalls', async t => {
735
735
  gotSchema();
736
736
  t.deepEqual(log.shift(), {
737
737
  type: 'vatstoreGet',
738
- key: 'vc.5.skey',
738
+ key: 'vc.4.skey',
739
739
  result: undefined,
740
740
  });
741
741
  expectFail();
@@ -1,5 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import test from 'ava';
3
+ import { avaRetry } from '@agoric/internal/tools/avaRetry.js';
3
4
 
4
5
  import { kslot, kunser } from '@agoric/kmarshal';
5
6
  import {
@@ -14,12 +15,12 @@ import { parseVatSlot } from '../../src/parseVatSlots.js';
14
15
 
15
16
  function getLastCollection(v) {
16
17
  // makeAndHold() uses makeScalarBigMapStore, and since we call it
17
- // early, it always gets "store #6", in vref o+2/6 (o+2 means
18
- // scalarMapStore, non-durable, and /6 means collectionID=6)
19
- const vref = 'o+v2/6';
18
+ // early, it always gets "store #5", in vref o+2/5 (o+2 means
19
+ // scalarMapStore, non-durable, and /5 means collectionID=5)
20
+ const vref = 'o+v2/5';
20
21
  // double-check that at least the collectionID is right
21
22
  const { t, fakestore } = v;
22
- t.is(JSON.parse(fakestore.get('idCounters')).collectionID, 7); // last was 6
23
+ t.is(JSON.parse(fakestore.get('idCounters')).collectionID, 6); // last was 5
23
24
  return vref;
24
25
  }
25
26
 
@@ -66,7 +67,7 @@ function assertState(v, vref, reachable, erv) {
66
67
  // different test.
67
68
 
68
69
  // test 1: lerv -> Lerv -> LerV -> Lerv -> lerv
69
- test.serial('store lifecycle 1', async t => {
70
+ avaRetry(test.serial, 'store lifecycle 1', async t => {
70
71
  const { v, dispatchMessageSuccessfully } = await setupTestLiveslots(
71
72
  t,
72
73
  buildRootObject,
@@ -94,7 +95,7 @@ test.serial('store lifecycle 1', async t => {
94
95
 
95
96
  // test 2: lerv -> Lerv -> LerV -> lerV -> LerV -> LERV -> lERV -> LERV ->
96
97
  // lERV -> LERV -> lERV -> leRV -> LeRV -> leRV -> LeRV -> LerV
97
- test.serial('store lifecycle 2', async t => {
98
+ avaRetry(test.serial, 'store lifecycle 2', async t => {
98
99
  const {
99
100
  v,
100
101
  dispatchMessageSuccessfully,
@@ -170,7 +171,7 @@ test.serial('store lifecycle 2', async t => {
170
171
  });
171
172
 
172
173
  // test 3: lerv -> Lerv -> LerV -> LERV -> LeRV -> leRV -> lerV -> lerv
173
- test.serial('store lifecycle 3', async t => {
174
+ avaRetry(test.serial, 'store lifecycle 3', async t => {
174
175
  const {
175
176
  v,
176
177
  dispatchMessageSuccessfully,
@@ -211,7 +212,7 @@ test.serial('store lifecycle 3', async t => {
211
212
  });
212
213
 
213
214
  // test 4: lerv -> Lerv -> LERv -> LeRv -> lerv
214
- test.serial('store lifecycle 4', async t => {
215
+ avaRetry(test.serial, 'store lifecycle 4', async t => {
215
216
  const { v, dispatchMessageSuccessfully, dispatchDropExports } =
216
217
  await setupTestLiveslots(t, buildRootObject, 'bob', { forceGC: true });
217
218
 
@@ -239,7 +240,7 @@ test.serial('store lifecycle 4', async t => {
239
240
  });
240
241
 
241
242
  // test 5: lerv -> Lerv -> LERv -> LeRv -> Lerv -> lerv
242
- test.serial('store lifecycle 5', async t => {
243
+ avaRetry(test.serial, 'store lifecycle 5', async t => {
243
244
  const {
244
245
  v,
245
246
  dispatchMessageSuccessfully,
@@ -277,7 +278,7 @@ test.serial('store lifecycle 5', async t => {
277
278
  });
278
279
 
279
280
  // test 6: lerv -> Lerv -> LERv -> LeRv -> LeRV -> LeRv -> LeRV -> leRV -> lerv
280
- test.serial('store lifecycle 6', async t => {
281
+ avaRetry(test.serial, 'store lifecycle 6', async t => {
281
282
  const { v, dispatchMessageSuccessfully, dispatchDropExports } =
282
283
  await setupTestLiveslots(t, buildRootObject, 'bob', { forceGC: true });
283
284
 
@@ -322,7 +323,7 @@ test.serial('store lifecycle 6', async t => {
322
323
  });
323
324
 
324
325
  // test 7: lerv -> Lerv -> LERv -> lERv -> LERv -> lERv -> lerv
325
- test.serial('store lifecycle 7', async t => {
326
+ avaRetry(test.serial, 'store lifecycle 7', async t => {
326
327
  const { v, dispatchMessageSuccessfully, dispatchDropExports } =
327
328
  await setupTestLiveslots(t, buildRootObject, 'bob', { forceGC: true });
328
329
 
@@ -361,7 +362,7 @@ test.serial('store lifecycle 7', async t => {
361
362
  });
362
363
 
363
364
  // test 8: lerv -> Lerv -> LERv -> LERV -> LERv -> LERV -> lERV -> lERv -> lerv
364
- test.serial('store lifecycle 8', async t => {
365
+ avaRetry(test.serial, 'store lifecycle 8', async t => {
365
366
  const { v, dispatchMessageSuccessfully, dispatchDropExports } =
366
367
  await setupTestLiveslots(t, buildRootObject, 'bob', { forceGC: true });
367
368
 
package/test/util.d.ts CHANGED
@@ -12,7 +12,7 @@ export function buildDispatch(onDispatchCallback?: (d: unknown) => void): {
12
12
  * @param {unknown} result
13
13
  */
14
14
  export function makeMessage(target: unknown, method: string | symbol, args?: any[], result?: unknown): unknown[];
15
- export function makeStartVat(vatParameters: any): any[];
15
+ export function makeStartVat(vatParametersCapData?: import("@endo/marshal").CapData<string>): (string | import("@endo/marshal").CapData<string>)[];
16
16
  export function makeBringOutYourDead(): string[];
17
17
  export function makeResolutions(resolutions: any): any[];
18
18
  export function makeResolve(target: any, result: any): any[];
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAKA;;GAEG;AACH,mDAFW,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI;;;EAwC9B;AAED;;;;;GAKG;AACH,oCALW,OAAO,UACP,MAAM,GAAG,MAAM,SACf,GAAG,EAAE,WACL,OAAO,aAOjB;AAED,wDAEC;AAED,iDAEC;AAED,yDAGC;AAED,6DAGC;AAED,2EAIC;AAED,qEAGC;AAED,uEAGC;AAED,uEAGC;;qBAjGoB,eAAe"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAKA;;GAEG;AACH,mDAFW,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI;;;EAwC9B;AAED;;;;;GAKG;AACH,oCALW,OAAO,UACP,MAAM,GAAG,MAAM,SACf,GAAG,EAAE,WACL,OAAO,aAOjB;AAED,mJAEC;AAED,iDAEC;AAED,yDAGC;AAED,6DAGC;AAED,2EAIC;AAED,qEAGC;AAED,uEAGC;AAED,uEAGC;;qBAjGoB,eAAe"}
package/test/util.js CHANGED
@@ -59,8 +59,8 @@ export function makeMessage(target, method, args = [], result = null) {
59
59
  return vatDeliverObject;
60
60
  }
61
61
 
62
- export function makeStartVat(vatParameters) {
63
- return harden(['startVat', vatParameters]);
62
+ export function makeStartVat(vatParametersCapData = kser(undefined)) {
63
+ return harden(['startVat', vatParametersCapData]);
64
64
  }
65
65
 
66
66
  export function makeBringOutYourDead() {