From 978a59ee0071f20a295e03139434d9d05e969eac Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 24 Jul 2024 12:06:05 -0400 Subject: [PATCH] change liveslots to provide passStyleOf on a symbol-named property --- packages/swingset-liveslots/src/vatDataTypes.d.ts | 1 - .../swingset-liveslots/test/test-vat-environment.js | 3 ++- packages/swingset-liveslots/tools/setup-vat-data.js | 13 +++++++++---- packages/vat-data/src/vat-data-bindings.js | 1 - 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/swingset-liveslots/src/vatDataTypes.d.ts b/packages/swingset-liveslots/src/vatDataTypes.d.ts index d1731cf0742..c417bef14fc 100644 --- a/packages/swingset-liveslots/src/vatDataTypes.d.ts +++ b/packages/swingset-liveslots/src/vatDataTypes.d.ts @@ -194,7 +194,6 @@ export type VatData = { options?: StoreOptions, ) => WeakSetStore; canBeDurable: (specimen: unknown) => boolean; - passStyleOf: (specimen: unknown) => string; }; // The JSDoc is repeated here and at the function definition so it appears diff --git a/packages/swingset-liveslots/test/test-vat-environment.js b/packages/swingset-liveslots/test/test-vat-environment.js index a6382c54a06..ed1f0caa6cc 100644 --- a/packages/swingset-liveslots/test/test-vat-environment.js +++ b/packages/swingset-liveslots/test/test-vat-environment.js @@ -31,7 +31,8 @@ test('vat globals', async t => { t.is(called, 1); t.truthy(vatGlobals); - // 'harden' is provided by SES (installed by the supervisor), not liveslots + // 'harden' is provided by SES (installed by the lockdown bundle), + // not liveslots t.is(typeof vatGlobals.harden, 'undefined'); // but liveslots provides VatData diff --git a/packages/swingset-liveslots/tools/setup-vat-data.js b/packages/swingset-liveslots/tools/setup-vat-data.js index 58e4e57269b..c3781d904ce 100644 --- a/packages/swingset-liveslots/tools/setup-vat-data.js +++ b/packages/swingset-liveslots/tools/setup-vat-data.js @@ -1,9 +1,13 @@ // @ts-check /* global globalThis */ -// This file produces the globalThis.VatData property outside of a running -// SwingSet so that it can be used by '@agoric/vat-data' (which only *consumes* -// `globalThis.VatData`) in code under test. + +// This file produces the globalThis.VatData property outside of a +// running SwingSet so that it can be used by '@agoric/vat-data' +// (which only *consumes* `globalThis.VatData`) in code under test. It +// also populates the passStyleOf symbol-named property. + import { passStyleOf } from '@endo/pass-style'; +import { PassStyleOfEndowmentSymbol } from '@endo/pass-style/endow.js'; import { makeFakeVirtualStuff } from './fakeVirtualSupport.js'; const { WeakMap, WeakSet } = globalThis; @@ -36,9 +40,10 @@ globalThis.VatData = harden({ fakeVomKit.cm.makeScalarBigSetStore(...args), makeScalarBigWeakSetStore: (...args) => fakeVomKit.cm.makeScalarBigWeakSetStore(...args), - passStyleOf, }); +globalThis[PassStyleOfEndowmentSymbol] = passStyleOf; + export const reincarnate = (options = {}) => { const { fakeStore = new Map(), fakeVomKit: fvk } = options; diff --git a/packages/vat-data/src/vat-data-bindings.js b/packages/vat-data/src/vat-data-bindings.js index 096ee374d2d..d5b214de7c0 100644 --- a/packages/vat-data/src/vat-data-bindings.js +++ b/packages/vat-data/src/vat-data-bindings.js @@ -26,7 +26,6 @@ if ('VatData' in globalThis) { makeScalarBigSetStore: unavailable, makeScalarBigWeakSetStore: unavailable, canBeDurable: unavailable, - passStyleOf: unavailable, // not exported from here in any case }; }