@agoric/swingset-liveslots 0.10.3-dev-ff1e301.0 → 0.10.3-dev-e90f87b.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-liveslots",
3
- "version": "0.10.3-dev-ff1e301.0+ff1e301",
3
+ "version": "0.10.3-dev-e90f87b.0+e90f87b",
4
4
  "description": "SwingSet ocap support layer",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -17,10 +17,10 @@
17
17
  "lint:eslint": "eslint ."
18
18
  },
19
19
  "dependencies": {
20
- "@agoric/assert": "0.6.1-dev-ff1e301.0+ff1e301",
21
- "@agoric/internal": "0.3.3-dev-ff1e301.0+ff1e301",
22
- "@agoric/store": "0.9.3-dev-ff1e301.0+ff1e301",
23
- "@agoric/vat-data": "0.5.3-dev-ff1e301.0+ff1e301",
20
+ "@agoric/assert": "0.6.1-dev-e90f87b.0+e90f87b",
21
+ "@agoric/internal": "0.3.3-dev-e90f87b.0+e90f87b",
22
+ "@agoric/store": "0.9.3-dev-e90f87b.0+e90f87b",
23
+ "@agoric/vat-data": "0.5.3-dev-e90f87b.0+e90f87b",
24
24
  "@endo/eventual-send": "^0.17.2",
25
25
  "@endo/exo": "^0.2.2",
26
26
  "@endo/far": "^0.2.18",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "ff1e3013a79972ab47a155914df2d96eacc96c5b"
64
+ "gitHead": "e90f87b24c5fa53a0f5c00f41cb633a07497d0b1"
65
65
  }
@@ -16,10 +16,19 @@ import {
16
16
 
17
17
  /** @template T @typedef {import('@agoric/vat-data').DefineKindOptions<T>} DefineKindOptions */
18
18
 
19
- const { hasOwn, defineProperty, getOwnPropertyNames } = Object;
19
+ const { hasOwn, defineProperty, getOwnPropertyNames, entries } = Object;
20
20
  const { ownKeys } = Reflect;
21
21
  const { quote: q } = assert;
22
22
 
23
+ // See https://github.com/Agoric/agoric-sdk/issues/8005
24
+ // Once agoric-sdk is upgraded to depend on endo post
25
+ // https://github.com/endojs/endo/pull/1606 then remove this
26
+ // definition of `b` and say instead
27
+ // ```js
28
+ // const { quote: q, base: b } = assert;
29
+ // ```
30
+ const b = index => q(Number(index));
31
+
23
32
  // import { kdebug } from './kdebug.js';
24
33
 
25
34
  // TODO Use environment-options.js currently in ses/src after factoring it out
@@ -141,9 +150,8 @@ const makeContextCache = (makeState, makeContext) => {
141
150
  * @param {*} getSlotForVal
142
151
  * @returns {ContextProvider}
143
152
  */
144
- const makeContextProvider = (contextCache, getSlotForVal) => {
145
- return harden(rep => contextCache.get(getSlotForVal(rep)));
146
- };
153
+ const makeContextProvider = (contextCache, getSlotForVal) =>
154
+ harden(rep => contextCache.get(getSlotForVal(rep)));
147
155
 
148
156
  const makeContextProviderKit = (contextCache, getSlotForVal, facetNames) => {
149
157
  /** @type { Record<string, any> } */
@@ -260,15 +268,15 @@ const makeFacets = (
260
268
  };
261
269
 
262
270
  const insistDurableCapdata = (vrm, what, capdata, valueFor) => {
263
- capdata.slots.forEach((vref, idx) => {
271
+ for (const [idx, vref] of entries(capdata.slots)) {
264
272
  if (!vrm.isDurable(vref)) {
265
273
  if (valueFor) {
266
- Fail`value for ${what} is not durable: slot ${q(idx)} of ${capdata}`;
274
+ Fail`value for ${what} is not durable: slot ${b(idx)} of ${capdata}`;
267
275
  } else {
268
- Fail`${what} is not durable: slot ${q(idx)} of ${capdata}`;
276
+ Fail`${what} is not durable: slot ${b(idx)} of ${capdata}`;
269
277
  }
270
278
  }
271
- });
279
+ }
272
280
  };
273
281
 
274
282
  const insistSameCapData = (oldCD, newCD) => {
@@ -281,11 +289,11 @@ const insistSameCapData = (oldCD, newCD) => {
281
289
  if (oldCD.slots.length !== newCD.slots.length) {
282
290
  Fail`durable Kind stateShape mismatch (slots.length)`;
283
291
  }
284
- oldCD.slots.forEach((oldVref, idx) => {
292
+ for (const [idx, oldVref] of entries(oldCD.slots)) {
285
293
  if (newCD.slots[idx] !== oldVref) {
286
294
  Fail`durable Kind stateShape mismatch (slot[${idx}])`;
287
295
  }
288
- });
296
+ }
289
297
  };
290
298
 
291
299
  /**
@@ -707,7 +715,7 @@ export const makeVirtualObjectManager = (
707
715
  durableKindDescriptor = undefined, // only for durables
708
716
  ) => {
709
717
  const {
710
- finish,
718
+ finish = undefined,
711
719
  stateShape = undefined,
712
720
  thisfulMethods = false,
713
721
  interfaceGuard = undefined,
@@ -974,9 +982,9 @@ export const makeVirtualObjectManager = (
974
982
  let doMoreGC = false;
975
983
  const record = dataCache.get(baseRef);
976
984
  for (const valueCD of Object.values(record.capdatas)) {
977
- valueCD.slots.forEach(vref => {
985
+ for (const vref of valueCD.slots) {
978
986
  doMoreGC = vrm.removeReachableVref(vref) || doMoreGC;
979
- });
987
+ }
980
988
  }
981
989
  dataCache.delete(baseRef);
982
990
  return doMoreGC;
@@ -1015,6 +1023,7 @@ export const makeVirtualObjectManager = (
1015
1023
  if (isDurable) {
1016
1024
  insistDurableCapdata(vrm, prop, valueCD, true);
1017
1025
  }
1026
+ // eslint-disable-next-line github/array-foreach
1018
1027
  valueCD.slots.forEach(vrm.addReachableVref);
1019
1028
  capdatas[prop] = valueCD;
1020
1029
  valueMap.set(prop, value);