@agoric/swingset-vat 0.32.3-dev-3e909dc.0 → 0.32.3-dev-a1dd248.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-vat",
3
- "version": "0.32.3-dev-3e909dc.0+3e909dc",
3
+ "version": "0.32.3-dev-a1dd248.0+a1dd248",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,16 +27,17 @@
27
27
  "@types/yargs-parser": "^21.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@agoric/assert": "0.6.1-dev-3e909dc.0+3e909dc",
31
- "@agoric/internal": "0.3.3-dev-3e909dc.0+3e909dc",
32
- "@agoric/store": "0.9.3-dev-3e909dc.0+3e909dc",
33
- "@agoric/swing-store": "0.9.2-dev-3e909dc.0+3e909dc",
34
- "@agoric/swingset-liveslots": "0.10.3-dev-3e909dc.0+3e909dc",
35
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-3e909dc.0+3e909dc",
36
- "@agoric/time": "0.3.3-dev-3e909dc.0+3e909dc",
37
- "@agoric/vat-data": "0.5.3-dev-3e909dc.0+3e909dc",
38
- "@agoric/xsnap": "0.14.3-dev-3e909dc.0+3e909dc",
39
- "@agoric/xsnap-lockdown": "0.14.1-dev-3e909dc.0+3e909dc",
30
+ "@agoric/assert": "0.6.1-dev-a1dd248.0+a1dd248",
31
+ "@agoric/internal": "0.3.3-dev-a1dd248.0+a1dd248",
32
+ "@agoric/kmarshal": "0.1.1-dev-a1dd248.0+a1dd248",
33
+ "@agoric/store": "0.9.3-dev-a1dd248.0+a1dd248",
34
+ "@agoric/swing-store": "0.9.2-dev-a1dd248.0+a1dd248",
35
+ "@agoric/swingset-liveslots": "0.10.3-dev-a1dd248.0+a1dd248",
36
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-a1dd248.0+a1dd248",
37
+ "@agoric/time": "0.3.3-dev-a1dd248.0+a1dd248",
38
+ "@agoric/vat-data": "0.5.3-dev-a1dd248.0+a1dd248",
39
+ "@agoric/xsnap": "0.14.3-dev-a1dd248.0+a1dd248",
40
+ "@agoric/xsnap-lockdown": "0.14.1-dev-a1dd248.0+a1dd248",
40
41
  "@endo/base64": "^0.2.34",
41
42
  "@endo/bundle-source": "^2.7.0",
42
43
  "@endo/captp": "^3.1.4",
@@ -100,5 +101,5 @@
100
101
  "typeCoverage": {
101
102
  "atLeast": 75.26
102
103
  },
103
- "gitHead": "3e909dcf51841f5c062c6f31bc89cacae18394ff"
104
+ "gitHead": "a1dd248f1dc5a770760e7520660ca9d4d7f442aa"
104
105
  }
@@ -20,7 +20,7 @@ import engineGC from '@agoric/internal/src/lib-nodejs/engine-gc.js';
20
20
  import { startSubprocessWorker } from '@agoric/internal/src/lib-nodejs/spawnSubprocessWorker.js';
21
21
  import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js';
22
22
  import { makeGcAndFinalize } from '@agoric/internal/src/lib-nodejs/gc-and-finalize.js';
23
- import { kslot, krefOf } from '../lib/kmarshal.js';
23
+ import { kslot, krefOf } from '@agoric/kmarshal';
24
24
  import { insistStorageAPI } from '../lib/storageAPI.js';
