From 271d05e1171c7cf5d9310b5240e6e58995c1a4a4 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 20:59:29 -0700 Subject: [PATCH 01/25] fix: endow with original unstructured assert --- packages/SwingSet/src/controller/controller.js | 3 ++- packages/SwingSet/src/kernel/kernel.js | 9 ++++++++- .../SwingSet/src/kernel/vat-loader/manager-local.js | 3 ++- .../subprocess-node/supervisor-subprocess-node.js | 5 +++-- packages/SwingSet/test/zcf-ish-upgrade/pseudo-zcf.js | 10 +++++++--- packages/cosmic-swingset/scripts/clean-core-eval.js | 5 ++++- packages/spawner/src/vat-spawned.js | 3 ++- .../lib/supervisor-subprocess-xsnap.js | 3 ++- packages/vats/src/core/chain-behaviors.js | 3 ++- packages/vats/src/repl.js | 5 ++++- packages/xsnap/src/avaAssertXS.js | 2 ++ packages/zoe/src/contractFacet/evalContractCode.js | 4 ++-- 12 files changed, 40 insertions(+), 15 deletions(-) diff --git a/packages/SwingSet/src/controller/controller.js b/packages/SwingSet/src/controller/controller.js index 404619164f2..32eaa4e40b5 100644 --- a/packages/SwingSet/src/controller/controller.js +++ b/packages/SwingSet/src/controller/controller.js @@ -211,7 +211,8 @@ export async function makeSwingsetController( filePrefix: 'kernel/...', endowments: { console: makeConsole(`${debugPrefix}SwingSet:kernel`), - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, require: kernelRequire, URL: globalThis.Base64, // Unavailable only on XSnap Base64: globalThis.Base64, // Available only on XSnap diff --git a/packages/SwingSet/src/kernel/kernel.js b/packages/SwingSet/src/kernel/kernel.js index ae24c76fb0b..23f0d9ec637 100644 --- a/packages/SwingSet/src/kernel/kernel.js +++ b/packages/SwingSet/src/kernel/kernel.js @@ -1,3 +1,5 @@ +/* global globalThis */ + import { assert, Fail } from '@agoric/assert'; import { isNat } from '@endo/nat'; import { importBundle } from '@endo/import-bundle'; @@ -1644,7 +1646,12 @@ export default function buildKernel( assert(bundle); const NS = await importBundle(bundle, { filePrefix: `dev-${name}/...`, - endowments: harden({ ...vatEndowments, console: devConsole, assert }), + endowments: harden({ + ...vatEndowments, + console: devConsole, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, + }), }); if (deviceEndowments[name] || unendowed) { diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-local.js b/packages/SwingSet/src/kernel/vat-loader/manager-local.js index ca94d76c7a9..46d61def5fb 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-local.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-local.js @@ -74,7 +74,8 @@ export function makeLocalVatManagerFactory({ const workerEndowments = harden({ ...vatEndowments, console: makeVatConsole(makeLogMaker('vat')), - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, TextEncoder, TextDecoder, Base64: globalThis.Base64, // Available only on XSnap diff --git a/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js b/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js index 20e7ff4db23..2ad8c55e485 100644 --- a/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js +++ b/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js @@ -1,4 +1,4 @@ -/* global WeakRef, FinalizationRegistry */ +/* global globalThis, WeakRef, FinalizationRegistry */ // this file is loaded at the start of a new subprocess import '@endo/init'; @@ -139,7 +139,8 @@ function handleSetBundle(margs) { // Enable or disable the console accordingly. const workerEndowments = { console: makeVatConsole(makeLogMaker(`SwingSet:vat:${vatID}`)), - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, }; async function buildVatNamespace(lsEndowments, inescapableGlobalProperties) { diff --git a/packages/SwingSet/test/zcf-ish-upgrade/pseudo-zcf.js b/packages/SwingSet/test/zcf-ish-upgrade/pseudo-zcf.js index b2aac733211..62b69fb4123 100644 --- a/packages/SwingSet/test/zcf-ish-upgrade/pseudo-zcf.js +++ b/packages/SwingSet/test/zcf-ish-upgrade/pseudo-zcf.js @@ -1,11 +1,10 @@ // @ts-nocheck -/* global VatData */ +/* global globalThis, VatData */ /* eslint-disable no-unused-vars */ import { Far } from '@endo/far'; import { importBundle } from '@endo/import-bundle'; import { defineDurableKind } from '@agoric/vat-data'; -import { assert } from '@agoric/assert'; import { provideHandle, provideBaggageSubset as provideBaggageSubTree, @@ -24,7 +23,12 @@ export const buildRootObject = async (vatPowers, vatParameters, baggage) => { const { D } = vatPowers; const { contractBundleCap } = vatParameters; const contractBundle = D(contractBundleCap).getBundle(); - const endowments = { console, assert, VatData }; + const endowments = { + console, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, + VatData, + }; const contractNS = await importBundle(contractBundle, { endowments }); const { setupInstallation, setup: _ } = contractNS; if (!setupInstallation) { diff --git a/packages/cosmic-swingset/scripts/clean-core-eval.js b/packages/cosmic-swingset/scripts/clean-core-eval.js index 58ad55094e0..b182992b3a3 100755 --- a/packages/cosmic-swingset/scripts/clean-core-eval.js +++ b/packages/cosmic-swingset/scripts/clean-core-eval.js @@ -1,4 +1,6 @@ #! /usr/bin/env node +/* global globalThis */ + import '@endo/init/debug.js'; import * as farExports from '@endo/far'; import { isEntrypoint } from '../src/helpers/is-entrypoint.js'; @@ -12,7 +14,8 @@ export const compartmentEvaluate = code => { const globals = harden({ ...modules, ...farExports, - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, console: { // Ensure we don't pollute stdout. debug: console.warn, diff --git a/packages/spawner/src/vat-spawned.js b/packages/spawner/src/vat-spawned.js index fa33bfa3e47..8539abe4386 100644 --- a/packages/spawner/src/vat-spawned.js +++ b/packages/spawner/src/vat-spawned.js @@ -6,7 +6,8 @@ import { Far } from '@endo/marshal'; const endowments = { VatData, console, - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, Base64: globalThis.Base64, // Present only on XSnap URL: globalThis.URL, // Absent only on XSnap }; diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js index 4f279879722..ca81d767176 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js @@ -255,7 +255,8 @@ function makeWorker(port) { const workerEndowments = { console: makeVatConsole(makeLogMaker('vat')), - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, // bootstrap provides HandledPromise HandledPromise: globalThis.HandledPromise, TextEncoder, diff --git a/packages/vats/src/core/chain-behaviors.js b/packages/vats/src/core/chain-behaviors.js index d40e0e48fd5..2cdaafc8489 100644 --- a/packages/vats/src/core/chain-behaviors.js +++ b/packages/vats/src/core/chain-behaviors.js @@ -39,7 +39,8 @@ export const bridgeCoreEval = async allPowers => { const endowments = { VatData: globalThis.VatData, console, - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, Base64: globalThis.Base64, // Present only on XSnap URL: globalThis.URL, // Absent only on XSnap }; diff --git a/packages/vats/src/repl.js b/packages/vats/src/repl.js index 1d00a23ad0d..e0d6fa27673 100644 --- a/packages/vats/src/repl.js +++ b/packages/vats/src/repl.js @@ -1,3 +1,5 @@ +/* global globalThis */ + import { isPromise } from '@endo/promise-kit'; import { Far } from '@endo/far'; import { V as E } from '@agoric/vow/vat.js'; @@ -194,7 +196,8 @@ export function getReplHandler(replObjects, send) { ...farExports, ...vowExports, E, - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, console: replConsole, commands, history, diff --git a/packages/xsnap/src/avaAssertXS.js b/packages/xsnap/src/avaAssertXS.js index 7522d1108ae..cddda9bda2f 100644 --- a/packages/xsnap/src/avaAssertXS.js +++ b/packages/xsnap/src/avaAssertXS.js @@ -228,6 +228,8 @@ function makeTester(htest, out) { fail(message) { assert(false, message); }, + // Not the SES or @endo/errors `assert` + // See https://github.com/Agoric/agoric-sdk/issues/9515 assert, truthy, /** diff --git a/packages/zoe/src/contractFacet/evalContractCode.js b/packages/zoe/src/contractFacet/evalContractCode.js index b357f3d2d00..b95a901056d 100644 --- a/packages/zoe/src/contractFacet/evalContractCode.js +++ b/packages/zoe/src/contractFacet/evalContractCode.js @@ -4,7 +4,6 @@ /* global globalThis */ import { importBundle } from '@endo/import-bundle'; -import { assert } from '@agoric/assert'; import { handlePWarning } from '../handleWarning.js'; const evalContractBundle = (bundle, additionalEndowments = {}) => { @@ -16,7 +15,8 @@ const evalContractBundle = (bundle, additionalEndowments = {}) => { const defaultEndowments = { console: louderConsole, - assert, + // See https://github.com/Agoric/agoric-sdk/issues/9515 + assert: globalThis.assert, VatData: globalThis.VatData, }; From ae692965bbf0a2f7c17ab8b3cc8615547f913c1e Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sat, 15 Jun 2024 14:54:04 -0700 Subject: [PATCH 02/25] fixup! add type comment --- packages/vats/src/core/core-eval-env.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vats/src/core/core-eval-env.d.ts b/packages/vats/src/core/core-eval-env.d.ts index 83b01732d40..a53028d74b5 100644 --- a/packages/vats/src/core/core-eval-env.d.ts +++ b/packages/vats/src/core/core-eval-env.d.ts @@ -29,6 +29,8 @@ declare global { // endowments var VatData: VatData; + // This is correctly the `Assert` type from `'ses'`, not from @endo/errors + // See https://github.com/Agoric/agoric-sdk/issues/9515 var assert: Assert; // console is a VirtualConsole but this directive fails to override the extant global `console` From 00619c68dbf16d78483b92e79cc0a0fc46eab161 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sun, 16 Jun 2024 14:03:11 -0700 Subject: [PATCH 03/25] fixup! moved from #9513 --- packages/xsnap/test/boot-lockdown.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/xsnap/test/boot-lockdown.test.js b/packages/xsnap/test/boot-lockdown.test.js index 189afd7458c..c5ebfc49124 100644 --- a/packages/xsnap/test/boot-lockdown.test.js +++ b/packages/xsnap/test/boot-lockdown.test.js @@ -1,3 +1,5 @@ +/* global globalThis */ + import test from 'ava'; import * as proc from 'child_process'; @@ -173,7 +175,9 @@ test('console - objects should include detail', async t => { Error('oops!'), ]; - const { Fail } = assert; + // Using `globalThis.assert` because of delayed SES lockdown + // See https://github.com/Agoric/agoric-sdk/issues/9515 + const { Fail } = globalThis.assert; try { Fail`assertion text ${richStructure}`; From 63793b3a615701de1b35ce9dbbd7bf23418d5973 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 17:30:33 -0700 Subject: [PATCH 04/25] refactor: use @endo/errors --- CHANGELOG.md | 4 +- multichain-testing/package.json | 2 +- multichain-testing/tools/batchQuery.js | 2 +- multichain-testing/tools/e2e-tools.js | 2 +- multichain-testing/tools/makeHttpClient.js | 2 +- packages/ERTP/package.json | 2 +- packages/ERTP/src/amountMath.js | 3 +- packages/ERTP/src/displayInfo.js | 2 +- packages/ERTP/src/issuerKit.js | 2 +- packages/ERTP/src/legacy-payment-helpers.js | 3 +- .../ERTP/src/mathHelpers/natMathHelpers.js | 3 +- packages/ERTP/src/paymentLedger.js | 5 +- packages/ERTP/src/purse.js | 3 +- .../basicFunctionality/bootstrap.js | 2 +- .../ertpService/ertp-service-upgrade.test.js | 2 +- .../swingsetTests/splitPayments/bootstrap.js | 2 +- packages/ERTP/test/unitTests/mintObj.test.js | 2 +- packages/SwingSet/package.json | 2 +- .../SwingSet/src/controller/controller.js | 2 +- .../src/controller/initializeKernel.js | 2 +- .../src/controller/initializeSwingset.js | 2 +- .../SwingSet/src/controller/startXSnap.js | 2 +- .../src/devices/bridge/device-bridge.js | 2 +- .../SwingSet/src/devices/command/command.js | 2 +- .../src/devices/command/device-command.js | 2 +- .../SwingSet/src/devices/lib/deviceTools.js | 2 +- .../src/devices/loopbox/device-loopbox.js | 2 +- .../SwingSet/src/devices/loopbox/loopbox.js | 2 +- .../src/devices/mailbox/device-mailbox.js | 2 +- .../SwingSet/src/devices/mailbox/mailbox.js | 2 +- .../src/devices/plugin/device-plugin.js | 2 +- .../src/devices/timer/device-timer.js | 2 +- packages/SwingSet/src/devices/timer/timer.js | 2 +- .../src/devices/vat-admin/device-vat-admin.js | 2 +- packages/SwingSet/src/kernel/deviceManager.js | 2 +- packages/SwingSet/src/kernel/deviceSlots.js | 2 +- .../SwingSet/src/kernel/deviceTranslator.js | 2 +- .../SwingSet/src/kernel/dummyMeterControl.js | 2 +- packages/SwingSet/src/kernel/gc-actions.js | 2 +- packages/SwingSet/src/kernel/kernel.js | 2 +- packages/SwingSet/src/kernel/kernelSyscall.js | 2 +- .../SwingSet/src/kernel/parseKernelSlots.js | 2 +- packages/SwingSet/src/kernel/slogger.js | 2 +- .../SwingSet/src/kernel/state/deviceKeeper.js | 2 +- .../SwingSet/src/kernel/state/kernelKeeper.js | 2 +- .../SwingSet/src/kernel/state/reachable.js | 2 +- packages/SwingSet/src/kernel/state/stats.js | 2 +- .../src/kernel/state/storageHelper.js | 2 +- .../SwingSet/src/kernel/state/vatKeeper.js | 2 +- .../SwingSet/src/kernel/vat-admin-hooks.js | 2 +- .../src/kernel/vat-loader/manager-factory.js | 2 +- .../src/kernel/vat-loader/manager-helper.js | 2 +- .../src/kernel/vat-loader/manager-local.js | 2 +- .../vat-loader/manager-subprocess-node.js | 2 +- .../vat-loader/manager-subprocess-xsnap.js | 2 +- .../src/kernel/vat-loader/vat-loader.js | 2 +- packages/SwingSet/src/kernel/vat-warehouse.js | 2 +- packages/SwingSet/src/kernel/vatTranslator.js | 2 +- packages/SwingSet/src/lib/assertOptions.js | 2 +- packages/SwingSet/src/lib/capdata.js | 2 +- packages/SwingSet/src/lib/id.js | 2 +- packages/SwingSet/src/lib/message.js | 2 +- packages/SwingSet/src/lib/parseVatSlots.js | 2 +- packages/SwingSet/src/lib/recordVatOptions.js | 2 +- packages/SwingSet/src/lib/runPolicies.js | 2 +- packages/SwingSet/src/lib/storageAPI.js | 2 +- packages/SwingSet/src/lib/workerOptions.js | 2 +- .../supervisor-subprocess-node.js | 2 +- .../SwingSet/src/vats/comms/clist-inbound.js | 2 +- .../SwingSet/src/vats/comms/clist-kernel.js | 2 +- .../SwingSet/src/vats/comms/clist-outbound.js | 2 +- .../SwingSet/src/vats/comms/controller.js | 2 +- packages/SwingSet/src/vats/comms/delivery.js | 2 +- packages/SwingSet/src/vats/comms/dispatch.js | 2 +- packages/SwingSet/src/vats/comms/gc-comms.js | 2 +- .../src/vats/comms/parseLocalSlots.js | 2 +- .../src/vats/comms/parseRemoteSlot.js | 2 +- packages/SwingSet/src/vats/comms/remote.js | 2 +- packages/SwingSet/src/vats/comms/state.js | 2 +- packages/SwingSet/src/vats/timer/vat-timer.js | 2 +- .../src/vats/vat-admin/vat-vat-admin.js | 2 +- packages/SwingSet/src/vats/vattp/vat-vattp.js | 2 +- .../test/basedir-promises-2/bootstrap.js | 2 +- .../test/basedir-promises/bootstrap.js | 2 +- .../test/basedir-transcript/bootstrap.js | 2 +- .../test/bundling/bootstrap-bundles.js | 2 +- .../SwingSet/test/bundling/bundles.test.js | 2 +- .../change-parameters.test.js | 2 +- packages/SwingSet/test/commsVatDriver.js | 2 +- .../bootstrap-device-mailbox.js | 2 +- .../SwingSet/test/device-plugin/bootstrap.js | 2 +- .../SwingSet/test/device-plugin/vat-bridge.js | 2 +- packages/SwingSet/test/devices/bootstrap-1.js | 2 +- packages/SwingSet/test/devices/bootstrap-3.js | 2 +- .../SwingSet/test/devices/device-raw-0.js | 2 +- .../test/files-vattp/bootstrap-test-vattp.js | 2 +- packages/SwingSet/test/gc-kernel.test.js | 2 +- packages/SwingSet/test/kernel.test.js | 2 +- packages/SwingSet/test/message-patterns.js | 2 +- .../promise-watcher/promise-watcher.test.js | 2 +- .../SwingSet/test/timer-device/bootstrap.js | 2 +- .../upgrade/bootstrap-scripted-upgrade.js | 2 +- .../test/upgrade/upgrade-replay.test.js | 2 +- .../SwingSet/test/upgrade/upgrade.test.js | 2 +- packages/SwingSet/test/upgrade/vat-ulrik-2.js | 2 +- packages/SwingSet/test/vat-util.js | 2 +- .../collection-slots/collection-slots.test.js | 2 +- .../delete-stored-vo/delete-stored-vo.test.js | 2 +- packages/SwingSet/test/vpid-kernel.test.js | 2 +- .../zcf-ish-upgrade/zcf-ish-upgrade.test.js | 2 +- packages/SwingSet/tools/bootstrap-relay.js | 4 +- packages/SwingSet/tools/dvo-test-harness.js | 2 +- packages/SwingSet/tools/manual-timer.js | 2 +- packages/SwingSet/tools/run-utils.js | 2 +- packages/agoric-cli/package.json | 2 +- packages/agoric-cli/src/commands/auction.js | 3 +- packages/agoric-cli/src/commands/oracle.js | 2 +- .../agoric-cli/src/commands/test-upgrade.js | 2 +- packages/agoric-cli/src/deploy.js | 3 +- packages/agoric-cli/src/lib/format.js | 4 +- packages/agoric-cli/src/lib/rpc.js | 2 +- packages/agoric-cli/src/lib/wallet.js | 2 +- packages/agoric-cli/src/main.js | 2 +- packages/agoric-cli/src/open.js | 2 +- packages/agoric-cli/src/publish.js | 56 +- packages/agoric-cli/src/sdk-package-names.js | 1 - packages/agoric-cli/src/set-defaults.js | 2 +- packages/assert/CHANGELOG.md | 492 ------------------ packages/assert/CONTRIBUTING.md | 49 -- packages/assert/NEWS.md | 5 - packages/assert/README.md | 23 - packages/assert/package.json | 56 -- packages/assert/src/assert.js | 88 ---- packages/assert/src/types-ambient.js | 351 ------------- packages/assert/test/assert.test.js | 20 - packages/assert/tsconfig.json | 8 - packages/assert/typedoc.json | 9 - packages/base-zone/package.json | 1 + packages/base-zone/src/make-once.js | 2 +- packages/base-zone/src/prepare-revocable.js | 2 +- packages/base-zone/src/watch-promise.js | 2 +- packages/benchmark/package.json | 2 +- packages/benchmark/src/benchmarkerator.js | 2 +- packages/boot/package.json | 2 +- .../boot/test/bootstrapTests/ibcServerMock.js | 3 +- packages/boot/test/bootstrapTests/lca.test.ts | 2 +- .../test/bootstrapTests/liquidation-1.test.ts | 2 +- .../bootstrapTests/liquidation-2b.test.ts | 2 +- .../liquidation-concurrent-1.test.ts | 2 +- .../liquidation-concurrent-2b.test.ts | 2 +- .../test/bootstrapTests/orchestration.test.ts | 2 +- .../test/bootstrapTests/vats-restart.test.ts | 3 +- .../bootstrapTests/vaults-integration.test.ts | 2 +- .../bootstrapTests/vaults-upgrade.test.ts | 2 +- .../boot/test/bootstrapTests/walletFactory.ts | 3 +- .../boot/test/upgrading/upgrade-vats.test.js | 3 +- packages/boot/tools/authorityViz.js | 4 +- packages/boot/tools/drivers.ts | 2 +- packages/boot/tools/liquidation.ts | 2 +- packages/boot/tools/supports.ts | 2 +- packages/builders/package.json | 2 +- packages/casting/package.json | 1 + packages/casting/src/follower-cosmjs.js | 4 +- packages/casting/src/leader-netconfig.js | 3 +- packages/cosmic-swingset/package.json | 2 +- packages/cosmic-swingset/src/chain-main.js | 2 +- .../cosmic-swingset/src/export-kernel-db.js | 2 +- .../cosmic-swingset/src/export-storage.js | 2 +- .../src/helpers/bufferedStorage.js | 2 +- .../cosmic-swingset/src/helpers/make-queue.js | 2 +- .../cosmic-swingset/src/import-kernel-db.js | 2 +- packages/cosmic-swingset/src/launch-chain.js | 2 +- packages/cosmic-swingset/src/params.js | 2 +- packages/cosmic-swingset/src/sim-chain.js | 2 +- packages/deploy-script-support/package.json | 2 +- .../src/assertOfferResult.js | 2 +- .../src/cachedBundleSpec.js | 2 +- .../src/endo-pieces-contract.js | 2 +- .../src/extract-proposal.js | 3 +- packages/deploy-script-support/src/offer.js | 2 +- .../src/startInstance.js | 2 +- packages/deployment/package.json | 2 +- packages/deployment/src/files.js | 2 +- packages/deployment/src/init.js | 2 +- packages/deployment/src/main.js | 2 +- packages/deployment/src/run.js | 2 +- packages/governance/package.json | 2 +- packages/governance/src/binaryVoteCounter.js | 3 +- .../src/contractGovernance/assertions.js | 2 +- .../src/contractGovernance/governApi.js | 3 +- .../src/contractGovernance/governParam.js | 3 +- .../src/contractGovernance/paramManager.js | 3 +- .../contractGovernance/typedParamManager.js | 3 +- packages/governance/src/contractGovernor.js | 3 +- .../governance/src/contractGovernorKit.js | 2 +- packages/governance/src/contractHelper.js | 3 +- .../src/multiCandidateVoteCounter.js | 3 +- packages/governance/src/validators.js | 2 +- .../committeeBinary/bootstrap.js | 3 +- .../committeeBinary/vat-voter.js | 2 +- .../contractGovernor/bootstrap.js | 3 +- .../contractGovernor/vat-voter.js | 3 +- .../tools/puppetContractGovernor.js | 2 +- packages/inter-protocol/package.json | 2 +- .../inter-protocol/src/auction/auctionBook.js | 2 +- .../inter-protocol/src/auction/auctioneer.js | 2 +- .../src/auction/scheduleMath.js | 4 +- .../inter-protocol/src/auction/scheduler.js | 5 +- .../src/auction/sortedOffers.js | 3 +- packages/inter-protocol/src/clientSupport.js | 2 +- .../inter-protocol/src/contractSupport.js | 2 +- packages/inter-protocol/src/interest.js | 2 +- .../src/price/priceOracleKit.js | 2 +- .../inter-protocol/src/price/roundsManager.js | 2 +- .../src/proposals/addAssetToVault.js | 5 +- .../inter-protocol/src/proposals/startPSM.js | 4 +- .../inter-protocol/src/proposals/utils.js | 2 +- .../inter-protocol/src/provisionPoolKit.js | 2 +- packages/inter-protocol/src/psm/psm.js | 3 +- .../src/reserve/assetReserveKit.js | 4 +- .../inter-protocol/src/vaultFactory/vault.js | 3 +- .../src/vaultFactory/vaultDirector.js | 3 +- .../src/vaultFactory/vaultHolder.js | 2 +- .../src/vaultFactory/vaultManager.js | 7 +- .../test/auction/auctionContract.test.js | 7 +- .../test/auction/scheduleMath.test.js | 2 +- .../test/psm/gov-replace-committee.js | 2 +- packages/inter-protocol/test/psm/psm.test.js | 3 +- .../test/smartWallet/boot-test-utils.js | 3 +- .../smartWallet/oracle-integration.test.js | 3 +- .../test/smartWallet/psm-integration.test.js | 2 +- ...ootstrap-fluxAggregator-service-upgrade.js | 2 +- .../fluxAggregator-service-upgrade.test.js | 2 +- .../psmUpgrade/bootstrap-psm-upgrade.js | 2 +- .../psmUpgrade/psm-upgrade.test.js | 2 +- .../reserve/assetReserve-upgrade.test.js | 2 +- .../reserve/bootstrap-assetReserve-upgrade.js | 2 +- .../test/vaultFactory/driver.js | 3 +- .../test/vaultFactory/vault-interest.test.js | 2 +- .../test/vaultFactory/vault.test.js | 2 +- .../vaultFactory/vaultLiquidation.test.js | 2 +- packages/internal/package.json | 2 +- packages/internal/src/callback.js | 6 +- packages/internal/src/lib-chainStorage.js | 3 +- .../src/lib-nodejs/spawnSubprocessWorker.js | 2 +- packages/internal/src/marshal.js | 3 +- packages/internal/src/netstring.js | 2 +- packages/internal/src/node/createBundles.js | 3 +- packages/internal/src/priority-senders.js | 2 +- packages/internal/src/storage-test-utils.js | 3 +- packages/internal/src/utils.js | 10 +- packages/kmarshal/package.json | 2 +- packages/kmarshal/src/kmarshal.js | 2 +- packages/network/package.json | 2 +- packages/network/src/bytes.js | 2 +- packages/network/src/network.js | 2 +- packages/network/src/router.js | 2 +- packages/notifier/package.json | 2 +- packages/notifier/src/notifier.js | 2 +- packages/notifier/src/publish-kit.js | 2 +- packages/notifier/src/subscribe.js | 5 +- packages/notifier/test/map-unum.js | 2 +- packages/notifier/test/publish-kit.test.js | 2 +- packages/orchestration/package.json | 2 +- .../src/examples/sendAnywhere.contract.js | 2 +- .../orchestration/src/exos/chainAccountKit.js | 4 +- .../src/exos/cosmosOrchestrationAccount.js | 5 +- .../src/exos/icqConnectionKit.js | 4 +- .../src/exos/local-chain-account-kit.js | 5 +- .../src/proposals/orchestration-proposal.js | 2 +- packages/orchestration/src/service.js | 3 +- packages/orchestration/src/utils/address.js | 2 +- packages/orchestration/src/utils/chainHub.js | 7 +- packages/orchestration/src/utils/cosmos.js | 4 +- .../orchestration/test/staking-ops.test.ts | 3 +- packages/pegasus/package.json | 2 +- packages/pegasus/src/courier.js | 2 +- packages/pegasus/src/ibc-trace.js | 2 +- packages/pegasus/src/ics20.js | 4 +- packages/pegasus/src/once-promise-kit.js | 2 +- packages/pegasus/src/pegasus.js | 6 +- packages/smart-wallet/package.json | 2 +- packages/smart-wallet/src/invitations.js | 3 +- packages/smart-wallet/src/marshal-contexts.js | 2 +- .../upgrade-walletFactory-proposal.js | 4 +- packages/smart-wallet/src/smartWallet.js | 3 +- packages/smart-wallet/test/addAsset.test.js | 3 +- packages/smart-wallet/test/devices.js | 2 +- .../smart-wallet/test/gameAssetContract.js | 2 +- .../smart-wallet/test/start-game1-proposal.js | 4 +- packages/smart-wallet/test/supports.js | 2 +- ...bootstrap-walletFactory-service-upgrade.js | 2 +- .../walletFactory-service-upgrade.test.js | 2 +- packages/solo/package.json | 2 +- packages/solo/src/add-chain.js | 2 +- packages/solo/src/chain-cosmos-sdk.js | 6 +- packages/solo/src/init-basedir.js | 2 +- packages/solo/src/main.js | 2 +- packages/solo/src/outbound.js | 2 +- packages/solo/src/pipe-entrypoint.js | 2 +- packages/solo/src/start.js | 2 +- packages/solo/src/vat-http.js | 2 +- packages/spawner/package.json | 2 +- packages/spawner/src/contractHost.js | 2 +- .../swingsetTests/contractHost/bootstrap.js | 2 +- packages/stat-logger/package.json | 3 + packages/stat-logger/src/statGraph.js | 2 +- packages/store/package.json | 1 + packages/store/src/legacy/legacyMap.js | 2 +- packages/store/src/legacy/legacyWeakMap.js | 2 +- packages/store/src/stores/scalarMapStore.js | 3 +- packages/store/src/stores/scalarSetStore.js | 3 +- .../store/src/stores/scalarWeakMapStore.js | 2 +- .../store/src/stores/scalarWeakSetStore.js | 2 +- packages/store/src/stores/store-utils.js | 2 +- packages/swing-store/package.json | 2 +- packages/swing-store/src/bundleStore.js | 2 +- packages/swing-store/src/exporter.js | 2 +- packages/swing-store/src/hasher.js | 2 +- packages/swing-store/src/importer.js | 2 +- packages/swing-store/src/internal.js | 2 +- packages/swing-store/src/kvStore.js | 2 +- packages/swing-store/src/repairMetadata.js | 2 +- packages/swing-store/src/snapStore.js | 2 +- packages/swing-store/src/swingStore.js | 2 +- packages/swing-store/src/transcriptStore.js | 2 +- packages/swingset-liveslots/package.json | 2 +- packages/swingset-liveslots/src/cache.js | 2 +- packages/swingset-liveslots/src/capdata.js | 2 +- .../src/collectionManager.js | 2 +- .../swingset-liveslots/src/facetiousness.js | 2 +- packages/swingset-liveslots/src/liveslots.js | 8 +- packages/swingset-liveslots/src/message.js | 2 +- .../swingset-liveslots/src/parseVatSlots.js | 2 +- .../src/virtualObjectManager.js | 7 +- .../src/virtualReferences.js | 2 +- .../swingset-liveslots/src/watchedPromises.js | 3 +- .../test/dummyMeterControl.js | 2 +- .../test/handled-promises.test.js | 2 +- .../swingset-liveslots/test/liveslots.test.js | 2 +- packages/swingset-liveslots/test/vat-util.js | 2 +- .../test/virtual-objects/rep-tostring.test.js | 3 +- .../test/vpid-liveslots.test.js | 2 +- .../tools/fakeVirtualSupport.js | 4 +- .../demo/vatFailure/vat-bad.js | 2 +- .../demo/vatStore2/bootstrap.js | 2 +- .../demo/vaultPerfTest/vat-benchmark.js | 2 +- .../demo/zoeTests/vat-alice.js | 2 +- .../swingset-runner/demo/zoeTests/vat-bob.js | 2 +- .../demo/zoeTests/vat-carol.js | 2 +- .../swingset-runner/demo/zoeTests/vat-dave.js | 2 +- packages/swingset-runner/package.json | 2 +- packages/swingset-runner/src/auditstore.js | 2 +- packages/swingset-runner/src/chain.js | 2 +- packages/swingset-runner/src/slogulator.js | 2 +- .../swingset-xsnap-supervisor/lib/capdata.js | 2 +- .../lib/supervisor-subprocess-xsnap.js | 2 +- .../swingset-xsnap-supervisor/package.json | 2 +- packages/telemetry/package.json | 2 +- packages/telemetry/src/flight-recorder.js | 3 +- .../telemetry/src/otel-and-flight-recorder.js | 2 +- packages/telemetry/src/slog-to-otel.js | 2 +- packages/time/package.json | 2 +- packages/time/src/timeMath.js | 3 +- packages/vat-data/package.json | 2 +- packages/vat-data/src/vat-data-bindings.js | 2 +- packages/vats/package.json | 2 +- packages/vats/src/bridge-target.js | 13 +- packages/vats/src/bridge.js | 2 +- packages/vats/src/core/basic-behaviors.js | 4 +- packages/vats/src/core/chain-behaviors.js | 2 +- packages/vats/src/core/client-behaviors.js | 3 +- packages/vats/src/core/demoIssuers.js | 3 +- packages/vats/src/core/lib-boot.js | 3 +- packages/vats/src/core/utils.js | 2 +- packages/vats/src/ibc.js | 2 +- packages/vats/src/lib-board.js | 2 +- packages/vats/src/localchain.js | 2 +- packages/vats/src/nameHub.js | 4 +- packages/vats/src/priceAuthorityRegistry.js | 2 +- .../src/proposals/restart-vats-proposal.js | 2 +- packages/vats/src/transfer.js | 3 +- packages/vats/src/vat-bank.js | 3 +- packages/vats/src/vat-bridge.js | 2 +- packages/vats/src/virtual-purse.js | 2 +- packages/vats/test/localchain.test.js | 3 +- packages/vats/tools/boot-test-utils.js | 3 +- packages/vats/tools/fake-bridge.js | 2 +- packages/vow/package.json | 1 + packages/vow/src/E.js | 4 +- packages/vow/src/message-breakpoints.js | 2 +- packages/vow/src/track-turns.js | 10 +- packages/wallet/api/deploy.js | 2 +- packages/wallet/api/package.json | 2 +- .../wallet/api/src/findOrMakeInvitation.js | 2 +- packages/wallet/api/src/issuerTable.js | 2 +- packages/wallet/api/src/lib-dehydrate.js | 2 +- packages/wallet/api/src/lib-wallet.js | 2 +- packages/wallet/api/test/lib-wallet.test.js | 2 +- packages/xsnap/package.json | 2 +- packages/xsnap/src/avaXS.js | 2 +- packages/xsnap/src/xsnap.js | 3 +- packages/zoe/README.md | 2 +- packages/zoe/package.json | 2 +- packages/zoe/src/cleanProposal.js | 2 +- .../zoe/src/contractFacet/allocationMath.js | 2 +- packages/zoe/src/contractFacet/exit.js | 3 +- packages/zoe/src/contractFacet/reallocate.js | 3 +- .../src/contractFacet/rightsConservation.js | 2 +- packages/zoe/src/contractFacet/vatRoot.js | 3 +- packages/zoe/src/contractFacet/zcfMint.js | 3 +- packages/zoe/src/contractFacet/zcfSeat.js | 5 +- packages/zoe/src/contractFacet/zcfZygote.js | 3 +- .../zoe/src/contractSupport/bondingCurves.js | 4 +- .../zoe/src/contractSupport/priceAuthority.js | 2 +- .../priceAuthorityTransform.js | 2 +- .../zoe/src/contractSupport/priceQuote.js | 2 +- packages/zoe/src/contractSupport/ratio.js | 2 +- packages/zoe/src/contractSupport/recorder.js | 2 +- .../zoe/src/contractSupport/stateMachine.js | 2 +- .../zoe/src/contractSupport/zoeHelpers.js | 3 +- .../src/contracts/auction/assertBidSeat.js | 2 +- packages/zoe/src/contracts/auction/index.js | 3 +- packages/zoe/src/contracts/autoswap.js | 2 +- .../contracts/callSpread/calculateShares.js | 2 +- .../contracts/callSpread/pricedCallSpread.js | 3 +- .../zoe/src/contracts/coveredCall-durable.js | 3 +- packages/zoe/src/contracts/coveredCall.js | 3 +- packages/zoe/src/contracts/loan/borrow.js | 2 +- packages/zoe/src/contracts/loan/close.js | 2 +- packages/zoe/src/contracts/loan/updateDebt.js | 6 +- packages/zoe/src/contracts/mintAndSellNFT.js | 2 +- packages/zoe/src/contracts/oracle.js | 2 +- packages/zoe/src/contracts/otcDesk.js | 2 +- packages/zoe/src/contracts/priceAggregator.js | 2 +- packages/zoe/src/contracts/sellItems.js | 3 +- packages/zoe/src/instanceRecordStorage.js | 3 +- packages/zoe/src/issuerRecord.js | 2 +- packages/zoe/src/issuerStorage.js | 3 +- packages/zoe/src/makeHandle.js | 4 +- packages/zoe/src/zoeService/createZCFVat.js | 2 +- packages/zoe/src/zoeService/escrowStorage.js | 2 +- packages/zoe/src/zoeService/feeMint.js | 3 +- .../zoe/src/zoeService/installationStorage.js | 4 +- .../src/zoeService/instanceAdminStorage.js | 3 +- .../zoe/src/zoeService/invitationQueries.js | 6 +- packages/zoe/src/zoeService/makeInvitation.js | 2 +- .../src/zoeService/offer/burnInvitation.js | 8 +- packages/zoe/src/zoeService/offer/offer.js | 2 +- .../zoe/src/zoeService/originalZoeSeat.js | 2 +- packages/zoe/src/zoeService/startInstance.js | 3 +- packages/zoe/src/zoeService/zoe.js | 3 +- packages/zoe/src/zoeService/zoeSeat.js | 2 +- .../brokenContracts/vat-alice.js | 2 +- .../bootstrap-coveredCall-service-upgrade.js | 3 +- .../coveredCall-durable-V3.js | 3 +- .../coveredCall-service-upgrade.test.js | 2 +- .../zoe/test/swingsetTests/zoe/vat-alice.js | 2 +- .../zoe/test/swingsetTests/zoe/vat-bob.js | 2 +- .../zoe/test/swingsetTests/zoe/vat-carol.js | 2 +- .../zoe/test/swingsetTests/zoe/vat-dave.js | 2 +- packages/zoe/test/unitTests/bounty.js | 2 +- .../test/unitTests/contracts/escrowToVote.js | 3 +- .../test/unitTests/contracts/oracle.test.js | 2 +- .../unitTests/contracts/sellTickets.test.js | 2 +- .../test/unitTests/contracts/useObjExample.js | 3 +- .../test/unitTests/fakePriceAuthority.test.js | 2 +- packages/zoe/test/unitTests/makeOffer.js | 2 +- .../zoe/test/unitTests/scriptedOracle.test.js | 2 +- .../zoe/test/unitTests/zcf/setupZcfTest.js | 2 +- packages/zoe/test/zoeTestHelpers.js | 2 +- packages/zoe/tools/fakePriceAuthority.js | 2 +- packages/zoe/tools/fakeVatAdmin.js | 2 +- packages/zoe/tools/manualTimer.js | 2 +- packages/zone/package.json | 1 + packages/zone/src/durable.js | 2 +- 476 files changed, 553 insertions(+), 1746 deletions(-) delete mode 100644 packages/assert/CHANGELOG.md delete mode 100644 packages/assert/CONTRIBUTING.md delete mode 100644 packages/assert/NEWS.md delete mode 100644 packages/assert/README.md delete mode 100755 packages/assert/package.json delete mode 100644 packages/assert/src/assert.js delete mode 100644 packages/assert/src/types-ambient.js delete mode 100644 packages/assert/test/assert.test.js delete mode 100644 packages/assert/tsconfig.json delete mode 100644 packages/assert/typedoc.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 68752e15373..94bed780555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -912,7 +912,7 @@ See https://github.com/Agoric/agoric-sdk/issues/3672 for the issue to fix the ro ### ⚠ BREAKING CHANGES * **tame-metering:** Converts `@agoric/tame-metering` from emulated ESM with `node -r esm` to Node.js ESM proper. -* **assert:** Converts `@agoric/assert` from emulated ESM with `node -r esm` to Node.js ESM proper. +* **assert:** Converts `@endo/errors` from emulated ESM with `node -r esm` to Node.js ESM proper. * **zoe:** new reallocate API to assist with reviewing conservation of rights (#3184) * **swing-store-simple:** This includes a renaming and refactoring of the constructors to acknowledge that the different SwingStore constructors are not polymorphic. @@ -1539,7 +1539,7 @@ otherwise. * review comments ([7db7e5c](https://github.com/Agoric/agoric-sdk/commit/7db7e5c4c569dfedff8d748dd58893218b0a2458)) * run ag-setup-cosmos under SES ([13c8efe](https://github.com/Agoric/agoric-sdk/commit/13c8efe6cf9ebc8c6a71b9098410c1af4162b570)) * take advantage of `/.../` being stripped from stack traces ([7acacc0](https://github.com/Agoric/agoric-sdk/commit/7acacc0d6ac06c37065ce984cc9147c945c572e5)) -* update '@agoric/assert' types ([3ce7587](https://github.com/Agoric/agoric-sdk/commit/3ce7587d0ba6d7a0f5c51a0cacbdc414eb02891b)) +* update '@endo/errors' types ([3ce7587](https://github.com/Agoric/agoric-sdk/commit/3ce7587d0ba6d7a0f5c51a0cacbdc414eb02891b)) * update dibc for v0.41.0 ([d990c14](https://github.com/Agoric/agoric-sdk/commit/d990c145ddcef3b090c63879a96a1942bc4ae69c)) * upgrade to patched cosmos-sdk v0.41.0 ([807320f](https://github.com/Agoric/agoric-sdk/commit/807320f5e16dafc8a1486eaf082bb54e994da577)) * use assert rather than FooError constructors ([f860c5b](https://github.com/Agoric/agoric-sdk/commit/f860c5bf5add165a08cb5bd543502857c3f57998)) diff --git a/multichain-testing/package.json b/multichain-testing/package.json index 56f41459839..4c031c1a489 100644 --- a/multichain-testing/package.json +++ b/multichain-testing/package.json @@ -17,7 +17,7 @@ }, "packageManager": "yarn@4.1.1", "devDependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cosmic-proto": "0.4.1-dev-08f8549.0", "@cosmjs/crypto": "^0.32.2", "@cosmjs/proto-signing": "^0.32.2", diff --git a/multichain-testing/tools/batchQuery.js b/multichain-testing/tools/batchQuery.js index 085e9e632fd..64c1d1855b5 100644 --- a/multichain-testing/tools/batchQuery.js +++ b/multichain-testing/tools/batchQuery.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { E } from '@endo/far'; /** @typedef {'children' | 'data'} AgoricChainStoragePathKind */ diff --git a/multichain-testing/tools/e2e-tools.js b/multichain-testing/tools/e2e-tools.js index fd5b70f4a9d..3d5b7417c41 100644 --- a/multichain-testing/tools/e2e-tools.js +++ b/multichain-testing/tools/e2e-tools.js @@ -1,5 +1,5 @@ /** global harden */ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { E, Far } from '@endo/far'; import { Nat } from '@endo/nat'; import { makePromiseKit } from '@endo/promise-kit'; diff --git a/multichain-testing/tools/makeHttpClient.js b/multichain-testing/tools/makeHttpClient.js index 4261cb2672b..e422f3f3c38 100644 --- a/multichain-testing/tools/makeHttpClient.js +++ b/multichain-testing/tools/makeHttpClient.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Far } from '@endo/far'; const { freeze } = Object; diff --git a/packages/ERTP/package.json b/packages/ERTP/package.json index 76bc34e84e4..7b1da460cbd 100644 --- a/packages/ERTP/package.json +++ b/packages/ERTP/package.json @@ -39,7 +39,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/notifier": "^0.6.2", "@agoric/store": "^0.9.2", "@agoric/vat-data": "^0.5.2", diff --git a/packages/ERTP/src/amountMath.js b/packages/ERTP/src/amountMath.js index a6e362ba045..8c586f45dcb 100644 --- a/packages/ERTP/src/amountMath.js +++ b/packages/ERTP/src/amountMath.js @@ -1,6 +1,7 @@ import { passStyleOf, assertRemotable, assertRecord } from '@endo/marshal'; import { M, matches } from '@agoric/store'; +import { q, Fail } from '@endo/errors'; import { natMathHelpers } from './mathHelpers/natMathHelpers.js'; import { setMathHelpers } from './mathHelpers/setMathHelpers.js'; import { copySetMathHelpers } from './mathHelpers/copySetMathHelpers.js'; @@ -11,8 +12,6 @@ import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.js'; * @import {Amount, AssetKind, AmountValue, AssetKindForValue, AssetValueForKind, Brand, CopyBagAmount, CopySetAmount, MathHelpers, NatAmount, NatValue, SetAmount, SetValue} from './types.js'; */ -const { quote: q, Fail } = assert; - /** * Constants for the kinds of assets we support. * diff --git a/packages/ERTP/src/displayInfo.js b/packages/ERTP/src/displayInfo.js index 3af7093f5f6..ab197558f15 100644 --- a/packages/ERTP/src/displayInfo.js +++ b/packages/ERTP/src/displayInfo.js @@ -1,6 +1,6 @@ // @jessie-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { mustMatch } from '@agoric/store'; import { DisplayInfoShape } from './typeGuards.js'; diff --git a/packages/ERTP/src/issuerKit.js b/packages/ERTP/src/issuerKit.js index 939d65b14df..479eff192f2 100644 --- a/packages/ERTP/src/issuerKit.js +++ b/packages/ERTP/src/issuerKit.js @@ -1,6 +1,6 @@ // @jessie-check -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { assertPattern } from '@agoric/store'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { makeDurableZone } from '@agoric/zone/durable.js'; diff --git a/packages/ERTP/src/legacy-payment-helpers.js b/packages/ERTP/src/legacy-payment-helpers.js index 55ca90f1c44..a800eb3f091 100644 --- a/packages/ERTP/src/legacy-payment-helpers.js +++ b/packages/ERTP/src/legacy-payment-helpers.js @@ -2,6 +2,7 @@ import { mustMatch } from '@agoric/store'; import { E } from '@endo/far'; +import { Fail } from '@endo/errors'; import { AmountMath } from './amountMath.js'; /** @@ -9,8 +10,6 @@ import { AmountMath } from './amountMath.js'; * @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js' */ -const { Fail } = assert; - /** * @file This file contains safer helper function alternatives to the similarly * named methods on issuer. These are parameterized by a purse used for diff --git a/packages/ERTP/src/mathHelpers/natMathHelpers.js b/packages/ERTP/src/mathHelpers/natMathHelpers.js index b15bc14b5d0..b549c4143f8 100644 --- a/packages/ERTP/src/mathHelpers/natMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/natMathHelpers.js @@ -4,7 +4,8 @@ import { Nat, isNat } from '@endo/nat'; /** @import {MathHelpers, NatValue} from '../types.js' */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; + const empty = 0n; /** diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js index 681ddd2eb20..7c17bb201e1 100644 --- a/packages/ERTP/src/paymentLedger.js +++ b/packages/ERTP/src/paymentLedger.js @@ -5,6 +5,7 @@ /* eslint-disable no-use-before-define */ import { isPromise } from '@endo/promise-kit'; import { mustMatch, M, keyEQ } from '@agoric/store'; +import { X, q, Fail } from '@endo/errors'; import { AmountMath } from './amountMath.js'; import { preparePaymentKind } from './payment.js'; import { preparePurseKind } from './purse.js'; @@ -17,8 +18,6 @@ import { BrandI, makeIssuerInterfaces } from './typeGuards.js'; * @import {Key} from '@endo/patterns'; */ -const { details: X, quote: q, Fail } = assert; - /** * @param {Brand} brand * @param {AssetKind} assetKind @@ -133,7 +132,7 @@ export const preparePaymentLedger = ( try { optShutdownWithFailure(reason); } catch (errInShutdown) { - assert.note(errInShutdown, X`Caused by: ${reason}`); + annotateError(errInShutdown, X`Caused by: ${reason}`); throw errInShutdown; } } diff --git a/packages/ERTP/src/purse.js b/packages/ERTP/src/purse.js index cc4f073f668..e67dcb10b9c 100644 --- a/packages/ERTP/src/purse.js +++ b/packages/ERTP/src/purse.js @@ -1,12 +1,11 @@ import { M, makeCopySet } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { AmountMath } from './amountMath.js'; import { makeTransientNotifierKit } from './transientNotifier.js'; import { makeAmountStore } from './amountStore.js'; /** @import {Amount, AssetKind, AmountValue, AssetKindForValue, RecoverySetsOption, Brand, Payment} from './types.js' */ -const { Fail } = assert; - const EMPTY_COPY_SET = makeCopySet([]); // TODO Type InterfaceGuard better than InterfaceGuard diff --git a/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js b/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js index 7fc825aff33..eee1378397a 100644 --- a/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js +++ b/packages/ERTP/test/swingsetTests/basicFunctionality/bootstrap.js @@ -1,5 +1,5 @@ import { E } from '@endo/eventual-send'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { Far } from '@endo/marshal'; import { makeIssuerKit, AmountMath } from '../../../src/index.js'; diff --git a/packages/ERTP/test/swingsetTests/ertpService/ertp-service-upgrade.test.js b/packages/ERTP/test/swingsetTests/ertpService/ertp-service-upgrade.test.js index a686df41deb..186c0d3fb2a 100644 --- a/packages/ERTP/test/swingsetTests/ertpService/ertp-service-upgrade.test.js +++ b/packages/ERTP/test/swingsetTests/ertpService/ertp-service-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { buildVatController } from '@agoric/swingset-vat'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js b/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js index 9a37b9b82a6..5e99e872799 100644 --- a/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js +++ b/packages/ERTP/test/swingsetTests/splitPayments/bootstrap.js @@ -1,5 +1,5 @@ import { E } from '@endo/eventual-send'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { Far } from '@endo/marshal'; import { makeIssuerKit, AmountMath } from '../../../src/index.js'; diff --git a/packages/ERTP/test/unitTests/mintObj.test.js b/packages/ERTP/test/unitTests/mintObj.test.js index 9bb3024cbd4..dec1ed3168c 100644 --- a/packages/ERTP/test/unitTests/mintObj.test.js +++ b/packages/ERTP/test/unitTests/mintObj.test.js @@ -1,7 +1,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; import { initEmpty, M } from '@agoric/store'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { defineDurableKind, makeKindHandle } from '@agoric/vat-data'; import { makeIssuerKit, AssetKind, AmountMath } from '../../src/index.js'; diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index 90644c03ed5..a67c8dc0ac1 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -27,7 +27,7 @@ "@types/yargs-parser": "^21.0.0" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/kmarshal": "^0.1.0", "@agoric/store": "^0.9.2", diff --git a/packages/SwingSet/src/controller/controller.js b/packages/SwingSet/src/controller/controller.js index 32eaa4e40b5..5534fa3e343 100644 --- a/packages/SwingSet/src/controller/controller.js +++ b/packages/SwingSet/src/controller/controller.js @@ -9,7 +9,7 @@ import { tmpName } from 'tmp'; import anylogger from 'anylogger'; import microtime from 'microtime'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { importBundle } from '@endo/import-bundle'; import { initSwingStore } from '@agoric/swing-store'; diff --git a/packages/SwingSet/src/controller/initializeKernel.js b/packages/SwingSet/src/controller/initializeKernel.js index 3378a28c39f..65238d8c5d6 100644 --- a/packages/SwingSet/src/controller/initializeKernel.js +++ b/packages/SwingSet/src/controller/initializeKernel.js @@ -2,7 +2,7 @@ import { makeMarshal } from '@endo/marshal'; import { Far } from '@endo/far'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; import { assertKnownOptions } from '../lib/assertOptions.js'; import { insistVatID } from '../lib/id.js'; diff --git a/packages/SwingSet/src/controller/initializeSwingset.js b/packages/SwingSet/src/controller/initializeSwingset.js index e3f48c3950a..649c68bcd6f 100644 --- a/packages/SwingSet/src/controller/initializeSwingset.js +++ b/packages/SwingSet/src/controller/initializeSwingset.js @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; import { mustMatch } from '@agoric/store'; import bundleSource from '@endo/bundle-source'; diff --git a/packages/SwingSet/src/controller/startXSnap.js b/packages/SwingSet/src/controller/startXSnap.js index b68145ccf1d..f5d7f311120 100644 --- a/packages/SwingSet/src/controller/startXSnap.js +++ b/packages/SwingSet/src/controller/startXSnap.js @@ -1,5 +1,5 @@ import path from 'path'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { type as osType } from 'os'; import { xsnap, recordXSnap } from '@agoric/xsnap'; diff --git a/packages/SwingSet/src/devices/bridge/device-bridge.js b/packages/SwingSet/src/devices/bridge/device-bridge.js index 463bf3097e0..216bf6556ca 100644 --- a/packages/SwingSet/src/devices/bridge/device-bridge.js +++ b/packages/SwingSet/src/devices/bridge/device-bridge.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; function sanitize(data) { diff --git a/packages/SwingSet/src/devices/command/command.js b/packages/SwingSet/src/devices/command/command.js index 9649052eeb5..f54a932b917 100644 --- a/packages/SwingSet/src/devices/command/command.js +++ b/packages/SwingSet/src/devices/command/command.js @@ -1,7 +1,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { Nat } from '@endo/nat'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export default function buildCommand(broadcastCallback) { broadcastCallback || Fail`broadcastCallback must be provided.`; diff --git a/packages/SwingSet/src/devices/command/device-command.js b/packages/SwingSet/src/devices/command/device-command.js index 98af2ea490c..2c50703f3ec 100644 --- a/packages/SwingSet/src/devices/command/device-command.js +++ b/packages/SwingSet/src/devices/command/device-command.js @@ -1,7 +1,7 @@ import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; diff --git a/packages/SwingSet/src/devices/lib/deviceTools.js b/packages/SwingSet/src/devices/lib/deviceTools.js index 562d2daab1a..9b5c91aaf28 100644 --- a/packages/SwingSet/src/devices/lib/deviceTools.js +++ b/packages/SwingSet/src/devices/lib/deviceTools.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { makeMarshal } from '@endo/marshal'; import { Far } from '@endo/far'; import { parseVatSlot } from '../../lib/parseVatSlots.js'; diff --git a/packages/SwingSet/src/devices/loopbox/device-loopbox.js b/packages/SwingSet/src/devices/loopbox/device-loopbox.js index cb9bb6f1fdc..403dbefed68 100644 --- a/packages/SwingSet/src/devices/loopbox/device-loopbox.js +++ b/packages/SwingSet/src/devices/loopbox/device-loopbox.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; export function buildRootDeviceNode(tools) { diff --git a/packages/SwingSet/src/devices/loopbox/loopbox.js b/packages/SwingSet/src/devices/loopbox/loopbox.js index 6a7477b4ce7..86e8884b485 100644 --- a/packages/SwingSet/src/devices/loopbox/loopbox.js +++ b/packages/SwingSet/src/devices/loopbox/loopbox.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /* * The "loopbox" is a special device used for unit tests, which glues one diff --git a/packages/SwingSet/src/devices/mailbox/device-mailbox.js b/packages/SwingSet/src/devices/mailbox/device-mailbox.js index 256e0c2e1e6..ddbbf6d250a 100644 --- a/packages/SwingSet/src/devices/mailbox/device-mailbox.js +++ b/packages/SwingSet/src/devices/mailbox/device-mailbox.js @@ -1,7 +1,7 @@ import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; diff --git a/packages/SwingSet/src/devices/mailbox/mailbox.js b/packages/SwingSet/src/devices/mailbox/mailbox.js index a54d11fe888..b8fd29787b5 100644 --- a/packages/SwingSet/src/devices/mailbox/mailbox.js +++ b/packages/SwingSet/src/devices/mailbox/mailbox.js @@ -66,7 +66,7 @@ import { Nat } from '@endo/nat'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; // This Map-based mailboxState object is a good starting point, but we may // replace it with one that tracks which parts of the state have been diff --git a/packages/SwingSet/src/devices/plugin/device-plugin.js b/packages/SwingSet/src/devices/plugin/device-plugin.js index 41927ffe8fa..bdf6d6ae1ac 100644 --- a/packages/SwingSet/src/devices/plugin/device-plugin.js +++ b/packages/SwingSet/src/devices/plugin/device-plugin.js @@ -1,6 +1,6 @@ import { makeCapTP } from '@endo/captp'; import { Far } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; diff --git a/packages/SwingSet/src/devices/timer/device-timer.js b/packages/SwingSet/src/devices/timer/device-timer.js index 25818d17bc5..99ca76322a4 100644 --- a/packages/SwingSet/src/devices/timer/device-timer.js +++ b/packages/SwingSet/src/devices/timer/device-timer.js @@ -23,7 +23,7 @@ */ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { Far } from '@endo/far'; // Since we use harden when saving the state, we need to copy the arrays so they diff --git a/packages/SwingSet/src/devices/timer/timer.js b/packages/SwingSet/src/devices/timer/timer.js index beb17efc8d4..3fa0361cacc 100644 --- a/packages/SwingSet/src/devices/timer/timer.js +++ b/packages/SwingSet/src/devices/timer/timer.js @@ -1,6 +1,6 @@ import { Nat } from '@endo/nat'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Endowments for a Timer device that can be made available to SwingSet vats. 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 3aec158d099..e25943a667f 100644 --- a/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js +++ b/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kunser } from '@agoric/kmarshal'; import { buildSerializationTools } from '../lib/deviceTools.js'; import { insistVatID } from '../../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/deviceManager.js b/packages/SwingSet/src/kernel/deviceManager.js index 35220b0ae69..77ecd002098 100644 --- a/packages/SwingSet/src/kernel/deviceManager.js +++ b/packages/SwingSet/src/kernel/deviceManager.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { makeDeviceSlots } from './deviceSlots.js'; import { insistCapData } from '../lib/capdata.js'; diff --git a/packages/SwingSet/src/kernel/deviceSlots.js b/packages/SwingSet/src/kernel/deviceSlots.js index e42fa461a25..609edc0837a 100644 --- a/packages/SwingSet/src/kernel/deviceSlots.js +++ b/packages/SwingSet/src/kernel/deviceSlots.js @@ -1,6 +1,6 @@ import { Remotable, makeMarshal } from '@endo/marshal'; import { passStyleOf } from '@endo/far'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistVatType, makeVatSlot, diff --git a/packages/SwingSet/src/kernel/deviceTranslator.js b/packages/SwingSet/src/kernel/deviceTranslator.js index f8c88dd9282..229d27512aa 100644 --- a/packages/SwingSet/src/kernel/deviceTranslator.js +++ b/packages/SwingSet/src/kernel/deviceTranslator.js @@ -1,5 +1,5 @@ // @ts-nocheck -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistMessage } from '../lib/message.js'; import { insistKernelType } from './parseKernelSlots.js'; import { insistVatType, parseVatSlot } from '../lib/parseVatSlots.js'; diff --git a/packages/SwingSet/src/kernel/dummyMeterControl.js b/packages/SwingSet/src/kernel/dummyMeterControl.js index d03961cfc13..19088a1caab 100644 --- a/packages/SwingSet/src/kernel/dummyMeterControl.js +++ b/packages/SwingSet/src/kernel/dummyMeterControl.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; export function makeDummyMeterControl() { let meteringDisabled = 0; diff --git a/packages/SwingSet/src/kernel/gc-actions.js b/packages/SwingSet/src/kernel/gc-actions.js index 38c4a6a6151..01adbeeff45 100644 --- a/packages/SwingSet/src/kernel/gc-actions.js +++ b/packages/SwingSet/src/kernel/gc-actions.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { insistKernelType } from './parseKernelSlots.js'; import { insistVatID } from '../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/kernel.js b/packages/SwingSet/src/kernel/kernel.js index 23f0d9ec637..d0c7c144256 100644 --- a/packages/SwingSet/src/kernel/kernel.js +++ b/packages/SwingSet/src/kernel/kernel.js @@ -1,6 +1,6 @@ /* global globalThis */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { isNat } from '@endo/nat'; import { importBundle } from '@endo/import-bundle'; import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; diff --git a/packages/SwingSet/src/kernel/kernelSyscall.js b/packages/SwingSet/src/kernel/kernelSyscall.js index eed35256b25..fa1ce165daf 100644 --- a/packages/SwingSet/src/kernel/kernelSyscall.js +++ b/packages/SwingSet/src/kernel/kernelSyscall.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistKernelType } from './parseKernelSlots.js'; import { insistCapData } from '../lib/capdata.js'; import { insistDeviceID, insistVatID } from '../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/parseKernelSlots.js b/packages/SwingSet/src/kernel/parseKernelSlots.js index e76ee77c58d..f4934dbacb0 100644 --- a/packages/SwingSet/src/kernel/parseKernelSlots.js +++ b/packages/SwingSet/src/kernel/parseKernelSlots.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // Object/promise references (in the kernel) contain a two-tuple of (type, // index). All object references point to entries in the kernel Object diff --git a/packages/SwingSet/src/kernel/slogger.js b/packages/SwingSet/src/kernel/slogger.js index b88ac1e8528..810a03b9a63 100644 --- a/packages/SwingSet/src/kernel/slogger.js +++ b/packages/SwingSet/src/kernel/slogger.js @@ -1,4 +1,4 @@ -import { quote } from '@agoric/assert'; +import { quote } from '@endo/errors'; const IDLE = 'idle'; const STARTUP = 'startup'; diff --git a/packages/SwingSet/src/kernel/state/deviceKeeper.js b/packages/SwingSet/src/kernel/state/deviceKeeper.js index 3c5e9f3fe6e..72200df6698 100644 --- a/packages/SwingSet/src/kernel/state/deviceKeeper.js +++ b/packages/SwingSet/src/kernel/state/deviceKeeper.js @@ -3,7 +3,7 @@ */ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { parseKernelSlot } from '../parseKernelSlots.js'; import { makeVatSlot, parseVatSlot } from '../../lib/parseVatSlots.js'; import { insistDeviceID } from '../../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/state/kernelKeeper.js b/packages/SwingSet/src/kernel/state/kernelKeeper.js index 4295b0ccf96..192be013c41 100644 --- a/packages/SwingSet/src/kernel/state/kernelKeeper.js +++ b/packages/SwingSet/src/kernel/state/kernelKeeper.js @@ -1,5 +1,5 @@ import { Nat, isNat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { initializeVatState, makeVatKeeper } from './vatKeeper.js'; import { initializeDeviceState, makeDeviceKeeper } from './deviceKeeper.js'; import { parseReachableAndVatSlot } from './reachable.js'; diff --git a/packages/SwingSet/src/kernel/state/reachable.js b/packages/SwingSet/src/kernel/state/reachable.js index 94753bd1b63..3a6162af399 100644 --- a/packages/SwingSet/src/kernel/state/reachable.js +++ b/packages/SwingSet/src/kernel/state/reachable.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; export function parseReachableAndVatSlot(value) { typeof value === 'string' || Fail`non-string value: ${value}`; diff --git a/packages/SwingSet/src/kernel/state/stats.js b/packages/SwingSet/src/kernel/state/stats.js index 6da7edab83c..e05257b805a 100644 --- a/packages/SwingSet/src/kernel/state/stats.js +++ b/packages/SwingSet/src/kernel/state/stats.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** @typedef {'counter' | 'gauge'} KernelStatsMetricType */ /** diff --git a/packages/SwingSet/src/kernel/state/storageHelper.js b/packages/SwingSet/src/kernel/state/storageHelper.js index cad0a907a39..65a8a796090 100644 --- a/packages/SwingSet/src/kernel/state/storageHelper.js +++ b/packages/SwingSet/src/kernel/state/storageHelper.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Iterate over keys with a given prefix, in lexicographic order, diff --git a/packages/SwingSet/src/kernel/state/vatKeeper.js b/packages/SwingSet/src/kernel/state/vatKeeper.js index 11b2e776ce6..2d6312c7c4c 100644 --- a/packages/SwingSet/src/kernel/state/vatKeeper.js +++ b/packages/SwingSet/src/kernel/state/vatKeeper.js @@ -2,7 +2,7 @@ * Kernel's keeper of persistent state for a vat. */ import { Nat, isNat } from '@endo/nat'; -import { assert, q, Fail } from '@agoric/assert'; +import { assert, q, Fail } from '@endo/errors'; import { parseKernelSlot } from '../parseKernelSlots.js'; import { makeVatSlot, parseVatSlot } from '../../lib/parseVatSlots.js'; import { insistVatID } from '../../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/vat-admin-hooks.js b/packages/SwingSet/src/kernel/vat-admin-hooks.js index 35045111b0f..affff0758b5 100644 --- a/packages/SwingSet/src/kernel/vat-admin-hooks.js +++ b/packages/SwingSet/src/kernel/vat-admin-hooks.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; import { insistVatID } from '../lib/id.js'; diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-factory.js b/packages/SwingSet/src/kernel/vat-loader/manager-factory.js index 56160da9254..2b8de555d9c 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-factory.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-factory.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { assertKnownOptions } from '../../lib/assertOptions.js'; import { makeLocalVatManagerFactory } from './manager-local.js'; import { makeNodeSubprocessFactory } from './manager-subprocess-node.js'; diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-helper.js b/packages/SwingSet/src/kernel/vat-loader/manager-helper.js index 8df28db1fe3..13a074cf118 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-helper.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-helper.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import '../../types-ambient.js'; import { insistVatDeliveryResult, diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-local.js b/packages/SwingSet/src/kernel/vat-loader/manager-local.js index 46d61def5fb..9261676a1e3 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-local.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-local.js @@ -1,6 +1,6 @@ /* global globalThis */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { importBundle } from '@endo/import-bundle'; import { makeLiveSlots } from '@agoric/swingset-liveslots'; import { makeManagerKit } from './manager-helper.js'; diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-node.js b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-node.js index 5ac7ec60f05..9cfad88feb7 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-node.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-node.js @@ -1,6 +1,6 @@ // import { spawn } from 'child_process'; // not from Compartment -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { makeManagerKit } from './manager-helper.js'; diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js index 712e6cce863..ff9a4bb1d50 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js @@ -1,5 +1,5 @@ import { synchronizedTee } from '@agoric/internal'; -import { assert, Fail, q } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { ExitCode } from '@agoric/xsnap/api.js'; import { makeManagerKit } from './manager-helper.js'; diff --git a/packages/SwingSet/src/kernel/vat-loader/vat-loader.js b/packages/SwingSet/src/kernel/vat-loader/vat-loader.js index a83022673d1..34fc179af0d 100644 --- a/packages/SwingSet/src/kernel/vat-loader/vat-loader.js +++ b/packages/SwingSet/src/kernel/vat-loader/vat-loader.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { assertKnownOptions } from '../../lib/assertOptions.js'; import { makeVatSlot } from '../../lib/parseVatSlots.js'; diff --git a/packages/SwingSet/src/kernel/vat-warehouse.js b/packages/SwingSet/src/kernel/vat-warehouse.js index 327b74fd4ea..9dc8903c713 100644 --- a/packages/SwingSet/src/kernel/vat-warehouse.js +++ b/packages/SwingSet/src/kernel/vat-warehouse.js @@ -1,4 +1,4 @@ -import { assert, Fail, quote as q } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { isNat } from '@endo/nat'; import { makeVatTranslators } from './vatTranslator.js'; import { insistVatDeliveryResult } from '../lib/message.js'; diff --git a/packages/SwingSet/src/kernel/vatTranslator.js b/packages/SwingSet/src/kernel/vatTranslator.js index 782fb8189d1..4f1d1e2aa08 100644 --- a/packages/SwingSet/src/kernel/vatTranslator.js +++ b/packages/SwingSet/src/kernel/vatTranslator.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistMessage } from '../lib/message.js'; import { insistKernelType, parseKernelSlot } from './parseKernelSlots.js'; import { insistVatType, parseVatSlot } from '../lib/parseVatSlots.js'; diff --git a/packages/SwingSet/src/lib/assertOptions.js b/packages/SwingSet/src/lib/assertOptions.js index 5e91e628f6a..9174fe3cbe8 100644 --- a/packages/SwingSet/src/lib/assertOptions.js +++ b/packages/SwingSet/src/lib/assertOptions.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; export function assertKnownOptions(options, knownNames) { assert(knownNames instanceof Array); diff --git a/packages/SwingSet/src/lib/capdata.js b/packages/SwingSet/src/lib/capdata.js index 5a2d03ef8c1..84a430f3cc6 100644 --- a/packages/SwingSet/src/lib/capdata.js +++ b/packages/SwingSet/src/lib/capdata.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { passStyleOf } from '@endo/far'; import { kunser, krefOf } from '@agoric/kmarshal'; diff --git a/packages/SwingSet/src/lib/id.js b/packages/SwingSet/src/lib/id.js index ca20188a5aa..34d674d1ba6 100644 --- a/packages/SwingSet/src/lib/id.js +++ b/packages/SwingSet/src/lib/id.js @@ -1,6 +1,6 @@ import { Nat } from '@endo/nat'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; // Vats are identified by an integer index, which (for typechecking purposes) // is encoded as `vNN`. Devices are similarly identified as `dNN`. Both have diff --git a/packages/SwingSet/src/lib/message.js b/packages/SwingSet/src/lib/message.js index 387ed058bb3..4f496a6837b 100644 --- a/packages/SwingSet/src/lib/message.js +++ b/packages/SwingSet/src/lib/message.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistCapData } from './capdata.js'; /** diff --git a/packages/SwingSet/src/lib/parseVatSlots.js b/packages/SwingSet/src/lib/parseVatSlots.js index 11abe5e428a..7b2dc48c081 100644 --- a/packages/SwingSet/src/lib/parseVatSlots.js +++ b/packages/SwingSet/src/lib/parseVatSlots.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // NOTE: confusing terminology: "slot" vs. "reference". All these things // called "slots" are references, but the word "slot" suggests something into diff --git a/packages/SwingSet/src/lib/recordVatOptions.js b/packages/SwingSet/src/lib/recordVatOptions.js index 81330a8a26b..09b8e9c759a 100644 --- a/packages/SwingSet/src/lib/recordVatOptions.js +++ b/packages/SwingSet/src/lib/recordVatOptions.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makeWorkerOptions } from './workerOptions.js'; export const makeVatOptionRecorder = (kernelKeeper, bundleHandler) => { diff --git a/packages/SwingSet/src/lib/runPolicies.js b/packages/SwingSet/src/lib/runPolicies.js index e3528d53c63..2b54eace7af 100644 --- a/packages/SwingSet/src/lib/runPolicies.js +++ b/packages/SwingSet/src/lib/runPolicies.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; export function foreverPolicy() { /** @type { RunPolicy } */ diff --git a/packages/SwingSet/src/lib/storageAPI.js b/packages/SwingSet/src/lib/storageAPI.js index 209a4377e20..1e5b6c5a4eb 100644 --- a/packages/SwingSet/src/lib/storageAPI.js +++ b/packages/SwingSet/src/lib/storageAPI.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Assert function to ensure that an object implements the StorageAPI diff --git a/packages/SwingSet/src/lib/workerOptions.js b/packages/SwingSet/src/lib/workerOptions.js index 0747047d108..4e4cc897119 100644 --- a/packages/SwingSet/src/lib/workerOptions.js +++ b/packages/SwingSet/src/lib/workerOptions.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * @param {string} managerType diff --git a/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js b/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js index 2ad8c55e485..8f1067b84ca 100644 --- a/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js +++ b/packages/SwingSet/src/supervisors/subprocess-node/supervisor-subprocess-node.js @@ -8,7 +8,7 @@ import fs from 'fs'; import { Buffer } from 'buffer'; import process from 'node:process'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { importBundle } from '@endo/import-bundle'; import { makeMarshal } from '@endo/marshal'; import { diff --git a/packages/SwingSet/src/vats/comms/clist-inbound.js b/packages/SwingSet/src/vats/comms/clist-inbound.js index fe95fb321dd..437911b1dc4 100644 --- a/packages/SwingSet/src/vats/comms/clist-inbound.js +++ b/packages/SwingSet/src/vats/comms/clist-inbound.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { flipRemoteSlot, insistRemoteType, diff --git a/packages/SwingSet/src/vats/comms/clist-kernel.js b/packages/SwingSet/src/vats/comms/clist-kernel.js index d32db8c83f2..e701091462b 100644 --- a/packages/SwingSet/src/vats/comms/clist-kernel.js +++ b/packages/SwingSet/src/vats/comms/clist-kernel.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { parseVatSlot, insistVatType } from '../../lib/parseVatSlots.js'; import { parseLocalSlot } from './parseLocalSlots.js'; import { cdebug } from './cdebug.js'; diff --git a/packages/SwingSet/src/vats/comms/clist-outbound.js b/packages/SwingSet/src/vats/comms/clist-outbound.js index fdd1a9d5756..05739ea9457 100644 --- a/packages/SwingSet/src/vats/comms/clist-outbound.js +++ b/packages/SwingSet/src/vats/comms/clist-outbound.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js'; import { flipRemoteSlot, diff --git a/packages/SwingSet/src/vats/comms/controller.js b/packages/SwingSet/src/vats/comms/controller.js index e914c742d7b..8314257eaf7 100644 --- a/packages/SwingSet/src/vats/comms/controller.js +++ b/packages/SwingSet/src/vats/comms/controller.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { kser, kunser, kslot, krefOf } from '@agoric/kmarshal'; // deliverToController() is used for local vats which want to talk to us as a diff --git a/packages/SwingSet/src/vats/comms/delivery.js b/packages/SwingSet/src/vats/comms/delivery.js index b8b624e5d2a..bdfd8703226 100644 --- a/packages/SwingSet/src/vats/comms/delivery.js +++ b/packages/SwingSet/src/vats/comms/delivery.js @@ -1,6 +1,6 @@ /* eslint-disable no-use-before-define */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { kser } from '@agoric/kmarshal'; import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js'; import { makeUndeliverableError } from '../../lib/makeUndeliverableError.js'; diff --git a/packages/SwingSet/src/vats/comms/dispatch.js b/packages/SwingSet/src/vats/comms/dispatch.js index 5480dabc5ce..68212073ce6 100644 --- a/packages/SwingSet/src/vats/comms/dispatch.js +++ b/packages/SwingSet/src/vats/comms/dispatch.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; import { makeVatSlot } from '../../lib/parseVatSlots.js'; import { insistMessage } from '../../lib/message.js'; diff --git a/packages/SwingSet/src/vats/comms/gc-comms.js b/packages/SwingSet/src/vats/comms/gc-comms.js index 32991459fa9..b73bdafb1cd 100644 --- a/packages/SwingSet/src/vats/comms/gc-comms.js +++ b/packages/SwingSet/src/vats/comms/gc-comms.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { parseVatSlot } from '../../lib/parseVatSlots.js'; import { parseRemoteSlot } from './parseRemoteSlot.js'; diff --git a/packages/SwingSet/src/vats/comms/parseLocalSlots.js b/packages/SwingSet/src/vats/comms/parseLocalSlots.js index 9a269cbc89f..e7b951bcb88 100644 --- a/packages/SwingSet/src/vats/comms/parseLocalSlots.js +++ b/packages/SwingSet/src/vats/comms/parseLocalSlots.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // Local object/promise references (in the comms vat) contain a two-tuple of // (type, index). All object references point to entries in the Local Object diff --git a/packages/SwingSet/src/vats/comms/parseRemoteSlot.js b/packages/SwingSet/src/vats/comms/parseRemoteSlot.js index 757f3f2e1c3..a33d66b0d1c 100644 --- a/packages/SwingSet/src/vats/comms/parseRemoteSlot.js +++ b/packages/SwingSet/src/vats/comms/parseRemoteSlot.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // Object/promise references (in remote messages) contain a three-tuple of // (type, allocator flag, index). The allocator flag inside an inbound diff --git a/packages/SwingSet/src/vats/comms/remote.js b/packages/SwingSet/src/vats/comms/remote.js index a1f4d91a61a..c39a3e63dc4 100644 --- a/packages/SwingSet/src/vats/comms/remote.js +++ b/packages/SwingSet/src/vats/comms/remote.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js'; import { makeRemoteSlot, diff --git a/packages/SwingSet/src/vats/comms/state.js b/packages/SwingSet/src/vats/comms/state.js index c326d6e4d42..65813f276b7 100644 --- a/packages/SwingSet/src/vats/comms/state.js +++ b/packages/SwingSet/src/vats/comms/state.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistCapData } from '../../lib/capdata.js'; import { makeVatSlot, diff --git a/packages/SwingSet/src/vats/timer/vat-timer.js b/packages/SwingSet/src/vats/timer/vat-timer.js index 6f449c9aec3..07473ff8909 100644 --- a/packages/SwingSet/src/vats/timer/vat-timer.js +++ b/packages/SwingSet/src/vats/timer/vat-timer.js @@ -3,7 +3,7 @@ import { Far, E, passStyleOf } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { Nat } from '@endo/nat'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { provideKindHandle, provideDurableMapStore, diff --git a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js index 4cc363dc572..a164f265ae4 100644 --- a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js +++ b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js @@ -17,7 +17,7 @@ import { prepareSingleton, } from '@agoric/vat-data'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; const managerTypes = ['local', 'node-subprocess', 'xsnap', 'xs-worker']; // xs-worker is alias diff --git a/packages/SwingSet/src/vats/vattp/vat-vattp.js b/packages/SwingSet/src/vats/vattp/vat-vattp.js index f85d4dca222..0a4f247290c 100644 --- a/packages/SwingSet/src/vats/vattp/vat-vattp.js +++ b/packages/SwingSet/src/vats/vattp/vat-vattp.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { provide, defineDurableKindMulti, diff --git a/packages/SwingSet/test/basedir-promises-2/bootstrap.js b/packages/SwingSet/test/basedir-promises-2/bootstrap.js index a67d406a3ff..19312d647e6 100644 --- a/packages/SwingSet/test/basedir-promises-2/bootstrap.js +++ b/packages/SwingSet/test/basedir-promises-2/bootstrap.js @@ -1,6 +1,6 @@ import { makePromiseKit } from '@endo/promise-kit'; import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, vatParameters) { const log = vatPowers.testLog; diff --git a/packages/SwingSet/test/basedir-promises/bootstrap.js b/packages/SwingSet/test/basedir-promises/bootstrap.js index a5ef76fc22e..fe0ba8a5a22 100644 --- a/packages/SwingSet/test/basedir-promises/bootstrap.js +++ b/packages/SwingSet/test/basedir-promises/bootstrap.js @@ -1,7 +1,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, vatParameters) { const log = vatPowers.testLog; diff --git a/packages/SwingSet/test/basedir-transcript/bootstrap.js b/packages/SwingSet/test/basedir-transcript/bootstrap.js index 917f5abe142..59c59422d73 100644 --- a/packages/SwingSet/test/basedir-transcript/bootstrap.js +++ b/packages/SwingSet/test/basedir-transcript/bootstrap.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, vatParameters) { return Far('root', { diff --git a/packages/SwingSet/test/bundling/bootstrap-bundles.js b/packages/SwingSet/test/bundling/bootstrap-bundles.js index 93e20095c07..803d6fecde5 100644 --- a/packages/SwingSet/test/bundling/bootstrap-bundles.js +++ b/packages/SwingSet/test/bundling/bootstrap-bundles.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Far, E } from '@endo/far'; import { importBundle } from '@endo/import-bundle'; diff --git a/packages/SwingSet/test/bundling/bundles.test.js b/packages/SwingSet/test/bundling/bundles.test.js index c3c3d85b495..03004e5b4d3 100644 --- a/packages/SwingSet/test/bundling/bundles.test.js +++ b/packages/SwingSet/test/bundling/bundles.test.js @@ -4,7 +4,7 @@ import { test } from '../../tools/prepare-test-env-ava.js'; import fs from 'fs'; import bundleSource from '@endo/bundle-source'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; diff --git a/packages/SwingSet/test/change-parameters/change-parameters.test.js b/packages/SwingSet/test/change-parameters/change-parameters.test.js index 290cba11ca1..0e2de993dee 100644 --- a/packages/SwingSet/test/change-parameters/change-parameters.test.js +++ b/packages/SwingSet/test/change-parameters/change-parameters.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kunser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; diff --git a/packages/SwingSet/test/commsVatDriver.js b/packages/SwingSet/test/commsVatDriver.js index 8e5ffdadc25..21a30e96796 100644 --- a/packages/SwingSet/test/commsVatDriver.js +++ b/packages/SwingSet/test/commsVatDriver.js @@ -1,5 +1,5 @@ // @ts-nocheck -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { kslot, kser } from '@agoric/kmarshal'; import buildCommsDispatch from '../src/vats/comms/index.js'; import { debugState } from '../src/vats/comms/dispatch.js'; diff --git a/packages/SwingSet/test/device-mailbox/bootstrap-device-mailbox.js b/packages/SwingSet/test/device-mailbox/bootstrap-device-mailbox.js index 2739b4266d6..7e8f6bdf828 100644 --- a/packages/SwingSet/test/device-mailbox/bootstrap-device-mailbox.js +++ b/packages/SwingSet/test/device-mailbox/bootstrap-device-mailbox.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, vatParameters) { const { D, testLog: log } = vatPowers; diff --git a/packages/SwingSet/test/device-plugin/bootstrap.js b/packages/SwingSet/test/device-plugin/bootstrap.js index 20bc3c1f4eb..8c7f4c59fb2 100644 --- a/packages/SwingSet/test/device-plugin/bootstrap.js +++ b/packages/SwingSet/test/device-plugin/bootstrap.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makePluginManager } from '../../src/vats/plugin-manager.js'; export function buildRootObject(vatPowers, vatParameters) { diff --git a/packages/SwingSet/test/device-plugin/vat-bridge.js b/packages/SwingSet/test/device-plugin/vat-bridge.js index 1c1c0e36f4f..4c434b7be79 100644 --- a/packages/SwingSet/test/device-plugin/vat-bridge.js +++ b/packages/SwingSet/test/device-plugin/vat-bridge.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, _vatParameters) { const log = vatPowers.testLog; diff --git a/packages/SwingSet/test/devices/bootstrap-1.js b/packages/SwingSet/test/devices/bootstrap-1.js index 058b5c6b6f4..664b9196e93 100644 --- a/packages/SwingSet/test/devices/bootstrap-1.js +++ b/packages/SwingSet/test/devices/bootstrap-1.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kser, kunser, krefOf } from '@agoric/kmarshal'; import { extractMessage } from '../vat-util.js'; diff --git a/packages/SwingSet/test/devices/bootstrap-3.js b/packages/SwingSet/test/devices/bootstrap-3.js index 3bff1e5cd71..566cb6bc379 100644 --- a/packages/SwingSet/test/devices/bootstrap-3.js +++ b/packages/SwingSet/test/devices/bootstrap-3.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; export function buildRootObject(vatPowers, vatParameters) { diff --git a/packages/SwingSet/test/devices/device-raw-0.js b/packages/SwingSet/test/devices/device-raw-0.js index d4e1ff1021b..b1ca08adfa8 100644 --- a/packages/SwingSet/test/devices/device-raw-0.js +++ b/packages/SwingSet/test/devices/device-raw-0.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { buildSerializationTools } from '../../src/devices/lib/deviceTools.js'; export function buildDevice(tools, endowments) { diff --git a/packages/SwingSet/test/files-vattp/bootstrap-test-vattp.js b/packages/SwingSet/test/files-vattp/bootstrap-test-vattp.js index 097d7da86b9..5325d28a0e1 100644 --- a/packages/SwingSet/test/files-vattp/bootstrap-test-vattp.js +++ b/packages/SwingSet/test/files-vattp/bootstrap-test-vattp.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; export function buildRootObject(vatPowers, vatParameters) { const { D, testLog: log } = vatPowers; diff --git a/packages/SwingSet/test/gc-kernel.test.js b/packages/SwingSet/test/gc-kernel.test.js index aa594391f07..eef51e76a4f 100644 --- a/packages/SwingSet/test/gc-kernel.test.js +++ b/packages/SwingSet/test/gc-kernel.test.js @@ -5,7 +5,7 @@ import anylogger from 'anylogger'; // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kser, kunser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; diff --git a/packages/SwingSet/test/kernel.test.js b/packages/SwingSet/test/kernel.test.js index 81e734fd66e..95dc619a19b 100644 --- a/packages/SwingSet/test/kernel.test.js +++ b/packages/SwingSet/test/kernel.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../tools/prepare-test-env-ava.js'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kser, kslot } from '@agoric/kmarshal'; import buildKernel from '../src/kernel/index.js'; import { initializeKernel } from '../src/controller/initializeKernel.js'; diff --git a/packages/SwingSet/test/message-patterns.js b/packages/SwingSet/test/message-patterns.js index b393c236a5d..9ab90a912f7 100644 --- a/packages/SwingSet/test/message-patterns.js +++ b/packages/SwingSet/test/message-patterns.js @@ -3,7 +3,7 @@ // test.stuff patterns. import { makePromiseKit } from '@endo/promise-kit'; -import { quote as q } from '@agoric/assert'; +import { q } from '@endo/errors'; import { Far, E } from '@endo/far'; import { ignore } from './vat-util.js'; diff --git a/packages/SwingSet/test/promise-watcher/promise-watcher.test.js b/packages/SwingSet/test/promise-watcher/promise-watcher.test.js index a8737a61e9b..7c607a4d355 100644 --- a/packages/SwingSet/test/promise-watcher/promise-watcher.test.js +++ b/packages/SwingSet/test/promise-watcher/promise-watcher.test.js @@ -5,7 +5,7 @@ import { handleUnhandledRejections } from './unhandledRejectionDetector.js'; import { test } from '../../tools/prepare-test-env-ava.js'; // eslint-disable-next-line import/order -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; // eslint-disable-next-line import/order import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; diff --git a/packages/SwingSet/test/timer-device/bootstrap.js b/packages/SwingSet/test/timer-device/bootstrap.js index 14bee765765..80d69515710 100644 --- a/packages/SwingSet/test/timer-device/bootstrap.js +++ b/packages/SwingSet/test/timer-device/bootstrap.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; diff --git a/packages/SwingSet/test/upgrade/bootstrap-scripted-upgrade.js b/packages/SwingSet/test/upgrade/bootstrap-scripted-upgrade.js index b5762a77ad1..c93cfa6b568 100644 --- a/packages/SwingSet/test/upgrade/bootstrap-scripted-upgrade.js +++ b/packages/SwingSet/test/upgrade/bootstrap-scripted-upgrade.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; const NUM_SENSORS = 39; diff --git a/packages/SwingSet/test/upgrade/upgrade-replay.test.js b/packages/SwingSet/test/upgrade/upgrade-replay.test.js index 6c02487e833..1cd95fc32d2 100644 --- a/packages/SwingSet/test/upgrade/upgrade-replay.test.js +++ b/packages/SwingSet/test/upgrade/upgrade-replay.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kser } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { diff --git a/packages/SwingSet/test/upgrade/upgrade.test.js b/packages/SwingSet/test/upgrade/upgrade.test.js index 4066c203466..77b7c781b87 100644 --- a/packages/SwingSet/test/upgrade/upgrade.test.js +++ b/packages/SwingSet/test/upgrade/upgrade.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import bundleSource from '@endo/bundle-source'; import { objectMap } from '@agoric/internal'; import { kser, kunser, krefOf } from '@agoric/kmarshal'; diff --git a/packages/SwingSet/test/upgrade/vat-ulrik-2.js b/packages/SwingSet/test/upgrade/vat-ulrik-2.js index 0d80ed3b490..e843e2154e3 100644 --- a/packages/SwingSet/test/upgrade/vat-ulrik-2.js +++ b/packages/SwingSet/test/upgrade/vat-ulrik-2.js @@ -1,5 +1,5 @@ import { Far, E } from '@endo/far'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { initEmpty } from '@agoric/store'; import { defineDurableKind, defineDurableKindMulti } from '@agoric/vat-data'; diff --git a/packages/SwingSet/test/vat-util.js b/packages/SwingSet/test/vat-util.js index e03fdcf3c97..8d2c4be5a13 100644 --- a/packages/SwingSet/test/vat-util.js +++ b/packages/SwingSet/test/vat-util.js @@ -1,7 +1,7 @@ // this file is imported by some test vats, so don't import any non-pure // modules -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; export function extractMessage(vatDeliverObject) { diff --git a/packages/SwingSet/test/virtualObjects/collection-slots/collection-slots.test.js b/packages/SwingSet/test/virtualObjects/collection-slots/collection-slots.test.js index f0d629a86e7..2c77a2e65c7 100644 --- a/packages/SwingSet/test/virtualObjects/collection-slots/collection-slots.test.js +++ b/packages/SwingSet/test/virtualObjects/collection-slots/collection-slots.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../../src/kernel/state/reachable.js'; diff --git a/packages/SwingSet/test/virtualObjects/delete-stored-vo/delete-stored-vo.test.js b/packages/SwingSet/test/virtualObjects/delete-stored-vo/delete-stored-vo.test.js index 291c664f51b..443a79fd3a8 100644 --- a/packages/SwingSet/test/virtualObjects/delete-stored-vo/delete-stored-vo.test.js +++ b/packages/SwingSet/test/virtualObjects/delete-stored-vo/delete-stored-vo.test.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order import { test } from '../../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kunser, krefOf } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { parseReachableAndVatSlot } from '../../../src/kernel/state/reachable.js'; diff --git a/packages/SwingSet/test/vpid-kernel.test.js b/packages/SwingSet/test/vpid-kernel.test.js index c97023516ed..a34fcc8281e 100644 --- a/packages/SwingSet/test/vpid-kernel.test.js +++ b/packages/SwingSet/test/vpid-kernel.test.js @@ -4,7 +4,7 @@ import { test } from '../tools/prepare-test-env-ava.js'; import anylogger from 'anylogger'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kser, kslot } from '@agoric/kmarshal'; import { initSwingStore } from '@agoric/swing-store'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; diff --git a/packages/SwingSet/test/zcf-ish-upgrade/zcf-ish-upgrade.test.js b/packages/SwingSet/test/zcf-ish-upgrade/zcf-ish-upgrade.test.js index 153a51a159a..d88e5c2db77 100644 --- a/packages/SwingSet/test/zcf-ish-upgrade/zcf-ish-upgrade.test.js +++ b/packages/SwingSet/test/zcf-ish-upgrade/zcf-ish-upgrade.test.js @@ -1,7 +1,7 @@ // eslint-disable-next-line import/order import { test } from '../../tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../../src/index.js'; diff --git a/packages/SwingSet/tools/bootstrap-relay.js b/packages/SwingSet/tools/bootstrap-relay.js index 6fa802b397e..cbfc641564f 100644 --- a/packages/SwingSet/tools/bootstrap-relay.js +++ b/packages/SwingSet/tools/bootstrap-relay.js @@ -1,11 +1,9 @@ -import { assert } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { objectMap } from '@agoric/internal'; import { Far, E } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { buildManualTimer } from './manual-timer.js'; -const { Fail, quote: q } = assert; - export const buildRootObject = () => { const timer = buildManualTimer(); let vatAdmin; diff --git a/packages/SwingSet/tools/dvo-test-harness.js b/packages/SwingSet/tools/dvo-test-harness.js index b8d54b0a953..d921c37de55 100644 --- a/packages/SwingSet/tools/dvo-test-harness.js +++ b/packages/SwingSet/tools/dvo-test-harness.js @@ -1,7 +1,7 @@ // eslint-disable-next-line import/order import { test } from './prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeMarshal } from '@endo/marshal'; import { initSwingStore } from '@agoric/swing-store'; import { initializeSwingset, makeSwingsetController } from '../src/index.js'; diff --git a/packages/SwingSet/tools/manual-timer.js b/packages/SwingSet/tools/manual-timer.js index 0634b892715..4a618ab41db 100644 --- a/packages/SwingSet/tools/manual-timer.js +++ b/packages/SwingSet/tools/manual-timer.js @@ -1,5 +1,5 @@ import { Far } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makeScalarMapStore } from '@agoric/store'; import { bindAllMethods } from '@agoric/internal'; import { TimeMath } from '@agoric/time'; diff --git a/packages/SwingSet/tools/run-utils.js b/packages/SwingSet/tools/run-utils.js index efe1499b2e5..5c1ed2e4b39 100644 --- a/packages/SwingSet/tools/run-utils.js +++ b/packages/SwingSet/tools/run-utils.js @@ -1,4 +1,4 @@ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { kunser } from '@agoric/kmarshal'; import { makeQueue } from '@endo/stream'; diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index 5786b3594f5..13a091066d5 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@agoric/access-token": "^0.4.21", - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cache": "^0.3.2", "@agoric/casting": "^0.4.2", "@agoric/cosmic-proto": "^0.4.0", diff --git a/packages/agoric-cli/src/commands/auction.js b/packages/agoric-cli/src/commands/auction.js index 78e3d8a8515..0b33b7507da 100644 --- a/packages/agoric-cli/src/commands/auction.js +++ b/packages/agoric-cli/src/commands/auction.js @@ -1,11 +1,10 @@ // @ts-check import { InvalidArgumentError } from 'commander'; +import { Fail } from '@endo/errors'; import { makeRpcUtils } from '../lib/rpc.js'; import { outputActionAndHint } from '../lib/wallet.js'; -const { Fail } = assert; - /** * @import {ParamTypesMap, ParamTypesMapFromRecord} from '@agoric/governance/src/contractGovernance/typedParamManager.js' * @import {ParamValueForType} from '@agoric/governance/src/types.js' diff --git a/packages/agoric-cli/src/commands/oracle.js b/packages/agoric-cli/src/commands/oracle.js index cd958fb609c..211b365d5d9 100644 --- a/packages/agoric-cli/src/commands/oracle.js +++ b/packages/agoric-cli/src/commands/oracle.js @@ -1,7 +1,7 @@ // @ts-check /* eslint-disable func-names */ /* global fetch, setTimeout, process */ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { Nat } from '@endo/nat'; import { Command } from 'commander'; diff --git a/packages/agoric-cli/src/commands/test-upgrade.js b/packages/agoric-cli/src/commands/test-upgrade.js index f530b05dd12..ca1aeda4a83 100644 --- a/packages/agoric-cli/src/commands/test-upgrade.js +++ b/packages/agoric-cli/src/commands/test-upgrade.js @@ -1,6 +1,6 @@ // @ts-check /* global process */ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { CommanderError } from 'commander'; import { normalizeAddressWithOptions } from '../lib/chain.js'; import { bigintReplacer } from '../lib/format.js'; diff --git a/packages/agoric-cli/src/deploy.js b/packages/agoric-cli/src/deploy.js index bd324d2206f..71d50f97e62 100644 --- a/packages/agoric-cli/src/deploy.js +++ b/packages/agoric-cli/src/deploy.js @@ -12,6 +12,7 @@ import { whileTrue } from '@agoric/internal'; import { getAccessToken } from '@agoric/access-token'; +import { X } from '@endo/errors'; import { makeBundlePublisher, makeCosmosBundlePublisher, @@ -20,8 +21,6 @@ import { import { makeJsonHttpClient } from './json-http-client-node.js'; import { makeScriptLoader } from './scripts.js'; -const { details: X } = assert; - // note: CapTP has its own HandledPromise instantiation, and the contract // must use the same one that CapTP uses. We achieve this by not bundling // captp, and doing a (non-isolated) dynamic import of the deploy script diff --git a/packages/agoric-cli/src/lib/format.js b/packages/agoric-cli/src/lib/format.js index 9e50c4d6e33..86781d37107 100644 --- a/packages/agoric-cli/src/lib/format.js +++ b/packages/agoric-cli/src/lib/format.js @@ -2,6 +2,8 @@ import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js'; +import { Fail, q } from '@endo/errors'; + /** @import {BoardRemote} from '@agoric/vats/tools/board-utils.js' */ /** @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; */ @@ -71,8 +73,6 @@ export const asPercent = ratio => { return (100 * Number(numerator.value)) / Number(denominator.value); }; -const { Fail, quote: q } = assert; - const isObject = x => typeof x === 'object' && x !== null; /** diff --git a/packages/agoric-cli/src/lib/rpc.js b/packages/agoric-cli/src/lib/rpc.js index 23da41fe7ff..5400c751efb 100644 --- a/packages/agoric-cli/src/lib/rpc.js +++ b/packages/agoric-cli/src/lib/rpc.js @@ -1,7 +1,7 @@ // @ts-check /* global Buffer, fetch, process */ -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { boardSlottingMarshaller, makeBoardRemote, diff --git a/packages/agoric-cli/src/lib/wallet.js b/packages/agoric-cli/src/lib/wallet.js index 610135d2910..e06602e8fc6 100644 --- a/packages/agoric-cli/src/lib/wallet.js +++ b/packages/agoric-cli/src/lib/wallet.js @@ -3,13 +3,13 @@ import { iterateReverse } from '@agoric/casting'; import { makeWalletStateCoalescer } from '@agoric/smart-wallet/src/utils.js'; +import { Fail } from '@endo/errors'; import { execSwingsetTransaction, pollBlocks, pollTx } from './chain.js'; import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js'; /** @import {CurrentWalletRecord} from '@agoric/smart-wallet/src/smartWallet.js' */ /** @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js' */ -const { Fail } = assert; const marshaller = boardSlottingMarshaller(); /** @type {CurrentWalletRecord} */ diff --git a/packages/agoric-cli/src/main.js b/packages/agoric-cli/src/main.js index ad008f927aa..35afa1a8148 100644 --- a/packages/agoric-cli/src/main.js +++ b/packages/agoric-cli/src/main.js @@ -2,7 +2,7 @@ import { Command } from 'commander'; import path from 'path'; import url from 'url'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { DEFAULT_KEEP_POLLING_SECONDS, DEFAULT_JITTER_SECONDS, diff --git a/packages/agoric-cli/src/open.js b/packages/agoric-cli/src/open.js index 7c4318f4ff2..639cda96240 100644 --- a/packages/agoric-cli/src/open.js +++ b/packages/agoric-cli/src/open.js @@ -3,7 +3,7 @@ import opener from 'opener'; import { getAccessToken } from '@agoric/access-token'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; export default async function walletMain(_progname, _rawArgs, powers, opts) { const { anylogger } = powers; diff --git a/packages/agoric-cli/src/publish.js b/packages/agoric-cli/src/publish.js index 248c3adae54..49396802be1 100644 --- a/packages/agoric-cli/src/publish.js +++ b/packages/agoric-cli/src/publish.js @@ -17,33 +17,6 @@ import { fromBech32 } from '@cosmjs/encoding'; import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js'; -// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go -const Agoric = { - Bech32MainPrefix: 'agoric', - CoinType: 564, - proto: { - swingset: { - InstallBundle: { - // matches package agoric.swingset in swingset/msgs.go - typeUrl: '/agoric.swingset.MsgInstallBundle', - }, - }, - }, - // arbitrary fee for installing a bundle - fee: { amount: [], gas: '50000000' }, - // Agoric chain does not use cosmos gas (yet?) - gasPrice: { denom: 'uist', amount: Decimal.fromUserInput('50000000', 0) }, -}; - -const hdPath = (coinType = 118, account = 0) => - stringToPath(`m/44'/${coinType}'/${account}'/0/0`); - -// @ts-expect-error difference in private property _push -const registry = new Registry([ - ...defaultRegistryTypes, - [Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle], -]); - /** * @typedef {object} JsonHttpRequest * @property {string} hostname @@ -83,7 +56,34 @@ const registry = new Registry([ * @typedef {SourceBundle | HashBundle} Bundle */ -const { details: X, quote: q, Fail } = assert; +import { X, q, Fail } from '@endo/errors'; + +// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go +const Agoric = { + Bech32MainPrefix: 'agoric', + CoinType: 564, + proto: { + swingset: { + InstallBundle: { + // matches package agoric.swingset in swingset/msgs.go + typeUrl: '/agoric.swingset.MsgInstallBundle', + }, + }, + }, + // arbitrary fee for installing a bundle + fee: { amount: [], gas: '50000000' }, + // Agoric chain does not use cosmos gas (yet?) + gasPrice: { denom: 'uist', amount: Decimal.fromUserInput('50000000', 0) }, +}; + +const hdPath = (coinType = 118, account = 0) => + stringToPath(`m/44'/${coinType}'/${account}'/0/0`); + +// @ts-expect-error difference in private property _push +const registry = new Registry([ + ...defaultRegistryTypes, + [Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle], +]); /** * @template T diff --git a/packages/agoric-cli/src/sdk-package-names.js b/packages/agoric-cli/src/sdk-package-names.js index 8eab6fa1d8e..416229b115b 100644 --- a/packages/agoric-cli/src/sdk-package-names.js +++ b/packages/agoric-cli/src/sdk-package-names.js @@ -2,7 +2,6 @@ // prettier-ignore export default [ "@agoric/access-token", - "@agoric/assert", "@agoric/async-flow", "@agoric/base-zone", "@agoric/benchmark", diff --git a/packages/agoric-cli/src/set-defaults.js b/packages/agoric-cli/src/set-defaults.js index 74ccc9b7ad0..c0fbd80e3cf 100644 --- a/packages/agoric-cli/src/set-defaults.js +++ b/packages/agoric-cli/src/set-defaults.js @@ -1,5 +1,5 @@ import { basename } from 'path'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { finishCosmosApp, finishTendermintConfig, diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md deleted file mode 100644 index a5248e601e6..00000000000 --- a/packages/assert/CHANGELOG.md +++ /dev/null @@ -1,492 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.6.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.5.1...@agoric/assert@0.6.0) (2023-05-19) - - -### Features - -* **assert:** export assert.Fail from endo ([#6613](https://github.com/Agoric/agoric-sdk/issues/6613)) ([c863b17](https://github.com/Agoric/agoric-sdk/commit/c863b1708393f6102ce8174573aab4207c2ce71f)) - - - -### [0.5.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.5.0...@agoric/assert@0.5.1) (2022-10-05) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.5.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.4.0...@agoric/assert@0.5.0) (2022-09-20) - - -### ⚠ BREAKING CHANGES - -* **store:** split `provide` into collision vs no-collision variants (#6080) - -### Features - -* NonNullish checked cast ([fb81983](https://github.com/Agoric/agoric-sdk/commit/fb81983bde4b9a2d5408a0040522c923f653b6f8)) - - -### Bug Fixes - -* far classes with interface guards, used by ERTP ([#5960](https://github.com/Agoric/agoric-sdk/issues/5960)) ([a8882a1](https://github.com/Agoric/agoric-sdk/commit/a8882a1cef97c9177bf76d04d1a1253d02c7921b)) - - -### Code Refactoring - -* **store:** split `provide` into collision vs no-collision variants ([#6080](https://github.com/Agoric/agoric-sdk/issues/6080)) ([939e25e](https://github.com/Agoric/agoric-sdk/commit/939e25e615ea1fcefff15a032996613031151c0d)), closes [#5875](https://github.com/Agoric/agoric-sdk/issues/5875) - - - -## [0.4.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.16...@agoric/assert@0.4.0) (2022-04-18) - - -### ⚠ BREAKING CHANGES - -* consistent Node engine requirement (>=14.15.0) - -### Miscellaneous Chores - -* consistent Node engine requirement (>=14.15.0) ([ddc40fa](https://github.com/Agoric/agoric-sdk/commit/ddc40fa525f845ed900512c38b99f01458a3d131)) - - - -### [0.3.16](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.15...@agoric/assert@0.3.16) (2022-02-21) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.15](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.14...@agoric/assert@0.3.15) (2021-12-02) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.14](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.13...@agoric/assert@0.3.14) (2021-10-13) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.13](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.12...@agoric/assert@0.3.13) (2021-09-23) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.11...@agoric/assert@0.3.12) (2021-09-15) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.10...@agoric/assert@0.3.11) (2021-08-18) - - -### Bug Fixes - -* **assert:** Improve diagnostic for missing assert global ([#3715](https://github.com/Agoric/agoric-sdk/issues/3715)) ([28a8ad8](https://github.com/Agoric/agoric-sdk/commit/28a8ad8658d7830caee666f1de247752774630a9)) - - - -### [0.3.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.9...@agoric/assert@0.3.10) (2021-08-17) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.6...@agoric/assert@0.3.9) (2021-08-15) - -### 0.26.10 (2021-07-28) - - -### Bug Fixes - -* **assert:** Use module extension for types.js ([7e79e5e](https://github.com/Agoric/agoric-sdk/commit/7e79e5e37f2ae0955e6a205c744bff44cd0bbe57)) - - - -### [0.3.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.6...@agoric/assert@0.3.8) (2021-08-14) - -### 0.26.10 (2021-07-28) - - -### Bug Fixes - -* **assert:** Use module extension for types.js ([7e79e5e](https://github.com/Agoric/agoric-sdk/commit/7e79e5e37f2ae0955e6a205c744bff44cd0bbe57)) - - - -### [0.3.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.6...@agoric/assert@0.3.7) (2021-07-28) - - -### Bug Fixes - -* **assert:** Use module extension for types.js ([7e79e5e](https://github.com/Agoric/agoric-sdk/commit/7e79e5e37f2ae0955e6a205c744bff44cd0bbe57)) - - - -### [0.3.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.5...@agoric/assert@0.3.6) (2021-07-01) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.4...@agoric/assert@0.3.5) (2021-06-28) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.3...@agoric/assert@0.3.4) (2021-06-25) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.2...@agoric/assert@0.3.3) (2021-06-24) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.1...@agoric/assert@0.3.2) (2021-06-23) - -**Note:** Version bump only for package @agoric/assert - - - - - -### [0.3.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.3.0...@agoric/assert@0.3.1) (2021-06-16) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.3.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.12...@agoric/assert@0.3.0) (2021-06-15) - - -### ⚠ BREAKING CHANGES - -* **assert:** Converts `@agoric/assert` from emulated ESM with `node -r esm` to Node.js ESM proper. - -### Features - -* **assert:** RESM to NESM ([d991df7](https://github.com/Agoric/agoric-sdk/commit/d991df7c0b56bd8c7eb0995bddfbd473010a7726)) - - -### Bug Fixes - -* Pin ESM to forked version ([54dbb55](https://github.com/Agoric/agoric-sdk/commit/54dbb55d64d7ff7adb395bc4bd9d1461dd2d3c17)) - - - -## [0.2.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.11...@agoric/assert@0.2.12) (2021-05-10) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.10...@agoric/assert@0.2.11) (2021-05-05) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.9...@agoric/assert@0.2.10) (2021-05-05) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.8...@agoric/assert@0.2.9) (2021-04-22) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.7...@agoric/assert@0.2.8) (2021-04-18) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.6...@agoric/assert@0.2.7) (2021-04-16) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.5...@agoric/assert@0.2.6) (2021-04-07) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.4...@agoric/assert@0.2.5) (2021-04-06) - - -### Bug Fixes - -* update to depend on ses 0.12.5 ([#2718](https://github.com/Agoric/agoric-sdk/issues/2718)) ([08dbe0d](https://github.com/Agoric/agoric-sdk/commit/08dbe0db5ce06944dc92c710865e441a60b31b5b)) -* update to ses 0.12.7, ses-ava 0.1.1 ([#2820](https://github.com/Agoric/agoric-sdk/issues/2820)) ([6d81775](https://github.com/Agoric/agoric-sdk/commit/6d81775715bc80e6033d75cb65edbfb1452b1608)) - - - - - -## [0.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.3...@agoric/assert@0.2.4) (2021-03-24) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.2...@agoric/assert@0.2.3) (2021-03-16) - - -### Bug Fixes - -* make separate 'test:xs' target, remove XS from 'test' target ([b9c1a69](https://github.com/Agoric/agoric-sdk/commit/b9c1a6987093fc8e09e8aba7acd2a1618413bac8)), closes [#2647](https://github.com/Agoric/agoric-sdk/issues/2647) -* properly type assert.typeof(xxx, 'object') ([4958636](https://github.com/Agoric/agoric-sdk/commit/49586365607175fd9f91896a66cf02ad14d93055)) -* upgrade ses to 0.12.3 to avoid console noise ([#2552](https://github.com/Agoric/agoric-sdk/issues/2552)) ([f59f5f5](https://github.com/Agoric/agoric-sdk/commit/f59f5f58d1567bb11710166b1dbc80f25c39a04f)) - - - - - -## [0.2.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.1...@agoric/assert@0.2.2) (2021-02-22) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.2.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.2.0...@agoric/assert@0.2.1) (2021-02-16) - - -### Bug Fixes - -* review comments ([17d7df6](https://github.com/Agoric/agoric-sdk/commit/17d7df6ee06eb5c340500bb5582f985c2993ab19)) -* update '@agoric/assert' types ([3ce7587](https://github.com/Agoric/agoric-sdk/commit/3ce7587d0ba6d7a0f5c51a0cacbdc414eb02891b)) -* use assert rather than FooError constructors ([f860c5b](https://github.com/Agoric/agoric-sdk/commit/f860c5bf5add165a08cb5bd543502857c3f57998)) - - - - - -# [0.2.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.1.0...@agoric/assert@0.2.0) (2020-12-10) - - -### Features - -* **import-bundle:** Preliminary support Endo zip hex bundle format ([#1983](https://github.com/Agoric/agoric-sdk/issues/1983)) ([983681b](https://github.com/Agoric/agoric-sdk/commit/983681bfc4bf512b6bd90806ed9220cd4fefc13c)) - - - - - -# [0.1.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.12-dev.0...@agoric/assert@0.1.0) (2020-11-07) - - -### Bug Fixes - -* coordinate assert typing with SES-shim ([#1972](https://github.com/Agoric/agoric-sdk/issues/1972)) ([ce56e24](https://github.com/Agoric/agoric-sdk/commit/ce56e24eb950f8bdede4e82207b339c3d2e4af58)) - - -### Features - -* **assert:** Thread stack traces to console, add entangled assert ([#1884](https://github.com/Agoric/agoric-sdk/issues/1884)) ([5d4f35f](https://github.com/Agoric/agoric-sdk/commit/5d4f35f901f2ca40a2a4d66dab980a5fe8e575f4)) - - - - - -## [0.0.12-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.11...@agoric/assert@0.0.12-dev.0) (2020-10-19) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.11-dev.2...@agoric/assert@0.0.11) (2020-10-11) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.11-dev.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.11-dev.1...@agoric/assert@0.0.11-dev.2) (2020-09-18) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.11-dev.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.11-dev.0...@agoric/assert@0.0.11-dev.1) (2020-09-18) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.11-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.10...@agoric/assert@0.0.11-dev.0) (2020-09-18) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.9...@agoric/assert@0.0.10) (2020-09-16) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.8...@agoric/assert@0.0.9) (2020-08-31) - - -### Bug Fixes - -* reduce inconsistency among our linting rules ([#1492](https://github.com/Agoric/agoric-sdk/issues/1492)) ([b6b675e](https://github.com/Agoric/agoric-sdk/commit/b6b675e2de110e2af19cad784a66220cab21dacf)) -* seal payload used for quoted details ([#1610](https://github.com/Agoric/agoric-sdk/issues/1610)) ([1acd5ba](https://github.com/Agoric/agoric-sdk/commit/1acd5baa3e7f0185823c929409f8aecddab36a3a)) -* update JS typings ([20941e6](https://github.com/Agoric/agoric-sdk/commit/20941e675302ee5905e4825638e661065ad5d3f9)) - - - - - -## [0.0.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.7...@agoric/assert@0.0.8) (2020-06-30) - - -### Bug Fixes - -* replace openDetail with quoting q ([#1134](https://github.com/Agoric/agoric-sdk/issues/1134)) ([67808a4](https://github.com/Agoric/agoric-sdk/commit/67808a4df515630ef7dc77c59054382f626ece96)) - - - - - -## [0.0.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.6...@agoric/assert@0.0.7) (2020-05-17) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.5...@agoric/assert@0.0.6) (2020-05-10) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.4...@agoric/assert@0.0.5) (2020-05-04) - - -### Bug Fixes - -* use the new (typed) harden package ([2eb1af0](https://github.com/Agoric/agoric-sdk/commit/2eb1af08fe3967629a3ce165752fd501a5c85a96)) -* **assert:** slightly better assert logging ([#919](https://github.com/Agoric/agoric-sdk/issues/919)) ([47b3729](https://github.com/Agoric/agoric-sdk/commit/47b3729aa6b4ebde0d23cf791c5295fcf8f58a00)) - - - - - -## [0.0.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.4-alpha.0...@agoric/assert@0.0.4) (2020-04-13) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.4-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.3...@agoric/assert@0.0.4-alpha.0) (2020-04-12) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.3-alpha.0...@agoric/assert@0.0.3) (2020-04-02) - -**Note:** Version bump only for package @agoric/assert - - - - - -## [0.0.3-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/assert@0.0.2...@agoric/assert@0.0.3-alpha.0) (2020-04-02) - -**Note:** Version bump only for package @agoric/assert - - - - - -## 0.0.2 (2020-03-26) - - -### Bug Fixes - -* remove extra interleaved spaces from assert console.error ([c6af2e4](https://github.com/Agoric/agoric-sdk/commit/c6af2e4abfc28959f70518d7905076270cffcb34)) - - -### Performance Improvements - -* Remove call to `harden` in `details` for performance reasons ([de1f04b](https://github.com/Agoric/agoric-sdk/commit/de1f04b0427af163b0a50cb645d6d676f09b08de)) diff --git a/packages/assert/CONTRIBUTING.md b/packages/assert/CONTRIBUTING.md deleted file mode 100644 index fa94c26fa6f..00000000000 --- a/packages/assert/CONTRIBUTING.md +++ /dev/null @@ -1,49 +0,0 @@ -# Contributing - -Thank you! - -## Contact - -We use github issues for all bug reports: -https://github.com/Agoric/agoric-sdk/issues Please add a [assert] -prefix to the title and `assert` tag to assert-related issues. - -## Installing, Testing - -You'll need Node.js version 11 or higher. - -* `git clone https://github.com/Agoric/agoric-sdk/` -* `cd agoric-sdk` -* `yarn install` -* `yarn build` (This *must* be done at the top level to build all of - the packages) -* `cd packages/assert` -* `yarn test` - -## Pull Requests - -Before submitting a pull request, please: - -* run `yarn test` within `packages/assert` and make sure all the unit - tests pass (running `yarn test` at the top level will test all the - monorepo packages, which can be a good integration test.) -* run `yarn run lint-fix` to reformat the code according to our - `eslint` profile, and fix any complaints that it can't automatically - correct - -## Making a Release - -* edit NEWS.md enumerating any user-visible changes. (If there are - changelogs/ snippets, consolidate them to build the new NEWS - entries, and then delete all the snippets.) -* make sure `yarn config set version-git-tag false` is the current - setting -* `yarn version` (interactive) or `yarn version --major` or `yarn version --minor` - * that changes `package.json` - * and does NOT do a `git commit` and `git tag` -* `git add .` -* `git commit -m "bump version"` -* `git tag -a assert-v$VERSION -m "assert-v$VERSION"` -* `yarn publish --access public` -* `git push` -* `git push origin assert-v$VERSION` diff --git a/packages/assert/NEWS.md b/packages/assert/NEWS.md deleted file mode 100644 index 1cd61fa03a1..00000000000 --- a/packages/assert/NEWS.md +++ /dev/null @@ -1,5 +0,0 @@ -User-visible changes in @agoric/assert: - -## Release 0.0.1 (8-Feb-2020) - -Moved from ERTP and created package `@agoric/assert` diff --git a/packages/assert/README.md b/packages/assert/README.md deleted file mode 100644 index 94098e30122..00000000000 --- a/packages/assert/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# assert - -An assertion library that keeps sensitive data outside of the Error. - -Throw (using provided error message) if expression is false. -Assert that expr is truthy, with an optional details to describe -the assertion. It is a tagged template literal like -```js -assert(expr, details`....`); -``` -If expr is falsy, then the template contents are reported to the -console and also in a thrown error. - -The literal portions of the template are assumed non-sensitive, as -are the `typeof` types of the substitution values. These are -assembled into the thrown error message. The actual contents of the -substitution values are assumed sensitive, to be revealed to the -console only. We assume only the virtual platform's owner can read -what is written to the console, where the owner is in a privileged -position over computation running on that platform. - -The optional `details` can be a string for backwards compatibility -with the nodejs assertion library. diff --git a/packages/assert/package.json b/packages/assert/package.json deleted file mode 100755 index 8562d691c24..00000000000 --- a/packages/assert/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@agoric/assert", - "version": "0.6.0", - "description": "Assert expression support that protects sensitive data", - "type": "module", - "main": "src/assert.js", - "engines": { - "node": "^18.12 || ^20.9" - }, - "scripts": { - "build": "exit 0", - "test": "ava", - "test:nyc": "exit 0", - "test:xs": "exit 0", - "lint-fix": "yarn lint:eslint --fix", - "lint": "run-s --continue-on-error lint:*", - "lint:eslint": "eslint .", - "lint:types": "tsc" - }, - "devDependencies": { - "@endo/init": "^1.1.2", - "ava": "^5.3.0" - }, - "ava": { - "require": [ - "@endo/init/debug.js" - ], - "files": [ - "test/**/*.test.*" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Agoric/agoric-sdk.git" - }, - "keywords": [ - "assert", - "errors" - ], - "author": "Agoric", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/Agoric/agoric-sdk/issues" - }, - "homepage": "https://github.com/Agoric/agoric-sdk#readme", - "files": [ - "src/", - "NEWS.md" - ], - "publishConfig": { - "access": "public" - }, - "typeCoverage": { - "atLeast": 100 - } -} diff --git a/packages/assert/src/assert.js b/packages/assert/src/assert.js deleted file mode 100644 index ed9a43393c7..00000000000 --- a/packages/assert/src/assert.js +++ /dev/null @@ -1,88 +0,0 @@ -/* global globalThis */ -// Copyright (C) 2019 Agoric, under Apache License 2.0 -// @ts-check - -// This module assumes the existence of a non-standard `assert` host object. -// SES version 0.11.0 introduces this global object and entangles it -// with the `console` host object in scope when it initializes, -// allowing errors, particularly assertion errors, to hide their "details" -// from callers that might catch those errors, then reveal them to the -// underlying console. -// To the extent that this `console` is considered a resource, -// this module must be considered a resource module. - -// The assertions re-exported here are defined in -// https://github.com/endojs/endo/blob/HEAD/packages/ses/src/error/assert.js - -// At https://github.com/Agoric/agoric-sdk/issues/2774 -// is a record of a failed attempt to remove '.types'. -// To satisfy CI, not only do we need to keep the file, -// but we need to import it here as well. -/// - -const { freeze } = Object; - -/** @type {import('ses').Assert} */ -const globalAssert = globalThis.assert; - -if (globalAssert === undefined) { - throw Error( - `Cannot initialize @agoric/assert, missing globalThis.assert, import 'ses' before '@agoric/assert'`, - ); -} - -const missing = /** @type {const} */ ([ - 'fail', - 'equal', - 'typeof', - 'string', - 'note', - 'details', - 'Fail', - 'quote', - 'makeAssert', -]).filter(name => globalAssert[name] === undefined); -if (missing.length > 0) { - throw Error( - `Cannot initialize @agoric/assert, missing globalThis.assert methods ${missing.join( - ', ', - )}`, - ); -} - -const { details, Fail, quote, makeAssert } = globalAssert; - -export { globalAssert as assert, details, Fail, quote, quote as q, makeAssert }; - -/** - * @template T - * @param {T | null | undefined} val - * @param {string} [optDetails] - * @returns {T} - */ -export const NonNullish = (val, optDetails = `unexpected ${quote(val)}`) => { - if (val != null) { - // This `!= null` idiom checks that `val` is neither `null` nor `undefined`. - return val; - } - assert.fail(optDetails); -}; -harden(NonNullish); - -/** - * Prepend the correct indefinite article onto a noun, typically a typeof result - * e.g., "an Object" vs. "a Number" - * - * @deprecated - * @param {string} str The noun to prepend - * @returns {string} The noun prepended with a/an - */ -function an(str) { - str = `${str}`; - if (str.length >= 1 && 'aeiouAEIOU'.includes(str[0])) { - return `an ${str}`; - } - return `a ${str}`; -} -freeze(an); -export { an }; diff --git a/packages/assert/src/types-ambient.js b/packages/assert/src/types-ambient.js deleted file mode 100644 index b8064f03108..00000000000 --- a/packages/assert/src/types-ambient.js +++ /dev/null @@ -1,351 +0,0 @@ -// @ts-check -/// - -// Based on -// https://github.com/endojs/endo/blob/HEAD/packages/ses/src/error/types.js -// Coordinate edits until we refactor to avoid this duplication -// At https://github.com/Agoric/agoric-sdk/issues/2774 -// is a record of a failed attempt to remove this duplication. - -/** - * @callback BaseAssert - * The `assert` function itself. - * - * @param {any} flag The truthy/falsy value - * @param {Details} [optDetails] The details to throw - * @param {ErrorConstructor} [ErrorConstructor] An optional alternate error - * constructor to use. - * @returns {asserts flag} - */ - -/** - * @typedef {object} AssertMakeErrorOptions - * @property {string} [errorName] - */ - -/** - * @callback AssertMakeError - * - * The `makeError` function, recording details for the console. - * - * The optional `optDetails` can be a string. - * @param {Details} [optDetails] The details of what was asserted - * @param {ErrorConstructor} [ErrorConstructor] An optional alternate error - * constructor to use. - * @param {AssertMakeErrorOptions} [options] - * @returns {Error} - */ - -/** - * @callback AssertFail - * - * The `assert.fail` method. - * - * Fail an assertion, recording full details to the console and - * raising an exception with a message in which `details` substitution values - * have been masked. - * - * The optional `optDetails` can be a string for backwards compatibility - * with the nodejs assertion library. - * @param {Details} [optDetails] The details of what was asserted - * @param {ErrorConstructor} [ErrorConstructor] An optional alternate error - * constructor to use. - * @returns {never} - */ - -/** - * @callback AssertEqual - * The `assert.equal` method - * - * Assert that two values must be `Object.is`. - * @param {any} actual The value we received - * @param {any} expected What we wanted - * @param {Details} [optDetails] The details to throw - * @param {ErrorConstructor} [ErrorConstructor] An optional alternate error - * constructor to use. - * @returns {void} - */ - -// Type all the overloads of the assertTypeof function. -// There may eventually be a better way to do this, but -// thems the breaks with Typescript 4.0. -/** - * @callback AssertTypeofBigint - * @param {any} specimen - * @param {'bigint'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is bigint} - */ - -/** - * @callback AssertTypeofBoolean - * @param {any} specimen - * @param {'boolean'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is boolean} - */ - -/** - * @callback AssertTypeofFunction - * @param {any} specimen - * @param {'function'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is Function} - */ - -/** - * @callback AssertTypeofNumber - * @param {any} specimen - * @param {'number'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is number} - */ - -/** - * @callback AssertTypeofObject - * @param {any} specimen - * @param {'object'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is Record | null} - */ - -/** - * @callback AssertTypeofString - * @param {any} specimen - * @param {'string'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is string} - */ - -/** - * @callback AssertTypeofSymbol - * @param {any} specimen - * @param {'symbol'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is symbol} - */ - -/** - * @callback AssertTypeofUndefined - * @param {any} specimen - * @param {'undefined'} typename - * @param {Details} [optDetails] - * @returns {asserts specimen is undefined} - */ - -/** - * The `assert.typeof` method - * - * @typedef {AssertTypeofBigint & AssertTypeofBoolean & AssertTypeofFunction & AssertTypeofNumber & AssertTypeofObject & AssertTypeofString & AssertTypeofSymbol & AssertTypeofUndefined} AssertTypeof - */ - -/** - * @callback AssertString - * The `assert.string` method. - * - * `assert.string(v)` is equivalent to `assert.typeof(v, 'string')`. We - * special case this one because it is the most frequently used. - * - * Assert an expected typeof result. - * @param {any} specimen The value to get the typeof - * @param {Details} [optDetails] The details to throw - * @returns {asserts specimen is string} - */ - -/** - * @callback AssertNote - * The `errorNote` function. - * - * Annotate an error with details, potentially to be used by an - * augmented console such as the causal console of `console.js`, to - * provide extra information associated with logged errors. - * - * @param {Error} error - * @param {Details} detailsNote - * @returns {void} - */ - -// ///////////////////////////////////////////////////////////////////////////// - -/** - * @typedef {{}} DetailsToken - * A call to the `details` template literal makes and returns a fresh details - * token, which is a frozen empty object associated with the arguments of that - * `details` template literal expression. - */ - -/** - * @typedef {string | DetailsToken} Details - * Either a plain string, or made by the `details` template literal tag. - */ - -/** - * @typedef {object} StringablePayload - * Holds the payload passed to quote so that its printed form is visible. - * @property {() => string} toString How to print the payload - */ - -/** - * To "declassify" and quote a substitution value used in a - * ``` details`...` ``` template literal, enclose that substitution expression - * in a call to `quote`. This makes the value appear quoted - * (as if with `JSON.stringify`) in the message of the thrown error. The - * payload itself is still passed unquoted to the console as it would be - * without `quote`. - * - * @example - * For example, the following will reveal the expected sky color, but not the - * actual incorrect sky color, in the thrown error's message: - * ```js - * sky.color === expectedColor || Fail`${sky.color} should be ${quote(expectedColor)}`; - * ``` - * @example - * The normal convention is to locally rename `details` to `X` and `quote` to `q` - * like `const { details: X, quote: q } = assert;`, so the above example would then be - * ```js - * sky.color === expectedColor || Fail`${sky.color} should be ${q(expectedColor)}`; - * ``` - * - * @callback AssertQuote - * @param {any} payload What to declassify - * @param {(string|number)} [spaces] - * @returns {StringablePayload} The declassified payload - */ - -/** - * @callback Raise - * - * To make an `assert` which terminates some larger unit of computation - * like a transaction, vat, or process, call `makeAssert` with a `Raise` - * callback, where that callback actually performs that larger termination. - * If possible, the callback should also report its `reason` parameter as - * the alleged reason for the termination. - * - * @param {Error} reason - */ - -/** - * @callback MakeAssert - * - * Makes and returns an `assert` function object that shares the bookkeeping - * state defined by this module with other `assert` function objects made by - * `makeAssert`. This state is per-module-instance and is exposed by the - * `loggedErrorHandler` above. We refer to `assert` as a "function object" - * because it can be called directly as a function, but also has methods that - * can be called. - * - * If `optRaise` is provided, the returned `assert` function object will call - * `optRaise(reason)` before throwing the error. This enables `optRaise` to - * engage in even more violent termination behavior, like terminating the vat, - * that prevents execution from reaching the following throw. However, if - * `optRaise` returns normally, which would be unusual, the throw following - * `optRaise(reason)` would still happen. - * - * @param {Raise} [optRaise] - * @param {boolean} [unredacted] - * @returns {Assert} - */ - -/** - * @typedef {(template: TemplateStringsArray | string[], ...args: any) => DetailsToken} DetailsTag - * - * Use the `details` function as a template literal tag to create - * informative error messages. The assertion functions take such messages - * as optional arguments: - * ```js - * assert(sky.isBlue(), details`${sky.color} should be "blue"`); - * ``` - * or following the normal convention to locally rename `details` to `X` - * and `quote` to `q` like `const { details: X, quote: q } = assert;`: - * ```js - * assert(sky.isBlue(), X`${sky.color} should be "blue"`); - * ``` - * However, note that in most cases it is preferable to instead use the `Fail` - * template literal tag (which has the same input signature as `details` - * but automatically creates and throws an error): - * ```js - * sky.isBlue() || Fail`${sky.color} should be "blue"`; - * ``` - * - * The details template tag returns a `DetailsToken` object that can print - * itself with the formatted message in two ways. - * It will report full details to the console, but - * mask embedded substitution values with their typeof information in the thrown error - * to prevent revealing secrets up the exceptional path. In the example - * above, the thrown error may reveal only that `sky.color` is a string, - * whereas the same diagnostic printed to the console reveals that the - * sky was green. This masking can be disabled for an individual substitution value - * using `quote`. - * - * The `raw` property of an input template array is ignored, so a simple - * array of strings may be provided directly. - */ - -/** - * @typedef {(template: TemplateStringsArray | string[], ...args: any) => never} FailTag - * - * Use the `Fail` function as a template literal tag to efficiently - * create and throw a `details`-style error only when a condition is not satisfied. - * ```js - * condition || Fail`...complaint...`; - * ``` - * This avoids the overhead of creating usually-unnecessary errors like - * ```js - * assert(condition, details`...complaint...`); - * ``` - * while improving readability over alternatives like - * ```js - * condition || assert.fail(details`...complaint...`); - * ``` - * - * However, due to current weakness in TypeScript, static reasoning - * is less powerful with the `||` patterns than with an `assert` call. - * Until/unless https://github.com/microsoft/TypeScript/issues/51426 is fixed, - * for `||`-style assertions where this loss of static reasoning is a problem, - * instead express the assertion as - * ```js - * if (!condition) { - * Fail`...complaint...`; - * } - * ``` - * or, if needed, - * ```js - * if (!condition) { - * // `throw` is noop since `Fail` throws, but it improves static analysis - * throw Fail`...complaint...`; - * } - * ``` - */ - -/** - * assert that expr is truthy, with an optional details to describe - * the assertion. It is a tagged template literal like - * ```js - * assert(expr, details`....`);` - * ``` - * - * The literal portions of the template are assumed non-sensitive, as - * are the `typeof` types of the substitution values. These are - * assembled into the thrown error message. The actual contents of the - * substitution values are assumed sensitive, to be revealed to - * the console only. We assume only the virtual platform's owner can read - * what is written to the console, where the owner is in a privileged - * position over computation running on that platform. - * - * The optional `optDetails` can be a string for backwards compatibility - * with the nodejs assertion library. - * - * @typedef { BaseAssert & { - * typeof: AssertTypeof, - * error: AssertMakeError, - * fail: AssertFail, - * equal: AssertEqual, - * string: AssertString, - * note: AssertNote, - * details: DetailsTag, - * Fail: FailTag, - * quote: AssertQuote, - * bare: AssertQuote, - * makeAssert: MakeAssert, - * } } Assert - */ diff --git a/packages/assert/test/assert.test.js b/packages/assert/test/assert.test.js deleted file mode 100644 index 9e2fa4b36e1..00000000000 --- a/packages/assert/test/assert.test.js +++ /dev/null @@ -1,20 +0,0 @@ -import test from 'ava'; - -import { NonNullish, Fail } from '../src/assert.js'; - -test('NonNullish', t => { - assert.equal(NonNullish('defined'), 'defined'); - t.throws(() => NonNullish(null), { - message: 'unexpected null', - }); - t.throws(() => NonNullish(undefined), { - message: 'unexpected "[undefined]"', - }); -}); - -test('Fail', t => { - t.notThrows(() => true || Fail`Should not be thrown`); - t.throws(() => false || Fail`Should be thrown`, { - message: 'Should be thrown', - }); -}); diff --git a/packages/assert/tsconfig.json b/packages/assert/tsconfig.json deleted file mode 100644 index f6d24d3de00..00000000000 --- a/packages/assert/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -// This file can contain .js-specific Typescript compiler config. -{ - "extends": "../../tsconfig.json", - "include": [ - "src/**/*.js", - "test/**/*.js", - ], -} diff --git a/packages/assert/typedoc.json b/packages/assert/typedoc.json deleted file mode 100644 index e6544ff3b56..00000000000 --- a/packages/assert/typedoc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": [ - "../../typedoc.base.json" - ], - "entryPoints": [ - "src/assert.js", - "src/types.js", - ] -} diff --git a/packages/base-zone/package.json b/packages/base-zone/package.json index 7adeeb7da22..deab47bb793 100644 --- a/packages/base-zone/package.json +++ b/packages/base-zone/package.json @@ -29,6 +29,7 @@ "dependencies": { "@agoric/store": "^0.9.2", "@endo/common": "^1.2.2", + "@endo/errors": "^1.2.2", "@endo/exo": "^1.5.0", "@endo/far": "^1.1.2", "@endo/pass-style": "^1.4.0", diff --git a/packages/base-zone/src/make-once.js b/packages/base-zone/src/make-once.js index e0b6f5d639e..adb01b70cb2 100644 --- a/packages/base-zone/src/make-once.js +++ b/packages/base-zone/src/make-once.js @@ -1,5 +1,5 @@ // @ts-check -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** @param {string} label */ const defaultLabelToKeys = label => harden([label]); diff --git a/packages/base-zone/src/prepare-revocable.js b/packages/base-zone/src/prepare-revocable.js index c59b3eb3cd8..8ef5a34347a 100644 --- a/packages/base-zone/src/prepare-revocable.js +++ b/packages/base-zone/src/prepare-revocable.js @@ -1,7 +1,7 @@ import { M } from '@endo/patterns'; import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** @import {Amplify} from '@endo/exo'; */ diff --git a/packages/base-zone/src/watch-promise.js b/packages/base-zone/src/watch-promise.js index 4693bd98377..0ed2a48d5ce 100644 --- a/packages/base-zone/src/watch-promise.js +++ b/packages/base-zone/src/watch-promise.js @@ -2,7 +2,7 @@ import { M } from '@endo/patterns'; import { E } from '@endo/far'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; const { apply } = Reflect; diff --git a/packages/benchmark/package.json b/packages/benchmark/package.json index 4d3f4e7015d..d9046f8b175 100644 --- a/packages/benchmark/package.json +++ b/packages/benchmark/package.json @@ -22,7 +22,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/boot": "^0.1.0", "@agoric/cosmic-swingset": "^0.41.3", "@agoric/internal": "^0.3.2", diff --git a/packages/benchmark/src/benchmarkerator.js b/packages/benchmark/src/benchmarkerator.js index 57327011ef8..2e40b37b493 100644 --- a/packages/benchmark/src/benchmarkerator.js +++ b/packages/benchmark/src/benchmarkerator.js @@ -6,7 +6,7 @@ import '@endo/init'; import '@agoric/cosmic-swingset/src/launch-chain.js'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { makeAgoricNamesRemotesFromFakeStorage } from '@agoric/vats/tools/board-utils.js'; import { makeSwingsetTestKit } from '@agoric/boot/tools/supports.ts'; diff --git a/packages/boot/package.json b/packages/boot/package.json index 0cbfd4b5ae2..a376630a8a6 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -18,7 +18,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/builders": "^0.1.0", "@agoric/cosmic-proto": "^0.4.0", "@agoric/cosmic-swingset": "^0.41.3", diff --git a/packages/boot/test/bootstrapTests/ibcServerMock.js b/packages/boot/test/bootstrapTests/ibcServerMock.js index 97d9fae7817..96a9c2c1eed 100644 --- a/packages/boot/test/bootstrapTests/ibcServerMock.js +++ b/packages/boot/test/bootstrapTests/ibcServerMock.js @@ -4,7 +4,8 @@ import { Far } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { V as E } from '@agoric/vow/vat.js'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; + const { log } = console; /** diff --git a/packages/boot/test/bootstrapTests/lca.test.ts b/packages/boot/test/bootstrapTests/lca.test.ts index 07020bcf9d4..3ea3ff1477b 100644 --- a/packages/boot/test/bootstrapTests/lca.test.ts +++ b/packages/boot/test/bootstrapTests/lca.test.ts @@ -2,7 +2,7 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import type { TestFn } from 'ava'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import type { start as stakeBldStart } from '@agoric/orchestration/src/examples/stakeBld.contract.js'; import type { Instance } from '@agoric/zoe/src/zoeService/utils.js'; import { diff --git a/packages/boot/test/bootstrapTests/liquidation-1.test.ts b/packages/boot/test/bootstrapTests/liquidation-1.test.ts index b9922456dc0..d25bec16d8d 100644 --- a/packages/boot/test/bootstrapTests/liquidation-1.test.ts +++ b/packages/boot/test/bootstrapTests/liquidation-1.test.ts @@ -1,7 +1,7 @@ /** @file Bootstrap test of liquidation across multiple collaterals */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import process from 'process'; import type { ExecutionContext, TestFn } from 'ava'; import type { ScheduleNotification } from '@agoric/inter-protocol/src/auction/scheduler.js'; diff --git a/packages/boot/test/bootstrapTests/liquidation-2b.test.ts b/packages/boot/test/bootstrapTests/liquidation-2b.test.ts index e9c0bc2a361..09996a313f9 100644 --- a/packages/boot/test/bootstrapTests/liquidation-2b.test.ts +++ b/packages/boot/test/bootstrapTests/liquidation-2b.test.ts @@ -8,7 +8,7 @@ */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import type { TestFn } from 'ava'; import { ScheduleNotification } from '@agoric/inter-protocol/src/auction/scheduler.js'; diff --git a/packages/boot/test/bootstrapTests/liquidation-concurrent-1.test.ts b/packages/boot/test/bootstrapTests/liquidation-concurrent-1.test.ts index e6ee036f4fb..1a7fa875e0c 100644 --- a/packages/boot/test/bootstrapTests/liquidation-concurrent-1.test.ts +++ b/packages/boot/test/bootstrapTests/liquidation-concurrent-1.test.ts @@ -2,7 +2,7 @@ /** @file Bootstrap test of liquidation across multiple collaterals */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import process from 'process'; import { TestFn } from 'ava'; import { diff --git a/packages/boot/test/bootstrapTests/liquidation-concurrent-2b.test.ts b/packages/boot/test/bootstrapTests/liquidation-concurrent-2b.test.ts index 19677638b5b..21f8f7bf394 100644 --- a/packages/boot/test/bootstrapTests/liquidation-concurrent-2b.test.ts +++ b/packages/boot/test/bootstrapTests/liquidation-concurrent-2b.test.ts @@ -8,7 +8,7 @@ */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { ExecutionContext, TestFn } from 'ava'; import { LiquidationTestContext, diff --git a/packages/boot/test/bootstrapTests/orchestration.test.ts b/packages/boot/test/bootstrapTests/orchestration.test.ts index d5fc69792bb..4d1332b492b 100644 --- a/packages/boot/test/bootstrapTests/orchestration.test.ts +++ b/packages/boot/test/bootstrapTests/orchestration.test.ts @@ -1,6 +1,6 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import type { CosmosValidatorAddress } from '@agoric/orchestration'; import type { start as startStakeIca } from '@agoric/orchestration/src/examples/stakeIca.contract.js'; diff --git a/packages/boot/test/bootstrapTests/vats-restart.test.ts b/packages/boot/test/bootstrapTests/vats-restart.test.ts index b23c5f61ee0..1d833861dd2 100644 --- a/packages/boot/test/bootstrapTests/vats-restart.test.ts +++ b/packages/boot/test/bootstrapTests/vats-restart.test.ts @@ -10,14 +10,13 @@ import { makeAgoricNamesRemotesFromFakeStorage } from '@agoric/vats/tools/board- import { TestFn } from 'ava'; import { BridgeHandler, ScopedBridgeManager } from '@agoric/vats'; import type { EconomyBootstrapSpace } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; +import { Fail } from '@endo/errors'; import { makeProposalExtractor, makeSwingsetTestKit, } from '../../tools/supports.ts'; import { makeWalletFactoryDriver } from '../../tools/drivers.ts'; -const { Fail } = assert; - // main/production config doesn't have initialPrice, upon which 'open vaults' depends const PLATFORM_CONFIG = '@agoric/vm-config/decentral-itest-vaults-config.json'; diff --git a/packages/boot/test/bootstrapTests/vaults-integration.test.ts b/packages/boot/test/bootstrapTests/vaults-integration.test.ts index b6f24417e36..745ee271977 100644 --- a/packages/boot/test/bootstrapTests/vaults-integration.test.ts +++ b/packages/boot/test/bootstrapTests/vaults-integration.test.ts @@ -1,7 +1,7 @@ /** @file Bootstrap test integration vaults with smart-wallet */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { SECONDS_PER_DAY } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; diff --git a/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts b/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts index 1013619428c..f01c54b87a2 100644 --- a/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts +++ b/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts @@ -7,7 +7,7 @@ */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { Far, makeMarshal } from '@endo/marshal'; import { SECONDS_PER_YEAR } from '@agoric/inter-protocol/src/interest.js'; diff --git a/packages/boot/test/bootstrapTests/walletFactory.ts b/packages/boot/test/bootstrapTests/walletFactory.ts index 7fed8e4e8eb..ca78e198672 100644 --- a/packages/boot/test/bootstrapTests/walletFactory.ts +++ b/packages/boot/test/bootstrapTests/walletFactory.ts @@ -2,11 +2,10 @@ import { AgoricNamesRemotes, makeAgoricNamesRemotesFromFakeStorage, } from '@agoric/vats/tools/board-utils.js'; +import { Fail } from '@endo/errors'; import { makeSwingsetTestKit } from '../../tools/supports.ts'; import { makeWalletFactoryDriver } from '../../tools/drivers.ts'; -const { Fail } = assert; - export const makeWalletFactoryContext = async ( t, configSpecifier = '@agoric/vm-config/decentral-main-vaults-config.json', diff --git a/packages/boot/test/upgrading/upgrade-vats.test.js b/packages/boot/test/upgrading/upgrade-vats.test.js index 8ffbfb84f87..6488566ef26 100644 --- a/packages/boot/test/upgrading/upgrade-vats.test.js +++ b/packages/boot/test/upgrading/upgrade-vats.test.js @@ -6,6 +6,7 @@ import { BridgeId } from '@agoric/internal'; import { buildVatController } from '@agoric/swingset-vat'; import { makeRunUtils } from '@agoric/swingset-vat/tools/run-utils.js'; import { resolve as importMetaResolve } from 'import-meta-resolve'; +import { Fail } from '@endo/errors'; import { matchAmount, matchIter, matchRef } from '../../tools/supports.ts'; /** @@ -13,8 +14,6 @@ import { matchAmount, matchIter, matchRef } from '../../tools/supports.ts'; */ const test = anyTest; -const { Fail } = assert; - const bfile = name => new URL(name, import.meta.url).pathname; const importSpec = spec => importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname); diff --git a/packages/boot/tools/authorityViz.js b/packages/boot/tools/authorityViz.js index 62ecfff0573..b7d382eaea0 100755 --- a/packages/boot/tools/authorityViz.js +++ b/packages/boot/tools/authorityViz.js @@ -3,6 +3,8 @@ import '@endo/init'; import process from 'process'; +import { Fail, q } from '@endo/errors'; + const { entries, keys, values } = Object; const logged = label => x => { @@ -199,8 +201,6 @@ const manifest2graph = manifest => { return { nodes, neighbors }; }; -const { Fail, quote: q } = assert; - /** * @param {string} specifier * @param {object} io diff --git a/packages/boot/tools/drivers.ts b/packages/boot/tools/drivers.ts index 431edc437b3..9a6c2c3a8e4 100644 --- a/packages/boot/tools/drivers.ts +++ b/packages/boot/tools/drivers.ts @@ -1,5 +1,5 @@ /* eslint-disable jsdoc/require-param */ -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { SECONDS_PER_MINUTE } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; diff --git a/packages/boot/tools/liquidation.ts b/packages/boot/tools/liquidation.ts index 2e88d7d56e9..7a106d058a5 100644 --- a/packages/boot/tools/liquidation.ts +++ b/packages/boot/tools/liquidation.ts @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { SECONDS_PER_HOUR, SECONDS_PER_MINUTE, diff --git a/packages/boot/tools/supports.ts b/packages/boot/tools/supports.ts index f5ba1c82b6a..ff2376918bf 100644 --- a/packages/boot/tools/supports.ts +++ b/packages/boot/tools/supports.ts @@ -7,7 +7,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { basename, join } from 'path'; import { inspect } from 'util'; -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { buildSwingset } from '@agoric/cosmic-swingset/src/launch-chain.js'; import { BridgeId, VBankAccount, makeTracer } from '@agoric/internal'; import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; diff --git a/packages/builders/package.json b/packages/builders/package.json index 0acd618d6c7..b3743b4052a 100644 --- a/packages/builders/package.json +++ b/packages/builders/package.json @@ -41,7 +41,7 @@ "import-meta-resolve": "^2.2.1" }, "devDependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/deploy-script-support": "^0.10.3", "@agoric/governance": "^0.10.3", "@agoric/inter-protocol": "^0.16.1", diff --git a/packages/casting/package.json b/packages/casting/package.json index 1b5fee77acb..30cd54a6831 100644 --- a/packages/casting/package.json +++ b/packages/casting/package.json @@ -29,6 +29,7 @@ "@cosmjs/proto-signing": "^0.32.3", "@cosmjs/stargate": "^0.32.3", "@cosmjs/tendermint-rpc": "^0.32.3", + "@endo/errors": "^1.2.2", "@endo/far": "^1.1.2", "@endo/init": "^1.1.2", "@endo/lockdown": "^1.0.7", diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index 0e0bad948cd..9f6b3e8aac1 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -6,6 +6,7 @@ import * as stargateStar from '@cosmjs/stargate'; import { isStreamCell } from '@agoric/internal/src/lib-chainStorage.js'; +import { X, q, Fail } from '@endo/errors'; import { MAKE_DEFAULT_DECODER, MAKE_DEFAULT_UNSERIALIZER } from './defaults.js'; import { makeCastingSpec } from './casting-spec.js'; import { makeLeader as defaultMakeLeader } from './leader-netconfig.js'; @@ -21,7 +22,6 @@ harden({ const { QueryClient } = stargateStar; const { Tendermint34Client } = tendermint34; -const { details: X, quote: q, Fail } = assert; const textDecoder = new TextDecoder(); /** @template T @typedef {import('./types.js').Follower>} ValueFollower */ @@ -264,7 +264,7 @@ export const makeCosmjsFollower = ( return; } crash( - assert.error( + makeError( X`Alleged value ${alleged.value} did not match proof ${proven.value}`, ), ); diff --git a/packages/casting/src/leader-netconfig.js b/packages/casting/src/leader-netconfig.js index 9a6d4c66ff8..dd3a41f6fdf 100644 --- a/packages/casting/src/leader-netconfig.js +++ b/packages/casting/src/leader-netconfig.js @@ -1,4 +1,5 @@ /* global fetch */ +import { Fail } from '@endo/errors'; import { makeRoundRobinLeader } from './leader.js'; import { DEFAULT_BOOTSTRAP, @@ -7,8 +8,6 @@ import { } from './defaults.js'; import { assertNetworkConfig } from './netconfig.js'; -const { Fail } = assert; - /** * @param {string[]} rpcAddrs * @param {import('./types.js').LeaderOptions} [leaderOptions] diff --git a/packages/cosmic-swingset/package.json b/packages/cosmic-swingset/package.json index f60ec2e7204..ce99220035c 100644 --- a/packages/cosmic-swingset/package.json +++ b/packages/cosmic-swingset/package.json @@ -22,7 +22,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/builders": "^0.1.0", "@agoric/cosmos": "^0.34.1", "@agoric/deploy-script-support": "^0.10.3", diff --git a/packages/cosmic-swingset/src/chain-main.js b/packages/cosmic-swingset/src/chain-main.js index 29766494c3e..2280f79eb28 100644 --- a/packages/cosmic-swingset/src/chain-main.js +++ b/packages/cosmic-swingset/src/chain-main.js @@ -18,7 +18,7 @@ import { exportMailbox, } from '@agoric/swingset-vat/src/devices/mailbox/mailbox.js'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { makeSlogSender, tryFlushSlogSender } from '@agoric/telemetry'; import { diff --git a/packages/cosmic-swingset/src/export-kernel-db.js b/packages/cosmic-swingset/src/export-kernel-db.js index c7053fee374..9149ca96336 100755 --- a/packages/cosmic-swingset/src/export-kernel-db.js +++ b/packages/cosmic-swingset/src/export-kernel-db.js @@ -11,7 +11,7 @@ import pathPower from 'path'; import { fileURLToPath } from 'url'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { makeShutdown } from '@agoric/internal/src/node/shutdown.js'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import { makeSwingStoreExporter } from '@agoric/swing-store'; diff --git a/packages/cosmic-swingset/src/export-storage.js b/packages/cosmic-swingset/src/export-storage.js index 6844d70f4c6..a96f91ccc84 100644 --- a/packages/cosmic-swingset/src/export-storage.js +++ b/packages/cosmic-swingset/src/export-storage.js @@ -1,6 +1,6 @@ import * as STORAGE_PATH from '@agoric/internal/src/chain-storage-paths.js'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * Export any specified storage subtrees, then delete the ones marked to clear. diff --git a/packages/cosmic-swingset/src/helpers/bufferedStorage.js b/packages/cosmic-swingset/src/helpers/bufferedStorage.js index 4b5a4dfc85b..1b58c69b1b4 100644 --- a/packages/cosmic-swingset/src/helpers/bufferedStorage.js +++ b/packages/cosmic-swingset/src/helpers/bufferedStorage.js @@ -1,6 +1,6 @@ // @ts-check -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // XXX Do these "StorageAPI" functions belong in their own package? diff --git a/packages/cosmic-swingset/src/helpers/make-queue.js b/packages/cosmic-swingset/src/helpers/make-queue.js index b70d649f80e..da54e279eeb 100644 --- a/packages/cosmic-swingset/src/helpers/make-queue.js +++ b/packages/cosmic-swingset/src/helpers/make-queue.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * @typedef {object} QueueStorage diff --git a/packages/cosmic-swingset/src/import-kernel-db.js b/packages/cosmic-swingset/src/import-kernel-db.js index c804bea19f7..cc77e6b4109 100755 --- a/packages/cosmic-swingset/src/import-kernel-db.js +++ b/packages/cosmic-swingset/src/import-kernel-db.js @@ -12,7 +12,7 @@ import fsPromisesPower from 'fs/promises'; import pathPower from 'path'; import BufferLineTransform from '@agoric/internal/src/node/buffer-line-transform.js'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { importSwingStore, openSwingStore } from '@agoric/swing-store'; import { isEntrypoint } from './helpers/is-entrypoint.js'; diff --git a/packages/cosmic-swingset/src/launch-chain.js b/packages/cosmic-swingset/src/launch-chain.js index c521e79bdbf..09b87eb2eaf 100644 --- a/packages/cosmic-swingset/src/launch-chain.js +++ b/packages/cosmic-swingset/src/launch-chain.js @@ -24,7 +24,7 @@ import { loadSwingsetConfigFile, } from '@agoric/swingset-vat'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { openSwingStore } from '@agoric/swing-store'; import { BridgeId as BRIDGE_ID } from '@agoric/internal'; import { makeWithQueue } from '@agoric/internal/src/queue.js'; diff --git a/packages/cosmic-swingset/src/params.js b/packages/cosmic-swingset/src/params.js index 3baa75b915c..f3a57b03749 100644 --- a/packages/cosmic-swingset/src/params.js +++ b/packages/cosmic-swingset/src/params.js @@ -1,7 +1,7 @@ // @ts-check // @jessie-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Nat, isNat } from '@endo/nat'; export const stringToNat = s => { diff --git a/packages/cosmic-swingset/src/sim-chain.js b/packages/cosmic-swingset/src/sim-chain.js index 19a0a09b4dc..c2f1e399562 100644 --- a/packages/cosmic-swingset/src/sim-chain.js +++ b/packages/cosmic-swingset/src/sim-chain.js @@ -11,7 +11,7 @@ import anylogger from 'anylogger'; import { makeSlogSender } from '@agoric/telemetry'; import { resolve as importMetaResolve } from 'import-meta-resolve'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makeWithQueue } from '@agoric/internal/src/queue.js'; import { makeBatchedDeliver } from '@agoric/internal/src/batched-deliver.js'; import stringify from './helpers/json-stable-stringify.js'; diff --git a/packages/deploy-script-support/package.json b/packages/deploy-script-support/package.json index 6459ae3226b..57b4443dda5 100644 --- a/packages/deploy-script-support/package.json +++ b/packages/deploy-script-support/package.json @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/ertp": "^0.16.2", "@agoric/import-manager": "^0.3.11", "@agoric/internal": "^0.3.2", diff --git a/packages/deploy-script-support/src/assertOfferResult.js b/packages/deploy-script-support/src/assertOfferResult.js index 0da39b6d91b..c9762db189f 100644 --- a/packages/deploy-script-support/src/assertOfferResult.js +++ b/packages/deploy-script-support/src/assertOfferResult.js @@ -1,5 +1,5 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; /** diff --git a/packages/deploy-script-support/src/cachedBundleSpec.js b/packages/deploy-script-support/src/cachedBundleSpec.js index 5ad7cd89ba7..e306ec3639a 100644 --- a/packages/deploy-script-support/src/cachedBundleSpec.js +++ b/packages/deploy-script-support/src/cachedBundleSpec.js @@ -1,4 +1,4 @@ -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @param {string} cacheDir diff --git a/packages/deploy-script-support/src/endo-pieces-contract.js b/packages/deploy-script-support/src/endo-pieces-contract.js index 715000aa415..44684303a79 100644 --- a/packages/deploy-script-support/src/endo-pieces-contract.js +++ b/packages/deploy-script-support/src/endo-pieces-contract.js @@ -3,7 +3,7 @@ import { E, Far } from '@endo/far'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { ZipWriter } from '@endo/zip'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; export const start = () => { /** @type { Map} */ diff --git a/packages/deploy-script-support/src/extract-proposal.js b/packages/deploy-script-support/src/extract-proposal.js index 1ebf8519232..3adc55fac4c 100644 --- a/packages/deploy-script-support/src/extract-proposal.js +++ b/packages/deploy-script-support/src/extract-proposal.js @@ -4,6 +4,7 @@ import fs from 'fs'; import { createRequire } from 'module'; import path from 'path'; +import { Fail } from '@endo/errors'; import { defangAndTrim, stringify } from './code-gen.js'; import { makeCoreProposalBehavior, @@ -19,8 +20,6 @@ import { * @typedef {ConfigProposal[] | SequentialCoreProposals} CoreProposals */ -const { Fail } = assert; - const req = createRequire(import.meta.url); /** diff --git a/packages/deploy-script-support/src/offer.js b/packages/deploy-script-support/src/offer.js index 3c03908c865..8944f1ae512 100644 --- a/packages/deploy-script-support/src/offer.js +++ b/packages/deploy-script-support/src/offer.js @@ -1,6 +1,6 @@ // @ts-check import { E } from '@endo/far'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; // Avoid pulling in too many dependencies like notifiers import { AmountMath } from '@agoric/ertp/src/amountMath.js'; diff --git a/packages/deploy-script-support/src/startInstance.js b/packages/deploy-script-support/src/startInstance.js index 1117357cca5..b387f4d8072 100644 --- a/packages/deploy-script-support/src/startInstance.js +++ b/packages/deploy-script-support/src/startInstance.js @@ -1,5 +1,5 @@ // @ts-check -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { E, passStyleOf } from '@endo/far'; /** @import {Petname} from '@agoric/deploy-script-support/src/externalTypes.js' */ diff --git a/packages/deployment/package.json b/packages/deployment/package.json index 193807d9f18..818744b2ce0 100644 --- a/packages/deployment/package.json +++ b/packages/deployment/package.json @@ -19,7 +19,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@endo/init": "^1.1.2", "@endo/marshal": "^1.5.0", "better-sqlite3": "^9.1.1", diff --git a/packages/deployment/src/files.js b/packages/deployment/src/files.js index 617817c1799..e7d8cf0bc1c 100644 --- a/packages/deployment/src/files.js +++ b/packages/deployment/src/files.js @@ -2,7 +2,7 @@ import { promisify } from 'util'; import { Readable } from 'stream'; import chalk from 'chalk'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; const { freeze } = Object; diff --git a/packages/deployment/src/init.js b/packages/deployment/src/init.js index 5e6e926517a..df9fcd7c316 100644 --- a/packages/deployment/src/init.js +++ b/packages/deployment/src/init.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { isObject } from '@endo/marshal'; import { PLAYBOOK_WRAPPER, SSH_TYPE } from './setup.js'; import { shellEscape } from './run.js'; diff --git a/packages/deployment/src/main.js b/packages/deployment/src/main.js index ed5e48a6450..f550e9a37d7 100644 --- a/packages/deployment/src/main.js +++ b/packages/deployment/src/main.js @@ -3,7 +3,7 @@ import djson from 'deterministic-json'; import { createHash } from 'crypto'; import chalk from 'chalk'; import parseArgs from 'minimist'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { doInit } from './init.js'; import { shellMetaRegexp, shellEscape } from './run.js'; import { streamFromString } from './files.js'; diff --git a/packages/deployment/src/run.js b/packages/deployment/src/run.js index c6d20e228e7..f511d0bc095 100644 --- a/packages/deployment/src/run.js +++ b/packages/deployment/src/run.js @@ -1,6 +1,6 @@ import { Writable } from 'stream'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; const { freeze } = Object; diff --git a/packages/governance/package.json b/packages/governance/package.json index 6b80a7efcfa..140c98c5c6f 100644 --- a/packages/governance/package.json +++ b/packages/governance/package.json @@ -31,7 +31,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", "@agoric/notifier": "^0.6.2", diff --git a/packages/governance/src/binaryVoteCounter.js b/packages/governance/src/binaryVoteCounter.js index 807e0d46258..0f3cdb1a3f5 100644 --- a/packages/governance/src/binaryVoteCounter.js +++ b/packages/governance/src/binaryVoteCounter.js @@ -2,6 +2,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { makeExo, keyEQ, makeScalarMapStore } from '@agoric/store'; import { E } from '@endo/eventual-send'; +import { Fail } from '@endo/errors'; import { buildQuestion, ChoiceMethod, @@ -20,8 +21,6 @@ import { makeQuorumCounter } from './quorumCounter.js'; * @import {BuildVoteCounter, OutcomeRecord, Position, QuestionSpec, VoteStatistics} from './types.js'; */ -const { Fail } = assert; - const validateBinaryQuestionSpec = questionSpec => { coerceQuestionSpec(questionSpec); diff --git a/packages/governance/src/contractGovernance/assertions.js b/packages/governance/src/contractGovernance/assertions.js index 1e2ede685bb..2ded5b3e009 100644 --- a/packages/governance/src/contractGovernance/assertions.js +++ b/packages/governance/src/contractGovernance/assertions.js @@ -3,7 +3,7 @@ import { assertIsRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; import { mustMatch } from '@agoric/store'; import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; const makeLooksLikeBrand = name => { /** @param {Brand} brand */ diff --git a/packages/governance/src/contractGovernance/governApi.js b/packages/governance/src/contractGovernance/governApi.js index e13debafc73..1f30f040a47 100644 --- a/packages/governance/src/contractGovernance/governApi.js +++ b/packages/governance/src/contractGovernance/governApi.js @@ -2,6 +2,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { keyEQ } from '@agoric/store'; +import { Fail, q } from '@endo/errors'; import { ChoiceMethod, QuorumRule, @@ -14,8 +15,6 @@ import { * @import {Position, ApiGovernor, ApiInvocationIssue, PoserFacet, VoteOnApiInvocation} from '../types.js'; */ -const { Fail, quote: q } = assert; - /** * Make a pair of positions for a question about whether to invoke an API. If * the vote passes, the method will be called on the governedApis facet with the diff --git a/packages/governance/src/contractGovernance/governParam.js b/packages/governance/src/contractGovernance/governParam.js index 789a441d32a..16e85db839e 100644 --- a/packages/governance/src/contractGovernance/governParam.js +++ b/packages/governance/src/contractGovernance/governParam.js @@ -2,6 +2,7 @@ import { E } from '@endo/eventual-send'; import { deeplyFulfilled, Far } from '@endo/marshal'; import { mustMatch, keyEQ } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { ChoiceMethod, coerceQuestionSpec, @@ -14,8 +15,6 @@ import { ParamChangesQuestionDetailsShape } from '../typeGuards.js'; * @import {ParamValue, ParamChangePositions, QuestionSpec, ChangeParamsPosition, ParamChangeIssue, ParamGovernor, ParamManagerRetriever, PoserFacet, VoteOnParamChanges} from '../types.js'; */ -const { Fail } = assert; - /** * The electorate that governs changes to the contract's parameters. It must be * declared in the governed contract. diff --git a/packages/governance/src/contractGovernance/paramManager.js b/packages/governance/src/contractGovernance/paramManager.js index 28d417fd481..895298017f0 100644 --- a/packages/governance/src/contractGovernance/paramManager.js +++ b/packages/governance/src/contractGovernance/paramManager.js @@ -5,6 +5,7 @@ import { Nat } from '@endo/nat'; import { keyEQ, makeScalarMapStore } from '@agoric/store'; import { E } from '@endo/eventual-send'; import { assertAllDefined } from '@agoric/internal'; +import { Fail, q } from '@endo/errors'; import { ParamTypes } from '../constants.js'; import { @@ -21,8 +22,6 @@ import { CONTRACT_ELECTORATE } from './governParam.js'; * @import {AnyParamManager, GovernanceSubscriptionState, ParamManagerBase, ParamStateRecord, ParamValueTyped, UpdateParams} from '../types.js'; */ -const { Fail, quote: q } = assert; - /** * @param {ParamManagerBase} paramManager * @param {{[CONTRACT_ELECTORATE]: ParamValueTyped<'invitation'>}} governedParams diff --git a/packages/governance/src/contractGovernance/typedParamManager.js b/packages/governance/src/contractGovernance/typedParamManager.js index 57871b2f5de..cc6f82e732c 100644 --- a/packages/governance/src/contractGovernance/typedParamManager.js +++ b/packages/governance/src/contractGovernance/typedParamManager.js @@ -1,10 +1,9 @@ import { E } from '@endo/eventual-send'; +import { Fail, q } from '@endo/errors'; import { ParamTypes } from '../constants.js'; import { CONTRACT_ELECTORATE } from './governParam.js'; import { makeParamManagerBuilder } from './paramManager.js'; -const { Fail, quote: q } = assert; - /** * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, ParamManagerBase, ParamStateRecord, ParamValueForType, UpdateParams} from '../types.js'; * @import {ParamType} from '../constants.js'; diff --git a/packages/governance/src/contractGovernor.js b/packages/governance/src/contractGovernor.js index 90575ef2fdf..1d1f2158734 100644 --- a/packages/governance/src/contractGovernor.js +++ b/packages/governance/src/contractGovernor.js @@ -3,6 +3,7 @@ import { E } from '@endo/eventual-send'; import { makeTracer } from '@agoric/internal'; import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js'; +import { Fail } from '@endo/errors'; import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; import { prepareContractGovernorKit } from './contractGovernorKit.js'; import { ParamChangesQuestionDetailsShape } from './typeGuards.js'; @@ -11,8 +12,6 @@ import { ParamChangesQuestionDetailsShape } from './typeGuards.js'; * @import {GovernableStartFn, GovernorCreatorFacet, GovernorPublic, ParamChangeIssueDetails} from './types.js'; */ -const { Fail } = assert; - const trace = makeTracer('CGov', false); /** @type {ContractMeta} */ diff --git a/packages/governance/src/contractGovernorKit.js b/packages/governance/src/contractGovernorKit.js index b7b6abe8e5b..02016b36607 100644 --- a/packages/governance/src/contractGovernorKit.js +++ b/packages/governance/src/contractGovernorKit.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { UnguardedHelperI, makeTracer } from '@agoric/internal'; import { M, prepareExoClassKit } from '@agoric/vat-data'; import { E } from '@endo/eventual-send'; diff --git a/packages/governance/src/contractHelper.js b/packages/governance/src/contractHelper.js index f03112e29ab..017595e8219 100644 --- a/packages/governance/src/contractHelper.js +++ b/packages/governance/src/contractHelper.js @@ -6,6 +6,7 @@ import { M } from '@agoric/store'; import { AmountShape, BrandShape } from '@agoric/ertp'; import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time'; import { E } from '@endo/eventual-send'; +import { Fail } from '@endo/errors'; import { makeParamManagerFromTerms } from './contractGovernance/typedParamManager.js'; import { GovernorFacetShape } from './typeGuards.js'; import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; @@ -14,8 +15,6 @@ import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, GovernanceSubscriptionState, GovernanceTerms, GovernedApis, GovernedCreatorFacet, GovernedPublicFacet} from './types.js'; */ -const { Fail } = assert; - export const GOVERNANCE_STORAGE_KEY = 'governance'; const publicMixinAPI = harden({ diff --git a/packages/governance/src/multiCandidateVoteCounter.js b/packages/governance/src/multiCandidateVoteCounter.js index 15cf17ee238..e13060440b4 100644 --- a/packages/governance/src/multiCandidateVoteCounter.js +++ b/packages/governance/src/multiCandidateVoteCounter.js @@ -1,6 +1,7 @@ import { keyEQ, makeExo, makeScalarMapStore } from '@agoric/store'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; +import { Fail } from '@endo/errors'; import { buildQuestion, ChoiceMethod, @@ -21,8 +22,6 @@ import { breakTie } from './breakTie.js'; * @import {QuestionSpec, BuildMultiVoteCounter, MultiOutcomeRecord, Position, VoteStatistics} from './types.js'; */ -const { Fail } = assert; - const validateQuestionSpec = questionSpec => { coerceQuestionSpec(questionSpec); diff --git a/packages/governance/src/validators.js b/packages/governance/src/validators.js index 04b358ff1a4..818612df02e 100644 --- a/packages/governance/src/validators.js +++ b/packages/governance/src/validators.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, AssertContractGovernance, AssertContractElectorate} from './types.js'; diff --git a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js index 71e50968aba..887d9cd93c4 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js +++ b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js @@ -3,6 +3,7 @@ import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { q } from '@endo/errors'; import { ChoiceMethod, ElectionType, @@ -15,8 +16,6 @@ import { remoteNullMarshaller } from '../utils.js'; * @import {QuestionDetails} from '../../../src/types.js'; */ -const { quote: q } = assert; - const makeVoterVat = async (log, vats, zoe) => { const voterCreator = E(vats.voter).build(zoe); log(`=> voter vat is set up`); diff --git a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js index 25ce219568b..b694a901078 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js +++ b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js @@ -7,7 +7,7 @@ import { Far } from '@endo/marshal'; * @import {CommitteeElectoratePublic, Issue} from '../../../src/types.js'; */ -const { quote: q } = assert; +import { q } from '@endo/errors'; /** * @param {(msg: any)=> void} log diff --git a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js index 47952e64665..2e6abf7d870 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js +++ b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js @@ -4,6 +4,7 @@ import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { q } from '@endo/errors'; import { assertContractElectorate, CONTRACT_ELECTORATE, @@ -15,8 +16,6 @@ import { makeTerms, MALLEABLE_NUMBER } from './governedContract.js'; * @import {ContractGovernanceVoteResult, GovernedPublicFacetMethods, GovernorCreatorFacet, ParamChangesSpec, QuestionDetails, SimpleIssue, StandardParamPath} from '../../../src/types.js'; */ -const { quote: q } = assert; - /** * @param {ERef} zoe * @param {(string:string) => undefined} log diff --git a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js index a165f474cf8..ffd5243509f 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js +++ b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js @@ -1,6 +1,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { q } from '@endo/errors'; import { assertContractElectorate, assertContractGovernance, @@ -10,8 +11,6 @@ import { } from '../../../src/index.js'; import { MALLEABLE_NUMBER } from './governedContract.js'; -const { quote: q } = assert; - const build = async (log, zoe) => { return Far('voter', { createVoter: async (name, invitation) => { diff --git a/packages/governance/tools/puppetContractGovernor.js b/packages/governance/tools/puppetContractGovernor.js index d4edd79883b..162fd7d11be 100644 --- a/packages/governance/tools/puppetContractGovernor.js +++ b/packages/governance/tools/puppetContractGovernor.js @@ -1,7 +1,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; // eslint-disable-next-line no-unused-vars -- used by typedef import { CONTRACT_ELECTORATE } from '../src/contractGovernance/governParam.js'; import { makeApiInvocationPositions } from '../src/contractGovernance/governApi.js'; diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index c2325e54111..5ff3f8f43ef 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -31,7 +31,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/ertp": "^0.16.2", "@agoric/governance": "^0.10.3", "@agoric/internal": "^0.3.2", diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index 15fbf84574d..4746ac61c7f 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -19,6 +19,7 @@ import { import { E } from '@endo/captp'; import { observeNotifier } from '@agoric/notifier'; +import { Fail } from '@endo/errors'; import { makeNatAmountShape } from '../contractSupport.js'; import { preparePriceBook, prepareScaledBidBook } from './offerBook.js'; import { @@ -32,7 +33,6 @@ import { * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail } = assert; const { makeEmpty } = AmountMath; const DEFAULT_DECIMALS = 9; diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index b0f231826ce..3b1dd235bb4 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -28,6 +28,7 @@ import { FullProposalShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { Fail, q } from '@endo/errors'; import { makeNatAmountShape } from '../contractSupport.js'; import { makeOfferSpecShape, prepareAuctionBook } from './auctionBook.js'; import { auctioneerParamTypes } from './params.js'; @@ -39,7 +40,6 @@ import { AuctionState } from './util.js'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail, quote: q } = assert; const { add, multiply } = natSafeMath; const trace = makeTracer('Auction', true); diff --git a/packages/inter-protocol/src/auction/scheduleMath.js b/packages/inter-protocol/src/auction/scheduleMath.js index 969981ea418..39adf5e9e26 100644 --- a/packages/inter-protocol/src/auction/scheduleMath.js +++ b/packages/inter-protocol/src/auction/scheduleMath.js @@ -1,13 +1,13 @@ -// @jessie-check +/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check import { TimeMath } from '@agoric/time'; import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; import { assertAllDefined, makeTracer } from '@agoric/internal'; +import { Fail } from '@endo/errors'; /** @import {TimestampRecord} from '@agoric/time'; */ const { subtract, multiply, floorDivide } = natSafeMath; -const { Fail } = assert; const trace = makeTracer('SMath', true); diff --git a/packages/inter-protocol/src/auction/scheduler.js b/packages/inter-protocol/src/auction/scheduler.js index e78d8645a97..a95b7ed32b0 100644 --- a/packages/inter-protocol/src/auction/scheduler.js +++ b/packages/inter-protocol/src/auction/scheduler.js @@ -4,6 +4,7 @@ import { Far } from '@endo/marshal'; import { makeTracer } from '@agoric/internal'; import { observeIteration, subscribeEach } from '@agoric/notifier'; +import { X, Fail, q } from '@endo/errors'; import { AuctionState, makeCancelTokenMaker } from './util.js'; import { computeRoundTiming, @@ -11,8 +12,6 @@ import { timeVsSchedule, } from './scheduleMath.js'; -const { details: X, Fail, quote: q } = assert; - const trace = makeTracer('SCHED', true); // If the startAuction wakeup is no more than 5 minutes late, go ahead with it. @@ -263,7 +262,7 @@ export const makeScheduler = async ( if (!nextSchedule) { console.error( - assert.error(X`tried to start auction when none is scheduled`), + makeError(X`tried to start auction when none is scheduled`), ); return; } diff --git a/packages/inter-protocol/src/auction/sortedOffers.js b/packages/inter-protocol/src/auction/sortedOffers.js index f1d0e211d49..38ff5a3250e 100644 --- a/packages/inter-protocol/src/auction/sortedOffers.js +++ b/packages/inter-protocol/src/auction/sortedOffers.js @@ -7,10 +7,9 @@ import { import { M, mustMatch } from '@agoric/store'; import { RatioShape } from '@agoric/ertp'; +import { Fail } from '@endo/errors'; import { decodeData, encodeData } from '../vaultFactory/storeUtils.js'; -const { Fail } = assert; - /** * @file we use a floating point representation of the price or rate as the * first part of the key in the store. The second part is the sequence number diff --git a/packages/inter-protocol/src/clientSupport.js b/packages/inter-protocol/src/clientSupport.js index abfa3904652..58c92353f80 100644 --- a/packages/inter-protocol/src/clientSupport.js +++ b/packages/inter-protocol/src/clientSupport.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { assertAllDefined } from '@agoric/internal'; import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; diff --git a/packages/inter-protocol/src/contractSupport.js b/packages/inter-protocol/src/contractSupport.js index 3226ce8fddf..0ac4f173dad 100644 --- a/packages/inter-protocol/src/contractSupport.js +++ b/packages/inter-protocol/src/contractSupport.js @@ -6,7 +6,7 @@ import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js'; /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; export const amountPattern = harden({ brand: M.remotable(), value: M.any() }); export const ratioPattern = harden({ diff --git a/packages/inter-protocol/src/interest.js b/packages/inter-protocol/src/interest.js index 18733796123..21ca9e866b7 100644 --- a/packages/inter-protocol/src/interest.js +++ b/packages/inter-protocol/src/interest.js @@ -7,7 +7,7 @@ import { multiplyRatios, quantize, } from '@agoric/zoe/src/contractSupport/ratio.js'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { TimeMath } from '@agoric/time'; /** diff --git a/packages/inter-protocol/src/price/priceOracleKit.js b/packages/inter-protocol/src/price/priceOracleKit.js index 7622fe50ef2..1f634d2544d 100644 --- a/packages/inter-protocol/src/price/priceOracleKit.js +++ b/packages/inter-protocol/src/price/priceOracleKit.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; import { M, prepareExoClassKit } from '@agoric/vat-data'; diff --git a/packages/inter-protocol/src/price/roundsManager.js b/packages/inter-protocol/src/price/roundsManager.js index e6566c51d04..0e47ce4cc38 100644 --- a/packages/inter-protocol/src/price/roundsManager.js +++ b/packages/inter-protocol/src/price/roundsManager.js @@ -1,4 +1,4 @@ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; import { TimeMath, TimestampShape } from '@agoric/time'; diff --git a/packages/inter-protocol/src/proposals/addAssetToVault.js b/packages/inter-protocol/src/proposals/addAssetToVault.js index a96bfb81ccb..3946118333a 100644 --- a/packages/inter-protocol/src/proposals/addAssetToVault.js +++ b/packages/inter-protocol/src/proposals/addAssetToVault.js @@ -1,4 +1,4 @@ -// @jessie-check +/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check // @ts-check import { ToFarFunction } from '@endo/captp'; @@ -12,6 +12,7 @@ import { Stable } from '@agoric/internal/src/tokens.js'; import { TimeMath } from '@agoric/time/src/timeMath.js'; import { makePromiseKit } from '@endo/promise-kit'; +import { q } from '@endo/errors'; import { oracleBrandFeedName, reserveThenGetNames, @@ -20,8 +21,6 @@ import { export * from './startPSM.js'; -const { quote: q } = assert; - /** * @typedef {object} InterchainAssetOptions * @property {string} [issuerBoardId] diff --git a/packages/inter-protocol/src/proposals/startPSM.js b/packages/inter-protocol/src/proposals/startPSM.js index 121813acf99..16e04ca5a64 100644 --- a/packages/inter-protocol/src/proposals/startPSM.js +++ b/packages/inter-protocol/src/proposals/startPSM.js @@ -1,4 +1,4 @@ -// @jessie-check +/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check import { makeMap } from 'jessie.js'; import { AmountMath, AssetKind } from '@agoric/ertp'; @@ -15,6 +15,7 @@ import { deeplyFulfilledObject } from '@agoric/internal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { Stable } from '@agoric/internal/src/tokens.js'; +import { X } from '@endo/errors'; import { reserveThenGetNamePaths } from './utils.js'; import { @@ -28,7 +29,6 @@ import { /** @import {EconomyBootstrapPowers} from './econ-behaviors.js' */ const BASIS_POINTS = 10000n; -const { details: X } = assert; export { inviteCommitteeMembers, startEconCharter, inviteToEconCharter }; diff --git a/packages/inter-protocol/src/proposals/utils.js b/packages/inter-protocol/src/proposals/utils.js index 9a4088c0691..fb517b42a7b 100644 --- a/packages/inter-protocol/src/proposals/utils.js +++ b/packages/inter-protocol/src/proposals/utils.js @@ -4,7 +4,7 @@ import { E } from '@endo/far'; /** @import {CopyMap} from '@endo/patterns') */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @param {ERef} nameAdmin diff --git a/packages/inter-protocol/src/provisionPoolKit.js b/packages/inter-protocol/src/provisionPoolKit.js index fb8136e2359..374b5f285e5 100644 --- a/packages/inter-protocol/src/provisionPoolKit.js +++ b/packages/inter-protocol/src/provisionPoolKit.js @@ -23,7 +23,7 @@ import { E } from '@endo/far'; import { Far } from '@endo/marshal'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; -const { details: X, quote: q, Fail } = assert; +import { X, q, Fail } from '@endo/errors'; const trace = makeTracer('ProvPool'); diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index eebcd9da605..6dbafc4d147 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -32,11 +32,10 @@ import { import { E } from '@endo/eventual-send'; import { mustMatch } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { makeCollectFeesInvitation } from '../collectFees.js'; import { makeNatAmountShape } from '../contractSupport.js'; -const { Fail } = assert; - /** * @file The Parity Stability Module supports efficiently minting/burning a * stable token at a specified fixed ratio to a reference stable token, which diff --git a/packages/inter-protocol/src/reserve/assetReserveKit.js b/packages/inter-protocol/src/reserve/assetReserveKit.js index ef682b83210..b21da11e2fe 100644 --- a/packages/inter-protocol/src/reserve/assetReserveKit.js +++ b/packages/inter-protocol/src/reserve/assetReserveKit.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { AmountMath, AmountShape, IssuerShape } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data'; @@ -11,8 +11,6 @@ import { AmountKeywordRecordShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/eventual-send'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; -const { quote: q } = assert; - const trace = makeTracer('ReserveKit', true); /** diff --git a/packages/inter-protocol/src/vaultFactory/vault.js b/packages/inter-protocol/src/vaultFactory/vault.js index 2216ad24f16..99908851c5b 100644 --- a/packages/inter-protocol/src/vaultFactory/vault.js +++ b/packages/inter-protocol/src/vaultFactory/vault.js @@ -4,6 +4,7 @@ import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; import { M, prepareExoClassKit } from '@agoric/vat-data'; import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; import { SeatShape } from '@agoric/zoe/src/typeGuards.js'; +import { q, Fail } from '@endo/errors'; import { addSubtract, allEmpty, @@ -13,8 +14,6 @@ import { calculateCurrentDebt, reverseInterest } from '../interest-math.js'; import { calculateDebtCosts } from './math.js'; import { prepareVaultKit } from './vaultKit.js'; -const { quote: q, Fail } = assert; - const trace = makeTracer('Vault', true); /** diff --git a/packages/inter-protocol/src/vaultFactory/vaultDirector.js b/packages/inter-protocol/src/vaultFactory/vaultDirector.js index 82504a08176..650cf89acef 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultDirector.js +++ b/packages/inter-protocol/src/vaultFactory/vaultDirector.js @@ -24,6 +24,7 @@ import { } from '@agoric/zoe/src/contractSupport/index.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { Fail, q } from '@endo/errors'; import { makeCollectFeesInvitation } from '../collectFees.js'; import { setWakeupsForNextAuction, @@ -39,8 +40,6 @@ import { provideAndStartVaultManagerKits, } from './vaultManager.js'; -const { Fail, quote: q } = assert; - const trace = makeTracer('VD', true); /** diff --git a/packages/inter-protocol/src/vaultFactory/vaultHolder.js b/packages/inter-protocol/src/vaultFactory/vaultHolder.js index c4a4acd49b7..73ec7702dd8 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultHolder.js +++ b/packages/inter-protocol/src/vaultFactory/vaultHolder.js @@ -4,7 +4,7 @@ import { M, prepareExoClassKit } from '@agoric/vat-data'; import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @typedef {{ diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index e80341b5b61..5c445cd1d9f 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -51,6 +51,7 @@ import { } from '@agoric/zoe/src/contractSupport/index.js'; import { PriceQuoteShape, SeatShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/eventual-send'; +import { X, Fail, q } from '@endo/errors'; import { checkDebtLimit, makeNatAmountShape, @@ -69,8 +70,6 @@ import { AuctionPFShape } from '../auction/auctioneer.js'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { details: X, Fail, quote: q } = assert; - const trace = makeTracer('VM'); /** @@ -415,12 +414,12 @@ export const prepareVaultManagerKit = ( ), fail: reason => { zcf.shutdownWithFailure( - assert.error(X`Unable to continue without a timer: ${reason}`), + makeError(X`Unable to continue without a timer: ${reason}`), ); }, finish: done => { zcf.shutdownWithFailure( - assert.error(X`Unable to continue without a timer: ${done}`), + makeError(X`Unable to continue without a timer: ${done}`), ); }, }); diff --git a/packages/inter-protocol/test/auction/auctionContract.test.js b/packages/inter-protocol/test/auction/auctionContract.test.js index d3715590bd2..95ff406c4e8 100644 --- a/packages/inter-protocol/test/auction/auctionContract.test.js +++ b/packages/inter-protocol/test/auction/auctionContract.test.js @@ -2,7 +2,11 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { documentStorageSchema } from '@agoric/governance/tools/storageDoc.js'; -import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; +import { + deeplyFulfilledObject, + makeTracer, + NonNullish, +} from '@agoric/internal'; import { subscribeEach } from '@agoric/notifier'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; @@ -16,7 +20,6 @@ import { assertPayoutAmount } from '@agoric/zoe/test/zoeTestHelpers.js'; import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js'; import { providePriceAuthorityRegistry } from '@agoric/vats/src/priceAuthorityRegistry.js'; import { E } from '@endo/eventual-send'; -import { NonNullish } from '@agoric/assert'; import { setupReserve, diff --git a/packages/inter-protocol/test/auction/scheduleMath.test.js b/packages/inter-protocol/test/auction/scheduleMath.test.js index 3358591d004..0b7e6cd3d3b 100644 --- a/packages/inter-protocol/test/auction/scheduleMath.test.js +++ b/packages/inter-protocol/test/auction/scheduleMath.test.js @@ -3,7 +3,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { TimeMath } from '@agoric/time'; import { Far } from '@endo/marshal'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { computeRoundTiming, nextDescendingStepTime, diff --git a/packages/inter-protocol/test/psm/gov-replace-committee.js b/packages/inter-protocol/test/psm/gov-replace-committee.js index 0a28d34bc51..aed086c3492 100644 --- a/packages/inter-protocol/test/psm/gov-replace-committee.js +++ b/packages/inter-protocol/test/psm/gov-replace-committee.js @@ -6,7 +6,7 @@ * (aka big hammer) */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; const runConfig = { committeeName: 'Economic Committee', diff --git a/packages/inter-protocol/test/psm/psm.test.js b/packages/inter-protocol/test/psm/psm.test.js index b8cd41e40e6..ccd533147f7 100644 --- a/packages/inter-protocol/test/psm/psm.test.js +++ b/packages/inter-protocol/test/psm/psm.test.js @@ -16,9 +16,8 @@ import { natSafeMath as NatMath, } from '@agoric/zoe/src/contractSupport/index.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish, makeTracer } from '@agoric/internal'; import { documentStorageSchema } from '@agoric/governance/tools/storageDoc.js'; -import { makeTracer } from '@agoric/internal'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { makeAgoricNamesAccess, makePromiseSpace } from '@agoric/vats'; import { diff --git a/packages/inter-protocol/test/smartWallet/boot-test-utils.js b/packages/inter-protocol/test/smartWallet/boot-test-utils.js index c078f0fd445..78d0cbfceaa 100644 --- a/packages/inter-protocol/test/smartWallet/boot-test-utils.js +++ b/packages/inter-protocol/test/smartWallet/boot-test-utils.js @@ -12,10 +12,9 @@ import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { Far } from '@endo/marshal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { vatRoots } from '@agoric/vats/tools/boot-test-utils.js'; +import { Fail } from '@endo/errors'; import { bundles, devices } from './devices.js'; -const { Fail } = assert; - export const noop = () => {}; /** @type {DProxy} */ diff --git a/packages/inter-protocol/test/smartWallet/oracle-integration.test.js b/packages/inter-protocol/test/smartWallet/oracle-integration.test.js index 2665d8e339b..e896b16ff88 100644 --- a/packages/inter-protocol/test/smartWallet/oracle-integration.test.js +++ b/packages/inter-protocol/test/smartWallet/oracle-integration.test.js @@ -1,8 +1,7 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish, zip } from '@agoric/internal'; import { AssetKind, makeIssuerKit } from '@agoric/ertp'; -import { zip } from '@agoric/internal'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { coalesceUpdates } from '@agoric/smart-wallet/src/utils.js'; import { TimeMath } from '@agoric/time'; diff --git a/packages/inter-protocol/test/smartWallet/psm-integration.test.js b/packages/inter-protocol/test/smartWallet/psm-integration.test.js index 65450049c10..2444cc34f43 100644 --- a/packages/inter-protocol/test/smartWallet/psm-integration.test.js +++ b/packages/inter-protocol/test/smartWallet/psm-integration.test.js @@ -3,7 +3,7 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { E } from '@endo/far'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { keyEQ } from '@agoric/store'; import { coalesceUpdates } from '@agoric/smart-wallet/src/utils.js'; diff --git a/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js b/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js index 3f75aacd182..8cb98cecc91 100644 --- a/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; diff --git a/packages/inter-protocol/test/swingsetTests/fluxAggregator/fluxAggregator-service-upgrade.test.js b/packages/inter-protocol/test/swingsetTests/fluxAggregator/fluxAggregator-service-upgrade.test.js index 3e3fafbbccc..a7aff689d51 100644 --- a/packages/inter-protocol/test/swingsetTests/fluxAggregator/fluxAggregator-service-upgrade.test.js +++ b/packages/inter-protocol/test/swingsetTests/fluxAggregator/fluxAggregator-service-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { buildVatController } from '@agoric/swingset-vat'; diff --git a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js index 2ac25fb7277..f91cd093873 100644 --- a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; diff --git a/packages/inter-protocol/test/swingsetTests/psmUpgrade/psm-upgrade.test.js b/packages/inter-protocol/test/swingsetTests/psmUpgrade/psm-upgrade.test.js index 45d4e66bf81..f2356d6dc7b 100644 --- a/packages/inter-protocol/test/swingsetTests/psmUpgrade/psm-upgrade.test.js +++ b/packages/inter-protocol/test/swingsetTests/psmUpgrade/psm-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { buildVatController } from '@agoric/swingset-vat'; diff --git a/packages/inter-protocol/test/swingsetTests/reserve/assetReserve-upgrade.test.js b/packages/inter-protocol/test/swingsetTests/reserve/assetReserve-upgrade.test.js index 06a5fd4f97d..37cd55ac94d 100644 --- a/packages/inter-protocol/test/swingsetTests/reserve/assetReserve-upgrade.test.js +++ b/packages/inter-protocol/test/swingsetTests/reserve/assetReserve-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { buildVatController } from '@agoric/swingset-vat'; diff --git a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js index 1ce482ed2f9..c81e14e39ac 100644 --- a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js @@ -1,6 +1,6 @@ // @ts-check -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish } from '@endo/errors'; import { makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; diff --git a/packages/inter-protocol/test/vaultFactory/driver.js b/packages/inter-protocol/test/vaultFactory/driver.js index e0f0e7e56c7..7c486fd4ea2 100644 --- a/packages/inter-protocol/test/vaultFactory/driver.js +++ b/packages/inter-protocol/test/vaultFactory/driver.js @@ -1,5 +1,5 @@ import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; -import { allValues, makeTracer, objectMap } from '@agoric/internal'; +import { allValues, makeTracer, objectMap, NonNullish } from '@agoric/internal'; import { makeNotifierFromSubscriber } from '@agoric/notifier'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { @@ -12,7 +12,6 @@ import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; import { deeplyFulfilled } from '@endo/marshal'; -import { NonNullish } from '@agoric/assert'; import { eventLoopIteration } from '@agoric/notifier/tools/testSupports.js'; import { providePriceAuthorityRegistry } from '@agoric/vats/src/priceAuthorityRegistry.js'; import { makeScalarBigMapStore } from '@agoric/vat-data/src/index.js'; diff --git a/packages/inter-protocol/test/vaultFactory/vault-interest.test.js b/packages/inter-protocol/test/vaultFactory/vault-interest.test.js index 01ac44e96dd..123393d2a0a 100644 --- a/packages/inter-protocol/test/vaultFactory/vault-interest.test.js +++ b/packages/inter-protocol/test/vaultFactory/vault-interest.test.js @@ -7,7 +7,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { AmountMath } from '@agoric/ertp'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; const vaultRoot = './vault-contract-wrapper.js'; diff --git a/packages/inter-protocol/test/vaultFactory/vault.test.js b/packages/inter-protocol/test/vaultFactory/vault.test.js index 77e03690c57..86aac35fed4 100644 --- a/packages/inter-protocol/test/vaultFactory/vault.test.js +++ b/packages/inter-protocol/test/vaultFactory/vault.test.js @@ -7,7 +7,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; const vaultRoot = './vault-contract-wrapper.js'; diff --git a/packages/inter-protocol/test/vaultFactory/vaultLiquidation.test.js b/packages/inter-protocol/test/vaultFactory/vaultLiquidation.test.js index 56aed15a328..9f9cad0738c 100644 --- a/packages/inter-protocol/test/vaultFactory/vaultLiquidation.test.js +++ b/packages/inter-protocol/test/vaultFactory/vaultLiquidation.test.js @@ -6,6 +6,7 @@ import { deeplyFulfilledObject, makeTracer, objectMap, + NonNullish, } from '@agoric/internal'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { @@ -19,7 +20,6 @@ import { E } from '@endo/eventual-send'; import { TimeMath } from '@agoric/time'; import { assertPayoutAmount } from '@agoric/zoe/test/zoeTestHelpers.js'; import { multiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js'; -import { NonNullish } from '@agoric/assert'; import { SECONDS_PER_DAY as ONE_DAY, diff --git a/packages/internal/package.json b/packages/internal/package.json index 0c893089470..c4a62bdbadd 100755 --- a/packages/internal/package.json +++ b/packages/internal/package.json @@ -20,7 +20,7 @@ "lint:types": "tsc" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/base-zone": "^0.1.0", "@endo/common": "^1.2.2", "@endo/far": "^1.1.2", diff --git a/packages/internal/src/callback.js b/packages/internal/src/callback.js index 51784b3f8a4..343815202de 100644 --- a/packages/internal/src/callback.js +++ b/packages/internal/src/callback.js @@ -6,7 +6,7 @@ import { getInterfaceMethodKeys } from '@endo/patterns'; /** @import {ERef} from '@endo/far' */ /** @import {Callback, SyncCallback} from './types.js' */ -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; const { fromEntries } = Object; @@ -223,9 +223,7 @@ export const prepareAttenuator = ( // Support both synchronous and async callbacks. const cb = this.state.cbs[key]; if (!cb) { - const err = assert.error( - `unimplemented ${q(tag)} method ${q(key)}`, - ); + const err = makeError(`unimplemented ${q(tag)} method ${q(key)}`); if (this.state.isSync) { throw err; } diff --git a/packages/internal/src/lib-chainStorage.js b/packages/internal/src/lib-chainStorage.js index 2f92e9c2abe..5fff792140a 100644 --- a/packages/internal/src/lib-chainStorage.js +++ b/packages/internal/src/lib-chainStorage.js @@ -3,6 +3,7 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { makeHeapZone } from '@agoric/base-zone/heap.js'; +import { Fail } from '@endo/errors'; import * as cb from './callback.js'; /** @@ -10,8 +11,6 @@ import * as cb from './callback.js'; * @import {PassableCap} from '@endo/marshal'; */ -const { Fail } = assert; - /** @typedef {ReturnType} Marshaller */ /** @typedef {Pick} Unserializer */ diff --git a/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js b/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js index 364452b23aa..7ba181152c5 100644 --- a/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js +++ b/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js @@ -1,7 +1,7 @@ // this file is loaded by the controller, in the start compartment import { spawn } from 'child_process'; import { makePromiseKit } from '@endo/promise-kit'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { arrayEncoderStream, arrayDecoderStream } from './worker-protocol.js'; import { netstringEncoderStream, diff --git a/packages/internal/src/marshal.js b/packages/internal/src/marshal.js index 21f7205d86a..8e95c7dc560 100644 --- a/packages/internal/src/marshal.js +++ b/packages/internal/src/marshal.js @@ -1,10 +1,9 @@ // @ts-check import { Far } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; +import { Fail } from '@endo/errors'; import { isStreamCell } from './lib-chainStorage.js'; -const { Fail } = assert; - /** * Should be a union with Remotable, but that's `any`, making this type * meaningless diff --git a/packages/internal/src/netstring.js b/packages/internal/src/netstring.js index 06feb874ea8..690d3c9f832 100644 --- a/packages/internal/src/netstring.js +++ b/packages/internal/src/netstring.js @@ -1,5 +1,5 @@ /* global Buffer */ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; // adapted from 'netstring-stream', https://github.com/tlivings/netstring-stream/ import { Transform } from 'stream'; diff --git a/packages/internal/src/node/createBundles.js b/packages/internal/src/node/createBundles.js index ecc7d505b73..9b78839e0ac 100644 --- a/packages/internal/src/node/createBundles.js +++ b/packages/internal/src/node/createBundles.js @@ -5,7 +5,8 @@ import path from 'path'; import { spawnSync } from 'child_process'; import { createRequire } from 'module'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; + const BUNDLE_SOURCE_PROGRAM = 'bundle-source'; const req = createRequire(import.meta.url); diff --git a/packages/internal/src/priority-senders.js b/packages/internal/src/priority-senders.js index d56b22b4d8a..f4f41d0ac58 100644 --- a/packages/internal/src/priority-senders.js +++ b/packages/internal/src/priority-senders.js @@ -1,6 +1,6 @@ import { E, Far } from '@endo/far'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; const PRIORITY_SENDERS_NAMESPACE_RE = /^[a-zA-Z0-9_-]{1,50}$/; diff --git a/packages/internal/src/storage-test-utils.js b/packages/internal/src/storage-test-utils.js index a54e610ac8f..4ab44922695 100644 --- a/packages/internal/src/storage-test-utils.js +++ b/packages/internal/src/storage-test-utils.js @@ -1,6 +1,7 @@ // @ts-check import { Far } from '@endo/far'; import { makeMarshal, Remotable } from '@endo/marshal'; +import { Fail } from '@endo/errors'; import { unmarshalFromVstorage } from './marshal.js'; import { makeTracer } from './debug.js'; import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js'; @@ -11,8 +12,6 @@ import { eventLoopIteration } from './testing-utils.js'; * @import {Marshaller, StorageEntry, StorageMessage, StorageNode} from './lib-chainStorage.js'; */ -const { Fail } = assert; - const trace = makeTracer('StorTU', false); /** diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index be3cf6dc8a9..0c278b81043 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -1,4 +1,4 @@ -// @ts-check +/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @ts-check // @jessie-check import { deeplyFulfilled, isObject } from '@endo/marshal'; @@ -6,9 +6,9 @@ import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; import { asyncGenerate } from 'jessie.js'; -const { fromEntries, keys, values } = Object; +import { q, Fail } from '@endo/errors'; -const { quote: q, Fail } = assert; +const { fromEntries, keys, values } = Object; export const BASIS_POINTS = 10_000n; @@ -204,8 +204,8 @@ export const synchronizedTee = (sourceStream, readerCount) => { if (doneResult) { result = Promise.resolve(doneResult); } else if (rejections.length) { - const error = assert.error(assert.details`Teed stream threw`); - assert.note(error, assert.details`Teed rejections: ${rejections}`); + const error = makeError(assert.details`Teed stream threw`); + annotateError(error, assert.details`Teed rejections: ${rejections}`); result = sourceStream.throw?.(error) || Promise.resolve(sourceStream.return?.()).then(() => diff --git a/packages/kmarshal/package.json b/packages/kmarshal/package.json index 78ba2d69074..6d0c4cb1bf6 100644 --- a/packages/kmarshal/package.json +++ b/packages/kmarshal/package.json @@ -23,7 +23,7 @@ "dependencies": { "@endo/far": "^1.1.2", "@endo/marshal": "^1.5.0", - "@agoric/assert": "^0.6.0" + "@endo/errors": "^1.2.2" }, "devDependencies": { "ava": "^5.3.0" diff --git a/packages/kmarshal/src/kmarshal.js b/packages/kmarshal/src/kmarshal.js index 707daf6d828..95449900b70 100644 --- a/packages/kmarshal/src/kmarshal.js +++ b/packages/kmarshal/src/kmarshal.js @@ -1,6 +1,6 @@ import { Far, passStyleOf } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; /** * @import { ERef } from '@endo/far'; diff --git a/packages/network/package.json b/packages/network/package.json index 6fdc9586e55..dae88c70df4 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -21,7 +21,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/store": "^0.9.2", "@agoric/vat-data": "^0.5.2", diff --git a/packages/network/src/bytes.js b/packages/network/src/bytes.js index e952b1b0dc4..aa50fee2c8f 100644 --- a/packages/network/src/bytes.js +++ b/packages/network/src/bytes.js @@ -1,5 +1,5 @@ // @ts-check -import { details, Fail } from '@agoric/assert'; +import { details, Fail } from '@endo/errors'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { isObject } from '@endo/pass-style'; diff --git a/packages/network/src/network.js b/packages/network/src/network.js index b4d47be7464..b834c3a1458 100644 --- a/packages/network/src/network.js +++ b/packages/network/src/network.js @@ -4,7 +4,7 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { toBytes } from './bytes.js'; import { Shape } from './shapes.js'; diff --git a/packages/network/src/router.js b/packages/network/src/router.js index b18d1c06407..09563db5b4f 100644 --- a/packages/network/src/router.js +++ b/packages/network/src/router.js @@ -5,7 +5,7 @@ import { E as defaultE } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { ENDPOINT_SEPARATOR, prepareNetworkProtocol } from './network.js'; import { Shape } from './shapes.js'; diff --git a/packages/notifier/package.json b/packages/notifier/package.json index ebe1ca9b99c..0e05299584e 100644 --- a/packages/notifier/package.json +++ b/packages/notifier/package.json @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/vat-data": "^0.5.2", "@endo/far": "^1.1.2", diff --git a/packages/notifier/src/notifier.js b/packages/notifier/src/notifier.js index 42ed192c1fa..9439bbf528f 100644 --- a/packages/notifier/src/notifier.js +++ b/packages/notifier/src/notifier.js @@ -1,6 +1,6 @@ /// -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { E, Far } from '@endo/far'; import { makePublishKit } from './publish-kit.js'; diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js index ea1d2c5f636..d8461d4988f 100644 --- a/packages/notifier/src/publish-kit.js +++ b/packages/notifier/src/publish-kit.js @@ -10,7 +10,7 @@ import { makePromiseKit } from '@endo/promise-kit'; * @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js'; */ -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; const sink = () => {}; const makeQuietRejection = reason => { diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index 2265bb21fbb..b480a1b3301 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -7,7 +7,8 @@ import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js'; */ -const { details: X, Fail } = assert; +import { X, Fail } from '@endo/errors'; + const sink = () => {}; /** @@ -48,7 +49,7 @@ const reconnectAsNeeded = async (getter, seed = []) => { // for which it is a result. if (isObject(err) && disconnection && disconnection !== err) { try { - assert.note( + annotateError( err, X`Attempting to recover from disconnection: ${disconnection}`, ); diff --git a/packages/notifier/test/map-unum.js b/packages/notifier/test/map-unum.js index c35bc302784..a0da12b78c8 100644 --- a/packages/notifier/test/map-unum.js +++ b/packages/notifier/test/map-unum.js @@ -7,7 +7,7 @@ // If this experiment works out, it or something like it may eventually move // from test/ to src/ -import { q, Fail } from '@agoric/assert'; +import { q, Fail } from '@endo/errors'; import { makeNotifierKit, makeSubscriptionKit, diff --git a/packages/notifier/test/publish-kit.test.js b/packages/notifier/test/publish-kit.test.js index 58ff9dd83f6..1c1c5c979ca 100644 --- a/packages/notifier/test/publish-kit.test.js +++ b/packages/notifier/test/publish-kit.test.js @@ -11,6 +11,7 @@ import { import { initSwingStore } from '@agoric/swing-store'; import { kunser } from '@agoric/kmarshal'; import { makeScalarBigMapStore } from '@agoric/vat-data/src/vat-data-bindings.js'; +import { q } from '@endo/errors'; import { makePublishKit, subscribeEach, @@ -25,7 +26,6 @@ import { invertPromiseSettlement } from './iterable-testing-tools.js'; */ const { ownKeys } = Reflect; -const { quote: q } = assert; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/orchestration/package.json b/packages/orchestration/package.json index 42c12b46947..ea1f7e5dbf9 100644 --- a/packages/orchestration/package.json +++ b/packages/orchestration/package.json @@ -32,7 +32,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cosmic-proto": "^0.4.0", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", diff --git a/packages/orchestration/src/examples/sendAnywhere.contract.js b/packages/orchestration/src/examples/sendAnywhere.contract.js index ed49472cee2..5e9e7398839 100644 --- a/packages/orchestration/src/examples/sendAnywhere.contract.js +++ b/packages/orchestration/src/examples/sendAnywhere.contract.js @@ -6,13 +6,13 @@ import { withdrawFromSeat } from '@agoric/zoe/src/contractSupport/zoeHelpers.js' import { AmountShape } from '@agoric/ertp'; import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; +import { Fail } from '@endo/errors'; import { CosmosChainInfoShape } from '../typeGuards.js'; import { makeOrchestrationFacade } from '../facade.js'; import { prepareLocalChainAccountKit } from '../exos/local-chain-account-kit.js'; import { makeChainHub } from '../utils/chainHub.js'; const { entries } = Object; -const { Fail } = assert; /** * @import {Baggage} from '@agoric/vat-data'; diff --git a/packages/orchestration/src/exos/chainAccountKit.js b/packages/orchestration/src/exos/chainAccountKit.js index 35d20c5583d..dd9de9214a5 100644 --- a/packages/orchestration/src/exos/chainAccountKit.js +++ b/packages/orchestration/src/exos/chainAccountKit.js @@ -1,9 +1,10 @@ /** @file ChainAccount exo */ -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { PurseShape } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; +import { Fail } from '@endo/errors'; import { ChainAddressShape, ConnectionHandlerI, @@ -22,7 +23,6 @@ import { makeTxPacket, parseTxPacket } from '../utils/packet.js'; * @import {ChainAddress} from '../types.js'; */ -const { Fail } = assert; const trace = makeTracer('ChainAccountKit'); /** @typedef {'UNPARSABLE_CHAIN_ADDRESS'} UnparsableChainAddress */ diff --git a/packages/orchestration/src/exos/cosmosOrchestrationAccount.js b/packages/orchestration/src/exos/cosmosOrchestrationAccount.js index f1c10cb24ac..e798fb31ced 100644 --- a/packages/orchestration/src/exos/cosmosOrchestrationAccount.js +++ b/packages/orchestration/src/exos/cosmosOrchestrationAccount.js @@ -23,6 +23,7 @@ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { InvitationShape } from '@agoric/zoe/src/typeGuards.js'; import { decodeBase64 } from '@endo/base64'; import { E } from '@endo/far'; +import { Fail } from '@endo/errors'; import { AmountArgShape, ChainAddressShape, @@ -48,8 +49,6 @@ import { dateInSeconds } from '../utils/time.js'; */ const trace = makeTracer('ComosOrchestrationAccountHolder'); - -const { Fail } = assert; /** * @typedef {object} ComosOrchestrationAccountNotification * @property {ChainAddress} chainAddress @@ -398,7 +397,7 @@ export const prepareCosmosOrchestrationAccountKit = ( }, withdrawRewards() { - throw assert.error('Not implemented'); + throw makeError('Not implemented'); }, /** @param {Delegation[]} delegations */ diff --git a/packages/orchestration/src/exos/icqConnectionKit.js b/packages/orchestration/src/exos/icqConnectionKit.js index 6c29d491ce3..92edd8d5ba9 100644 --- a/packages/orchestration/src/exos/icqConnectionKit.js +++ b/packages/orchestration/src/exos/icqConnectionKit.js @@ -1,8 +1,9 @@ /** @file ICQConnection Exo */ -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { makeTracer } from '@agoric/internal'; import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; +import { Fail } from '@endo/errors'; import { makeQueryPacket, parseQueryPacket } from '../utils/packet.js'; import { ConnectionHandlerI } from '../typeGuards.js'; @@ -15,7 +16,6 @@ import { ConnectionHandlerI } from '../typeGuards.js'; * @import {LocalIbcAddress, RemoteIbcAddress} from '@agoric/vats/tools/ibc-utils.js'; */ -const { Fail } = assert; const trace = makeTracer('Orchestration:ICQConnection'); export const ICQMsgShape = M.splitRecord( diff --git a/packages/orchestration/src/exos/local-chain-account-kit.js b/packages/orchestration/src/exos/local-chain-account-kit.js index 3c5fd73f6ac..ea51048b818 100644 --- a/packages/orchestration/src/exos/local-chain-account-kit.js +++ b/packages/orchestration/src/exos/local-chain-account-kit.js @@ -1,5 +1,5 @@ /** @file Use-object for the owner of a localchain account */ -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { typedJson } from '@agoric/cosmic-proto/vatsafe'; import { AmountShape, PaymentShape } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; @@ -8,6 +8,7 @@ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { InvitationShape } from '@agoric/zoe/src/typeGuards.js'; import { V } from '@agoric/vow/vat.js'; import { E } from '@endo/far'; +import { Fail } from '@endo/errors'; import { AmountArgShape, ChainAddressShape, @@ -27,8 +28,6 @@ import { dateInSeconds, makeTimestampHelper } from '../utils/time.js'; */ const trace = makeTracer('LCAH'); - -const { Fail } = assert; /** * @typedef {object} LocalChainAccountNotification * @property {string} address diff --git a/packages/orchestration/src/proposals/orchestration-proposal.js b/packages/orchestration/src/proposals/orchestration-proposal.js index 46846cd17f6..a6c4e6d0783 100644 --- a/packages/orchestration/src/proposals/orchestration-proposal.js +++ b/packages/orchestration/src/proposals/orchestration-proposal.js @@ -1,7 +1,7 @@ import { makeTracer } from '@agoric/internal'; import { E, Far } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { registerChainNamespace } from '../chain-info.js'; import { CHAIN_KEY, CONNECTIONS_KEY } from '../utils/chainHub.js'; diff --git a/packages/orchestration/src/service.js b/packages/orchestration/src/service.js index 3c203914296..15e7c121cc1 100644 --- a/packages/orchestration/src/service.js +++ b/packages/orchestration/src/service.js @@ -3,6 +3,7 @@ import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; import { Shape as NetworkShape } from '@agoric/network'; +import { Fail, bare } from '@endo/errors'; import { prepareChainAccountKit } from './exos/chainAccountKit.js'; import { prepareICQConnectionKit } from './exos/icqConnectionKit.js'; import { @@ -18,8 +19,6 @@ import { * @import {ICQConnection, IcaAccount, ICQConnectionKit} from './types.js'; */ -const { Fail, bare } = assert; - /** * @typedef {object} OrchestrationPowers * @property {Remote} portAllocator diff --git a/packages/orchestration/src/utils/address.js b/packages/orchestration/src/utils/address.js index e423895db91..3e0c608fa50 100644 --- a/packages/orchestration/src/utils/address.js +++ b/packages/orchestration/src/utils/address.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * @import {IBCConnectionID} from '@agoric/vats'; diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index d1df713d5c1..8555bc3c8c3 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -1,10 +1,9 @@ import { E } from '@endo/far'; import { M, mustMatch } from '@endo/patterns'; import { makeHeapZone } from '@agoric/zone'; +import { Fail } from '@endo/errors'; import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js'; -const { Fail } = assert; - /** * @import {NameHub} from '@agoric/vats'; * @import {CosmosChainInfo, IBCConnectionInfo} from '../cosmos-api.js'; @@ -98,7 +97,7 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => { const chainInfo = await E(agoricNames) .lookup(CHAIN_KEY, chainName) .catch(_cause => { - throw assert.error(`chain not found:${chainName}`); + throw makeError(`chain not found:${chainName}`); }); chainInfos.init(chainName, chainInfo); return chainInfo; @@ -127,7 +126,7 @@ export const makeChainHub = (agoricNames, zone = makeHeapZone()) => { const connectionInfo = await E(agoricNames) .lookup(CONNECTIONS_KEY, key) .catch(_cause => { - throw assert.error(`connection not found: ${chainId1}<->${chainId2}`); + throw makeError(`connection not found: ${chainId1}<->${chainId2}`); }); connectionInfos.init(key, connectionInfo); return connectionInfo; diff --git a/packages/orchestration/src/utils/cosmos.js b/packages/orchestration/src/utils/cosmos.js index d84a2e5f033..0baf94e89e7 100644 --- a/packages/orchestration/src/utils/cosmos.js +++ b/packages/orchestration/src/utils/cosmos.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js'; import { decodeBase64, encodeBase64 } from '@endo/base64'; @@ -31,6 +31,6 @@ export const tryDecodeResponse = (ackStr, fromProtoMsg) => { const msg = fromProtoMsg(protoMsg); return msg; } catch (cause) { - throw assert.error(`bad response: ${ackStr}`, undefined, { cause }); + throw makeError(`bad response: ${ackStr}`, undefined, { cause }); } }; diff --git a/packages/orchestration/test/staking-ops.test.ts b/packages/orchestration/test/staking-ops.test.ts index 4059ac372f8..99408348c13 100644 --- a/packages/orchestration/test/staking-ops.test.ts +++ b/packages/orchestration/test/staking-ops.test.ts @@ -16,6 +16,7 @@ import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js'; import type { TimestampRecord, TimestampValue } from '@agoric/time'; import type { AnyJson } from '@agoric/cosmic-proto'; import { makeDurableZone } from '@agoric/zone/durable.js'; +import { Fail } from '@endo/errors'; import { prepareCosmosOrchestrationAccountKit, trivialDelegateResponse, @@ -23,8 +24,6 @@ import { import { encodeTxResponse } from '../src/utils/cosmos.js'; import type { IcaAccount, ChainAddress, ICQConnection } from '../src/types.js'; -const { Fail } = assert; - test('MsgDelegateResponse trivial response', t => { t.is( trivialDelegateResponse, diff --git a/packages/pegasus/package.json b/packages/pegasus/package.json index c4145c6194c..24328ef4325 100644 --- a/packages/pegasus/package.json +++ b/packages/pegasus/package.json @@ -28,7 +28,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", "@agoric/network": "^0.1.0", diff --git a/packages/pegasus/src/courier.js b/packages/pegasus/src/courier.js index fcee1c5b7d7..7397d8a6dcd 100644 --- a/packages/pegasus/src/courier.js +++ b/packages/pegasus/src/courier.js @@ -1,5 +1,5 @@ // @ts-check -import { details as X } from '@agoric/assert'; +import { X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { WalletName } from '@agoric/internal'; diff --git a/packages/pegasus/src/ibc-trace.js b/packages/pegasus/src/ibc-trace.js index 1a075156c33..474321492cf 100644 --- a/packages/pegasus/src/ibc-trace.js +++ b/packages/pegasus/src/ibc-trace.js @@ -1,6 +1,6 @@ // @ts-check import { Far } from '@endo/far'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { parse } from '@agoric/network'; diff --git a/packages/pegasus/src/ics20.js b/packages/pegasus/src/ics20.js index df96c2d8f4c..269237c8a0e 100644 --- a/packages/pegasus/src/ics20.js +++ b/packages/pegasus/src/ics20.js @@ -1,7 +1,7 @@ // @ts-check import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; /** * @typedef {object} ICS20TransferPacket Packet shape defined at: @@ -30,7 +30,7 @@ const safeJSONParseObject = s => { try { obj = JSON.parse(s); } catch (e) { - assert.note(e, X`${s} is not valid JSON`); + annotateError(e, X`${s} is not valid JSON`); throw e; } if (typeof obj !== 'object') { diff --git a/packages/pegasus/src/once-promise-kit.js b/packages/pegasus/src/once-promise-kit.js index ce50980cd7e..6f55bc9c44c 100644 --- a/packages/pegasus/src/once-promise-kit.js +++ b/packages/pegasus/src/once-promise-kit.js @@ -1,5 +1,5 @@ // @ts-check -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; /** diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js index e73014804cc..579623a9a2f 100644 --- a/packages/pegasus/src/pegasus.js +++ b/packages/pegasus/src/pegasus.js @@ -1,6 +1,6 @@ // @ts-check -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { makeLegacyWeakMap, makeLegacyMap } from '@agoric/store'; import { E, Far } from '@endo/far'; import { @@ -147,7 +147,7 @@ export const makePegasus = ({ zcf, board, namesByAddress, when }) => { // handled it correctly and that flow doesn't need to trigger an // additional UnhandledRejectionWarning in our vat. promise.catch(() => {}); - reject(assert.error(X`${receiveDenom} is temporarily unavailable`)); + reject(makeError(X`${receiveDenom} is temporarily unavailable`)); // Allow new transfers to be initiated after this rejection. receiveDenomToCourierPK.delete(receiveDenom); @@ -427,7 +427,7 @@ export const makePegasus = ({ zcf, board, namesByAddress, when }) => { abort, } = connectionToLocalDenomState.get(c); connectionToLocalDenomState.delete(c); - const err = assert.error(X`pegasusConnectionHandler closed`); + const err = makeError(X`pegasusConnectionHandler closed`); receiveDenomPublication.fail(err); /** @type {PegasusConnection} */ const state = harden({ diff --git a/packages/smart-wallet/package.json b/packages/smart-wallet/package.json index f2f805cafb1..1faf0dc7f81 100644 --- a/packages/smart-wallet/package.json +++ b/packages/smart-wallet/package.json @@ -26,7 +26,7 @@ "import-meta-resolve": "^2.2.1" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/casting": "^0.4.2", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", diff --git a/packages/smart-wallet/src/invitations.js b/packages/smart-wallet/src/invitations.js index d877225d87e..624b7575dec 100644 --- a/packages/smart-wallet/src/invitations.js +++ b/packages/smart-wallet/src/invitations.js @@ -2,10 +2,9 @@ import { AmountMath } from '@agoric/ertp'; import { mustMatch } from '@agoric/store'; import { InvitationHandleShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/far'; +import { Fail } from '@endo/errors'; import { shape } from './typeGuards.js'; -const { Fail } = assert; - // A safety limit const MAX_PIPE_LENGTH = 2; diff --git a/packages/smart-wallet/src/marshal-contexts.js b/packages/smart-wallet/src/marshal-contexts.js index d5303ff39af..b1ac80aa6b4 100644 --- a/packages/smart-wallet/src/marshal-contexts.js +++ b/packages/smart-wallet/src/marshal-contexts.js @@ -4,7 +4,7 @@ import { Far, makeMarshal, Remotable } from '@endo/marshal'; import { HandledPromise } from '@endo/eventual-send'; // TODO: convince tsc this isn't needed import { DEFAULT_PREFIX } from '@agoric/vats/src/lib-board.js'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * @import {PassableCap, RemotableObject} from '@endo/marshal'; diff --git a/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js b/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js index ea3e3e81826..b0f4fa20e9d 100644 --- a/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js +++ b/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js @@ -3,9 +3,9 @@ import { E } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; import { allValues } from '@agoric/internal'; -console.warn('upgrade-walletFactory-proposal.js module evaluating'); +import { Fail } from '@endo/errors'; -const { Fail } = assert; +console.warn('upgrade-walletFactory-proposal.js module evaluating'); // vstorage paths under published.* const WALLET_STORAGE_PATH_SEGMENT = 'wallet'; diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js index 453ad6caf18..87ea2fddf85 100644 --- a/packages/smart-wallet/src/smartWallet.js +++ b/packages/smart-wallet/src/smartWallet.js @@ -37,6 +37,7 @@ import { PaymentPKeywordRecordShape, } from '@agoric/zoe/src/typeGuards.js'; +import { Fail, q } from '@endo/errors'; import { makeInvitationsHelper } from './invitations.js'; import { shape } from './typeGuards.js'; import { objectMapStoragePath } from './utils.js'; @@ -44,8 +45,6 @@ import { prepareOfferWatcher, watchOfferOutcomes } from './offerWatcher.js'; /** @import {OfferId, OfferStatus} from './offers.js'; */ -const { Fail, quote: q } = assert; - const trace = makeTracer('SmrtWlt'); /** diff --git a/packages/smart-wallet/test/addAsset.test.js b/packages/smart-wallet/test/addAsset.test.js index 89658d70f82..b24ccd03dbb 100644 --- a/packages/smart-wallet/test/addAsset.test.js +++ b/packages/smart-wallet/test/addAsset.test.js @@ -9,12 +9,11 @@ import bundleSource from '@endo/bundle-source'; import { makeMarshal } from '@endo/marshal'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { makeFakeBankManagerKit } from '@agoric/vats/tools/bank-utils.js'; +import { Fail } from '@endo/errors'; import { makeDefaultTestContext } from './contexts.js'; import { ActionType, headValue, makeMockTestSpace } from './supports.js'; import { makeImportContext } from '../src/marshal-contexts.js'; -const { Fail } = assert; - const importSpec = spec => importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname); diff --git a/packages/smart-wallet/test/devices.js b/packages/smart-wallet/test/devices.js index 1718fa3ed66..a25511e8eed 100644 --- a/packages/smart-wallet/test/devices.js +++ b/packages/smart-wallet/test/devices.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import centralSupply from '@agoric/vats/bundles/bundle-centralSupply.js'; import mintHolder from '@agoric/vats/bundles/bundle-mintHolder.js'; import provisionPool from '@agoric/vats/bundles/bundle-provisionPool.js'; diff --git a/packages/smart-wallet/test/gameAssetContract.js b/packages/smart-wallet/test/gameAssetContract.js index f2d6c68363d..9c693763608 100644 --- a/packages/smart-wallet/test/gameAssetContract.js +++ b/packages/smart-wallet/test/gameAssetContract.js @@ -7,7 +7,7 @@ import { makeTracer } from '@agoric/internal'; import { M, getCopyBagEntries } from '@agoric/store'; import { E, Far } from '@endo/far'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; const trace = makeTracer('Game', true); diff --git a/packages/smart-wallet/test/start-game1-proposal.js b/packages/smart-wallet/test/start-game1-proposal.js index 2cc662bd745..ce5f827c8c8 100644 --- a/packages/smart-wallet/test/start-game1-proposal.js +++ b/packages/smart-wallet/test/start-game1-proposal.js @@ -3,9 +3,9 @@ import { E } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp/src/amountMath.js'; -console.warn('start-game1-proposal.js module evaluating'); +import { Fail } from '@endo/errors'; -const { Fail } = assert; +console.warn('start-game1-proposal.js module evaluating'); // vstorage paths under published.* const BOARD_AUX = 'boardAux'; diff --git a/packages/smart-wallet/test/supports.js b/packages/smart-wallet/test/supports.js index 65fd4a2365e..929eea57bfc 100644 --- a/packages/smart-wallet/test/supports.js +++ b/packages/smart-wallet/test/supports.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import * as ActionType from '@agoric/internal/src/action-types.js'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; diff --git a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/bootstrap-walletFactory-service-upgrade.js b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/bootstrap-walletFactory-service-upgrade.js index 9a556dd926e..4557a4cc954 100644 --- a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/bootstrap-walletFactory-service-upgrade.js +++ b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/bootstrap-walletFactory-service-upgrade.js @@ -1,5 +1,5 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; diff --git a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-service-upgrade.test.js b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-service-upgrade.test.js index 84bb0a9bc2e..53fd7ec8db0 100644 --- a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-service-upgrade.test.js +++ b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-service-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { buildVatController } from '@agoric/swingset-vat'; diff --git a/packages/solo/package.json b/packages/solo/package.json index 90d2ed14525..49c99ac28c1 100644 --- a/packages/solo/package.json +++ b/packages/solo/package.json @@ -23,7 +23,7 @@ "license": "Apache-2.0", "dependencies": { "@agoric/access-token": "^0.4.21", - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cache": "^0.3.2", "@agoric/cosmic-swingset": "^0.41.3", "@agoric/internal": "^0.3.2", diff --git a/packages/solo/src/add-chain.js b/packages/solo/src/add-chain.js index cf549cdd1f8..39aab2f9b3a 100644 --- a/packages/solo/src/add-chain.js +++ b/packages/solo/src/add-chain.js @@ -5,7 +5,7 @@ import djson from 'deterministic-json'; import path from 'path'; import fs from 'fs'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import setGCIIngress from './set-gci-ingress.js'; const DEFAULT_CHAIN_CONFIG = 'https://testnet.agoric.com/network-config'; diff --git a/packages/solo/src/chain-cosmos-sdk.js b/packages/solo/src/chain-cosmos-sdk.js index 9210a513c01..57a7f288e72 100644 --- a/packages/solo/src/chain-cosmos-sdk.js +++ b/packages/solo/src/chain-cosmos-sdk.js @@ -11,7 +11,7 @@ import anylogger from 'anylogger'; import { makeNotifierKit } from '@agoric/notifier'; import { makePromiseKit } from '@endo/promise-kit'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { DEFAULT_BATCH_TIMEOUT_MS, makeBatchedDeliver, @@ -697,13 +697,13 @@ ${chainID} chain does not yet know of address ${clientAddr}${adviseEgress( if (txResult.code) { // eslint-disable-next-line no-use-before-define failedSend( - assert.error(`Error in tx processing: ${txResult.log}`), + makeError(`Error in tx processing: ${txResult.log}`), ); } }) .catch(err => // eslint-disable-next-line no-use-before-define - failedSend(assert.error(`Error in tx processing: ${err}`)), + failedSend(makeError(`Error in tx processing: ${err}`)), ); // We submitted the transaction to the mempool successfully. diff --git a/packages/solo/src/init-basedir.js b/packages/solo/src/init-basedir.js index 2064447501f..7ad5d072c36 100644 --- a/packages/solo/src/init-basedir.js +++ b/packages/solo/src/init-basedir.js @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import { execFileSync } from 'child_process'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import anylogger from 'anylogger'; import { HELPER } from './chain-cosmos-sdk.js'; diff --git a/packages/solo/src/main.js b/packages/solo/src/main.js index 9dc2dea2ab8..7d9fd993af1 100644 --- a/packages/solo/src/main.js +++ b/packages/solo/src/main.js @@ -3,7 +3,7 @@ import path from 'path'; import parseArgs from 'minimist'; import process from 'process'; import { spawnSync } from 'child_process'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import anylogger from 'anylogger'; diff --git a/packages/solo/src/outbound.js b/packages/solo/src/outbound.js index b504965ef7d..8d6d3a2370e 100644 --- a/packages/solo/src/outbound.js +++ b/packages/solo/src/outbound.js @@ -1,7 +1,7 @@ /* global process */ import anylogger from 'anylogger'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; // Limit the debug log length. const SOLO_MAX_DEBUG_LENGTH = diff --git a/packages/solo/src/pipe-entrypoint.js b/packages/solo/src/pipe-entrypoint.js index 81781f78f9d..566489e0189 100644 --- a/packages/solo/src/pipe-entrypoint.js +++ b/packages/solo/src/pipe-entrypoint.js @@ -52,7 +52,7 @@ const main = async () => { break; } default: { - assert.error(`unknown method ${method}`); + makeError(`unknown method ${method}`); } } diff --git a/packages/solo/src/start.js b/packages/solo/src/start.js index cf2237c2662..d138d35d742 100644 --- a/packages/solo/src/start.js +++ b/packages/solo/src/start.js @@ -16,7 +16,7 @@ import anylogger from 'anylogger'; // import connect from 'lotion-connect'; // import djson from 'deterministic-json'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { makeSlogSender, tryFlushSlogSender } from '@agoric/telemetry'; import { loadSwingsetConfigFile, diff --git a/packages/solo/src/vat-http.js b/packages/solo/src/vat-http.js index bfa410ffcba..94d9a1ff872 100644 --- a/packages/solo/src/vat-http.js +++ b/packages/solo/src/vat-http.js @@ -2,7 +2,7 @@ import { makeNotifierKit } from '@agoric/notifier'; import { makeCache } from '@agoric/cache'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { getReplHandler } from '@agoric/vats/src/repl.js'; import { makePromiseKit } from '@endo/promise-kit'; import { getCapTPHandler } from './captp.js'; diff --git a/packages/spawner/package.json b/packages/spawner/package.json index a1adaccfa44..a284d4d537c 100644 --- a/packages/spawner/package.json +++ b/packages/spawner/package.json @@ -31,7 +31,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@endo/eventual-send": "^1.2.2", "@endo/import-bundle": "^1.1.2", "@endo/marshal": "^1.5.0" diff --git a/packages/spawner/src/contractHost.js b/packages/spawner/src/contractHost.js index 7971e4e728f..64c68de218f 100644 --- a/packages/spawner/src/contractHost.js +++ b/packages/spawner/src/contractHost.js @@ -1,7 +1,7 @@ // Copyright (C) 2019 Agoric, under Apache License 2.0 import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Far } from '@endo/marshal'; // spawnBundle is built with 'yarn build' diff --git a/packages/spawner/test/swingsetTests/contractHost/bootstrap.js b/packages/spawner/test/swingsetTests/contractHost/bootstrap.js index 573c1297125..5aac91e8b9f 100644 --- a/packages/spawner/test/swingsetTests/contractHost/bootstrap.js +++ b/packages/spawner/test/swingsetTests/contractHost/bootstrap.js @@ -1,7 +1,7 @@ // Copyright (C) 2019 Agoric, under Apache License 2.0 import { E } from '@endo/eventual-send'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; export function buildRootObject(vatPowers, vatParameters) { diff --git a/packages/stat-logger/package.json b/packages/stat-logger/package.json index 323b0030bea..d0db79beda8 100644 --- a/packages/stat-logger/package.json +++ b/packages/stat-logger/package.json @@ -15,6 +15,9 @@ "lint-fix": "yarn lint:eslint --fix", "lint:eslint": "eslint ." }, + "dependencies": { + "@endo/errors": "^1.2.2" + }, "peerDependencies": { "canvas": "^2.6.1", "vega": "^5.22.1", diff --git a/packages/stat-logger/src/statGraph.js b/packages/stat-logger/src/statGraph.js index c85805ed3f0..800aae4a95c 100644 --- a/packages/stat-logger/src/statGraph.js +++ b/packages/stat-logger/src/statGraph.js @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; function scanMax(filePath, fields) { const lines = fs.readFileSync(filePath, { encoding: 'utf8' }).split('\n'); diff --git a/packages/store/package.json b/packages/store/package.json index 6f3f52aabab..1f1b530638c 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -30,6 +30,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { + "@endo/errors": "^1.2.2", "@endo/exo": "^1.5.0", "@endo/marshal": "^1.5.0", "@endo/pass-style": "^1.4.0", diff --git a/packages/store/src/legacy/legacyMap.js b/packages/store/src/legacy/legacyMap.js index 6c07685c9fa..15ec3d29720 100644 --- a/packages/store/src/legacy/legacyMap.js +++ b/packages/store/src/legacy/legacyMap.js @@ -1,7 +1,7 @@ /** @import {LegacyMap, LegacyWeakMap} from '../types.js'; */ // TODO, once migrated to endo, import from @endo/errors instead -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * This module and its fraternal sibling legacyWeakMap exist only to ease a diff --git a/packages/store/src/legacy/legacyWeakMap.js b/packages/store/src/legacy/legacyWeakMap.js index 56ff91718b3..fba9ecf696b 100644 --- a/packages/store/src/legacy/legacyWeakMap.js +++ b/packages/store/src/legacy/legacyWeakMap.js @@ -1,7 +1,7 @@ /** @import {LegacyWeakMap} from '../types.js'; */ // TODO, once migrated to endo, import from @endo/errors instead -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * See doccomment in the closely related `legacyMap.js` module. diff --git a/packages/store/src/stores/scalarMapStore.js b/packages/store/src/stores/scalarMapStore.js index 6847800b33c..ef78a934c10 100644 --- a/packages/store/src/stores/scalarMapStore.js +++ b/packages/store/src/stores/scalarMapStore.js @@ -12,6 +12,7 @@ import { mustMatch, assertPattern, } from '@endo/patterns'; +import { q } from '@endo/errors'; import { makeWeakMapStoreMethods } from './scalarWeakMapStore.js'; import { makeCurrentKeysKit } from './store-utils.js'; @@ -21,8 +22,6 @@ import { makeCurrentKeysKit } from './store-utils.js'; * @import {MapStore, MapStoreMethods, StoreOptions} from '../types.js'; */ -const { quote: q } = assert; - /** * @template {Key} K * @template {Passable} V diff --git a/packages/store/src/stores/scalarSetStore.js b/packages/store/src/stores/scalarSetStore.js index 5f4756fc628..223f3a29b55 100644 --- a/packages/store/src/stores/scalarSetStore.js +++ b/packages/store/src/stores/scalarSetStore.js @@ -7,6 +7,7 @@ import { mustMatch, assertPattern, } from '@endo/patterns'; +import { q } from '@endo/errors'; import { makeWeakSetStoreMethods } from './scalarWeakSetStore.js'; import { makeCurrentKeysKit } from './store-utils.js'; @@ -15,8 +16,6 @@ import { makeCurrentKeysKit } from './store-utils.js'; * @import {SetStore, SetStoreMethods, StoreOptions} from '../types.js'; */ -const { quote: q } = assert; - /** * @template {Key} K * @param {Set} jsset diff --git a/packages/store/src/stores/scalarWeakMapStore.js b/packages/store/src/stores/scalarWeakMapStore.js index 6bf46df0cbc..ccf7dc73a9f 100644 --- a/packages/store/src/stores/scalarWeakMapStore.js +++ b/packages/store/src/stores/scalarWeakMapStore.js @@ -12,7 +12,7 @@ import { * @import {WeakMapStore, StoreOptions} from '../types.js'; */ -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; /** * @template {Key} K diff --git a/packages/store/src/stores/scalarWeakSetStore.js b/packages/store/src/stores/scalarWeakSetStore.js index cc5762b4785..ed0f6fa8bbd 100644 --- a/packages/store/src/stores/scalarWeakSetStore.js +++ b/packages/store/src/stores/scalarWeakSetStore.js @@ -6,7 +6,7 @@ import { isCopySet, } from '@endo/patterns'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; /** * @import {Key} from '@endo/patterns'; diff --git a/packages/store/src/stores/store-utils.js b/packages/store/src/stores/store-utils.js index 77ca084ee42..f7c10527f75 100644 --- a/packages/store/src/stores/store-utils.js +++ b/packages/store/src/stores/store-utils.js @@ -8,7 +8,7 @@ import { M, matches } from '@endo/patterns'; * @import {Key} from '@endo/patterns'; */ -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; // TODO: Undate `@endo/patterns` to export the original, and delete the // reimplementation here. diff --git a/packages/swing-store/package.json b/packages/swing-store/package.json index a1972774c41..ac7ce9a749a 100644 --- a/packages/swing-store/package.json +++ b/packages/swing-store/package.json @@ -21,7 +21,7 @@ "lint:eslint": "eslint ." }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@endo/base64": "^1.0.5", "@endo/bundle-source": "^3.2.3", diff --git a/packages/swing-store/src/bundleStore.js b/packages/swing-store/src/bundleStore.js index 6482d696757..28f022cfdf6 100644 --- a/packages/swing-store/src/bundleStore.js +++ b/packages/swing-store/src/bundleStore.js @@ -5,7 +5,7 @@ import { Buffer } from 'buffer'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { checkBundle } from '@endo/check-bundle/lite.js'; import { Nat } from '@endo/nat'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { createSHA256 } from './hasher.js'; /** diff --git a/packages/swing-store/src/exporter.js b/packages/swing-store/src/exporter.js index 87590835c29..7e9a745f25f 100644 --- a/packages/swing-store/src/exporter.js +++ b/packages/swing-store/src/exporter.js @@ -1,6 +1,6 @@ import sqlite3 from 'better-sqlite3'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { dbFileInDirectory } from './util.js'; import { getKeyType } from './kvStore.js'; diff --git a/packages/swing-store/src/hasher.js b/packages/swing-store/src/hasher.js index 17153494b35..384425517e5 100644 --- a/packages/swing-store/src/hasher.js +++ b/packages/swing-store/src/hasher.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { createHash } from 'crypto'; diff --git a/packages/swing-store/src/importer.js b/packages/swing-store/src/importer.js index 8b13bfbaddb..4fb1af6b4f6 100644 --- a/packages/swing-store/src/importer.js +++ b/packages/swing-store/src/importer.js @@ -1,4 +1,4 @@ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { makeSwingStore } from './swingStore.js'; import { buffer } from './util.js'; diff --git a/packages/swing-store/src/internal.js b/packages/swing-store/src/internal.js index 890c04b02d3..6abc2485e6d 100644 --- a/packages/swing-store/src/internal.js +++ b/packages/swing-store/src/internal.js @@ -1,4 +1,4 @@ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; /** * @typedef { import('./snapStore.js').SnapStoreInternal } SnapStoreInternal diff --git a/packages/swing-store/src/kvStore.js b/packages/swing-store/src/kvStore.js index bf3e80e740c..646aaf3ae1c 100644 --- a/packages/swing-store/src/kvStore.js +++ b/packages/swing-store/src/kvStore.js @@ -1,5 +1,5 @@ // @ts-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * @typedef {{ diff --git a/packages/swing-store/src/repairMetadata.js b/packages/swing-store/src/repairMetadata.js index 1e40498c30c..dc570dca659 100644 --- a/packages/swing-store/src/repairMetadata.js +++ b/packages/swing-store/src/repairMetadata.js @@ -1,4 +1,4 @@ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { assertComplete } from './assertComplete.js'; /** diff --git a/packages/swing-store/src/snapStore.js b/packages/swing-store/src/snapStore.js index 60ae903d899..c96a49c0343 100644 --- a/packages/swing-store/src/snapStore.js +++ b/packages/swing-store/src/snapStore.js @@ -3,7 +3,7 @@ import { createHash } from 'crypto'; import { finished as finishedCallback, PassThrough, Readable } from 'stream'; import { promisify } from 'util'; import { createGzip, createGunzip } from 'zlib'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { aggregateTryFinally, PromiseAllOrErrors, diff --git a/packages/swing-store/src/swingStore.js b/packages/swing-store/src/swingStore.js index 8201d75b441..ccf9c200687 100644 --- a/packages/swing-store/src/swingStore.js +++ b/packages/swing-store/src/swingStore.js @@ -5,7 +5,7 @@ import * as path from 'path'; import sqlite3 from 'better-sqlite3'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { dbFileInDirectory } from './util.js'; import { makeKVStore, getKeyType } from './kvStore.js'; diff --git a/packages/swing-store/src/transcriptStore.js b/packages/swing-store/src/transcriptStore.js index b3797d73ec3..adbcb71e5d1 100644 --- a/packages/swing-store/src/transcriptStore.js +++ b/packages/swing-store/src/transcriptStore.js @@ -1,7 +1,7 @@ // @ts-check import { Readable } from 'stream'; import { Buffer } from 'buffer'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import BufferLineTransform from '@agoric/internal/src/node/buffer-line-transform.js'; import { createSHA256 } from './hasher.js'; diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index a9a58537640..82706c32f80 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -17,7 +17,7 @@ "lint:eslint": "eslint ." }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/store": "^0.9.2", "@endo/env-options": "^1.1.4", diff --git a/packages/swingset-liveslots/src/cache.js b/packages/swingset-liveslots/src/cache.js index f0129b1ccd4..8c484267223 100644 --- a/packages/swingset-liveslots/src/cache.js +++ b/packages/swingset-liveslots/src/cache.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * @template V diff --git a/packages/swingset-liveslots/src/capdata.js b/packages/swingset-liveslots/src/capdata.js index 2514cfd75d7..bdb9013b81d 100644 --- a/packages/swingset-liveslots/src/capdata.js +++ b/packages/swingset-liveslots/src/capdata.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Assert function to ensure that something expected to be a capdata object diff --git a/packages/swingset-liveslots/src/collectionManager.js b/packages/swingset-liveslots/src/collectionManager.js index 178514988f8..8aa7ddd6e57 100644 --- a/packages/swingset-liveslots/src/collectionManager.js +++ b/packages/swingset-liveslots/src/collectionManager.js @@ -1,4 +1,4 @@ -import { assert, q, Fail } from '@agoric/assert'; +import { assert, q, Fail } from '@endo/errors'; import { Far, passStyleOf } from '@endo/far'; import { zeroPad, diff --git a/packages/swingset-liveslots/src/facetiousness.js b/packages/swingset-liveslots/src/facetiousness.js index bd48e206b28..c58b966a3b2 100644 --- a/packages/swingset-liveslots/src/facetiousness.js +++ b/packages/swingset-liveslots/src/facetiousness.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Assess the facetiousness of a value. If the value is an object containing diff --git a/packages/swingset-liveslots/src/liveslots.js b/packages/swingset-liveslots/src/liveslots.js index f34d9e3db44..b2ccdd18a4f 100644 --- a/packages/swingset-liveslots/src/liveslots.js +++ b/packages/swingset-liveslots/src/liveslots.js @@ -4,7 +4,7 @@ import { getInterfaceOf, makeMarshal, } from '@endo/marshal'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail, X } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { E, HandledPromise } from '@endo/eventual-send'; import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js'; @@ -19,8 +19,6 @@ import { makeWatchedPromiseManager } from './watchedPromises.js'; const SYSCALL_CAPDATA_BODY_SIZE_LIMIT = 10_000_000; const SYSCALL_CAPDATA_SLOTS_LENGTH_LIMIT = 10_000; -const { details: X } = assert; - // 'makeLiveSlots' is a dispatcher which uses javascript Maps to keep track // of local objects which have been exported. These cannot be persisted // beyond the runtime of the javascript environment, so this mechanism is not @@ -747,8 +745,8 @@ function build( try { val = vrm.reanimate(baseRef); } catch (err) { - const wrappedError = assert.error(X`failed to reanimate ${iface}`); - assert.note(wrappedError, X`Original error: ${err}`); + const wrappedError = makeError(X`failed to reanimate ${iface}`); + annotateError(wrappedError, X`Original error: ${err}`); throw wrappedError; } if (facet !== undefined) { diff --git a/packages/swingset-liveslots/src/message.js b/packages/swingset-liveslots/src/message.js index 3da9e83e63f..5dcc513b6d9 100644 --- a/packages/swingset-liveslots/src/message.js +++ b/packages/swingset-liveslots/src/message.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { insistCapData } from './capdata.js'; /** diff --git a/packages/swingset-liveslots/src/parseVatSlots.js b/packages/swingset-liveslots/src/parseVatSlots.js index ade5c09651e..b5e945a30a8 100644 --- a/packages/swingset-liveslots/src/parseVatSlots.js +++ b/packages/swingset-liveslots/src/parseVatSlots.js @@ -1,5 +1,5 @@ import { Nat } from '@endo/nat'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; // NOTE: confusing terminology: "slot" vs. "reference". All these things // called "slots" are references, but the word "slot" suggests something into diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index 3a349f483cc..7c4a9b910e1 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -2,12 +2,7 @@ /* eslint-disable no-use-before-define, jsdoc/require-returns-type */ import { environmentOptionsListHas } from '@endo/env-options'; -import { - assert, - throwRedacted as Fail, - quote as q, - bare as b, -} from '@endo/errors'; +import { assert, throwRedacted as Fail, q, bare as b } from '@endo/errors'; import { assertPattern, mustMatch } from '@agoric/store'; import { defendPrototype, defendPrototypeKit } from '@endo/exo/tools.js'; import { Far, passStyleOf } from '@endo/marshal'; diff --git a/packages/swingset-liveslots/src/virtualReferences.js b/packages/swingset-liveslots/src/virtualReferences.js index 71bdc328db4..10ed3785140 100644 --- a/packages/swingset-liveslots/src/virtualReferences.js +++ b/packages/swingset-liveslots/src/virtualReferences.js @@ -1,6 +1,6 @@ /* eslint-disable no-use-before-define, jsdoc/require-returns-type */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { Nat } from '@endo/nat'; import { parseVatSlot } from './parseVatSlots.js'; import { diff --git a/packages/swingset-liveslots/src/watchedPromises.js b/packages/swingset-liveslots/src/watchedPromises.js index d1095eaee68..e6ccad5d755 100644 --- a/packages/swingset-liveslots/src/watchedPromises.js +++ b/packages/swingset-liveslots/src/watchedPromises.js @@ -2,9 +2,8 @@ // no-lonely-if is a stupid rule that really should be disabled globally /* eslint-disable no-lonely-if */ -import { Fail } from '@endo/errors'; +import { Fail, assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; import { initEmpty, M } from '@agoric/store'; import { parseVatSlot } from './parseVatSlots.js'; diff --git a/packages/swingset-liveslots/test/dummyMeterControl.js b/packages/swingset-liveslots/test/dummyMeterControl.js index 4ff5604bd87..37f9a850bff 100644 --- a/packages/swingset-liveslots/test/dummyMeterControl.js +++ b/packages/swingset-liveslots/test/dummyMeterControl.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; export function makeDummyMeterControl() { let meteringDisabled = 0; diff --git a/packages/swingset-liveslots/test/handled-promises.test.js b/packages/swingset-liveslots/test/handled-promises.test.js index e13c0055cae..3fcbe0d1630 100644 --- a/packages/swingset-liveslots/test/handled-promises.test.js +++ b/packages/swingset-liveslots/test/handled-promises.test.js @@ -1,7 +1,7 @@ import test from 'ava'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { M, provideLazy as provide } from '@agoric/store'; import { makePromiseKit } from '@endo/promise-kit'; // Disabled to avoid circular dependencies. diff --git a/packages/swingset-liveslots/test/liveslots.test.js b/packages/swingset-liveslots/test/liveslots.test.js index d926212eb86..2ebfaafe951 100644 --- a/packages/swingset-liveslots/test/liveslots.test.js +++ b/packages/swingset-liveslots/test/liveslots.test.js @@ -4,7 +4,7 @@ import test from 'ava'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kslot, kser, kunser } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { makeLiveSlots, makeMarshaller } from '../src/liveslots.js'; diff --git a/packages/swingset-liveslots/test/vat-util.js b/packages/swingset-liveslots/test/vat-util.js index 112205ab790..974addf801c 100644 --- a/packages/swingset-liveslots/test/vat-util.js +++ b/packages/swingset-liveslots/test/vat-util.js @@ -1,7 +1,7 @@ // this file is imported by some test vats, so don't import any non-pure // modules -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; export function extractMessage(vatDeliverObject) { diff --git a/packages/swingset-liveslots/test/virtual-objects/rep-tostring.test.js b/packages/swingset-liveslots/test/virtual-objects/rep-tostring.test.js index e75ccf2ee6b..ebf6079f9f6 100644 --- a/packages/swingset-liveslots/test/virtual-objects/rep-tostring.test.js +++ b/packages/swingset-liveslots/test/virtual-objects/rep-tostring.test.js @@ -5,12 +5,11 @@ import './set-debug-label-instances.js'; import { passStyleOf } from '@endo/far'; // this samples it +import { q } from '@endo/errors'; import { makeFakeVirtualStuff } from '../../tools/fakeVirtualSupport.js'; // all tests in this file will be run with DEBUG='label-instances' import { parseVatSlot } from '../../src/parseVatSlots.js'; -const { quote: q } = assert; - const init = () => ({}); const behavior = {}; const facets = { foo: {}, bar: {} }; diff --git a/packages/swingset-liveslots/test/vpid-liveslots.test.js b/packages/swingset-liveslots/test/vpid-liveslots.test.js index e565283c1a8..93b82be7b41 100644 --- a/packages/swingset-liveslots/test/vpid-liveslots.test.js +++ b/packages/swingset-liveslots/test/vpid-liveslots.test.js @@ -4,7 +4,7 @@ import test from 'ava'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { kser, kslot } from '@agoric/kmarshal'; import { buildSyscall, makeDispatch } from './liveslots-helpers.js'; import { makeMessage, makeResolve, makeReject } from './util.js'; diff --git a/packages/swingset-liveslots/tools/fakeVirtualSupport.js b/packages/swingset-liveslots/tools/fakeVirtualSupport.js index 26a6ee51627..fdfa8a59ff0 100644 --- a/packages/swingset-liveslots/tools/fakeVirtualSupport.js +++ b/packages/swingset-liveslots/tools/fakeVirtualSupport.js @@ -1,7 +1,7 @@ /* global globalThis */ /* eslint-disable max-classes-per-file */ import { makeMarshal } from '@endo/marshal'; -import { assert } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { parseVatSlot } from '../src/parseVatSlots.js'; @@ -10,8 +10,6 @@ import { makeWatchedPromiseManager } from '../src/watchedPromises.js'; import { makeFakeVirtualObjectManager } from './fakeVirtualObjectManager.js'; import { makeFakeCollectionManager } from './fakeCollectionManager.js'; -const { Fail } = assert; - const { WeakRef: RealWeakRef, WeakMap: RealWeakMap, diff --git a/packages/swingset-runner/demo/vatFailure/vat-bad.js b/packages/swingset-runner/demo/vatFailure/vat-bad.js index bea73c6da98..c4343ce5f9c 100644 --- a/packages/swingset-runner/demo/vatFailure/vat-bad.js +++ b/packages/swingset-runner/demo/vatFailure/vat-bad.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { kser } from '@agoric/kmarshal'; export default function setup(syscall, _state, _helpers, _vatPowers) { diff --git a/packages/swingset-runner/demo/vatStore2/bootstrap.js b/packages/swingset-runner/demo/vatStore2/bootstrap.js index 83f3f5d2bba..a8d600d4016 100644 --- a/packages/swingset-runner/demo/vatStore2/bootstrap.js +++ b/packages/swingset-runner/demo/vatStore2/bootstrap.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { makeXorShift128 } from './xorshift128.js'; const p = console.log; diff --git a/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js b/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js index 69b82ba7dc8..46fbe3c6771 100644 --- a/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js +++ b/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js @@ -12,7 +12,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-alice.js b/packages/swingset-runner/demo/zoeTests/vat-alice.js index ffedcdbcb5e..5b8fdb4cdf7 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-alice.js +++ b/packages/swingset-runner/demo/zoeTests/vat-alice.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { SECOND_PRICE } from '@agoric/zoe/src/contracts/auction/index.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-bob.js b/packages/swingset-runner/demo/zoeTests/vat-bob.js index cba3b8f0acd..208cd671f61 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-bob.js +++ b/packages/swingset-runner/demo/zoeTests/vat-bob.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-carol.js b/packages/swingset-runner/demo/zoeTests/vat-carol.js index aac126c06a2..4e3a2d4dc9e 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-carol.js +++ b/packages/swingset-runner/demo/zoeTests/vat-carol.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { showPurseBalance, setupIssuers } from './helpers.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-dave.js b/packages/swingset-runner/demo/zoeTests/vat-dave.js index f65526d7908..992ebd928e1 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-dave.js +++ b/packages/swingset-runner/demo/zoeTests/vat-dave.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/swingset-runner/package.json b/packages/swingset-runner/package.json index 218c8a0ede2..3b43718ee38 100644 --- a/packages/swingset-runner/package.json +++ b/packages/swingset-runner/package.json @@ -19,7 +19,7 @@ "ci:autobench": "./autobench.js" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/deploy-script-support": "^0.10.3", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", diff --git a/packages/swingset-runner/src/auditstore.js b/packages/swingset-runner/src/auditstore.js index e024734c86f..568196df3a1 100644 --- a/packages/swingset-runner/src/auditstore.js +++ b/packages/swingset-runner/src/auditstore.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { parseReachableAndVatSlot } from '@agoric/swingset-vat/src/kernel/state/reachable.js'; import { parseVatSlot } from '@agoric/swingset-vat/src/lib/parseVatSlots.js'; diff --git a/packages/swingset-runner/src/chain.js b/packages/swingset-runner/src/chain.js index 7564c768fb0..f8860b8d159 100644 --- a/packages/swingset-runner/src/chain.js +++ b/packages/swingset-runner/src/chain.js @@ -4,7 +4,7 @@ import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import * as STORAGE_PATH from '@agoric/internal/src/chain-storage-paths.js'; import { extractCoreProposalBundles } from '@agoric/deploy-script-support/src/extract-proposal.js'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * Export any specified storage subtrees, then delete the ones marked to clear. diff --git a/packages/swingset-runner/src/slogulator.js b/packages/swingset-runner/src/slogulator.js index b6a7bd301a7..9d8bb9c504a 100644 --- a/packages/swingset-runner/src/slogulator.js +++ b/packages/swingset-runner/src/slogulator.js @@ -3,7 +3,7 @@ import process from 'process'; import Readlines from 'n-readlines'; import yargs from 'yargs'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /* eslint-disable no-use-before-define */ diff --git a/packages/swingset-xsnap-supervisor/lib/capdata.js b/packages/swingset-xsnap-supervisor/lib/capdata.js index 9810af65a23..9466b9058bf 100644 --- a/packages/swingset-xsnap-supervisor/lib/capdata.js +++ b/packages/swingset-xsnap-supervisor/lib/capdata.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Assert function to ensure that something expected to be a capdata object diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js index ca81d767176..d7eb1325744 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js @@ -1,5 +1,5 @@ /* global globalThis WeakRef FinalizationRegistry */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { importBundle } from '@endo/import-bundle'; import { makeLiveSlots, diff --git a/packages/swingset-xsnap-supervisor/package.json b/packages/swingset-xsnap-supervisor/package.json index f7ab24f2db7..89e2b2f20b1 100644 --- a/packages/swingset-xsnap-supervisor/package.json +++ b/packages/swingset-xsnap-supervisor/package.json @@ -23,7 +23,7 @@ "test:xs": "exit 0" }, "devDependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/swingset-liveslots": "^0.10.2", "@endo/bundle-source": "^3.2.3", "@endo/import-bundle": "^1.1.2", diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json index 130435fd8e3..f4d3b6e189f 100644 --- a/packages/telemetry/package.json +++ b/packages/telemetry/package.json @@ -22,7 +22,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/store": "^0.9.2", "@endo/init": "^1.1.2", diff --git a/packages/telemetry/src/flight-recorder.js b/packages/telemetry/src/flight-recorder.js index e6c3048fd5b..8273396c6fe 100644 --- a/packages/telemetry/src/flight-recorder.js +++ b/packages/telemetry/src/flight-recorder.js @@ -5,10 +5,9 @@ import fs from 'node:fs'; import fsp from 'node:fs/promises'; import path from 'node:path'; +import { Fail } from '@endo/errors'; import { serializeSlogObj } from './serialize-slog-obj.js'; -const { Fail } = assert; - export const DEFAULT_CBUF_SIZE = 100 * 1024 * 1024; export const DEFAULT_CBUF_FILE = 'flight-recorder.bin'; export const SLOG_MAGIC = 0x41472d534c4f4721n; // 'AG-SLOG!' diff --git a/packages/telemetry/src/otel-and-flight-recorder.js b/packages/telemetry/src/otel-and-flight-recorder.js index 53818c6d04f..5ce1103daa1 100644 --- a/packages/telemetry/src/otel-and-flight-recorder.js +++ b/packages/telemetry/src/otel-and-flight-recorder.js @@ -1,4 +1,4 @@ -import { NonNullish } from '@agoric/assert'; +import { NonNullish } from '@agoric/internal'; import { makeSlogSender as makeSlogSenderFromEnv } from './make-slog-sender.js'; /** diff --git a/packages/telemetry/src/slog-to-otel.js b/packages/telemetry/src/slog-to-otel.js index e53583d1b21..51b76bd0b8a 100644 --- a/packages/telemetry/src/slog-to-otel.js +++ b/packages/telemetry/src/slog-to-otel.js @@ -1,7 +1,7 @@ import otel, { SpanStatusCode } from '@opentelemetry/api'; import { makeMarshal, Remotable } from '@endo/marshal'; -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { makeLegacyMap } from '@agoric/store'; import { diff --git a/packages/time/package.json b/packages/time/package.json index b116686e2ae..18e541a7295 100644 --- a/packages/time/package.json +++ b/packages/time/package.json @@ -31,7 +31,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@endo/nat": "^5.0.7", "@endo/patterns": "^1.4.0" }, diff --git a/packages/time/src/timeMath.js b/packages/time/src/timeMath.js index 242246609d3..e7769d2f1be 100644 --- a/packages/time/src/timeMath.js +++ b/packages/time/src/timeMath.js @@ -1,11 +1,10 @@ import { Nat } from '@endo/nat'; import { mustMatch } from '@endo/patterns'; +import { Fail, q } from '@endo/errors'; import { RelativeTimeRecordShape, TimestampRecordShape } from './typeGuards.js'; /** @import {RelativeTime, RelativeTimeValue, TimerBrand, TimeMathType, Timestamp, TimestampRecord, TimestampValue} from './types.js' */ -const { Fail, quote: q } = assert; - /** * `agreedTimerBrand` is internal to this module. * diff --git a/packages/vat-data/package.json b/packages/vat-data/package.json index 4709fa621fe..640f61fe7b6 100644 --- a/packages/vat-data/package.json +++ b/packages/vat-data/package.json @@ -19,7 +19,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/base-zone": "^0.1.0", "@agoric/store": "^0.9.2", "@agoric/swingset-liveslots": "^0.10.2", diff --git a/packages/vat-data/src/vat-data-bindings.js b/packages/vat-data/src/vat-data-bindings.js index f336d606ea0..218f25dca11 100644 --- a/packages/vat-data/src/vat-data-bindings.js +++ b/packages/vat-data/src/vat-data-bindings.js @@ -1,6 +1,6 @@ /* global globalThis */ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { provideLazy } from '@agoric/store'; /** @import {Baggage, PickFacet, VatData} from '@agoric/swingset-liveslots' */ diff --git a/packages/vats/package.json b/packages/vats/package.json index 5510a296a5a..848e8899cde 100644 --- a/packages/vats/package.json +++ b/packages/vats/package.json @@ -22,7 +22,7 @@ "author": "Agoric", "license": "Apache-2.0", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cosmic-proto": "^0.4.0", "@agoric/ertp": "^0.16.2", "@agoric/governance": "^0.10.3", diff --git a/packages/vats/src/bridge-target.js b/packages/vats/src/bridge-target.js index e5ea1d29228..483bc125f78 100644 --- a/packages/vats/src/bridge-target.js +++ b/packages/vats/src/bridge-target.js @@ -1,6 +1,7 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; +import { X, Fail } from '@endo/errors'; import { BridgeHandlerI } from './bridge.js'; /** @@ -8,8 +9,6 @@ import { BridgeHandlerI } from './bridge.js'; * too restrictive to work out-of-the-box. */ -const { details: X, Fail } = assert; - /** * @typedef {object} TargetApp an object representing the app that receives * upcalls from the low-level TargetHost on the other side of a bridge @@ -232,11 +231,9 @@ export const prepareBridgeTargetKit = (zone, makeTargetRegistration) => try { targetToApp.init(target, wrappedApp); } catch (cause) { - throw assert.error( - X`Target ${target} already registered`, - undefined, - { cause }, - ); + throw makeError(X`Target ${target} already registered`, undefined, { + cause, + }); } await E(targetHost).sendDowncall({ @@ -274,7 +271,7 @@ export const prepareBridgeTargetKit = (zone, makeTargetRegistration) => try { targetToApp.set(target, wrappedApp); } catch (cause) { - throw assert.error( + throw makeError( X`Target ${target} is already unregistered`, undefined, { cause }, diff --git a/packages/vats/src/bridge.js b/packages/vats/src/bridge.js index b6cacd0bb2c..97179273bec 100644 --- a/packages/vats/src/bridge.js +++ b/packages/vats/src/bridge.js @@ -1,7 +1,7 @@ import { M } from '@agoric/store'; import { E } from '@endo/far'; -const { Fail, details: X } = assert; +import { Fail, X } from '@endo/errors'; export const BridgeHandlerI = M.interface('BridgeHandler', { fromBridge: M.call(M.any()).returns(M.promise()), diff --git a/packages/vats/src/core/basic-behaviors.js b/packages/vats/src/core/basic-behaviors.js index e1ed1a1fc0f..c4b21d0980c 100644 --- a/packages/vats/src/core/basic-behaviors.js +++ b/packages/vats/src/core/basic-behaviors.js @@ -12,15 +12,13 @@ import { provideLazy } from '@agoric/store/src/stores/store-utils.js'; import { E, getInterfaceOf } from '@endo/far'; import { Nat } from '@endo/nat'; -import { Fail, NonNullish } from '@agoric/assert'; +import { Fail, NonNullish, X } from '@endo/errors'; import { makeNameHubKit } from '../nameHub.js'; import { PowerFlags } from '../walletFlags.js'; import { feeIssuerConfig, makeMyAddressNameAdminKit } from './utils.js'; /** @import {GovernableStartFn, GovernanceFacetKit} from '@agoric/governance/src/types.js'; */ -const { details: X } = assert; - /** * In golang/cosmos/app/app.go, we define cosmosInitAction with type * AG_COSMOS_INIT, with the following shape. diff --git a/packages/vats/src/core/chain-behaviors.js b/packages/vats/src/core/chain-behaviors.js index 2cdaafc8489..2378f875518 100644 --- a/packages/vats/src/core/chain-behaviors.js +++ b/packages/vats/src/core/chain-behaviors.js @@ -13,11 +13,11 @@ import * as farExports from '@endo/far'; import { E, Far } from '@endo/far'; import { importBundle } from '@endo/import-bundle'; import { makePromiseKit } from '@endo/promise-kit'; +import { Fail } from '@endo/errors'; import { PowerFlags } from '../walletFlags.js'; import { BASIC_BOOTSTRAP_PERMITS } from './basic-behaviors.js'; import { agoricNamesReserved, callProperties, extractPowers } from './utils.js'; -const { Fail } = assert; const { keys } = Object; /** diff --git a/packages/vats/src/core/client-behaviors.js b/packages/vats/src/core/client-behaviors.js index 778ceb8a86a..f937257fb34 100644 --- a/packages/vats/src/core/client-behaviors.js +++ b/packages/vats/src/core/client-behaviors.js @@ -2,11 +2,10 @@ import { E, Far } from '@endo/far'; import { makePluginManager } from '@agoric/swingset-vat/src/vats/plugin-manager.js'; import { observeNotifier } from '@agoric/notifier'; import { deeplyFulfilledObject } from '@agoric/internal'; +import { Fail } from '@endo/errors'; import { registerNetworkProtocols } from '../proposals/network-proposal.js'; import { makeVatsFromBundles } from './basic-behaviors.js'; -const { Fail } = assert; - const PROVISIONER_INDEX = 1; function makeVattpFrom(vats) { diff --git a/packages/vats/src/core/demoIssuers.js b/packages/vats/src/core/demoIssuers.js index 24fe7c1addc..d5b755c41b3 100644 --- a/packages/vats/src/core/demoIssuers.js +++ b/packages/vats/src/core/demoIssuers.js @@ -9,7 +9,8 @@ import { Nat } from '@endo/nat'; import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js'; import { Stake, Stable } from '@agoric/internal/src/tokens.js'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; + const { multiply, floorDivide } = natSafeMath; const { entries, fromEntries, keys, values } = Object; diff --git a/packages/vats/src/core/lib-boot.js b/packages/vats/src/core/lib-boot.js index 29da9135545..104d879fe21 100644 --- a/packages/vats/src/core/lib-boot.js +++ b/packages/vats/src/core/lib-boot.js @@ -1,5 +1,6 @@ import { E, Far } from '@endo/far'; import { makeHeapZone } from '@agoric/zone'; +import { Fail, q } from '@endo/errors'; import { makeVatSpace, makeWellKnownSpaces, @@ -7,8 +8,6 @@ import { } from './utils.js'; import { makePromiseSpace } from './promise-space.js'; -const { Fail, quote: q } = assert; - /** * @typedef {true * | string diff --git a/packages/vats/src/core/utils.js b/packages/vats/src/core/utils.js index 4e3539622c4..092774a9bd3 100644 --- a/packages/vats/src/core/utils.js +++ b/packages/vats/src/core/utils.js @@ -8,9 +8,9 @@ import { makeNameHubKit } from '../nameHub.js'; import { makeLogHooks, makePromiseSpace } from './promise-space.js'; import './types-ambient.js'; +import { Fail, q } from '@endo/errors'; const { entries, fromEntries, keys } = Object; -const { Fail, quote: q } = assert; /** * Used in bootstrap to reserve names in the agoricNames namespace before any diff --git a/packages/vats/src/ibc.js b/packages/vats/src/ibc.js index c54ae476bce..d75bd27fd18 100644 --- a/packages/vats/src/ibc.js +++ b/packages/vats/src/ibc.js @@ -1,6 +1,6 @@ // @ts-check -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { E } from '@endo/far'; import { byteSourceToBase64, base64ToBytes } from '@agoric/network'; diff --git a/packages/vats/src/lib-board.js b/packages/vats/src/lib-board.js index 90b305b9303..f1c7a23a48f 100644 --- a/packages/vats/src/lib-board.js +++ b/packages/vats/src/lib-board.js @@ -3,7 +3,7 @@ * @see prepareBoardKit() */ -import { assert, Fail, q } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { prepareDurablePublishKit } from '@agoric/notifier'; import { M, makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data'; import { diff --git a/packages/vats/src/localchain.js b/packages/vats/src/localchain.js index 11495090730..32aeca8f9d7 100644 --- a/packages/vats/src/localchain.js +++ b/packages/vats/src/localchain.js @@ -4,7 +4,7 @@ import { M } from '@endo/patterns'; import { AmountShape, BrandShape, PaymentShape } from '@agoric/ertp'; import { Shape as NetworkShape } from '@agoric/network'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @import {TypedJson, ResponseTo, JsonSafe} from '@agoric/cosmic-proto'; diff --git a/packages/vats/src/nameHub.js b/packages/vats/src/nameHub.js index d93d449fb13..814e3030660 100644 --- a/packages/vats/src/nameHub.js +++ b/packages/vats/src/nameHub.js @@ -1,4 +1,4 @@ -import { assert, NonNullish } from '@agoric/assert'; +import { assert, NonNullish, Fail, q } from '@endo/errors'; import { E } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { M, getInterfaceGuardPayload } from '@endo/patterns'; @@ -11,8 +11,6 @@ import { import { makeHeapZone } from '@agoric/zone'; import { deeplyFulfilledObject } from '@agoric/internal'; -const { Fail, quote: q } = assert; - const KeyShape = M.string(); const PathShape = M.arrayOf(KeyShape); diff --git a/packages/vats/src/priceAuthorityRegistry.js b/packages/vats/src/priceAuthorityRegistry.js index eb8bb0e3013..52ae22b0862 100644 --- a/packages/vats/src/priceAuthorityRegistry.js +++ b/packages/vats/src/priceAuthorityRegistry.js @@ -15,7 +15,7 @@ import { PriceAuthorityI } from '@agoric/zoe/src/contractSupport/priceAuthority. * @import {MutableQuote, PriceAuthority, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @typedef {object} Deleter diff --git a/packages/vats/src/proposals/restart-vats-proposal.js b/packages/vats/src/proposals/restart-vats-proposal.js index 7613d833e51..fe4d1611034 100644 --- a/packages/vats/src/proposals/restart-vats-proposal.js +++ b/packages/vats/src/proposals/restart-vats-proposal.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; import { M, mustMatch } from '@agoric/store'; import { E, getInterfaceOf } from '@endo/far'; diff --git a/packages/vats/src/transfer.js b/packages/vats/src/transfer.js index a9a04bd36a7..78d458c15b6 100644 --- a/packages/vats/src/transfer.js +++ b/packages/vats/src/transfer.js @@ -3,14 +3,13 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { VTRANSFER_IBC_EVENT } from '@agoric/internal'; import { coerceToByteSource, byteSourceToBase64 } from '@agoric/network'; +import { Fail, bare } from '@endo/errors'; import { TargetAppI, AppTransformerI } from './bridge-target.js'; /** * @import {TargetApp, TargetHost} from './bridge-target.js' */ -const { Fail, bare } = assert; - /** * The least possibly restrictive guard for a `watch` watcher's `onFulfilled` or * `onRejected` reaction diff --git a/packages/vats/src/vat-bank.js b/packages/vats/src/vat-bank.js index 55d2771ea1c..d6dc1d0eb47 100644 --- a/packages/vats/src/vat-bank.js +++ b/packages/vats/src/vat-bank.js @@ -13,6 +13,7 @@ import { provideLazy } from '@agoric/store'; import { makeDurableZone } from '@agoric/zone/durable.js'; import { E, Far } from '@endo/far'; import { makeAtomicProvider } from '@agoric/store/src/stores/store-utils.js'; +import { Fail } from '@endo/errors'; import { BridgeHandlerI, BridgeScopedManagerI } from './bridge.js'; import { makeVirtualPurseKitIKit, @@ -24,8 +25,6 @@ import { * @import {Passable, RemotableObject} from '@endo/pass-style') */ -const { Fail } = assert; - const { VirtualPurseControllerI } = makeVirtualPurseKitIKit(); const BridgeChannelI = M.interface('BridgeChannel', { diff --git a/packages/vats/src/vat-bridge.js b/packages/vats/src/vat-bridge.js index e18a80fea18..12afdf1e09e 100644 --- a/packages/vats/src/vat-bridge.js +++ b/packages/vats/src/vat-bridge.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; import { makeDurableZone } from '@agoric/zone/durable.js'; import * as cb from '@agoric/internal/src/callback.js'; diff --git a/packages/vats/src/virtual-purse.js b/packages/vats/src/virtual-purse.js index c08b39751ae..1d23dd278a4 100644 --- a/packages/vats/src/virtual-purse.js +++ b/packages/vats/src/virtual-purse.js @@ -12,7 +12,7 @@ import { import { getInterfaceGuardPayload } from '@endo/patterns'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * @param {Pattern} [brandShape] diff --git a/packages/vats/test/localchain.test.js b/packages/vats/test/localchain.test.js index ea09acf92c5..46a244c6608 100644 --- a/packages/vats/test/localchain.test.js +++ b/packages/vats/test/localchain.test.js @@ -1,13 +1,12 @@ // @ts-check import { test as anyTest } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { NonNullish } from '@agoric/assert'; +import { NonNullish, VTRANSFER_IBC_EVENT } from '@agoric/internal'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { reincarnate } from '@agoric/swingset-liveslots/tools/setup-vat-data.js'; import { withAmountUtils } from '@agoric/zoe/tools/test-utils.js'; import { makeDurableZone } from '@agoric/zone/durable.js'; import { getInterfaceOf } from '@endo/marshal'; -import { VTRANSFER_IBC_EVENT } from '@agoric/internal'; import { prepareVowTools, V as E } from '@agoric/vow/vat.js'; import { prepareLocalChainTools } from '../src/localchain.js'; import { prepareBridgeTargetModule } from '../src/bridge-target.js'; diff --git a/packages/vats/tools/boot-test-utils.js b/packages/vats/tools/boot-test-utils.js index 827f8f4f2c0..d838f65744f 100644 --- a/packages/vats/tools/boot-test-utils.js +++ b/packages/vats/tools/boot-test-utils.js @@ -5,6 +5,7 @@ import { import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { Far } from '@endo/marshal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; +import { Fail } from '@endo/errors'; import { bundles, devices } from '../test/devices.js'; import { buildRootObject as agoricNamesRoot } from '../src/vat-agoricNames.js'; @@ -17,8 +18,6 @@ import { buildRootObject as priceAuthorityRoot } from '../src/vat-priceAuthority import { buildRootObject as provisioningRoot } from '../src/vat-provisioning.js'; import { buildRootObject as zoeRoot } from '../src/vat-zoe.js'; -const { Fail } = assert; - export const vatRoots = { agoricNames: agoricNamesRoot, bank: bankRoot, diff --git a/packages/vats/tools/fake-bridge.js b/packages/vats/tools/fake-bridge.js index 9976648508e..3434c4c2af9 100644 --- a/packages/vats/tools/fake-bridge.js +++ b/packages/vats/tools/fake-bridge.js @@ -1,5 +1,5 @@ // @ts-check -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { makeTracer, VBankAccount } from '@agoric/internal'; import { E } from '@endo/far'; import { makeWhen } from '@agoric/vow/src/when.js'; diff --git a/packages/vow/package.json b/packages/vow/package.json index 40e793d781b..44b014db30e 100755 --- a/packages/vow/package.json +++ b/packages/vow/package.json @@ -23,6 +23,7 @@ "@agoric/base-zone": "^0.1.0", "@agoric/internal": "^0.3.2", "@endo/env-options": "^1.1.4", + "@endo/errors": "^1.2.2", "@endo/eventual-send": "^1.2.2", "@endo/pass-style": "^1.4.0", "@endo/patterns": "^1.4.0", diff --git a/packages/vow/src/E.js b/packages/vow/src/E.js index e243a2304c5..dc32a17f792 100644 --- a/packages/vow/src/E.js +++ b/packages/vow/src/E.js @@ -15,10 +15,10 @@ * designed to be a drop-in replacement for the version in * `@endo/eventual-send/src/E.js` which contained no concept of "unwrap", */ +import { X, q, Fail } from '@endo/errors'; import { trackTurns } from './track-turns.js'; import { makeMessageBreakpointTester } from './message-breakpoints.js'; -const { details: X, quote: q, Fail } = assert; const { assign, create } = Object; const onSend = makeMessageBreakpointTester('ENDO_SEND_BREAKPOINTS'); @@ -79,7 +79,7 @@ const makeEProxyHandler = (recipient, HandledPromise, unwrap) => if (this !== receiver) { // Reject the async function call return HandledPromise.reject( - assert.error( + makeError( X`Unexpected receiver for "${q(propertyKey)}" method of E(${q( recipient, )})`, diff --git a/packages/vow/src/message-breakpoints.js b/packages/vow/src/message-breakpoints.js index fd161cde942..860cf6fbe1a 100644 --- a/packages/vow/src/message-breakpoints.js +++ b/packages/vow/src/message-breakpoints.js @@ -1,7 +1,7 @@ // @ts-check import { getEnvironmentOption } from '@endo/env-options'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; const { hasOwn, freeze, entries } = Object; diff --git a/packages/vow/src/track-turns.js b/packages/vow/src/track-turns.js index 154121142df..6b5ab5a11cd 100644 --- a/packages/vow/src/track-turns.js +++ b/packages/vow/src/track-turns.js @@ -6,7 +6,7 @@ import { } from '@endo/env-options'; // NOTE: We can't import these because they're not in scope before lockdown. -// import { assert, details as X, Fail } from '@agoric/assert'; +// import { assert, X, Fail } from '@endo/errors'; // WARNING: Global Mutable State! // This state is communicated to `assert` that makes it available to the @@ -34,7 +34,7 @@ const ENABLED = const addRejectionNote = detailsNote => reason => { if (reason instanceof Error) { - assert.note(reason, detailsNote); + annotateError(reason, detailsNote); } if (VERBOSE) { console.log('REJECTED at top of event loop', reason); @@ -53,7 +53,7 @@ const wrapFunction = result = func(...args); } catch (err) { if (err instanceof Error) { - assert.note( + annotateError( err, X`Thrown from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`, ); @@ -91,14 +91,14 @@ export const trackTurns = funcs => { if (!ENABLED || typeof globalThis === 'undefined' || !globalThis.assert) { return funcs; } - const { details: X } = assert; + import { X } from '@endo/errors'; hiddenCurrentEvent += 1; const sendingError = Error( `Event: ${hiddenCurrentTurn}.${hiddenCurrentEvent}`, ); if (hiddenPriorError !== undefined) { - assert.note(sendingError, X`Caused by: ${hiddenPriorError}`); + annotateError(sendingError, X`Caused by: ${hiddenPriorError}`); } return /** @type {T} */ ( diff --git a/packages/wallet/api/deploy.js b/packages/wallet/api/deploy.js index 0fd036d40ef..0534c8cfac1 100644 --- a/packages/wallet/api/deploy.js +++ b/packages/wallet/api/deploy.js @@ -3,7 +3,7 @@ // FIXME: This is just hacked together for the legacy wallet. import { E } from '@endo/eventual-send'; -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import path from 'path'; const dirname = path.dirname(new URL(import.meta.url).pathname); diff --git a/packages/wallet/api/package.json b/packages/wallet/api/package.json index 217d8791f7c..572196f329a 100644 --- a/packages/wallet/api/package.json +++ b/packages/wallet/api/package.json @@ -21,7 +21,7 @@ "ava": "^5.3.0" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/cache": "^0.3.2", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", diff --git a/packages/wallet/api/src/findOrMakeInvitation.js b/packages/wallet/api/src/findOrMakeInvitation.js index e0f49b42266..a993a179343 100644 --- a/packages/wallet/api/src/findOrMakeInvitation.js +++ b/packages/wallet/api/src/findOrMakeInvitation.js @@ -1,4 +1,4 @@ -import { assert, Fail, q } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { passStyleOf } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; diff --git a/packages/wallet/api/src/issuerTable.js b/packages/wallet/api/src/issuerTable.js index f9880b7b29b..9a5e6552c2e 100644 --- a/packages/wallet/api/src/issuerTable.js +++ b/packages/wallet/api/src/issuerTable.js @@ -1,6 +1,6 @@ // @ts-check -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makeScalarWeakMapStore } from '@agoric/store'; diff --git a/packages/wallet/api/src/lib-dehydrate.js b/packages/wallet/api/src/lib-dehydrate.js index b4f7defb55e..63c82729547 100644 --- a/packages/wallet/api/src/lib-dehydrate.js +++ b/packages/wallet/api/src/lib-dehydrate.js @@ -2,7 +2,7 @@ import { makeMarshal, mapIterable } from '@endo/marshal'; import { makeLegacyMap, makeScalarMapStore } from '@agoric/store'; -import { assert, Fail, q } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; /** * @typedef {string[]} Path diff --git a/packages/wallet/api/src/lib-wallet.js b/packages/wallet/api/src/lib-wallet.js index c91126981c4..6efd0fc6f6e 100644 --- a/packages/wallet/api/src/lib-wallet.js +++ b/packages/wallet/api/src/lib-wallet.js @@ -11,7 +11,7 @@ * and dapps. */ -import { assert, q, Fail } from '@agoric/assert'; +import { assert, q, Fail } from '@endo/errors'; import { makeScalarStoreCoordinator } from '@agoric/cache'; import { objectMap, WalletName } from '@agoric/internal'; import { slotStringUnserialize } from '@agoric/internal/src/storage-test-utils.js'; diff --git a/packages/wallet/api/test/lib-wallet.test.js b/packages/wallet/api/test/lib-wallet.test.js index 1d7b26a90db..087cbd09e52 100644 --- a/packages/wallet/api/test/lib-wallet.test.js +++ b/packages/wallet/api/test/lib-wallet.test.js @@ -10,7 +10,7 @@ import { M } from '@agoric/store'; import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js'; import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js'; import { makeNameHubKit, diff --git a/packages/xsnap/package.json b/packages/xsnap/package.json index 3d67a418912..12591dca544 100644 --- a/packages/xsnap/package.json +++ b/packages/xsnap/package.json @@ -27,7 +27,7 @@ "test:xs": "exit 0" }, "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/internal": "^0.3.2", "@agoric/xsnap-lockdown": "^0.14.0", "@endo/bundle-source": "^3.2.3", diff --git a/packages/xsnap/src/avaXS.js b/packages/xsnap/src/avaXS.js index 082bce4acda..09778dfde84 100644 --- a/packages/xsnap/src/avaXS.js +++ b/packages/xsnap/src/avaXS.js @@ -11,7 +11,7 @@ import '@endo/init'; import fs from 'fs'; import { tmpName } from 'tmp'; -import { assert, q, Fail } from '@agoric/assert'; +import { assert, q, Fail } from '@endo/errors'; import { getDebugLockdownBundle } from '@agoric/xsnap-lockdown'; import { xsnap } from './xsnap.js'; diff --git a/packages/xsnap/src/xsnap.js b/packages/xsnap/src/xsnap.js index 77ab250a2c8..9fbe590caac 100644 --- a/packages/xsnap/src/xsnap.js +++ b/packages/xsnap/src/xsnap.js @@ -18,11 +18,10 @@ import { makeNetstringReader, makeNetstringWriter } from '@endo/netstring'; import { makeNodeReader, makeNodeWriter } from '@endo/stream-node'; import { makePromiseKit, racePromises } from '@endo/promise-kit'; import { forever } from '@agoric/internal'; +import { Fail, q } from '@endo/errors'; import { ErrorCode, ErrorSignal, ErrorMessage, METER_TYPE } from '../api.js'; import { defer } from './defer.js'; -const { Fail, quote: q } = assert; - // This will need adjustment, but seems to be fine for a start. export const DEFAULT_CRANK_METERING_LIMIT = 1e8; diff --git a/packages/zoe/README.md b/packages/zoe/README.md index ba6747cbda5..80c5f229adf 100644 --- a/packages/zoe/README.md +++ b/packages/zoe/README.md @@ -80,7 +80,7 @@ For example, suppose v1 code of a simple single-increment-counter contract antic import { M } from '@agoric/store'; import { prepareExo, prepareExoClass } from '@agoric/vat-data'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; export const start = async (zcf, _privateArgs, instanceBaggage) => { const CODE_VERSION = 2; diff --git a/packages/zoe/package.json b/packages/zoe/package.json index bb33081e34c..d98f74da5a8 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -43,7 +43,7 @@ }, "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { - "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.2.2", "@agoric/base-zone": "^0.1.0", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", diff --git a/packages/zoe/src/cleanProposal.js b/packages/zoe/src/cleanProposal.js index 37fd8bef2bd..c807ee0947f 100644 --- a/packages/zoe/src/cleanProposal.js +++ b/packages/zoe/src/cleanProposal.js @@ -1,4 +1,4 @@ -import { assert, q, Fail } from '@agoric/assert'; +import { assert, q, Fail } from '@endo/errors'; import { AmountMath, getAssetKind } from '@agoric/ertp'; import { objectMap } from '@agoric/internal'; import { assertRecord } from '@endo/marshal'; diff --git a/packages/zoe/src/contractFacet/allocationMath.js b/packages/zoe/src/contractFacet/allocationMath.js index 6160de05551..c72f43baed2 100644 --- a/packages/zoe/src/contractFacet/allocationMath.js +++ b/packages/zoe/src/contractFacet/allocationMath.js @@ -1,6 +1,6 @@ import { AmountMath } from '@agoric/ertp'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; /** * @callback Operation diff --git a/packages/zoe/src/contractFacet/exit.js b/packages/zoe/src/contractFacet/exit.js index ac1cd92791e..8ca0593aba1 100644 --- a/packages/zoe/src/contractFacet/exit.js +++ b/packages/zoe/src/contractFacet/exit.js @@ -3,14 +3,13 @@ import { prepareExoClass, provideDurableSetStore } from '@agoric/vat-data'; import { M, initEmpty } from '@agoric/store'; import { TimestampShape } from '@agoric/time'; +import { Fail, q } from '@endo/errors'; import { isOnDemandExitRule, isAfterDeadlineExitRule, isWaivedExitRule, } from '../typeGuards.js'; -const { Fail, quote: q } = assert; - const ExitObjectI = M.interface('ExitObject', { exit: M.call().returns() }); const WakerI = M.interface('Waker', { wake: M.call(TimestampShape).returns(), diff --git a/packages/zoe/src/contractFacet/reallocate.js b/packages/zoe/src/contractFacet/reallocate.js index f09b7f031c4..3fc46e1f9c6 100644 --- a/packages/zoe/src/contractFacet/reallocate.js +++ b/packages/zoe/src/contractFacet/reallocate.js @@ -1,10 +1,9 @@ import { makeScalarMapStore } from '@agoric/vat-data'; +import { Fail } from '@endo/errors'; import { assertRightsConserved } from './rightsConservation.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; -const { Fail } = assert; - /** @typedef {Array} TransactionList */ /** diff --git a/packages/zoe/src/contractFacet/rightsConservation.js b/packages/zoe/src/contractFacet/rightsConservation.js index 23b5a946907..34bd80126f8 100644 --- a/packages/zoe/src/contractFacet/rightsConservation.js +++ b/packages/zoe/src/contractFacet/rightsConservation.js @@ -1,5 +1,5 @@ import { makeScalarMapStore } from '@agoric/store'; -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import '../internal-types.js'; diff --git a/packages/zoe/src/contractFacet/vatRoot.js b/packages/zoe/src/contractFacet/vatRoot.js index befea18e9c6..e1f179e305c 100644 --- a/packages/zoe/src/contractFacet/vatRoot.js +++ b/packages/zoe/src/contractFacet/vatRoot.js @@ -12,10 +12,9 @@ import { E } from '@endo/far'; import '../internal-types.js'; +import { Fail } from '@endo/errors'; import { makeZCFZygote } from './zcfZygote.js'; -const { Fail } = assert; - /** * @param {VatPowers & { testJigSetter: TestJigSetter }} powers * @param {{contractBundleCap: BundleCap, zoeService: ZoeService, invitationIssuer: Issuer<'set'>, privateArgs?: any}} vatParameters diff --git a/packages/zoe/src/contractFacet/zcfMint.js b/packages/zoe/src/contractFacet/zcfMint.js index e6cf7833950..afa475e55b6 100644 --- a/packages/zoe/src/contractFacet/zcfMint.js +++ b/packages/zoe/src/contractFacet/zcfMint.js @@ -3,6 +3,7 @@ import { AmountMath } from '@agoric/ertp'; import { prepareExoClass } from '@agoric/vat-data'; import { E } from '@endo/eventual-send'; +import { Fail } from '@endo/errors'; import { coerceAmountKeywordRecord } from '../cleanProposal.js'; import { assertFullIssuerRecord, makeIssuerRecord } from '../issuerRecord.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; @@ -12,8 +13,6 @@ import { ZcfMintI } from '../typeGuards.js'; import './internal-types.js'; import './types-ambient.js'; -const { Fail } = assert; - /** * @param {AmountKeywordRecord} amr * @param {IssuerRecord} issuerRecord diff --git a/packages/zoe/src/contractFacet/zcfSeat.js b/packages/zoe/src/contractFacet/zcfSeat.js index 898a635c67f..dff84c2170e 100644 --- a/packages/zoe/src/contractFacet/zcfSeat.js +++ b/packages/zoe/src/contractFacet/zcfSeat.js @@ -11,6 +11,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { initEmpty, M } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { isOfferSafe } from './offerSafety.js'; import { assertRightsConserved } from './rightsConservation.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; @@ -23,8 +24,6 @@ import { import { makeAllocationMap } from './reallocate.js'; import { TransferPartShape } from '../contractSupport/atomicTransfer.js'; -const { Fail } = assert; - /** * The SeatManager holds the active zcfSeats and can reallocate and * make new zcfSeats. @@ -181,7 +180,7 @@ export const createSeatManager = ( const { self } = this; if (typeof reason === 'string') { reason = Error(reason); - assert.note( + annotateError( reason, 'ZCFSeat.fail was called with a string reason, but requires an Error argument.', ); diff --git a/packages/zoe/src/contractFacet/zcfZygote.js b/packages/zoe/src/contractFacet/zcfZygote.js index 49384f0b8b4..4d6881b7a25 100644 --- a/packages/zoe/src/contractFacet/zcfZygote.js +++ b/packages/zoe/src/contractFacet/zcfZygote.js @@ -14,6 +14,7 @@ import { passStyleOf, Remotable } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; import { objectMap } from '@agoric/internal'; +import { Fail } from '@endo/errors'; import { cleanProposal } from '../cleanProposal.js'; import { handlePKitWarning } from '../handleWarning.js'; import { makeInstanceRecordStorage } from '../instanceRecordStorage.js'; @@ -32,8 +33,6 @@ import { prepareZcMint } from './zcfMint.js'; /** @import {IssuerOptionsRecord} from '@agoric/ertp' */ -const { Fail } = assert; - /** * Make the ZCF vat in zygote-usable form. First, a generic ZCF is * made, then the contract code is evaluated, then a particular diff --git a/packages/zoe/src/contractSupport/bondingCurves.js b/packages/zoe/src/contractSupport/bondingCurves.js index 347561ee43a..113c74d13b1 100644 --- a/packages/zoe/src/contractSupport/bondingCurves.js +++ b/packages/zoe/src/contractSupport/bondingCurves.js @@ -1,10 +1,10 @@ -// @jessie-check +/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check import { Nat } from '@endo/nat'; +import { Fail } from '@endo/errors'; import { natSafeMath } from './safeMath.js'; const { subtract, add, multiply, floorDivide } = natSafeMath; -const { Fail } = assert; const BASIS_POINTS = 10000n; // TODO change to 10_000n once tooling copes. diff --git a/packages/zoe/src/contractSupport/priceAuthority.js b/packages/zoe/src/contractSupport/priceAuthority.js index 75c454a55e6..a3b9564b715 100644 --- a/packages/zoe/src/contractSupport/priceAuthority.js +++ b/packages/zoe/src/contractSupport/priceAuthority.js @@ -12,7 +12,7 @@ import { M } from '@agoric/store'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery, PriceQuoteCreate, PriceAuthorityKit, PriceQuoteTrigger, MutableQuote,} from '@agoric/zoe/tools/types.js'; */ -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; const trace = makeTracer('PA', false); diff --git a/packages/zoe/src/contractSupport/priceAuthorityTransform.js b/packages/zoe/src/contractSupport/priceAuthorityTransform.js index fbfd509c707..46efd7e202f 100644 --- a/packages/zoe/src/contractSupport/priceAuthorityTransform.js +++ b/packages/zoe/src/contractSupport/priceAuthorityTransform.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail, assert } from '@agoric/assert'; +import { Fail, assert } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { makeNotifier } from '@agoric/notifier'; diff --git a/packages/zoe/src/contractSupport/priceQuote.js b/packages/zoe/src/contractSupport/priceQuote.js index ff8b22e4c6b..04ea2074ffc 100644 --- a/packages/zoe/src/contractSupport/priceQuote.js +++ b/packages/zoe/src/contractSupport/priceQuote.js @@ -8,7 +8,7 @@ import { E } from '@endo/eventual-send'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; // PriceAuthorities return quotes as a pair of an amount and a payment, both // with the same value. The underlying amount wraps amountIn, amountOut, timer diff --git a/packages/zoe/src/contractSupport/ratio.js b/packages/zoe/src/contractSupport/ratio.js index 7635ce7d7b8..9beb84852c5 100644 --- a/packages/zoe/src/contractSupport/ratio.js +++ b/packages/zoe/src/contractSupport/ratio.js @@ -1,5 +1,5 @@ /// -import { q, Fail } from '@agoric/assert'; +import { q, Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { assertRecord } from '@endo/marshal'; import { isNat } from '@endo/nat'; diff --git a/packages/zoe/src/contractSupport/recorder.js b/packages/zoe/src/contractSupport/recorder.js index 7c9e63f7536..65c0d7d324d 100644 --- a/packages/zoe/src/contractSupport/recorder.js +++ b/packages/zoe/src/contractSupport/recorder.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { StorageNodeShape } from '@agoric/internal'; import { prepareDurablePublishKit } from '@agoric/notifier'; import { diff --git a/packages/zoe/src/contractSupport/stateMachine.js b/packages/zoe/src/contractSupport/stateMachine.js index 2f505a370ef..eb4e3296927 100644 --- a/packages/zoe/src/contractSupport/stateMachine.js +++ b/packages/zoe/src/contractSupport/stateMachine.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; /* allowedTransitions is an array of arrays which gets turned into a * map. The map maps string states to an array of potential next diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index 74c4b683a6e..c46fa082144 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -4,13 +4,12 @@ import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { AssetKind } from '@agoric/ertp'; import { fromUniqueEntries } from '@agoric/internal'; +import { Fail } from '@endo/errors'; import { satisfiesWant } from '../contractFacet/offerSafety.js'; import { atomicTransfer, fromOnly, toOnly } from './atomicTransfer.js'; export const defaultAcceptanceMsg = `The offer has been accepted. Once the contract has been completed, please check your payout`; -const { Fail } = assert; - const getKeysSorted = obj => harden(Reflect.ownKeys(obj || {}).sort()); export const assertIssuerKeywords = (zcf, expected) => { diff --git a/packages/zoe/src/contracts/auction/assertBidSeat.js b/packages/zoe/src/contracts/auction/assertBidSeat.js index 84a9626b057..be392b81187 100644 --- a/packages/zoe/src/contracts/auction/assertBidSeat.js +++ b/packages/zoe/src/contracts/auction/assertBidSeat.js @@ -1,4 +1,4 @@ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; export const assertBidSeat = (zcf, sellSeat, bidSeat) => { diff --git a/packages/zoe/src/contracts/auction/index.js b/packages/zoe/src/contracts/auction/index.js index 149699f2c7c..f960272d42d 100644 --- a/packages/zoe/src/contracts/auction/index.js +++ b/packages/zoe/src/contracts/auction/index.js @@ -5,6 +5,7 @@ import { Far } from '@endo/marshal'; import { TimeMath, RelativeTimeShape } from '@agoric/time'; // Eventually will be importable from '@agoric/zoe-contract-support' +import { Fail } from '@endo/errors'; import { defaultAcceptanceMsg, assertIssuerKeywords, @@ -14,8 +15,6 @@ import * as secondPriceLogic from './secondPriceLogic.js'; import * as firstPriceLogic from './firstPriceLogic.js'; import { assertBidSeat } from './assertBidSeat.js'; -const { Fail } = assert; - const FIRST_PRICE = 'first-price'; const SECOND_PRICE = 'second-price'; diff --git a/packages/zoe/src/contracts/autoswap.js b/packages/zoe/src/contracts/autoswap.js index 40939bbf65d..93d1e7d469b 100644 --- a/packages/zoe/src/contracts/autoswap.js +++ b/packages/zoe/src/contracts/autoswap.js @@ -1,5 +1,5 @@ import { Far } from '@endo/marshal'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { AmountMath, isNatValue } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' diff --git a/packages/zoe/src/contracts/callSpread/calculateShares.js b/packages/zoe/src/contracts/callSpread/calculateShares.js index 47bd8a781d9..ff6e189d062 100644 --- a/packages/zoe/src/contracts/callSpread/calculateShares.js +++ b/packages/zoe/src/contracts/callSpread/calculateShares.js @@ -1,7 +1,7 @@ /// import { AmountMath, isNatValue } from '@agoric/ertp'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeRatio, oneMinus } from '../../contractSupport/index.js'; import { make100Percent, make0Percent } from './percent.js'; diff --git a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js index 929a2c0da4f..ec203e0bb66 100644 --- a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js +++ b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js @@ -5,6 +5,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; +import { Fail } from '@endo/errors'; import { assertProposalShape, depositToSeat, @@ -19,8 +20,6 @@ import { Position } from './position.js'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail } = assert; - const PERCENT_BASE = 100n; const BASIS_POINTS = 10000n; diff --git a/packages/zoe/src/contracts/coveredCall-durable.js b/packages/zoe/src/contracts/coveredCall-durable.js index 1b161576217..e654ac7ca6a 100644 --- a/packages/zoe/src/contracts/coveredCall-durable.js +++ b/packages/zoe/src/contracts/coveredCall-durable.js @@ -1,10 +1,9 @@ import { mustMatch, M } from '@agoric/store'; import { prepareExo, prepareExoClass } from '@agoric/vat-data'; +import { Fail } from '@endo/errors'; import { swapExact } from '../contractSupport/index.js'; import { isAfterDeadlineExitRule, OfferHandlerI } from '../typeGuards.js'; -const { Fail } = assert; - const sellSeatExpiredMsg = 'The covered call option is expired.'; /** diff --git a/packages/zoe/src/contracts/coveredCall.js b/packages/zoe/src/contracts/coveredCall.js index 09228dab326..0c54a9620a8 100644 --- a/packages/zoe/src/contracts/coveredCall.js +++ b/packages/zoe/src/contracts/coveredCall.js @@ -1,10 +1,9 @@ import { M, mustMatch } from '@agoric/store'; // Eventually will be importable from '@agoric/zoe-contract-support' +import { Fail, q } from '@endo/errors'; import { swapExact } from '../contractSupport/index.js'; import { isAfterDeadlineExitRule } from '../typeGuards.js'; -const { Fail, quote: q } = assert; - /** * A call option is the right (but not the obligation) to buy digital * assets at a pre-determined price, called the strike price. This diff --git a/packages/zoe/src/contracts/loan/borrow.js b/packages/zoe/src/contracts/loan/borrow.js index af720c00e9d..aca8c6fc426 100644 --- a/packages/zoe/src/contracts/loan/borrow.js +++ b/packages/zoe/src/contracts/loan/borrow.js @@ -1,4 +1,4 @@ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; diff --git a/packages/zoe/src/contracts/loan/close.js b/packages/zoe/src/contracts/loan/close.js index 5a83051bd01..38db51aa9e0 100644 --- a/packages/zoe/src/contracts/loan/close.js +++ b/packages/zoe/src/contracts/loan/close.js @@ -1,6 +1,6 @@ /// -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { assertProposalShape } from '../../contractSupport/index.js'; diff --git a/packages/zoe/src/contracts/loan/updateDebt.js b/packages/zoe/src/contracts/loan/updateDebt.js index 94c4678e405..8569f459af0 100644 --- a/packages/zoe/src/contracts/loan/updateDebt.js +++ b/packages/zoe/src/contracts/loan/updateDebt.js @@ -1,6 +1,6 @@ import { Far } from '@endo/marshal'; import { makeNotifierKit, observeNotifier } from '@agoric/notifier'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; @@ -70,7 +70,7 @@ export const makeDebtCalculator = debtCalculatorConfig => { } }, fail: reason => { - assert.note( + annotateError( reason, X`Period problem: ${originalDebt}, started: ${basetime}, debt: ${debt}`, ); @@ -79,7 +79,7 @@ export const makeDebtCalculator = debtCalculatorConfig => { }); observeNotifier(periodNotifier, periodObserver).catch(reason => { - assert.note( + annotateError( reason, X`Unable to updateDebt originally: ${originalDebt}, started: ${basetime}, debt: ${debt}`, ); diff --git a/packages/zoe/src/contracts/mintAndSellNFT.js b/packages/zoe/src/contracts/mintAndSellNFT.js index ae8f7863239..4eaef68d1a6 100644 --- a/packages/zoe/src/contracts/mintAndSellNFT.js +++ b/packages/zoe/src/contracts/mintAndSellNFT.js @@ -2,7 +2,7 @@ import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js'; /** diff --git a/packages/zoe/src/contracts/oracle.js b/packages/zoe/src/contracts/oracle.js index a15bcc11184..f9338017418 100644 --- a/packages/zoe/src/contracts/oracle.js +++ b/packages/zoe/src/contracts/oracle.js @@ -1,5 +1,5 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ -import { assert, Fail } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; diff --git a/packages/zoe/src/contracts/otcDesk.js b/packages/zoe/src/contracts/otcDesk.js index 6259dfa1791..a52204600d2 100644 --- a/packages/zoe/src/contracts/otcDesk.js +++ b/packages/zoe/src/contracts/otcDesk.js @@ -1,5 +1,5 @@ import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { Far } from '@endo/marshal'; import { offerTo, diff --git a/packages/zoe/src/contracts/priceAggregator.js b/packages/zoe/src/contracts/priceAggregator.js index 81be2fb4ecf..768a20c3b81 100644 --- a/packages/zoe/src/contracts/priceAggregator.js +++ b/packages/zoe/src/contracts/priceAggregator.js @@ -1,5 +1,5 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { assertAllDefined } from '@agoric/internal'; import { diff --git a/packages/zoe/src/contracts/sellItems.js b/packages/zoe/src/contracts/sellItems.js index c4dd855922c..795815743bf 100644 --- a/packages/zoe/src/contracts/sellItems.js +++ b/packages/zoe/src/contracts/sellItems.js @@ -7,6 +7,7 @@ import { observeIteration, subscribeLatest, } from '@agoric/notifier'; +import { Fail } from '@endo/errors'; import { assertIssuerKeywords, defaultAcceptanceMsg, @@ -14,8 +15,6 @@ import { assertNatAssetKind, } from '../contractSupport/index.js'; -const { Fail } = assert; - /** * Sell items in exchange for money. Items may be fungible or * non-fungible and multiple items may be bought at once. Money must diff --git a/packages/zoe/src/instanceRecordStorage.js b/packages/zoe/src/instanceRecordStorage.js index caa99f02c76..6cd27d321ef 100644 --- a/packages/zoe/src/instanceRecordStorage.js +++ b/packages/zoe/src/instanceRecordStorage.js @@ -1,4 +1,5 @@ import { provide, prepareExoClass, M } from '@agoric/vat-data'; +import { q, Fail } from '@endo/errors'; import { assertKeywordName } from './cleanProposal.js'; import { BrandKeywordRecordShape, @@ -12,8 +13,6 @@ import { const { ownKeys } = Reflect; -const { quote: q, Fail } = assert; - /** * The InstanceRecord stores the installation, customTerms, issuers, * and brands for a particular Zoe contract instance. The installation diff --git a/packages/zoe/src/issuerRecord.js b/packages/zoe/src/issuerRecord.js index 60c1da35ffa..4c2071a192b 100644 --- a/packages/zoe/src/issuerRecord.js +++ b/packages/zoe/src/issuerRecord.js @@ -1,5 +1,5 @@ // @jessie-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; /** * Put together information about the issuer in a standard format that diff --git a/packages/zoe/src/issuerStorage.js b/packages/zoe/src/issuerStorage.js index 55f776d35e5..c1810702a60 100644 --- a/packages/zoe/src/issuerStorage.js +++ b/packages/zoe/src/issuerStorage.js @@ -2,11 +2,10 @@ import { deeplyFulfilledObject, objectMap } from '@agoric/internal'; import { provideDurableWeakMapStore } from '@agoric/vat-data'; import { E } from '@endo/eventual-send'; +import { Fail } from '@endo/errors'; import { cleanKeywords } from './cleanProposal.js'; import { makeIssuerRecord } from './issuerRecord.js'; -const { Fail } = assert; - const STORAGE_INSTANTIATED_KEY = 'IssuerStorageInstantiated'; /** diff --git a/packages/zoe/src/makeHandle.js b/packages/zoe/src/makeHandle.js index f01c046c532..89365027898 100644 --- a/packages/zoe/src/makeHandle.js +++ b/packages/zoe/src/makeHandle.js @@ -1,13 +1,11 @@ // @jessie-check -import { assert } from '@agoric/assert'; +import { assert, Fail } from '@endo/errors'; import { initEmpty, makeExo } from '@agoric/store'; import { prepareExoClass } from '@agoric/vat-data'; import { HandleI } from './typeGuards.js'; -const { Fail } = assert; - /** @import {Baggage} from '@agoric/vat-data' */ /** diff --git a/packages/zoe/src/zoeService/createZCFVat.js b/packages/zoe/src/zoeService/createZCFVat.js index e1437e7b7e6..003f8989bf2 100644 --- a/packages/zoe/src/zoeService/createZCFVat.js +++ b/packages/zoe/src/zoeService/createZCFVat.js @@ -2,7 +2,7 @@ import { E } from '@endo/eventual-send'; -const { Fail, quote: q } = assert; +import { Fail, q } from '@endo/errors'; export const getZcfBundleCap = (zcfSpec, vatAdminSvc) => { let zcfBundleCapP; diff --git a/packages/zoe/src/zoeService/escrowStorage.js b/packages/zoe/src/zoeService/escrowStorage.js index 6c20944d02b..e256014b242 100644 --- a/packages/zoe/src/zoeService/escrowStorage.js +++ b/packages/zoe/src/zoeService/escrowStorage.js @@ -1,6 +1,6 @@ import { AmountMath } from '@agoric/ertp'; import { E } from '@endo/eventual-send'; -import { q, Fail } from '@agoric/assert'; +import { q, Fail } from '@endo/errors'; import { deeplyFulfilledObject, objectMap } from '@agoric/internal'; import { provideDurableWeakMapStore } from '@agoric/vat-data'; diff --git a/packages/zoe/src/zoeService/feeMint.js b/packages/zoe/src/zoeService/feeMint.js index b56089f8bae..a8f9771707b 100644 --- a/packages/zoe/src/zoeService/feeMint.js +++ b/packages/zoe/src/zoeService/feeMint.js @@ -11,10 +11,9 @@ import { provide, prepareExoClassKit, } from '@agoric/vat-data'; +import { Fail, q } from '@endo/errors'; import { FeeMintAccessShape } from '../typeGuards.js'; -const { Fail, quote: q } = assert; - /** @deprecated Redundant. Just omit it. */ const FEE_MINT_KIT = 'FeeMintKit'; diff --git a/packages/zoe/src/zoeService/installationStorage.js b/packages/zoe/src/zoeService/installationStorage.js index 787474dc406..eded152891e 100644 --- a/packages/zoe/src/zoeService/installationStorage.js +++ b/packages/zoe/src/zoeService/installationStorage.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert, Fail, q } from '@endo/errors'; import { M, prepareExo, @@ -11,8 +11,6 @@ import { UnwrappedInstallationShape, } from '../typeGuards.js'; -const { Fail, quote: q } = assert; - /** @typedef { import('@agoric/swingset-vat').BundleCap} BundleCap */ /** @typedef { import('@agoric/swingset-vat').BundleID} BundleID */ /** @import {Baggage} from '@agoric/vat-data' */ diff --git a/packages/zoe/src/zoeService/instanceAdminStorage.js b/packages/zoe/src/zoeService/instanceAdminStorage.js index 75061fc4aeb..084be650a14 100644 --- a/packages/zoe/src/zoeService/instanceAdminStorage.js +++ b/packages/zoe/src/zoeService/instanceAdminStorage.js @@ -9,6 +9,7 @@ import { provide, } from '@agoric/vat-data'; import { E } from '@endo/eventual-send'; +import { q, Fail } from '@endo/errors'; import { defineDurableHandle } from '../makeHandle.js'; import { BrandKeywordRecordShape, @@ -18,8 +19,6 @@ import { } from '../typeGuards.js'; import { makeZoeSeatAdminFactory } from './zoeSeat.js'; -const { quote: q, Fail } = assert; - /** * @file Two objects are defined here, both called InstanceAdminSomething. * InstanceAdminStorage is a container for individual InstanceAdmins. Each diff --git a/packages/zoe/src/zoeService/invitationQueries.js b/packages/zoe/src/zoeService/invitationQueries.js index 6ba3dfad8aa..9fa3195a257 100644 --- a/packages/zoe/src/zoeService/invitationQueries.js +++ b/packages/zoe/src/zoeService/invitationQueries.js @@ -1,16 +1,16 @@ // @jessie-check -import { assert, details as X, Fail, quote as q } from '@agoric/assert'; +import { assert, X, Fail, q } from '@endo/errors'; import { E } from '@endo/eventual-send'; export const makeInvitationQueryFns = invitationIssuer => { /** @type {GetInvitationDetails} */ const getInvitationDetails = async invitationP => { const onRejected = reason => { - const err = assert.error( + const err = makeError( X`A Zoe invitation is required, not ${invitationP}`, ); - assert.note(err, X`Due to ${reason}`); + annotateError(err, X`Due to ${reason}`); throw err; }; const invAmount = await E(invitationIssuer) diff --git a/packages/zoe/src/zoeService/makeInvitation.js b/packages/zoe/src/zoeService/makeInvitation.js index 5a755ed0d7a..b6e5c20242f 100644 --- a/packages/zoe/src/zoeService/makeInvitation.js +++ b/packages/zoe/src/zoeService/makeInvitation.js @@ -1,6 +1,6 @@ // @jessie-check -import { Fail, q } from '@agoric/assert'; +import { Fail, q } from '@endo/errors'; import { provideDurableMapStore } from '@agoric/vat-data'; import { AssetKind, hasIssuer, prepareIssuerKit } from '@agoric/ertp'; import { InvitationElementShape } from '../typeGuards.js'; diff --git a/packages/zoe/src/zoeService/offer/burnInvitation.js b/packages/zoe/src/zoeService/offer/burnInvitation.js index eb5b36e90c5..40948ca118d 100644 --- a/packages/zoe/src/zoeService/offer/burnInvitation.js +++ b/packages/zoe/src/zoeService/offer/burnInvitation.js @@ -1,6 +1,6 @@ // @jessie-check -import { Fail, assert, details as X } from '@agoric/assert'; +import { Fail, assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; /** @@ -16,10 +16,8 @@ import { E } from '@endo/eventual-send'; */ export const burnInvitation = (invitationIssuer, invitation) => { const handleRejected = reason => { - const err = assert.error( - X`A Zoe invitation is required, not ${invitation}`, - ); - assert.note(err, X`Due to ${reason}`); + const err = makeError(X`A Zoe invitation is required, not ${invitation}`); + annotateError(err, X`Due to ${reason}`); throw err; }; const handleFulfilled = invitationAmount => { diff --git a/packages/zoe/src/zoeService/offer/offer.js b/packages/zoe/src/zoeService/offer/offer.js index 3e91ff977a9..acdb29097b7 100644 --- a/packages/zoe/src/zoeService/offer/offer.js +++ b/packages/zoe/src/zoeService/offer/offer.js @@ -10,7 +10,7 @@ import { makeInvitationQueryFns } from '../invitationQueries.js'; import '../internal-types.js'; -const { quote: q, Fail } = assert; +import { q, Fail } from '@endo/errors'; export const makeOfferMethod = offerDataAccess => { /** @type {Offer} */ diff --git a/packages/zoe/src/zoeService/originalZoeSeat.js b/packages/zoe/src/zoeService/originalZoeSeat.js index 7970d07ec5b..8ea02df592c 100644 --- a/packages/zoe/src/zoeService/originalZoeSeat.js +++ b/packages/zoe/src/zoeService/originalZoeSeat.js @@ -15,7 +15,7 @@ import { PaymentPKeywordRecordShape, } from '../typeGuards.js'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; export const coreUserSeatMethods = harden({ getProposal: M.call().returns(M.promise()), diff --git a/packages/zoe/src/zoeService/startInstance.js b/packages/zoe/src/zoeService/startInstance.js index 3219963f3c3..e729c1d9ce2 100644 --- a/packages/zoe/src/zoeService/startInstance.js +++ b/packages/zoe/src/zoeService/startInstance.js @@ -12,6 +12,7 @@ import { import { initEmpty } from '@agoric/store'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; +import { Fail, q } from '@endo/errors'; import { defineDurableHandle } from '../makeHandle.js'; import { makeInstanceAdminMaker } from './instanceAdminStorage.js'; import { @@ -25,8 +26,6 @@ import { /** @import {Baggage} from '@agoric/vat-data' */ /** @typedef { import('@agoric/swingset-vat').BundleCap} BundleCap */ -const { Fail, quote: q } = assert; - /** * @param {Pick} startInstanceAccess * @param {() => ERef} getZcfBundleCapP diff --git a/packages/zoe/src/zoeService/zoe.js b/packages/zoe/src/zoeService/zoe.js index 71abd32ce46..eb7d76a50ab 100644 --- a/packages/zoe/src/zoeService/zoe.js +++ b/packages/zoe/src/zoeService/zoe.js @@ -20,6 +20,7 @@ import { Far } from '@endo/marshal'; import { makeScalarBigMapStore, prepareExo } from '@agoric/vat-data'; import { M } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { makeZoeStorageManager } from './zoeStorageManager.js'; import { makeStartInstance } from './startInstance.js'; import { makeOfferMethod } from './offer/offer.js'; @@ -30,8 +31,6 @@ import { ZoeServiceI } from '../typeGuards.js'; /** @import {Baggage} from '@agoric/vat-data' */ -const { Fail } = assert; - /** * Create a durable instance of Zoe. * diff --git a/packages/zoe/src/zoeService/zoeSeat.js b/packages/zoe/src/zoeService/zoeSeat.js index 926537792df..9dda60e63a9 100644 --- a/packages/zoe/src/zoeService/zoeSeat.js +++ b/packages/zoe/src/zoeService/zoeSeat.js @@ -15,7 +15,7 @@ import { coreUserSeatMethods, } from './originalZoeSeat.js'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; // ZoeSeatAdmin has the implementation of coreUserSeatMethods, but ZoeUserSeat // is the facet shared with users. The latter transparently forwards to the diff --git a/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js b/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js index 8d8cc167304..e4ea1010504 100644 --- a/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js +++ b/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js @@ -2,7 +2,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { showPurseBalance, setupIssuers } from '../helpers.js'; async function logCounter(log, publicAPI) { diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js index 3a40423e9ad..8c9e7f43e38 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js @@ -1,10 +1,9 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; +import { q, X } from '@endo/errors'; import buildManualTimer from '../../../tools/manualTimer.js'; -const { quote: q, details: X } = assert; - const mintInto = (kit, purse, value) => E(kit.mint) .mintPayment(AmountMath.make(kit.brand, value)) diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js index b44f6dc3d37..b580f215e36 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js @@ -1,6 +1,7 @@ import { M, mustMatch } from '@agoric/store'; import { prepareExoClass, prepareExo } from '@agoric/vat-data'; +import { X } from '@endo/errors'; import { swapExact } from '../../../src/contractSupport/index.js'; import { InvitationShape, @@ -8,8 +9,6 @@ import { OfferHandlerI, } from '../../../src/typeGuards.js'; -const { details: X } = assert; - const sellSeatExpiredMsg = 'The covered call option is expired.'; /** @type {ContractMeta} */ diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-service-upgrade.test.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-service-upgrade.test.js index dcc10a1543b..0b78463dc3d 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-service-upgrade.test.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-service-upgrade.test.js @@ -1,6 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { buildVatController } from '@agoric/swingset-vat'; const bfile = name => new URL(name, import.meta.url).pathname; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-alice.js b/packages/zoe/test/swingsetTests/zoe/vat-alice.js index 7e6d66c74dc..f63f0fffbe5 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-alice.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-alice.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { showPurseBalance, setupIssuers } from '../helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-bob.js b/packages/zoe/test/swingsetTests/zoe/vat-bob.js index c236266ae13..ed4deb5b73f 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-bob.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-bob.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-carol.js b/packages/zoe/test/swingsetTests/zoe/vat-carol.js index 717ae70ca7e..526f969a1a8 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-carol.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-carol.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { showPurseBalance, setupIssuers } from '../helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-dave.js b/packages/zoe/test/swingsetTests/zoe/vat-dave.js index f6eba02fe3c..7d8460a89e7 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-dave.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-dave.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/zoe/test/unitTests/bounty.js b/packages/zoe/test/unitTests/bounty.js index 0882826b1ee..77205854874 100644 --- a/packages/zoe/test/unitTests/bounty.js +++ b/packages/zoe/test/unitTests/bounty.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; /** diff --git a/packages/zoe/test/unitTests/contracts/escrowToVote.js b/packages/zoe/test/unitTests/contracts/escrowToVote.js index eb342e1275f..b7726809d41 100644 --- a/packages/zoe/test/unitTests/contracts/escrowToVote.js +++ b/packages/zoe/test/unitTests/contracts/escrowToVote.js @@ -4,14 +4,13 @@ import { Far } from '@endo/marshal'; import { makeScalarMapStore } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' +import { X, q } from '@endo/errors'; import { assertIssuerKeywords, assertProposalShape, assertNatAssetKind, } from '../../../src/contractSupport/index.js'; -const { details: X, quote: q } = assert; - /** * This contract implements coin voting. There are two roles: the * Secretary, who can determine the question (a string), make voting diff --git a/packages/zoe/test/unitTests/contracts/oracle.test.js b/packages/zoe/test/unitTests/contracts/oracle.test.js index 2f3b36e463a..9efacad53ff 100644 --- a/packages/zoe/test/unitTests/contracts/oracle.test.js +++ b/packages/zoe/test/unitTests/contracts/oracle.test.js @@ -6,7 +6,7 @@ import bundleSource from '@endo/bundle-source'; import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; diff --git a/packages/zoe/test/unitTests/contracts/sellTickets.test.js b/packages/zoe/test/unitTests/contracts/sellTickets.test.js index 931fc4b83a5..92e86ea357a 100644 --- a/packages/zoe/test/unitTests/contracts/sellTickets.test.js +++ b/packages/zoe/test/unitTests/contracts/sellTickets.test.js @@ -2,7 +2,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; import path from 'path'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import bundleSource from '@endo/bundle-source'; import { makeIssuerKit, AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/zoe/test/unitTests/contracts/useObjExample.js b/packages/zoe/test/unitTests/contracts/useObjExample.js index 599971e7e5e..06dbb5b0e03 100644 --- a/packages/zoe/test/unitTests/contracts/useObjExample.js +++ b/packages/zoe/test/unitTests/contracts/useObjExample.js @@ -2,13 +2,12 @@ import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' +import { X } from '@endo/errors'; import { assertIssuerKeywords, assertProposalShape, } from '../../../src/contractSupport/index.js'; -const { details: X } = assert; - /** * Give a use object when a payment is escrowed * diff --git a/packages/zoe/test/unitTests/fakePriceAuthority.test.js b/packages/zoe/test/unitTests/fakePriceAuthority.test.js index 12150ed6620..f402c577455 100644 --- a/packages/zoe/test/unitTests/fakePriceAuthority.test.js +++ b/packages/zoe/test/unitTests/fakePriceAuthority.test.js @@ -1,7 +1,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { TimeMath } from '@agoric/time'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import buildManualTimer from '../../tools/manualTimer.js'; diff --git a/packages/zoe/test/unitTests/makeOffer.js b/packages/zoe/test/unitTests/makeOffer.js index 7469daf71cb..407e9476aeb 100644 --- a/packages/zoe/test/unitTests/makeOffer.js +++ b/packages/zoe/test/unitTests/makeOffer.js @@ -1,5 +1,5 @@ import { E } from '@endo/eventual-send'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; /** * @param {ERef} zoe diff --git a/packages/zoe/test/unitTests/scriptedOracle.test.js b/packages/zoe/test/unitTests/scriptedOracle.test.js index bb955b1ba75..7391e77cca8 100644 --- a/packages/zoe/test/unitTests/scriptedOracle.test.js +++ b/packages/zoe/test/unitTests/scriptedOracle.test.js @@ -8,7 +8,7 @@ import { E } from '@endo/eventual-send'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { TimeMath } from '@agoric/time'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { makeFakeVatAdmin } from '../../tools/fakeVatAdmin.js'; import { makeZoeForTest } from '../../tools/setup-zoe.js'; diff --git a/packages/zoe/test/unitTests/zcf/setupZcfTest.js b/packages/zoe/test/unitTests/zcf/setupZcfTest.js index 413a0dd72c7..690f30f7b2b 100644 --- a/packages/zoe/test/unitTests/zcf/setupZcfTest.js +++ b/packages/zoe/test/unitTests/zcf/setupZcfTest.js @@ -1,6 +1,6 @@ import { E } from '@endo/eventual-send'; import bundleSource from '@endo/bundle-source'; -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import path from 'path'; diff --git a/packages/zoe/test/zoeTestHelpers.js b/packages/zoe/test/zoeTestHelpers.js index 170e78236de..56b8c9a659e 100644 --- a/packages/zoe/test/zoeTestHelpers.js +++ b/packages/zoe/test/zoeTestHelpers.js @@ -2,7 +2,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath, assertValueGetHelpers } from '@agoric/ertp'; -import { q } from '@agoric/assert'; +import { q } from '@endo/errors'; export const assertAmountsEqual = (t, amount, expected, label = '') => { harden(amount); diff --git a/packages/zoe/tools/fakePriceAuthority.js b/packages/zoe/tools/fakePriceAuthority.js index 3abdbca3ccb..bdfac2999e8 100644 --- a/packages/zoe/tools/fakePriceAuthority.js +++ b/packages/zoe/tools/fakePriceAuthority.js @@ -8,13 +8,13 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { TimeMath } from '@agoric/time'; +import { Fail } from '@endo/errors'; import { natSafeMath } from '../src/contractSupport/index.js'; /** * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -const { Fail } = assert; const { coerceRelativeTimeRecord } = TimeMath; // 'if (a >= b)' becomes 'if (timestampGTE(a,b))' diff --git a/packages/zoe/tools/fakeVatAdmin.js b/packages/zoe/tools/fakeVatAdmin.js index 8587db4e19a..d56565079b5 100644 --- a/packages/zoe/tools/fakeVatAdmin.js +++ b/packages/zoe/tools/fakeVatAdmin.js @@ -1,6 +1,6 @@ // @jessie-check -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { Far } from '@endo/marshal'; diff --git a/packages/zoe/tools/manualTimer.js b/packages/zoe/tools/manualTimer.js index 50e07512734..ce7d0b4d3e0 100644 --- a/packages/zoe/tools/manualTimer.js +++ b/packages/zoe/tools/manualTimer.js @@ -9,7 +9,7 @@ import { TimeMath } from '@agoric/time'; * @import {RemotableBrand} from '@endo/eventual-send'; */ -const { Fail } = assert; +import { Fail } from '@endo/errors'; // we wrap SwingSet's buildManualTimer to accomodate the needs of // zoe's tests diff --git a/packages/zone/package.json b/packages/zone/package.json index d496c7b32e6..32851e8aa00 100644 --- a/packages/zone/package.json +++ b/packages/zone/package.json @@ -29,6 +29,7 @@ "dependencies": { "@agoric/base-zone": "^0.1.0", "@agoric/vat-data": "^0.5.2", + "@endo/errors": "^1.2.2", "@endo/far": "^1.1.2", "@endo/pass-style": "^1.4.0" }, diff --git a/packages/zone/src/durable.js b/packages/zone/src/durable.js index 34bcb69cd51..4ea84c2f89c 100644 --- a/packages/zone/src/durable.js +++ b/packages/zone/src/durable.js @@ -17,7 +17,7 @@ import { import { agoricVatDataKeys as keys, makeOnceKit } from '@agoric/base-zone'; -const { Fail } = assert; +import { Fail } from '@endo/errors'; /** * A variant of `canBeDurable` that returns `false` instead of ever throwing. From e8beb42ba3c392c3a44b6d8cdc0944008c160425 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 17:37:55 -0700 Subject: [PATCH 05/25] fixup! NonNullish in internal --- packages/internal/src/errors.js | 16 ++++++++++++++++ packages/internal/src/index.js | 1 + .../src/lib-nodejs/spawnSubprocessWorker.js | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/internal/src/errors.js diff --git a/packages/internal/src/errors.js b/packages/internal/src/errors.js new file mode 100644 index 00000000000..57ea53bc4a6 --- /dev/null +++ b/packages/internal/src/errors.js @@ -0,0 +1,16 @@ +import { quote } from '@endo/errors'; + +/** + * @template T + * @param {T | null | undefined} val + * @param {string} [optDetails] + * @returns {T} + */ +export const NonNullish = (val, optDetails = `unexpected ${quote(val)}`) => { + if (val != null) { + // This `!= null` idiom checks that `val` is neither `null` nor `undefined`. + return val; + } + assert.fail(optDetails); +}; +harden(NonNullish); diff --git a/packages/internal/src/index.js b/packages/internal/src/index.js index c8e36af48ef..a9b3a7b0a3b 100644 --- a/packages/internal/src/index.js +++ b/packages/internal/src/index.js @@ -4,6 +4,7 @@ export * from './config.js'; export * from './debug.js'; +export * from './errors.js'; export * from './utils.js'; export * from './method-tools.js'; export * from './typeGuards.js'; diff --git a/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js b/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js index 7ba181152c5..bd79838d3b1 100644 --- a/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js +++ b/packages/internal/src/lib-nodejs/spawnSubprocessWorker.js @@ -1,7 +1,7 @@ // this file is loaded by the controller, in the start compartment import { spawn } from 'child_process'; import { makePromiseKit } from '@endo/promise-kit'; -import { NonNullish } from '@agoric/internal'; +import { NonNullish } from '../errors.js'; import { arrayEncoderStream, arrayDecoderStream } from './worker-protocol.js'; import { netstringEncoderStream, From 76b01b1ee6494a03df2b8945767d3ecafa5cff80 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 18:05:17 -0700 Subject: [PATCH 06/25] fixup! semi-manual mostly import QuickFix --- packages/ERTP/src/paymentLedger.js | 2 +- packages/SwingSet/tools/bootstrap-relay.js | 2 +- packages/boot/tools/authorityViz.js | 7 ++++--- packages/casting/src/follower-cosmjs.js | 2 +- packages/inter-protocol/src/auction/scheduler.js | 2 +- packages/inter-protocol/src/vaultFactory/vaultManager.js | 2 +- packages/internal/src/callback.js | 2 +- packages/internal/src/utils.js | 2 +- packages/notifier/src/subscribe.js | 2 +- packages/orchestration/src/exos/chainAccountKit.js | 3 +-- .../orchestration/src/exos/cosmosOrchestrationAccount.js | 2 +- packages/orchestration/src/exos/icqConnectionKit.js | 3 +-- packages/orchestration/src/exos/local-chain-account-kit.js | 3 +-- packages/orchestration/src/utils/chainHub.js | 2 +- packages/orchestration/src/utils/cosmos.js | 2 +- packages/pegasus/src/ics20.js | 2 +- packages/pegasus/src/pegasus.js | 2 +- packages/solo/src/chain-cosmos-sdk.js | 2 +- packages/solo/src/pipe-entrypoint.js | 1 + packages/swingset-liveslots/src/liveslots.js | 2 +- packages/vats/src/bridge-target.js | 2 +- packages/vats/src/core/utils.js | 2 +- packages/vow/src/E.js | 2 +- packages/vow/src/track-turns.js | 6 +++--- packages/zoe/src/contractFacet/zcfSeat.js | 2 +- packages/zoe/src/contracts/loan/updateDebt.js | 2 +- packages/zoe/src/makeHandle.js | 2 +- packages/zoe/src/zoeService/installationStorage.js | 2 +- packages/zoe/src/zoeService/invitationQueries.js | 2 +- packages/zoe/src/zoeService/offer/burnInvitation.js | 2 +- packages/zoe/src/zoeService/offer/offer.js | 3 +-- packages/zoe/src/zoeService/originalZoeSeat.js | 3 +-- packages/zoe/src/zoeService/zoeSeat.js | 3 +-- 33 files changed, 38 insertions(+), 42 deletions(-) diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js index 7c17bb201e1..89bcfc11ca7 100644 --- a/packages/ERTP/src/paymentLedger.js +++ b/packages/ERTP/src/paymentLedger.js @@ -5,7 +5,7 @@ /* eslint-disable no-use-before-define */ import { isPromise } from '@endo/promise-kit'; import { mustMatch, M, keyEQ } from '@agoric/store'; -import { X, q, Fail } from '@endo/errors'; +import { X, q, Fail, annotateError } from '@endo/errors'; import { AmountMath } from './amountMath.js'; import { preparePaymentKind } from './payment.js'; import { preparePurseKind } from './purse.js'; diff --git a/packages/SwingSet/tools/bootstrap-relay.js b/packages/SwingSet/tools/bootstrap-relay.js index cbfc641564f..730a7aa6593 100644 --- a/packages/SwingSet/tools/bootstrap-relay.js +++ b/packages/SwingSet/tools/bootstrap-relay.js @@ -1,4 +1,4 @@ -import { assert, Fail, q } from '@endo/errors'; +import { Fail, q } from '@endo/errors'; import { objectMap } from '@agoric/internal'; import { Far, E } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; diff --git a/packages/boot/tools/authorityViz.js b/packages/boot/tools/authorityViz.js index b7d382eaea0..de7bd1d174d 100755 --- a/packages/boot/tools/authorityViz.js +++ b/packages/boot/tools/authorityViz.js @@ -38,7 +38,8 @@ const styles = { * }} GraphNode */ function* fmtGraph(nodes, neighbors) { - const q = txt => JSON.stringify(txt.replace(/\./g, '_')); + // TODO Why is this distinct from `q`? + const q2 = txt => JSON.stringify(txt.replace(/\./g, '_')); yield 'digraph G {\n'; yield 'rankdir = LR;\n'; const clusters = new Set( @@ -52,7 +53,7 @@ function* fmtGraph(nodes, neighbors) { } for (const { id, cluster, label, style } of nodes) { if (subgraph && cluster !== subgraph) continue; - yield `${q(id)} [label=${q(label)}${style ? `, ${style}` : ''}];\n`; + yield `${q2(id)} [label=${q2(label)}${style ? `, ${style}` : ''}];\n`; } if (subgraph) { yield `}\n`; @@ -60,7 +61,7 @@ function* fmtGraph(nodes, neighbors) { } for (const [src, arcs] of neighbors.entries()) { for (const { id, style } of arcs) { - yield `${q(src)} -> ${q(id)} [${style}]\n`; + yield `${q2(src)} -> ${q2(id)} [${style}]\n`; } } yield '}\n'; diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index 9f6b3e8aac1..c7e54272457 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -6,7 +6,7 @@ import * as stargateStar from '@cosmjs/stargate'; import { isStreamCell } from '@agoric/internal/src/lib-chainStorage.js'; -import { X, q, Fail } from '@endo/errors'; +import { X, q, Fail, makeError } from '@endo/errors'; import { MAKE_DEFAULT_DECODER, MAKE_DEFAULT_UNSERIALIZER } from './defaults.js'; import { makeCastingSpec } from './casting-spec.js'; import { makeLeader as defaultMakeLeader } from './leader-netconfig.js'; diff --git a/packages/inter-protocol/src/auction/scheduler.js b/packages/inter-protocol/src/auction/scheduler.js index a95b7ed32b0..e9456e9a710 100644 --- a/packages/inter-protocol/src/auction/scheduler.js +++ b/packages/inter-protocol/src/auction/scheduler.js @@ -4,7 +4,7 @@ import { Far } from '@endo/marshal'; import { makeTracer } from '@agoric/internal'; import { observeIteration, subscribeEach } from '@agoric/notifier'; -import { X, Fail, q } from '@endo/errors'; +import { X, Fail, q, makeError } from '@endo/errors'; import { AuctionState, makeCancelTokenMaker } from './util.js'; import { computeRoundTiming, diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index 5c445cd1d9f..f6b3117eb97 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -51,7 +51,7 @@ import { } from '@agoric/zoe/src/contractSupport/index.js'; import { PriceQuoteShape, SeatShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/eventual-send'; -import { X, Fail, q } from '@endo/errors'; +import { X, Fail, q, makeError } from '@endo/errors'; import { checkDebtLimit, makeNatAmountShape, diff --git a/packages/internal/src/callback.js b/packages/internal/src/callback.js index 343815202de..7c8afa2f286 100644 --- a/packages/internal/src/callback.js +++ b/packages/internal/src/callback.js @@ -6,7 +6,7 @@ import { getInterfaceMethodKeys } from '@endo/patterns'; /** @import {ERef} from '@endo/far' */ /** @import {Callback, SyncCallback} from './types.js' */ -import { Fail, q } from '@endo/errors'; +import { Fail, makeError, q } from '@endo/errors'; const { fromEntries } = Object; diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index 0c278b81043..c2b013ec848 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -6,7 +6,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; import { asyncGenerate } from 'jessie.js'; -import { q, Fail } from '@endo/errors'; +import { q, Fail, makeError, annotateError } from '@endo/errors'; const { fromEntries, keys, values } = Object; diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index b480a1b3301..d79c92aecda 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -7,7 +7,7 @@ import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js'; */ -import { X, Fail } from '@endo/errors'; +import { X, Fail, annotateError } from '@endo/errors'; const sink = () => {}; diff --git a/packages/orchestration/src/exos/chainAccountKit.js b/packages/orchestration/src/exos/chainAccountKit.js index dd9de9214a5..e1c16aa89cb 100644 --- a/packages/orchestration/src/exos/chainAccountKit.js +++ b/packages/orchestration/src/exos/chainAccountKit.js @@ -1,7 +1,6 @@ /** @file ChainAccount exo */ -import { NonNullish } from '@agoric/internal'; +import { NonNullish, makeTracer } from '@agoric/internal'; import { PurseShape } from '@agoric/ertp'; -import { makeTracer } from '@agoric/internal'; import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; import { Fail } from '@endo/errors'; diff --git a/packages/orchestration/src/exos/cosmosOrchestrationAccount.js b/packages/orchestration/src/exos/cosmosOrchestrationAccount.js index e798fb31ced..891730cea06 100644 --- a/packages/orchestration/src/exos/cosmosOrchestrationAccount.js +++ b/packages/orchestration/src/exos/cosmosOrchestrationAccount.js @@ -23,7 +23,7 @@ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { InvitationShape } from '@agoric/zoe/src/typeGuards.js'; import { decodeBase64 } from '@endo/base64'; import { E } from '@endo/far'; -import { Fail } from '@endo/errors'; +import { Fail, makeError } from '@endo/errors'; import { AmountArgShape, ChainAddressShape, diff --git a/packages/orchestration/src/exos/icqConnectionKit.js b/packages/orchestration/src/exos/icqConnectionKit.js index 92edd8d5ba9..4afaf9ed491 100644 --- a/packages/orchestration/src/exos/icqConnectionKit.js +++ b/packages/orchestration/src/exos/icqConnectionKit.js @@ -1,6 +1,5 @@ /** @file ICQConnection Exo */ -import { NonNullish } from '@agoric/internal'; -import { makeTracer } from '@agoric/internal'; +import { NonNullish, makeTracer } from '@agoric/internal'; import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; import { Fail } from '@endo/errors'; diff --git a/packages/orchestration/src/exos/local-chain-account-kit.js b/packages/orchestration/src/exos/local-chain-account-kit.js index ea51048b818..f6db682ecac 100644 --- a/packages/orchestration/src/exos/local-chain-account-kit.js +++ b/packages/orchestration/src/exos/local-chain-account-kit.js @@ -1,8 +1,7 @@ /** @file Use-object for the owner of a localchain account */ -import { NonNullish } from '@agoric/internal'; +import { NonNullish, makeTracer } from '@agoric/internal'; import { typedJson } from '@agoric/cosmic-proto/vatsafe'; import { AmountShape, PaymentShape } from '@agoric/ertp'; -import { makeTracer } from '@agoric/internal'; import { M } from '@agoric/vat-data'; import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { InvitationShape } from '@agoric/zoe/src/typeGuards.js'; diff --git a/packages/orchestration/src/utils/chainHub.js b/packages/orchestration/src/utils/chainHub.js index 8555bc3c8c3..d370314d053 100644 --- a/packages/orchestration/src/utils/chainHub.js +++ b/packages/orchestration/src/utils/chainHub.js @@ -1,7 +1,7 @@ import { E } from '@endo/far'; import { M, mustMatch } from '@endo/patterns'; import { makeHeapZone } from '@agoric/zone'; -import { Fail } from '@endo/errors'; +import { Fail, makeError } from '@endo/errors'; import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js'; /** diff --git a/packages/orchestration/src/utils/cosmos.js b/packages/orchestration/src/utils/cosmos.js index 0baf94e89e7..f901e870db4 100644 --- a/packages/orchestration/src/utils/cosmos.js +++ b/packages/orchestration/src/utils/cosmos.js @@ -1,6 +1,6 @@ -import { assert } from '@endo/errors'; import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js'; import { decodeBase64, encodeBase64 } from '@endo/base64'; +import { makeError } from '@endo/errors'; /** maximum clock skew, in seconds, for unbonding time reported from other chain */ export const maxClockSkew = 10n * 60n; diff --git a/packages/pegasus/src/ics20.js b/packages/pegasus/src/ics20.js index 269237c8a0e..519fd1f2623 100644 --- a/packages/pegasus/src/ics20.js +++ b/packages/pegasus/src/ics20.js @@ -1,7 +1,7 @@ // @ts-check import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, X, Fail } from '@endo/errors'; +import { assert, X, Fail, annotateError } from '@endo/errors'; /** * @typedef {object} ICS20TransferPacket Packet shape defined at: diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js index 579623a9a2f..d96a2b1dd1b 100644 --- a/packages/pegasus/src/pegasus.js +++ b/packages/pegasus/src/pegasus.js @@ -1,6 +1,6 @@ // @ts-check -import { assert, X, Fail } from '@endo/errors'; +import { assert, X, Fail, makeError } from '@endo/errors'; import { makeLegacyWeakMap, makeLegacyMap } from '@agoric/store'; import { E, Far } from '@endo/far'; import { diff --git a/packages/solo/src/chain-cosmos-sdk.js b/packages/solo/src/chain-cosmos-sdk.js index 57a7f288e72..78703edb0ed 100644 --- a/packages/solo/src/chain-cosmos-sdk.js +++ b/packages/solo/src/chain-cosmos-sdk.js @@ -11,7 +11,7 @@ import anylogger from 'anylogger'; import { makeNotifierKit } from '@agoric/notifier'; import { makePromiseKit } from '@endo/promise-kit'; -import { assert, Fail } from '@endo/errors'; +import { Fail, makeError } from '@endo/errors'; import { DEFAULT_BATCH_TIMEOUT_MS, makeBatchedDeliver, diff --git a/packages/solo/src/pipe-entrypoint.js b/packages/solo/src/pipe-entrypoint.js index 566489e0189..d724a9d852e 100644 --- a/packages/solo/src/pipe-entrypoint.js +++ b/packages/solo/src/pipe-entrypoint.js @@ -9,6 +9,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import '@agoric/cosmic-swingset/src/anylogger-agoric.js'; import { connectToFakeChain } from '@agoric/cosmic-swingset/src/sim-chain.js'; import { makeShutdown } from '@agoric/internal/src/node/shutdown.js'; +import { makeError } from '@endo/errors'; const { registerShutdown } = makeShutdown(false); registerShutdown(() => process.exit()); diff --git a/packages/swingset-liveslots/src/liveslots.js b/packages/swingset-liveslots/src/liveslots.js index b2ccdd18a4f..a2baffd5026 100644 --- a/packages/swingset-liveslots/src/liveslots.js +++ b/packages/swingset-liveslots/src/liveslots.js @@ -4,7 +4,7 @@ import { getInterfaceOf, makeMarshal, } from '@endo/marshal'; -import { assert, Fail, X } from '@endo/errors'; +import { annotateError, assert, Fail, makeError, X } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { E, HandledPromise } from '@endo/eventual-send'; import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js'; diff --git a/packages/vats/src/bridge-target.js b/packages/vats/src/bridge-target.js index 483bc125f78..a4d0cb27c97 100644 --- a/packages/vats/src/bridge-target.js +++ b/packages/vats/src/bridge-target.js @@ -1,7 +1,7 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { X, Fail } from '@endo/errors'; +import { X, Fail, makeError } from '@endo/errors'; import { BridgeHandlerI } from './bridge.js'; /** diff --git a/packages/vats/src/core/utils.js b/packages/vats/src/core/utils.js index 092774a9bd3..bb75661f8e0 100644 --- a/packages/vats/src/core/utils.js +++ b/packages/vats/src/core/utils.js @@ -1,3 +1,4 @@ +import { Fail, q } from '@endo/errors'; import { Stable, Stake } from '@agoric/internal/src/tokens.js'; import { WalletName } from '@agoric/internal'; import { E, Far } from '@endo/far'; @@ -8,7 +9,6 @@ import { makeNameHubKit } from '../nameHub.js'; import { makeLogHooks, makePromiseSpace } from './promise-space.js'; import './types-ambient.js'; -import { Fail, q } from '@endo/errors'; const { entries, fromEntries, keys } = Object; diff --git a/packages/vow/src/E.js b/packages/vow/src/E.js index dc32a17f792..c07bb8f3f8d 100644 --- a/packages/vow/src/E.js +++ b/packages/vow/src/E.js @@ -15,7 +15,7 @@ * designed to be a drop-in replacement for the version in * `@endo/eventual-send/src/E.js` which contained no concept of "unwrap", */ -import { X, q, Fail } from '@endo/errors'; +import { X, q, Fail, makeError } from '@endo/errors'; import { trackTurns } from './track-turns.js'; import { makeMessageBreakpointTester } from './message-breakpoints.js'; diff --git a/packages/vow/src/track-turns.js b/packages/vow/src/track-turns.js index 6b5ab5a11cd..1e7de58a3f3 100644 --- a/packages/vow/src/track-turns.js +++ b/packages/vow/src/track-turns.js @@ -4,6 +4,7 @@ import { getEnvironmentOption, environmentOptionsListHas, } from '@endo/env-options'; +import { annotateError, X } from '@endo/errors'; // NOTE: We can't import these because they're not in scope before lockdown. // import { assert, X, Fail } from '@endo/errors'; @@ -42,7 +43,7 @@ const addRejectionNote = detailsNote => reason => { }; const wrapFunction = - (func, sendingError, X) => + (func, sendingError) => (...args) => { hiddenPriorError = sendingError; hiddenCurrentTurn += 1; @@ -91,7 +92,6 @@ export const trackTurns = funcs => { if (!ENABLED || typeof globalThis === 'undefined' || !globalThis.assert) { return funcs; } - import { X } from '@endo/errors'; hiddenCurrentEvent += 1; const sendingError = Error( @@ -102,7 +102,7 @@ export const trackTurns = funcs => { } return /** @type {T} */ ( - funcs.map(func => func && wrapFunction(func, sendingError, X)) + funcs.map(func => func && wrapFunction(func, sendingError)) ); }; diff --git a/packages/zoe/src/contractFacet/zcfSeat.js b/packages/zoe/src/contractFacet/zcfSeat.js index dff84c2170e..237094dac55 100644 --- a/packages/zoe/src/contractFacet/zcfSeat.js +++ b/packages/zoe/src/contractFacet/zcfSeat.js @@ -11,7 +11,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { initEmpty, M } from '@agoric/store'; -import { Fail } from '@endo/errors'; +import { annotateError, Fail } from '@endo/errors'; import { isOfferSafe } from './offerSafety.js'; import { assertRightsConserved } from './rightsConservation.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; diff --git a/packages/zoe/src/contracts/loan/updateDebt.js b/packages/zoe/src/contracts/loan/updateDebt.js index 8569f459af0..29992269078 100644 --- a/packages/zoe/src/contracts/loan/updateDebt.js +++ b/packages/zoe/src/contracts/loan/updateDebt.js @@ -1,6 +1,6 @@ import { Far } from '@endo/marshal'; import { makeNotifierKit, observeNotifier } from '@agoric/notifier'; -import { assert, X } from '@endo/errors'; +import { annotateError, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; diff --git a/packages/zoe/src/makeHandle.js b/packages/zoe/src/makeHandle.js index 89365027898..8801e011fd7 100644 --- a/packages/zoe/src/makeHandle.js +++ b/packages/zoe/src/makeHandle.js @@ -1,6 +1,6 @@ // @jessie-check -import { assert, Fail } from '@endo/errors'; +import { Fail } from '@endo/errors'; import { initEmpty, makeExo } from '@agoric/store'; import { prepareExoClass } from '@agoric/vat-data'; diff --git a/packages/zoe/src/zoeService/installationStorage.js b/packages/zoe/src/zoeService/installationStorage.js index eded152891e..f931c68838a 100644 --- a/packages/zoe/src/zoeService/installationStorage.js +++ b/packages/zoe/src/zoeService/installationStorage.js @@ -1,4 +1,4 @@ -import { assert, Fail, q } from '@endo/errors'; +import { Fail, q } from '@endo/errors'; import { M, prepareExo, diff --git a/packages/zoe/src/zoeService/invitationQueries.js b/packages/zoe/src/zoeService/invitationQueries.js index 9fa3195a257..df5d670012a 100644 --- a/packages/zoe/src/zoeService/invitationQueries.js +++ b/packages/zoe/src/zoeService/invitationQueries.js @@ -1,6 +1,6 @@ // @jessie-check -import { assert, X, Fail, q } from '@endo/errors'; +import { X, Fail, q, makeError, annotateError } from '@endo/errors'; import { E } from '@endo/eventual-send'; export const makeInvitationQueryFns = invitationIssuer => { diff --git a/packages/zoe/src/zoeService/offer/burnInvitation.js b/packages/zoe/src/zoeService/offer/burnInvitation.js index 40948ca118d..42b8c9dea05 100644 --- a/packages/zoe/src/zoeService/offer/burnInvitation.js +++ b/packages/zoe/src/zoeService/offer/burnInvitation.js @@ -1,6 +1,6 @@ // @jessie-check -import { Fail, assert, X } from '@endo/errors'; +import { Fail, assert, X, makeError, annotateError } from '@endo/errors'; import { E } from '@endo/eventual-send'; /** diff --git a/packages/zoe/src/zoeService/offer/offer.js b/packages/zoe/src/zoeService/offer/offer.js index acdb29097b7..092e3d9f223 100644 --- a/packages/zoe/src/zoeService/offer/offer.js +++ b/packages/zoe/src/zoeService/offer/offer.js @@ -1,5 +1,6 @@ // @jessie-check +import { q, Fail } from '@endo/errors'; import { passStyleOf } from '@endo/marshal'; import { mustMatch } from '@agoric/store'; import { E } from '@endo/eventual-send'; @@ -10,8 +11,6 @@ import { makeInvitationQueryFns } from '../invitationQueries.js'; import '../internal-types.js'; -import { q, Fail } from '@endo/errors'; - export const makeOfferMethod = offerDataAccess => { /** @type {Offer} */ const offer = async ( diff --git a/packages/zoe/src/zoeService/originalZoeSeat.js b/packages/zoe/src/zoeService/originalZoeSeat.js index 8ea02df592c..cee45bd20dc 100644 --- a/packages/zoe/src/zoeService/originalZoeSeat.js +++ b/packages/zoe/src/zoeService/originalZoeSeat.js @@ -1,4 +1,5 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; import { SubscriberShape } from '@agoric/notifier'; import { E } from '@endo/eventual-send'; import { M, prepareExoClassKit } from '@agoric/vat-data'; @@ -15,8 +16,6 @@ import { PaymentPKeywordRecordShape, } from '../typeGuards.js'; -import { Fail } from '@endo/errors'; - export const coreUserSeatMethods = harden({ getProposal: M.call().returns(M.promise()), getPayouts: M.call().returns(M.promise()), diff --git a/packages/zoe/src/zoeService/zoeSeat.js b/packages/zoe/src/zoeService/zoeSeat.js index 9dda60e63a9..c6d58c6d29d 100644 --- a/packages/zoe/src/zoeService/zoeSeat.js +++ b/packages/zoe/src/zoeService/zoeSeat.js @@ -1,4 +1,5 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; import { prepareDurablePublishKit } from '@agoric/notifier'; import { E } from '@endo/eventual-send'; import { M, prepareExoClassKit } from '@agoric/vat-data'; @@ -15,8 +16,6 @@ import { coreUserSeatMethods, } from './originalZoeSeat.js'; -import { Fail } from '@endo/errors'; - // ZoeSeatAdmin has the implementation of coreUserSeatMethods, but ZoeUserSeat // is the facet shared with users. The latter transparently forwards to the // former. From 537e9904b74a1b906043ee8a04fbb847a7862941 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 18:44:35 -0700 Subject: [PATCH 07/25] fixup! lint driven manual fixes --- packages/boot/test/bootstrapTests/vaults-upgrade.test.ts | 3 ++- packages/boot/tools/drivers.ts | 3 ++- packages/boot/tools/supports.ts | 9 +++++++-- .../bootstrap-fluxAggregator-service-upgrade.js | 8 ++++++-- .../swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js | 8 ++++++-- .../reserve/bootstrap-assetReserve-upgrade.js | 8 ++++++-- packages/network/src/bytes.js | 9 +++------ packages/pegasus/src/once-promise-kit.js | 9 +++++++++ packages/vats/src/core/basic-behaviors.js | 3 ++- packages/vats/src/nameHub.js | 4 ++-- packages/wallet/api/src/lib-wallet.js | 2 +- 11 files changed, 46 insertions(+), 20 deletions(-) diff --git a/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts b/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts index f01c54b87a2..3684fe4fb1e 100644 --- a/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts +++ b/packages/boot/test/bootstrapTests/vaults-upgrade.test.ts @@ -7,7 +7,8 @@ */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; +import { NonNullish } from '@agoric/internal'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { Far, makeMarshal } from '@endo/marshal'; import { SECONDS_PER_YEAR } from '@agoric/inter-protocol/src/interest.js'; diff --git a/packages/boot/tools/drivers.ts b/packages/boot/tools/drivers.ts index 9a6c2c3a8e4..b9f0c8bb207 100644 --- a/packages/boot/tools/drivers.ts +++ b/packages/boot/tools/drivers.ts @@ -1,5 +1,6 @@ /* eslint-disable jsdoc/require-param */ -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; +import { NonNullish } from '@agoric/internal'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { SECONDS_PER_MINUTE } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; diff --git a/packages/boot/tools/supports.ts b/packages/boot/tools/supports.ts index ff2376918bf..0c3daf75255 100644 --- a/packages/boot/tools/supports.ts +++ b/packages/boot/tools/supports.ts @@ -7,9 +7,14 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { basename, join } from 'path'; import { inspect } from 'util'; -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; import { buildSwingset } from '@agoric/cosmic-swingset/src/launch-chain.js'; -import { BridgeId, VBankAccount, makeTracer } from '@agoric/internal'; +import { + BridgeId, + NonNullish, + VBankAccount, + makeTracer, +} from '@agoric/internal'; import { unmarshalFromVstorage } from '@agoric/internal/src/marshal.js'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import { krefOf } from '@agoric/kmarshal'; diff --git a/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js b/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js index 8cb98cecc91..cdc1f520358 100644 --- a/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/fluxAggregator/bootstrap-fluxAggregator-service-upgrade.js @@ -1,9 +1,13 @@ // @ts-check -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; -import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; +import { + deeplyFulfilledObject, + makeTracer, + NonNullish, +} from '@agoric/internal'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import { makeNotifierFromSubscriber } from '@agoric/notifier'; import { makeNameHubKit } from '@agoric/vats'; diff --git a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js index f91cd093873..1a86f7a67f8 100644 --- a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js @@ -1,9 +1,13 @@ // @ts-check -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; -import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; +import { + deeplyFulfilledObject, + makeTracer, + NonNullish, +} from '@agoric/internal'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import { mustMatch } from '@agoric/store'; import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js'; diff --git a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js index c81e14e39ac..d6bb13d4d50 100644 --- a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js @@ -1,9 +1,13 @@ // @ts-check -import { Fail, NonNullish } from '@endo/errors'; +import { Fail } from '@endo/errors'; import { makeIssuerKit } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; -import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; +import { + deeplyFulfilledObject, + makeTracer, + NonNullish, +} from '@agoric/internal'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import { makeNameHubKit } from '@agoric/vats'; import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js'; diff --git a/packages/network/src/bytes.js b/packages/network/src/bytes.js index aa50fee2c8f..67c0b79c241 100644 --- a/packages/network/src/bytes.js +++ b/packages/network/src/bytes.js @@ -1,5 +1,5 @@ // @ts-check -import { details, Fail } from '@endo/errors'; +import { X, Fail } from '@endo/errors'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { isObject } from '@endo/pass-style'; @@ -23,14 +23,11 @@ export function coerceToByteSource(specimen) { } isObject(specimen) || - assert.fail(details`non-object ${specimen} is not a ByteSource`, TypeError); + assert.fail(X`non-object ${specimen} is not a ByteSource`, TypeError); const obj = /** @type {{}} */ (specimen); typeof obj[Symbol.iterator] === 'function' || - assert.fail( - details`non-iterable ${specimen} is not a ByteSource`, - TypeError, - ); + assert.fail(X`non-iterable ${specimen} is not a ByteSource`, TypeError); // Good enough... it's iterable and can be converted later. return /** @type {ByteSource} */ (specimen); diff --git a/packages/pegasus/src/once-promise-kit.js b/packages/pegasus/src/once-promise-kit.js index 6f55bc9c44c..55a48b83f2c 100644 --- a/packages/pegasus/src/once-promise-kit.js +++ b/packages/pegasus/src/once-promise-kit.js @@ -2,6 +2,15 @@ import { assert } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; +/** + * Should be + * at-import {DetailsToken} from '@endo/errors' + * but somehow @endo/errors is not exporting that type. TODO fix. + * In the meantime... + * + * @typedef {{}} DetailsToken + */ + /** * Create a promise kit that will throw an exception if it is resolved or * rejected more than once. diff --git a/packages/vats/src/core/basic-behaviors.js b/packages/vats/src/core/basic-behaviors.js index c4b21d0980c..7b3f41efb39 100644 --- a/packages/vats/src/core/basic-behaviors.js +++ b/packages/vats/src/core/basic-behaviors.js @@ -6,13 +6,14 @@ import { deeplyFulfilledObject, VBankAccount, WalletName, + NonNullish, } from '@agoric/internal'; import { keyEQ, makeScalarMapStore } from '@agoric/store'; import { provideLazy } from '@agoric/store/src/stores/store-utils.js'; import { E, getInterfaceOf } from '@endo/far'; import { Nat } from '@endo/nat'; -import { Fail, NonNullish, X } from '@endo/errors'; +import { Fail, X } from '@endo/errors'; import { makeNameHubKit } from '../nameHub.js'; import { PowerFlags } from '../walletFlags.js'; import { feeIssuerConfig, makeMyAddressNameAdminKit } from './utils.js'; diff --git a/packages/vats/src/nameHub.js b/packages/vats/src/nameHub.js index 814e3030660..c6597c78725 100644 --- a/packages/vats/src/nameHub.js +++ b/packages/vats/src/nameHub.js @@ -1,4 +1,4 @@ -import { assert, NonNullish, Fail, q } from '@endo/errors'; +import { assert, Fail, q } from '@endo/errors'; import { E } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { M, getInterfaceGuardPayload } from '@endo/patterns'; @@ -9,7 +9,7 @@ import { prepareGuardedAttenuator, } from '@agoric/internal/src/callback.js'; import { makeHeapZone } from '@agoric/zone'; -import { deeplyFulfilledObject } from '@agoric/internal'; +import { deeplyFulfilledObject, NonNullish } from '@agoric/internal'; const KeyShape = M.string(); const PathShape = M.arrayOf(KeyShape); diff --git a/packages/wallet/api/src/lib-wallet.js b/packages/wallet/api/src/lib-wallet.js index 6efd0fc6f6e..721ebb256ae 100644 --- a/packages/wallet/api/src/lib-wallet.js +++ b/packages/wallet/api/src/lib-wallet.js @@ -1682,7 +1682,7 @@ export function makeWalletRoot({ (kind, lookup) => (...path) => { path.length === 1 || - Fail`${assert.quote( + Fail`${q( kind, )} lookup must be called with a single offer ID, not ${path}`; return lookup(path[0]); From b1ec7a070dc2b9a13c8c7a80243d97052868dbbf Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 18:49:16 -0700 Subject: [PATCH 08/25] fixup! revert CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94bed780555..68752e15373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -912,7 +912,7 @@ See https://github.com/Agoric/agoric-sdk/issues/3672 for the issue to fix the ro ### ⚠ BREAKING CHANGES * **tame-metering:** Converts `@agoric/tame-metering` from emulated ESM with `node -r esm` to Node.js ESM proper. -* **assert:** Converts `@endo/errors` from emulated ESM with `node -r esm` to Node.js ESM proper. +* **assert:** Converts `@agoric/assert` from emulated ESM with `node -r esm` to Node.js ESM proper. * **zoe:** new reallocate API to assist with reviewing conservation of rights (#3184) * **swing-store-simple:** This includes a renaming and refactoring of the constructors to acknowledge that the different SwingStore constructors are not polymorphic. @@ -1539,7 +1539,7 @@ otherwise. * review comments ([7db7e5c](https://github.com/Agoric/agoric-sdk/commit/7db7e5c4c569dfedff8d748dd58893218b0a2458)) * run ag-setup-cosmos under SES ([13c8efe](https://github.com/Agoric/agoric-sdk/commit/13c8efe6cf9ebc8c6a71b9098410c1af4162b570)) * take advantage of `/.../` being stripped from stack traces ([7acacc0](https://github.com/Agoric/agoric-sdk/commit/7acacc0d6ac06c37065ce984cc9147c945c572e5)) -* update '@endo/errors' types ([3ce7587](https://github.com/Agoric/agoric-sdk/commit/3ce7587d0ba6d7a0f5c51a0cacbdc414eb02891b)) +* update '@agoric/assert' types ([3ce7587](https://github.com/Agoric/agoric-sdk/commit/3ce7587d0ba6d7a0f5c51a0cacbdc414eb02891b)) * update dibc for v0.41.0 ([d990c14](https://github.com/Agoric/agoric-sdk/commit/d990c145ddcef3b090c63879a96a1942bc4ae69c)) * upgrade to patched cosmos-sdk v0.41.0 ([807320f](https://github.com/Agoric/agoric-sdk/commit/807320f5e16dafc8a1486eaf082bb54e994da577)) * use assert rather than FooError constructors ([f860c5b](https://github.com/Agoric/agoric-sdk/commit/f860c5bf5add165a08cb5bd543502857c3f57998)) From e733280c4c116cdd3ff8da491f0aaa739a8b0028 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:07:02 -0700 Subject: [PATCH 09/25] fixup! restore weird automated comment motion --- packages/agoric-cli/src/publish.js | 58 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/agoric-cli/src/publish.js b/packages/agoric-cli/src/publish.js index 49396802be1..6344f5ddf5c 100644 --- a/packages/agoric-cli/src/publish.js +++ b/packages/agoric-cli/src/publish.js @@ -17,6 +17,35 @@ import { fromBech32 } from '@cosmjs/encoding'; import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js'; +import { X, q, Fail } from '@endo/errors'; + +// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go +const Agoric = { + Bech32MainPrefix: 'agoric', + CoinType: 564, + proto: { + swingset: { + InstallBundle: { + // matches package agoric.swingset in swingset/msgs.go + typeUrl: '/agoric.swingset.MsgInstallBundle', + }, + }, + }, + // arbitrary fee for installing a bundle + fee: { amount: [], gas: '50000000' }, + // Agoric chain does not use cosmos gas (yet?) + gasPrice: { denom: 'uist', amount: Decimal.fromUserInput('50000000', 0) }, +}; + +const hdPath = (coinType = 118, account = 0) => + stringToPath(`m/44'/${coinType}'/${account}'/0/0`); + +// @ts-expect-error difference in private property _push +const registry = new Registry([ + ...defaultRegistryTypes, + [Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle], +]); + /** * @typedef {object} JsonHttpRequest * @property {string} hostname @@ -56,35 +85,6 @@ import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js'; * @typedef {SourceBundle | HashBundle} Bundle */ -import { X, q, Fail } from '@endo/errors'; - -// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go -const Agoric = { - Bech32MainPrefix: 'agoric', - CoinType: 564, - proto: { - swingset: { - InstallBundle: { - // matches package agoric.swingset in swingset/msgs.go - typeUrl: '/agoric.swingset.MsgInstallBundle', - }, - }, - }, - // arbitrary fee for installing a bundle - fee: { amount: [], gas: '50000000' }, - // Agoric chain does not use cosmos gas (yet?) - gasPrice: { denom: 'uist', amount: Decimal.fromUserInput('50000000', 0) }, -}; - -const hdPath = (coinType = 118, account = 0) => - stringToPath(`m/44'/${coinType}'/${account}'/0/0`); - -// @ts-expect-error difference in private property _push -const registry = new Registry([ - ...defaultRegistryTypes, - [Agoric.proto.swingset.InstallBundle.typeUrl, MsgInstallBundle], -]); - /** * @template T * @param {Array} array From 8635da210758ad35d990bc19699138932f80c1a5 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:14:52 -0700 Subject: [PATCH 10/25] fixup! revert mystery jessie directive text --- packages/inter-protocol/src/auction/scheduleMath.js | 2 +- packages/inter-protocol/src/proposals/addAssetToVault.js | 2 +- packages/inter-protocol/src/proposals/startPSM.js | 2 +- packages/zoe/src/contractSupport/bondingCurves.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/inter-protocol/src/auction/scheduleMath.js b/packages/inter-protocol/src/auction/scheduleMath.js index 39adf5e9e26..a6eb48e5d7f 100644 --- a/packages/inter-protocol/src/auction/scheduleMath.js +++ b/packages/inter-protocol/src/auction/scheduleMath.js @@ -1,4 +1,4 @@ -/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check +// @jessie-check import { TimeMath } from '@agoric/time'; import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; diff --git a/packages/inter-protocol/src/proposals/addAssetToVault.js b/packages/inter-protocol/src/proposals/addAssetToVault.js index 3946118333a..5d1bc7fd521 100644 --- a/packages/inter-protocol/src/proposals/addAssetToVault.js +++ b/packages/inter-protocol/src/proposals/addAssetToVault.js @@ -1,4 +1,4 @@ -/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check +// @jessie-check // @ts-check import { ToFarFunction } from '@endo/captp'; diff --git a/packages/inter-protocol/src/proposals/startPSM.js b/packages/inter-protocol/src/proposals/startPSM.js index 16e04ca5a64..41ebb584ab2 100644 --- a/packages/inter-protocol/src/proposals/startPSM.js +++ b/packages/inter-protocol/src/proposals/startPSM.js @@ -1,4 +1,4 @@ -/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check +// @jessie-check import { makeMap } from 'jessie.js'; import { AmountMath, AssetKind } from '@agoric/ertp'; diff --git a/packages/zoe/src/contractSupport/bondingCurves.js b/packages/zoe/src/contractSupport/bondingCurves.js index 113c74d13b1..0f81d25ff3e 100644 --- a/packages/zoe/src/contractSupport/bondingCurves.js +++ b/packages/zoe/src/contractSupport/bondingCurves.js @@ -1,4 +1,4 @@ -/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @jessie-check +// @jessie-check import { Nat } from '@endo/nat'; import { Fail } from '@endo/errors'; From af1a5476c8c932557878e6650e3afe6872aee1f2 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:22:53 -0700 Subject: [PATCH 11/25] fixup! revert mystery ts-check directive text --- packages/internal/src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index c2b013ec848..b6847200e9e 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -1,4 +1,4 @@ -/* eslint @jessie.js/no-nested-await:['error'],curly:['error','all'],eqeqeq:['error','always'],no-bitwise:['error'],no-fallthrough:['error',{commentPattern:'fallthrough is not allowed in Jessie'}],no-restricted-globals:['error','RegExp','Date','Symbol'],no-restricted-syntax:['error',{selector:"BinaryExpression[operator='in']",message:"'in' is not allowed in Jessie"},{selector:"BinaryExpression[operator='instanceof']",message:"'instanceof' is not allowed in Jessie; use duck typing"},{selector:'NewExpression',message:"'new' is not allowed in Jessie; use a 'maker' function"},{selector:'FunctionDeclaration[generator=true]',message:'generators are not allowed in Jessie'},{selector:'FunctionExpression[generator=true]',message:'generators are not allowed in Jessie'},{selector:'DoWhileStatement',message:'do/while statements are not allowed in Jessie'},{selector:'ThisExpression',message:"'this' is not allowed in Jessie; use a closed-over lexical variable instead"},{selector:"UnaryExpression[operator='delete']",message:"'delete' is not allowed in Jessie; destructure objects and reassemble them without mutation"},{selector:'ForInStatement',message:'for/in statements are not allowed in Jessie; use for/of Object.keys(val)'},{selector:"MemberExpression[computed=true][property.type!='Literal'][property.type!='UnaryExpression']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:"MemberExpression[computed=true][property.type='UnaryExpression'][property.operator!='+']",message:"arbitrary computed property names are not allowed in Jessie; use leading '+'"},{selector:'Super',message:"'super' is not allowed in Jessie"},{selector:'MetaProperty',message:"'import.meta' is not allowed in Jessie"},{selector:'ClassExpression',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:'ClassDeclaration',message:"'class' is not allowed in Jessie; define a 'maker' function"},{selector:"CallExpression[callee.name='eval']",message:"'eval' is not allowed in Jessie"},{selector:'Literal[regex]',message:'regexp literal syntax is not allowed in Jessie'}],no-var:['error'],guard-for-in:'off',semi:['error','always'] */ // @ts-check +// @ts-check // @jessie-check import { deeplyFulfilled, isObject } from '@endo/marshal'; From 3c130a40244d4b33a359ecc43531b686ed9d9f2b Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:31:00 -0700 Subject: [PATCH 12/25] fixup! manually fixed some unnecessary "as"s --- packages/swingset-liveslots/src/virtualObjectManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index 7c4a9b910e1..e58430f6c4c 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -2,7 +2,7 @@ /* eslint-disable no-use-before-define, jsdoc/require-returns-type */ import { environmentOptionsListHas } from '@endo/env-options'; -import { assert, throwRedacted as Fail, q, bare as b } from '@endo/errors'; +import { assert, Fail, q, b } from '@endo/errors'; import { assertPattern, mustMatch } from '@agoric/store'; import { defendPrototype, defendPrototypeKit } from '@endo/exo/tools.js'; import { Far, passStyleOf } from '@endo/marshal'; From f643c89c4d7a5b37bd5b8d8b1d1283c919952ec3 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:39:25 -0700 Subject: [PATCH 13/25] fixup! canonical short forms --- packages/SwingSet/src/kernel/slogger.js | 4 ++-- packages/internal/src/errors.js | 4 ++-- packages/orchestration/src/service.js | 4 ++-- packages/vats/src/transfer.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/SwingSet/src/kernel/slogger.js b/packages/SwingSet/src/kernel/slogger.js index 810a03b9a63..be5b6d017d1 100644 --- a/packages/SwingSet/src/kernel/slogger.js +++ b/packages/SwingSet/src/kernel/slogger.js @@ -1,4 +1,4 @@ -import { quote } from '@endo/errors'; +import { q } from '@endo/errors'; const IDLE = 'idle'; const STARTUP = 'startup'; @@ -66,7 +66,7 @@ function makeCallbackRegistry(callbacks) { if (!cbNames.length) { return; } - console.warn(errorUnusedMsg, cbNames.map(quote).sort().join(', ')); + console.warn(errorUnusedMsg, cbNames.map(q).sort().join(', ')); }, }); } diff --git a/packages/internal/src/errors.js b/packages/internal/src/errors.js index 57ea53bc4a6..473db1c25c2 100644 --- a/packages/internal/src/errors.js +++ b/packages/internal/src/errors.js @@ -1,4 +1,4 @@ -import { quote } from '@endo/errors'; +import { q } from '@endo/errors'; /** * @template T @@ -6,7 +6,7 @@ import { quote } from '@endo/errors'; * @param {string} [optDetails] * @returns {T} */ -export const NonNullish = (val, optDetails = `unexpected ${quote(val)}`) => { +export const NonNullish = (val, optDetails = `unexpected ${q(val)}`) => { if (val != null) { // This `!= null` idiom checks that `val` is neither `null` nor `undefined`. return val; diff --git a/packages/orchestration/src/service.js b/packages/orchestration/src/service.js index 15e7c121cc1..c8a5f4e3aa1 100644 --- a/packages/orchestration/src/service.js +++ b/packages/orchestration/src/service.js @@ -3,7 +3,7 @@ import { V as E } from '@agoric/vow/vat.js'; import { M } from '@endo/patterns'; import { Shape as NetworkShape } from '@agoric/network'; -import { Fail, bare } from '@endo/errors'; +import { Fail, b } from '@endo/errors'; import { prepareChainAccountKit } from './exos/chainAccountKit.js'; import { prepareICQConnectionKit } from './exos/icqConnectionKit.js'; import { @@ -45,7 +45,7 @@ import { * @param {K} name */ const getPower = (powers, name) => { - powers.has(name) || Fail`need powers.${bare(name)} for this method`; + powers.has(name) || Fail`need powers.${b(name)} for this method`; return /** @type {OrchestrationPowers[K]} */ (powers.get(name)); }; diff --git a/packages/vats/src/transfer.js b/packages/vats/src/transfer.js index 78d458c15b6..ea3782bc79d 100644 --- a/packages/vats/src/transfer.js +++ b/packages/vats/src/transfer.js @@ -3,7 +3,7 @@ import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { VTRANSFER_IBC_EVENT } from '@agoric/internal'; import { coerceToByteSource, byteSourceToBase64 } from '@agoric/network'; -import { Fail, bare } from '@endo/errors'; +import { Fail, b } from '@endo/errors'; import { TargetAppI, AppTransformerI } from './bridge-target.js'; /** @@ -53,7 +53,7 @@ const prepareTransferInterceptor = (zone, vowTools) => { const { isActiveTap, tap } = this.state; obj.type === VTRANSFER_IBC_EVENT || - Fail`Invalid upcall argument type ${obj.type}; expected ${bare(VTRANSFER_IBC_EVENT)}`; + Fail`Invalid upcall argument type ${obj.type}; expected ${b(VTRANSFER_IBC_EVENT)}`; // First, call our target contract listener. // A VTransfer active interceptor can return a write acknowledgement From 8edee7096ce05aab15fe603d7256e71a510ec317 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 19:45:14 -0700 Subject: [PATCH 14/25] fixup! track-turns init order note --- packages/vow/src/track-turns.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vow/src/track-turns.js b/packages/vow/src/track-turns.js index 1e7de58a3f3..e81b0c4b2dd 100644 --- a/packages/vow/src/track-turns.js +++ b/packages/vow/src/track-turns.js @@ -4,10 +4,11 @@ import { getEnvironmentOption, environmentOptionsListHas, } from '@endo/env-options'; -import { annotateError, X } from '@endo/errors'; -// NOTE: We can't import these because they're not in scope before lockdown. -// import { assert, X, Fail } from '@endo/errors'; +// Note that in the original track-turns.js in @endo/eventual-send we +// can't simply import these because `assert` is not in scope before lockdown. +// But this copy in @agoric/vow the import is fine. +import { annotateError, X } from '@endo/errors'; // WARNING: Global Mutable State! // This state is communicated to `assert` that makes it available to the From 22f352730f645987b75f058bd51e56f75d5e01b4 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 20:05:09 -0700 Subject: [PATCH 15/25] fixup! missing Details type --- packages/zoe/src/contractFacet/offerHandlerStorage.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/zoe/src/contractFacet/offerHandlerStorage.js b/packages/zoe/src/contractFacet/offerHandlerStorage.js index 26ff65aaff1..2d153e162eb 100644 --- a/packages/zoe/src/contractFacet/offerHandlerStorage.js +++ b/packages/zoe/src/contractFacet/offerHandlerStorage.js @@ -6,6 +6,15 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data'; import { defineDurableHandle } from '../makeHandle.js'; +/** + * The following should work. But for some reason, @endo/errors does + * not export the type `Details`. TODO fix. + * at-import {Details} from '@endo/errors' + * In the meantime... + * + * @typedef {string | {}} Details + */ + /** * @import {RemotableBrand} from '@endo/eventual-send'; * @import {RemotableObject} from '@endo/pass-style'; From 456958fb39690777ab3ce9ab76d210a3bc14c524 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 14 Jun 2024 21:25:28 -0700 Subject: [PATCH 16/25] fixup! remove packages/assert from CI --- .github/workflows/test-all-packages.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index f88455570dc..166a83f729e 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -152,9 +152,6 @@ jobs: - name: yarn test (access-token) if: (success() || failure()) run: cd packages/access-token && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - - name: yarn test (assert) - if: (success() || failure()) - run: cd packages/assert && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: yarn test (benchmark) if: (success() || failure()) run: cd packages/benchmark && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT From 10dfe0696c72640c788215ac1b2e9aebafd0e2d3 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sun, 16 Jun 2024 13:07:14 -0700 Subject: [PATCH 17/25] fixup! somehow missed device-bundle.js --- packages/SwingSet/src/devices/bundle/device-bundle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SwingSet/src/devices/bundle/device-bundle.js b/packages/SwingSet/src/devices/bundle/device-bundle.js index 1b3dfa74d77..88f87ffd8da 100644 --- a/packages/SwingSet/src/devices/bundle/device-bundle.js +++ b/packages/SwingSet/src/devices/bundle/device-bundle.js @@ -1,4 +1,4 @@ -import { assert } from '@agoric/assert'; +import { assert } from '@endo/errors'; import { buildSerializationTools } from '../lib/deviceTools.js'; /* From e1bd82ade137db6028b4871ce7c6e7878a86d9f8 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sun, 16 Jun 2024 15:37:58 -0700 Subject: [PATCH 18/25] fixup! more details to X --- packages/internal/src/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index b6847200e9e..6d5f479ecb0 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -6,7 +6,7 @@ import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; import { asyncGenerate } from 'jessie.js'; -import { q, Fail, makeError, annotateError } from '@endo/errors'; +import { q, Fail, makeError, annotateError, X } from '@endo/errors'; const { fromEntries, keys, values } = Object; @@ -204,8 +204,8 @@ export const synchronizedTee = (sourceStream, readerCount) => { if (doneResult) { result = Promise.resolve(doneResult); } else if (rejections.length) { - const error = makeError(assert.details`Teed stream threw`); - annotateError(error, assert.details`Teed rejections: ${rejections}`); + const error = makeError(X`Teed stream threw`); + annotateError(error, X`Teed rejections: ${rejections}`); result = sourceStream.throw?.(error) || Promise.resolve(sourceStream.return?.()).then(() => From 457d10ad7cb0c00e20fdcdaea77a62e35ec790cd Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 10:47:02 -0700 Subject: [PATCH 19/25] fixup! merge repair --- packages/orchestration/src/facade.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/orchestration/src/facade.js b/packages/orchestration/src/facade.js index 9d9b21e256c..53cdd699f00 100644 --- a/packages/orchestration/src/facade.js +++ b/packages/orchestration/src/facade.js @@ -1,6 +1,6 @@ /** @file Orchestration service */ -import { Fail } from '@agoric/assert'; +import { Fail } from '@endo/errors'; import { pickFacet } from '@agoric/vat-data'; import { prepareOrchestratorKit } from './exos/orchestrator.js'; From f5c6f1caad6e7888757403142c6575cc6057b3df Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 12:26:43 -0700 Subject: [PATCH 20/25] fixup! newlines --- packages/vats/src/localchain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vats/src/localchain.js b/packages/vats/src/localchain.js index e7af90e2af5..b9aae359835 100644 --- a/packages/vats/src/localchain.js +++ b/packages/vats/src/localchain.js @@ -1,10 +1,10 @@ // @ts-check +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { AmountShape, BrandShape, PaymentShape } from '@agoric/ertp'; import { Shape as NetworkShape } from '@agoric/network'; -import { Fail } from '@endo/errors'; const { Vow$ } = NetworkShape; /** From 4142e2103305695f483f93a9352fbf13b6d0512c Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 13:33:00 -0700 Subject: [PATCH 21/25] fixup! review clarification --- packages/boot/tools/authorityViz.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/boot/tools/authorityViz.js b/packages/boot/tools/authorityViz.js index de7bd1d174d..86d080255eb 100755 --- a/packages/boot/tools/authorityViz.js +++ b/packages/boot/tools/authorityViz.js @@ -38,8 +38,7 @@ const styles = { * }} GraphNode */ function* fmtGraph(nodes, neighbors) { - // TODO Why is this distinct from `q`? - const q2 = txt => JSON.stringify(txt.replace(/\./g, '_')); + const quote = txt => JSON.stringify(txt.replace(/\./g, '_')); yield 'digraph G {\n'; yield 'rankdir = LR;\n'; const clusters = new Set( @@ -53,7 +52,7 @@ function* fmtGraph(nodes, neighbors) { } for (const { id, cluster, label, style } of nodes) { if (subgraph && cluster !== subgraph) continue; - yield `${q2(id)} [label=${q2(label)}${style ? `, ${style}` : ''}];\n`; + yield `${quote(id)} [label=${quote(label)}${style ? `, ${style}` : ''}];\n`; } if (subgraph) { yield `}\n`; @@ -61,7 +60,7 @@ function* fmtGraph(nodes, neighbors) { } for (const [src, arcs] of neighbors.entries()) { for (const { id, style } of arcs) { - yield `${q2(src)} -> ${q2(id)} [${style}]\n`; + yield `${quote(src)} -> ${quote(id)} [${style}]\n`; } } yield '}\n'; From b80921f087fd057759e8a36f49a885c384fb3392 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 15:35:35 -0700 Subject: [PATCH 22/25] fixup! review suggestions --- packages/ERTP/src/mathHelpers/natMathHelpers.js | 3 +-- packages/zoe/src/contractFacet/offerHandlerStorage.js | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/ERTP/src/mathHelpers/natMathHelpers.js b/packages/ERTP/src/mathHelpers/natMathHelpers.js index b549c4143f8..969ed7b4630 100644 --- a/packages/ERTP/src/mathHelpers/natMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/natMathHelpers.js @@ -1,11 +1,10 @@ // @jessie-check +import { Fail } from '@endo/errors'; import { Nat, isNat } from '@endo/nat'; /** @import {MathHelpers, NatValue} from '../types.js' */ -import { Fail } from '@endo/errors'; - const empty = 0n; /** diff --git a/packages/zoe/src/contractFacet/offerHandlerStorage.js b/packages/zoe/src/contractFacet/offerHandlerStorage.js index 2d153e162eb..528c089aee5 100644 --- a/packages/zoe/src/contractFacet/offerHandlerStorage.js +++ b/packages/zoe/src/contractFacet/offerHandlerStorage.js @@ -8,8 +8,11 @@ import { defineDurableHandle } from '../makeHandle.js'; /** * The following should work. But for some reason, @endo/errors does - * not export the type `Details`. TODO fix. + * not export the type `Details`. + * See https://github.com/endojs/endo/issues/2339 + * * at-import {Details} from '@endo/errors' + * * In the meantime... * * @typedef {string | {}} Details From cbdd8c1265807a93e01a20e5c37c7ce58b9a2cfb Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 16:32:30 -0700 Subject: [PATCH 23/25] fixup! layered import order --- a3p-integration/proposals/c:stake-bld/test-lib/rpc.js | 2 +- packages/ERTP/src/amountMath.js | 2 +- packages/ERTP/src/legacy-payment-helpers.js | 4 ++-- packages/ERTP/src/paymentLedger.js | 2 +- packages/ERTP/src/purse.js | 2 +- packages/ERTP/test/unitTests/mintObj.test.js | 2 +- packages/SwingSet/src/controller/initializeKernel.js | 2 +- packages/SwingSet/src/devices/command/command.js | 3 +-- packages/SwingSet/src/devices/command/device-command.js | 3 +-- packages/SwingSet/src/devices/mailbox/device-mailbox.js | 3 +-- packages/SwingSet/src/devices/mailbox/mailbox.js | 3 +-- packages/SwingSet/src/devices/plugin/device-plugin.js | 2 +- packages/SwingSet/src/vats/timer/vat-timer.js | 2 +- packages/agoric-cli/src/commands/oracle.js | 2 +- packages/agoric-cli/src/deploy.js | 4 ++-- packages/agoric-cli/src/lib/format.js | 3 +-- packages/agoric-cli/src/lib/wallet.js | 2 +- packages/agoric-cli/src/open.js | 4 +--- packages/agoric-cli/src/publish.js | 4 +--- packages/async-flow/src/convert.js | 2 +- packages/async-flow/src/equate.js | 2 +- packages/async-flow/src/replay-membrane.js | 8 ++++---- packages/base-zone/src/prepare-revocable.js | 5 ++--- packages/base-zone/src/watch-promise.js | 3 +-- packages/boot/test/bootstrapTests/ibcServerMock.js | 3 +-- packages/boot/test/bootstrapTests/vats-restart.test.ts | 6 +++--- packages/boot/test/bootstrapTests/walletFactory.ts | 2 +- packages/boot/test/upgrading/upgrade-vats.test.js | 2 +- packages/casting/src/follower-cosmjs.js | 3 +-- packages/cosmic-swingset/src/chain-main.js | 2 +- packages/cosmic-swingset/src/export-kernel-db.js | 2 +- packages/cosmic-swingset/src/import-kernel-db.js | 2 +- packages/cosmic-swingset/src/launch-chain.js | 6 +++--- packages/cosmic-swingset/src/sim-chain.js | 2 +- .../deploy-script-support/src/endo-pieces-contract.js | 3 +-- packages/deploy-script-support/src/extract-proposal.js | 2 +- packages/deploy-script-support/src/offer.js | 2 +- packages/governance/src/binaryVoteCounter.js | 4 ++-- packages/governance/src/contractGovernance/assertions.js | 3 +-- packages/governance/src/contractGovernance/governApi.js | 2 +- .../governance/src/contractGovernance/governParam.js | 2 +- .../governance/src/contractGovernance/paramManager.js | 2 +- packages/governance/src/contractGovernor.js | 4 ++-- packages/governance/src/contractHelper.js | 2 +- packages/governance/src/multiCandidateVoteCounter.js | 4 ++-- packages/governance/src/validators.js | 3 +-- .../test/swingsetTests/committeeBinary/bootstrap.js | 2 +- .../test/swingsetTests/committeeBinary/vat-voter.js | 8 ++++---- .../test/swingsetTests/contractGovernor/bootstrap.js | 6 +++--- .../test/swingsetTests/contractGovernor/vat-voter.js | 2 +- packages/governance/tools/puppetContractGovernor.js | 2 +- packages/inter-protocol/src/auction/auctionBook.js | 4 ++-- packages/inter-protocol/src/auction/auctioneer.js | 6 +++--- packages/inter-protocol/src/auction/scheduleMath.js | 2 +- packages/inter-protocol/src/auction/scheduler.js | 4 ++-- packages/inter-protocol/src/auction/sortedOffers.js | 2 +- packages/inter-protocol/src/contractSupport.js | 3 +-- packages/inter-protocol/src/interest.js | 2 +- packages/inter-protocol/src/proposals/addAssetToVault.js | 2 +- packages/inter-protocol/src/proposals/startPSM.js | 4 ++-- packages/inter-protocol/src/proposals/utils.js | 5 ++--- packages/inter-protocol/src/provisionPoolKit.js | 8 ++++---- packages/inter-protocol/src/psm/psm.js | 4 ++-- packages/inter-protocol/src/vaultFactory/vault.js | 2 +- .../inter-protocol/src/vaultFactory/vaultDirector.js | 6 +++--- packages/inter-protocol/src/vaultFactory/vaultHolder.js | 3 +-- packages/inter-protocol/src/vaultFactory/vaultManager.js | 4 ++-- .../inter-protocol/test/smartWallet/boot-test-utils.js | 2 +- .../test/vaultFactory/vault-interest.test.js | 2 +- packages/inter-protocol/test/vaultFactory/vault.test.js | 2 +- packages/internal/src/callback.js | 3 +-- packages/internal/src/lib-chainStorage.js | 2 +- packages/internal/src/marshal.js | 2 +- packages/internal/src/priority-senders.js | 3 +-- packages/internal/src/storage-test-utils.js | 2 +- packages/internal/src/utils.js | 3 +-- packages/kmarshal/src/kmarshal.js | 2 +- packages/network/src/network.js | 2 +- packages/network/src/router.js | 2 +- packages/notifier/src/publish-kit.js | 7 +++---- packages/notifier/src/subscribe.js | 3 +-- packages/notifier/test/publish-kit.test.js | 3 ++- packages/orchestration/src/exos/chain-account-kit.js | 6 +++--- packages/orchestration/src/exos/chain-hub.js | 8 ++++---- .../src/exos/cosmos-orchestration-account.js | 6 +++--- packages/orchestration/src/exos/icq-connection-kit.js | 4 ++-- .../src/proposals/orchestration-proposal.js | 4 ++-- packages/orchestration/src/service.js | 2 +- packages/orchestration/src/utils/cosmos.js | 4 ++-- packages/pegasus/src/ibc-trace.js | 2 +- packages/pegasus/src/ics20.js | 2 +- packages/pegasus/src/once-promise-kit.js | 3 ++- packages/smart-wallet/src/invitations.js | 4 ++-- packages/smart-wallet/src/marshal-contexts.js | 6 +++--- .../src/proposals/upgrade-walletFactory-proposal.js | 3 +-- packages/smart-wallet/src/smartWallet.js | 2 +- packages/smart-wallet/test/addAsset.test.js | 9 +++++---- packages/smart-wallet/test/gameAssetContract.js | 6 +++--- packages/smart-wallet/test/start-game1-proposal.js | 3 +-- packages/solo/src/chain-cosmos-sdk.js | 4 ++-- packages/solo/src/pipe-entrypoint.js | 4 ++-- packages/solo/src/vat-http.js | 9 +++++---- packages/spawner/src/contractHost.js | 2 +- .../spawner/test/swingsetTests/contractHost/bootstrap.js | 2 +- packages/store/src/stores/scalarMapStore.js | 2 +- packages/store/src/stores/scalarSetStore.js | 2 +- packages/store/src/stores/scalarWeakMapStore.js | 3 +-- packages/store/src/stores/scalarWeakSetStore.js | 3 +-- packages/store/src/stores/store-utils.js | 3 +-- packages/swing-store/src/bundleStore.js | 2 +- packages/swingset-runner/src/chain.js | 3 +-- 111 files changed, 171 insertions(+), 197 deletions(-) diff --git a/a3p-integration/proposals/c:stake-bld/test-lib/rpc.js b/a3p-integration/proposals/c:stake-bld/test-lib/rpc.js index 5e047204151..2cc3c34913f 100644 --- a/a3p-integration/proposals/c:stake-bld/test-lib/rpc.js +++ b/a3p-integration/proposals/c:stake-bld/test-lib/rpc.js @@ -3,11 +3,11 @@ // @ts-check /* global Buffer */ +import { Fail } from '@endo/errors'; import { boardSlottingMarshaller, makeBoardRemote, } from '@agoric/internal/src/marshal.js'; -import { Fail } from '@endo/errors'; export { boardSlottingMarshaller }; diff --git a/packages/ERTP/src/amountMath.js b/packages/ERTP/src/amountMath.js index 8c586f45dcb..002051cc3b2 100644 --- a/packages/ERTP/src/amountMath.js +++ b/packages/ERTP/src/amountMath.js @@ -1,7 +1,7 @@ +import { q, Fail } from '@endo/errors'; import { passStyleOf, assertRemotable, assertRecord } from '@endo/marshal'; import { M, matches } from '@agoric/store'; -import { q, Fail } from '@endo/errors'; import { natMathHelpers } from './mathHelpers/natMathHelpers.js'; import { setMathHelpers } from './mathHelpers/setMathHelpers.js'; import { copySetMathHelpers } from './mathHelpers/copySetMathHelpers.js'; diff --git a/packages/ERTP/src/legacy-payment-helpers.js b/packages/ERTP/src/legacy-payment-helpers.js index a800eb3f091..f52d2f92ee6 100644 --- a/packages/ERTP/src/legacy-payment-helpers.js +++ b/packages/ERTP/src/legacy-payment-helpers.js @@ -1,8 +1,8 @@ // @jessie-check -import { mustMatch } from '@agoric/store'; -import { E } from '@endo/far'; import { Fail } from '@endo/errors'; +import { E } from '@endo/far'; +import { mustMatch } from '@agoric/store'; import { AmountMath } from './amountMath.js'; /** diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js index 89bcfc11ca7..dcf3baffcc6 100644 --- a/packages/ERTP/src/paymentLedger.js +++ b/packages/ERTP/src/paymentLedger.js @@ -3,9 +3,9 @@ /// /* eslint-disable no-use-before-define */ +import { X, q, Fail, annotateError } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { mustMatch, M, keyEQ } from '@agoric/store'; -import { X, q, Fail, annotateError } from '@endo/errors'; import { AmountMath } from './amountMath.js'; import { preparePaymentKind } from './payment.js'; import { preparePurseKind } from './purse.js'; diff --git a/packages/ERTP/src/purse.js b/packages/ERTP/src/purse.js index e67dcb10b9c..323b7c8d24a 100644 --- a/packages/ERTP/src/purse.js +++ b/packages/ERTP/src/purse.js @@ -1,5 +1,5 @@ -import { M, makeCopySet } from '@agoric/store'; import { Fail } from '@endo/errors'; +import { M, makeCopySet } from '@agoric/store'; import { AmountMath } from './amountMath.js'; import { makeTransientNotifierKit } from './transientNotifier.js'; import { makeAmountStore } from './amountStore.js'; diff --git a/packages/ERTP/test/unitTests/mintObj.test.js b/packages/ERTP/test/unitTests/mintObj.test.js index dec1ed3168c..782f4cd5917 100644 --- a/packages/ERTP/test/unitTests/mintObj.test.js +++ b/packages/ERTP/test/unitTests/mintObj.test.js @@ -1,7 +1,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { initEmpty, M } from '@agoric/store'; import { assert } from '@endo/errors'; +import { initEmpty, M } from '@agoric/store'; import { defineDurableKind, makeKindHandle } from '@agoric/vat-data'; import { makeIssuerKit, AssetKind, AmountMath } from '../../src/index.js'; diff --git a/packages/SwingSet/src/controller/initializeKernel.js b/packages/SwingSet/src/controller/initializeKernel.js index 65238d8c5d6..e9e26f93411 100644 --- a/packages/SwingSet/src/controller/initializeKernel.js +++ b/packages/SwingSet/src/controller/initializeKernel.js @@ -1,8 +1,8 @@ /* eslint-disable no-use-before-define */ +import { assert, Fail } from '@endo/errors'; import { makeMarshal } from '@endo/marshal'; import { Far } from '@endo/far'; -import { assert, Fail } from '@endo/errors'; import { kser, kunser } from '@agoric/kmarshal'; import { assertKnownOptions } from '../lib/assertOptions.js'; import { insistVatID } from '../lib/id.js'; diff --git a/packages/SwingSet/src/devices/command/command.js b/packages/SwingSet/src/devices/command/command.js index f54a932b917..d2d3a0e73a9 100644 --- a/packages/SwingSet/src/devices/command/command.js +++ b/packages/SwingSet/src/devices/command/command.js @@ -1,8 +1,7 @@ +import { Fail } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; import { Nat } from '@endo/nat'; -import { Fail } from '@endo/errors'; - export default function buildCommand(broadcastCallback) { broadcastCallback || Fail`broadcastCallback must be provided.`; let inboundCallback; diff --git a/packages/SwingSet/src/devices/command/device-command.js b/packages/SwingSet/src/devices/command/device-command.js index 2c50703f3ec..e9fe2e7a533 100644 --- a/packages/SwingSet/src/devices/command/device-command.js +++ b/packages/SwingSet/src/devices/command/device-command.js @@ -1,8 +1,7 @@ +import { Fail } from '@endo/errors'; import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { Fail } from '@endo/errors'; - export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; const { registerInboundCallback, deliverResponse, sendBroadcast } = diff --git a/packages/SwingSet/src/devices/mailbox/device-mailbox.js b/packages/SwingSet/src/devices/mailbox/device-mailbox.js index ddbbf6d250a..ae4bf5cfc30 100644 --- a/packages/SwingSet/src/devices/mailbox/device-mailbox.js +++ b/packages/SwingSet/src/devices/mailbox/device-mailbox.js @@ -1,8 +1,7 @@ +import { assert, Fail } from '@endo/errors'; import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, Fail } from '@endo/errors'; - export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; diff --git a/packages/SwingSet/src/devices/mailbox/mailbox.js b/packages/SwingSet/src/devices/mailbox/mailbox.js index b8fd29787b5..e3d6ef0c165 100644 --- a/packages/SwingSet/src/devices/mailbox/mailbox.js +++ b/packages/SwingSet/src/devices/mailbox/mailbox.js @@ -64,9 +64,8 @@ */ -import { Nat } from '@endo/nat'; - import { Fail } from '@endo/errors'; +import { Nat } from '@endo/nat'; // This Map-based mailboxState object is a good starting point, but we may // replace it with one that tracks which parts of the state have been diff --git a/packages/SwingSet/src/devices/plugin/device-plugin.js b/packages/SwingSet/src/devices/plugin/device-plugin.js index bdf6d6ae1ac..f71d57e2738 100644 --- a/packages/SwingSet/src/devices/plugin/device-plugin.js +++ b/packages/SwingSet/src/devices/plugin/device-plugin.js @@ -1,6 +1,6 @@ +import { Fail } from '@endo/errors'; import { makeCapTP } from '@endo/captp'; import { Far } from '@endo/far'; -import { Fail } from '@endo/errors'; export function buildRootDeviceNode(tools) { const { SO, getDeviceState, setDeviceState, endowments } = tools; diff --git a/packages/SwingSet/src/vats/timer/vat-timer.js b/packages/SwingSet/src/vats/timer/vat-timer.js index 07473ff8909..7ea007bf2cc 100644 --- a/packages/SwingSet/src/vats/timer/vat-timer.js +++ b/packages/SwingSet/src/vats/timer/vat-timer.js @@ -1,9 +1,9 @@ /* eslint-disable no-use-before-define */ +import { assert } from '@endo/errors'; import { Far, E, passStyleOf } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { Nat } from '@endo/nat'; -import { assert } from '@endo/errors'; import { provideKindHandle, provideDurableMapStore, diff --git a/packages/agoric-cli/src/commands/oracle.js b/packages/agoric-cli/src/commands/oracle.js index 211b365d5d9..af03aad0c21 100644 --- a/packages/agoric-cli/src/commands/oracle.js +++ b/packages/agoric-cli/src/commands/oracle.js @@ -2,8 +2,8 @@ /* eslint-disable func-names */ /* global fetch, setTimeout, process */ import { Fail } from '@endo/errors'; -import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { Nat } from '@endo/nat'; +import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { Command } from 'commander'; import * as cp from 'child_process'; import { inspect } from 'util'; diff --git a/packages/agoric-cli/src/deploy.js b/packages/agoric-cli/src/deploy.js index 71d50f97e62..68e2a94e6f1 100644 --- a/packages/agoric-cli/src/deploy.js +++ b/packages/agoric-cli/src/deploy.js @@ -1,8 +1,9 @@ // @ts-check /* global process setTimeout setInterval clearInterval */ -import { E, makeCapTP } from '@endo/captp'; +import { X } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; +import { E, makeCapTP } from '@endo/captp'; import { makeLeaderFromRpcAddresses } from '@agoric/casting'; import path from 'path'; import http from 'http'; @@ -12,7 +13,6 @@ import { whileTrue } from '@agoric/internal'; import { getAccessToken } from '@agoric/access-token'; -import { X } from '@endo/errors'; import { makeBundlePublisher, makeCosmosBundlePublisher, diff --git a/packages/agoric-cli/src/lib/format.js b/packages/agoric-cli/src/lib/format.js index 86781d37107..78227bcd615 100644 --- a/packages/agoric-cli/src/lib/format.js +++ b/packages/agoric-cli/src/lib/format.js @@ -1,8 +1,7 @@ // @ts-check -import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js'; - import { Fail, q } from '@endo/errors'; +import { makeBoardRemote } from '@agoric/vats/tools/board-utils.js'; /** @import {BoardRemote} from '@agoric/vats/tools/board-utils.js' */ /** @import {VBankAssetDetail} from '@agoric/vats/tools/board-utils.js'; */ diff --git a/packages/agoric-cli/src/lib/wallet.js b/packages/agoric-cli/src/lib/wallet.js index e06602e8fc6..c120db764e9 100644 --- a/packages/agoric-cli/src/lib/wallet.js +++ b/packages/agoric-cli/src/lib/wallet.js @@ -1,9 +1,9 @@ // @ts-check /* global process */ +import { Fail } from '@endo/errors'; import { iterateReverse } from '@agoric/casting'; import { makeWalletStateCoalescer } from '@agoric/smart-wallet/src/utils.js'; -import { Fail } from '@endo/errors'; import { execSwingsetTransaction, pollBlocks, pollTx } from './chain.js'; import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js'; diff --git a/packages/agoric-cli/src/open.js b/packages/agoric-cli/src/open.js index 639cda96240..3251a49bc72 100644 --- a/packages/agoric-cli/src/open.js +++ b/packages/agoric-cli/src/open.js @@ -1,9 +1,7 @@ /* global process setInterval clearInterval */ import opener from 'opener'; - -import { getAccessToken } from '@agoric/access-token'; - import { assert, X } from '@endo/errors'; +import { getAccessToken } from '@agoric/access-token'; export default async function walletMain(_progname, _rawArgs, powers, opts) { const { anylogger } = powers; diff --git a/packages/agoric-cli/src/publish.js b/packages/agoric-cli/src/publish.js index 6344f5ddf5c..2d21068e940 100644 --- a/packages/agoric-cli/src/publish.js +++ b/packages/agoric-cli/src/publish.js @@ -1,6 +1,7 @@ // @ts-check /// +import { X, q, Fail } from '@endo/errors'; import { E } from '@endo/far'; import { @@ -14,11 +15,8 @@ import { defaultRegistryTypes } from '@cosmjs/stargate'; import { stringToPath } from '@cosmjs/crypto'; import { Decimal } from '@cosmjs/math'; import { fromBech32 } from '@cosmjs/encoding'; - import { MsgInstallBundle } from '@agoric/cosmic-proto/swingset/msgs.js'; -import { X, q, Fail } from '@endo/errors'; - // https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go const Agoric = { Bech32MainPrefix: 'agoric', diff --git a/packages/async-flow/src/convert.js b/packages/async-flow/src/convert.js index d0935496a02..51ed928ec2e 100644 --- a/packages/async-flow/src/convert.js +++ b/packages/async-flow/src/convert.js @@ -1,5 +1,6 @@ import { Fail, X, annotateError, makeError, q } from '@endo/errors'; import { throwLabeled } from '@endo/common/throw-labeled.js'; +import { objectMap } from '@endo/common/object-map.js'; import { getErrorConstructor, getTag, @@ -8,7 +9,6 @@ import { passStyleOf, } from '@endo/pass-style'; import { isVow } from '@agoric/vow/src/vow-utils.js'; -import { objectMap } from '@endo/common/object-map.js'; /** * @import {Passable} from '@endo/pass-style' diff --git a/packages/async-flow/src/equate.js b/packages/async-flow/src/equate.js index 7dd9fc9f4fd..f11df50e911 100644 --- a/packages/async-flow/src/equate.js +++ b/packages/async-flow/src/equate.js @@ -1,8 +1,8 @@ import { Fail, X, annotateError, q } from '@endo/errors'; import { throwLabeled } from '@endo/common/throw-labeled.js'; import { getTag, isObject, passStyleOf } from '@endo/pass-style'; -import { isVow } from '@agoric/vow/src/vow-utils.js'; import { recordNames } from '@endo/marshal'; +import { isVow } from '@agoric/vow/src/vow-utils.js'; const { is } = Object; diff --git a/packages/async-flow/src/replay-membrane.js b/packages/async-flow/src/replay-membrane.js index 5f513333fed..d83b38f551b 100644 --- a/packages/async-flow/src/replay-membrane.js +++ b/packages/async-flow/src/replay-membrane.js @@ -1,5 +1,9 @@ /* eslint-disable no-use-before-define */ import { Fail, X, b, makeError, q } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { getMethodNames } from '@endo/eventual-send/utils.js'; +import { throwLabeled } from '@endo/common/throw-labeled.js'; +import { objectMap } from '@endo/common/object-map.js'; import { Far, Remotable, @@ -8,11 +12,7 @@ import { makeTagged, passStyleOf, } from '@endo/pass-style'; -import { E } from '@endo/eventual-send'; -import { throwLabeled } from '@endo/common/throw-labeled.js'; import { heapVowE } from '@agoric/vow/vat.js'; -import { getMethodNames } from '@endo/eventual-send/utils.js'; -import { objectMap } from '@endo/common/object-map.js'; import { isVow } from '@agoric/vow/src/vow-utils.js'; import { makeEquate } from './equate.js'; import { makeConvertKit } from './convert.js'; diff --git a/packages/base-zone/src/prepare-revocable.js b/packages/base-zone/src/prepare-revocable.js index 8ef5a34347a..0368b61c42c 100644 --- a/packages/base-zone/src/prepare-revocable.js +++ b/packages/base-zone/src/prepare-revocable.js @@ -1,7 +1,6 @@ -import { M } from '@endo/patterns'; -import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; - import { Fail, q } from '@endo/errors'; +import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; +import { M } from '@endo/patterns'; /** @import {Amplify} from '@endo/exo'; */ diff --git a/packages/base-zone/src/watch-promise.js b/packages/base-zone/src/watch-promise.js index 0ed2a48d5ce..14bd105223c 100644 --- a/packages/base-zone/src/watch-promise.js +++ b/packages/base-zone/src/watch-promise.js @@ -1,9 +1,8 @@ // @ts-check +import { Fail } from '@endo/errors'; import { M } from '@endo/patterns'; import { E } from '@endo/far'; -import { Fail } from '@endo/errors'; - const { apply } = Reflect; /** diff --git a/packages/boot/test/bootstrapTests/ibcServerMock.js b/packages/boot/test/bootstrapTests/ibcServerMock.js index 652acd775b4..f2e97bdd817 100644 --- a/packages/boot/test/bootstrapTests/ibcServerMock.js +++ b/packages/boot/test/bootstrapTests/ibcServerMock.js @@ -1,11 +1,10 @@ /** @file Mock IBC Server */ // @ts-check +import { q, Fail } from '@endo/errors'; import { Far } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; import { heapVowE as E } from '@agoric/vow/vat.js'; -import { q, Fail } from '@endo/errors'; - const { log } = console; /** diff --git a/packages/boot/test/bootstrapTests/vats-restart.test.ts b/packages/boot/test/bootstrapTests/vats-restart.test.ts index 2cd9f2effed..0655b96ec2c 100644 --- a/packages/boot/test/bootstrapTests/vats-restart.test.ts +++ b/packages/boot/test/bootstrapTests/vats-restart.test.ts @@ -1,16 +1,16 @@ /** @file Bootstrap test of restarting (almost) all vats */ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; +import { TestFn } from 'ava'; import processAmbient from 'child_process'; import { promises as fsAmbientPromises } from 'fs'; +import { Fail } from '@endo/errors'; +import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; import { makeAgoricNamesRemotesFromFakeStorage } from '@agoric/vats/tools/board-utils.js'; -import { TestFn } from 'ava'; import { BridgeHandler, ScopedBridgeManager } from '@agoric/vats'; import type { EconomyBootstrapSpace } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; -import { Fail } from '@endo/errors'; import { makeProposalExtractor, makeSwingsetTestKit, diff --git a/packages/boot/test/bootstrapTests/walletFactory.ts b/packages/boot/test/bootstrapTests/walletFactory.ts index 76010c3f1e7..2fa6f4c3d5e 100644 --- a/packages/boot/test/bootstrapTests/walletFactory.ts +++ b/packages/boot/test/bootstrapTests/walletFactory.ts @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; import { AgoricNamesRemotes, makeAgoricNamesRemotesFromFakeStorage, } from '@agoric/vats/tools/board-utils.js'; -import { Fail } from '@endo/errors'; import { makeSwingsetTestKit } from '../../tools/supports.ts'; import { makeWalletFactoryDriver } from '../../tools/drivers.ts'; diff --git a/packages/boot/test/upgrading/upgrade-vats.test.js b/packages/boot/test/upgrading/upgrade-vats.test.js index 6488566ef26..4685dd8228f 100644 --- a/packages/boot/test/upgrading/upgrade-vats.test.js +++ b/packages/boot/test/upgrading/upgrade-vats.test.js @@ -1,12 +1,12 @@ // @ts-check import { test as anyTest } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; +import { Fail } from '@endo/errors'; import { makeTagged } from '@endo/marshal'; import { BridgeId } from '@agoric/internal'; import { buildVatController } from '@agoric/swingset-vat'; import { makeRunUtils } from '@agoric/swingset-vat/tools/run-utils.js'; import { resolve as importMetaResolve } from 'import-meta-resolve'; -import { Fail } from '@endo/errors'; import { matchAmount, matchIter, matchRef } from '../../tools/supports.ts'; /** diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index c7e54272457..e04572d649c 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -1,12 +1,11 @@ /// +import { X, q, Fail, makeError } from '@endo/errors'; import { E, Far } from '@endo/far'; import * as tendermint34 from '@cosmjs/tendermint-rpc'; import * as stargateStar from '@cosmjs/stargate'; import { isStreamCell } from '@agoric/internal/src/lib-chainStorage.js'; - -import { X, q, Fail, makeError } from '@endo/errors'; import { MAKE_DEFAULT_DECODER, MAKE_DEFAULT_UNSERIALIZER } from './defaults.js'; import { makeCastingSpec } from './casting-spec.js'; import { makeLeader as defaultMakeLeader } from './leader-netconfig.js'; diff --git a/packages/cosmic-swingset/src/chain-main.js b/packages/cosmic-swingset/src/chain-main.js index 2280f79eb28..466ed83d1f0 100644 --- a/packages/cosmic-swingset/src/chain-main.js +++ b/packages/cosmic-swingset/src/chain-main.js @@ -10,6 +10,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import tmpfs from 'tmp'; import { fork } from 'node:child_process'; +import { Fail, q } from '@endo/errors'; import { E } from '@endo/far'; import engineGC from '@agoric/internal/src/lib-nodejs/engine-gc.js'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; @@ -18,7 +19,6 @@ import { exportMailbox, } from '@agoric/swingset-vat/src/devices/mailbox/mailbox.js'; -import { Fail, q } from '@endo/errors'; import { makeSlogSender, tryFlushSlogSender } from '@agoric/telemetry'; import { diff --git a/packages/cosmic-swingset/src/export-kernel-db.js b/packages/cosmic-swingset/src/export-kernel-db.js index 9149ca96336..cc90e945b29 100755 --- a/packages/cosmic-swingset/src/export-kernel-db.js +++ b/packages/cosmic-swingset/src/export-kernel-db.js @@ -10,8 +10,8 @@ import fsPower from 'fs/promises'; import pathPower from 'path'; import { fileURLToPath } from 'url'; -import { makePromiseKit } from '@endo/promise-kit'; import { Fail, q } from '@endo/errors'; +import { makePromiseKit } from '@endo/promise-kit'; import { makeShutdown } from '@agoric/internal/src/node/shutdown.js'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; import { makeSwingStoreExporter } from '@agoric/swing-store'; diff --git a/packages/cosmic-swingset/src/import-kernel-db.js b/packages/cosmic-swingset/src/import-kernel-db.js index cc77e6b4109..9db89a6da33 100755 --- a/packages/cosmic-swingset/src/import-kernel-db.js +++ b/packages/cosmic-swingset/src/import-kernel-db.js @@ -11,8 +11,8 @@ import fsPower from 'fs'; import fsPromisesPower from 'fs/promises'; import pathPower from 'path'; -import BufferLineTransform from '@agoric/internal/src/node/buffer-line-transform.js'; import { Fail, q } from '@endo/errors'; +import BufferLineTransform from '@agoric/internal/src/node/buffer-line-transform.js'; import { importSwingStore, openSwingStore } from '@agoric/swing-store'; import { isEntrypoint } from './helpers/is-entrypoint.js'; diff --git a/packages/cosmic-swingset/src/launch-chain.js b/packages/cosmic-swingset/src/launch-chain.js index 09b87eb2eaf..26b3b855884 100644 --- a/packages/cosmic-swingset/src/launch-chain.js +++ b/packages/cosmic-swingset/src/launch-chain.js @@ -7,11 +7,10 @@ import '@agoric/builders'; import anylogger from 'anylogger'; +import { assert, Fail } from '@endo/errors'; import { E } from '@endo/far'; import bundleSource from '@endo/bundle-source'; -/** @import {RunPolicy} from '@agoric/swingset-vat' */ - import { buildMailbox, buildMailboxStateMap, @@ -24,7 +23,6 @@ import { loadSwingsetConfigFile, } from '@agoric/swingset-vat'; import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js'; -import { assert, Fail } from '@endo/errors'; import { openSwingStore } from '@agoric/swing-store'; import { BridgeId as BRIDGE_ID } from '@agoric/internal'; import { makeWithQueue } from '@agoric/internal/src/queue.js'; @@ -53,6 +51,8 @@ import { makeQueue, makeQueueStorageMock } from './helpers/make-queue.js'; import { exportStorage } from './export-storage.js'; import { parseLocatedJson } from './helpers/json.js'; +/** @import {RunPolicy} from '@agoric/swingset-vat' */ + const console = anylogger('launch-chain'); const blockManagerConsole = anylogger('block-manager'); diff --git a/packages/cosmic-swingset/src/sim-chain.js b/packages/cosmic-swingset/src/sim-chain.js index c2f1e399562..ba1847d6cfc 100644 --- a/packages/cosmic-swingset/src/sim-chain.js +++ b/packages/cosmic-swingset/src/sim-chain.js @@ -1,6 +1,7 @@ /* global process setTimeout clearTimeout */ import path from 'path'; import fs from 'fs'; +import { Fail } from '@endo/errors'; import { importMailbox, exportMailbox, @@ -11,7 +12,6 @@ import anylogger from 'anylogger'; import { makeSlogSender } from '@agoric/telemetry'; import { resolve as importMetaResolve } from 'import-meta-resolve'; -import { Fail } from '@endo/errors'; import { makeWithQueue } from '@agoric/internal/src/queue.js'; import { makeBatchedDeliver } from '@agoric/internal/src/batched-deliver.js'; import stringify from './helpers/json-stable-stringify.js'; diff --git a/packages/deploy-script-support/src/endo-pieces-contract.js b/packages/deploy-script-support/src/endo-pieces-contract.js index 44684303a79..acd46770eba 100644 --- a/packages/deploy-script-support/src/endo-pieces-contract.js +++ b/packages/deploy-script-support/src/endo-pieces-contract.js @@ -1,10 +1,9 @@ // @ts-check +import { Fail, q } from '@endo/errors'; import { E, Far } from '@endo/far'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { ZipWriter } from '@endo/zip'; -import { Fail, q } from '@endo/errors'; - export const start = () => { /** @type { Map} */ const hashToEntry = new Map(); diff --git a/packages/deploy-script-support/src/extract-proposal.js b/packages/deploy-script-support/src/extract-proposal.js index 3adc55fac4c..f0b258b4bb7 100644 --- a/packages/deploy-script-support/src/extract-proposal.js +++ b/packages/deploy-script-support/src/extract-proposal.js @@ -1,10 +1,10 @@ // @ts-check +import { Fail } from '@endo/errors'; import { deeplyFulfilledObject } from '@agoric/internal'; import fs from 'fs'; import { createRequire } from 'module'; import path from 'path'; -import { Fail } from '@endo/errors'; import { defangAndTrim, stringify } from './code-gen.js'; import { makeCoreProposalBehavior, diff --git a/packages/deploy-script-support/src/offer.js b/packages/deploy-script-support/src/offer.js index 8944f1ae512..2307988735d 100644 --- a/packages/deploy-script-support/src/offer.js +++ b/packages/deploy-script-support/src/offer.js @@ -1,6 +1,6 @@ // @ts-check -import { E } from '@endo/far'; import { assert } from '@endo/errors'; +import { E } from '@endo/far'; // Avoid pulling in too many dependencies like notifiers import { AmountMath } from '@agoric/ertp/src/amountMath.js'; diff --git a/packages/governance/src/binaryVoteCounter.js b/packages/governance/src/binaryVoteCounter.js index 0f3cdb1a3f5..d502507e737 100644 --- a/packages/governance/src/binaryVoteCounter.js +++ b/packages/governance/src/binaryVoteCounter.js @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; -import { makeExo, keyEQ, makeScalarMapStore } from '@agoric/store'; import { E } from '@endo/eventual-send'; +import { makeExo, keyEQ, makeScalarMapStore } from '@agoric/store'; -import { Fail } from '@endo/errors'; import { buildQuestion, ChoiceMethod, diff --git a/packages/governance/src/contractGovernance/assertions.js b/packages/governance/src/contractGovernance/assertions.js index 2ded5b3e009..09a3bb57930 100644 --- a/packages/governance/src/contractGovernance/assertions.js +++ b/packages/governance/src/contractGovernance/assertions.js @@ -1,10 +1,9 @@ +import { Fail } from '@endo/errors'; import { isRemotable } from '@endo/marshal'; import { assertIsRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; import { mustMatch } from '@agoric/store'; import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time'; -import { Fail } from '@endo/errors'; - const makeLooksLikeBrand = name => { /** @param {Brand} brand */ return brand => { diff --git a/packages/governance/src/contractGovernance/governApi.js b/packages/governance/src/contractGovernance/governApi.js index 1f30f040a47..f700e6de740 100644 --- a/packages/governance/src/contractGovernance/governApi.js +++ b/packages/governance/src/contractGovernance/governApi.js @@ -1,8 +1,8 @@ +import { Fail, q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { keyEQ } from '@agoric/store'; -import { Fail, q } from '@endo/errors'; import { ChoiceMethod, QuorumRule, diff --git a/packages/governance/src/contractGovernance/governParam.js b/packages/governance/src/contractGovernance/governParam.js index 16e85db839e..8ca1b9b7859 100644 --- a/packages/governance/src/contractGovernance/governParam.js +++ b/packages/governance/src/contractGovernance/governParam.js @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { deeplyFulfilled, Far } from '@endo/marshal'; import { mustMatch, keyEQ } from '@agoric/store'; -import { Fail } from '@endo/errors'; import { ChoiceMethod, coerceQuestionSpec, diff --git a/packages/governance/src/contractGovernance/paramManager.js b/packages/governance/src/contractGovernance/paramManager.js index 895298017f0..ccafa4fc6b7 100644 --- a/packages/governance/src/contractGovernance/paramManager.js +++ b/packages/governance/src/contractGovernance/paramManager.js @@ -1,3 +1,4 @@ +import { Fail, q } from '@endo/errors'; import { Far, passStyleOf } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; import { assertKeywordName } from '@agoric/zoe/src/cleanProposal.js'; @@ -5,7 +6,6 @@ import { Nat } from '@endo/nat'; import { keyEQ, makeScalarMapStore } from '@agoric/store'; import { E } from '@endo/eventual-send'; import { assertAllDefined } from '@agoric/internal'; -import { Fail, q } from '@endo/errors'; import { ParamTypes } from '../constants.js'; import { diff --git a/packages/governance/src/contractGovernor.js b/packages/governance/src/contractGovernor.js index 1d1f2158734..594d17aa28a 100644 --- a/packages/governance/src/contractGovernor.js +++ b/packages/governance/src/contractGovernor.js @@ -1,9 +1,9 @@ -import { mustMatch } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; +import { mustMatch } from '@agoric/store'; import { makeTracer } from '@agoric/internal'; import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js'; -import { Fail } from '@endo/errors'; import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; import { prepareContractGovernorKit } from './contractGovernorKit.js'; import { ParamChangesQuestionDetailsShape } from './typeGuards.js'; diff --git a/packages/governance/src/contractHelper.js b/packages/governance/src/contractHelper.js index 017595e8219..c3a0896ea1d 100644 --- a/packages/governance/src/contractHelper.js +++ b/packages/governance/src/contractHelper.js @@ -1,3 +1,4 @@ +import { Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; import { makeStoredPublisherKit } from '@agoric/notifier'; import { getMethodNames, objectMap } from '@agoric/internal'; @@ -6,7 +7,6 @@ import { M } from '@agoric/store'; import { AmountShape, BrandShape } from '@agoric/ertp'; import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time'; import { E } from '@endo/eventual-send'; -import { Fail } from '@endo/errors'; import { makeParamManagerFromTerms } from './contractGovernance/typedParamManager.js'; import { GovernorFacetShape } from './typeGuards.js'; import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; diff --git a/packages/governance/src/multiCandidateVoteCounter.js b/packages/governance/src/multiCandidateVoteCounter.js index e13060440b4..ff236aa911d 100644 --- a/packages/governance/src/multiCandidateVoteCounter.js +++ b/packages/governance/src/multiCandidateVoteCounter.js @@ -1,7 +1,7 @@ -import { keyEQ, makeExo, makeScalarMapStore } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail } from '@endo/errors'; +import { keyEQ, makeExo, makeScalarMapStore } from '@agoric/store'; import { buildQuestion, ChoiceMethod, diff --git a/packages/governance/src/validators.js b/packages/governance/src/validators.js index 818612df02e..4d626944c46 100644 --- a/packages/governance/src/validators.js +++ b/packages/governance/src/validators.js @@ -1,6 +1,5 @@ -import { E } from '@endo/eventual-send'; - import { Fail, q } from '@endo/errors'; +import { E } from '@endo/eventual-send'; /** * @import {VoteCounterCreatorFacet, VoteCounterPublicFacet, QuestionSpec, OutcomeRecord, AddQuestion, AddQuestionReturn, AssertContractGovernance, AssertContractElectorate} from './types.js'; diff --git a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js index 887d9cd93c4..b23a3fe2a1d 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js +++ b/packages/governance/test/swingsetTests/committeeBinary/bootstrap.js @@ -1,9 +1,9 @@ +import { q } from '@endo/errors'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { q } from '@endo/errors'; import { ChoiceMethod, ElectionType, diff --git a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js index b694a901078..d817520ed99 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js +++ b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js @@ -1,14 +1,14 @@ -import { makeNotifierFromSubscriber, observeNotifier } from '@agoric/notifier'; -import { keyEQ } from '@agoric/store'; +import { q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { makeNotifierFromSubscriber, observeNotifier } from '@agoric/notifier'; +import { keyEQ } from '@agoric/store'; + /** * @import {CommitteeElectoratePublic, Issue} from '../../../src/types.js'; */ -import { q } from '@endo/errors'; - /** * @param {(msg: any)=> void} log * @param {Issue} issue diff --git a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js index 2e6abf7d870..12dc64fe62b 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js +++ b/packages/governance/test/swingsetTests/contractGovernor/bootstrap.js @@ -1,10 +1,10 @@ +import { q } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { Far } from '@endo/marshal'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; import { observeIteration, subscribeEach } from '@agoric/notifier'; import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; -import { E } from '@endo/eventual-send'; -import { Far } from '@endo/marshal'; -import { q } from '@endo/errors'; import { assertContractElectorate, CONTRACT_ELECTORATE, diff --git a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js index ffd5243509f..4f8cb994f86 100644 --- a/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js +++ b/packages/governance/test/swingsetTests/contractGovernor/vat-voter.js @@ -1,7 +1,7 @@ +import { q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { q } from '@endo/errors'; import { assertContractElectorate, assertContractGovernance, diff --git a/packages/governance/tools/puppetContractGovernor.js b/packages/governance/tools/puppetContractGovernor.js index 162fd7d11be..0ad9aa3e07b 100644 --- a/packages/governance/tools/puppetContractGovernor.js +++ b/packages/governance/tools/puppetContractGovernor.js @@ -1,7 +1,7 @@ +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@endo/errors'; // eslint-disable-next-line no-unused-vars -- used by typedef import { CONTRACT_ELECTORATE } from '../src/contractGovernance/governParam.js'; import { makeApiInvocationPositions } from '../src/contractGovernance/governApi.js'; diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index 4746ac61c7f..3b373c79a79 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -2,6 +2,8 @@ /// /// +import { Fail } from '@endo/errors'; +import { E } from '@endo/captp'; import { AmountMath, RatioShape } from '@agoric/ertp'; import { mustMatch } from '@agoric/store'; import { M, prepareExoClassKit } from '@agoric/vat-data'; @@ -16,10 +18,8 @@ import { multiplyRatios, ratioGTE, } from '@agoric/zoe/src/contractSupport/index.js'; -import { E } from '@endo/captp'; import { observeNotifier } from '@agoric/notifier'; -import { Fail } from '@endo/errors'; import { makeNatAmountShape } from '../contractSupport.js'; import { preparePriceBook, prepareScaledBidBook } from './offerBook.js'; import { diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index 3b1dd235bb4..6d6b2d021a1 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -1,6 +1,9 @@ /// /// +import { Fail, q } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { Far } from '@endo/marshal'; import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp'; import { handleParamGovernance } from '@agoric/governance'; import { BASIS_POINTS, makeTracer } from '@agoric/internal'; @@ -25,10 +28,7 @@ import { offerTo, } from '@agoric/zoe/src/contractSupport/index.js'; import { FullProposalShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/eventual-send'; -import { Far } from '@endo/marshal'; -import { Fail, q } from '@endo/errors'; import { makeNatAmountShape } from '../contractSupport.js'; import { makeOfferSpecShape, prepareAuctionBook } from './auctionBook.js'; import { auctioneerParamTypes } from './params.js'; diff --git a/packages/inter-protocol/src/auction/scheduleMath.js b/packages/inter-protocol/src/auction/scheduleMath.js index a6eb48e5d7f..73fe93e4cef 100644 --- a/packages/inter-protocol/src/auction/scheduleMath.js +++ b/packages/inter-protocol/src/auction/scheduleMath.js @@ -1,9 +1,9 @@ // @jessie-check +import { Fail } from '@endo/errors'; import { TimeMath } from '@agoric/time'; import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; import { assertAllDefined, makeTracer } from '@agoric/internal'; -import { Fail } from '@endo/errors'; /** @import {TimestampRecord} from '@agoric/time'; */ diff --git a/packages/inter-protocol/src/auction/scheduler.js b/packages/inter-protocol/src/auction/scheduler.js index e9456e9a710..716b84267b5 100644 --- a/packages/inter-protocol/src/auction/scheduler.js +++ b/packages/inter-protocol/src/auction/scheduler.js @@ -1,10 +1,10 @@ +import { X, Fail, q, makeError } from '@endo/errors'; import { E } from '@endo/eventual-send'; -import { TimeMath } from '@agoric/time'; import { Far } from '@endo/marshal'; +import { TimeMath } from '@agoric/time'; import { makeTracer } from '@agoric/internal'; import { observeIteration, subscribeEach } from '@agoric/notifier'; -import { X, Fail, q, makeError } from '@endo/errors'; import { AuctionState, makeCancelTokenMaker } from './util.js'; import { computeRoundTiming, diff --git a/packages/inter-protocol/src/auction/sortedOffers.js b/packages/inter-protocol/src/auction/sortedOffers.js index 38ff5a3250e..fd58098815b 100644 --- a/packages/inter-protocol/src/auction/sortedOffers.js +++ b/packages/inter-protocol/src/auction/sortedOffers.js @@ -1,5 +1,6 @@ // @jessie-check +import { Fail } from '@endo/errors'; import { makeRatio, ratioToNumber, @@ -7,7 +8,6 @@ import { import { M, mustMatch } from '@agoric/store'; import { RatioShape } from '@agoric/ertp'; -import { Fail } from '@endo/errors'; import { decodeData, encodeData } from '../vaultFactory/storeUtils.js'; /** diff --git a/packages/inter-protocol/src/contractSupport.js b/packages/inter-protocol/src/contractSupport.js index 0ac4f173dad..bc1941561a0 100644 --- a/packages/inter-protocol/src/contractSupport.js +++ b/packages/inter-protocol/src/contractSupport.js @@ -1,13 +1,12 @@ // @jessie-check +import { Fail, q } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { M } from '@agoric/store'; import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js'; /** @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -import { Fail, q } from '@endo/errors'; - export const amountPattern = harden({ brand: M.remotable(), value: M.any() }); export const ratioPattern = harden({ numerator: amountPattern, diff --git a/packages/inter-protocol/src/interest.js b/packages/inter-protocol/src/interest.js index 21ca9e866b7..688c4e67d2d 100644 --- a/packages/inter-protocol/src/interest.js +++ b/packages/inter-protocol/src/interest.js @@ -1,5 +1,6 @@ // @jessie-check +import { Fail } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; import { @@ -7,7 +8,6 @@ import { multiplyRatios, quantize, } from '@agoric/zoe/src/contractSupport/ratio.js'; -import { Fail } from '@endo/errors'; import { TimeMath } from '@agoric/time'; /** diff --git a/packages/inter-protocol/src/proposals/addAssetToVault.js b/packages/inter-protocol/src/proposals/addAssetToVault.js index 5d1bc7fd521..f1481e09099 100644 --- a/packages/inter-protocol/src/proposals/addAssetToVault.js +++ b/packages/inter-protocol/src/proposals/addAssetToVault.js @@ -1,6 +1,7 @@ // @jessie-check // @ts-check +import { q } from '@endo/errors'; import { ToFarFunction } from '@endo/captp'; import { Far } from '@endo/marshal'; import { AmountMath, AssetKind } from '@agoric/ertp'; @@ -12,7 +13,6 @@ import { Stable } from '@agoric/internal/src/tokens.js'; import { TimeMath } from '@agoric/time/src/timeMath.js'; import { makePromiseKit } from '@endo/promise-kit'; -import { q } from '@endo/errors'; import { oracleBrandFeedName, reserveThenGetNames, diff --git a/packages/inter-protocol/src/proposals/startPSM.js b/packages/inter-protocol/src/proposals/startPSM.js index 41ebb584ab2..8a6e0bd5daa 100644 --- a/packages/inter-protocol/src/proposals/startPSM.js +++ b/packages/inter-protocol/src/proposals/startPSM.js @@ -1,11 +1,12 @@ // @jessie-check import { makeMap } from 'jessie.js'; +import { X } from '@endo/errors'; +import { E } from '@endo/far'; import { AmountMath, AssetKind } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; -import { E } from '@endo/far'; import { makeHistoryReviver, makeBoardRemote, @@ -15,7 +16,6 @@ import { deeplyFulfilledObject } from '@agoric/internal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { Stable } from '@agoric/internal/src/tokens.js'; -import { X } from '@endo/errors'; import { reserveThenGetNamePaths } from './utils.js'; import { diff --git a/packages/inter-protocol/src/proposals/utils.js b/packages/inter-protocol/src/proposals/utils.js index fb517b42a7b..4dce2abdad3 100644 --- a/packages/inter-protocol/src/proposals/utils.js +++ b/packages/inter-protocol/src/proposals/utils.js @@ -1,11 +1,10 @@ +import { Fail } from '@endo/errors'; +import { E } from '@endo/far'; import { WalletName } from '@agoric/internal'; import { getCopyMapEntries, makeCopyMap } from '@agoric/store'; -import { E } from '@endo/far'; /** @import {CopyMap} from '@endo/patterns') */ -import { Fail } from '@endo/errors'; - /** * @param {ERef} nameAdmin * @param {string[][]} paths diff --git a/packages/inter-protocol/src/provisionPoolKit.js b/packages/inter-protocol/src/provisionPoolKit.js index 374b5f285e5..4e1c71aa704 100644 --- a/packages/inter-protocol/src/provisionPoolKit.js +++ b/packages/inter-protocol/src/provisionPoolKit.js @@ -1,4 +1,8 @@ // @ts-check +import { X, q, Fail } from '@endo/errors'; +import { E } from '@endo/far'; +import { Far } from '@endo/marshal'; + import { AmountMath, BrandShape } from '@agoric/ertp'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; @@ -19,12 +23,8 @@ import { makeRecorderTopic, } from '@agoric/zoe/src/contractSupport/topics.js'; import { InstanceHandleShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/far'; -import { Far } from '@endo/marshal'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; -import { X, q, Fail } from '@endo/errors'; - const trace = makeTracer('ProvPool'); const FIRST_UPPER_KEYWORD = /^[A-Z][a-zA-Z0-9_$]*$/; diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index 6dbafc4d147..f19e1cb9fe2 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -2,6 +2,8 @@ /// /// +import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { AmountMath, AmountShape, BrandShape, RatioShape } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, @@ -29,10 +31,8 @@ import { InstanceHandleShape, InvitationShape, } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/eventual-send'; import { mustMatch } from '@agoric/store'; -import { Fail } from '@endo/errors'; import { makeCollectFeesInvitation } from '../collectFees.js'; import { makeNatAmountShape } from '../contractSupport.js'; diff --git a/packages/inter-protocol/src/vaultFactory/vault.js b/packages/inter-protocol/src/vaultFactory/vault.js index 99908851c5b..70fed25f3fa 100644 --- a/packages/inter-protocol/src/vaultFactory/vault.js +++ b/packages/inter-protocol/src/vaultFactory/vault.js @@ -1,10 +1,10 @@ +import { q, Fail } from '@endo/errors'; import { AmountMath, AmountShape } from '@agoric/ertp'; import { StorageNodeShape, makeTracer } from '@agoric/internal'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; import { M, prepareExoClassKit } from '@agoric/vat-data'; import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; import { SeatShape } from '@agoric/zoe/src/typeGuards.js'; -import { q, Fail } from '@endo/errors'; import { addSubtract, allEmpty, diff --git a/packages/inter-protocol/src/vaultFactory/vaultDirector.js b/packages/inter-protocol/src/vaultFactory/vaultDirector.js index 650cf89acef..5eea587cd44 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultDirector.js +++ b/packages/inter-protocol/src/vaultFactory/vaultDirector.js @@ -1,6 +1,9 @@ /// /// +import { Fail, q } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { Far } from '@endo/marshal'; import { AmountMath, AmountShape, BrandShape, IssuerShape } from '@agoric/ertp'; import { GovernorFacetShape, @@ -22,9 +25,6 @@ import { TopicsRecordShape, unitAmount, } from '@agoric/zoe/src/contractSupport/index.js'; -import { E } from '@endo/eventual-send'; -import { Far } from '@endo/marshal'; -import { Fail, q } from '@endo/errors'; import { makeCollectFeesInvitation } from '../collectFees.js'; import { setWakeupsForNextAuction, diff --git a/packages/inter-protocol/src/vaultFactory/vaultHolder.js b/packages/inter-protocol/src/vaultFactory/vaultHolder.js index 73ec7702dd8..567849ae3e0 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultHolder.js +++ b/packages/inter-protocol/src/vaultFactory/vaultHolder.js @@ -1,11 +1,10 @@ /** @file Use-object for the owner of a vault */ +import { Fail } from '@endo/errors'; import { AmountShape } from '@agoric/ertp'; import { M, prepareExoClassKit } from '@agoric/vat-data'; import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; -import { Fail } from '@endo/errors'; - /** * @typedef {{ * topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit; diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index f6b3117eb97..ad5cffc37ed 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -18,6 +18,8 @@ */ /// +import { X, Fail, q, makeError } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { AmountMath, AmountShape, @@ -50,8 +52,6 @@ import { TopicsRecordShape, } from '@agoric/zoe/src/contractSupport/index.js'; import { PriceQuoteShape, SeatShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/eventual-send'; -import { X, Fail, q, makeError } from '@endo/errors'; import { checkDebtLimit, makeNatAmountShape, diff --git a/packages/inter-protocol/test/smartWallet/boot-test-utils.js b/packages/inter-protocol/test/smartWallet/boot-test-utils.js index 78d0cbfceaa..c4674281b69 100644 --- a/packages/inter-protocol/test/smartWallet/boot-test-utils.js +++ b/packages/inter-protocol/test/smartWallet/boot-test-utils.js @@ -4,6 +4,7 @@ * integrates multiple bundles so should move to a bootstrap-style test. */ // @ts-check +import { Fail } from '@endo/errors'; import { makeFakeVatAdmin, zcfBundleCap, @@ -12,7 +13,6 @@ import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; import { Far } from '@endo/marshal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { vatRoots } from '@agoric/vats/tools/boot-test-utils.js'; -import { Fail } from '@endo/errors'; import { bundles, devices } from './devices.js'; export const noop = () => {}; diff --git a/packages/inter-protocol/test/vaultFactory/vault-interest.test.js b/packages/inter-protocol/test/vaultFactory/vault-interest.test.js index 123393d2a0a..72e4648fb88 100644 --- a/packages/inter-protocol/test/vaultFactory/vault-interest.test.js +++ b/packages/inter-protocol/test/vaultFactory/vault-interest.test.js @@ -1,5 +1,6 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { setUpZoeForTest } from '@agoric/zoe/tools/setup-zoe.js'; import bundleSource from '@endo/bundle-source'; @@ -7,7 +8,6 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { AmountMath } from '@agoric/ertp'; -import { assert } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; const vaultRoot = './vault-contract-wrapper.js'; diff --git a/packages/inter-protocol/test/vaultFactory/vault.test.js b/packages/inter-protocol/test/vaultFactory/vault.test.js index 86aac35fed4..c5712a70755 100644 --- a/packages/inter-protocol/test/vaultFactory/vault.test.js +++ b/packages/inter-protocol/test/vaultFactory/vault.test.js @@ -1,5 +1,6 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { assert } from '@endo/errors'; import { setUpZoeForTest } from '@agoric/zoe/tools/setup-zoe.js'; import bundleSource from '@endo/bundle-source'; import { E } from '@endo/eventual-send'; @@ -7,7 +8,6 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { assert } from '@endo/errors'; import { makeTracer } from '@agoric/internal'; const vaultRoot = './vault-contract-wrapper.js'; diff --git a/packages/internal/src/callback.js b/packages/internal/src/callback.js index 7c8afa2f286..01350acfa58 100644 --- a/packages/internal/src/callback.js +++ b/packages/internal/src/callback.js @@ -1,4 +1,5 @@ // @ts-check +import { Fail, makeError, q } from '@endo/errors'; import { E } from '@endo/far'; import { isObject, isPassableSymbol } from '@endo/marshal'; import { getInterfaceMethodKeys } from '@endo/patterns'; @@ -6,8 +7,6 @@ import { getInterfaceMethodKeys } from '@endo/patterns'; /** @import {ERef} from '@endo/far' */ /** @import {Callback, SyncCallback} from './types.js' */ -import { Fail, makeError, q } from '@endo/errors'; - const { fromEntries } = Object; const { ownKeys: rawOwnKeys } = Reflect; diff --git a/packages/internal/src/lib-chainStorage.js b/packages/internal/src/lib-chainStorage.js index 5fff792140a..e67b5766166 100644 --- a/packages/internal/src/lib-chainStorage.js +++ b/packages/internal/src/lib-chainStorage.js @@ -1,9 +1,9 @@ // @ts-check +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { makeHeapZone } from '@agoric/base-zone/heap.js'; -import { Fail } from '@endo/errors'; import * as cb from './callback.js'; /** diff --git a/packages/internal/src/marshal.js b/packages/internal/src/marshal.js index 8e95c7dc560..3750b910ad2 100644 --- a/packages/internal/src/marshal.js +++ b/packages/internal/src/marshal.js @@ -1,7 +1,7 @@ // @ts-check +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; -import { Fail } from '@endo/errors'; import { isStreamCell } from './lib-chainStorage.js'; /** diff --git a/packages/internal/src/priority-senders.js b/packages/internal/src/priority-senders.js index f4f41d0ac58..f47c3d2e7ad 100644 --- a/packages/internal/src/priority-senders.js +++ b/packages/internal/src/priority-senders.js @@ -1,6 +1,5 @@ -import { E, Far } from '@endo/far'; - import { Fail, q } from '@endo/errors'; +import { E, Far } from '@endo/far'; const PRIORITY_SENDERS_NAMESPACE_RE = /^[a-zA-Z0-9_-]{1,50}$/; diff --git a/packages/internal/src/storage-test-utils.js b/packages/internal/src/storage-test-utils.js index 4ab44922695..9da583ab10a 100644 --- a/packages/internal/src/storage-test-utils.js +++ b/packages/internal/src/storage-test-utils.js @@ -1,7 +1,7 @@ // @ts-check +import { Fail } from '@endo/errors'; import { Far } from '@endo/far'; import { makeMarshal, Remotable } from '@endo/marshal'; -import { Fail } from '@endo/errors'; import { unmarshalFromVstorage } from './marshal.js'; import { makeTracer } from './debug.js'; import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js'; diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index 6d5f479ecb0..0ca49c8515c 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -1,13 +1,12 @@ // @ts-check // @jessie-check +import { q, Fail, makeError, annotateError, X } from '@endo/errors'; import { deeplyFulfilled, isObject } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; import { asyncGenerate } from 'jessie.js'; -import { q, Fail, makeError, annotateError, X } from '@endo/errors'; - const { fromEntries, keys, values } = Object; export const BASIS_POINTS = 10_000n; diff --git a/packages/kmarshal/src/kmarshal.js b/packages/kmarshal/src/kmarshal.js index 95449900b70..aa6c7475d8c 100644 --- a/packages/kmarshal/src/kmarshal.js +++ b/packages/kmarshal/src/kmarshal.js @@ -1,6 +1,6 @@ +import { assert, Fail } from '@endo/errors'; import { Far, passStyleOf } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; -import { assert, Fail } from '@endo/errors'; /** * @import { ERef } from '@endo/far'; diff --git a/packages/network/src/network.js b/packages/network/src/network.js index b834c3a1458..d6e1a3bbc86 100644 --- a/packages/network/src/network.js +++ b/packages/network/src/network.js @@ -2,9 +2,9 @@ /// +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@endo/errors'; import { toBytes } from './bytes.js'; import { Shape } from './shapes.js'; diff --git a/packages/network/src/router.js b/packages/network/src/router.js index 09563db5b4f..cea73335bd2 100644 --- a/packages/network/src/router.js +++ b/packages/network/src/router.js @@ -3,9 +3,9 @@ /// /// +import { Fail } from '@endo/errors'; import { E as defaultE } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@endo/errors'; import { ENDPOINT_SEPARATOR, prepareNetworkProtocol } from './network.js'; import { Shape } from './shapes.js'; diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js index d8461d4988f..86a3d1f295f 100644 --- a/packages/notifier/src/publish-kit.js +++ b/packages/notifier/src/publish-kit.js @@ -1,17 +1,16 @@ /// -import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data'; +import { Fail, q } from '@endo/errors'; import { E, Far } from '@endo/far'; -import { M, getInterfaceGuardPayload } from '@endo/patterns'; import { makePromiseKit } from '@endo/promise-kit'; +import { M, getInterfaceGuardPayload } from '@endo/patterns'; +import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data'; /** * @import {ERef} from '@endo/far'; * @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js'; */ -import { Fail, q } from '@endo/errors'; - const sink = () => {}; const makeQuietRejection = reason => { const rejection = harden(Promise.reject(reason)); diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index d79c92aecda..c0c2aec301f 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -1,3 +1,4 @@ +import { X, Fail, annotateError } from '@endo/errors'; import { E, Far } from '@endo/far'; import { isObject } from '@endo/marshal'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; @@ -7,8 +8,6 @@ import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js'; */ -import { X, Fail, annotateError } from '@endo/errors'; - const sink = () => {}; /** diff --git a/packages/notifier/test/publish-kit.test.js b/packages/notifier/test/publish-kit.test.js index 1c1c5c979ca..29b53a81d5f 100644 --- a/packages/notifier/test/publish-kit.test.js +++ b/packages/notifier/test/publish-kit.test.js @@ -2,6 +2,8 @@ import '@agoric/swingset-liveslots/tools/prepare-test-env.js'; import test from 'ava'; + +import { q } from '@endo/errors'; import { E } from '@endo/far'; import { buildKernelBundles, @@ -11,7 +13,6 @@ import { import { initSwingStore } from '@agoric/swing-store'; import { kunser } from '@agoric/kmarshal'; import { makeScalarBigMapStore } from '@agoric/vat-data/src/vat-data-bindings.js'; -import { q } from '@endo/errors'; import { makePublishKit, subscribeEach, diff --git a/packages/orchestration/src/exos/chain-account-kit.js b/packages/orchestration/src/exos/chain-account-kit.js index 3defe932d56..cc2e7ac1f15 100644 --- a/packages/orchestration/src/exos/chain-account-kit.js +++ b/packages/orchestration/src/exos/chain-account-kit.js @@ -1,9 +1,9 @@ /** @file ChainAccount exo */ -import { NonNullish, makeTracer } from '@agoric/internal'; -import { VowShape } from '@agoric/vow'; +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@endo/errors'; +import { NonNullish, makeTracer } from '@agoric/internal'; +import { VowShape } from '@agoric/vow'; import { ChainAddressShape, OutboundConnectionHandlerI, diff --git a/packages/orchestration/src/exos/chain-hub.js b/packages/orchestration/src/exos/chain-hub.js index 6ab3b2e2db1..88ae11e8a15 100644 --- a/packages/orchestration/src/exos/chain-hub.js +++ b/packages/orchestration/src/exos/chain-hub.js @@ -1,11 +1,11 @@ +import { Fail, makeError } from '@endo/errors'; +import { E } from '@endo/far'; +import { M } from '@endo/patterns'; + import { VowShape } from '@agoric/vow'; // eslint-disable-next-line no-restricted-syntax import { heapVowTools } from '@agoric/vow/vat.js'; import { makeHeapZone } from '@agoric/zone'; -import { Fail, makeError } from '@endo/errors'; - -import { E } from '@endo/far'; -import { M } from '@endo/patterns'; import { CosmosChainInfoShape, IBCConnectionInfoShape } from '../typeGuards.js'; // FIXME test thoroughly whether heap suffices for ChainHub diff --git a/packages/orchestration/src/exos/cosmos-orchestration-account.js b/packages/orchestration/src/exos/cosmos-orchestration-account.js index 4c473ac0f2f..025562003ae 100644 --- a/packages/orchestration/src/exos/cosmos-orchestration-account.js +++ b/packages/orchestration/src/exos/cosmos-orchestration-account.js @@ -1,4 +1,7 @@ /** @file Use-object for the owner of a staking account */ +import { Fail } from '@endo/errors'; +import { decodeBase64 } from '@endo/base64'; +import { E } from '@endo/far'; import { toRequestQueryJson } from '@agoric/cosmic-proto'; import { QueryBalanceRequest, @@ -20,9 +23,6 @@ import { Shape as NetworkShape } from '@agoric/network'; import { M } from '@agoric/vat-data'; import { VowShape } from '@agoric/vow'; import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/index.js'; -import { decodeBase64 } from '@endo/base64'; -import { E } from '@endo/far'; -import { Fail } from '@endo/errors'; import { AmountArgShape, ChainAddressShape, diff --git a/packages/orchestration/src/exos/icq-connection-kit.js b/packages/orchestration/src/exos/icq-connection-kit.js index dc29ddd195e..cfe78cc8ae5 100644 --- a/packages/orchestration/src/exos/icq-connection-kit.js +++ b/packages/orchestration/src/exos/icq-connection-kit.js @@ -1,8 +1,8 @@ /** @file ICQConnection Exo */ -import { NonNullish, makeTracer } from '@agoric/internal'; +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { Fail } from '@endo/errors'; +import { NonNullish, makeTracer } from '@agoric/internal'; import { makeQueryPacket, parseQueryPacket } from '../utils/packet.js'; import { OutboundConnectionHandlerI } from '../typeGuards.js'; diff --git a/packages/orchestration/src/proposals/orchestration-proposal.js b/packages/orchestration/src/proposals/orchestration-proposal.js index e36e7c4288a..815e3bc7aad 100644 --- a/packages/orchestration/src/proposals/orchestration-proposal.js +++ b/packages/orchestration/src/proposals/orchestration-proposal.js @@ -1,7 +1,7 @@ -import { makeTracer } from '@agoric/internal'; +import { Fail } from '@endo/errors'; import { E, Far } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; -import { Fail } from '@endo/errors'; +import { makeTracer } from '@agoric/internal'; import { registerChainNamespace } from '../chain-info.js'; import { CHAIN_KEY, CONNECTIONS_KEY } from '../exos/chain-hub.js'; diff --git a/packages/orchestration/src/service.js b/packages/orchestration/src/service.js index c9658f5ce1c..93cbf1ab7ce 100644 --- a/packages/orchestration/src/service.js +++ b/packages/orchestration/src/service.js @@ -1,9 +1,9 @@ /** @file Orchestration service */ +import { Fail, b } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { Shape as NetworkShape } from '@agoric/network'; -import { Fail, b } from '@endo/errors'; import { prepareChainAccountKit } from './exos/chain-account-kit.js'; import { prepareICQConnectionKit } from './exos/icq-connection-kit.js'; import { diff --git a/packages/orchestration/src/utils/cosmos.js b/packages/orchestration/src/utils/cosmos.js index f901e870db4..325b3183f01 100644 --- a/packages/orchestration/src/utils/cosmos.js +++ b/packages/orchestration/src/utils/cosmos.js @@ -1,6 +1,6 @@ -import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js'; -import { decodeBase64, encodeBase64 } from '@endo/base64'; import { makeError } from '@endo/errors'; +import { decodeBase64, encodeBase64 } from '@endo/base64'; +import { Any } from '@agoric/cosmic-proto/google/protobuf/any.js'; /** maximum clock skew, in seconds, for unbonding time reported from other chain */ export const maxClockSkew = 10n * 60n; diff --git a/packages/pegasus/src/ibc-trace.js b/packages/pegasus/src/ibc-trace.js index 474321492cf..2460027ba17 100644 --- a/packages/pegasus/src/ibc-trace.js +++ b/packages/pegasus/src/ibc-trace.js @@ -1,6 +1,6 @@ // @ts-check -import { Far } from '@endo/far'; import { Fail } from '@endo/errors'; +import { Far } from '@endo/far'; import { parse } from '@agoric/network'; diff --git a/packages/pegasus/src/ics20.js b/packages/pegasus/src/ics20.js index 519fd1f2623..cd273368d86 100644 --- a/packages/pegasus/src/ics20.js +++ b/packages/pegasus/src/ics20.js @@ -1,7 +1,7 @@ // @ts-check +import { assert, X, Fail, annotateError } from '@endo/errors'; import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, X, Fail, annotateError } from '@endo/errors'; /** * @typedef {object} ICS20TransferPacket Packet shape defined at: diff --git a/packages/pegasus/src/once-promise-kit.js b/packages/pegasus/src/once-promise-kit.js index 55a48b83f2c..dbfcb355eb0 100644 --- a/packages/pegasus/src/once-promise-kit.js +++ b/packages/pegasus/src/once-promise-kit.js @@ -5,7 +5,8 @@ import { makePromiseKit } from '@endo/promise-kit'; /** * Should be * at-import {DetailsToken} from '@endo/errors' - * but somehow @endo/errors is not exporting that type. TODO fix. + * but somehow @endo/errors is not exporting that type. + * See https://github.com/endojs/endo/issues/2339 * In the meantime... * * @typedef {{}} DetailsToken diff --git a/packages/smart-wallet/src/invitations.js b/packages/smart-wallet/src/invitations.js index 624b7575dec..75243d55b1f 100644 --- a/packages/smart-wallet/src/invitations.js +++ b/packages/smart-wallet/src/invitations.js @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; +import { E } from '@endo/far'; import { AmountMath } from '@agoric/ertp'; import { mustMatch } from '@agoric/store'; import { InvitationHandleShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/far'; -import { Fail } from '@endo/errors'; import { shape } from './typeGuards.js'; // A safety limit diff --git a/packages/smart-wallet/src/marshal-contexts.js b/packages/smart-wallet/src/marshal-contexts.js index b1ac80aa6b4..2c6442aff03 100644 --- a/packages/smart-wallet/src/marshal-contexts.js +++ b/packages/smart-wallet/src/marshal-contexts.js @@ -1,11 +1,11 @@ // @ts-check +import { Fail, q } from '@endo/errors'; +import { HandledPromise } from '@endo/eventual-send'; // TODO: convince tsc this isn't needed + import { makeScalarMapStore } from '@agoric/store'; import { Far, makeMarshal, Remotable } from '@endo/marshal'; -import { HandledPromise } from '@endo/eventual-send'; // TODO: convince tsc this isn't needed import { DEFAULT_PREFIX } from '@agoric/vats/src/lib-board.js'; -import { Fail, q } from '@endo/errors'; - /** * @import {PassableCap, RemotableObject} from '@endo/marshal'; * @import {Key} from '@endo/patterns'; diff --git a/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js b/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js index b0f4fa20e9d..7fd6db38760 100644 --- a/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js +++ b/packages/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js @@ -1,10 +1,9 @@ // @ts-check +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; import { allValues } from '@agoric/internal'; -import { Fail } from '@endo/errors'; - console.warn('upgrade-walletFactory-proposal.js module evaluating'); // vstorage paths under published.* diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js index 87ea2fddf85..6953189257e 100644 --- a/packages/smart-wallet/src/smartWallet.js +++ b/packages/smart-wallet/src/smartWallet.js @@ -1,3 +1,4 @@ +import { Fail, q } from '@endo/errors'; import { E } from '@endo/far'; import { AmountShape, @@ -37,7 +38,6 @@ import { PaymentPKeywordRecordShape, } from '@agoric/zoe/src/typeGuards.js'; -import { Fail, q } from '@endo/errors'; import { makeInvitationsHelper } from './invitations.js'; import { shape } from './typeGuards.js'; import { objectMapStoragePath } from './utils.js'; diff --git a/packages/smart-wallet/test/addAsset.test.js b/packages/smart-wallet/test/addAsset.test.js index b24ccd03dbb..4effbf96878 100644 --- a/packages/smart-wallet/test/addAsset.test.js +++ b/packages/smart-wallet/test/addAsset.test.js @@ -1,15 +1,16 @@ // @ts-check import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; + +import { Fail } from '@endo/errors'; import { E, Far } from '@endo/far'; -import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; -import { makeCopyBag } from '@agoric/store'; import { makePromiseKit } from '@endo/promise-kit'; import bundleSource from '@endo/bundle-source'; import { makeMarshal } from '@endo/marshal'; +import { AmountMath, makeIssuerKit } from '@agoric/ertp'; +import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; +import { makeCopyBag } from '@agoric/store'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import { makeFakeBankManagerKit } from '@agoric/vats/tools/bank-utils.js'; -import { Fail } from '@endo/errors'; import { makeDefaultTestContext } from './contexts.js'; import { ActionType, headValue, makeMockTestSpace } from './supports.js'; import { makeImportContext } from '../src/marshal-contexts.js'; diff --git a/packages/smart-wallet/test/gameAssetContract.js b/packages/smart-wallet/test/gameAssetContract.js index 9c693763608..356ec3f4236 100644 --- a/packages/smart-wallet/test/gameAssetContract.js +++ b/packages/smart-wallet/test/gameAssetContract.js @@ -1,13 +1,13 @@ /** @file illustrates using non-vbank assets */ // deep import to avoid dependency on all of ERTP, vat-data +import { Fail, q } from '@endo/errors'; +import { E, Far } from '@endo/far'; + import { AmountShape } from '@agoric/ertp/src/typeGuards.js'; import { AmountMath, AssetKind } from '@agoric/ertp/src/amountMath.js'; import { makeTracer } from '@agoric/internal'; import { M, getCopyBagEntries } from '@agoric/store'; -import { E, Far } from '@endo/far'; - -import { Fail, q } from '@endo/errors'; const trace = makeTracer('Game', true); diff --git a/packages/smart-wallet/test/start-game1-proposal.js b/packages/smart-wallet/test/start-game1-proposal.js index ce5f827c8c8..0cf619bf942 100644 --- a/packages/smart-wallet/test/start-game1-proposal.js +++ b/packages/smart-wallet/test/start-game1-proposal.js @@ -1,10 +1,9 @@ // @ts-check +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { makeMarshal } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp/src/amountMath.js'; -import { Fail } from '@endo/errors'; - console.warn('start-game1-proposal.js module evaluating'); // vstorage paths under published.* diff --git a/packages/solo/src/chain-cosmos-sdk.js b/packages/solo/src/chain-cosmos-sdk.js index 78703edb0ed..8b27bbaa2fb 100644 --- a/packages/solo/src/chain-cosmos-sdk.js +++ b/packages/solo/src/chain-cosmos-sdk.js @@ -8,10 +8,10 @@ import { open as tempOpen } from 'temp'; import WebSocket from 'ws'; import anylogger from 'anylogger'; -import { makeNotifierKit } from '@agoric/notifier'; +import { Fail, makeError } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail, makeError } from '@endo/errors'; +import { makeNotifierKit } from '@agoric/notifier'; import { DEFAULT_BATCH_TIMEOUT_MS, makeBatchedDeliver, diff --git a/packages/solo/src/pipe-entrypoint.js b/packages/solo/src/pipe-entrypoint.js index d724a9d852e..54266764b35 100644 --- a/packages/solo/src/pipe-entrypoint.js +++ b/packages/solo/src/pipe-entrypoint.js @@ -3,13 +3,13 @@ import '@endo/init/pre-bundle-source.js'; import '@endo/init/unsafe-fast.js'; -import { parse, stringify } from '@endo/marshal'; +import { makeError } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; +import { parse, stringify } from '@endo/marshal'; import '@agoric/cosmic-swingset/src/anylogger-agoric.js'; import { connectToFakeChain } from '@agoric/cosmic-swingset/src/sim-chain.js'; import { makeShutdown } from '@agoric/internal/src/node/shutdown.js'; -import { makeError } from '@endo/errors'; const { registerShutdown } = makeShutdown(false); registerShutdown(() => process.exit()); diff --git a/packages/solo/src/vat-http.js b/packages/solo/src/vat-http.js index 94d9a1ff872..6f6b2b93653 100644 --- a/packages/solo/src/vat-http.js +++ b/packages/solo/src/vat-http.js @@ -1,10 +1,11 @@ -import { makeNotifierKit } from '@agoric/notifier'; -import { makeCache } from '@agoric/cache'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; +import { makePromiseKit } from '@endo/promise-kit'; import { Far } from '@endo/marshal'; -import { Fail } from '@endo/errors'; + +import { makeNotifierKit } from '@agoric/notifier'; +import { makeCache } from '@agoric/cache'; import { getReplHandler } from '@agoric/vats/src/repl.js'; -import { makePromiseKit } from '@endo/promise-kit'; import { getCapTPHandler } from './captp.js'; // This vat contains the HTTP request handler. diff --git a/packages/spawner/src/contractHost.js b/packages/spawner/src/contractHost.js index 64c68de218f..84b6461d63f 100644 --- a/packages/spawner/src/contractHost.js +++ b/packages/spawner/src/contractHost.js @@ -1,7 +1,7 @@ // Copyright (C) 2019 Agoric, under Apache License 2.0 -import { E } from '@endo/eventual-send'; import { assert } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; // spawnBundle is built with 'yarn build' diff --git a/packages/spawner/test/swingsetTests/contractHost/bootstrap.js b/packages/spawner/test/swingsetTests/contractHost/bootstrap.js index 5aac91e8b9f..a4773a1e6d7 100644 --- a/packages/spawner/test/swingsetTests/contractHost/bootstrap.js +++ b/packages/spawner/test/swingsetTests/contractHost/bootstrap.js @@ -1,7 +1,7 @@ // Copyright (C) 2019 Agoric, under Apache License 2.0 -import { E } from '@endo/eventual-send'; import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; export function buildRootObject(vatPowers, vatParameters) { diff --git a/packages/store/src/stores/scalarMapStore.js b/packages/store/src/stores/scalarMapStore.js index ef78a934c10..2a9cf63cd18 100644 --- a/packages/store/src/stores/scalarMapStore.js +++ b/packages/store/src/stores/scalarMapStore.js @@ -1,3 +1,4 @@ +import { q } from '@endo/errors'; import { Far, assertPassable, @@ -12,7 +13,6 @@ import { mustMatch, assertPattern, } from '@endo/patterns'; -import { q } from '@endo/errors'; import { makeWeakMapStoreMethods } from './scalarWeakMapStore.js'; import { makeCurrentKeysKit } from './store-utils.js'; diff --git a/packages/store/src/stores/scalarSetStore.js b/packages/store/src/stores/scalarSetStore.js index 223f3a29b55..e49b4edf077 100644 --- a/packages/store/src/stores/scalarSetStore.js +++ b/packages/store/src/stores/scalarSetStore.js @@ -1,3 +1,4 @@ +import { q } from '@endo/errors'; import { Far, filterIterable } from '@endo/pass-style'; import { compareRank } from '@endo/marshal'; import { @@ -7,7 +8,6 @@ import { mustMatch, assertPattern, } from '@endo/patterns'; -import { q } from '@endo/errors'; import { makeWeakSetStoreMethods } from './scalarWeakSetStore.js'; import { makeCurrentKeysKit } from './store-utils.js'; diff --git a/packages/store/src/stores/scalarWeakMapStore.js b/packages/store/src/stores/scalarWeakMapStore.js index ccf7dc73a9f..3f9af270ace 100644 --- a/packages/store/src/stores/scalarWeakMapStore.js +++ b/packages/store/src/stores/scalarWeakMapStore.js @@ -1,3 +1,4 @@ +import { q, Fail } from '@endo/errors'; import { Far, assertPassable, passStyleOf } from '@endo/pass-style'; import { getCopyMapEntries, @@ -12,8 +13,6 @@ import { * @import {WeakMapStore, StoreOptions} from '../types.js'; */ -import { q, Fail } from '@endo/errors'; - /** * @template {Key} K * @template {Passable} V diff --git a/packages/store/src/stores/scalarWeakSetStore.js b/packages/store/src/stores/scalarWeakSetStore.js index ed0f6fa8bbd..bc06011279c 100644 --- a/packages/store/src/stores/scalarWeakSetStore.js +++ b/packages/store/src/stores/scalarWeakSetStore.js @@ -1,3 +1,4 @@ +import { q, Fail } from '@endo/errors'; import { Far, passStyleOf } from '@endo/pass-style'; import { getCopySetKeys, @@ -6,8 +7,6 @@ import { isCopySet, } from '@endo/patterns'; -import { q, Fail } from '@endo/errors'; - /** * @import {Key} from '@endo/patterns'; * @import {StoreOptions, WeakSetStore, WeakSetStoreMethods} from '@agoric/store'; diff --git a/packages/store/src/stores/store-utils.js b/packages/store/src/stores/store-utils.js index f7c10527f75..692c18a9323 100644 --- a/packages/store/src/stores/store-utils.js +++ b/packages/store/src/stores/store-utils.js @@ -1,3 +1,4 @@ +import { Fail, q } from '@endo/errors'; import { Far } from '@endo/marshal'; import { M, matches } from '@endo/patterns'; @@ -8,8 +9,6 @@ import { M, matches } from '@endo/patterns'; * @import {Key} from '@endo/patterns'; */ -import { Fail, q } from '@endo/errors'; - // TODO: Undate `@endo/patterns` to export the original, and delete the // reimplementation here. /** diff --git a/packages/swing-store/src/bundleStore.js b/packages/swing-store/src/bundleStore.js index 28f022cfdf6..ebabd352e59 100644 --- a/packages/swing-store/src/bundleStore.js +++ b/packages/swing-store/src/bundleStore.js @@ -2,10 +2,10 @@ import { createHash } from 'crypto'; import { Readable } from 'stream'; import { Buffer } from 'buffer'; +import { Fail, q } from '@endo/errors'; import { encodeBase64, decodeBase64 } from '@endo/base64'; import { checkBundle } from '@endo/check-bundle/lite.js'; import { Nat } from '@endo/nat'; -import { Fail, q } from '@endo/errors'; import { createSHA256 } from './hasher.js'; /** diff --git a/packages/swingset-runner/src/chain.js b/packages/swingset-runner/src/chain.js index f8860b8d159..888dba5a84a 100644 --- a/packages/swingset-runner/src/chain.js +++ b/packages/swingset-runner/src/chain.js @@ -1,11 +1,10 @@ +import { Fail, q } from '@endo/errors'; import { buildBridge } from '@agoric/swingset-vat'; import { BridgeId, VBankAccount } from '@agoric/internal'; import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js'; import * as STORAGE_PATH from '@agoric/internal/src/chain-storage-paths.js'; import { extractCoreProposalBundles } from '@agoric/deploy-script-support/src/extract-proposal.js'; -import { Fail, q } from '@endo/errors'; - /** * Export any specified storage subtrees, then delete the ones marked to clear. * From 0f2ea4dafd84e31926fc4ea0d7bdc405123c9b49 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 18:38:28 -0700 Subject: [PATCH 24/25] fixup! layered import order --- .../src/vats/vat-admin/vat-vat-admin.js | 5 ++--- packages/SwingSet/tools/manual-timer.js | 2 +- packages/swingset-liveslots/src/liveslots.js | 2 +- .../test/handled-promises.test.js | 2 +- .../swingset-liveslots/test/liveslots.test.js | 2 +- .../test/vpid-liveslots.test.js | 2 +- .../tools/fakeVirtualSupport.js | 2 +- .../demo/vatStore2/bootstrap.js | 2 +- .../demo/vaultPerfTest/vat-benchmark.js | 2 +- .../swingset-runner/demo/zoeTests/vat-bob.js | 2 +- .../demo/zoeTests/vat-carol.js | 2 +- .../swingset-runner/demo/zoeTests/vat-dave.js | 2 +- packages/telemetry/src/slog-to-otel.js | 2 +- packages/time/src/timeMath.js | 2 +- packages/vats/src/bridge-target.js | 2 +- packages/vats/src/bridge.js | 3 +-- packages/vats/src/core/basic-behaviors.js | 8 +++---- packages/vats/src/core/chain-behaviors.js | 11 +++++----- packages/vats/src/core/client-behaviors.js | 2 +- packages/vats/src/core/demoIssuers.js | 8 +++---- packages/vats/src/core/lib-boot.js | 2 +- packages/vats/src/priceAuthorityRegistry.js | 8 +++---- packages/vats/src/transfer.js | 2 +- packages/vats/src/vat-bank.js | 7 +++--- packages/vats/src/virtual-purse.js | 8 +++---- packages/vats/tools/boot-test-utils.js | 5 +++-- packages/wallet/api/deploy.js | 2 +- packages/wallet/api/src/lib-dehydrate.js | 2 +- packages/wallet/api/test/lib-wallet.test.js | 9 ++++---- packages/xsnap/src/xsnap.js | 22 +++++++++---------- .../zoe/src/contractFacet/allocationMath.js | 3 +-- packages/zoe/src/contractFacet/exit.js | 2 +- packages/zoe/src/contractFacet/reallocate.js | 2 +- 33 files changed, 68 insertions(+), 71 deletions(-) diff --git a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js index e58b8e1002a..058692f036a 100644 --- a/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js +++ b/packages/SwingSet/src/vats/vat-admin/vat-vat-admin.js @@ -5,10 +5,11 @@ * must ensure that only data goes in and out. It's also responsible for turning * device affordances into objects that can be used by code in other vats. */ +import { Nat, isNat } from '@endo/nat'; +import { q, Fail } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; // import { makeNotifierKit } from '@agoric/notifier'; // XXX RESTORE import { Far, E, passStyleOf } from '@endo/far'; -import { Nat, isNat } from '@endo/nat'; import { provide, makeScalarBigMapStore, @@ -17,8 +18,6 @@ import { prepareSingleton, } from '@agoric/vat-data'; -import { q, Fail } from '@endo/errors'; - const managerTypes = ['local', 'node-subprocess', 'xsnap', 'xs-worker']; // xs-worker is alias function producePRR() { diff --git a/packages/SwingSet/tools/manual-timer.js b/packages/SwingSet/tools/manual-timer.js index 4a618ab41db..6eb7a62bad1 100644 --- a/packages/SwingSet/tools/manual-timer.js +++ b/packages/SwingSet/tools/manual-timer.js @@ -1,5 +1,5 @@ -import { Far } from '@endo/far'; import { Fail } from '@endo/errors'; +import { Far } from '@endo/far'; import { makeScalarMapStore } from '@agoric/store'; import { bindAllMethods } from '@agoric/internal'; import { TimeMath } from '@agoric/time'; diff --git a/packages/swingset-liveslots/src/liveslots.js b/packages/swingset-liveslots/src/liveslots.js index a2baffd5026..7246f41f2d8 100644 --- a/packages/swingset-liveslots/src/liveslots.js +++ b/packages/swingset-liveslots/src/liveslots.js @@ -1,10 +1,10 @@ +import { annotateError, assert, Fail, makeError, X } from '@endo/errors'; import { Remotable, passStyleOf, getInterfaceOf, makeMarshal, } from '@endo/marshal'; -import { annotateError, assert, Fail, makeError, X } from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; import { E, HandledPromise } from '@endo/eventual-send'; import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js'; diff --git a/packages/swingset-liveslots/test/handled-promises.test.js b/packages/swingset-liveslots/test/handled-promises.test.js index 3fcbe0d1630..be97ea4219b 100644 --- a/packages/swingset-liveslots/test/handled-promises.test.js +++ b/packages/swingset-liveslots/test/handled-promises.test.js @@ -1,7 +1,7 @@ import test from 'ava'; -import { Far } from '@endo/marshal'; import { Fail } from '@endo/errors'; +import { Far } from '@endo/marshal'; import { M, provideLazy as provide } from '@agoric/store'; import { makePromiseKit } from '@endo/promise-kit'; // Disabled to avoid circular dependencies. diff --git a/packages/swingset-liveslots/test/liveslots.test.js b/packages/swingset-liveslots/test/liveslots.test.js index 2ebfaafe951..24eeed6182f 100644 --- a/packages/swingset-liveslots/test/liveslots.test.js +++ b/packages/swingset-liveslots/test/liveslots.test.js @@ -1,10 +1,10 @@ // @ts-nocheck import test from 'ava'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; -import { Fail } from '@endo/errors'; import { kslot, kser, kunser } from '@agoric/kmarshal'; import { M } from '@agoric/store'; import { makeLiveSlots, makeMarshaller } from '../src/liveslots.js'; diff --git a/packages/swingset-liveslots/test/vpid-liveslots.test.js b/packages/swingset-liveslots/test/vpid-liveslots.test.js index 93b82be7b41..2aa0f5d6275 100644 --- a/packages/swingset-liveslots/test/vpid-liveslots.test.js +++ b/packages/swingset-liveslots/test/vpid-liveslots.test.js @@ -1,10 +1,10 @@ // @ts-nocheck import test from 'ava'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { Far } from '@endo/marshal'; -import { Fail } from '@endo/errors'; import { kser, kslot } from '@agoric/kmarshal'; import { buildSyscall, makeDispatch } from './liveslots-helpers.js'; import { makeMessage, makeResolve, makeReject } from './util.js'; diff --git a/packages/swingset-liveslots/tools/fakeVirtualSupport.js b/packages/swingset-liveslots/tools/fakeVirtualSupport.js index fdfa8a59ff0..9a4658c0163 100644 --- a/packages/swingset-liveslots/tools/fakeVirtualSupport.js +++ b/packages/swingset-liveslots/tools/fakeVirtualSupport.js @@ -1,7 +1,7 @@ /* global globalThis */ /* eslint-disable max-classes-per-file */ -import { makeMarshal } from '@endo/marshal'; import { assert, Fail } from '@endo/errors'; +import { makeMarshal } from '@endo/marshal'; import { isPromise } from '@endo/promise-kit'; import { parseVatSlot } from '../src/parseVatSlots.js'; diff --git a/packages/swingset-runner/demo/vatStore2/bootstrap.js b/packages/swingset-runner/demo/vatStore2/bootstrap.js index a8d600d4016..8c86e3e2459 100644 --- a/packages/swingset-runner/demo/vatStore2/bootstrap.js +++ b/packages/swingset-runner/demo/vatStore2/bootstrap.js @@ -1,6 +1,6 @@ +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail } from '@endo/errors'; import { makeXorShift128 } from './xorshift128.js'; const p = console.log; diff --git a/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js b/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js index 46fbe3c6771..8a211a30f05 100644 --- a/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js +++ b/packages/swingset-runner/demo/vaultPerfTest/vat-benchmark.js @@ -10,9 +10,9 @@ // vat-benchmark.js driver and the JSON config file (and possibly the runner // itself, if it's not on your $PATH) accordingly. +import { assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert } from '@endo/errors'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-bob.js b/packages/swingset-runner/demo/zoeTests/vat-bob.js index 208cd671f61..2291af8de87 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-bob.js +++ b/packages/swingset-runner/demo/zoeTests/vat-bob.js @@ -1,6 +1,6 @@ +import { assert, X, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-carol.js b/packages/swingset-runner/demo/zoeTests/vat-carol.js index 4e3a2d4dc9e..bf4e22f5430 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-carol.js +++ b/packages/swingset-runner/demo/zoeTests/vat-carol.js @@ -1,6 +1,6 @@ +import { assert, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { showPurseBalance, setupIssuers } from './helpers.js'; diff --git a/packages/swingset-runner/demo/zoeTests/vat-dave.js b/packages/swingset-runner/demo/zoeTests/vat-dave.js index 992ebd928e1..28a80c0a9e8 100644 --- a/packages/swingset-runner/demo/zoeTests/vat-dave.js +++ b/packages/swingset-runner/demo/zoeTests/vat-dave.js @@ -1,6 +1,6 @@ +import { assert, X, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/telemetry/src/slog-to-otel.js b/packages/telemetry/src/slog-to-otel.js index 51b76bd0b8a..d4b4abc4a44 100644 --- a/packages/telemetry/src/slog-to-otel.js +++ b/packages/telemetry/src/slog-to-otel.js @@ -1,7 +1,7 @@ import otel, { SpanStatusCode } from '@opentelemetry/api'; -import { makeMarshal, Remotable } from '@endo/marshal'; import { Fail, q } from '@endo/errors'; +import { makeMarshal, Remotable } from '@endo/marshal'; import { makeLegacyMap } from '@agoric/store'; import { diff --git a/packages/time/src/timeMath.js b/packages/time/src/timeMath.js index e7769d2f1be..925eb59cc04 100644 --- a/packages/time/src/timeMath.js +++ b/packages/time/src/timeMath.js @@ -1,6 +1,6 @@ import { Nat } from '@endo/nat'; -import { mustMatch } from '@endo/patterns'; import { Fail, q } from '@endo/errors'; +import { mustMatch } from '@endo/patterns'; import { RelativeTimeRecordShape, TimestampRecordShape } from './typeGuards.js'; /** @import {RelativeTime, RelativeTimeValue, TimerBrand, TimeMathType, Timestamp, TimestampRecord, TimestampValue} from './types.js' */ diff --git a/packages/vats/src/bridge-target.js b/packages/vats/src/bridge-target.js index a4d0cb27c97..626d9f5e22e 100644 --- a/packages/vats/src/bridge-target.js +++ b/packages/vats/src/bridge-target.js @@ -1,7 +1,7 @@ +import { X, Fail, makeError } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; -import { X, Fail, makeError } from '@endo/errors'; import { BridgeHandlerI } from './bridge.js'; /** diff --git a/packages/vats/src/bridge.js b/packages/vats/src/bridge.js index 95b871a7b30..1da85fc9c57 100644 --- a/packages/vats/src/bridge.js +++ b/packages/vats/src/bridge.js @@ -1,8 +1,7 @@ +import { Fail, X } from '@endo/errors'; import { M } from '@agoric/store'; import { E } from '@endo/far'; -import { Fail, X } from '@endo/errors'; - /** * Helper to type the registered scoped bridge correctly. * diff --git a/packages/vats/src/core/basic-behaviors.js b/packages/vats/src/core/basic-behaviors.js index d28d08c35e6..4bbbdf69ad9 100644 --- a/packages/vats/src/core/basic-behaviors.js +++ b/packages/vats/src/core/basic-behaviors.js @@ -1,3 +1,7 @@ +import { Nat } from '@endo/nat'; +import { Fail, X } from '@endo/errors'; +import { E, getInterfaceOf } from '@endo/far'; + import { AssetKind } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { Stable, Stake } from '@agoric/internal/src/tokens.js'; @@ -10,10 +14,6 @@ import { } from '@agoric/internal'; import { keyEQ, makeScalarMapStore } from '@agoric/store'; import { provideLazy } from '@agoric/store/src/stores/store-utils.js'; -import { E, getInterfaceOf } from '@endo/far'; -import { Nat } from '@endo/nat'; - -import { Fail, X } from '@endo/errors'; import { makeNameHubKit } from '../nameHub.js'; import { PowerFlags } from '../walletFlags.js'; import { feeIssuerConfig, makeMyAddressNameAdminKit } from './utils.js'; diff --git a/packages/vats/src/core/chain-behaviors.js b/packages/vats/src/core/chain-behaviors.js index 9193099610a..b8b14c01c11 100644 --- a/packages/vats/src/core/chain-behaviors.js +++ b/packages/vats/src/core/chain-behaviors.js @@ -1,4 +1,10 @@ /* global globalThis */ +import { Fail } from '@endo/errors'; +import * as farExports from '@endo/far'; +import { E, Far } from '@endo/far'; +import { importBundle } from '@endo/import-bundle'; +import { makePromiseKit } from '@endo/promise-kit'; + import { allValues, BridgeId as BRIDGE_ID } from '@agoric/internal'; import * as STORAGE_PATH from '@agoric/internal/src/chain-storage-paths.js'; import { makePrioritySendersManager } from '@agoric/internal/src/priority-senders.js'; @@ -9,11 +15,6 @@ import { } from '@agoric/notifier'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { prepareRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js'; -import * as farExports from '@endo/far'; -import { E, Far } from '@endo/far'; -import { importBundle } from '@endo/import-bundle'; -import { makePromiseKit } from '@endo/promise-kit'; -import { Fail } from '@endo/errors'; import { PowerFlags } from '../walletFlags.js'; import { BASIC_BOOTSTRAP_PERMITS } from './basic-behaviors.js'; import { agoricNamesReserved, callProperties, extractPowers } from './utils.js'; diff --git a/packages/vats/src/core/client-behaviors.js b/packages/vats/src/core/client-behaviors.js index f937257fb34..5fae7cfced0 100644 --- a/packages/vats/src/core/client-behaviors.js +++ b/packages/vats/src/core/client-behaviors.js @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; import { E, Far } from '@endo/far'; import { makePluginManager } from '@agoric/swingset-vat/src/vats/plugin-manager.js'; import { observeNotifier } from '@agoric/notifier'; import { deeplyFulfilledObject } from '@agoric/internal'; -import { Fail } from '@endo/errors'; import { registerNetworkProtocols } from '../proposals/network-proposal.js'; import { makeVatsFromBundles } from './basic-behaviors.js'; diff --git a/packages/vats/src/core/demoIssuers.js b/packages/vats/src/core/demoIssuers.js index 23517b5660d..c48a8890969 100644 --- a/packages/vats/src/core/demoIssuers.js +++ b/packages/vats/src/core/demoIssuers.js @@ -1,16 +1,16 @@ +import { Fail, q } from '@endo/errors'; +import { Nat } from '@endo/nat'; +import { E, Far } from '@endo/far'; + import { AmountMath, AssetKind } from '@agoric/ertp'; import { split, splitMany } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { makeRatio, natSafeMath, } from '@agoric/zoe/src/contractSupport/index.js'; -import { E, Far } from '@endo/far'; -import { Nat } from '@endo/nat'; import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js'; import { Stake, Stable } from '@agoric/internal/src/tokens.js'; -import { Fail, q } from '@endo/errors'; - const { multiply, floorDivide } = natSafeMath; const { entries, fromEntries, keys, values } = Object; diff --git a/packages/vats/src/core/lib-boot.js b/packages/vats/src/core/lib-boot.js index 104d879fe21..5cf6771eb8d 100644 --- a/packages/vats/src/core/lib-boot.js +++ b/packages/vats/src/core/lib-boot.js @@ -1,6 +1,6 @@ +import { Fail, q } from '@endo/errors'; import { E, Far } from '@endo/far'; import { makeHeapZone } from '@agoric/zone'; -import { Fail, q } from '@endo/errors'; import { makeVatSpace, makeWellKnownSpaces, diff --git a/packages/vats/src/priceAuthorityRegistry.js b/packages/vats/src/priceAuthorityRegistry.js index 52ae22b0862..a6ebab20258 100644 --- a/packages/vats/src/priceAuthorityRegistry.js +++ b/packages/vats/src/priceAuthorityRegistry.js @@ -1,3 +1,7 @@ +import { Fail } from '@endo/errors'; +import { E } from '@endo/far'; +import { Far } from '@endo/marshal'; + import { BrandShape } from '@agoric/ertp'; import { M, @@ -6,8 +10,6 @@ import { provideDurableMapStore, } from '@agoric/vat-data'; import { provideLazy } from '@agoric/store'; -import { E } from '@endo/far'; -import { Far } from '@endo/marshal'; import { PriceAuthorityI } from '@agoric/zoe/src/contractSupport/priceAuthority.js'; /** @@ -15,8 +17,6 @@ import { PriceAuthorityI } from '@agoric/zoe/src/contractSupport/priceAuthority. * @import {MutableQuote, PriceAuthority, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -import { Fail } from '@endo/errors'; - /** * @typedef {object} Deleter * @property {() => void} delete diff --git a/packages/vats/src/transfer.js b/packages/vats/src/transfer.js index ea3782bc79d..5df07f7aadc 100644 --- a/packages/vats/src/transfer.js +++ b/packages/vats/src/transfer.js @@ -1,9 +1,9 @@ // @ts-check +import { Fail, b } from '@endo/errors'; import { E } from '@endo/far'; import { M } from '@endo/patterns'; import { VTRANSFER_IBC_EVENT } from '@agoric/internal'; import { coerceToByteSource, byteSourceToBase64 } from '@agoric/network'; -import { Fail, b } from '@endo/errors'; import { TargetAppI, AppTransformerI } from './bridge-target.js'; /** diff --git a/packages/vats/src/vat-bank.js b/packages/vats/src/vat-bank.js index d6dc1d0eb47..63630a20874 100644 --- a/packages/vats/src/vat-bank.js +++ b/packages/vats/src/vat-bank.js @@ -1,3 +1,7 @@ +import { Fail } from '@endo/errors'; +import { E, Far } from '@endo/far'; +import { M, getInterfaceGuardPayload } from '@endo/patterns'; + import { AmountMath, AssetKind, BrandShape } from '@agoric/ertp'; import { deeplyFulfilledObject } from '@agoric/internal'; import { prepareGuardedAttenuator } from '@agoric/internal/src/callback.js'; @@ -8,12 +12,9 @@ import { prepareDurablePublishKit, subscribeEach, } from '@agoric/notifier'; -import { M, getInterfaceGuardPayload } from '@endo/patterns'; import { provideLazy } from '@agoric/store'; import { makeDurableZone } from '@agoric/zone/durable.js'; -import { E, Far } from '@endo/far'; import { makeAtomicProvider } from '@agoric/store/src/stores/store-utils.js'; -import { Fail } from '@endo/errors'; import { BridgeHandlerI, BridgeScopedManagerI } from './bridge.js'; import { makeVirtualPurseKitIKit, diff --git a/packages/vats/src/virtual-purse.js b/packages/vats/src/virtual-purse.js index 1d23dd278a4..68addb78ceb 100644 --- a/packages/vats/src/virtual-purse.js +++ b/packages/vats/src/virtual-purse.js @@ -1,7 +1,9 @@ -import { M } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { E } from '@endo/far'; import { isPromise } from '@endo/promise-kit'; +import { getInterfaceGuardPayload } from '@endo/patterns'; +import { M } from '@agoric/store'; import { AmountShape, BrandShape, @@ -10,10 +12,6 @@ import { PaymentShape, } from '@agoric/ertp/src/typeGuards.js'; -import { getInterfaceGuardPayload } from '@endo/patterns'; - -import { Fail } from '@endo/errors'; - /** * @param {Pattern} [brandShape] * @param {Pattern} [amountShape] diff --git a/packages/vats/tools/boot-test-utils.js b/packages/vats/tools/boot-test-utils.js index d838f65744f..cb8fc7b9cf6 100644 --- a/packages/vats/tools/boot-test-utils.js +++ b/packages/vats/tools/boot-test-utils.js @@ -1,11 +1,12 @@ +import { Fail } from '@endo/errors'; +import { Far } from '@endo/marshal'; + import { makeFakeVatAdmin, zcfBundleCap, } from '@agoric/zoe/tools/fakeVatAdmin.js'; import { buildZoeManualTimer } from '@agoric/zoe/tools/manualTimer.js'; -import { Far } from '@endo/marshal'; import { makeScalarBigMapStore } from '@agoric/vat-data'; -import { Fail } from '@endo/errors'; import { bundles, devices } from '../test/devices.js'; import { buildRootObject as agoricNamesRoot } from '../src/vat-agoricNames.js'; diff --git a/packages/wallet/api/deploy.js b/packages/wallet/api/deploy.js index 0534c8cfac1..deb72b241c7 100644 --- a/packages/wallet/api/deploy.js +++ b/packages/wallet/api/deploy.js @@ -2,8 +2,8 @@ // Agoric wallet deployment script. // FIXME: This is just hacked together for the legacy wallet. -import { E } from '@endo/eventual-send'; import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import path from 'path'; const dirname = path.dirname(new URL(import.meta.url).pathname); diff --git a/packages/wallet/api/src/lib-dehydrate.js b/packages/wallet/api/src/lib-dehydrate.js index 63c82729547..5f96148f1a2 100644 --- a/packages/wallet/api/src/lib-dehydrate.js +++ b/packages/wallet/api/src/lib-dehydrate.js @@ -1,8 +1,8 @@ // @ts-check +import { assert, Fail, q } from '@endo/errors'; import { makeMarshal, mapIterable } from '@endo/marshal'; import { makeLegacyMap, makeScalarMapStore } from '@agoric/store'; -import { assert, Fail, q } from '@endo/errors'; /** * @typedef {string[]} Path diff --git a/packages/wallet/api/test/lib-wallet.test.js b/packages/wallet/api/test/lib-wallet.test.js index 087cbd09e52..99d00560268 100644 --- a/packages/wallet/api/test/lib-wallet.test.js +++ b/packages/wallet/api/test/lib-wallet.test.js @@ -1,16 +1,15 @@ // @ts-check import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { assert } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import bundleSource from '@endo/bundle-source'; -import { makeCache } from '@agoric/cache'; -import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp'; import { M } from '@agoric/store'; - +import { makeCache } from '@agoric/cache'; +import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp'; import { makeZoeForTest } from '@agoric/zoe/tools/setup-zoe.js'; -import { E } from '@endo/eventual-send'; -import { assert } from '@endo/errors'; import { makeFakeBoard } from '@agoric/vats/tools/board-utils.js'; import { makeNameHubKit, diff --git a/packages/xsnap/src/xsnap.js b/packages/xsnap/src/xsnap.js index 9fbe590caac..a0fe1baa5b2 100644 --- a/packages/xsnap/src/xsnap.js +++ b/packages/xsnap/src/xsnap.js @@ -1,27 +1,27 @@ /* global process */ /* eslint no-await-in-loop: ["off"] */ -/** - * @typedef {typeof import('child_process').spawn} Spawn - * @import {Writable} from 'stream' - */ - -/** - * @template T - * @typedef {import('./defer.js').Deferred} Deferred - */ - import { finished } from 'stream/promises'; import { PassThrough, Readable } from 'stream'; import { promisify } from 'util'; +import { Fail, q } from '@endo/errors'; import { makeNetstringReader, makeNetstringWriter } from '@endo/netstring'; import { makeNodeReader, makeNodeWriter } from '@endo/stream-node'; import { makePromiseKit, racePromises } from '@endo/promise-kit'; import { forever } from '@agoric/internal'; -import { Fail, q } from '@endo/errors'; import { ErrorCode, ErrorSignal, ErrorMessage, METER_TYPE } from '../api.js'; import { defer } from './defer.js'; +/** + * @typedef {typeof import('child_process').spawn} Spawn + * @import {Writable} from 'stream' + */ + +/** + * @template T + * @typedef {import('./defer.js').Deferred} Deferred + */ + // This will need adjustment, but seems to be fine for a start. export const DEFAULT_CRANK_METERING_LIMIT = 1e8; diff --git a/packages/zoe/src/contractFacet/allocationMath.js b/packages/zoe/src/contractFacet/allocationMath.js index c72f43baed2..47a74bda32e 100644 --- a/packages/zoe/src/contractFacet/allocationMath.js +++ b/packages/zoe/src/contractFacet/allocationMath.js @@ -1,6 +1,5 @@ -import { AmountMath } from '@agoric/ertp'; - import { Fail, q } from '@endo/errors'; +import { AmountMath } from '@agoric/ertp'; /** * @callback Operation diff --git a/packages/zoe/src/contractFacet/exit.js b/packages/zoe/src/contractFacet/exit.js index 8ca0593aba1..3dcb79f9936 100644 --- a/packages/zoe/src/contractFacet/exit.js +++ b/packages/zoe/src/contractFacet/exit.js @@ -1,9 +1,9 @@ +import { Fail, q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { prepareExoClass, provideDurableSetStore } from '@agoric/vat-data'; import { M, initEmpty } from '@agoric/store'; import { TimestampShape } from '@agoric/time'; -import { Fail, q } from '@endo/errors'; import { isOnDemandExitRule, isAfterDeadlineExitRule, diff --git a/packages/zoe/src/contractFacet/reallocate.js b/packages/zoe/src/contractFacet/reallocate.js index 3fc46e1f9c6..997a9e996e5 100644 --- a/packages/zoe/src/contractFacet/reallocate.js +++ b/packages/zoe/src/contractFacet/reallocate.js @@ -1,6 +1,6 @@ +import { Fail } from '@endo/errors'; import { makeScalarMapStore } from '@agoric/vat-data'; -import { Fail } from '@endo/errors'; import { assertRightsConserved } from './rightsConservation.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; From e1b7b9684b2173d7e778887db0c1efdbcef7e1b2 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Mon, 1 Jul 2024 21:21:46 -0700 Subject: [PATCH 25/25] fixup! layered import order --- packages/zoe/README.md | 5 ++--- packages/zoe/src/contractFacet/rightsConservation.js | 2 +- packages/zoe/src/contractFacet/vatRoot.js | 2 +- packages/zoe/src/contractFacet/zcfMint.js | 4 ++-- packages/zoe/src/contractFacet/zcfSeat.js | 4 ++-- packages/zoe/src/contractFacet/zcfZygote.js | 11 ++++++----- packages/zoe/src/contractSupport/priceAuthority.js | 4 ++-- .../src/contractSupport/priceAuthorityTransform.js | 2 +- packages/zoe/src/contractSupport/priceQuote.js | 5 ++--- packages/zoe/src/contractSupport/zoeHelpers.js | 4 ++-- packages/zoe/src/contracts/auction/index.js | 2 +- packages/zoe/src/contracts/autoswap.js | 2 +- .../zoe/src/contracts/callSpread/calculateShares.js | 2 +- .../zoe/src/contracts/callSpread/pricedCallSpread.js | 2 +- packages/zoe/src/contracts/coveredCall-durable.js | 2 +- packages/zoe/src/contracts/coveredCall.js | 2 +- packages/zoe/src/contracts/loan/updateDebt.js | 2 +- packages/zoe/src/contracts/mintAndSellNFT.js | 2 +- packages/zoe/src/contracts/otcDesk.js | 2 +- packages/zoe/src/contracts/sellItems.js | 2 +- packages/zoe/src/instanceRecordStorage.js | 2 +- packages/zoe/src/issuerStorage.js | 4 ++-- .../test/swingsetTests/brokenContracts/vat-alice.js | 2 +- .../bootstrap-coveredCall-service-upgrade.js | 2 +- .../upgradeCoveredCall/coveredCall-durable-V3.js | 3 +-- packages/zoe/test/swingsetTests/zoe/vat-alice.js | 2 +- packages/zoe/test/swingsetTests/zoe/vat-bob.js | 2 +- packages/zoe/test/swingsetTests/zoe/vat-carol.js | 2 +- packages/zoe/test/swingsetTests/zoe/vat-dave.js | 2 +- packages/zoe/test/unitTests/bounty.js | 2 +- packages/zoe/test/unitTests/contracts/escrowToVote.js | 2 +- packages/zoe/test/unitTests/contracts/oracle.test.js | 6 +++--- .../zoe/test/unitTests/contracts/useObjExample.js | 2 +- .../zoe/test/unitTests/fakePriceAuthority.test.js | 2 +- packages/zoe/test/unitTests/makeOffer.js | 2 +- packages/zoe/test/unitTests/scriptedOracle.test.js | 2 +- packages/zoe/test/unitTests/zcf/setupZcfTest.js | 2 +- packages/zoe/test/zoeTestHelpers.js | 3 +-- packages/zoe/tools/fakePriceAuthority.js | 9 +++++---- packages/zoe/tools/manualTimer.js | 3 +-- packages/zone/src/durable.js | 4 ++-- 41 files changed, 60 insertions(+), 63 deletions(-) diff --git a/packages/zoe/README.md b/packages/zoe/README.md index 80c5f229adf..934e9b5f143 100644 --- a/packages/zoe/README.md +++ b/packages/zoe/README.md @@ -77,10 +77,9 @@ The new bundle must export a `prepare` function in place of `start`. This is cal For example, suppose v1 code of a simple single-increment-counter contract anticipated extension of exported functionality and decided to track it by means of "codeVersion" data in baggage. v2 code could add multi-increment behavior like so: ```js -import { M } from '@agoric/store'; -import { prepareExo, prepareExoClass } from '@agoric/vat-data'; - import { q, Fail } from '@endo/errors'; +import { M } from '@endo/patterns'; +import { prepareExo, prepareExoClass } from '@agoric/vat-data'; export const start = async (zcf, _privateArgs, instanceBaggage) => { const CODE_VERSION = 2; diff --git a/packages/zoe/src/contractFacet/rightsConservation.js b/packages/zoe/src/contractFacet/rightsConservation.js index 34bd80126f8..8ab027b9123 100644 --- a/packages/zoe/src/contractFacet/rightsConservation.js +++ b/packages/zoe/src/contractFacet/rightsConservation.js @@ -1,5 +1,5 @@ -import { makeScalarMapStore } from '@agoric/store'; import { assert, Fail } from '@endo/errors'; +import { makeScalarMapStore } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; import '../internal-types.js'; diff --git a/packages/zoe/src/contractFacet/vatRoot.js b/packages/zoe/src/contractFacet/vatRoot.js index e1f179e305c..00404e0c003 100644 --- a/packages/zoe/src/contractFacet/vatRoot.js +++ b/packages/zoe/src/contractFacet/vatRoot.js @@ -7,12 +7,12 @@ // time this file is edited, the bundle must be manually rebuilt with // `yarn build-zcfBundle`. +import { Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; import { E } from '@endo/far'; import '../internal-types.js'; -import { Fail } from '@endo/errors'; import { makeZCFZygote } from './zcfZygote.js'; /** diff --git a/packages/zoe/src/contractFacet/zcfMint.js b/packages/zoe/src/contractFacet/zcfMint.js index 431848927d1..085747285cf 100644 --- a/packages/zoe/src/contractFacet/zcfMint.js +++ b/packages/zoe/src/contractFacet/zcfMint.js @@ -1,9 +1,9 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { prepareExoClass } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; -import { Fail } from '@endo/errors'; import { coerceAmountKeywordRecord } from '../cleanProposal.js'; import { assertFullIssuerRecord, makeIssuerRecord } from '../issuerRecord.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; diff --git a/packages/zoe/src/contractFacet/zcfSeat.js b/packages/zoe/src/contractFacet/zcfSeat.js index 237094dac55..d46fb583420 100644 --- a/packages/zoe/src/contractFacet/zcfSeat.js +++ b/packages/zoe/src/contractFacet/zcfSeat.js @@ -1,4 +1,6 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { annotateError, Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { makeScalarBigWeakMapStore, prepareExoClass, @@ -7,11 +9,9 @@ import { provideDurableMapStore, provideDurableWeakMapStore, } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { initEmpty, M } from '@agoric/store'; -import { annotateError, Fail } from '@endo/errors'; import { isOfferSafe } from './offerSafety.js'; import { assertRightsConserved } from './rightsConservation.js'; import { addToAllocation, subtractFromAllocation } from './allocationMath.js'; diff --git a/packages/zoe/src/contractFacet/zcfZygote.js b/packages/zoe/src/contractFacet/zcfZygote.js index 65f0bd8846a..b044f311ee7 100644 --- a/packages/zoe/src/contractFacet/zcfZygote.js +++ b/packages/zoe/src/contractFacet/zcfZygote.js @@ -1,4 +1,9 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { passStyleOf } from '@endo/pass-style'; +import { makePromiseKit } from '@endo/promise-kit'; + import { AssetKind } from '@agoric/ertp'; import { assertPattern, mustMatch } from '@agoric/store'; import { @@ -9,12 +14,8 @@ import { prepareExoClass, provideDurableMapStore, } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; -import { passStyleOf } from '@endo/pass-style'; -import { makePromiseKit } from '@endo/promise-kit'; - import { objectMap } from '@agoric/internal'; -import { Fail } from '@endo/errors'; + import { cleanProposal } from '../cleanProposal.js'; import { handlePKitWarning } from '../handleWarning.js'; import { makeInstanceRecordStorage } from '../instanceRecordStorage.js'; diff --git a/packages/zoe/src/contractSupport/priceAuthority.js b/packages/zoe/src/contractSupport/priceAuthority.js index a3b9564b715..ae88e854ab0 100644 --- a/packages/zoe/src/contractSupport/priceAuthority.js +++ b/packages/zoe/src/contractSupport/priceAuthority.js @@ -1,7 +1,9 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { q, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; + import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp'; import { makeNotifier } from '@agoric/notifier'; import { makeTracer } from '@agoric/internal'; @@ -12,8 +14,6 @@ import { M } from '@agoric/store'; * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery, PriceQuoteCreate, PriceAuthorityKit, PriceQuoteTrigger, MutableQuote,} from '@agoric/zoe/tools/types.js'; */ -import { q, Fail } from '@endo/errors'; - const trace = makeTracer('PA', false); /** diff --git a/packages/zoe/src/contractSupport/priceAuthorityTransform.js b/packages/zoe/src/contractSupport/priceAuthorityTransform.js index 46efd7e202f..ce2d79217b9 100644 --- a/packages/zoe/src/contractSupport/priceAuthorityTransform.js +++ b/packages/zoe/src/contractSupport/priceAuthorityTransform.js @@ -1,6 +1,6 @@ +import { Fail, assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { Fail, assert } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { makeNotifier } from '@agoric/notifier'; diff --git a/packages/zoe/src/contractSupport/priceQuote.js b/packages/zoe/src/contractSupport/priceQuote.js index 04ea2074ffc..33d18db434e 100644 --- a/packages/zoe/src/contractSupport/priceQuote.js +++ b/packages/zoe/src/contractSupport/priceQuote.js @@ -1,15 +1,14 @@ // @jessie-check -import { AmountMath } from '@agoric/ertp'; +import { Fail } from '@endo/errors'; import { Nat } from '@endo/nat'; import { E } from '@endo/eventual-send'; +import { AmountMath } from '@agoric/ertp'; /** * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js'; */ -import { Fail } from '@endo/errors'; - // PriceAuthorities return quotes as a pair of an amount and a payment, both // with the same value. The underlying amount wraps amountIn, amountOut, timer // and timestamp. The payment is issued by the quoteIssuer to support veracity diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index c46fa082144..b206f0b53ed 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -1,10 +1,10 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ -import { mustMatch, keyEQ } from '@agoric/store'; +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; +import { mustMatch, keyEQ } from '@agoric/store'; import { AssetKind } from '@agoric/ertp'; import { fromUniqueEntries } from '@agoric/internal'; -import { Fail } from '@endo/errors'; import { satisfiesWant } from '../contractFacet/offerSafety.js'; import { atomicTransfer, fromOnly, toOnly } from './atomicTransfer.js'; diff --git a/packages/zoe/src/contracts/auction/index.js b/packages/zoe/src/contracts/auction/index.js index f960272d42d..d6b2f432960 100644 --- a/packages/zoe/src/contracts/auction/index.js +++ b/packages/zoe/src/contracts/auction/index.js @@ -1,11 +1,11 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { mustMatch } from '@endo/patterns'; import { Far } from '@endo/marshal'; import { TimeMath, RelativeTimeShape } from '@agoric/time'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { Fail } from '@endo/errors'; import { defaultAcceptanceMsg, assertIssuerKeywords, diff --git a/packages/zoe/src/contracts/autoswap.js b/packages/zoe/src/contracts/autoswap.js index 93d1e7d469b..6b9d673253a 100644 --- a/packages/zoe/src/contracts/autoswap.js +++ b/packages/zoe/src/contracts/autoswap.js @@ -1,5 +1,5 @@ -import { Far } from '@endo/marshal'; import { assert } from '@endo/errors'; +import { Far } from '@endo/marshal'; import { AmountMath, isNatValue } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' diff --git a/packages/zoe/src/contracts/callSpread/calculateShares.js b/packages/zoe/src/contracts/callSpread/calculateShares.js index ff6e189d062..7f1de802d54 100644 --- a/packages/zoe/src/contracts/callSpread/calculateShares.js +++ b/packages/zoe/src/contracts/callSpread/calculateShares.js @@ -1,7 +1,7 @@ /// -import { AmountMath, isNatValue } from '@agoric/ertp'; import { assert } from '@endo/errors'; +import { AmountMath, isNatValue } from '@agoric/ertp'; import { makeRatio, oneMinus } from '../../contractSupport/index.js'; import { make100Percent, make0Percent } from './percent.js'; diff --git a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js index ec203e0bb66..358124b2da3 100644 --- a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js +++ b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js @@ -1,11 +1,11 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ /// +import { Fail } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; -import { Fail } from '@endo/errors'; import { assertProposalShape, depositToSeat, diff --git a/packages/zoe/src/contracts/coveredCall-durable.js b/packages/zoe/src/contracts/coveredCall-durable.js index e654ac7ca6a..bcac0693003 100644 --- a/packages/zoe/src/contracts/coveredCall-durable.js +++ b/packages/zoe/src/contracts/coveredCall-durable.js @@ -1,6 +1,6 @@ +import { Fail } from '@endo/errors'; import { mustMatch, M } from '@agoric/store'; import { prepareExo, prepareExoClass } from '@agoric/vat-data'; -import { Fail } from '@endo/errors'; import { swapExact } from '../contractSupport/index.js'; import { isAfterDeadlineExitRule, OfferHandlerI } from '../typeGuards.js'; diff --git a/packages/zoe/src/contracts/coveredCall.js b/packages/zoe/src/contracts/coveredCall.js index 0c54a9620a8..1f441aebb57 100644 --- a/packages/zoe/src/contracts/coveredCall.js +++ b/packages/zoe/src/contracts/coveredCall.js @@ -1,6 +1,6 @@ +import { Fail, q } from '@endo/errors'; import { M, mustMatch } from '@agoric/store'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { Fail, q } from '@endo/errors'; import { swapExact } from '../contractSupport/index.js'; import { isAfterDeadlineExitRule } from '../typeGuards.js'; diff --git a/packages/zoe/src/contracts/loan/updateDebt.js b/packages/zoe/src/contracts/loan/updateDebt.js index 29992269078..8930d806492 100644 --- a/packages/zoe/src/contracts/loan/updateDebt.js +++ b/packages/zoe/src/contracts/loan/updateDebt.js @@ -1,6 +1,6 @@ +import { annotateError, X } from '@endo/errors'; import { Far } from '@endo/marshal'; import { makeNotifierKit, observeNotifier } from '@agoric/notifier'; -import { annotateError, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; diff --git a/packages/zoe/src/contracts/mintAndSellNFT.js b/packages/zoe/src/contracts/mintAndSellNFT.js index 4eaef68d1a6..f1531a70130 100644 --- a/packages/zoe/src/contracts/mintAndSellNFT.js +++ b/packages/zoe/src/contracts/mintAndSellNFT.js @@ -1,8 +1,8 @@ +import { assert } from '@endo/errors'; import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert } from '@endo/errors'; import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js'; /** diff --git a/packages/zoe/src/contracts/otcDesk.js b/packages/zoe/src/contracts/otcDesk.js index a52204600d2..483f4e842f7 100644 --- a/packages/zoe/src/contracts/otcDesk.js +++ b/packages/zoe/src/contracts/otcDesk.js @@ -1,5 +1,5 @@ -import { E } from '@endo/eventual-send'; import { assert } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { offerTo, diff --git a/packages/zoe/src/contracts/sellItems.js b/packages/zoe/src/contracts/sellItems.js index 795815743bf..4a53a8536c1 100644 --- a/packages/zoe/src/contracts/sellItems.js +++ b/packages/zoe/src/contracts/sellItems.js @@ -1,4 +1,5 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; import { Nat } from '@endo/nat'; import { AmountMath } from '@agoric/ertp'; @@ -7,7 +8,6 @@ import { observeIteration, subscribeLatest, } from '@agoric/notifier'; -import { Fail } from '@endo/errors'; import { assertIssuerKeywords, defaultAcceptanceMsg, diff --git a/packages/zoe/src/instanceRecordStorage.js b/packages/zoe/src/instanceRecordStorage.js index 6cd27d321ef..34faf24500f 100644 --- a/packages/zoe/src/instanceRecordStorage.js +++ b/packages/zoe/src/instanceRecordStorage.js @@ -1,5 +1,5 @@ -import { provide, prepareExoClass, M } from '@agoric/vat-data'; import { q, Fail } from '@endo/errors'; +import { provide, prepareExoClass, M } from '@agoric/vat-data'; import { assertKeywordName } from './cleanProposal.js'; import { BrandKeywordRecordShape, diff --git a/packages/zoe/src/issuerStorage.js b/packages/zoe/src/issuerStorage.js index c1810702a60..74cecc7565c 100644 --- a/packages/zoe/src/issuerStorage.js +++ b/packages/zoe/src/issuerStorage.js @@ -1,8 +1,8 @@ +import { Fail } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { deeplyFulfilledObject, objectMap } from '@agoric/internal'; import { provideDurableWeakMapStore } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; -import { Fail } from '@endo/errors'; import { cleanKeywords } from './cleanProposal.js'; import { makeIssuerRecord } from './issuerRecord.js'; diff --git a/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js b/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js index e4ea1010504..13f5921b9e1 100644 --- a/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js +++ b/packages/zoe/test/swingsetTests/brokenContracts/vat-alice.js @@ -1,8 +1,8 @@ // @ts-nocheck +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { showPurseBalance, setupIssuers } from '../helpers.js'; async function logCounter(log, publicAPI) { diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js index 8c9e7f43e38..90c0faeb701 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/bootstrap-coveredCall-service-upgrade.js @@ -1,7 +1,7 @@ +import { q, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; -import { q, X } from '@endo/errors'; import buildManualTimer from '../../../tools/manualTimer.js'; const mintInto = (kit, purse, value) => diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js index b580f215e36..5391381995c 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js @@ -1,7 +1,6 @@ +import { X } from '@endo/errors'; import { M, mustMatch } from '@agoric/store'; - import { prepareExoClass, prepareExo } from '@agoric/vat-data'; -import { X } from '@endo/errors'; import { swapExact } from '../../../src/contractSupport/index.js'; import { InvitationShape, diff --git a/packages/zoe/test/swingsetTests/zoe/vat-alice.js b/packages/zoe/test/swingsetTests/zoe/vat-alice.js index f63f0fffbe5..774c6aa5960 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-alice.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-alice.js @@ -1,6 +1,6 @@ +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; import { showPurseBalance, setupIssuers } from '../helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-bob.js b/packages/zoe/test/swingsetTests/zoe/vat-bob.js index ed4deb5b73f..55eacaa551d 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-bob.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-bob.js @@ -1,6 +1,6 @@ +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-carol.js b/packages/zoe/test/swingsetTests/zoe/vat-carol.js index 526f969a1a8..eba052ca353 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-carol.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-carol.js @@ -1,6 +1,6 @@ +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { showPurseBalance, setupIssuers } from '../helpers.js'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-dave.js b/packages/zoe/test/swingsetTests/zoe/vat-dave.js index 7d8460a89e7..38a56fc53e9 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-dave.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-dave.js @@ -1,6 +1,6 @@ +import { assert, X, Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X, Fail } from '@endo/errors'; import { keyEQ } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; diff --git a/packages/zoe/test/unitTests/bounty.js b/packages/zoe/test/unitTests/bounty.js index 77205854874..bfec6ca4185 100644 --- a/packages/zoe/test/unitTests/bounty.js +++ b/packages/zoe/test/unitTests/bounty.js @@ -1,6 +1,6 @@ +import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { AmountMath } from '@agoric/ertp'; /** diff --git a/packages/zoe/test/unitTests/contracts/escrowToVote.js b/packages/zoe/test/unitTests/contracts/escrowToVote.js index b7726809d41..9d3f83ee612 100644 --- a/packages/zoe/test/unitTests/contracts/escrowToVote.js +++ b/packages/zoe/test/unitTests/contracts/escrowToVote.js @@ -1,10 +1,10 @@ // @ts-nocheck +import { X, q } from '@endo/errors'; import { Far } from '@endo/marshal'; import { makeScalarMapStore } from '@agoric/store'; import { AmountMath } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { X, q } from '@endo/errors'; import { assertIssuerKeywords, assertProposalShape, diff --git a/packages/zoe/test/unitTests/contracts/oracle.test.js b/packages/zoe/test/unitTests/contracts/oracle.test.js index 9efacad53ff..4680c10fd64 100644 --- a/packages/zoe/test/unitTests/contracts/oracle.test.js +++ b/packages/zoe/test/unitTests/contracts/oracle.test.js @@ -2,13 +2,13 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; import path from 'path'; +import { assert, X } from '@endo/errors'; import bundleSource from '@endo/bundle-source'; - -import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; import { Far } from '@endo/marshal'; -import { assert, X } from '@endo/errors'; import { E } from '@endo/eventual-send'; +import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; + import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; import { makeZoeForTest } from '../../../tools/setup-zoe.js'; diff --git a/packages/zoe/test/unitTests/contracts/useObjExample.js b/packages/zoe/test/unitTests/contracts/useObjExample.js index 06dbb5b0e03..f627d91516f 100644 --- a/packages/zoe/test/unitTests/contracts/useObjExample.js +++ b/packages/zoe/test/unitTests/contracts/useObjExample.js @@ -1,8 +1,8 @@ +import { X } from '@endo/errors'; import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { X } from '@endo/errors'; import { assertIssuerKeywords, assertProposalShape, diff --git a/packages/zoe/test/unitTests/fakePriceAuthority.test.js b/packages/zoe/test/unitTests/fakePriceAuthority.test.js index f402c577455..6ebef43ddf7 100644 --- a/packages/zoe/test/unitTests/fakePriceAuthority.test.js +++ b/packages/zoe/test/unitTests/fakePriceAuthority.test.js @@ -1,7 +1,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { E } from '@endo/eventual-send'; import { assert } from '@endo/errors'; +import { E } from '@endo/eventual-send'; import { TimeMath } from '@agoric/time'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import buildManualTimer from '../../tools/manualTimer.js'; diff --git a/packages/zoe/test/unitTests/makeOffer.js b/packages/zoe/test/unitTests/makeOffer.js index 407e9476aeb..ece49066122 100644 --- a/packages/zoe/test/unitTests/makeOffer.js +++ b/packages/zoe/test/unitTests/makeOffer.js @@ -1,5 +1,5 @@ -import { E } from '@endo/eventual-send'; import { assert } from '@endo/errors'; +import { E } from '@endo/eventual-send'; /** * @param {ERef} zoe diff --git a/packages/zoe/test/unitTests/scriptedOracle.test.js b/packages/zoe/test/unitTests/scriptedOracle.test.js index 7391e77cca8..adea4c055ad 100644 --- a/packages/zoe/test/unitTests/scriptedOracle.test.js +++ b/packages/zoe/test/unitTests/scriptedOracle.test.js @@ -3,12 +3,12 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; import path from 'path'; +import { assert } from '@endo/errors'; import bundleSource from '@endo/bundle-source'; import { E } from '@endo/eventual-send'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { TimeMath } from '@agoric/time'; -import { assert } from '@endo/errors'; import { makeFakeVatAdmin } from '../../tools/fakeVatAdmin.js'; import { makeZoeForTest } from '../../tools/setup-zoe.js'; diff --git a/packages/zoe/test/unitTests/zcf/setupZcfTest.js b/packages/zoe/test/unitTests/zcf/setupZcfTest.js index 690f30f7b2b..350dd664e35 100644 --- a/packages/zoe/test/unitTests/zcf/setupZcfTest.js +++ b/packages/zoe/test/unitTests/zcf/setupZcfTest.js @@ -1,6 +1,6 @@ +import { assert } from '@endo/errors'; import { E } from '@endo/eventual-send'; import bundleSource from '@endo/bundle-source'; -import { assert } from '@endo/errors'; import path from 'path'; diff --git a/packages/zoe/test/zoeTestHelpers.js b/packages/zoe/test/zoeTestHelpers.js index 56b8c9a659e..e857d1fecd0 100644 --- a/packages/zoe/test/zoeTestHelpers.js +++ b/packages/zoe/test/zoeTestHelpers.js @@ -1,9 +1,8 @@ +import { q } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { AmountMath, assertValueGetHelpers } from '@agoric/ertp'; -import { q } from '@endo/errors'; - export const assertAmountsEqual = (t, amount, expected, label = '') => { harden(amount); harden(expected); diff --git a/packages/zoe/tools/fakePriceAuthority.js b/packages/zoe/tools/fakePriceAuthority.js index bdfac2999e8..f7b24db3ec6 100644 --- a/packages/zoe/tools/fakePriceAuthority.js +++ b/packages/zoe/tools/fakePriceAuthority.js @@ -1,14 +1,15 @@ -import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; +import { Fail } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; +import { E } from '@endo/eventual-send'; +import { Far } from '@endo/marshal'; + +import { makeIssuerKit, AssetKind, AmountMath } from '@agoric/ertp'; import { makeNotifierKit, makeNotifierFromAsyncIterable, } from '@agoric/notifier'; -import { E } from '@endo/eventual-send'; -import { Far } from '@endo/marshal'; import { TimeMath } from '@agoric/time'; -import { Fail } from '@endo/errors'; import { natSafeMath } from '../src/contractSupport/index.js'; /** diff --git a/packages/zoe/tools/manualTimer.js b/packages/zoe/tools/manualTimer.js index ce7d0b4d3e0..f833e2e2e83 100644 --- a/packages/zoe/tools/manualTimer.js +++ b/packages/zoe/tools/manualTimer.js @@ -1,3 +1,4 @@ +import { Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; import { bindAllMethods } from '@agoric/internal'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; @@ -9,8 +10,6 @@ import { TimeMath } from '@agoric/time'; * @import {RemotableBrand} from '@endo/eventual-send'; */ -import { Fail } from '@endo/errors'; - // we wrap SwingSet's buildManualTimer to accomodate the needs of // zoe's tests diff --git a/packages/zone/src/durable.js b/packages/zone/src/durable.js index 4ea84c2f89c..24f8093a088 100644 --- a/packages/zone/src/durable.js +++ b/packages/zone/src/durable.js @@ -1,7 +1,9 @@ // @ts-check // @jessie-check +import { Fail } from '@endo/errors'; import { Far, isPassable } from '@endo/pass-style'; + import { canBeDurable, makeScalarMapStore, @@ -17,8 +19,6 @@ import { import { agoricVatDataKeys as keys, makeOnceKit } from '@agoric/base-zone'; -import { Fail } from '@endo/errors'; - /** * A variant of `canBeDurable` that returns `false` instead of ever throwing. *