diff --git a/packages/SwingSet/tools/bundleTool.js b/packages/SwingSet/tools/bundleTool.js index 6c5abd14443..6b0e612fc30 100755 --- a/packages/SwingSet/tools/bundleTool.js +++ b/packages/SwingSet/tools/bundleTool.js @@ -1,6 +1,7 @@ import { makeNodeBundleCache as wrappedMaker } from '@endo/bundle-source/cache.js'; import styles from 'ansi-styles'; // less authority than 'chalk' +/** @type {typeof wrappedMaker} */ export const makeNodeBundleCache = async (dest, options, loadModule, pid) => { const log = (...args) => { const flattened = args.map(arg => @@ -16,9 +17,9 @@ export const makeNodeBundleCache = async (dest, options, loadModule, pid) => { }; return wrappedMaker(dest, { log, ...options }, loadModule, pid); }; -/** @typedef {ReturnType} BundleCache */ +/** @typedef {Awaited>} BundleCache */ -/** @type {Map} */ +/** @type {Map>} */ const providedCaches = new Map(); /** @@ -29,10 +30,11 @@ const providedCaches = new Map(); * @param {{ format?: string, dev?: boolean }} options * @param {(id: string) => Promise} loadModule * @param {number} [pid] - * @returns {BundleCache} + * @returns {Promise} */ export const provideBundleCache = (dest, options, loadModule, pid) => { const uniqueDest = [dest, options.format, options.dev].join('-'); + // store the promise instead of awaiting to prevent a race let bundleCache = providedCaches.get(uniqueDest); if (!bundleCache) { bundleCache = makeNodeBundleCache(dest, options, loadModule, pid); @@ -42,5 +44,9 @@ export const provideBundleCache = (dest, options, loadModule, pid) => { }; harden(provideBundleCache); +/** + * @param {string} dest + * @returns {Promise} + */ export const unsafeMakeBundleCache = dest => makeNodeBundleCache(dest, {}, s => import(s)); diff --git a/packages/async-flow/src/replay-membrane.js b/packages/async-flow/src/replay-membrane.js index b37ea0bfed0..44ed86848e7 100644 --- a/packages/async-flow/src/replay-membrane.js +++ b/packages/async-flow/src/replay-membrane.js @@ -285,7 +285,14 @@ export const makeReplayMembrane = ({ try { optVerb ? heapVowE.sendOnly(hostTarget)[optVerb](...hostArgs) - : // @ts-expect-error XXX heapVowE + : // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore once we changed this from E to heapVowE, + // typescript started complaining that heapVowE(hostTarget) + // is not callable. I'm not sure if this is a just a typing bug + // in heapVowE or also reflects a runtime deficiency. But this + // case it not used yet anyway. We disable it + // with at-ts-ignore rather than at-ts-expect-error because + // the dependency-graph tests complains that the latter is unused. heapVowE.sendOnly(hostTarget)(...hostArgs); } catch (hostProblem) { throw Panic`internal: eventual sendOnly synchrously failed ${hostProblem}`; @@ -313,7 +320,14 @@ export const makeReplayMembrane = ({ try { const hostPromise = optVerb ? heapVowE(hostTarget)[optVerb](...hostArgs) - : // @ts-expect-error XXX heapVowE + : // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore once we changed this from E to heapVowE, + // typescript started complaining that heapVowE(hostTarget) + // is not callable. I'm not sure if this is a just a typing bug + // in heapVowE or also reflects a runtime deficiency. But this + // case it not used yet anyway. We disable it + // with at-ts-ignore rather than at-ts-expect-error because + // the dependency-graph tests complains that the latter is unused. heapVowE(hostTarget)(...hostArgs); resolver.resolve(hostPromise); // TODO does this always work? } catch (hostProblem) { diff --git a/packages/zoe/src/instanceRecordStorage.js b/packages/zoe/src/instanceRecordStorage.js index 34faf24500f..2405c4caee3 100644 --- a/packages/zoe/src/instanceRecordStorage.js +++ b/packages/zoe/src/instanceRecordStorage.js @@ -1,5 +1,5 @@ import { q, Fail } from '@endo/errors'; -import { provide, prepareExoClass, M } from '@agoric/vat-data'; +import { prepareExoClass, M } from '@agoric/vat-data'; import { assertKeywordName } from './cleanProposal.js'; import { BrandKeywordRecordShape, @@ -28,8 +28,6 @@ const { ownKeys } = Reflect; * @returns {(ir: InstanceRecord) => InstanceState} */ export const makeInstanceRecordStorage = baggage => { - provide(baggage, 'instanceRecord', () => undefined); - const assertInstantiated = instanceRecord => { instanceRecord !== 'undefined' || Fail`instanceRecord has not been instantiated`; diff --git a/packages/zoe/src/typeGuards.js b/packages/zoe/src/typeGuards.js index 7d2fd0664c3..f2642599293 100644 --- a/packages/zoe/src/typeGuards.js +++ b/packages/zoe/src/typeGuards.js @@ -296,7 +296,6 @@ export const ZoeStorageManagerIKit = harden({ }), startInstanceAccess: M.interface('ZoeStorage startInstance access', { makeZoeInstanceStorageManager: M.call( - M.any(), InstallationShape, M.any(), IssuerPKeywordRecordShape, diff --git a/packages/zoe/src/zoeService/internal-types.js b/packages/zoe/src/zoeService/internal-types.js index eeb1f09281b..eb7badb4ce5 100644 --- a/packages/zoe/src/zoeService/internal-types.js +++ b/packages/zoe/src/zoeService/internal-types.js @@ -99,7 +99,6 @@ * instance-specific terms * * @callback MakeZoeInstanceStorageManager - * @param {import('@agoric/vat-data').Baggage} instanceBaggage * @param {Installation} installation * @param {object} customTerms * @param {IssuerKeywordRecord} uncleanIssuerKeywordRecord diff --git a/packages/zoe/src/zoeService/startInstance.js b/packages/zoe/src/zoeService/startInstance.js index e729c1d9ce2..79d1d8470f9 100644 --- a/packages/zoe/src/zoeService/startInstance.js +++ b/packages/zoe/src/zoeService/startInstance.js @@ -3,7 +3,6 @@ import { E } from '@endo/eventual-send'; import { passStyleOf } from '@endo/marshal'; import { M, - makeScalarBigMapStore, provideDurableWeakMapStore, prepareExoClass, prepareExo, @@ -301,14 +300,9 @@ export const makeStartInstance = ( const instanceHandle = makeInstanceHandle(); - const instanceBaggage = makeScalarBigMapStore('instanceBaggage', { - durable: true, - }); - const zoeInstanceStorageManager = await E( startInstanceAccess, ).makeZoeInstanceStorageManager( - instanceBaggage, installation, customTerms, uncleanIssuerKeywordRecord, diff --git a/packages/zoe/src/zoeService/zoeStorageManager.js b/packages/zoe/src/zoeService/zoeStorageManager.js index ae763e42adc..80d0c2cd5d6 100644 --- a/packages/zoe/src/zoeService/zoeStorageManager.js +++ b/packages/zoe/src/zoeService/zoeStorageManager.js @@ -352,7 +352,6 @@ export const makeZoeStorageManager = ( /** @type {MakeZoeInstanceStorageManager} */ const makeZoeInstanceStorageManager = async ( - instanceBaggage, installation, customTerms, uncleanIssuerKeywordRecord, diff --git a/packages/zoe/tools/setup-zoe.js b/packages/zoe/tools/setup-zoe.js index 6c6a97a1b1c..03dc1de104e 100644 --- a/packages/zoe/tools/setup-zoe.js +++ b/packages/zoe/tools/setup-zoe.js @@ -23,6 +23,7 @@ export const makeZoeForTest = vatAdminSvc => /** * Returns promises for `zoe` and the `feeMintAccess`. + * Provide testing versions of capabilities for Zoe contracts. * * @template {object} [T=unknown] * @param {object} options