@agoric/swingset-liveslots 0.10.3-u14.0 → 0.10.3-u16.1
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/README.md +2 -0
- package/package.json +27 -19
- package/src/cache.js +2 -1
- package/src/capdata.js +0 -1
- package/src/collectionManager.js +154 -72
- package/src/index.js +4 -1
- package/src/liveslots.js +52 -81
- package/src/message.js +4 -4
- package/src/types.js +8 -2
- package/src/vatDataTypes.d.ts +271 -0
- package/src/vatDataTypes.js +2 -0
- package/src/vatstore-iterators.js +2 -0
- package/src/virtualObjectManager.js +189 -70
- package/src/virtualReferences.js +51 -0
- package/src/watchedPromises.js +61 -16
- package/test/{test-baggage.js → baggage.test.js} +1 -2
- package/test/{test-cache.js → cache.test.js} +0 -1
- package/test/{test-collection-schema-refcount.js → collection-schema-refcount.test.js} +1 -2
- package/test/{test-collection-upgrade.js → collection-upgrade.test.js} +1 -3
- package/test/{test-collections.js → collections.test.js} +117 -14
- package/test/{test-dropped-collection-weakrefs.js → dropped-collection-weakrefs.test.js} +1 -2
- package/test/{test-durabilityChecks.js → durabilityChecks.test.js} +3 -3
- package/test/{test-facetiousness.js → facetiousness.test.js} +1 -2
- package/test/gc-and-finalize.js +30 -1
- package/test/gc-helpers.js +2 -3
- package/test/{test-gc-sensitivity.js → gc-sensitivity.test.js} +2 -2
- package/test/{test-handled-promises.js → handled-promises.test.js} +5 -7
- package/test/{test-initial-vrefs.js → initial-vrefs.test.js} +2 -3
- package/test/liveslots-helpers.js +6 -6
- package/test/{test-liveslots-mock-gc.js → liveslots-mock-gc.test.js} +2 -2
- package/test/{test-liveslots-real-gc.js → liveslots-real-gc.test.js} +44 -35
- package/test/{test-liveslots.js → liveslots.test.js} +13 -14
- package/test/mock-gc.js +1 -0
- package/test/storeGC/{test-lifecycle.js → lifecycle.test.js} +2 -2
- package/test/storeGC/{test-refcount-management.js → refcount-management.test.js} +1 -2
- package/test/storeGC/{test-scalar-store-kind.js → scalar-store-kind.test.js} +0 -1
- package/test/storeGC/{test-weak-key.js → weak-key.test.js} +1 -2
- package/test/util.js +2 -2
- package/test/vat-util.js +1 -1
- package/test/virtual-objects/{test-cease-recognition.js → cease-recognition.test.js} +2 -2
- package/test/virtual-objects/{test-cross-facet.js → cross-facet.test.js} +5 -4
- package/test/virtual-objects/{test-empty-data.js → empty-data.test.js} +1 -2
- package/test/virtual-objects/{test-facets.js → facets.test.js} +1 -2
- package/test/virtual-objects/{test-kind-changes.js → kind-changes.test.js} +2 -2
- package/test/virtual-objects/{test-reachable-vrefs.js → reachable-vrefs.test.js} +2 -2
- package/test/virtual-objects/{test-rep-tostring.js → rep-tostring.test.js} +2 -3
- package/test/virtual-objects/{test-retain-remotable.js → retain-remotable.test.js} +25 -24
- package/test/virtual-objects/{test-state-shape.js → state-shape.test.js} +2 -2
- package/test/virtual-objects/{test-virtualObjectGC.js → virtualObjectGC.test.js} +2 -2
- package/test/virtual-objects/{test-virtualObjectManager.js → virtualObjectManager.test.js} +6 -2
- package/test/virtual-objects/{test-vo-real-gc.js → vo-real-gc.test.js} +8 -8
- package/test/virtual-objects/{test-weakcollections-vref-handling.js → weakcollections-vref-handling.test.js} +1 -2
- package/test/{test-vo-test-harness.js → vo-test-harness.test.js} +0 -1
- package/test/{test-vpid-liveslots.js → vpid-liveslots.test.js} +4 -5
- package/test/waitUntilQuiescent.js +2 -1
- package/tools/fakeVirtualSupport.js +41 -24
- package/tools/prepare-test-env.js +13 -0
- package/tools/setup-vat-data.js +62 -0
- package/CHANGELOG.md +0 -93
- package/test/kmarshal.js +0 -79
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
2
|
|
|
4
3
|
import { Far } from '@endo/marshal';
|
|
4
|
+
import { kser } from '@agoric/kmarshal';
|
|
5
5
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
6
6
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
7
|
-
import { kser } from './kmarshal.js';
|
|
8
7
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
9
8
|
import { makeStartVat, makeBringOutYourDead } from './util.js';
|
|
10
9
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/* eslint-disable no-await-in-loop, @jessie.js/no-nested-await, no-shadow */
|
|
2
1
|
import test from 'ava';
|
|
3
|
-
import '@endo/init/debug.js';
|
|
4
2
|
|
|
5
3
|
import { Far } from '@endo/marshal';
|
|
4
|
+
import { kser } from '@agoric/kmarshal';
|
|
6
5
|
import { M } from '@agoric/store';
|
|
7
6
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
8
7
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
9
|
-
import { kser } from './kmarshal.js';
|
|
10
8
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
11
9
|
import { makeStartVat } from './util.js';
|
|
12
10
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
3
|
|
|
4
4
|
import { Far } from '@endo/marshal';
|
|
5
5
|
import { M } from '@agoric/store';
|
|
6
|
+
import { makeCopyMap, makeCopySet } from '@endo/patterns';
|
|
6
7
|
import { makeFakeCollectionManager } from '../tools/fakeVirtualSupport.js';
|
|
7
8
|
|
|
8
9
|
const {
|
|
@@ -100,6 +101,12 @@ function exerciseMapOperations(t, collectionName, testStore) {
|
|
|
100
101
|
() => testStore.set(86, 'not work'),
|
|
101
102
|
m(`key 86 not found in collection "${collectionName}"`),
|
|
102
103
|
);
|
|
104
|
+
t.throws(
|
|
105
|
+
() => testStore.set(somethingMissing, 'not work'),
|
|
106
|
+
m(
|
|
107
|
+
`key "[Alleged: something missing]" not found in collection "${collectionName}"`,
|
|
108
|
+
),
|
|
109
|
+
);
|
|
103
110
|
t.throws(
|
|
104
111
|
() => testStore.init(47, 'already there'),
|
|
105
112
|
m(`key 47 already registered in collection "${collectionName}"`),
|
|
@@ -117,11 +124,17 @@ function exerciseMapOperations(t, collectionName, testStore) {
|
|
|
117
124
|
t.is(testStore.get(somethingElse), something);
|
|
118
125
|
|
|
119
126
|
testStore.delete(47);
|
|
127
|
+
testStore.delete(something);
|
|
120
128
|
t.falsy(testStore.has(47));
|
|
129
|
+
t.falsy(testStore.has(something));
|
|
121
130
|
t.throws(
|
|
122
131
|
() => testStore.get(47),
|
|
123
132
|
m(`key 47 not found in collection "${collectionName}"`),
|
|
124
133
|
);
|
|
134
|
+
t.throws(
|
|
135
|
+
() => testStore.get(something),
|
|
136
|
+
m(`key "[Alleged: something]" not found in collection "${collectionName}"`),
|
|
137
|
+
);
|
|
125
138
|
t.throws(
|
|
126
139
|
() => testStore.delete(22),
|
|
127
140
|
m(`key 22 not found in collection "${collectionName}"`),
|
|
@@ -146,7 +159,9 @@ function exerciseSetOperations(t, collectionName, testStore) {
|
|
|
146
159
|
t.notThrows(() => testStore.add(47));
|
|
147
160
|
|
|
148
161
|
testStore.delete(47);
|
|
162
|
+
testStore.delete(something);
|
|
149
163
|
t.falsy(testStore.has(47));
|
|
164
|
+
t.falsy(testStore.has(something));
|
|
150
165
|
t.throws(
|
|
151
166
|
() => testStore.delete(22),
|
|
152
167
|
m(`key 22 not found in collection "${collectionName}"`),
|
|
@@ -191,6 +206,89 @@ test('basic weak set operations', t => {
|
|
|
191
206
|
);
|
|
192
207
|
});
|
|
193
208
|
|
|
209
|
+
function exerciseSetAddAll(t, weak, testStore) {
|
|
210
|
+
const allThatStuff = stuff.map(entry => entry[0]);
|
|
211
|
+
|
|
212
|
+
testStore.addAll(allThatStuff);
|
|
213
|
+
for (const elem of allThatStuff) {
|
|
214
|
+
t.truthy(testStore.has(elem));
|
|
215
|
+
testStore.delete(elem);
|
|
216
|
+
}
|
|
217
|
+
if (!weak) {
|
|
218
|
+
t.is(testStore.getSize(), 0);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
testStore.addAll(makeCopySet(allThatStuff));
|
|
222
|
+
for (const elem of allThatStuff) {
|
|
223
|
+
t.truthy(testStore.has(elem));
|
|
224
|
+
testStore.delete(elem);
|
|
225
|
+
}
|
|
226
|
+
if (!weak) {
|
|
227
|
+
t.is(testStore.getSize(), 0);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
t.throws(
|
|
231
|
+
() => testStore.addAll({ bogus: 47 }),
|
|
232
|
+
m(/provided data source is not iterable/),
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
test('set addAll', t => {
|
|
237
|
+
exerciseSetAddAll(t, false, makeScalarBigSetStore('test set'));
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test('weak set addAll', t => {
|
|
241
|
+
exerciseSetAddAll(t, true, makeScalarBigWeakSetStore('test weak set'));
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test('set snapshot', t => {
|
|
245
|
+
const testStore = makeScalarBigSetStore('test set');
|
|
246
|
+
const allThatStuff = stuff.map(entry => entry[0]);
|
|
247
|
+
testStore.addAll(allThatStuff);
|
|
248
|
+
t.deepEqual(testStore.snapshot(), makeCopySet(allThatStuff));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
function exerciseMapAddAll(t, weak, testStore) {
|
|
252
|
+
testStore.addAll(stuff);
|
|
253
|
+
for (const [k, v] of stuff) {
|
|
254
|
+
t.truthy(testStore.has(k));
|
|
255
|
+
t.is(testStore.get(k), v);
|
|
256
|
+
testStore.delete(k);
|
|
257
|
+
}
|
|
258
|
+
if (!weak) {
|
|
259
|
+
t.is(testStore.getSize(), 0);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
testStore.addAll(makeCopyMap(stuff));
|
|
263
|
+
for (const [k, v] of stuff) {
|
|
264
|
+
t.truthy(testStore.has(k));
|
|
265
|
+
t.is(testStore.get(k), v);
|
|
266
|
+
testStore.delete(k);
|
|
267
|
+
}
|
|
268
|
+
if (!weak) {
|
|
269
|
+
t.is(testStore.getSize(), 0);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
t.throws(
|
|
273
|
+
() => testStore.addAll({ bogus: 47 }),
|
|
274
|
+
m(/provided data source is not iterable/),
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
test('map addAll', t => {
|
|
279
|
+
exerciseMapAddAll(t, false, makeScalarBigMapStore('test map'));
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test('weak map addAll', t => {
|
|
283
|
+
exerciseMapAddAll(t, true, makeScalarBigWeakMapStore('test weak map'));
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
test('map snapshot', t => {
|
|
287
|
+
const testStore = makeScalarBigMapStore('test map');
|
|
288
|
+
testStore.addAll(stuff);
|
|
289
|
+
t.deepEqual(testStore.snapshot(), makeCopyMap(stuff));
|
|
290
|
+
});
|
|
291
|
+
|
|
194
292
|
test('constrain map key shape', t => {
|
|
195
293
|
const stringsOnly = makeScalarBigMapStore('map key strings only', {
|
|
196
294
|
keyShape: M.string(),
|
|
@@ -405,7 +503,9 @@ test('map fail on concurrent modification', t => {
|
|
|
405
503
|
const primeMap = makeScalarBigMapStore('fmap', {
|
|
406
504
|
keyShape: M.number(),
|
|
407
505
|
});
|
|
408
|
-
|
|
506
|
+
for (const [i, v] of primes.entries()) {
|
|
507
|
+
primeMap.init(v, `${v} is prime #${i + 1}`);
|
|
508
|
+
}
|
|
409
509
|
|
|
410
510
|
let iter = primeMap.keys()[Symbol.iterator]();
|
|
411
511
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -433,7 +533,9 @@ test('set fail on concurrent modification', t => {
|
|
|
433
533
|
const primeSet = makeScalarBigSetStore('fset', {
|
|
434
534
|
keyShape: M.number(),
|
|
435
535
|
});
|
|
436
|
-
|
|
536
|
+
for (const v of primes) {
|
|
537
|
+
primeSet.add(v);
|
|
538
|
+
}
|
|
437
539
|
|
|
438
540
|
let iter = primeSet.keys()[Symbol.iterator]();
|
|
439
541
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -461,7 +563,9 @@ test('map ok with concurrent deletion', t => {
|
|
|
461
563
|
const primeMap = makeScalarBigMapStore('fmap', {
|
|
462
564
|
keyShape: M.number(),
|
|
463
565
|
});
|
|
464
|
-
|
|
566
|
+
for (const [i, v] of primes.entries()) {
|
|
567
|
+
primeMap.init(v, `${v} is prime #${i + 1}`);
|
|
568
|
+
}
|
|
465
569
|
const iter = primeMap.keys()[Symbol.iterator]();
|
|
466
570
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
467
571
|
primeMap.delete(3);
|
|
@@ -476,7 +580,9 @@ test('set ok with concurrent deletion', t => {
|
|
|
476
580
|
const primeSet = makeScalarBigSetStore('fset', {
|
|
477
581
|
keyShape: M.number(),
|
|
478
582
|
});
|
|
479
|
-
|
|
583
|
+
for (const v of primes) {
|
|
584
|
+
primeSet.add(v);
|
|
585
|
+
}
|
|
480
586
|
|
|
481
587
|
const iter = primeSet.keys()[Symbol.iterator]();
|
|
482
588
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -766,13 +872,6 @@ test('set queries', t => {
|
|
|
766
872
|
symbolKrusty,
|
|
767
873
|
undefined,
|
|
768
874
|
]);
|
|
769
|
-
|
|
770
|
-
// @ts-expect-error our BigSetStore has .entries, but not the SetStore type
|
|
771
|
-
t.deepEqual(Array.from(testStore.entries(M.number())), [
|
|
772
|
-
[-29, -29],
|
|
773
|
-
[3, 3],
|
|
774
|
-
[47, 47],
|
|
775
|
-
]);
|
|
776
875
|
});
|
|
777
876
|
|
|
778
877
|
test('remotable sort order', t => {
|
|
@@ -798,7 +897,9 @@ test('complex map queries', t => {
|
|
|
798
897
|
const primeStore = makeScalarBigMapStore('prime map', {
|
|
799
898
|
keyShape: M.number(),
|
|
800
899
|
});
|
|
801
|
-
|
|
900
|
+
for (const [i, v] of primes.entries()) {
|
|
901
|
+
primeStore.init(v, `${v} is prime #${i + 1}`);
|
|
902
|
+
}
|
|
802
903
|
|
|
803
904
|
t.deepEqual(Array.from(primeStore.values()), [
|
|
804
905
|
'2 is prime #1',
|
|
@@ -973,7 +1074,9 @@ test('complex set queries', t => {
|
|
|
973
1074
|
const primeStore = makeScalarBigSetStore('prime set', {
|
|
974
1075
|
keyShape: M.number(),
|
|
975
1076
|
});
|
|
976
|
-
|
|
1077
|
+
for (const v of primes) {
|
|
1078
|
+
primeStore.add(v);
|
|
1079
|
+
}
|
|
977
1080
|
|
|
978
1081
|
t.deepEqual(
|
|
979
1082
|
Array.from(primeStore.values()),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
2
|
import { Far } from '@endo/marshal';
|
|
3
|
+
import { kser } from '@agoric/kmarshal';
|
|
4
4
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
5
|
-
import { kser } from './kmarshal.js';
|
|
6
5
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
7
6
|
import { makeStartVat } from './util.js';
|
|
8
7
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
2
|
|
|
4
3
|
import { Far } from '@endo/marshal';
|
|
5
4
|
import { makeFakeVirtualStuff } from '../tools/fakeVirtualSupport.js';
|
|
@@ -16,6 +15,7 @@ async function runDurabilityCheckTest(t, relaxDurabilityRules) {
|
|
|
16
15
|
|
|
17
16
|
const durableHolderKind = makeKindHandle('holder');
|
|
18
17
|
|
|
18
|
+
/** @param {any} held */
|
|
19
19
|
const initHolder = (held = null) => ({ held });
|
|
20
20
|
const holderBehavior = {
|
|
21
21
|
hold: ({ state }, value) => {
|
|
@@ -269,5 +269,5 @@ async function runDurabilityCheckTest(t, relaxDurabilityRules) {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
test('durability checks (strict)',
|
|
273
|
-
test('durability checks (relaxed)',
|
|
272
|
+
test('durability checks (strict)', runDurabilityCheckTest, false);
|
|
273
|
+
test('durability checks (relaxed)', runDurabilityCheckTest, true);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@endo/init/debug.js';
|
|
2
1
|
import test from 'ava';
|
|
3
2
|
import {
|
|
4
3
|
assessFacetiousness,
|
|
@@ -126,7 +125,7 @@ test('checkAndUpdateFacetiousness', t => {
|
|
|
126
125
|
t.deepEqual(cauf({}, barfoo), barfoo);
|
|
127
126
|
|
|
128
127
|
// a single Kind can only be redefined as another single
|
|
129
|
-
t.
|
|
128
|
+
t.is(cauf(desc(), undefined), undefined);
|
|
130
129
|
t.throws(() => cauf(desc(), foo), {
|
|
131
130
|
message: 'defineDurableKindMulti called for unfaceted KindHandle "tag"',
|
|
132
131
|
});
|
package/test/gc-and-finalize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* global setImmediate */
|
|
1
|
+
/* global setImmediate, FinalizationRegistry */
|
|
2
2
|
|
|
3
3
|
/* A note on our GC terminology:
|
|
4
4
|
*
|
|
@@ -89,3 +89,32 @@ export function makeGcAndFinalize(gcPower) {
|
|
|
89
89
|
await new Promise(setImmediate);
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
const fr = new FinalizationRegistry(({ promise, resolve }) => {
|
|
94
|
+
promise.result = true;
|
|
95
|
+
resolve(true);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const makeCollectedResultKit = () => {
|
|
99
|
+
/** @type {(val: true) => void} */
|
|
100
|
+
let resolve;
|
|
101
|
+
|
|
102
|
+
const promise = /** @type {Promise<true> & {result: boolean}} */ (
|
|
103
|
+
new Promise(r => {
|
|
104
|
+
resolve = r;
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
promise.result = false;
|
|
108
|
+
return {
|
|
109
|
+
promise,
|
|
110
|
+
// @ts-expect-error
|
|
111
|
+
resolve,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export function watchCollected(target) {
|
|
116
|
+
const kit = makeCollectedResultKit();
|
|
117
|
+
fr.register(target, kit);
|
|
118
|
+
|
|
119
|
+
return kit.promise;
|
|
120
|
+
}
|
package/test/gc-helpers.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
// eslint-disable-next-line import/order
|
|
2
|
-
|
|
3
1
|
import { Far } from '@endo/marshal';
|
|
4
2
|
import { M } from '@agoric/store';
|
|
5
|
-
import { kslot, kser } from '
|
|
3
|
+
import { kslot, kser } from '@agoric/kmarshal';
|
|
6
4
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
7
5
|
|
|
8
6
|
// These tests follow the model described in
|
|
@@ -168,6 +166,7 @@ export function* enumerateKeysWithPrefix(fakestore, prefix) {
|
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
}
|
|
169
|
+
harden(enumerateKeysWithPrefix);
|
|
171
170
|
|
|
172
171
|
export function recognizersOf(v, baseref) {
|
|
173
172
|
// the | is followed by the collectionID that can recognize baseref
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
3
|
import { Far } from '@endo/marshal';
|
|
4
|
+
import { kser } from '@agoric/kmarshal';
|
|
4
5
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
5
6
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
6
|
-
import { kser } from './kmarshal.js';
|
|
7
7
|
import { makeMockGC } from './mock-gc.js';
|
|
8
8
|
import { makeMessage, makeStartVat } from './util.js';
|
|
9
9
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-await-in-loop, @jessie.js/no-nested-await, no-shadow */
|
|
2
1
|
import test from 'ava';
|
|
3
|
-
import '@endo/init/debug.js';
|
|
4
2
|
|
|
5
3
|
import { Far } from '@endo/marshal';
|
|
6
4
|
import { Fail } from '@agoric/assert';
|
|
@@ -9,7 +7,7 @@ import { makePromiseKit } from '@endo/promise-kit';
|
|
|
9
7
|
// Disabled to avoid circular dependencies.
|
|
10
8
|
// import { makeStoreUtils } from '@agoric/vat-data/src/vat-data-bindings.js';
|
|
11
9
|
// import { makeExoUtils } from '@agoric/vat-data/src/exo-utils.js';
|
|
12
|
-
import { kslot, kser } from '
|
|
10
|
+
import { kslot, kser } from '@agoric/kmarshal';
|
|
13
11
|
import { setupTestLiveslots } from './liveslots-helpers.js';
|
|
14
12
|
import { makeResolve, makeReject } from './util.js';
|
|
15
13
|
|
|
@@ -233,12 +231,12 @@ test('past-incarnation watched promises', async t => {
|
|
|
233
231
|
t.deepEqual(getDispatchLogs(), [
|
|
234
232
|
fulfillmentMessage(`p-${nextPImport()}`, 'created local promise: rejected'),
|
|
235
233
|
]);
|
|
236
|
-
t.
|
|
234
|
+
t.is(
|
|
237
235
|
lastPImport - firstPImport + 1,
|
|
238
236
|
4,
|
|
239
237
|
'imported 4 promises (1 per dispatch)',
|
|
240
238
|
);
|
|
241
|
-
t.
|
|
239
|
+
t.is(lastPExport - firstPExport + 1, 1, 'exported 1 promise: first');
|
|
242
240
|
|
|
243
241
|
await dispatchMessage('watchLocalPromise', 'orphaned');
|
|
244
242
|
t.deepEqual(getDispatchLogs(), [
|
|
@@ -260,12 +258,12 @@ test('past-incarnation watched promises', async t => {
|
|
|
260
258
|
fulfillmentMessage(`p-${nextPImport()}`, 'watched local promise: rejected'),
|
|
261
259
|
rejectionMessage(`p+${lastPExport}`, S),
|
|
262
260
|
]);
|
|
263
|
-
t.
|
|
261
|
+
t.is(
|
|
264
262
|
lastPImport - firstPImport + 1,
|
|
265
263
|
7,
|
|
266
264
|
'imported 7 promises (1 per dispatch)',
|
|
267
265
|
);
|
|
268
|
-
t.
|
|
266
|
+
t.is(
|
|
269
267
|
lastPExport - firstPExport + 1,
|
|
270
268
|
4,
|
|
271
269
|
'exported 4 promises: first, orphaned, fulfilled, rejected',
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
2
|
|
|
4
3
|
import { Far } from '@endo/far';
|
|
4
|
+
import { kunser } from '@agoric/kmarshal';
|
|
5
5
|
import { M } from '@agoric/store';
|
|
6
6
|
import { setupTestLiveslots } from './liveslots-helpers.js';
|
|
7
|
-
import { kunser } from './kmarshal.js';
|
|
8
7
|
|
|
9
8
|
function buildRootObject(vatPowers, vatParameters, baggage) {
|
|
10
9
|
const vd = vatPowers.VatData;
|
|
@@ -148,5 +147,5 @@ test('vrefs', async t => {
|
|
|
148
147
|
const expectedStore1Vref = `o+v${initialKindIDs.scalarMapStore}/5`;
|
|
149
148
|
const store1Vref = (await run('getStore1')).slots[0];
|
|
150
149
|
t.is(store1Vref, expectedStore1Vref);
|
|
151
|
-
t.
|
|
150
|
+
t.is(kunser(JSON.parse(fakestore.get(`vc.5.s${'key'}`))), 'value');
|
|
152
151
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* global WeakRef, FinalizationRegistry */
|
|
2
|
-
import
|
|
2
|
+
import { kser } from '@agoric/kmarshal';
|
|
3
3
|
|
|
4
|
+
import engineGC from './engine-gc.js';
|
|
4
5
|
import { waitUntilQuiescent } from './waitUntilQuiescent.js';
|
|
5
6
|
import { makeGcAndFinalize } from './gc-and-finalize.js';
|
|
6
7
|
import { makeDummyMeterControl } from './dummyMeterControl.js';
|
|
@@ -12,12 +13,11 @@ import {
|
|
|
12
13
|
makeRetireExports,
|
|
13
14
|
makeBringOutYourDead,
|
|
14
15
|
} from './util.js';
|
|
15
|
-
import { kser } from './kmarshal.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @param {object} [options]
|
|
19
|
-
* @param {boolean} [options.skipLogging
|
|
20
|
-
* @param {Map<string, string>} [options.kvStore
|
|
19
|
+
* @param {boolean} [options.skipLogging]
|
|
20
|
+
* @param {Map<string, string>} [options.kvStore]
|
|
21
21
|
*/
|
|
22
22
|
export function buildSyscall(options = {}) {
|
|
23
23
|
const { skipLogging = false, kvStore: fakestore = new Map() } = options;
|
|
@@ -168,9 +168,9 @@ function makeRPMaker(nextNumber = 1) {
|
|
|
168
168
|
* @param {string} vatName
|
|
169
169
|
* @param {object} [options]
|
|
170
170
|
* @param {boolean} [options.forceGC]
|
|
171
|
-
* @param {Map<string, string>} [options.kvStore
|
|
171
|
+
* @param {Map<string, string>} [options.kvStore]
|
|
172
172
|
* @param {number} [options.nextPromiseImportNumber]
|
|
173
|
-
* @param {boolean} [options.skipLogging
|
|
173
|
+
* @param {boolean} [options.skipLogging]
|
|
174
174
|
*/
|
|
175
175
|
export async function setupTestLiveslots(
|
|
176
176
|
t,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import test from 'ava';
|
|
2
|
-
import '@endo/init/debug.js';
|
|
3
3
|
|
|
4
4
|
import { Far } from '@endo/marshal';
|
|
5
|
+
import { kslot, kser } from '@agoric/kmarshal';
|
|
5
6
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
6
7
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
7
|
-
import { kslot, kser } from './kmarshal.js';
|
|
8
8
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
9
9
|
import {
|
|
10
10
|
makeMessage,
|