@agoric/swingset-liveslots 0.10.3-dev-3e909dc.0 → 0.10.3-dev-d4b32f1.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-3e909dc.0+3e909dc",
3
+ "version": "0.10.3-dev-d4b32f1.0+d4b32f1",
4
4
  "description": "SwingSet ocap support layer",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -17,9 +17,9 @@
17
17
  "lint:eslint": "eslint ."
18
18
  },
19
19
  "dependencies": {
20
- "@agoric/assert": "0.6.1-dev-3e909dc.0+3e909dc",
21
- "@agoric/internal": "0.3.3-dev-3e909dc.0+3e909dc",
22
- "@agoric/store": "0.9.3-dev-3e909dc.0+3e909dc",
20
+ "@agoric/assert": "0.6.1-dev-d4b32f1.0+d4b32f1",
21
+ "@agoric/internal": "0.3.3-dev-d4b32f1.0+d4b32f1",
22
+ "@agoric/store": "0.9.3-dev-d4b32f1.0+d4b32f1",
23
23
  "@endo/eventual-send": "^0.17.5",
24
24
  "@endo/exo": "^0.2.5",
25
25
  "@endo/far": "^0.2.21",
@@ -31,6 +31,7 @@
31
31
  "@endo/promise-kit": "^0.2.59"
32
32
  },
33
33
  "devDependencies": {
34
+ "@agoric/kmarshal": "0.1.1-dev-d4b32f1.0+d4b32f1",
34
35
  "ava": "^5.3.0"
35
36
  },
36
37
  "files": [
@@ -66,5 +67,5 @@
66
67
  "typeCoverage": {
67
68
  "atLeast": 71.48
68
69
  },
69
- "gitHead": "3e909dcf51841f5c062c6f31bc89cacae18394ff"
70
+ "gitHead": "d4b32f129868ed2faa32f1bcad51b5d2248d4c14"
70
71
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Far } from '@endo/marshal';
4
4
  import { M } from '@agoric/store';
5
- import { kslot, kser } from './kmarshal.js';
5
+ import { kslot, kser } from '@agoric/kmarshal';
6
6
  import { parseVatSlot } from '../src/parseVatSlots.js';
7
7
 
8
8
  // These tests follow the model described in
@@ -1,6 +1,7 @@
1
1
  /* global WeakRef, FinalizationRegistry */
2
- import engineGC from './engine-gc.js';
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,7 +13,6 @@ 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]
@@ -1,12 +1,12 @@
1
1
  // @ts-nocheck
2
2
  import test from 'ava';
3
3
 
4
+ import { kslot, kunser } from '@agoric/kmarshal';
4
5
  import {
5
6
  setupTestLiveslots,
6
7
  findSyscallsByType,
7
8
  } from '../liveslots-helpers.js';
8
9
  import { buildRootObject, mainHeldIdx, mapRef } from '../gc-helpers.js';
9
- import { kslot, kunser } from '../kmarshal.js';
10
10
  import { parseVatSlot } from '../../src/parseVatSlots.js';
11
11
 
12
12
  // These tests follow the model described in
@@ -1,5 +1,6 @@
1
1
  import test from 'ava';
2
2
 
