@agoric/swingset-vat 0.32.3-upgrade-18-dev-6ddbef0.0 → 0.32.3-upgrade-19-dev-c605745.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.
@@ -97,6 +97,7 @@ export function makeSyscallSimulator(
97
97
  deliveryNum,
98
98
  transcriptEntry,
99
99
  ) {
100
+ const context = `anachrophobia in ${vatID} delivery d${deliveryNum}`;
100
101
  const syscallsExpected = [...transcriptEntry.sc]; // copy
101
102
  const syscallsMade = [];
102
103
  // syscallStatus's length will be max(syscallsExpected,
@@ -107,31 +108,36 @@ export function makeSyscallSimulator(
107
108
  let replayError; // sticky
108
109
 
109
110
  const explain = () => {
110
- console.log(`anachrophobia strikes ${vatID} on delivery ${deliveryNum}`);
111
+ console.log(
112
+ `anachrophobia strikes ${vatID} delivery d${deliveryNum} syscalls`,
113
+ );
111
114
  for (const [idx, status] of syscallStatus.entries()) {
112
115
  const expected = syscallsExpected[idx];
113
116
  const got = syscallsMade[idx];
114
117
  switch (status) {
115
118
  case 'ok': {
116
- console.log(`sc[${idx}]: ok: ${djson.stringify(got)}`);
119
+ console.log(`sc${idx}: ok: ${djson.stringify(got)}`);
117
120
  break;
118
121
  }
119
122
  case 'wrong': {
120
- console.log(`sc[${idx}]: wrong`);
121
- console.log(` expected: ${djson.stringify(expected.s)}`);
122
- console.log(` got : ${djson.stringify(got)}`);
123
+ console.log(
124
+ `
125
+ sc${idx}: WRONG
126
+ expected: ${djson.stringify(expected.s)}
127
+ got : ${djson.stringify(got)}`.trimStart(),
128
+ );
123
129
  break;
124
130
  }
125
131
  case 'extra': {
126
- console.log(`sc[${idx}]: extra: ${djson.stringify(got)}`);
132
+ console.log(`sc${idx}: EXTRA: ${djson.stringify(got)}`);
127
133
  break;
128
134
  }
129
135
  case 'missing': {
130
- console.log(`sc[${idx}]: missing: ${djson.stringify(expected.s)}`);
136
+ console.log(`sc${idx}: MISSING: ${djson.stringify(expected.s)}`);
131
137
  break;
132
138
  }
133
139
  default:
134
- Fail`bad ${status}`;
140
+ Fail`sc${idx}: bad status ${status}`;
135
141
  }
136
142
  }
137
143
  };
@@ -140,16 +146,16 @@ export function makeSyscallSimulator(
140
146
  // slog entries have no kernel-translated kso/ksr
141
147
  const finish = kernelSlog.syscall(vatID, undefined, vso);
142
148
  const expected = syscallsExpected[syscallsMade.length];
143
- syscallsMade.push(vso);
149
+ const idx = syscallsMade.push(vso) - 1;
144
150
  if (!expected) {
145
151
  syscallStatus.push('extra');
146
- const error = Error(`anachrophobia in ${vatID}: extra syscall`);
152
+ const error = Error(`${context}: extra syscall at index sc${idx}`);
147
153
  replayError ||= error;
148
154
  throw error;
149
155
  }
150
156
  if (!syscallsAreIdentical(expected.s, vso)) {
151
157
  syscallStatus.push('wrong');
152
- const error = Error(`anachrophobia in ${vatID}: wrong syscall`);
158
+ const error = Error(`${context}: wrong syscall at index sc${idx}`);
153
159
  replayError ||= error;
154
160
  throw error;
155
161
  }
@@ -159,12 +165,14 @@ export function makeSyscallSimulator(
159
165
  };
160
166
 
161
167
  const finishSimulation = () => {
162
- if (syscallsMade.length < syscallsExpected.length) {
163
- const missing = syscallsExpected.length - syscallsMade.length;
168
+ const missing = syscallsExpected.length - syscallsMade.length;
169
+ if (missing > 0) {
164
170
  for (let i = 0; i < missing; i += 1) {
165
171
  syscallStatus.push('missing');
166
172
  }
167
- const error = Error(`anachrophobia in ${vatID}: missing syscalls`);
173
+ const error = Error(
174
+ `${context}: missing ${missing} syscall(s) at index sc${syscallsMade.length}`,
175
+ );
168
176
  replayError ||= error;
169
177
  }
170
178
 
@@ -389,7 +397,6 @@ export function makeVatWarehouse({
389
397
  // entriesReplayed, // retval of replayTranscript() above
390
398
  // );
391
399
  ephemeral.vats.set(vatID, result);
392
- // eslint-disable-next-line no-use-before-define
393
400
  await applyAvailabilityPolicy(vatID);
394
401
  return result;
395
402
  }
@@ -596,7 +603,6 @@ export function makeVatWarehouse({
596
603
  //
597
604
  /** @type { KernelDeliveryObject } */
598
605
  const kd = harden(['bringOutYourDead']);
599
- // eslint-disable-next-line no-use-before-define
600
606
  const vd = kernelDeliveryToVatDelivery(vatID, kd);
601
607
  const vs = kernelSlog.provideVatSlogger(vatID).vatSlog;
602
608
  await deliverToVat(vatID, kd, vd, vs);
@@ -36,6 +36,7 @@ workerLog(`supervisor started`);
36
36
 
37
37
  function makeNetstringReader({ fd, encoding }) {
38
38
  const input = Buffer.alloc(32 * 1024);
39
+ /** @type {Buffer<ArrayBufferLike>} */
39
40
  let buffered = Buffer.alloc(0);
40
41
  let decoded = [];
41
42
 
@@ -32,16 +32,15 @@ function makeSupervisorDispatch(dispatch) {
32
32
  async function dispatchToVat(delivery) {
33
33
  // the (low-level) vat is responsible for giving up agency, but we still
34
34
  // protect against exceptions
35
- return Promise.resolve(delivery)
36
- .then(dispatch)
37
- .then(
38
- res => harden(['ok', res, null]),
39
- err => {
40
- // TODO react more thoughtfully, maybe terminate the vat
41
- console.warn(`error during vat dispatch() of ${delivery}`, err);
42
- return harden(['error', `${err}`, null]);
43
- },
44
- );
35
+ await null;
36
+ try {
37
+ const res = await dispatch(delivery);
38
+ return harden(['ok', res, null]);
39
+ } catch (err) {
40
+ // TODO react more thoughtfully, maybe terminate the vat
41
+ console.warn(`error during vat dispatch() of ${delivery}`, err);
42
+ return harden(['error', `${err}`, null]);
43
+ }
45
44
  }
46
45
 
47
46
  return harden(dispatchToVat);
package/src/typeGuards.js CHANGED
@@ -10,37 +10,40 @@ export const ManagerType = M.or(
10
10
 
11
11
  const Bundle = M.splitRecord({ moduleType: M.string() });
12
12
 
13
- const SwingsetConfigOptions = harden({
13
+ const VatConfigOptions = harden({
14
14
  creationOptions: M.splitRecord({}, { critical: M.boolean() }),
15
15
  parameters: M.recordOf(M.string(), M.any()),
16
16
  });
17
17
 
18
- const SwingSetConfigProperties = M.or(
19
- M.splitRecord({ sourceSpec: M.string() }, SwingsetConfigOptions),
20
- M.splitRecord({ bundleSpec: M.string() }, SwingsetConfigOptions),
21
- M.splitRecord({ bundle: Bundle }, SwingsetConfigOptions),
22
- );
23
- const SwingSetConfigDescriptor = M.recordOf(
24
- M.string(),
25
- SwingSetConfigProperties,
26
- );
18
+ const makeSwingSetConfigProperties = (required = {}, optional = {}, rest) =>
19
+ M.or(
20
+ M.splitRecord({ sourceSpec: M.string(), ...required }, optional, rest),
21
+ M.splitRecord({ bundleSpec: M.string(), ...required }, optional, rest),
22
+ M.splitRecord({ bundle: Bundle, ...required }, optional, rest),
23
+ );
24
+ const makeSwingSetConfigDescriptor = (required, optional, rest) =>
25
+ M.recordOf(
26
+ M.string(),
27
+ makeSwingSetConfigProperties(required, optional, rest),
28
+ );
27
29
 
28
30
  /**
29
31
  * NOTE: this pattern suffices for PSM bootstrap,
30
32
  * but does not cover the whole SwingSet config syntax.
31
33
  *
32
34
  * {@link ./docs/configuration.md}
33
- * TODO: move this to swingset?
34
35
  *
35
36
  * @see SwingSetConfig
36
37
  * in ./types-external.js
37
38
  */
38
- export const SwingSetConfig = M.and(
39
- M.splitRecord({}, { defaultManagerType: ManagerType }),
40
- M.splitRecord({}, { includeDevDependencies: M.boolean() }),
41
- M.splitRecord({}, { defaultReapInterval: M.number() }), // not in type decl
42
- M.splitRecord({}, { snapshotInterval: M.number() }),
43
- M.splitRecord({}, { vats: SwingSetConfigDescriptor }),
44
- M.splitRecord({}, { bootstrap: M.string() }),
45
- M.splitRecord({}, { bundles: SwingSetConfigDescriptor }),
39
+ export const SwingSetConfig = M.splitRecord(
40
+ { vats: makeSwingSetConfigDescriptor(undefined, VatConfigOptions) },
41
+ {
42
+ defaultManagerType: ManagerType,
43
+ includeDevDependencies: M.boolean(),
44
+ defaultReapInterval: M.number(),
45
+ snapshotInterval: M.number(),
46
+ bootstrap: M.string(),
47
+ bundles: makeSwingSetConfigDescriptor(undefined, undefined, {}),
48
+ },
46
49
  );
@@ -1,10 +1,10 @@
1
- /** @import { ERef } from '@endo/far'; */
2
-
3
1
  export {};
4
2
 
5
3
  /**
6
4
  * @import {Guarded} from '@endo/exo';
5
+ * @import {ERef} from '@endo/far';
7
6
  * @import {Passable, RemotableObject} from '@endo/pass-style';
7
+ * @import {LimitedConsole} from '@agoric/internal/src/js-utils.js';
8
8
  */
9
9
 
10
10
  /* This file defines types that part of the external API of swingset. That
@@ -129,14 +129,6 @@ export {};
129
129
  * @typedef { (dr: VatDeliveryResult) => void } SlogFinishDelivery
130
130
  * @typedef { (ksr: KernelSyscallResult, vsr: VatSyscallResult) => void } SlogFinishSyscall
131
131
  * @typedef { { write: ({}) => void,
132
- * vatConsole: (vatID: string, origConsole: {}) => {},
133
- * delivery: (vatID: string,
134
- * newCrankNum: BigInt, newDeliveryNum: BigInt,
135
- * kd: KernelDeliveryObject, vd: VatDeliveryObject,
136
- * replay?: boolean) => SlogFinishDelivery,
137
- * syscall: (vatID: string,
138
- * ksc: KernelSyscallObject | undefined,
139
- * vsc: VatSyscallObject) => SlogFinishSyscall,
140
132
  * provideVatSlogger: (vatID: string,
141
133
  * dynamic?: boolean,
142
134
  * description?: string,
@@ -144,6 +136,20 @@ export {};
144
136
  * vatSourceBundle?: unknown,
145
137
  * managerType?: string,
146
138
  * vatParameters?: unknown) => { vatSlog: VatSlog },
139
+ * vatConsole: (vatID: string, origConsole: LimitedConsole) => LimitedConsole,
140
+ * startup: (vatID: string) => () => void,
141
+ * delivery: (vatID: string,
142
+ * newCrankNum: BigInt, newDeliveryNum: BigInt,
143
+ * kd: KernelDeliveryObject, vd: VatDeliveryObject,
144
+ * replay?: boolean) => SlogFinishDelivery,
145
+ * syscall: (vatID: string,
146
+ * ksc: KernelSyscallObject | undefined,
147
+ * vsc: VatSyscallObject) => SlogFinishSyscall,
148
+ * changeCList: (vatID: string,
149
+ * crankNum: BigInt,
150
+ * mode: 'import' | 'export' | 'drop',
151
+ * kernelSlot: string,
152
+ * vatSlot: string) => void,
147
153
  * terminateVat: (vatID: string, shouldReject: boolean, info: SwingSetCapData) => void,
148
154
  * } } KernelSlog
149
155
  * @typedef {{
@@ -154,27 +160,25 @@ export {};
154
160
  */
155
161
 
156
162
  /**
163
+ * @typedef {{ bundle: Bundle }} BundleRef a bundle object
164
+ * @typedef {{ bundleName: string }} BundleName a name identifying a property in the `bundles` of a SwingSetOptions object
165
+ * @typedef {{ bundleSpec: string }} BundleSpec a path to a bundle file
166
+ * @typedef {{ sourceSpec: string }} SourceSpec a package specifier such as "@agoric/swingset-vat/tools/vat-puppet.js"
167
+ *
157
168
  * @typedef {{
158
- * sourceSpec: string // path to pre-bundled root
159
- * }} SourceSpec
160
- * @typedef {{
161
- * bundleSpec: string // path to bundled code
162
- * }} BundleSpec
163
- * @typedef {{
164
- * bundle: Bundle
165
- * }} BundleRef
166
- * @typedef {{
167
- * bundleName: string
168
- * }} BundleName
169
- * @typedef {(SourceSpec | BundleSpec | BundleRef | BundleName ) & {
170
169
  * bundleID?: BundleID,
171
- * creationOptions?: Record<string, any>,
170
+ * creationOptions?: StaticVatOptions,
172
171
  * parameters?: Record<string, any>,
173
- * }} SwingSetConfigProperties
172
+ * }} VatConfigOptions
173
+ */
174
+ /**
175
+ * @template [Fields=object]
176
+ * @typedef {(SourceSpec | BundleSpec | BundleName | BundleRef) & Fields} SwingSetConfigProperties
174
177
  */
175
178
 
176
179
  /**
177
- * @typedef {Record<string, SwingSetConfigProperties>} SwingSetConfigDescriptor
180
+ * @template [Fields=object]
181
+ * @typedef {Record<string, SwingSetConfigProperties<Fields>>} SwingSetConfigDescriptor
178
182
  * Where the property name is the name of the vat. Note that
179
183
  * the `bootstrap` property names the vat that should be used as the bootstrap vat. Although a swingset
180
184
  * configuration can designate any vat as its bootstrap vat, `loadBasedir` will always look for a file named
@@ -188,7 +192,7 @@ export {};
188
192
  * `devDependencies` of the surrounding `package.json` should be accessible to
189
193
  * bundles.
190
194
  * @property {string} [bundleCachePath] if present, SwingSet will use a bundle cache at this path
191
- * @property {SwingSetConfigDescriptor} vats
195
+ * @property {SwingSetConfigDescriptor<VatConfigOptions>} vats
192
196
  * @property {SwingSetConfigDescriptor} [bundles]
193
197
  * @property {BundleFormat} [bundleFormat] the bundle source / import bundle
194
198
  * format.
@@ -206,7 +210,7 @@ export {};
206
210
  */
207
211
 
208
212
  /**
209
- * @typedef {{ bundleName: string} | { bundle: Bundle } | { bundleID: BundleID } } SourceOfBundle
213
+ * @typedef {BundleName | BundleRef | {bundleID: BundleID}} SourceOfBundle
210
214
  */
211
215
  /**
212
216
  * @typedef { import('@agoric/swing-store').KVStore } KVStore
@@ -295,12 +299,8 @@ export {};
295
299
  * Vat Creation and Management
296
300
  *
297
301
  * @typedef { string } BundleID
298
- * @typedef {any} BundleCap
302
+ * @typedef { any } BundleCap
299
303
  * @typedef { { moduleFormat: 'endoZipBase64', endoZipBase64: string, endoZipBase64Sha512: string } } EndoZipBase64Bundle
300
- *
301
- * @typedef { unknown } Meter
302
- *
303
- * E(vatAdminService).createVat(bundle, options: DynamicVatOptions)
304
304
  */
305
305
 
306
306
  /**
@@ -326,8 +326,6 @@ export {};
326
326
  * types are then defined as amendments to this base type.
327
327
  *
328
328
  * @typedef { object } BaseVatOptions
329
- * @property { string } name
330
- * @property { * } [vatParameters]
331
329
  * @property { boolean } [enableSetup]
332
330
  * If true, permits the vat to construct itself using the
333
331
  * `setup()` API, which bypasses the imposition of LiveSlots but
@@ -346,6 +344,10 @@ export {};
346
344
  * outbound syscalls so that the vat's internal state can be
347
345
  * reconstructed via replay. If false, no such record is kept.
348
346
  * Defaults to true.
347
+ * @property { ManagerType } [managerType]
348
+ * @property { boolean } [neverReap]
349
+ * If true, disables automatic bringOutYourDead deliveries to a vat.
350
+ * Defaults to false.
349
351
  * @property { number | 'never' } [reapInterval]
350
352
  * Trigger a bringOutYourDead after the vat has received
351
353
  * this many deliveries. If the value is 'never',
@@ -360,7 +362,7 @@ export {};
360
362
  */
361
363
 
362
364
  /**
363
- * @typedef { { meter?: Meter } } OptMeter
365
+ * @typedef { { meter?: unknown } } OptMeter
364
366
  * If a meter is provided, the new dynamic vat is limited to a fixed
365
367
  * amount of computation and allocation that can occur during any
366
368
  * given crank. Peak stack frames are limited as well. In addition,
@@ -370,14 +372,13 @@ export {};
370
372
  * terminated. If undefined, the vat is unmetered. Static vats
371
373
  * cannot be metered.
372
374
  *
373
- * @typedef { { managerType?: ManagerType } } OptManagerType
374
- * @typedef { BaseVatOptions & OptMeter & OptManagerType } DynamicVatOptions
375
+ * @typedef { BaseVatOptions & { name: string, vatParameters?: object } & OptMeter } DynamicVatOptions
375
376
  *
376
377
  * config.vats[name].creationOptions: StaticVatOptions
377
378
  *
378
379
  * @typedef { { enableDisavow?: boolean } } OptEnableDisavow
379
380
  * @typedef { { nodeOptions?: string[] } } OptNodeOptions
380
- * @typedef { BaseVatOptions & OptManagerType & OptEnableDisavow & OptNodeOptions } StaticVatOptions
381
+ * @typedef { BaseVatOptions & OptEnableDisavow & OptNodeOptions } StaticVatOptions
381
382
  *
382
383
  * @typedef { { vatParameters?: object, upgradeMessage?: string } } VatUpgradeOptions
383
384
  * @typedef { { incarnationNumber: number } } VatUpgradeResults
@@ -29,7 +29,6 @@ export {};
29
29
  * @typedef { string } MeterID
30
30
  * @typedef { { meterID?: MeterID } } OptMeterID
31
31
  * @typedef { import('./types-external.js').BaseVatOptions } BaseVatOptions
32
- * @typedef { import('./types-external.js').OptManagerType } OptManagerType
33
32
  * @typedef { import('@agoric/swingset-liveslots').VatDeliveryObject } VatDeliveryObject
34
33
  * @typedef { import('@agoric/swingset-liveslots').VatDeliveryResult } VatDeliveryResult
35
34
  * @typedef { import('@agoric/swingset-liveslots').VatSyscallObject } VatSyscallObject
@@ -38,7 +37,7 @@ export {};
38
37
  *
39
38
  * // used by vatKeeper.setSourceAndOptions(source, RecordedVatOptions)
40
39
  *
41
- * @typedef { BaseVatOptions & OptMeterID & OptManagerType } InternalDynamicVatOptions
40
+ * @typedef { BaseVatOptions & OptMeterID } InternalDynamicVatOptions
42
41
  *
43
42
  * RecordedVatOptions is fully-specified, no optional fields
44
43
  *
@@ -112,7 +111,7 @@ export {};
112
111
  * enableDisavow: boolean,
113
112
  * useTranscript: boolean,
114
113
  * name: string,
115
- * sourcedConsole: Pick<Console, 'debug' | 'log' | 'info' | 'warn' | 'error'>,
114
+ * sourcedConsole: import('@agoric/internal/src/js-utils.js').LimitedConsole,
116
115
  * enableSetup: boolean,
117
116
  * setup?: unknown,
118
117
  * retainSyscall?: boolean
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
1
  import { assert, Fail } from '@endo/errors';
4
2
  import { kser } from '@agoric/kmarshal';
5
3
  import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js';
@@ -150,7 +150,6 @@ export function makeState(syscall) {
150
150
  store.set('r.nextID', '1');
151
151
  store.set('initialized', 'true');
152
152
  if (controller) {
153
- // eslint-disable-next-line no-use-before-define
154
153
  addMetaObject(controller);
155
154
  cdebug(`comms controller is ${controller}`);
156
155
  }
@@ -393,7 +392,6 @@ export function makeState(syscall) {
393
392
  // the object is unreachable
394
393
 
395
394
  const { owner, isReachable, isRecognizable } =
396
- // eslint-disable-next-line no-use-before-define
397
395
  getOwnerAndStatus(lref);
398
396
  if (isReachable) {
399
397
  // but the exporter doesn't realize it yet, so schedule a
@@ -558,7 +556,6 @@ export function makeState(syscall) {
558
556
  isReachable = isReachableByKernel(lref);
559
557
  isRecognizable = !!mapToKernel(lref);
560
558
  } else {
561
- // eslint-disable-next-line no-use-before-define
562
559
  const remote = getRemote(owner);
563
560
  isReachable = remote.isReachable(lref);
564
561
  isRecognizable = !!remote.mapToRemote(lref);
@@ -794,7 +791,6 @@ export function makeState(syscall) {
794
791
  insistPromiseIsUnresolved,
795
792
  markPromiseAsResolved,
796
793
 
797
- // eslint-disable-next-line no-use-before-define
798
794
  getRemote,
799
795
  addRemote,
800
796
  getRemoteIDForName,
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
1
  import { assert } from '@endo/errors';
4
2
  import { Far, E, passStyleOf } from '@endo/far';
5
3
  import { makePromiseKit } from '@endo/promise-kit';
@@ -16,6 +14,8 @@ import { makeScalarWeakMapStore } from '@agoric/store';
16
14
  import { TimeMath } from '@agoric/time';
17
15
 
18
16
  /**
17
+ * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
18
+ * @import {MapStore} from '@agoric/swingset-liveslots';
19
19
  * @import {Passable, RemotableObject} from '@endo/pass-style';
20
20
  * @import {Key} from '@endo/patterns';
21
21
  */
@@ -100,7 +100,6 @@ export function buildRootObject(vatPowers, _vatParameters, baggage) {
100
100
  // getNotifier: ({ state }) => state.notifier, // XXX RESTORE
101
101
  getNotifier: ({ _self }) => Fail`not implemented, see #7234`, // XXX TEMP
102
102
  },
103
- // eslint-disable-next-line no-use-before-define
104
103
  { finish: finishMeter },
105
104
  );
106
105
 
@@ -120,18 +119,15 @@ export function buildRootObject(vatPowers, _vatParameters, baggage) {
120
119
  // getNotifier: ({ state }) => state.notifier, // will never fire // XXX RESTORE
121
120
  getNotifier: ({ _self }) => Fail`not implemented, see #7234`, // XXX TEMP
122
121
  },
123
- // eslint-disable-next-line no-use-before-define
124
122
  { finish: finishMeter },
125
123
  );
126
124
 
127
125
  function finishMeter({ state, self }) {
128
- // eslint-disable-next-line no-use-before-define
129
126
  meterByID.init(
130
127
  state.meterID,
131
128
  // harden({ meter: self, updater: state.updater }), // XXX RESTORE
132
129
  harden({ meter: self }), // XXX TEMP
133
130
  );
134
- // eslint-disable-next-line no-use-before-define
135
131
  meterIDByMeter.set(self, state.meterID);
136
132
  }
137
133
 
@@ -1,8 +1,6 @@
1
1
  import { makeMarshal } from '@endo/marshal';
2
2
  import { Far } from '@endo/far';
3
3
 
4
- /* eslint-disable no-use-before-define */
5
-
6
4
  function fakeSTV(slot, iface = 'Remotable') {
7
5
  return Far(iface, {
8
6
  getSlot: () => slot,
@@ -11,7 +11,6 @@ export function buildRootObject() {
11
11
  async function runTests(phase) {
12
12
  testLog = [];
13
13
  doneP = makePromiseKit();
14
- // eslint-disable-next-line no-use-before-define
15
14
  await E(testVatRoot).runTests(self, phase);
16
15
  await doneP.promise;
17
16
  return testLog;
@@ -1,3 +1,12 @@
1
+ /**
2
+ * @file Source code for a bootstrap vat that runs blockchain behaviors (such as
3
+ * bridge vat integration) and exposes reflective methods for use in testing.
4
+ *
5
+ * TODO: Build from ./vat-puppet.js makeReflectionMethods
6
+ * and share code with packages/vats/tools/vat-reflective-chain-bootstrap.js
7
+ * (which basically extends this for better [mock] blockchain integration).
8
+ */
9
+
1
10
  import { Fail, q } from '@endo/errors';
2
11
  import { objectMap } from '@agoric/internal';
3
12
  import { Far, E } from '@endo/far';
@@ -1,6 +1,10 @@
1
1
  import { makeNodeBundleCache as wrappedMaker } from '@endo/bundle-source/cache.js';
2
2
  import styles from 'ansi-styles'; // less authority than 'chalk'
3
3
 
4
+ /**
5
+ * @import {EReturn} from '@endo/far';
6
+ */
7
+
4
8
  /** @type {typeof wrappedMaker} */
5
9
  export const makeNodeBundleCache = async (dest, options, loadModule, pid) => {
6
10
  const log = (...args) => {
@@ -17,7 +21,7 @@ export const makeNodeBundleCache = async (dest, options, loadModule, pid) => {
17
21
  };
18
22
  return wrappedMaker(dest, { log, ...options }, loadModule, pid);
19
23
  };
20
- /** @typedef {Awaited<ReturnType<typeof makeNodeBundleCache>>} BundleCache */
24
+ /** @typedef {EReturn<typeof makeNodeBundleCache>} BundleCache */
21
25
 
22
26
  /** @type {Map<string, Promise<BundleCache>>} */
23
27
  const providedCaches = new Map();