25
25
  import {
26
26
  buildKernelBundle,
@@ -3,9 +3,9 @@
3
3
  import { makeMarshal } from '@endo/marshal';
4
4
  import { Far } from '@endo/far';
5
5
  import { assert, Fail } from '@agoric/assert';
6
+ import { kser, kunser } from '@agoric/kmarshal';
6
7
  import { assertKnownOptions } from '../lib/assertOptions.js';
7
8
  import { insistVatID } from '../lib/id.js';
8
- import { kser, kunser } from '../lib/kmarshal.js';
9
9
  import { makeVatSlot } from '../lib/parseVatSlots.js';
10
10
  import { insistStorageAPI } from '../lib/storageAPI.js';
11
11
  import { makeVatOptionRecorder } from '../lib/recordVatOptions.js';
@@ -1,8 +1,8 @@
1
1
  import { Nat } from '@endo/nat';
2
2
  import { assert } from '@agoric/assert';
3
+ import { kunser } from '@agoric/kmarshal';
3
4
  import { buildSerializationTools } from '../lib/deviceTools.js';
4
5
  import { insistVatID } from '../../lib/id.js';
5
- import { kunser } from '../../lib/kmarshal.js';
6
6
 
7
7
  /*
8
8
 
@@ -2,9 +2,9 @@ import { assert, Fail } from '@agoric/assert';
2
2
  import { isNat } from '@endo/nat';
3
3
  import { importBundle } from '@endo/import-bundle';
4
4
  import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
5
+ import { kser, kslot, makeError } from '@agoric/kmarshal';
5
6
  import { assertKnownOptions } from '../lib/assertOptions.js';
6
7
  import { foreverPolicy } from '../lib/runPolicies.js';
7
- import { kser, kslot, makeError } from '../lib/kmarshal.js';
8
8
  import { makeVatManagerFactory } from './vat-loader/manager-factory.js';
9
9
  import { makeVatWarehouse } from './vat-warehouse.js';
10
10
  import makeDeviceManager from './deviceManager.js';
@@ -1,8 +1,8 @@
1
+ import { kser } from '@agoric/kmarshal';
1
2
  import { insistKernelType, parseKernelSlot } from './parseKernelSlots.js';
2
3
  import { insistCapData } from '../lib/capdata.js';
3
4
  import { insistMessage } from '../lib/message.js';
4
5
  import { insistVatID } from '../lib/id.js';
5
- import { kser } from '../lib/kmarshal.js';
6
6
 
7
7
  /**
8
8
  * @param {object} tools
@@ -1,5 +1,5 @@
1
+ import { kunser } from '@agoric/kmarshal';
1
2
  import { insistCapData } from '../lib/capdata.js';
2
- import { kunser } from '../lib/kmarshal.js';
3
3
 
4
4
  /**
5
5
  * @param {string} vatID
@@ -1,6 +1,6 @@
1
1
  import { assert } from '@agoric/assert';
2
+ import { kser, kunser } from '@agoric/kmarshal';
2
3
  import { insistVatID } from '../lib/id.js';
3
- import { kser, kunser } from '../lib/kmarshal.js';
4
4
 
5
5
  export function makeVatAdminHooks(tools) {
6
6
  const { kernelKeeper, terminateVat } = tools;
@@ -1,6 +1,6 @@
1
1
  import { Fail } from '@agoric/assert';
2
2
  import { passStyleOf } from '@endo/far';
3
- import { kunser, krefOf } from './kmarshal.js';
3
+ import { kunser, krefOf } from '@agoric/kmarshal';
4
4
 
5
5
  /* eslint-disable jsdoc/require-returns-check */
6
6
  /**
@@ -11,7 +11,7 @@
11
11
  // "data is not callable" error is kind of unique to the way swingset handles
12
12
  // references, so we create a distinct error message.
13
13
 
14
- import { kunser, kser } from './kmarshal.js';
14
+ import { kunser, kser } from '@agoric/kmarshal';
15
15
 
16
16
  export function makeUndeliverableError(methargs) {
17
17
  const method = kunser(methargs)[0];
@@ -1,6 +1,6 @@
1
1
  import { Nat } from '@endo/nat';
2
2
  import { assert, Fail } from '@agoric/assert';
3
- import { kser, kunser, kslot, krefOf } from '../../lib/kmarshal.js';
3
+ import { kser, kunser, kslot, krefOf } from '@agoric/kmarshal';
4
4
 
5
5
  // deliverToController() is used for local vats which want to talk to us as a
6
6
  // vat, rather than as a conduit to talk to remote vats. The bootstrap
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
 
3
3
  import { assert, Fail } from '@agoric/assert';
4
+ import { kser } from '@agoric/kmarshal';
4
5
  import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js';
5
6
  import { makeUndeliverableError } from '../../lib/makeUndeliverableError.js';
6
7
  import { extractSingleSlot, insistCapData } from '../../lib/capdata.js';
7
8
  import { insistRemoteType } from './parseRemoteSlot.js';
8
9
  import { insistRemoteID } from './remote.js';
9
- import { kser } from '../../lib/kmarshal.js';
10
10
 
11
11
  export function makeDeliveryKit(
12
12
  state,
@@ -1,10 +1,10 @@
1
1
  import { assert, Fail } from '@agoric/assert';
2
+ import { kser, kunser } from '@agoric/kmarshal';
2
3
  import { makeVatSlot } from '../../lib/parseVatSlots.js';
3
4
  import { insistMessage } from '../../lib/message.js';
4
5
  import { makeState } from './state.js';
5
6
  import { deliverToController } from './controller.js';
6
7
  import { insistCapData } from '../../lib/capdata.js';
7
- import { kser, kunser } from '../../lib/kmarshal.js';
8
8
 
9
9
  import { makeCListKit } from './clist.js';
10
10
  import { makeDeliveryKit } from './delivery.js';
@@ -1,165 +0,0 @@
1
- import { Far, passStyleOf } from '@endo/far';
2
- import { makeMarshal } from '@endo/marshal';
3
- import { assert, Fail } from '@agoric/assert';
4
-
5
- // Simple wrapper for serializing and unserializing marshalled values inside the
6
- // kernel, where we don't actually want to use clists nor actually allocate real
7
- // objects, but instead to stay entirely within the domain of krefs. This is
8
- // used to enable syntactic manipulation of serialized values while remaining
9
- // agnostic about the internal details of the serialization encoding.
10
-
11
- /**
12
- * @typedef {{getKref: () => string, iface: () => string} | Promise} KCap
13
- */
14
-
15
- const { toStringTag } = Symbol;
16
-
17
- const makeStringStandinPromise = kref => {
18
- const p = Promise.resolve(`${kref} stand in`);
19
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
20
- Object.defineProperty(p, toStringTag, {
21
- value: kref,
22
- enumerable: false,
23
- });
24
- return harden(p);
25
- };
26
-
27
- const getStringStandinPromiseTag = p => {
28
- const desc = Object.getOwnPropertyDescriptor(p, toStringTag);
29
- assert(desc !== undefined, 'promise lacks own @@toStringTag property');
30
- const kref = desc.value;
31
- assert.typeof(kref, 'string');
32
- return kref;
33
- };
34
-
35
- const makeAccessorStandinPromise = kref => {
36
- // TODO This Bizarro world hack is only for the version of Endo that
37
- // agoric-sdk currently depends on, and is already inconsistent with
38
- // the "current" endo. Once agoric-sdk depends only on the next endo,
39
- // we should delete this code, and rename `makeStringStandinPromise`
40
- // above to `makeStandinPromise`.
41
- //
42
- // Bizarro World hack for attaching a string property to a Promise, courtesy
43
- // of MarkM. Even though the @@toStringTag property nominally *is* a
44
- // string, some unfortunate stuff in our hardened JS safety checks blows up
45
- // if it actually is. Eventually that will be fixed and we'll be able to
46
- // use the @@toStringTag property directly, but for now we need to use this
47
- // weird construct employing a sneaky getter function. Note that this is
48
- // only necessary in the first place because smallcaps encodes promise
49
- // references differently from remotable object references, and the current
50
- // version of the smallcaps decoder annoyingly insists that if the encoded
51
- // body string says a slot is a promise, then convertSlotToVal had better by
52
- // damn return an actual Promise, even if, as in the intended use case here,
53
- // we neither want nor need a promise nor are capable of making any use of
54
- // the fact that it is one.
55
- const p = Promise.resolve(`${kref} stand in`);
56
- // Bizarro World makes eslint hallucinate
57
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
58
- Object.defineProperty(p, toStringTag, {
59
- get: reveal => (reveal ? kref : NaN),
60
- enumerable: false,
61
- });
62
- return harden(p);
63
- };
64
-
65
- const getAccessorStandinPromiseTag = p => {
66
- // Other half of Bizarro World hack for handling promises. Note the
67
- // peculiar way the @@toStringTag getter is used.
68
- const desc = Object.getOwnPropertyDescriptor(p, toStringTag);
69
- assert(desc !== undefined, 'promise lacks toStringTag getter');
70
-
71
- const getter = desc.get;
72
- assert.typeof(getter, 'function', 'toStringTag getter is not a function');
73
- // @ts-expect-error violates the norm that getters have zero parameters
74
- const kref = getter(true);
75
- assert.typeof(kref, 'string');
76
- return kref;
77
- };
78
-
79
- const [makeStandinPromise, getStandinPromiseTag] = (() => {
80
- // Use whatever works
81
- try {
82
- const p = makeStringStandinPromise('string mascot');
83
- assert(passStyleOf(p) === 'promise');
84
- return [makeStringStandinPromise, getStringStandinPromiseTag];
85
- } catch (_1) {
86
- try {
87
- const p = makeAccessorStandinPromise('accessor mascot');
88
- assert(passStyleOf(p) === 'promise');
89
- return [makeAccessorStandinPromise, getAccessorStandinPromiseTag];
90
- } catch (_2) {
91
- throw Error('One of the promise tagging schemes should have worked');
92
- }
93
- }
94
- })();
95
-
96
- /**
97
- * @param {string} kref
98
- * @param {string} [iface]
99
- * @returns {import('@endo/eventual-send').ERef<KCap>}
100
- */
101
- export const kslot = (kref, iface = 'undefined') => {
102
- assert.typeof(kref, 'string');
103
- if (iface && iface.startsWith('Alleged: ')) {
104
- // Encoder prepends "Alleged: " to iface string, but the decoder doesn't strip it
105
- // Unclear whether it's the decoder or me who is wrong
106
- iface = iface.slice(9);
107
- }
108
- if (
109
- kref.startsWith('p') ||
110
- kref.startsWith('kp') ||
111
- kref.startsWith('lp') ||
112
- kref.startsWith('rp')
113
- ) {
114
- return makeStandinPromise(kref);
115
- } else {
116
- const o = Far(iface, {
117
- iface: () => iface,
118
- getKref: () => `${kref}`,
119
- });
120
- return o;
121
- }
122
- };
123
-
124
- /**
125
- * @param {any} obj
126
- * @returns {string}
127
- */
128
- export const krefOf = obj => {
129
- switch (passStyleOf(obj)) {
130
- case 'promise': {
131
- return getStandinPromiseTag(obj);
132
- }
133
- case 'remotable': {
134
- const getKref = obj.getKref;
135
- assert.typeof(getKref, 'function', 'object lacks getKref function');
136
- return getKref();
137
- }
138
- default:
139
- // When krefOf() is called as part of kmarshal.serialize, marshal
140
- // will only give it things that are 'remotable' (Promises and the
141
- // Far objects created by kslot()). When krefOf() is called by
142
- // kernel code (as part of extractSingleSlot() or the vat-comms
143
- // equivalent), it ought to throw if 'obj' is not one of the
144
- // objects created by our kslot().
145
- return Fail`krefOf requires a promise or remotable`;
146
- }
147
- };
148
-
149
- const kmarshal = makeMarshal(krefOf, kslot, {
150
- serializeBodyFormat: 'smallcaps',
151
- errorTagging: 'off',
152
- });
153
-
154
- export const kser = value => kmarshal.serialize(harden(value));
155
-
156
- /**
157
- * @param {import('@endo/marshal').CapData<string>} serializedValue
158
- * @returns {any}
159
- */
160
- export const kunser = serializedValue => kmarshal.unserialize(serializedValue);
161
-
162
- export function makeError(message) {
163
- assert.typeof(message, 'string');
164
- return kser(Error(message));
165
- }