3
+ import { kslot } from '@agoric/kmarshal';
3
4
  import {
4
5
  findSyscallsByType,
5
6
  setupTestLiveslots,
@@ -11,7 +12,6 @@ import {
11
12
  refValString,
12
13
  assertCollectionDeleted,
13
14
  } from '../gc-helpers.js';
14
- import { kslot } from '../kmarshal.js';
15
15
  import { vstr } from '../util.js';
16
16
 
17
17
  // These tests follow the model described in
@@ -1,5 +1,6 @@
1
1
  import test from 'ava';
2
2
 
3
+ import { kslot } from '@agoric/kmarshal';
3
4
  import { setupTestLiveslots } from '../liveslots-helpers.js';
4
5
  import {
5
6
  buildRootObject,
@@ -7,7 +8,6 @@ import {
7
8
  assertCollectionDeleted,
8
9
  deduceCollectionID,
9
10
  } from '../gc-helpers.js';
10
- import { kslot } from '../kmarshal.js';
11
11
  import { vstr } from '../util.js';
12
12
 
13
13
  // These tests follow the model described in test-virtualObjectGC.js
@@ -1,9 +1,9 @@
1
1
  import test from 'ava';
2
2
 
3
3
  import { Far } from '@endo/marshal';
4
+ import { kunser } from '@agoric/kmarshal';
4
5
  import { setupTestLiveslots } from './liveslots-helpers.js';
5
6
  import { vstr } from './util.js';
6
- import { kunser } from './kmarshal.js';
7
7
  import { parseVatSlot } from '../src/parseVatSlots.js';
8
8
 
9
9
  function buildRootObject(vatPowers, vatParameters, baggage) {
@@ -1,9 +1,9 @@
1
1
  import test from 'ava';
2
2
 
3
3
  import { Far } from '@endo/marshal';
4
+ import { kser } from '@agoric/kmarshal';
4
5
  import { makeLiveSlots } from '../src/liveslots.js';
5
6
  import { parseVatSlot } from '../src/parseVatSlots.js';
6
- import { kser } from './kmarshal.js';
7
7
  import { buildSyscall } from './liveslots-helpers.js';
8
8
  import { makeStartVat, makeBringOutYourDead } from './util.js';
9
9
  import { makeMockGC } from './mock-gc.js';
@@ -1,10 +1,10 @@
1
1
  import test from 'ava';
2
2
 
3
3
  import { Far } from '@endo/marshal';
4
+ import { kser } from '@agoric/kmarshal';
4
5
  import { M } from '@agoric/store';
5
6
  import { makeLiveSlots } from '../src/liveslots.js';
6
7
  import { parseVatSlot } from '../src/parseVatSlots.js';
7
- import { kser } from './kmarshal.js';
8
8
  import { buildSyscall } from './liveslots-helpers.js';
9
9
  import { makeStartVat } from './util.js';
10
10
  import { makeMockGC } from './mock-gc.js';
@@ -1,7 +1,7 @@
1
1
  import test from 'ava';
2
2
  import { Far } from '@endo/marshal';
3
+ import { kser } from '@agoric/kmarshal';
3
4
  import { makeLiveSlots } from '../src/liveslots.js';
4
- import { kser } from './kmarshal.js';
5
5
  import { buildSyscall } from './liveslots-helpers.js';
6
6
  import { makeStartVat } from './util.js';
7
7
  import { makeMockGC } from './mock-gc.js';
@@ -1,9 +1,9 @@
1
1
  // @ts-nocheck
2
2
  import test from 'ava';
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
 
@@ -7,7 +7,7 @@ import { makePromiseKit } from '@endo/promise-kit';
7
7
  // Disabled to avoid circular dependencies.
8
8
  // import { makeStoreUtils } from '@agoric/vat-data/src/vat-data-bindings.js';
9
9
  // import { makeExoUtils } from '@agoric/vat-data/src/exo-utils.js';
10
- import { kslot, kser } from './kmarshal.js';
10
+ import { kslot, kser } from '@agoric/kmarshal';
11
11
  import { setupTestLiveslots } from './liveslots-helpers.js';
12
12
  import { makeResolve, makeReject } from './util.js';
13
13
 
@@ -1,9 +1,9 @@
1
1
  import test from 'ava';
2
2
 
3
3
  import { Far } from '@endo/far';
4
+ import { kunser } from '@agoric/kmarshal';
4
5
  import { M } from '@agoric/store';
5
6
  import { setupTestLiveslots } from './liveslots-helpers.js';
6
- import { kunser } from './kmarshal.js';
7
7
 
8
8
  function buildRootObject(vatPowers, vatParameters, baggage) {
9
9
  const vd = vatPowers.VatData;
@@ -2,9 +2,9 @@
2
2
  import test from 'ava';
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,
@@ -4,9 +4,9 @@ import test from 'ava';
4
4
 
5
5
  import { Far } from '@endo/marshal';
6
6
  import { makePromiseKit } from '@endo/promise-kit';
7
+ import { kslot, kser } from '@agoric/kmarshal';
7
8
  import engineGC from './engine-gc.js';
8
9
  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,
@@ -5,9 +5,9 @@ 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';
8
9
  import { M } from '@agoric/store';
9
10
  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';
@@ -3,11 +3,11 @@ import test from 'ava';
3
3
 
4
4
  import { E } from '@endo/eventual-send';
5
5
  import { makePromiseKit } from '@endo/promise-kit';
6
- import { Fail } from '@agoric/assert';
7
6
  import { Far } from '@endo/marshal';
7
+ import { Fail } from '@agoric/assert';
8
+ import { kser, kslot } from '@agoric/kmarshal';
8
9
  import { buildSyscall, makeDispatch } from './liveslots-helpers.js';
9
10
  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(
package/test/util.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { kser } from '@agoric/kmarshal';
1
2
  import { vstr } from './vat-util.js';
2
- import { kser } from './kmarshal.js';
3
3
 
4
4
  export { vstr };
5
5
 
package/test/vat-util.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // modules
3
3
 
4
4
  import { Fail } from '@agoric/assert';
5
- import { kser, kunser } from './kmarshal.js';
5
+ import { kser, kunser } from '@agoric/kmarshal';
6
6
 
7
7
  export function extractMessage(vatDeliverObject) {
8
8
  const [type, ...vdoargs] = vatDeliverObject;
@@ -1,10 +1,10 @@
1
1
  // @ts-nocheck
2
2
  import test from 'ava';
3
3
  import { Far } from '@endo/marshal';
4
+ import { kser } from '@agoric/kmarshal';
4
5
  import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js';
5
6
  import { makeLiveSlots } from '../../src/liveslots.js';
6
7
  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';
@@ -2,9 +2,9 @@
2
2
  import test from 'ava';
3
3
 
4
4
  import { Far } from '@endo/marshal';
5
+ import { kser, kslot } from '@agoric/kmarshal';
5
6
  import { M } from '@agoric/store';
6
7
  import { makeLiveSlots } from '../../src/liveslots.js';
7
- import { kser, kslot } 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';
@@ -2,11 +2,11 @@
2
2
  import test from 'ava';
3
3
 
4
4
  import { Far } from '@endo/marshal';
5
+ import { krefOf, kser, kslot } from '@agoric/kmarshal';
5
6
  import {
6
7
  setupTestLiveslots,
7
8
  findSyscallsByType,
8
9
  } from '../liveslots-helpers.js';
9
- import { krefOf, kser, kslot } from '../kmarshal.js';
10
10
  import { parseVatSlot } from '../../src/parseVatSlots.js';
11
11
 
12
12
  // Legs:
@@ -1,12 +1,12 @@
1
1
  // @ts-nocheck
2
2
  import test from 'ava';
3
3
 
4
+ import { kser, kslot } from '@agoric/kmarshal';
4
5
  import {
5
6
  makeFakeVirtualObjectManager,
6
7
  makeFakeVirtualStuff,
7
8
  } from '../../tools/fakeVirtualSupport.js';
8
9
 
9
- import { kser, kslot } from '../kmarshal.js';
10
10
  import { vstr } from '../util.js';
11
11
 
12
12
  function initThing(label = 'thing', counter = 0) {
@@ -3,7 +3,7 @@
3
3
  import test from 'ava';
4
4
 
5
5
  import { Far } from '@endo/marshal';
6
- import { kser, kunser } from '../kmarshal.js';
6
+ import { kser, kunser } from '@agoric/kmarshal';
7
7
  import { setupTestLiveslots } from '../liveslots-helpers.js';
8
8
 
9
9
  test('virtual object state writes', async t => {
package/test/kmarshal.js DELETED
@@ -1,79 +0,0 @@
1
- import { Far, makeMarshal, passStyleOf } from '@endo/marshal';
2
- import { assert } from '@agoric/assert';
3
-
4
- // Simple wrapper for serializing and unserializing marshalled values inside the
5
- // kernel, where we don't actually want to use clists nor actually allocate real
6
- // objects, but instead to stay entirely within the domain of krefs. This is
7
- // used to enable syntactic manipulation of serialized values while remaining
8
- // agnostic about the internal details of the serialization encoding.
9
-
10
- const refMap = new WeakMap();
11
-
12
- export const kslot = (kref, iface) => {
13
- assert.typeof(kref, 'string');
14
- if (iface && iface.startsWith('Alleged: ')) {
15
- // Encoder prepends "Alleged: " to iface string, but the decoder doesn't strip it
16
- // Unclear whether it's the decoder or me who is wrong
17
- iface = iface.slice(9);
18
- }
19
- if (
20
- kref.startsWith('p') ||
21
- kref.startsWith('kp') ||
22
- kref.startsWith('lp') ||
23
- kref.startsWith('rp')
24
- ) {
25
- // TODO: temporary hack because smallcaps encodes promise references
26
- // differently from remotable object references, and the current version of
27
- // the smallcaps decoder annoyingly insists that if the encoded body string
28
- // says a slot is a promise, then convertSlotToVal had better by damn return
29
- // an actual Promise, even if, as in the intended use case here, we neither
30
- // want nor need a promise, nor the overhead of a map to keep track of it
31
- // with. This behavior is in service of defense against a hypothesized
32
- // security issue whose exact nature has largely been forgotton in the
33
- // months since it was first encountered. MarkM is currently researching
34
- // what the problem was thought to have been, to see if it is real and to
35
- // understand it if so. This will eventually result in either changes to
36
- // the smallcaps encoding or to the marshal setup API to support the purely
37
- // manipulative use case. In the meantime, this ugliness...
38
- const p = new Promise(() => undefined);
39
- refMap.set(p, kref);
40
- return harden(p);
41
- } else {
42
- const o = Far(iface, {
43
- iface: () => iface,
44
- getKref: () => `${kref}`,
45
- });
46
- return o;
47
- }
48
- };
49
-
50
- export const krefOf = obj => {
51
- const fromMap = refMap.get(obj);
52
- if (fromMap) {
53
- return fromMap;
54
- }
55
- // When krefOf() is called as part of kmarshal.serialize, marshal
56
- // will only give it things that are 'remotable' (Promises and the
57
- // Far objects created by kslot()). When krefOf() is called by
58
- // kernel code (as part of extractSingleSlot() or the vat-comms
59
- // equivalent), it ought to throw if 'obj' is not one of the Far
60
- // objects created by our kslot().
61
- assert.equal(passStyleOf(obj), 'remotable', obj);
62
- const getKref = obj.getKref;
63
- assert.typeof(getKref, 'function');
64
- return getKref();
65
- };
66
-
67
- const kmarshal = makeMarshal(krefOf, kslot, {
68
- serializeBodyFormat: 'smallcaps',
69
- errorTagging: 'off',
70
- });
71
-
72
- export const kser = value => kmarshal.serialize(harden(value));
73
-
74
- export const kunser = serializedValue => kmarshal.unserialize(serializedValue);
75
-
76
- export function makeError(message) {
77
- assert.typeof(message, 'string');
78
- return kser(Error(message));
79
- }