diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 50fa4af159de..33558a16e9a1 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -217,6 +217,9 @@ jobs: - name: yarn test (internal) if: (success() || failure()) run: cd packages/internal && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + - name: yarn test (kmarshal) + if: (success() || failure()) + run: cd packages/kmarshal && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: yarn test (network) if: (success() || failure()) run: cd packages/network && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index a375d8f2ad46..ce15fac215f5 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -29,6 +29,7 @@ "dependencies": { "@agoric/assert": "^0.6.0", "@agoric/internal": "^0.3.2", + "@agoric/kmarshal": "^0.1.0", "@agoric/store": "^0.9.2", "@agoric/swing-store": "^0.9.1", "@agoric/swingset-liveslots": "^0.10.2", diff --git a/packages/SwingSet/src/controller/controller.js b/packages/SwingSet/src/controller/controller.js index 880b0e9bb65c..58661fcab813 100644 --- a/packages/SwingSet/src/controller/controller.js +++ b/packages/SwingSet/src/controller/controller.js @@ -20,7 +20,7 @@ import engineGC from '@agoric/internal/src/lib-nodejs/engine-gc.js'; import { startSubprocessWorker } from '@agoric/internal/src/lib-nodejs/spawnSubprocessWorker.js'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import { makeGcAndFinalize } from '@agoric/internal/src/lib-nodejs/gc-and-finalize.js'; -import { kslot, krefOf } from '../lib/kmarshal.js'; +import { kslot, krefOf } from '@agoric/kmarshal'; import { insistStorageAPI } from '../lib/storageAPI.js'; import { buildKernelBundle, diff --git a/packages/SwingSet/src/controller/initializeKernel.js b/packages/SwingSet/src/controller/initializeKernel.js index 233901e40154..dbf4a74cf10a 100644 --- a/packages/SwingSet/src/controller/initializeKernel.js +++ b/packages/SwingSet/src/controller/initializeKernel.js @@ -3,9 +3,9 @@ import { makeMarshal } from '@endo/marshal'; import { Far } from '@endo/far'; import { assert, Fail } from '@agoric/assert'; +import { kser, kunser } from '@agoric/kmarshal'; import { assertKnownOptions } from '../lib/assertOptions.js'; import { insistVatID } from '../lib/id.js'; -import { kser, kunser } from '../lib/kmarshal.js'; import { makeVatSlot } from '../lib/parseVatSlots.js'; import { insistStorageAPI } from '../lib/storageAPI.js'; import { makeVatOptionRecorder } from '../lib/recordVatOptions.js'; diff --git a/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js b/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js index 5edac1d0a97f..59e9d583852d 100644 --- a/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js +++ b/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js @@ -1,8 +1,8 @@ import { Nat } from '@endo/nat'; import { assert } from '@agoric/assert'; +import { kunser } from '@agoric/kmarshal'; import { buildSerializationTools } from '../lib/deviceTools.js'; import { insistVatID } from '../../lib/id.js'; -import { kunser } from '../../lib/kmarshal.js'; /* diff --git a/packages/SwingSet/src/kernel/kernel.js b/packages/SwingSet/src/kernel/kernel.js index c99e95d0d75c..10df109655bb 100644 --- a/packages/SwingSet/src/kernel/kernel.js +++ b/packages/SwingSet/src/kernel/kernel.js @@ -2,9 +2,9 @@ import { assert, Fail } from '@agoric/assert'; import { isNat } from '@endo/nat'; import { importBundle } from '@endo/import-bundle'; import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; +import { kser, kslot, makeError } from '@agoric/kmarshal'; import { assertKnownOptions } from '../lib/assertOptions.js'; import { foreverPolicy } from '../lib/runPolicies.js'; -import { kser, kslot, makeError } from '../lib/kmarshal.js'; import { makeVatManagerFactory } from './vat-loader/manager-factory.js'; import { makeVatWarehouse } from './vat-warehouse.js'; import makeDeviceManager from './deviceManager.js'; diff --git a/packages/SwingSet/src/kernel/kernelQueue.js b/packages/SwingSet/src/kernel/kernelQueue.js index 471b7cd02936..be025b87b57f 100644 --- a/packages/SwingSet/src/kernel/kernelQueue.js +++ b/packages/SwingSet/src/kernel/kernelQueue.js @@ -1,8 +1,8 @@ +import { kser } from '@agoric/kmarshal'; import { insistKernelType, parseKernelSlot } from './parseKernelSlots.js'; import { insistCapData } from '../lib/capdata.js'; import { insistMessage } from '../lib/message.js'; import { insistVatID } from '../lib/id.js'; -import { kser } from '../lib/kmarshal.js'; /** * @param {object} tools diff --git a/packages/SwingSet/src/kernel/notifyTermination.js b/packages/SwingSet/src/kernel/notifyTermination.js index cde53fc706b8..38e9d67ce479 100644 --- a/packages/SwingSet/src/kernel/notifyTermination.js +++ b/packages/SwingSet/src/kernel/notifyTermination.js @@ -1,5 +1,5 @@ +import { kunser } from '@agoric/kmarshal'; import { insistCapData } from '../lib/capdata.js'; -import { kunser } from '../lib/kmarshal.js'; /** * @param {string} vatID diff --git a/packages/SwingSet/src/kernel/vat-admin-hooks.js b/packages/SwingSet/src/kernel/vat-admin-hooks.js index c441bc80af0e..35045111b0f6 100644 --- a/packages/SwingSet/src/kernel/vat-admin-hooks.js +++ b/packages/SwingSet/src/kernel/vat-admin-hooks.js @@ -1,6 +1,6 @@ import { assert } from '@agoric/assert'; +import { kser, kunser } from '@agoric/kmarshal'; import { insistVatID } from '../lib/id.js'; -import { kser, kunser } from '../lib/kmarshal.js'; export function makeVatAdminHooks(tools) { const { kernelKeeper, terminateVat } = tools; diff --git a/packages/SwingSet/src/lib/capdata.js b/packages/SwingSet/src/lib/capdata.js index f0e76e701d05..bbbfbbbf6217 100644 --- a/packages/SwingSet/src/lib/capdata.js +++ b/packages/SwingSet/src/lib/capdata.js @@ -1,6 +1,6 @@ import { Fail } from '@agoric/assert'; import { passStyleOf } from '@endo/far'; -import { kunser, krefOf } from './kmarshal.js'; +import { kunser, krefOf } from '@agoric/kmarshal'; /* eslint-disable jsdoc/require-returns-check */ /** diff --git a/packages/SwingSet/src/lib/makeUndeliverableError.js b/packages/SwingSet/src/lib/makeUndeliverableError.js index 51521e631915..ce9dcec410df 100644 --- a/packages/SwingSet/src/lib/makeUndeliverableError.js +++ b/packages/SwingSet/src/lib/makeUndeliverableError.js @@ -11,7 +11,7 @@ // "data is not callable" error is kind of unique to the way swingset handles // references, so we create a distinct error message. -import { kunser, kser } from './kmarshal.js'; +import { kunser, kser } from '@agoric/kmarshal'; export function makeUndeliverableError(methargs) { const method = kunser(methargs)[0]; diff --git a/packages/SwingSet/src/vats/comms/controller.js b/packages/SwingSet/src/vats/comms/controller.js index db0b737285f5..e914c742d7bf 100644 --- a/packages/SwingSet/src/vats/comms/controller.js +++ b/packages/SwingSet/src/vats/comms/controller.js @@ -1,6 +1,6 @@ import { Nat } from '@endo/nat'; import { assert, Fail } from '@agoric/assert'; -import { kser, kunser, kslot, krefOf } from '../../lib/kmarshal.js'; +import { kser, kunser, kslot, krefOf } from '@agoric/kmarshal'; // deliverToController() is used for local vats which want to talk to us as a // vat, rather than as a conduit to talk to remote vats. The bootstrap diff --git a/packages/SwingSet/src/vats/comms/delivery.js b/packages/SwingSet/src/vats/comms/delivery.js index 13ec3ffcd958..b8b624e5d2a4 100644 --- a/packages/SwingSet/src/vats/comms/delivery.js +++ b/packages/SwingSet/src/vats/comms/delivery.js @@ -1,12 +1,12 @@ /* eslint-disable no-use-before-define */ import { assert, Fail } from '@agoric/assert'; +import { kser } from '@agoric/kmarshal'; import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js'; import { makeUndeliverableError } from '../../lib/makeUndeliverableError.js'; import { extractSingleSlot, insistCapData } from '../../lib/capdata.js'; import { insistRemoteType } from './parseRemoteSlot.js'; import { insistRemoteID } from './remote.js'; -import { kser } from '../../lib/kmarshal.js'; export function makeDeliveryKit( state, diff --git a/packages/SwingSet/src/vats/comms/dispatch.js b/packages/SwingSet/src/vats/comms/dispatch.js index 9f7e5799170b..5480dabc5cee 100644 --- a/packages/SwingSet/src/vats/comms/dispatch.js +++ b/packages/SwingSet/src/vats/comms/dispatch.js @@ -1,10 +1,10 @@ import { assert, Fail } from '@agoric/assert'; +import { kser, kunser } from '@agoric/kmarshal'; import { makeVatSlot } from '../../lib/parseVatSlots.js'; import { insistMessage } from '../../lib/message.js'; import { makeState } from './state.js'; import { deliverToController } from './controller.js'; import { insistCapData } from '../../lib/capdata.js'; -import { kser, kunser } from '../../lib/kmarshal.js'; import { makeCListKit } from './clist.js'; import { makeDeliveryKit } from './delivery.js'; diff --git a/packages/SwingSet/test/bundling/test-bundles.js b/packages/SwingSet/test/bundling/test-bundles.js index 137ce9b8a0d0..c3c3d85b495f 100644 --- a/packages/SwingSet/test/bundling/test-bundles.js +++ b/packages/SwingSet/test/bundling/test-bundles.js @@ -2,13 +2,12 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import fs from 'fs'; import bundleSource from '@endo/bundle-source'; import { assert } from '@agoric/assert'; +import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; -import { kunser, krefOf } from '../../src/lib/kmarshal.js'; function bfile(name) { return new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/change-parameters/test-change-parameters.js b/packages/SwingSet/test/change-parameters/test-change-parameters.js index 48e22fc24ff5..290cba11ca13 100644 --- a/packages/SwingSet/test/change-parameters/test-change-parameters.js +++ b/packages/SwingSet/test/change-parameters/test-change-parameters.js @@ -2,11 +2,10 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { assert } from '@agoric/assert'; +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; -import { kunser } from '../../src/lib/kmarshal.js'; function bfile(name) { return new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/commsVatDriver.js b/packages/SwingSet/test/commsVatDriver.js index 9eb9a7d4e7fc..8e5ffdadc258 100644 --- a/packages/SwingSet/test/commsVatDriver.js +++ b/packages/SwingSet/test/commsVatDriver.js @@ -1,10 +1,10 @@ // @ts-nocheck import { assert, Fail } from '@agoric/assert'; +import { kslot, kser } from '@agoric/kmarshal'; import buildCommsDispatch from '../src/vats/comms/index.js'; import { debugState } from '../src/vats/comms/dispatch.js'; import { flipRemoteSlot } from '../src/vats/comms/parseRemoteSlot.js'; import { makeMessage, makeResolutions } from './util.js'; -import { kslot, kser } from '../src/lib/kmarshal.js'; // This module provides a power tool for testing the comms vat implementation. // It provides support for injecting events into the comms vat and observing diff --git a/packages/SwingSet/test/definition/test-vat-definition.js b/packages/SwingSet/test/definition/test-vat-definition.js index 0fa550eee2c9..dbd266b2de3b 100644 --- a/packages/SwingSet/test/definition/test-vat-definition.js +++ b/packages/SwingSet/test/definition/test-vat-definition.js @@ -1,7 +1,8 @@ import { test } from '../../tools/prepare-test-env-ava.js'; +// eslint-disable-next-line import/order +import { kser } from '@agoric/kmarshal'; import { buildVatController } from '../../src/index.js'; -import { kser } from '../../src/lib/kmarshal.js'; test('create with setup and buildRootObject', async t => { const config = { diff --git a/packages/SwingSet/test/device-hooks/test-device-hooks.js b/packages/SwingSet/test/device-hooks/test-device-hooks.js index 3c4243e34e61..d2521cf698c4 100644 --- a/packages/SwingSet/test/device-hooks/test-device-hooks.js +++ b/packages/SwingSet/test/device-hooks/test-device-hooks.js @@ -2,8 +2,8 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import bundleSource from '@endo/bundle-source'; +import { kunser, kser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { @@ -11,7 +11,6 @@ import { makeSwingsetController, buildKernelBundles, } from '../../src/index.js'; -import { kunser, kser, kslot } from '../../src/lib/kmarshal.js'; function dfile(name) { return new URL(`./${name}`, import.meta.url).pathname; diff --git a/packages/SwingSet/test/device-mailbox/test-device-mailbox.js b/packages/SwingSet/test/device-mailbox/test-device-mailbox.js index a15f569724af..c7091d638247 100644 --- a/packages/SwingSet/test/device-mailbox/test-device-mailbox.js +++ b/packages/SwingSet/test/device-mailbox/test-device-mailbox.js @@ -1,9 +1,9 @@ // @ts-nocheck // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order -import bundleSource from '@endo/bundle-source'; +import bundleSource from '@endo/bundle-source'; +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, @@ -15,7 +15,6 @@ import { buildMailbox, } from '../../src/devices/mailbox/mailbox.js'; import { bundleOpts } from '../util.js'; -import { kunser } from '../../src/lib/kmarshal.js'; test.before(async t => { const kernelBundles = await buildKernelBundles(); diff --git a/packages/SwingSet/test/devices/bootstrap-1.js b/packages/SwingSet/test/devices/bootstrap-1.js index f0ea62a34406..058b5c6b6f44 100644 --- a/packages/SwingSet/test/devices/bootstrap-1.js +++ b/packages/SwingSet/test/devices/bootstrap-1.js @@ -1,6 +1,6 @@ import { Fail } from '@agoric/assert'; +import { kser, kunser, krefOf } from '@agoric/kmarshal'; import { extractMessage } from '../vat-util.js'; -import { kser, kunser, krefOf } from '../../src/lib/kmarshal.js'; export default function setup(syscall, state, _helpers, vatPowers) { const { testLog } = vatPowers; diff --git a/packages/SwingSet/test/devices/bootstrap-4.js b/packages/SwingSet/test/devices/bootstrap-4.js index ad7150017c70..26111b604318 100644 --- a/packages/SwingSet/test/devices/bootstrap-4.js +++ b/packages/SwingSet/test/devices/bootstrap-4.js @@ -1,6 +1,6 @@ +import { kunser, kser, kslot, krefOf } from '@agoric/kmarshal'; import { insistVatType } from '../../src/lib/parseVatSlots.js'; import { extractMessage } from '../vat-util.js'; -import { kunser, kser, kslot, krefOf } from '../../src/lib/kmarshal.js'; // to exercise the error we get when syscall.callNow() is given a promise // identifier, we must bypass liveslots, which would otherwise protect us diff --git a/packages/SwingSet/test/devices/test-devices.js b/packages/SwingSet/test/devices/test-devices.js index 02bbc3ec2d95..7aa66d590db9 100644 --- a/packages/SwingSet/test/devices/test-devices.js +++ b/packages/SwingSet/test/devices/test-devices.js @@ -3,8 +3,9 @@ import { test } from '../../tools/prepare-test-env-ava.js'; import bundleSource from '@endo/bundle-source'; -import { initSwingStore } from '@agoric/swing-store'; import { parse } from '@endo/marshal'; +import { kser, kslot } from '@agoric/kmarshal'; +import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, @@ -13,7 +14,6 @@ import { } from '../../src/index.js'; import buildCommand from '../../src/devices/command/command.js'; import { bundleOpts, vstr } from '../util.js'; -import { kser, kslot } from '../../src/lib/kmarshal.js'; function dfile(name) { return new URL(`./${name}`, import.meta.url).pathname; diff --git a/packages/SwingSet/test/devices/test-raw-device.js b/packages/SwingSet/test/devices/test-raw-device.js index 9e79e4c3e3e9..75cfa8f649bc 100644 --- a/packages/SwingSet/test/devices/test-raw-device.js +++ b/packages/SwingSet/test/devices/test-raw-device.js @@ -5,7 +5,7 @@ import { test } from '../../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order import bundleSource from '@endo/bundle-source'; import { initSwingStore } from '@agoric/swing-store'; -import { kunser } from '../../src/lib/kmarshal.js'; +import { kunser } from '@agoric/kmarshal'; import { initializeSwingset, diff --git a/packages/SwingSet/test/metering/test-dynamic-vat-metered.js b/packages/SwingSet/test/metering/test-dynamic-vat-metered.js index 3839c5f94c18..e3157b3f19b7 100644 --- a/packages/SwingSet/test/metering/test-dynamic-vat-metered.js +++ b/packages/SwingSet/test/metering/test-dynamic-vat-metered.js @@ -2,12 +2,11 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import bundleSource from '@endo/bundle-source'; +import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildKernelBundles, buildVatController } from '../../src/index.js'; import { restartVatAdminVat } from '../util.js'; -import { kunser, krefOf } from '../../src/lib/kmarshal.js'; import { enumeratePrefixedKeys } from '../../src/kernel/state/storageHelper.js'; async function prepare() { diff --git a/packages/SwingSet/test/metering/test-dynamic-vat-unmetered.js b/packages/SwingSet/test/metering/test-dynamic-vat-unmetered.js index 42e3f96bee41..d4b759ee3853 100644 --- a/packages/SwingSet/test/metering/test-dynamic-vat-unmetered.js +++ b/packages/SwingSet/test/metering/test-dynamic-vat-unmetered.js @@ -1,9 +1,8 @@ -// eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order +import { kunser } from '@agoric/kmarshal'; import { buildVatController } from '../../src/index.js'; -import { kunser } from '../../src/lib/kmarshal.js'; // Dynamic vats are created without metering by default diff --git a/packages/SwingSet/test/run-policy/test-run-policy.js b/packages/SwingSet/test/run-policy/test-run-policy.js index 2a7838ae4324..a76d17785b29 100644 --- a/packages/SwingSet/test/run-policy/test-run-policy.js +++ b/packages/SwingSet/test/run-policy/test-run-policy.js @@ -1,7 +1,8 @@ // @ts-nocheck +// eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order +import { kslot, kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import { @@ -9,7 +10,6 @@ import { computronCounter, wallClockWaiter, } from '../../src/lib/runPolicies.js'; -import { kslot, kser } from '../../src/lib/kmarshal.js'; async function testCranks(t, mode) { /** @type {SwingSetConfig} */ diff --git a/packages/SwingSet/test/test-abandon-export.js b/packages/SwingSet/test/test-abandon-export.js index df9d76eb771f..55d3762e22e7 100644 --- a/packages/SwingSet/test/test-abandon-export.js +++ b/packages/SwingSet/test/test-abandon-export.js @@ -6,7 +6,7 @@ import buildKernel from '../src/kernel/index.js'; import { initializeKernel } from '../src/controller/initializeKernel.js'; import { extractMethod } from '../src/lib/kdebug.js'; import { makeKernelEndowments, buildDispatch } from './util.js'; -import { kser, kunser, kslot } from '../src/lib/kmarshal.js'; +import { kser, kunser, kslot } from '@agoric/kmarshal'; const makeKernel = async () => { const endowments = makeKernelEndowments(); diff --git a/packages/SwingSet/test/test-comms.js b/packages/SwingSet/test/test-comms.js index fc84afcbd17b..2c76f65fb24b 100644 --- a/packages/SwingSet/test/test-comms.js +++ b/packages/SwingSet/test/test-comms.js @@ -1,7 +1,8 @@ // @ts-nocheck -// eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; +// eslint-disable-next-line import/order +import { kser, kslot } from '@agoric/kmarshal'; import buildCommsDispatch from '../src/vats/comms/index.js'; import { flipRemoteSlot } from '../src/vats/comms/parseRemoteSlot.js'; import { makeState } from '../src/vats/comms/state.js'; @@ -15,7 +16,6 @@ import { makeRetireImports, } from './util.js'; import { commsVatDriver } from './commsVatDriver.js'; -import { kser, kslot } from '../src/lib/kmarshal.js'; test('translation', t => { const s = makeState(null); diff --git a/packages/SwingSet/test/test-controller.js b/packages/SwingSet/test/test-controller.js index 818bbceabbd7..e731182d6fcd 100644 --- a/packages/SwingSet/test/test-controller.js +++ b/packages/SwingSet/test/test-controller.js @@ -2,8 +2,8 @@ // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { spawn } from 'child_process'; +import { kser, kunser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildVatController, @@ -12,7 +12,6 @@ import { makeSwingsetController, } from '../src/index.js'; import { checkKT } from './util.js'; -import { kser, kunser, kslot } from '../src/lib/kmarshal.js'; const emptyVP = kser({}); diff --git a/packages/SwingSet/test/test-exomessages.js b/packages/SwingSet/test/test-exomessages.js index 34474873c8e6..594a63d83057 100644 --- a/packages/SwingSet/test/test-exomessages.js +++ b/packages/SwingSet/test/test-exomessages.js @@ -1,7 +1,8 @@ import { test } from '../tools/prepare-test-env-ava.js'; +// eslint-disable-next-line import/order +import { kunser, kslot, krefOf } from '@agoric/kmarshal'; import { buildVatController } from '../src/index.js'; -import { kunser, kslot, krefOf } from '../src/lib/kmarshal.js'; async function beginning(t, mode) { const config = { diff --git a/packages/SwingSet/test/test-gc-kernel.js b/packages/SwingSet/test/test-gc-kernel.js index d841bd85b081..640462f55616 100644 --- a/packages/SwingSet/test/test-gc-kernel.js +++ b/packages/SwingSet/test/test-gc-kernel.js @@ -5,8 +5,8 @@ import anylogger from 'anylogger'; // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { assert } from '@agoric/assert'; +import { kser, kunser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import { parseVatSlot } from '../src/lib/parseVatSlots.js'; @@ -24,7 +24,6 @@ import { makeRetireExports, makeRetireImports, } from './util.js'; -import { kser, kunser, kslot } from '../src/lib/kmarshal.js'; function makeConsole(tag) { const log = anylogger(tag); diff --git a/packages/SwingSet/test/test-kernel.js b/packages/SwingSet/test/test-kernel.js index 5eb45924d943..81e734fd66e4 100644 --- a/packages/SwingSet/test/test-kernel.js +++ b/packages/SwingSet/test/test-kernel.js @@ -2,13 +2,12 @@ // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { Fail } from '@agoric/assert'; +import { kser, kslot } from '@agoric/kmarshal'; import buildKernel from '../src/kernel/index.js'; import { initializeKernel } from '../src/controller/initializeKernel.js'; import { makeVatSlot } from '../src/lib/parseVatSlots.js'; import { checkKT, extractMessage, makeKernelEndowments } from './util.js'; -import { kser, kslot } from '../src/lib/kmarshal.js'; function oneResolution(promiseID, rejected, data) { return [[promiseID, rejected, data]]; diff --git a/packages/SwingSet/test/test-marshal.js b/packages/SwingSet/test/test-marshal.js index 7655cfe9d882..6e1a8d673cae 100644 --- a/packages/SwingSet/test/test-marshal.js +++ b/packages/SwingSet/test/test-marshal.js @@ -4,10 +4,10 @@ import { test } from '../tools/prepare-test-env-ava.js'; import { Far } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; +import { kser, makeError } from '@agoric/kmarshal'; import { makeMarshaller } from '@agoric/swingset-liveslots'; import { makeDummyMeterControl } from '../src/kernel/dummyMeterControl.js'; -import { kser, makeError } from '../src/lib/kmarshal.js'; const gcTools = harden({ WeakRef, diff --git a/packages/SwingSet/test/test-promises.js b/packages/SwingSet/test/test-promises.js index f4effda6b08b..6d6a73712e74 100644 --- a/packages/SwingSet/test/test-promises.js +++ b/packages/SwingSet/test/test-promises.js @@ -2,12 +2,12 @@ import { test } from '../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order +import { kser, kslot, kunser } from '@agoric/kmarshal'; import { buildVatController, loadBasedir, buildKernelBundles, } from '../src/index.js'; -import { kser, kslot, kunser } from '../src/lib/kmarshal.js'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/test-state.js b/packages/SwingSet/test/test-state.js index 40ea95f0749c..690e0647a8f9 100644 --- a/packages/SwingSet/test/test-state.js +++ b/packages/SwingSet/test/test-state.js @@ -2,13 +2,13 @@ /* eslint-disable no-useless-concat */ // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order + import { createHash } from 'crypto'; +import { kser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import makeKernelKeeper from '../src/kernel/state/kernelKeeper.js'; import { makeKernelStats } from '../src/kernel/state/stats.js'; import { KERNEL_STATS_METRICS } from '../src/kernel/metrics.js'; -import { kser, kslot } from '../src/lib/kmarshal.js'; import { enumeratePrefixedKeys, getPrefixedValues, diff --git a/packages/SwingSet/test/test-vpid-kernel.js b/packages/SwingSet/test/test-vpid-kernel.js index d34ccb359e79..b8b03997c8b2 100644 --- a/packages/SwingSet/test/test-vpid-kernel.js +++ b/packages/SwingSet/test/test-vpid-kernel.js @@ -5,12 +5,12 @@ import { test } from '../tools/prepare-test-env-ava.js'; import anylogger from 'anylogger'; import { Fail } from '@agoric/assert'; +import { kser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import buildKernel from '../src/kernel/index.js'; import { initializeKernel } from '../src/controller/initializeKernel.js'; -import { kser, kslot } from '../src/lib/kmarshal.js'; import { buildDispatch } from './util.js'; diff --git a/packages/SwingSet/test/test-xsnap-errors.js b/packages/SwingSet/test/test-xsnap-errors.js index 8b41b23dad15..4eb6e3f404b9 100644 --- a/packages/SwingSet/test/test-xsnap-errors.js +++ b/packages/SwingSet/test/test-xsnap-errors.js @@ -6,6 +6,7 @@ import { spawn } from 'child_process'; import fs from 'fs'; import { tmpName } from 'tmp'; import bundleSource from '@endo/bundle-source'; +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { makeXsSubprocessFactory } from '../src/kernel/vat-loader/manager-subprocess-xsnap.js'; @@ -14,7 +15,6 @@ import { makeXsnapBundleData, } from '../src/controller/bundle-handler.js'; import { makeStartXSnap } from '../src/controller/startXSnap.js'; -import { kser } from '../src/lib/kmarshal.js'; test('child termination distinguished from meter exhaustion', async t => { /** @type { ReturnType } */ diff --git a/packages/SwingSet/test/timer/test-timer.js b/packages/SwingSet/test/timer/test-timer.js index 49f3c2936388..2df4742240a4 100644 --- a/packages/SwingSet/test/timer/test-timer.js +++ b/packages/SwingSet/test/timer/test-timer.js @@ -1,11 +1,10 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import { buildTimer } from '../../src/devices/timer/timer.js'; -import { kunser } from '../../src/lib/kmarshal.js'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/transcript/test-state-sync-reload.js b/packages/SwingSet/test/transcript/test-state-sync-reload.js index 83e9b983e52e..ec6af96d47c3 100644 --- a/packages/SwingSet/test/transcript/test-state-sync-reload.js +++ b/packages/SwingSet/test/transcript/test-state-sync-reload.js @@ -1,7 +1,9 @@ // @ts-nocheck /* eslint @typescript-eslint/no-floating-promises: "warn" */ import test from 'ava'; + import tmp from 'tmp'; +import { kunser } from '@agoric/kmarshal'; import { initSwingStore, makeSwingStoreExporter, @@ -9,7 +11,6 @@ import { } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import { buildKernelBundle } from '../../src/controller/initializeSwingset.js'; -import { kunser } from '../../src/lib/kmarshal.js'; /** * @param {string} [prefix] diff --git a/packages/SwingSet/test/transcript/test-transcript-entries.js b/packages/SwingSet/test/transcript/test-transcript-entries.js index aad87dedb7e4..36b7cded0e27 100644 --- a/packages/SwingSet/test/transcript/test-transcript-entries.js +++ b/packages/SwingSet/test/transcript/test-transcript-entries.js @@ -1,10 +1,11 @@ // @ts-nocheck /* eslint @typescript-eslint/no-floating-promises: "warn" */ import test from 'ava'; + +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import { buildKernelBundle } from '../../src/controller/initializeSwingset.js'; -import { kunser } from '../../src/lib/kmarshal.js'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/upgrade/test-upgrade-replay.js b/packages/SwingSet/test/upgrade/test-upgrade-replay.js index b8ec534896cc..6c02487e8336 100644 --- a/packages/SwingSet/test/upgrade/test-upgrade-replay.js +++ b/packages/SwingSet/test/upgrade/test-upgrade-replay.js @@ -3,6 +3,7 @@ import { test } from '../../tools/prepare-test-env-ava.js'; import { assert } from '@agoric/assert'; +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildKernelBundles, @@ -10,7 +11,6 @@ import { makeSwingsetController, } from '../../src/index.js'; import { bundleOpts } from '../util.js'; -import { kser } from '../../src/lib/kmarshal.js'; function bfile(name) { return new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/upgrade/test-upgrade.js b/packages/SwingSet/test/upgrade/test-upgrade.js index f5641617e600..d30fc45e6761 100644 --- a/packages/SwingSet/test/upgrade/test-upgrade.js +++ b/packages/SwingSet/test/upgrade/test-upgrade.js @@ -2,14 +2,13 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { assert } from '@agoric/assert'; import bundleSource from '@endo/bundle-source'; import { objectMap } from '@agoric/internal'; +import { kser, kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../src/kernel/state/reachable.js'; import { parseVatSlot } from '../../src/lib/parseVatSlots.js'; -import { kser, kunser, krefOf } from '../../src/lib/kmarshal.js'; import { buildKernelBundles, initializeSwingset, diff --git a/packages/SwingSet/test/util.js b/packages/SwingSet/test/util.js index 669ce24252c2..aedaab707b80 100644 --- a/packages/SwingSet/test/util.js +++ b/packages/SwingSet/test/util.js @@ -3,10 +3,10 @@ import anylogger from 'anylogger'; import bundleSource from '@endo/bundle-source'; +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import { extractMessage, ignore, vstr } from './vat-util.js'; -import { kser } from '../src/lib/kmarshal.js'; export { extractMessage, ignore, vstr }; diff --git a/packages/SwingSet/test/vat-admin/terminate/test-terminate-replay.js b/packages/SwingSet/test/vat-admin/terminate/test-terminate-replay.js index 45e4c17c3743..aaa555ed2d5b 100644 --- a/packages/SwingSet/test/vat-admin/terminate/test-terminate-replay.js +++ b/packages/SwingSet/test/vat-admin/terminate/test-terminate-replay.js @@ -1,7 +1,8 @@ // @ts-nocheck // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order + +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { @@ -9,7 +10,6 @@ import { loadSwingsetConfigFile, buildKernelBundles, } from '../../../src/index.js'; -import { kser } from '../../../src/lib/kmarshal.js'; test.before(async t => { const kernelBundles = await buildKernelBundles(); diff --git a/packages/SwingSet/test/vat-admin/terminate/test-terminate.js b/packages/SwingSet/test/vat-admin/terminate/test-terminate.js index c4e194a0c970..750862e084b5 100644 --- a/packages/SwingSet/test/vat-admin/terminate/test-terminate.js +++ b/packages/SwingSet/test/vat-admin/terminate/test-terminate.js @@ -1,7 +1,8 @@ // @ts-nocheck // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order + +import { kser, kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { @@ -9,7 +10,6 @@ import { loadSwingsetConfigFile, buildKernelBundles, } from '../../../src/index.js'; -import { kser, kunser } from '../../../src/lib/kmarshal.js'; import { enumeratePrefixedKeys } from '../../../src/kernel/state/storageHelper.js'; import { restartVatAdminVat } from '../../util.js'; diff --git a/packages/SwingSet/test/vat-admin/test-create-vat.js b/packages/SwingSet/test/vat-admin/test-create-vat.js index c853bd85c92e..a23a686752ed 100644 --- a/packages/SwingSet/test/vat-admin/test-create-vat.js +++ b/packages/SwingSet/test/vat-admin/test-create-vat.js @@ -1,8 +1,9 @@ // @ts-nocheck // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order + import bundleSource from '@endo/bundle-source'; +import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildKernelBundles, @@ -11,7 +12,6 @@ import { loadBasedir, } from '../../src/index.js'; import { bundleOpts, restartVatAdminVat } from '../util.js'; -import { kunser, krefOf } from '../../src/lib/kmarshal.js'; import { extractMethod } from '../../src/lib/kdebug.js'; function nonBundleFunction(_E) { diff --git a/packages/SwingSet/test/vat-admin/test-replay.js b/packages/SwingSet/test/vat-admin/test-replay.js index 6011f7a93632..24cb2dfd24f2 100644 --- a/packages/SwingSet/test/vat-admin/test-replay.js +++ b/packages/SwingSet/test/vat-admin/test-replay.js @@ -1,10 +1,10 @@ // @ts-nocheck // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order + +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildKernelBundles, buildVatController } from '../../src/index.js'; -import { kser } from '../../src/lib/kmarshal.js'; function copy(data) { return JSON.parse(JSON.stringify(data)); diff --git a/packages/SwingSet/test/vat-direct.js b/packages/SwingSet/test/vat-direct.js index 52bfd3c2d4a8..a9121801b92c 100644 --- a/packages/SwingSet/test/vat-direct.js +++ b/packages/SwingSet/test/vat-direct.js @@ -1,6 +1,6 @@ // @ts-nocheck +import { krefOf, kser, kslot, kunser } from '@agoric/kmarshal'; import { extractMessage } from './vat-util.js'; -import { krefOf, kser, kslot, kunser } from '../src/lib/kmarshal.js'; /** * A testing vat that generically exposes kernel interactions diff --git a/packages/SwingSet/test/vat-syscall-failure.js b/packages/SwingSet/test/vat-syscall-failure.js index 861c73e399e1..4c1af219fda0 100644 --- a/packages/SwingSet/test/vat-syscall-failure.js +++ b/packages/SwingSet/test/vat-syscall-failure.js @@ -1,5 +1,5 @@ +import { kser } from '@agoric/kmarshal'; import { extractMessage } from './vat-util.js'; -import { kser } from '../src/lib/kmarshal.js'; export default function setup(syscall, _state, _helpers, vatPowers) { function dispatch(vatDeliverObject) { diff --git a/packages/SwingSet/test/vat-timer-upgrade/test-vat-timer-upgrade.js b/packages/SwingSet/test/vat-timer-upgrade/test-vat-timer-upgrade.js index 60613c555f26..138a203c1615 100644 --- a/packages/SwingSet/test/vat-timer-upgrade/test-vat-timer-upgrade.js +++ b/packages/SwingSet/test/vat-timer-upgrade/test-vat-timer-upgrade.js @@ -1,12 +1,11 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import bundleSource from '@endo/bundle-source'; +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import { buildTimer } from '../../src/devices/timer/timer.js'; -import { kunser } from '../../src/lib/kmarshal.js'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/vat-util.js b/packages/SwingSet/test/vat-util.js index ee55521b73f2..e03fdcf3c971 100644 --- a/packages/SwingSet/test/vat-util.js +++ b/packages/SwingSet/test/vat-util.js @@ -2,7 +2,7 @@ // modules import { assert } from '@agoric/assert'; -import { kser, kunser } from '../src/lib/kmarshal.js'; +import { kser, kunser } from '@agoric/kmarshal'; export function extractMessage(vatDeliverObject) { const [type, ...vdoargs] = vatDeliverObject; diff --git a/packages/SwingSet/test/virtualObjects/collection-slots/test-collection-slots.js b/packages/SwingSet/test/virtualObjects/collection-slots/test-collection-slots.js index d69a960a0793..f0d629a86e7a 100644 --- a/packages/SwingSet/test/virtualObjects/collection-slots/test-collection-slots.js +++ b/packages/SwingSet/test/virtualObjects/collection-slots/test-collection-slots.js @@ -2,8 +2,8 @@ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { assert } from '@agoric/assert'; +import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../../src/kernel/state/reachable.js'; import { @@ -11,8 +11,6 @@ import { makeSwingsetController, } from '../../../src/index.js'; -import { kunser, krefOf } from '../../../src/lib/kmarshal.js'; - function bfile(name) { return new URL(name, import.meta.url).pathname; } diff --git a/packages/SwingSet/test/virtualObjects/delete-stored-vo/test-delete-stored-vo.js b/packages/SwingSet/test/virtualObjects/delete-stored-vo/test-delete-stored-vo.js index 12025568f134..291c664f51bd 100644 --- a/packages/SwingSet/test/virtualObjects/delete-stored-vo/test-delete-stored-vo.js +++ b/packages/SwingSet/test/virtualObjects/delete-stored-vo/test-delete-stored-vo.js @@ -2,15 +2,14 @@ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order import { assert } from '@agoric/assert'; +import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../../src/kernel/state/reachable.js'; import { initializeSwingset, makeSwingsetController, } from '../../../src/index.js'; -import { kunser, krefOf } from '../../../src/lib/kmarshal.js'; function bfile(name) { return new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/virtualObjects/test-facet-retention.js b/packages/SwingSet/test/virtualObjects/test-facet-retention.js index 05d1cc03b4d5..389fb6f12bd3 100644 --- a/packages/SwingSet/test/virtualObjects/test-facet-retention.js +++ b/packages/SwingSet/test/virtualObjects/test-facet-retention.js @@ -1,10 +1,10 @@ // @ts-nocheck import test from 'ava'; + +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { buildVatController } from '../../src/index.js'; -import { kunser } from '../../src/lib/kmarshal.js'; - // Check that facets which don't reference their state still keep their cohort alive // Test what happens when userspace builds recognizers for various VO diff --git a/packages/SwingSet/test/virtualObjects/test-representatives.js b/packages/SwingSet/test/virtualObjects/test-representatives.js index 12e2395fdd30..0a9a8b812c94 100644 --- a/packages/SwingSet/test/virtualObjects/test-representatives.js +++ b/packages/SwingSet/test/virtualObjects/test-representatives.js @@ -2,6 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; +import { kser, kslot } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { initSwingStore } from '@agoric/swing-store'; import { @@ -11,7 +12,6 @@ import { } from '../../src/index.js'; import makeNextLog from '../make-nextlog.js'; -import { kser, kslot } from '../../src/lib/kmarshal.js'; import { enumeratePrefixedKeys } from '../../src/kernel/state/storageHelper.js'; import { vstr } from '../util.js'; diff --git a/packages/SwingSet/test/virtualObjects/test-weakcollections.js b/packages/SwingSet/test/virtualObjects/test-weakcollections.js index 88dcb8a3a61b..d6a401ff9273 100644 --- a/packages/SwingSet/test/virtualObjects/test-weakcollections.js +++ b/packages/SwingSet/test/virtualObjects/test-weakcollections.js @@ -1,11 +1,11 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; +import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import engineGC from '@agoric/internal/src/lib-nodejs/engine-gc.js'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; import makeNextLog from '../make-nextlog.js'; -import { kser } from '../../src/lib/kmarshal.js'; test('weakMap in vat', async t => { const config = { diff --git a/packages/SwingSet/test/virtualObjects/vdata-promises/test-vdata-promises.js b/packages/SwingSet/test/virtualObjects/vdata-promises/test-vdata-promises.js index 6c8676586d52..6d7bf9aa666f 100644 --- a/packages/SwingSet/test/virtualObjects/vdata-promises/test-vdata-promises.js +++ b/packages/SwingSet/test/virtualObjects/vdata-promises/test-vdata-promises.js @@ -1,14 +1,13 @@ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -// eslint-disable-next-line import/order +import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../../src/kernel/state/reachable.js'; import { initializeSwingset, makeSwingsetController, } from '../../../src/index.js'; -import { kunser } from '../../../src/lib/kmarshal.js'; function bfile(name) { return new URL(name, import.meta.url).pathname; diff --git a/packages/SwingSet/test/workers/test-worker.js b/packages/SwingSet/test/workers/test-worker.js index c1750779b127..ec49a67e0ffc 100644 --- a/packages/SwingSet/test/workers/test-worker.js +++ b/packages/SwingSet/test/workers/test-worker.js @@ -1,7 +1,8 @@ import { test } from '../../tools/prepare-test-env-ava.js'; +// eslint-disable-next-line import/order +import { kunser } from '@agoric/kmarshal'; import { loadBasedir, buildVatController } from '../../src/index.js'; -import { kunser } from '../../src/lib/kmarshal.js'; const expected = [ ['B good', 'C good', 'F good', 'three good', 'exit good', 'exitWF good'], diff --git a/packages/agoric-cli/src/sdk-package-names.js b/packages/agoric-cli/src/sdk-package-names.js index a4371b52d2d2..2db4676d928c 100644 --- a/packages/agoric-cli/src/sdk-package-names.js +++ b/packages/agoric-cli/src/sdk-package-names.js @@ -20,6 +20,7 @@ export default [ "@agoric/import-manager", "@agoric/inter-protocol", "@agoric/internal", + "@agoric/kmarshal", "@agoric/network", "@agoric/notifier", "@agoric/pegasus", diff --git a/packages/boot/package.json b/packages/boot/package.json index db0c04e4b794..9dde12c8c9c1 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -42,6 +42,7 @@ "@agoric/deploy-script-support": "^0.10.3", "@agoric/governance": "^0.10.3", "@agoric/inter-protocol": "^0.16.1", + "@agoric/kmarshal": "^0.1.0", "@agoric/store": "^0.9.2", "@agoric/swing-store": "^0.9.1", "@agoric/swingset-liveslots": "^0.10.2", diff --git a/packages/boot/test/bootstrapTests/supports.ts b/packages/boot/test/bootstrapTests/supports.ts index 9d0e0908ae58..fd245138e762 100644 --- a/packages/boot/test/bootstrapTests/supports.ts +++ b/packages/boot/test/bootstrapTests/supports.ts @@ -14,7 +14,7 @@ import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import { initSwingStore } from '@agoric/swing-store'; import { loadSwingsetConfigFile } from '@agoric/swingset-vat'; -import { krefOf, kunser } from '@agoric/swingset-vat/src/lib/kmarshal.js'; +import { krefOf, kunser } from '@agoric/kmarshal'; import { TimeMath, Timestamp } from '@agoric/time'; import { boardSlottingMarshaller, diff --git a/packages/kmarshal/package.json b/packages/kmarshal/package.json new file mode 100644 index 000000000000..493c73f74432 --- /dev/null +++ b/packages/kmarshal/package.json @@ -0,0 +1,43 @@ +{ + "name": "@agoric/kmarshal", + "version": "0.1.0", + "description": "Token-only marshaller for kernel and tests", + "type": "module", + "main": "./src/kmarshal.js", + "exports": { + ".": "./src/kmarshal.js" + }, + "repository": "https://github.com/Agoric/agoric-sdk", + "author": "Agoric", + "license": "Apache-2.0", + "scripts": { + "build": "exit 0", + "test": "ava", + "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", + "test:xs": "exit 0", + "lint-fix": "yarn lint:eslint --fix", + "lint": "run-s --continue-on-error lint:*", + "lint:types": "tsc", + "lint:eslint": "eslint ." + }, + "dependencies": { + "@endo/far": "^0.2.21", + "@endo/marshal": "^0.8.8", + "@agoric/assert": "^0.6.0" + }, + "devDependencies": { + "ava": "^5.3.0" + }, + "publishConfig": { + "access": "public" + }, + "ava": { + "files": [ + "test/**/test-*.js" + ], + "require": [ + "@endo/init/debug.js" + ], + "timeout": "2m" + } +} diff --git a/packages/SwingSet/src/lib/kmarshal.js b/packages/kmarshal/src/kmarshal.js similarity index 100% rename from packages/SwingSet/src/lib/kmarshal.js rename to packages/kmarshal/src/kmarshal.js diff --git a/packages/kmarshal/test/test-basic.js b/packages/kmarshal/test/test-basic.js new file mode 100644 index 000000000000..60ad70c3c8f4 --- /dev/null +++ b/packages/kmarshal/test/test-basic.js @@ -0,0 +1,29 @@ +import test from 'ava'; + +import { kser, kunser, krefOf } from '../src/kmarshal.js'; + +test('sanity check', t => { + const serUndefined = kser(undefined); + t.deepEqual(serUndefined, { + body: '#"#undefined"', + slots: [], + }); + t.is(kunser(serUndefined), undefined); + + const serNumber = kser(47); + t.deepEqual(serNumber, { + body: '#47', + slots: [], + }); + t.is(kunser(serNumber), 47); + + const serString = kser('foo'); + t.deepEqual(serString, { + body: '#"foo"', + slots: [], + }); + t.is(kunser(serString), 'foo'); + + const remotable = kunser({ body: '#"$0"', slots: ['ko47'] }); + t.is(krefOf(remotable), 'ko47'); +}); diff --git a/packages/kmarshal/tsconfig.json b/packages/kmarshal/tsconfig.json new file mode 100644 index 000000000000..282b3f23e362 --- /dev/null +++ b/packages/kmarshal/tsconfig.json @@ -0,0 +1,12 @@ +// This file can contain .js-specific Typescript compiler config. +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "maxNodeModuleJsDepth": 2, + }, + "include": [ + "src/**/*.js", + "test/**/*.js" + ] +} diff --git a/packages/notifier/package.json b/packages/notifier/package.json index 18f917a0a07a..ac9e39936c8c 100644 --- a/packages/notifier/package.json +++ b/packages/notifier/package.json @@ -42,6 +42,7 @@ "@endo/promise-kit": "^0.2.59" }, "devDependencies": { + "@agoric/kmarshal": "^0.1.0", "@agoric/swingset-liveslots": "^0.10.2", "@agoric/swing-store": "^0.9.1", "@agoric/swingset-vat": "^0.32.2", diff --git a/packages/notifier/test/test-publish-kit.js b/packages/notifier/test/test-publish-kit.js index 15eb84a8a9c1..2a7216bedce8 100644 --- a/packages/notifier/test/test-publish-kit.js +++ b/packages/notifier/test/test-publish-kit.js @@ -10,7 +10,7 @@ import { makeSwingsetController, } from '@agoric/swingset-vat'; import { initSwingStore } from '@agoric/swing-store'; -import { kunser } from '@agoric/swingset-vat/src/lib/kmarshal.js'; +import { kunser } from '@agoric/kmarshal'; import { makeScalarBigMapStore } from '@agoric/vat-data/src/vat-data-bindings.js'; import { makePublishKit, diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index 59fddfc92b17..f387571a2128 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -31,7 +31,8 @@ "@endo/promise-kit": "^0.2.59" }, "devDependencies": { - "ava": "^5.3.0" + "ava": "^5.3.0", + "@agoric/kmarshal": "^0.1.0" }, "files": [ "src/**/*.js", diff --git a/packages/swingset-liveslots/test/gc-helpers.js b/packages/swingset-liveslots/test/gc-helpers.js index 8736a587895c..376ac94365b6 100644 --- a/packages/swingset-liveslots/test/gc-helpers.js +++ b/packages/swingset-liveslots/test/gc-helpers.js @@ -2,7 +2,7 @@ import { Far } from '@endo/marshal'; import { M } from '@agoric/store'; -import { kslot, kser } from './kmarshal.js'; +import { kslot, kser } from '@agoric/kmarshal'; import { parseVatSlot } from '../src/parseVatSlots.js'; // These tests follow the model described in diff --git a/packages/swingset-liveslots/test/kmarshal.js b/packages/swingset-liveslots/test/kmarshal.js deleted file mode 100644 index e623b4101609..000000000000 --- a/packages/swingset-liveslots/test/kmarshal.js +++ /dev/null @@ -1,79 +0,0 @@ -import { Far, makeMarshal, passStyleOf } from '@endo/marshal'; -import { assert } from '@agoric/assert'; - -// Simple wrapper for serializing and unserializing marshalled values inside the -// kernel, where we don't actually want to use clists nor actually allocate real -// objects, but instead to stay entirely within the domain of krefs. This is -// used to enable syntactic manipulation of serialized values while remaining -// agnostic about the internal details of the serialization encoding. - -const refMap = new WeakMap(); - -export const kslot = (kref, iface) => { - assert.typeof(kref, 'string'); - if (iface && iface.startsWith('Alleged: ')) { - // Encoder prepends "Alleged: " to iface string, but the decoder doesn't strip it - // Unclear whether it's the decoder or me who is wrong - iface = iface.slice(9); - } - if ( - kref.startsWith('p') || - kref.startsWith('kp') || - kref.startsWith('lp') || - kref.startsWith('rp') - ) { - // TODO: temporary hack because smallcaps encodes promise references - // differently from remotable object references, and the current version of - // the smallcaps decoder annoyingly insists that if the encoded body string - // says a slot is a promise, then convertSlotToVal had better by damn return - // an actual Promise, even if, as in the intended use case here, we neither - // want nor need a promise, nor the overhead of a map to keep track of it - // with. This behavior is in service of defense against a hypothesized - // security issue whose exact nature has largely been forgotton in the - // months since it was first encountered. MarkM is currently researching - // what the problem was thought to have been, to see if it is real and to - // understand it if so. This will eventually result in either changes to - // the smallcaps encoding or to the marshal setup API to support the purely - // manipulative use case. In the meantime, this ugliness... - const p = new Promise(() => undefined); - refMap.set(p, kref); - return harden(p); - } else { - const o = Far(iface, { - iface: () => iface, - getKref: () => `${kref}`, - }); - return o; - } -}; - -export const krefOf = obj => { - const fromMap = refMap.get(obj); - if (fromMap) { - return fromMap; - } - // When krefOf() is called as part of kmarshal.serialize, marshal - // will only give it things that are 'remotable' (Promises and the - // Far objects created by kslot()). When krefOf() is called by - // kernel code (as part of extractSingleSlot() or the vat-comms - // equivalent), it ought to throw if 'obj' is not one of the Far - // objects created by our kslot(). - assert.equal(passStyleOf(obj), 'remotable', obj); - const getKref = obj.getKref; - assert.typeof(getKref, 'function'); - return getKref(); -}; - -const kmarshal = makeMarshal(krefOf, kslot, { - serializeBodyFormat: 'smallcaps', - errorTagging: 'off', -}); - -export const kser = value => kmarshal.serialize(harden(value)); - -export const kunser = serializedValue => kmarshal.unserialize(serializedValue); - -export function makeError(message) { - assert.typeof(message, 'string'); - return kser(Error(message)); -} diff --git a/packages/swingset-liveslots/test/liveslots-helpers.js b/packages/swingset-liveslots/test/liveslots-helpers.js index 1f101af07e64..8926bf72d160 100644 --- a/packages/swingset-liveslots/test/liveslots-helpers.js +++ b/packages/swingset-liveslots/test/liveslots-helpers.js @@ -1,6 +1,7 @@ /* global WeakRef, FinalizationRegistry */ -import engineGC from './engine-gc.js'; +import { kser } from '@agoric/kmarshal'; +import engineGC from './engine-gc.js'; import { waitUntilQuiescent } from './waitUntilQuiescent.js'; import { makeGcAndFinalize } from './gc-and-finalize.js'; import { makeDummyMeterControl } from './dummyMeterControl.js'; @@ -12,7 +13,6 @@ import { makeRetireExports, makeBringOutYourDead, } from './util.js'; -import { kser } from './kmarshal.js'; /** * @param {object} [options] diff --git a/packages/swingset-liveslots/test/storeGC/test-lifecycle.js b/packages/swingset-liveslots/test/storeGC/test-lifecycle.js index 62bee16ccdb7..2f998917b04e 100644 --- a/packages/swingset-liveslots/test/storeGC/test-lifecycle.js +++ b/packages/swingset-liveslots/test/storeGC/test-lifecycle.js @@ -1,12 +1,12 @@ // @ts-nocheck import test from 'ava'; +import { kslot, kunser } from '@agoric/kmarshal'; import { setupTestLiveslots, findSyscallsByType, } from '../liveslots-helpers.js'; import { buildRootObject, mainHeldIdx, mapRef } from '../gc-helpers.js'; -import { kslot, kunser } from '../kmarshal.js'; import { parseVatSlot } from '../../src/parseVatSlots.js'; // These tests follow the model described in diff --git a/packages/swingset-liveslots/test/storeGC/test-refcount-management.js b/packages/swingset-liveslots/test/storeGC/test-refcount-management.js index c5f88d56d61a..65fd4aaa4263 100644 --- a/packages/swingset-liveslots/test/storeGC/test-refcount-management.js +++ b/packages/swingset-liveslots/test/storeGC/test-refcount-management.js @@ -1,5 +1,6 @@ import test from 'ava'; +import { kslot } from '@agoric/kmarshal'; import { findSyscallsByType, setupTestLiveslots, @@ -11,7 +12,6 @@ import { refValString, assertCollectionDeleted, } from '../gc-helpers.js'; -import { kslot } from '../kmarshal.js'; import { vstr } from '../util.js'; // These tests follow the model described in diff --git a/packages/swingset-liveslots/test/storeGC/test-weak-key.js b/packages/swingset-liveslots/test/storeGC/test-weak-key.js index d5001aa50571..a074705240bf 100644 --- a/packages/swingset-liveslots/test/storeGC/test-weak-key.js +++ b/packages/swingset-liveslots/test/storeGC/test-weak-key.js @@ -1,5 +1,6 @@ import test from 'ava'; +import { kslot } from '@agoric/kmarshal'; import { setupTestLiveslots } from '../liveslots-helpers.js'; import { buildRootObject, @@ -7,7 +8,6 @@ import { assertCollectionDeleted, deduceCollectionID, } from '../gc-helpers.js'; -import { kslot } from '../kmarshal.js'; import { vstr } from '../util.js'; // These tests follow the model described in test-virtualObjectGC.js diff --git a/packages/swingset-liveslots/test/test-baggage.js b/packages/swingset-liveslots/test/test-baggage.js index be4b2013514b..a1523b647a41 100644 --- a/packages/swingset-liveslots/test/test-baggage.js +++ b/packages/swingset-liveslots/test/test-baggage.js @@ -1,9 +1,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kunser } from '@agoric/kmarshal'; import { setupTestLiveslots } from './liveslots-helpers.js'; import { vstr } from './util.js'; -import { kunser } from './kmarshal.js'; import { parseVatSlot } from '../src/parseVatSlots.js'; function buildRootObject(vatPowers, vatParameters, baggage) { diff --git a/packages/swingset-liveslots/test/test-collection-schema-refcount.js b/packages/swingset-liveslots/test/test-collection-schema-refcount.js index 7754e119ab94..e563ecf52273 100644 --- a/packages/swingset-liveslots/test/test-collection-schema-refcount.js +++ b/packages/swingset-liveslots/test/test-collection-schema-refcount.js @@ -1,9 +1,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser } from '@agoric/kmarshal'; import { makeLiveSlots } from '../src/liveslots.js'; import { parseVatSlot } from '../src/parseVatSlots.js'; -import { kser } from './kmarshal.js'; import { buildSyscall } from './liveslots-helpers.js'; import { makeStartVat, makeBringOutYourDead } from './util.js'; import { makeMockGC } from './mock-gc.js'; diff --git a/packages/swingset-liveslots/test/test-collection-upgrade.js b/packages/swingset-liveslots/test/test-collection-upgrade.js index e8f1719c7c43..ca3292096595 100644 --- a/packages/swingset-liveslots/test/test-collection-upgrade.js +++ b/packages/swingset-liveslots/test/test-collection-upgrade.js @@ -1,10 +1,10 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { makeLiveSlots } from '../src/liveslots.js'; import { parseVatSlot } from '../src/parseVatSlots.js'; -import { kser } from './kmarshal.js'; import { buildSyscall } from './liveslots-helpers.js'; import { makeStartVat } from './util.js'; import { makeMockGC } from './mock-gc.js'; diff --git a/packages/swingset-liveslots/test/test-dropped-collection-weakrefs.js b/packages/swingset-liveslots/test/test-dropped-collection-weakrefs.js index 466f5476399c..8c197fc79ea3 100644 --- a/packages/swingset-liveslots/test/test-dropped-collection-weakrefs.js +++ b/packages/swingset-liveslots/test/test-dropped-collection-weakrefs.js @@ -1,7 +1,7 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser } from '@agoric/kmarshal'; import { makeLiveSlots } from '../src/liveslots.js'; -import { kser } from './kmarshal.js'; import { buildSyscall } from './liveslots-helpers.js'; import { makeStartVat } from './util.js'; import { makeMockGC } from './mock-gc.js'; diff --git a/packages/swingset-liveslots/test/test-gc-sensitivity.js b/packages/swingset-liveslots/test/test-gc-sensitivity.js index 86215af4d2e2..4952446c9115 100644 --- a/packages/swingset-liveslots/test/test-gc-sensitivity.js +++ b/packages/swingset-liveslots/test/test-gc-sensitivity.js @@ -1,9 +1,9 @@ // @ts-nocheck import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser } from '@agoric/kmarshal'; import { buildSyscall } from './liveslots-helpers.js'; import { makeLiveSlots } from '../src/liveslots.js'; -import { kser } from './kmarshal.js'; import { makeMockGC } from './mock-gc.js'; import { makeMessage, makeStartVat } from './util.js'; diff --git a/packages/swingset-liveslots/test/test-handled-promises.js b/packages/swingset-liveslots/test/test-handled-promises.js index fc14cfae6341..e13c0055cae5 100644 --- a/packages/swingset-liveslots/test/test-handled-promises.js +++ b/packages/swingset-liveslots/test/test-handled-promises.js @@ -7,7 +7,7 @@ import { makePromiseKit } from '@endo/promise-kit'; // Disabled to avoid circular dependencies. // import { makeStoreUtils } from '@agoric/vat-data/src/vat-data-bindings.js'; // import { makeExoUtils } from '@agoric/vat-data/src/exo-utils.js'; -import { kslot, kser } from './kmarshal.js'; +import { kslot, kser } from '@agoric/kmarshal'; import { setupTestLiveslots } from './liveslots-helpers.js'; import { makeResolve, makeReject } from './util.js'; diff --git a/packages/swingset-liveslots/test/test-initial-vrefs.js b/packages/swingset-liveslots/test/test-initial-vrefs.js index 65916a3d06b6..c53262d95ad9 100644 --- a/packages/swingset-liveslots/test/test-initial-vrefs.js +++ b/packages/swingset-liveslots/test/test-initial-vrefs.js @@ -1,9 +1,9 @@ import test from 'ava'; import { Far } from '@endo/far'; +import { kunser } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { setupTestLiveslots } from './liveslots-helpers.js'; -import { kunser } from './kmarshal.js'; function buildRootObject(vatPowers, vatParameters, baggage) { const vd = vatPowers.VatData; diff --git a/packages/swingset-liveslots/test/test-liveslots-mock-gc.js b/packages/swingset-liveslots/test/test-liveslots-mock-gc.js index ad73d7d4dfd0..d7cff5d0967f 100644 --- a/packages/swingset-liveslots/test/test-liveslots-mock-gc.js +++ b/packages/swingset-liveslots/test/test-liveslots-mock-gc.js @@ -2,9 +2,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kslot, kser } from '@agoric/kmarshal'; import { makeLiveSlots } from '../src/liveslots.js'; import { parseVatSlot } from '../src/parseVatSlots.js'; -import { kslot, kser } from './kmarshal.js'; import { buildSyscall } from './liveslots-helpers.js'; import { makeMessage, diff --git a/packages/swingset-liveslots/test/test-liveslots-real-gc.js b/packages/swingset-liveslots/test/test-liveslots-real-gc.js index 0bb1c92389e2..97cbf33ce1d4 100644 --- a/packages/swingset-liveslots/test/test-liveslots-real-gc.js +++ b/packages/swingset-liveslots/test/test-liveslots-real-gc.js @@ -4,9 +4,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; +import { kslot, kser } from '@agoric/kmarshal'; import engineGC from './engine-gc.js'; import { makeGcAndFinalize } from './gc-and-finalize.js'; -import { kslot, kser } from './kmarshal.js'; import { buildSyscall, makeDispatch } from './liveslots-helpers.js'; import { makeMessage, diff --git a/packages/swingset-liveslots/test/test-liveslots.js b/packages/swingset-liveslots/test/test-liveslots.js index 9bcb2fa9ae83..d926212eb862 100644 --- a/packages/swingset-liveslots/test/test-liveslots.js +++ b/packages/swingset-liveslots/test/test-liveslots.js @@ -5,9 +5,9 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; import { Fail } from '@agoric/assert'; +import { kslot, kser, kunser } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { makeLiveSlots, makeMarshaller } from '../src/liveslots.js'; -import { kslot, kser, kunser } from './kmarshal.js'; import { buildSyscall, makeDispatch } from './liveslots-helpers.js'; import { makeMessage, makeStartVat, makeResolve, makeReject } from './util.js'; import { makeMockGC } from './mock-gc.js'; diff --git a/packages/swingset-liveslots/test/test-vpid-liveslots.js b/packages/swingset-liveslots/test/test-vpid-liveslots.js index 2903c6bded58..0079e8c6a72e 100644 --- a/packages/swingset-liveslots/test/test-vpid-liveslots.js +++ b/packages/swingset-liveslots/test/test-vpid-liveslots.js @@ -3,11 +3,11 @@ import test from 'ava'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail } from '@agoric/assert'; import { Far } from '@endo/marshal'; +import { Fail } from '@agoric/assert'; +import { kser, kslot } from '@agoric/kmarshal'; import { buildSyscall, makeDispatch } from './liveslots-helpers.js'; import { makeMessage, makeResolve, makeReject } from './util.js'; -import { kser, kslot } from './kmarshal.js'; function hush(p) { p.then( diff --git a/packages/swingset-liveslots/test/util.js b/packages/swingset-liveslots/test/util.js index 22af120c7ec5..a6f815964cc7 100644 --- a/packages/swingset-liveslots/test/util.js +++ b/packages/swingset-liveslots/test/util.js @@ -1,5 +1,5 @@ +import { kser } from '@agoric/kmarshal'; import { vstr } from './vat-util.js'; -import { kser } from './kmarshal.js'; export { vstr }; diff --git a/packages/swingset-liveslots/test/vat-util.js b/packages/swingset-liveslots/test/vat-util.js index d88a807cd5cc..112205ab790c 100644 --- a/packages/swingset-liveslots/test/vat-util.js +++ b/packages/swingset-liveslots/test/vat-util.js @@ -2,7 +2,7 @@ // modules import { Fail } from '@agoric/assert'; -import { kser, kunser } from './kmarshal.js'; +import { kser, kunser } from '@agoric/kmarshal'; export function extractMessage(vatDeliverObject) { const [type, ...vdoargs] = vatDeliverObject; diff --git a/packages/swingset-liveslots/test/virtual-objects/test-kind-changes.js b/packages/swingset-liveslots/test/virtual-objects/test-kind-changes.js index 82b01ac24f17..7642eb3a43b2 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-kind-changes.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-kind-changes.js @@ -1,10 +1,10 @@ // @ts-nocheck import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser } from '@agoric/kmarshal'; import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js'; import { makeLiveSlots } from '../../src/liveslots.js'; import { parseVatSlot } from '../../src/parseVatSlots.js'; -import { kser } from '../kmarshal.js'; import { buildSyscall } from '../liveslots-helpers.js'; import { makeStartVat, makeMessage } from '../util.js'; import { makeMockGC } from '../mock-gc.js'; diff --git a/packages/swingset-liveslots/test/virtual-objects/test-state-shape.js b/packages/swingset-liveslots/test/virtual-objects/test-state-shape.js index c2891cbda8e4..7c9257ba1f62 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-state-shape.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-state-shape.js @@ -2,9 +2,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { kser, kslot } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { makeLiveSlots } from '../../src/liveslots.js'; -import { kser, kslot } from '../kmarshal.js'; import { buildSyscall } from '../liveslots-helpers.js'; import { makeStartVat, makeMessage } from '../util.js'; import { makeMockGC } from '../mock-gc.js'; diff --git a/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectGC.js b/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectGC.js index 14f9b3ec5927..2adf582af067 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectGC.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectGC.js @@ -2,11 +2,11 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { krefOf, kser, kslot } from '@agoric/kmarshal'; import { setupTestLiveslots, findSyscallsByType, } from '../liveslots-helpers.js'; -import { krefOf, kser, kslot } from '../kmarshal.js'; import { parseVatSlot } from '../../src/parseVatSlots.js'; // Legs: diff --git a/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectManager.js b/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectManager.js index 86519f4fad1c..859d152bf96a 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectManager.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-virtualObjectManager.js @@ -1,12 +1,12 @@ // @ts-nocheck import test from 'ava'; +import { kser, kslot } from '@agoric/kmarshal'; import { makeFakeVirtualObjectManager, makeFakeVirtualStuff, } from '../../tools/fakeVirtualSupport.js'; -import { kser, kslot } from '../kmarshal.js'; import { vstr } from '../util.js'; function initThing(label = 'thing', counter = 0) { diff --git a/packages/swingset-liveslots/test/virtual-objects/test-vo-real-gc.js b/packages/swingset-liveslots/test/virtual-objects/test-vo-real-gc.js index e4eadb938a2d..bf7283a7d20e 100644 --- a/packages/swingset-liveslots/test/virtual-objects/test-vo-real-gc.js +++ b/packages/swingset-liveslots/test/virtual-objects/test-vo-real-gc.js @@ -3,7 +3,7 @@ import test from 'ava'; import { Far } from '@endo/marshal'; -import { kser, kunser } from '../kmarshal.js'; +import { kser, kunser } from '@agoric/kmarshal'; import { setupTestLiveslots } from '../liveslots-helpers.js'; test('virtual object state writes', async t => { diff --git a/packages/swingset-runner/demo/vatFailure/vat-bad.js b/packages/swingset-runner/demo/vatFailure/vat-bad.js index 7ea8c6e058b3..bea73c6da989 100644 --- a/packages/swingset-runner/demo/vatFailure/vat-bad.js +++ b/packages/swingset-runner/demo/vatFailure/vat-bad.js @@ -1,5 +1,5 @@ import { assert } from '@agoric/assert'; -import { kser } from '@agoric/swingset-vat/src/lib/kmarshal.js'; +import { kser } from '@agoric/kmarshal'; export default function setup(syscall, _state, _helpers, _vatPowers) { function deliver(target, method, args) { diff --git a/packages/swingset-runner/package.json b/packages/swingset-runner/package.json index b590c20dde61..4fa77c6c5a86 100644 --- a/packages/swingset-runner/package.json +++ b/packages/swingset-runner/package.json @@ -24,6 +24,7 @@ "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", "@agoric/inter-protocol": "^0.16.1", + "@agoric/kmarshal": "^0.1.0", "@agoric/stat-logger": "^0.4.28", "@agoric/store": "^0.9.2", "@agoric/swing-store": "^0.9.1", diff --git a/packages/zoe/package.json b/packages/zoe/package.json index 407d3ff0e462..a340ab3557d1 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -65,6 +65,7 @@ }, "devDependencies": { "@endo/init": "^0.5.59", + "@agoric/kmarshal": "^0.1.0", "ava": "^5.3.0", "c8": "^7.13.0", "import-meta-resolve": "^2.2.1", diff --git a/packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js b/packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js index 0acd57b2a222..226a2d1450a7 100644 --- a/packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js +++ b/packages/zoe/test/swingsetTests/zoe/test-zoe-upgrade.js @@ -1,7 +1,7 @@ import '@agoric/swingset-liveslots/tools/prepare-test-env.js'; import test from 'ava'; import { buildVatController } from '@agoric/swingset-vat'; -import { kunser } from '@agoric/swingset-vat/src/lib/kmarshal.js'; +import { kunser } from '@agoric/kmarshal'; const bfile = name => new URL(name, import.meta.url).pathname;