@agoric/swingset-liveslots 0.10.3-dev-5dc325b.0 → 0.10.3-getting-started-dev-d127d1d.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/CHANGELOG.md +77 -0
- package/package.json +17 -23
- package/src/collectionManager.js +66 -135
- package/src/index.js +1 -2
- package/src/liveslots.js +74 -47
- package/src/virtualObjectManager.js +15 -61
- package/src/virtualReferences.js +0 -51
- package/src/watchedPromises.js +0 -6
- package/test/gc-helpers.js +1 -1
- package/test/kmarshal.js +79 -0
- package/test/liveslots-helpers.js +6 -6
- package/test/mock-gc.js +0 -1
- package/test/storeGC/test-lifecycle.js +2 -2
- package/test/storeGC/test-refcount-management.js +2 -1
- package/test/storeGC/test-scalar-store-kind.js +1 -0
- package/test/storeGC/test-weak-key.js +2 -1
- package/test/test-baggage.js +2 -1
- package/test/test-cache.js +1 -0
- package/test/test-collection-schema-refcount.js +2 -1
- package/test/test-collection-upgrade.js +3 -1
- package/test/test-collections.js +14 -117
- package/test/test-dropped-collection-weakrefs.js +2 -1
- package/test/test-durabilityChecks.js +3 -3
- package/test/test-facetiousness.js +2 -1
- package/test/test-gc-sensitivity.js +2 -2
- package/test/test-handled-promises.js +7 -5
- package/test/test-initial-vrefs.js +3 -2
- package/test/test-liveslots-mock-gc.js +2 -2
- package/test/test-liveslots-real-gc.js +2 -2
- package/test/test-liveslots.js +14 -13
- package/test/test-vo-test-harness.js +1 -0
- package/test/test-vpid-liveslots.js +4 -3
- package/test/util.js +2 -2
- package/test/vat-util.js +1 -1
- package/test/virtual-objects/test-cease-recognition.js +2 -2
- package/test/virtual-objects/test-cross-facet.js +2 -1
- package/test/virtual-objects/test-empty-data.js +2 -1
- package/test/virtual-objects/test-facets.js +2 -1
- package/test/virtual-objects/test-kind-changes.js +2 -2
- package/test/virtual-objects/test-reachable-vrefs.js +2 -2
- package/test/virtual-objects/test-rep-tostring.js +3 -2
- package/test/virtual-objects/test-retain-remotable.js +1 -1
- package/test/virtual-objects/test-state-shape.js +2 -2
- package/test/virtual-objects/test-virtualObjectGC.js +2 -2
- package/test/virtual-objects/test-virtualObjectManager.js +2 -6
- package/test/virtual-objects/test-vo-real-gc.js +2 -2
- package/test/virtual-objects/test-weakcollections-vref-handling.js +2 -1
- package/tools/fakeVirtualSupport.js +19 -37
- package/src/vatDataTypes.d.ts +0 -234
- package/src/vatDataTypes.js +0 -2
- package/tools/prepare-test-env.js +0 -13
- package/tools/setup-vat-data.js +0 -61
package/test/test-baggage.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
import { Far } from '@endo/marshal';
|
|
4
|
-
import { kunser } from '@agoric/kmarshal';
|
|
5
5
|
import { setupTestLiveslots } from './liveslots-helpers.js';
|
|
6
6
|
import { vstr } from './util.js';
|
|
7
|
+
import { kunser } from './kmarshal.js';
|
|
7
8
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
8
9
|
|
|
9
10
|
function buildRootObject(vatPowers, vatParameters, baggage) {
|
package/test/test-cache.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
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';
|
|
7
8
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
8
9
|
import { makeStartVat, makeBringOutYourDead } from './util.js';
|
|
9
10
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop, @jessie.js/no-nested-await, no-shadow */
|
|
1
2
|
import test from 'ava';
|
|
3
|
+
import '@endo/init/debug.js';
|
|
2
4
|
|
|
3
5
|
import { Far } from '@endo/marshal';
|
|
4
|
-
import { kser } from '@agoric/kmarshal';
|
|
5
6
|
import { M } from '@agoric/store';
|
|
6
7
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
7
8
|
import { parseVatSlot } from '../src/parseVatSlots.js';
|
|
9
|
+
import { kser } from './kmarshal.js';
|
|
8
10
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
9
11
|
import { makeStartVat } from './util.js';
|
|
10
12
|
import { makeMockGC } from './mock-gc.js';
|
package/test/test-collections.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
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';
|
|
7
6
|
import { makeFakeCollectionManager } from '../tools/fakeVirtualSupport.js';
|
|
8
7
|
|
|
9
8
|
const {
|
|
@@ -101,12 +100,6 @@ function exerciseMapOperations(t, collectionName, testStore) {
|
|
|
101
100
|
() => testStore.set(86, 'not work'),
|
|
102
101
|
m(`key 86 not found in collection "${collectionName}"`),
|
|
103
102
|
);
|
|
104
|
-
t.throws(
|
|
105
|
-
() => testStore.set(somethingMissing, 'not work'),
|
|
106
|
-
m(
|
|
107
|
-
`key "[Alleged: something missing]" not found in collection "${collectionName}"`,
|
|
108
|
-
),
|
|
109
|
-
);
|
|
110
103
|
t.throws(
|
|
111
104
|
() => testStore.init(47, 'already there'),
|
|
112
105
|
m(`key 47 already registered in collection "${collectionName}"`),
|
|
@@ -124,17 +117,11 @@ function exerciseMapOperations(t, collectionName, testStore) {
|
|
|
124
117
|
t.is(testStore.get(somethingElse), something);
|
|
125
118
|
|
|
126
119
|
testStore.delete(47);
|
|
127
|
-
testStore.delete(something);
|
|
128
120
|
t.falsy(testStore.has(47));
|
|
129
|
-
t.falsy(testStore.has(something));
|
|
130
121
|
t.throws(
|
|
131
122
|
() => testStore.get(47),
|
|
132
123
|
m(`key 47 not found in collection "${collectionName}"`),
|
|
133
124
|
);
|
|
134
|
-
t.throws(
|
|
135
|
-
() => testStore.get(something),
|
|
136
|
-
m(`key "[Alleged: something]" not found in collection "${collectionName}"`),
|
|
137
|
-
);
|
|
138
125
|
t.throws(
|
|
139
126
|
() => testStore.delete(22),
|
|
140
127
|
m(`key 22 not found in collection "${collectionName}"`),
|
|
@@ -159,9 +146,7 @@ function exerciseSetOperations(t, collectionName, testStore) {
|
|
|
159
146
|
t.notThrows(() => testStore.add(47));
|
|
160
147
|
|
|
161
148
|
testStore.delete(47);
|
|
162
|
-
testStore.delete(something);
|
|
163
149
|
t.falsy(testStore.has(47));
|
|
164
|
-
t.falsy(testStore.has(something));
|
|
165
150
|
t.throws(
|
|
166
151
|
() => testStore.delete(22),
|
|
167
152
|
m(`key 22 not found in collection "${collectionName}"`),
|
|
@@ -206,89 +191,6 @@ test('basic weak set operations', t => {
|
|
|
206
191
|
);
|
|
207
192
|
});
|
|
208
193
|
|
|
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
|
-
|
|
292
194
|
test('constrain map key shape', t => {
|
|
293
195
|
const stringsOnly = makeScalarBigMapStore('map key strings only', {
|
|
294
196
|
keyShape: M.string(),
|
|
@@ -503,9 +405,7 @@ test('map fail on concurrent modification', t => {
|
|
|
503
405
|
const primeMap = makeScalarBigMapStore('fmap', {
|
|
504
406
|
keyShape: M.number(),
|
|
505
407
|
});
|
|
506
|
-
|
|
507
|
-
primeMap.init(v, `${v} is prime #${i + 1}`);
|
|
508
|
-
}
|
|
408
|
+
primes.forEach((v, i) => primeMap.init(v, `${v} is prime #${i + 1}`));
|
|
509
409
|
|
|
510
410
|
let iter = primeMap.keys()[Symbol.iterator]();
|
|
511
411
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -533,9 +433,7 @@ test('set fail on concurrent modification', t => {
|
|
|
533
433
|
const primeSet = makeScalarBigSetStore('fset', {
|
|
534
434
|
keyShape: M.number(),
|
|
535
435
|
});
|
|
536
|
-
|
|
537
|
-
primeSet.add(v);
|
|
538
|
-
}
|
|
436
|
+
primes.forEach(v => primeSet.add(v));
|
|
539
437
|
|
|
540
438
|
let iter = primeSet.keys()[Symbol.iterator]();
|
|
541
439
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -563,9 +461,7 @@ test('map ok with concurrent deletion', t => {
|
|
|
563
461
|
const primeMap = makeScalarBigMapStore('fmap', {
|
|
564
462
|
keyShape: M.number(),
|
|
565
463
|
});
|
|
566
|
-
|
|
567
|
-
primeMap.init(v, `${v} is prime #${i + 1}`);
|
|
568
|
-
}
|
|
464
|
+
primes.forEach((v, i) => primeMap.init(v, `${v} is prime #${i + 1}`));
|
|
569
465
|
const iter = primeMap.keys()[Symbol.iterator]();
|
|
570
466
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
571
467
|
primeMap.delete(3);
|
|
@@ -580,9 +476,7 @@ test('set ok with concurrent deletion', t => {
|
|
|
580
476
|
const primeSet = makeScalarBigSetStore('fset', {
|
|
581
477
|
keyShape: M.number(),
|
|
582
478
|
});
|
|
583
|
-
|
|
584
|
-
primeSet.add(v);
|
|
585
|
-
}
|
|
479
|
+
primes.forEach(v => primeSet.add(v));
|
|
586
480
|
|
|
587
481
|
const iter = primeSet.keys()[Symbol.iterator]();
|
|
588
482
|
t.deepEqual(iter.next(), { done: false, value: 2 });
|
|
@@ -872,6 +766,13 @@ test('set queries', t => {
|
|
|
872
766
|
symbolKrusty,
|
|
873
767
|
undefined,
|
|
874
768
|
]);
|
|
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
|
+
]);
|
|
875
776
|
});
|
|
876
777
|
|
|
877
778
|
test('remotable sort order', t => {
|
|
@@ -897,9 +798,7 @@ test('complex map queries', t => {
|
|
|
897
798
|
const primeStore = makeScalarBigMapStore('prime map', {
|
|
898
799
|
keyShape: M.number(),
|
|
899
800
|
});
|
|
900
|
-
|
|
901
|
-
primeStore.init(v, `${v} is prime #${i + 1}`);
|
|
902
|
-
}
|
|
801
|
+
primes.forEach((v, i) => primeStore.init(v, `${v} is prime #${i + 1}`));
|
|
903
802
|
|
|
904
803
|
t.deepEqual(Array.from(primeStore.values()), [
|
|
905
804
|
'2 is prime #1',
|
|
@@ -1074,9 +973,7 @@ test('complex set queries', t => {
|
|
|
1074
973
|
const primeStore = makeScalarBigSetStore('prime set', {
|
|
1075
974
|
keyShape: M.number(),
|
|
1076
975
|
});
|
|
1077
|
-
|
|
1078
|
-
primeStore.add(v);
|
|
1079
|
-
}
|
|
976
|
+
primes.forEach(v => primeStore.add(v));
|
|
1080
977
|
|
|
1081
978
|
t.deepEqual(
|
|
1082
979
|
Array.from(primeStore.values()),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
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';
|
|
5
6
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
6
7
|
import { makeStartVat } from './util.js';
|
|
7
8
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
import { Far } from '@endo/marshal';
|
|
4
5
|
import { makeFakeVirtualStuff } from '../tools/fakeVirtualSupport.js';
|
|
@@ -15,7 +16,6 @@ async function runDurabilityCheckTest(t, relaxDurabilityRules) {
|
|
|
15
16
|
|
|
16
17
|
const durableHolderKind = makeKindHandle('holder');
|
|
17
18
|
|
|
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)', runDurabilityCheckTest, false);
|
|
273
|
-
test('durability checks (relaxed)', runDurabilityCheckTest, true);
|
|
272
|
+
test('durability checks (strict)', t => runDurabilityCheckTest(t, false));
|
|
273
|
+
test('durability checks (relaxed)', t => runDurabilityCheckTest(t, true));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@endo/init/debug.js';
|
|
1
2
|
import test from 'ava';
|
|
2
3
|
import {
|
|
3
4
|
assessFacetiousness,
|
|
@@ -125,7 +126,7 @@ test('checkAndUpdateFacetiousness', t => {
|
|
|
125
126
|
t.deepEqual(cauf({}, barfoo), barfoo);
|
|
126
127
|
|
|
127
128
|
// a single Kind can only be redefined as another single
|
|
128
|
-
t.
|
|
129
|
+
t.deepEqual(cauf(desc(), undefined), undefined);
|
|
129
130
|
t.throws(() => cauf(desc(), foo), {
|
|
130
131
|
message: 'defineDurableKindMulti called for unfaceted KindHandle "tag"',
|
|
131
132
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
3
|
import { Far } from '@endo/marshal';
|
|
4
|
-
import { kser } from '@agoric/kmarshal';
|
|
5
4
|
import { buildSyscall } from './liveslots-helpers.js';
|
|
6
5
|
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,4 +1,6 @@
|
|
|
1
|
+
/* eslint-disable no-await-in-loop, @jessie.js/no-nested-await, no-shadow */
|
|
1
2
|
import test from 'ava';
|
|
3
|
+
import '@endo/init/debug.js';
|
|
2
4
|
|
|
3
5
|
import { Far } from '@endo/marshal';
|
|
4
6
|
import { Fail } from '@agoric/assert';
|
|
@@ -7,7 +9,7 @@ import { makePromiseKit } from '@endo/promise-kit';
|
|
|
7
9
|
// Disabled to avoid circular dependencies.
|
|
8
10
|
// import { makeStoreUtils } from '@agoric/vat-data/src/vat-data-bindings.js';
|
|
9
11
|
// import { makeExoUtils } from '@agoric/vat-data/src/exo-utils.js';
|
|
10
|
-
import { kslot, kser } from '
|
|
12
|
+
import { kslot, kser } from './kmarshal.js';
|
|
11
13
|
import { setupTestLiveslots } from './liveslots-helpers.js';
|
|
12
14
|
import { makeResolve, makeReject } from './util.js';
|
|
13
15
|
|
|
@@ -231,12 +233,12 @@ test('past-incarnation watched promises', async t => {
|
|
|
231
233
|
t.deepEqual(getDispatchLogs(), [
|
|
232
234
|
fulfillmentMessage(`p-${nextPImport()}`, 'created local promise: rejected'),
|
|
233
235
|
]);
|
|
234
|
-
t.
|
|
236
|
+
t.deepEqual(
|
|
235
237
|
lastPImport - firstPImport + 1,
|
|
236
238
|
4,
|
|
237
239
|
'imported 4 promises (1 per dispatch)',
|
|
238
240
|
);
|
|
239
|
-
t.
|
|
241
|
+
t.deepEqual(lastPExport - firstPExport + 1, 1, 'exported 1 promise: first');
|
|
240
242
|
|
|
241
243
|
await dispatchMessage('watchLocalPromise', 'orphaned');
|
|
242
244
|
t.deepEqual(getDispatchLogs(), [
|
|
@@ -258,12 +260,12 @@ test('past-incarnation watched promises', async t => {
|
|
|
258
260
|
fulfillmentMessage(`p-${nextPImport()}`, 'watched local promise: rejected'),
|
|
259
261
|
rejectionMessage(`p+${lastPExport}`, S),
|
|
260
262
|
]);
|
|
261
|
-
t.
|
|
263
|
+
t.deepEqual(
|
|
262
264
|
lastPImport - firstPImport + 1,
|
|
263
265
|
7,
|
|
264
266
|
'imported 7 promises (1 per dispatch)',
|
|
265
267
|
);
|
|
266
|
-
t.
|
|
268
|
+
t.deepEqual(
|
|
267
269
|
lastPExport - firstPExport + 1,
|
|
268
270
|
4,
|
|
269
271
|
'exported 4 promises: first, orphaned, fulfilled, rejected',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
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';
|
|
7
8
|
|
|
8
9
|
function buildRootObject(vatPowers, vatParameters, baggage) {
|
|
9
10
|
const vd = vatPowers.VatData;
|
|
@@ -147,5 +148,5 @@ test('vrefs', async t => {
|
|
|
147
148
|
const expectedStore1Vref = `o+v${initialKindIDs.scalarMapStore}/5`;
|
|
148
149
|
const store1Vref = (await run('getStore1')).slots[0];
|
|
149
150
|
t.is(store1Vref, expectedStore1Vref);
|
|
150
|
-
t.
|
|
151
|
+
t.deepEqual(kunser(JSON.parse(fakestore.get(`vc.5.s${'key'}`))), 'value');
|
|
151
152
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
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';
|
|
6
5
|
import { makeLiveSlots } from '../src/liveslots.js';
|
|
7
6
|
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,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* global WeakRef */
|
|
3
2
|
import test from 'ava';
|
|
3
|
+
import '@endo/init/debug.js';
|
|
4
4
|
|
|
5
5
|
import { Far } from '@endo/marshal';
|
|
6
6
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
7
|
-
import { kslot, kser } from '@agoric/kmarshal';
|
|
8
7
|
import engineGC from './engine-gc.js';
|
|
9
8
|
import { makeGcAndFinalize } from './gc-and-finalize.js';
|
|
9
|
+
import { kslot, kser } from './kmarshal.js';
|
|
10
10
|
import { buildSyscall, makeDispatch } from './liveslots-helpers.js';
|
|
11
11
|
import {
|
|
12
12
|
makeMessage,
|
package/test/test-liveslots.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
3
|
|
|
4
4
|
import { E } from '@endo/eventual-send';
|
|
5
5
|
import { Far } from '@endo/marshal';
|
|
6
6
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
7
7
|
import { Fail } from '@agoric/assert';
|
|
8
|
-
import { kslot, kser, kunser } from '@agoric/kmarshal';
|
|
9
8
|
import { M } from '@agoric/store';
|
|
10
9
|
import { makeLiveSlots, makeMarshaller } from '../src/liveslots.js';
|
|
10
|
+
import { kslot, kser, kunser } from './kmarshal.js';
|
|
11
11
|
import { buildSyscall, makeDispatch } from './liveslots-helpers.js';
|
|
12
12
|
import { makeMessage, makeStartVat, makeResolve, makeReject } from './util.js';
|
|
13
13
|
import { makeMockGC } from './mock-gc.js';
|
|
@@ -45,14 +45,14 @@ test('calls', async t => {
|
|
|
45
45
|
|
|
46
46
|
// root!one() // sendOnly
|
|
47
47
|
await dispatch(makeMessage(rootA, 'one', ['args']));
|
|
48
|
-
t.
|
|
48
|
+
t.deepEqual(log.shift(), 'one');
|
|
49
49
|
|
|
50
50
|
// pr = makePromise()
|
|
51
51
|
// root!two(pr.promise)
|
|
52
52
|
// pr.resolve('result')
|
|
53
53
|
await dispatch(makeMessage(rootA, 'two', [kslot('p-1')]));
|
|
54
54
|
t.deepEqual(log.shift(), { type: 'subscribe', target: 'p-1' });
|
|
55
|
-
t.
|
|
55
|
+
t.deepEqual(log.shift(), 'two true');
|
|
56
56
|
|
|
57
57
|
await dispatch(makeResolve('p-1', kser('result')));
|
|
58
58
|
t.deepEqual(log.shift(), ['res', 'result']);
|
|
@@ -63,7 +63,7 @@ test('calls', async t => {
|
|
|
63
63
|
|
|
64
64
|
await dispatch(makeMessage(rootA, 'two', [kslot('p-2')]));
|
|
65
65
|
t.deepEqual(log.shift(), { type: 'subscribe', target: 'p-2' });
|
|
66
|
-
t.
|
|
66
|
+
t.deepEqual(log.shift(), 'two true');
|
|
67
67
|
|
|
68
68
|
await dispatch(makeReject('p-2', kser('rejection')));
|
|
69
69
|
t.deepEqual(log.shift(), ['rej', 'rejection']);
|
|
@@ -99,7 +99,7 @@ test('liveslots pipelines to syscall.send', async t => {
|
|
|
99
99
|
// for x!pipe1(), a second pipelined to the result promise of it, and a
|
|
100
100
|
// third pipelined to the result of the second.
|
|
101
101
|
|
|
102
|
-
t.
|
|
102
|
+
t.deepEqual(log.shift(), 'sent p1p2p3');
|
|
103
103
|
t.deepEqual(log.shift(), {
|
|
104
104
|
type: 'send',
|
|
105
105
|
targetSlot: x,
|
|
@@ -656,7 +656,8 @@ test('capdata size limit on syscalls', async t => {
|
|
|
656
656
|
};
|
|
657
657
|
|
|
658
658
|
const send = op => dispatch(makeMessage(rootA, op, [kslot(target)], rp));
|
|
659
|
-
const expectFail = () =>
|
|
659
|
+
const expectFail = () =>
|
|
660
|
+
t.deepEqual(log.shift(), 'fail: syscall capdata too large');
|
|
660
661
|
const expectVoidReturn = () =>
|
|
661
662
|
t.deepEqual(log.shift(), {
|
|
662
663
|
type: 'resolve',
|
|
@@ -905,7 +906,7 @@ test('disable disavow', async t => {
|
|
|
905
906
|
|
|
906
907
|
// root~.one() // sendOnly
|
|
907
908
|
await dispatch(makeMessage(rootA, 'one', []));
|
|
908
|
-
t.
|
|
909
|
+
t.deepEqual(log.shift(), false);
|
|
909
910
|
t.deepEqual(log, []);
|
|
910
911
|
});
|
|
911
912
|
|
|
@@ -966,7 +967,7 @@ test('disavow', async t => {
|
|
|
966
967
|
// root~.one(import1) // sendOnly
|
|
967
968
|
await dispatch(makeMessage(rootA, 'one', [kslot(import1)]));
|
|
968
969
|
t.deepEqual(log.shift(), { type: 'dropImports', slots: [import1] });
|
|
969
|
-
t.
|
|
970
|
+
t.deepEqual(log.shift(), 'disavowed pres1');
|
|
970
971
|
|
|
971
972
|
function loggedError(re) {
|
|
972
973
|
const l = log.shift();
|
|
@@ -974,11 +975,11 @@ test('disavow', async t => {
|
|
|
974
975
|
t.truthy(re.test(l.message));
|
|
975
976
|
}
|
|
976
977
|
loggedError(/attempt to disavow unknown/);
|
|
977
|
-
t.
|
|
978
|
+
t.deepEqual(log.shift(), 'tried duplicate disavow');
|
|
978
979
|
loggedError(/attempt to disavow unknown/);
|
|
979
|
-
t.
|
|
980
|
+
t.deepEqual(log.shift(), 'tried to disavow Promise');
|
|
980
981
|
loggedError(/attempt to disavow an export/);
|
|
981
|
-
t.
|
|
982
|
+
t.deepEqual(log.shift(), 'tried to disavow export');
|
|
982
983
|
const msg = log.shift();
|
|
983
984
|
t.like(msg, {
|
|
984
985
|
type: 'exit',
|
|
@@ -986,7 +987,7 @@ test('disavow', async t => {
|
|
|
986
987
|
});
|
|
987
988
|
expectError(t, msg.info, /this Presence has been disavowed/);
|
|
988
989
|
t.deepEqual(log.shift(), Error('this Presence has been disavowed'));
|
|
989
|
-
t.
|
|
990
|
+
t.deepEqual(log.shift(), 'tried to send to disavowed');
|
|
990
991
|
t.deepEqual(log, []);
|
|
991
992
|
});
|
|
992
993
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
3
|
|
|
4
4
|
import { E } from '@endo/eventual-send';
|
|
5
5
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
6
|
-
import { Far } from '@endo/marshal';
|
|
7
6
|
import { Fail } from '@agoric/assert';
|
|
8
|
-
import {
|
|
7
|
+
import { Far } from '@endo/marshal';
|
|
9
8
|
import { buildSyscall, makeDispatch } from './liveslots-helpers.js';
|
|
10
9
|
import { makeMessage, makeResolve, makeReject } from './util.js';
|
|
10
|
+
import { kser, kslot } from './kmarshal.js';
|
|
11
11
|
|
|
12
12
|
function hush(p) {
|
|
13
13
|
p.then(
|
|
@@ -293,6 +293,7 @@ async function doVatResolveCase23(t, which, mode, stalls) {
|
|
|
293
293
|
// another few turns. We wait some number of turns before using p1
|
|
294
294
|
// again, to exercise as many race conditions as possible.
|
|
295
295
|
for (let i = 0; i < stalls; i += 1) {
|
|
296
|
+
// eslint-disable-next-line no-await-in-loop
|
|
296
297
|
await Promise.resolve();
|
|
297
298
|
}
|
|
298
299
|
|
package/test/util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { kser } from '@agoric/kmarshal';
|
|
2
1
|
import { vstr } from './vat-util.js';
|
|
2
|
+
import { kser } from './kmarshal.js';
|
|
3
3
|
|
|
4
4
|
export { vstr };
|
|
5
5
|
|
|
@@ -48,7 +48,7 @@ export function buildDispatch(onDispatchCallback) {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* @param {unknown} target
|
|
51
|
-
* @param {string
|
|
51
|
+
* @param {string} method
|
|
52
52
|
* @param {any[]} args
|
|
53
53
|
* @param {unknown} result
|
|
54
54
|
*/
|
package/test/vat-util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* global FinalizationRegistry WeakRef */
|
|
3
2
|
import test from 'ava';
|
|
3
|
+
import '@endo/init/debug.js';
|
|
4
4
|
|
|
5
5
|
import { buildSyscall } from '../liveslots-helpers.js';
|
|
6
6
|
import { makeVirtualReferenceManager } from '../../src/virtualReferences.js';
|
|
@@ -38,7 +38,7 @@ function weakKeyCheck(t, log, vref) {
|
|
|
38
38
|
t.true(result === undefined || !result.startsWith(prefix), `ew:${result}`);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
test('only enumerate virtual objects', t => {
|
|
41
|
+
test('only enumerate virtual objects', async t => {
|
|
42
42
|
const { log, vrm } = makeVRM();
|
|
43
43
|
|
|
44
44
|
// retiring a plain Remotable does a is-it-a-weak-key chck
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js';
|
|
4
5
|
|
|
@@ -14,7 +15,7 @@ function attack2(mut1, immut2) {
|
|
|
14
15
|
Reflect.apply(mutableProto.set, immut2, [6]);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
test('forbid cross-facet prototype attack', t => {
|
|
18
|
+
test('forbid cross-facet prototype attack', async t => {
|
|
18
19
|
const vom = makeFakeVirtualObjectManager();
|
|
19
20
|
const init = () => ({ value: 0 });
|
|
20
21
|
const behavior = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js';
|
|
4
5
|
|
|
5
|
-
test('non-object initial data message', t => {
|
|
6
|
+
test('non-object initial data message', async t => {
|
|
6
7
|
const vom = makeFakeVirtualObjectManager();
|
|
7
8
|
const goodInit = () => ({ value: 0 });
|
|
8
9
|
// 'badInit' is () => { value: 0 }
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
2
3
|
|
|
3
4
|
import { makeFakeVirtualObjectManager } from '../../tools/fakeVirtualSupport.js';
|
|
4
5
|
|
|
5
|
-
test('facets', t => {
|
|
6
|
+
test('facets', async t => {
|
|
6
7
|
const vom = makeFakeVirtualObjectManager();
|
|
7
8
|
const init = () => ({ value: 0 });
|
|
8
9
|
const behavior = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
3
|
import { Far } from '@endo/marshal';
|
|
4
|
-
import { kser } from '@agoric/kmarshal';
|
|
5
4
|
import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js';
|
|
6
5
|
import { makeLiveSlots } from '../../src/liveslots.js';
|
|
7
6
|
import { parseVatSlot } from '../../src/parseVatSlots.js';
|
|
7
|
+
import { kser } from '../kmarshal.js';
|
|
8
8
|
import { buildSyscall } from '../liveslots-helpers.js';
|
|
9
9
|
import { makeStartVat, makeMessage } from '../util.js';
|
|
10
10
|
import { makeMockGC } from '../mock-gc.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import test from 'ava';
|
|
2
|
+
import '@endo/init/debug.js';
|
|
3
3
|
|
|
4
4
|
import { Remotable } from '@endo/marshal';
|
|
5
5
|
import { initEmpty } from '@agoric/store';
|
|
@@ -7,7 +7,7 @@ import { initEmpty } from '@agoric/store';
|
|
|
7
7
|
import { makeVatSlot } from '../../src/parseVatSlots.js';
|
|
8
8
|
import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js';
|
|
9
9
|
|
|
10
|
-
test('VOM tracks reachable vrefs', t => {
|
|
10
|
+
test('VOM tracks reachable vrefs', async t => {
|
|
11
11
|
const { vom, vrm, cm } = makeFakeVirtualStuff();
|
|
12
12
|
const { defineKind } = vom;
|
|
13
13
|
const { makeScalarBigWeakMapStore } = cm;
|