Skip to content

Commit

Permalink
change liveslots to provide passStyleOf on a symbol-named property
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Jul 24, 2024
1 parent f262d8c commit 978a59e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion packages/swingset-liveslots/src/vatDataTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export type VatData = {
options?: StoreOptions,
) => WeakSetStore<K>;
canBeDurable: (specimen: unknown) => boolean;
passStyleOf: (specimen: unknown) => string;
};

// The JSDoc is repeated here and at the function definition so it appears
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/test/test-vat-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions packages/swingset-liveslots/tools/setup-vat-data.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/vat-data/src/vat-data-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if ('VatData' in globalThis) {
makeScalarBigSetStore: unavailable,
makeScalarBigWeakSetStore: unavailable,
canBeDurable: unavailable,
passStyleOf: unavailable, // not exported from here in any case
};
}

Expand Down

0 comments on commit 978a59e

Please sign in to comment.