From 3ec10165ed4362b24973fbe4983efd6aabc2287f Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Thu, 18 Jan 2024 11:20:01 -0800 Subject: [PATCH] refactor: remove migrated common --- .github/workflows/test-all-packages.yml | 3 - packages/ERTP/package.json | 2 + packages/ERTP/src/amountMath.js | 4 +- packages/ERTP/src/displayInfo.js | 4 +- packages/ERTP/src/issuerKit.js | 4 +- packages/ERTP/src/legacy-payment-helpers.js | 6 +- .../src/mathHelpers/copyBagMathHelpers.js | 2 +- .../src/mathHelpers/copySetMathHelpers.js | 2 +- .../ERTP/src/mathHelpers/natMathHelpers.js | 2 +- .../ERTP/src/mathHelpers/setMathHelpers.js | 2 +- packages/ERTP/src/payment.js | 2 +- packages/ERTP/src/paymentLedger.js | 13 +- packages/ERTP/src/purse.js | 5 +- .../mathHelpers/test-copyBagMathHelpers.js | 2 +- .../mathHelpers/test-copySetMathHelpers.js | 3 +- .../mathHelpers/test-natMathHelpers.js | 3 +- .../test/unitTests/test-amountProperties.js | 3 +- packages/ERTP/test/unitTests/test-mintObj.js | 5 +- packages/ERTP/test/unitTests/test-recovery.js | 2 +- packages/SwingSet/package.json | 3 + .../src/controller/initializeSwingset.js | 7 +- packages/SwingSet/src/typeGuards.js | 2 +- .../SwingSet/test/upgrade/test-upgrade.js | 2 +- packages/SwingSet/test/upgrade/vat-ulrik-1.js | 2 +- packages/SwingSet/test/upgrade/vat-ulrik-2.js | 5 +- packages/SwingSet/test/vat-exporter.js | 4 +- .../test/virtualObjects/vat-orphan-bob.js | 2 +- packages/SwingSet/tools/bootstrap-relay.js | 2 +- packages/agoric-cli/package.json | 3 +- packages/agoric-cli/src/commands/inter.js | 5 +- packages/agoric-cli/src/sdk-package-names.js | 1 - packages/assert/src/types.js | 5 +- packages/base-zone/package.json | 1 + packages/base-zone/src/make-once.js | 2 +- packages/boot/package.json | 1 + packages/boot/test/bootstrapTests/zcfProbe.js | 6 +- packages/boot/test/test-boot-config.js | 3 +- packages/builders/package.json | 1 + .../scripts/inter-protocol/init-core.js | 2 +- packages/cache/package.json | 3 +- packages/cache/src/store.js | 4 +- packages/cache/test/test-mvp.js | 4 +- packages/cache/test/test-storage.js | 6 +- packages/casting/package.json | 2 + packages/casting/src/follower-cosmjs.js | 9 +- packages/casting/src/netconfig.js | 2 +- packages/governance/package.json | 3 + packages/governance/src/contractGovernor.js | 5 +- packages/governance/src/contractHelper.js | 3 +- packages/inter-protocol/package.json | 3 + .../inter-protocol/src/auction/auctionBook.js | 8 +- .../inter-protocol/src/auction/auctioneer.js | 9 +- .../inter-protocol/src/auction/offerBook.js | 3 +- packages/inter-protocol/src/auction/params.js | 3 +- .../inter-protocol/src/auction/scheduler.js | 17 +- .../src/auction/sortedOffers.js | 3 +- .../inter-protocol/src/contractSupport.js | 3 +- packages/inter-protocol/src/provisionPool.js | 3 +- .../inter-protocol/src/provisionPoolKit.js | 7 +- .../src/vaultFactory/vaultManager.js | 14 +- .../test/auction/test-scheduler.js | 2 +- packages/inter-protocol/test/auction/tools.js | 3 +- .../test/vaultFactory/driver.js | 3 +- .../test-replacePriceAuthority.js | 3 +- .../test/vaultFactory/test-vaultFactory.js | 10 +- .../vaultFactory/test-vaultLiquidation.js | 3 +- packages/internal/package.json | 1 + packages/internal/src/callback.js | 7 +- packages/internal/src/utils.js | 49 +- packages/internal/test/test-utils.js | 47 -- packages/notifier/package.json | 1 + packages/notifier/src/subscribe.js | 8 +- packages/pegasus/package.json | 1 + packages/pegasus/src/ics20.js | 9 +- packages/pegasus/src/pegasus.js | 14 +- packages/same-structure/CHANGELOG.md | 496 ------------------ packages/same-structure/CONTRIBUTING.md | 49 -- packages/same-structure/NEWS.md | 31 -- packages/same-structure/README.md | 3 - packages/same-structure/index.js | 24 - packages/same-structure/package.json | 47 -- packages/same-structure/tsconfig.json | 10 - packages/smart-wallet/package.json | 2 + packages/smart-wallet/src/invitations.js | 5 +- packages/smart-wallet/src/offerWatcher.js | 5 +- packages/smart-wallet/src/smartWallet.js | 2 +- packages/smart-wallet/src/utils.js | 3 +- packages/solo/package.json | 1 + packages/solo/src/chain-cosmos-sdk.js | 9 +- packages/solo/src/pipe-entrypoint.js | 3 +- packages/store/package.json | 1 + packages/store/src/index.js | 19 +- packages/store/src/stores/scalarMapStore.js | 3 +- packages/store/src/stores/scalarSetStore.js | 3 +- .../store/src/stores/scalarWeakMapStore.js | 11 +- .../store/src/stores/scalarWeakSetStore.js | 11 +- packages/store/src/stores/store-utils.js | 28 +- packages/swingset-liveslots/package.json | 1 + .../src/collectionManager.js | 4 +- packages/swingset-liveslots/src/liveslots.js | 19 +- .../src/virtualObjectManager.js | 56 +- .../swingset-liveslots/src/watchedPromises.js | 3 +- .../swingset-liveslots/test/gc-helpers.js | 3 +- .../test/test-collection-upgrade.js | 3 +- .../test/test-handled-promises.js | 6 +- .../test/test-initial-vrefs.js | 3 +- packages/vat-data/package.json | 4 +- packages/vat-data/src/exo-utils.js | 2 +- packages/vat-data/src/index.js | 3 +- .../vat-data/test/test-durable-classes.js | 2 +- packages/vat-data/test/test-prepare.js | 2 +- .../vat-data/test/test-scalar-only-keys.js | 5 +- .../vat-data/test/test-virtual-classes.js | 2 +- packages/vats/src/bridge.js | 5 +- packages/wallet/api/package.json | 2 + packages/wallet/api/src/lib-wallet.js | 5 +- packages/wallet/api/test/test-lib-wallet.js | 6 +- packages/wallet/package.json | 3 +- packages/zoe/package.json | 4 + packages/zoe/src/cleanProposal.js | 8 +- packages/zoe/src/contractFacet/exit.js | 4 +- packages/zoe/src/contractFacet/zcfSeat.js | 11 +- packages/zoe/src/contractFacet/zcfZygote.js | 12 +- .../zoe/src/contractSupport/atomicTransfer.js | 2 +- .../zoe/src/contractSupport/durability.js | 5 +- .../zoe/src/contractSupport/priceAuthority.js | 3 +- packages/zoe/src/contractSupport/recorder.js | 9 +- packages/zoe/src/contractSupport/topics.js | 5 +- .../zoe/src/contractSupport/zoeHelpers.js | 5 +- .../zoe/src/contracts/coveredCall-durable.js | 3 +- packages/zoe/src/contracts/coveredCall.js | 3 +- packages/zoe/src/contracts/loan/updateDebt.js | 7 +- .../zoe/src/contracts/scaledPriceAuthority.js | 3 +- packages/zoe/src/instanceRecordStorage.js | 4 +- packages/zoe/src/makeHandle.js | 7 +- packages/zoe/src/typeGuards.js | 3 +- packages/zoe/src/zoeService/escrowStorage.js | 7 +- packages/zoe/src/zoeService/feeMint.js | 4 +- .../zoe/src/zoeService/installationStorage.js | 7 +- .../src/zoeService/instanceAdminStorage.js | 5 +- .../zoe/src/zoeService/invitationQueries.js | 6 +- .../src/zoeService/offer/burnInvitation.js | 14 +- packages/zoe/src/zoeService/offer/offer.js | 4 +- packages/zoe/src/zoeService/startInstance.js | 7 +- packages/zoe/src/zoeService/zoe.js | 3 +- packages/zoe/src/zoeService/zoeSeat.js | 8 +- .../coveredCall-durable-V3.js | 2 +- .../zoe/test/swingsetTests/zoe/vat-bob.js | 5 +- .../zoe/test/swingsetTests/zoe/vat-carol.js | 5 +- .../zoe/test/swingsetTests/zoe/vat-dave.js | 7 +- .../test-coveredCall-want-pattern.js | 3 +- .../unitTests/contracts/test-coveredCall.js | 3 +- .../zoe/test/unitTests/test-cleanProposal.js | 3 +- .../test/unitTests/zcf/test-zoeHelpersWZcf.js | 3 +- yarn.lock | 7 + 155 files changed, 443 insertions(+), 1066 deletions(-) delete mode 100644 packages/same-structure/CHANGELOG.md delete mode 100644 packages/same-structure/CONTRIBUTING.md delete mode 100644 packages/same-structure/NEWS.md delete mode 100644 packages/same-structure/README.md delete mode 100644 packages/same-structure/index.js delete mode 100644 packages/same-structure/package.json delete mode 100644 packages/same-structure/tsconfig.json diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 2fbbbd5af0e4..7711aff2ed8c 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -145,9 +145,6 @@ jobs: - name: yarn test (notifier) if: (success() || failure()) run: cd packages/notifier && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - - name: yarn test (same-structure) - if: (success() || failure()) - run: cd packages/same-structure && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: yarn test (sparse-ints) if: (success() || failure()) run: cd packages/sparse-ints && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT diff --git a/packages/ERTP/package.json b/packages/ERTP/package.json index 8734868004fd..442602474e3d 100644 --- a/packages/ERTP/package.json +++ b/packages/ERTP/package.json @@ -43,7 +43,9 @@ "@agoric/notifier": "^0.6.2", "@agoric/store": "^0.9.2", "@agoric/vat-data": "^0.5.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", + "@endo/exo": "^1.1.0", "@endo/far": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", diff --git a/packages/ERTP/src/amountMath.js b/packages/ERTP/src/amountMath.js index 2820cdc9c952..b5b5e9d3d61b 100644 --- a/packages/ERTP/src/amountMath.js +++ b/packages/ERTP/src/amountMath.js @@ -1,12 +1,12 @@ +import { quote as q, throwRedacted as Fail } from '@endo/errors'; import { passStyleOf, assertRemotable, assertRecord } from '@endo/marshal'; +import { M, matches } from '@endo/patterns'; -import { M, matches } from '@agoric/store'; import { natMathHelpers } from './mathHelpers/natMathHelpers.js'; import { setMathHelpers } from './mathHelpers/setMathHelpers.js'; import { copySetMathHelpers } from './mathHelpers/copySetMathHelpers.js'; import { copyBagMathHelpers } from './mathHelpers/copyBagMathHelpers.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 abd7a1afb752..26ab4bda511e 100644 --- a/packages/ERTP/src/displayInfo.js +++ b/packages/ERTP/src/displayInfo.js @@ -1,7 +1,7 @@ // @jessie-check -import { Fail } from '@agoric/assert'; -import { mustMatch } from '@agoric/store'; +import { throwRedacted as Fail } from '@endo/errors'; +import { mustMatch } from '@endo/patterns'; import { DisplayInfoShape } from './typeGuards.js'; diff --git a/packages/ERTP/src/issuerKit.js b/packages/ERTP/src/issuerKit.js index 028ba4fbcd60..bb35d608c5d6 100644 --- a/packages/ERTP/src/issuerKit.js +++ b/packages/ERTP/src/issuerKit.js @@ -1,7 +1,7 @@ // @jessie-check -import { assert } from '@agoric/assert'; -import { assertPattern } from '@agoric/store'; +import { assert } from '@endo/errors'; +import { assertPattern } from '@endo/patterns'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { AssetKind, assertAssetKind } from './amountMath.js'; diff --git a/packages/ERTP/src/legacy-payment-helpers.js b/packages/ERTP/src/legacy-payment-helpers.js index f7ee86b4e50c..86fea0def265 100644 --- a/packages/ERTP/src/legacy-payment-helpers.js +++ b/packages/ERTP/src/legacy-payment-helpers.js @@ -1,10 +1,10 @@ // @jessie-check -import { mustMatch } from '@agoric/store'; +import { throwRedacted as Fail } from '@endo/errors'; import { E } from '@endo/far'; -import { AmountMath } from './amountMath.js'; +import { mustMatch } from '@endo/patterns'; -const { Fail } = assert; +import { AmountMath } from './amountMath.js'; /** * @file This file contains safer helper function alternatives to the similarly diff --git a/packages/ERTP/src/mathHelpers/copyBagMathHelpers.js b/packages/ERTP/src/mathHelpers/copyBagMathHelpers.js index 20305c246100..0824f80a0b39 100644 --- a/packages/ERTP/src/mathHelpers/copyBagMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/copyBagMathHelpers.js @@ -9,7 +9,7 @@ import { bagIsSuperbag, bagUnion, bagDisjointSubtract, -} from '@agoric/store'; +} from '@endo/patterns'; import '../types-ambient.js'; /** @type {CopyBag} */ diff --git a/packages/ERTP/src/mathHelpers/copySetMathHelpers.js b/packages/ERTP/src/mathHelpers/copySetMathHelpers.js index 653f2185a16b..fa3ad2f5e6ec 100644 --- a/packages/ERTP/src/mathHelpers/copySetMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/copySetMathHelpers.js @@ -9,7 +9,7 @@ import { setIsSuperset, setDisjointUnion, setDisjointSubtract, -} from '@agoric/store'; +} from '@endo/patterns'; import '../types-ambient.js'; /** @type {CopySet} */ diff --git a/packages/ERTP/src/mathHelpers/natMathHelpers.js b/packages/ERTP/src/mathHelpers/natMathHelpers.js index 688d19f5d4cb..4c25f0f4bb61 100644 --- a/packages/ERTP/src/mathHelpers/natMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/natMathHelpers.js @@ -1,10 +1,10 @@ // @jessie-check +import { throwRedacted as Fail } from '@endo/errors'; import { Nat, isNat } from '@endo/nat'; import '../types-ambient.js'; -const { Fail } = assert; const empty = 0n; /** diff --git a/packages/ERTP/src/mathHelpers/setMathHelpers.js b/packages/ERTP/src/mathHelpers/setMathHelpers.js index 87f2e22f44d6..12e1ced6d065 100644 --- a/packages/ERTP/src/mathHelpers/setMathHelpers.js +++ b/packages/ERTP/src/mathHelpers/setMathHelpers.js @@ -8,7 +8,7 @@ import { elementsDisjointSubtract, coerceToElements, elementsCompare, -} from '@agoric/store'; +} from '@endo/patterns'; import '../types-ambient.js'; // Operations for arrays with unique objects identifying and providing diff --git a/packages/ERTP/src/payment.js b/packages/ERTP/src/payment.js index 809be8cc965b..40d69a6a24af 100644 --- a/packages/ERTP/src/payment.js +++ b/packages/ERTP/src/payment.js @@ -1,6 +1,6 @@ // @jessie-check -import { initEmpty } from '@agoric/store'; +import { initEmpty } from '@endo/exo'; import { prepareExoClass } from '@agoric/vat-data'; /** @typedef {import('@endo/patterns').MethodGuard} MethodGuard */ diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js index b11ecc925a76..cc321f978f4b 100644 --- a/packages/ERTP/src/paymentLedger.js +++ b/packages/ERTP/src/paymentLedger.js @@ -1,8 +1,15 @@ // @jessie-check /* eslint-disable no-use-before-define */ +import { + redacted as X, + quote as q, + throwRedacted as Fail, + note as errorNote, +} from '@endo/errors'; import { isPromise } from '@endo/promise-kit'; -import { mustMatch, M, keyEQ } from '@agoric/store'; +import { mustMatch, M, keyEQ } from '@endo/patterns'; + import { provideDurableWeakMapStore, prepareExo, @@ -17,8 +24,6 @@ import { BrandI, makeIssuerInterfaces } from './typeGuards.js'; /** @typedef {import('@agoric/vat-data').Baggage} Baggage */ -const { details: X, quote: q, Fail } = assert; - /** * @param {Brand} brand * @param {AssetKind} assetKind @@ -131,7 +136,7 @@ export const preparePaymentLedger = ( try { optShutdownWithFailure(reason); } catch (errInShutdown) { - assert.note(errInShutdown, X`Caused by: ${reason}`); + errorNote(errInShutdown, X`Caused by: ${reason}`); throw errInShutdown; } } diff --git a/packages/ERTP/src/purse.js b/packages/ERTP/src/purse.js index 74451170fe0b..79f50ec77fc3 100644 --- a/packages/ERTP/src/purse.js +++ b/packages/ERTP/src/purse.js @@ -1,4 +1,6 @@ -import { M } from '@agoric/store'; +import { throwRedacted as Fail } from '@endo/errors'; +import { M } from '@endo/patterns'; + import { prepareExoClassKit, makeScalarBigSetStore } from '@agoric/vat-data'; import { AmountMath } from './amountMath.js'; import { makeTransientNotifierKit } from './transientNotifier.js'; @@ -7,7 +9,6 @@ import { makeTransientNotifierKit } from './transientNotifier.js'; /** @typedef {import('@endo/patterns').InterfaceGuard} InterfaceGuard */ /** @typedef {import('@agoric/vat-data').Baggage} Baggage */ -const { Fail } = assert; /** * @param {Baggage} issuerBaggage diff --git a/packages/ERTP/test/unitTests/mathHelpers/test-copyBagMathHelpers.js b/packages/ERTP/test/unitTests/mathHelpers/test-copyBagMathHelpers.js index 64e0ed9bd858..06ce586f487c 100644 --- a/packages/ERTP/test/unitTests/mathHelpers/test-copyBagMathHelpers.js +++ b/packages/ERTP/test/unitTests/mathHelpers/test-copyBagMathHelpers.js @@ -3,7 +3,7 @@ import { makeTagged } from '@endo/marshal'; import { getCopyBagEntries, makeCopyBagFromElements as makeBag, -} from '@agoric/store'; +} from '@endo/patterns'; import { AmountMath as m, AssetKind } from '../../../src/index.js'; import { mockBrand } from './mockBrand.js'; diff --git a/packages/ERTP/test/unitTests/mathHelpers/test-copySetMathHelpers.js b/packages/ERTP/test/unitTests/mathHelpers/test-copySetMathHelpers.js index d303851cf0f9..019babd630a0 100644 --- a/packages/ERTP/test/unitTests/mathHelpers/test-copySetMathHelpers.js +++ b/packages/ERTP/test/unitTests/mathHelpers/test-copySetMathHelpers.js @@ -1,5 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { getCopySetKeys, makeCopySet } from '@agoric/store'; + +import { getCopySetKeys, makeCopySet } from '@endo/patterns'; import { AmountMath as m, AssetKind } from '../../../src/index.js'; import { mockBrand } from './mockBrand.js'; diff --git a/packages/ERTP/test/unitTests/mathHelpers/test-natMathHelpers.js b/packages/ERTP/test/unitTests/mathHelpers/test-natMathHelpers.js index d43164ce4746..23eabfd91109 100644 --- a/packages/ERTP/test/unitTests/mathHelpers/test-natMathHelpers.js +++ b/packages/ERTP/test/unitTests/mathHelpers/test-natMathHelpers.js @@ -1,7 +1,8 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { M } from '@agoric/store'; import { Far } from '@endo/marshal'; +import { M } from '@endo/patterns'; + import { AmountMath as m, AssetKind } from '../../../src/index.js'; import { mockBrand } from './mockBrand.js'; diff --git a/packages/ERTP/test/unitTests/test-amountProperties.js b/packages/ERTP/test/unitTests/test-amountProperties.js index 6bfa2d718785..dc975d9e1a6d 100644 --- a/packages/ERTP/test/unitTests/test-amountProperties.js +++ b/packages/ERTP/test/unitTests/test-amountProperties.js @@ -1,5 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { makeCopyBag } from '@agoric/store'; + +import { makeCopyBag } from '@endo/patterns'; import { fc } from '@fast-check/ava'; import { AmountMath as m, AssetKind } from '../../src/index.js'; diff --git a/packages/ERTP/test/unitTests/test-mintObj.js b/packages/ERTP/test/unitTests/test-mintObj.js index 9bb3024cbd42..8908b0ab4c14 100644 --- a/packages/ERTP/test/unitTests/test-mintObj.js +++ b/packages/ERTP/test/unitTests/test-mintObj.js @@ -1,7 +1,8 @@ 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 { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; import { defineDurableKind, makeKindHandle } from '@agoric/vat-data'; import { makeIssuerKit, AssetKind, AmountMath } from '../../src/index.js'; diff --git a/packages/ERTP/test/unitTests/test-recovery.js b/packages/ERTP/test/unitTests/test-recovery.js index 3ed6ef326a76..6c12a2756ae8 100644 --- a/packages/ERTP/test/unitTests/test-recovery.js +++ b/packages/ERTP/test/unitTests/test-recovery.js @@ -1,5 +1,5 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { getCopySetKeys, keyEQ, makeCopySet } from '@agoric/store'; +import { getCopySetKeys, keyEQ, makeCopySet } from '@endo/patterns'; import { makeIssuerKit, AmountMath } from '../../src/index.js'; diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index e03a9b86c1c0..267b14a6d98c 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -40,10 +40,13 @@ "@agoric/xsnap-lockdown": "^0.14.0", "@endo/base64": "^1.0.1", "@endo/bundle-source": "^3.0.2", + "@endo/common": "^1.0.2", "@endo/captp": "^4.0.2", "@endo/check-bundle": "^1.0.2", "@endo/compartment-mapper": "^1.1.0", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", + "@endo/exo": "^1.1.0", "@endo/far": "^1.0.2", "@endo/import-bundle": "^1.0.2", "@endo/init": "^1.0.2", diff --git a/packages/SwingSet/src/controller/initializeSwingset.js b/packages/SwingSet/src/controller/initializeSwingset.js index e3f48c3950ad..7e07b2e982f7 100644 --- a/packages/SwingSet/src/controller/initializeSwingset.js +++ b/packages/SwingSet/src/controller/initializeSwingset.js @@ -2,10 +2,11 @@ import fs from 'fs'; import path from 'path'; -import { assert, Fail } from '@agoric/assert'; -import { makeTracer } from '@agoric/internal'; -import { mustMatch } from '@agoric/store'; +import { assert, throwRedacted as Fail } from '@endo/errors'; import bundleSource from '@endo/bundle-source'; +import { mustMatch } from '@endo/patterns'; + +import { makeTracer } from '@agoric/internal'; import { resolve as resolveModuleSpecifier } from 'import-meta-resolve'; import { ManagerType } from '../typeGuards.js'; import { provideBundleCache } from '../../tools/bundleTool.js'; diff --git a/packages/SwingSet/src/typeGuards.js b/packages/SwingSet/src/typeGuards.js index dd313d11b142..fb98de96a690 100644 --- a/packages/SwingSet/src/typeGuards.js +++ b/packages/SwingSet/src/typeGuards.js @@ -1,5 +1,5 @@ // @jessie-check -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; export const ManagerType = M.or( 'xsnap', diff --git a/packages/SwingSet/test/upgrade/test-upgrade.js b/packages/SwingSet/test/upgrade/test-upgrade.js index d30fc45e6761..faf54ecdf504 100644 --- a/packages/SwingSet/test/upgrade/test-upgrade.js +++ b/packages/SwingSet/test/upgrade/test-upgrade.js @@ -4,7 +4,7 @@ import { test } from '../../tools/prepare-test-env-ava.js'; import { assert } from '@agoric/assert'; import bundleSource from '@endo/bundle-source'; -import { objectMap } from '@agoric/internal'; +import { objectMap } from '@endo/common/object-map.js'; import { kser, 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/upgrade/vat-ulrik-1.js b/packages/SwingSet/test/upgrade/vat-ulrik-1.js index 89c08c286df1..b75dde49a147 100644 --- a/packages/SwingSet/test/upgrade/vat-ulrik-1.js +++ b/packages/SwingSet/test/upgrade/vat-ulrik-1.js @@ -1,6 +1,6 @@ import { Far, E } from '@endo/far'; import { makePromiseKit } from '@endo/promise-kit'; -import { initEmpty } from '@agoric/store'; +import { initEmpty } from '@endo/exo'; import { makeKindHandle, defineDurableKind, diff --git a/packages/SwingSet/test/upgrade/vat-ulrik-2.js b/packages/SwingSet/test/upgrade/vat-ulrik-2.js index 0d80ed3b4901..1259e40938cf 100644 --- a/packages/SwingSet/test/upgrade/vat-ulrik-2.js +++ b/packages/SwingSet/test/upgrade/vat-ulrik-2.js @@ -1,6 +1,7 @@ import { Far, E } from '@endo/far'; -import { assert } from '@agoric/assert'; -import { initEmpty } from '@agoric/store'; +import { assert } from '@endo/errors'; +import { initEmpty } from '@endo/exo'; + import { defineDurableKind, defineDurableKindMulti } from '@agoric/vat-data'; const initialize = (name, imp, value) => { diff --git a/packages/SwingSet/test/vat-exporter.js b/packages/SwingSet/test/vat-exporter.js index fe9cabb227e2..e516ad3dffdd 100644 --- a/packages/SwingSet/test/vat-exporter.js +++ b/packages/SwingSet/test/vat-exporter.js @@ -1,5 +1,7 @@ import { Far } from '@endo/far'; -import { M, defineExoClass } from '@agoric/store'; +import { M } from '@endo/patterns'; +import { defineExoClass } from '@endo/exo'; + import { defineVirtualExoClass, prepareExoClass, diff --git a/packages/SwingSet/test/virtualObjects/vat-orphan-bob.js b/packages/SwingSet/test/virtualObjects/vat-orphan-bob.js index c943755bcecb..1b656a42b660 100644 --- a/packages/SwingSet/test/virtualObjects/vat-orphan-bob.js +++ b/packages/SwingSet/test/virtualObjects/vat-orphan-bob.js @@ -1,5 +1,5 @@ import { Far } from '@endo/far'; -import { initEmpty } from '@agoric/store'; +import { initEmpty } from '@endo/exo'; import { defineKind, defineKindMulti } from '@agoric/vat-data'; const { getPrototypeOf } = Object; diff --git a/packages/SwingSet/tools/bootstrap-relay.js b/packages/SwingSet/tools/bootstrap-relay.js index f054f567ae56..358365d06ef8 100644 --- a/packages/SwingSet/tools/bootstrap-relay.js +++ b/packages/SwingSet/tools/bootstrap-relay.js @@ -1,5 +1,5 @@ import { assert } from '@agoric/assert'; -import { objectMap } from '@agoric/internal'; +import { objectMap } from '@endo/common/object-map.js'; import { Far, E } from '@endo/far'; import { buildManualTimer } from './manual-timer.js'; diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index 825701a4fce9..db81ca4d5e91 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -58,8 +58,9 @@ "@cosmjs/proto-signing": "^0.30.1", "@cosmjs/stargate": "^0.30.1", "@endo/bundle-source": "^3.0.2", - "@endo/captp": "^4.0.2", + "@endo/common": "^1.0.2", "@endo/compartment-mapper": "^1.1.0", + "@endo/captp": "^4.0.2", "@endo/far": "^1.0.2", "@endo/init": "^1.0.2", "@endo/marshal": "^1.1.0", diff --git a/packages/agoric-cli/src/commands/inter.js b/packages/agoric-cli/src/commands/inter.js index ccc092c9bcbf..fc660e985ff9 100644 --- a/packages/agoric-cli/src/commands/inter.js +++ b/packages/agoric-cli/src/commands/inter.js @@ -5,11 +5,10 @@ // @ts-check import { CommanderError, InvalidArgumentError } from 'commander'; -// TODO: should get M from endo https://github.com/Agoric/agoric-sdk/issues/7090 +import { objectMap } from '@endo/common/object-map.js'; +import { M, matches } from '@endo/patterns'; import { makeOfferSpecShape } from '@agoric/inter-protocol/src/auction/auctionBook.js'; import { Offers } from '@agoric/inter-protocol/src/clientSupport.js'; -import { objectMap } from '@agoric/internal'; -import { M, matches } from '@agoric/store'; import { normalizeAddressWithOptions, pollBlocks } from '../lib/chain.js'; import { diff --git a/packages/agoric-cli/src/sdk-package-names.js b/packages/agoric-cli/src/sdk-package-names.js index 1f2908ddf7b1..4e2f83d97c95 100644 --- a/packages/agoric-cli/src/sdk-package-names.js +++ b/packages/agoric-cli/src/sdk-package-names.js @@ -25,7 +25,6 @@ export default [ "@agoric/network", "@agoric/notifier", "@agoric/pegasus", - "@agoric/same-structure", "@agoric/smart-wallet", "@agoric/solo", "@agoric/sparse-ints", diff --git a/packages/assert/src/types.js b/packages/assert/src/types.js index a4c287e41799..b01ecee9e3bc 100644 --- a/packages/assert/src/types.js +++ b/packages/assert/src/types.js @@ -26,7 +26,7 @@ /** * @callback AssertMakeError * - * The `assert.error` method, recording details for the console. + * The `makeError` function, recording details for the console. * * The optional `optDetails` can be a string. * @param {Details} [optDetails] The details of what was asserted @@ -154,7 +154,7 @@ /** * @callback AssertNote - * The `assert.note` method. + * 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 @@ -345,6 +345,7 @@ * details: DetailsTag, * Fail: FailTag, * quote: AssertQuote, + * bare: AssertQuote, * makeAssert: MakeAssert, * } } Assert */ diff --git a/packages/base-zone/package.json b/packages/base-zone/package.json index 8491987e504d..91ff3c4247e7 100644 --- a/packages/base-zone/package.json +++ b/packages/base-zone/package.json @@ -27,6 +27,7 @@ "license": "Apache-2.0", "dependencies": { "@agoric/store": "^0.9.2", + "@endo/errors": "^1.0.2", "@endo/exo": "^1.1.0", "@endo/far": "^1.0.2", "@endo/pass-style": "^1.1.0", diff --git a/packages/base-zone/src/make-once.js b/packages/base-zone/src/make-once.js index e0b6f5d639e0..9bb1a44f5f9e 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 { throwRedacted as Fail } from '@endo/errors'; /** @param {string} label */ const defaultLabelToKeys = label => harden([label]); diff --git a/packages/boot/package.json b/packages/boot/package.json index 746ed12a846b..f9c083dc239d 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -39,6 +39,7 @@ "@endo/eventual-send": "^1.1.0", "@endo/init": "^1.0.2", "@endo/far": "^1.0.2", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "@endo/stream": "^1.0.2", "import-meta-resolve": "^2.2.1" diff --git a/packages/boot/test/bootstrapTests/zcfProbe.js b/packages/boot/test/bootstrapTests/zcfProbe.js index 16ab4fd1fa9f..76ab96931fb4 100644 --- a/packages/boot/test/bootstrapTests/zcfProbe.js +++ b/packages/boot/test/bootstrapTests/zcfProbe.js @@ -1,12 +1,14 @@ import '@agoric/zoe/exported.js'; -import { makeTracer } from '@agoric/internal'; import { E } from '@endo/far'; +import { M } from '@endo/patterns'; + +import { makeTracer } from '@agoric/internal'; import { atomicRearrange, provideAll, } from '@agoric/zoe/src/contractSupport/index.js'; -import { M, prepareExoClass, provide } from '@agoric/vat-data'; +import { prepareExoClass, provide } from '@agoric/vat-data'; import { AmountMath } from '@agoric/ertp'; const trace = makeTracer('ZCF Probe'); diff --git a/packages/boot/test/test-boot-config.js b/packages/boot/test/test-boot-config.js index edbd81131818..be35f91a2470 100644 --- a/packages/boot/test/test-boot-config.js +++ b/packages/boot/test/test-boot-config.js @@ -7,8 +7,9 @@ import { promises as fsPromises } from 'fs'; import { resolve as importMetaResolve } from 'import-meta-resolve'; import path from 'path'; +import { mustMatch } from '@endo/patterns'; + import { extractCoreProposalBundles } from '@agoric/deploy-script-support/src/extract-proposal.js'; -import { mustMatch } from '@agoric/store'; import { loadSwingsetConfigFile, shape as ssShape } from '@agoric/swingset-vat'; import { provideBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; diff --git a/packages/builders/package.json b/packages/builders/package.json index cdaeaa943816..82d9cb028929 100644 --- a/packages/builders/package.json +++ b/packages/builders/package.json @@ -32,6 +32,7 @@ "@agoric/vats": "^0.15.1", "@agoric/zoe": "^0.26.2", "@endo/bundle-source": "^3.0.2", + "@endo/common": "^1.0.2", "@endo/captp": "^4.0.2", "@endo/eventual-send": "^1.1.0", "@endo/far": "^1.0.2", diff --git a/packages/builders/scripts/inter-protocol/init-core.js b/packages/builders/scripts/inter-protocol/init-core.js index fa9fe1052a95..bd37452c929c 100644 --- a/packages/builders/scripts/inter-protocol/init-core.js +++ b/packages/builders/scripts/inter-protocol/init-core.js @@ -4,8 +4,8 @@ * chain state) Only works with "local" chain and not sim-chain b/c it needs * governance votes (n/a on sim-chain). */ +import { objectMap } from '@endo/common/object-map.js'; import { makeHelpers } from '@agoric/deploy-script-support'; -import { objectMap } from '@agoric/internal'; import { getManifestForInterProtocol, diff --git a/packages/cache/package.json b/packages/cache/package.json index cc59cb19a717..de8fad5471fc 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -24,7 +24,8 @@ "@agoric/store": "^0.9.2", "@agoric/vat-data": "^0.5.2", "@endo/far": "^1.0.2", - "@endo/marshal": "^1.1.0" + "@endo/marshal": "^1.1.0", + "@endo/patterns": "^1.1.0" }, "devDependencies": { "@agoric/zoe": "^0.26.2", diff --git a/packages/cache/src/store.js b/packages/cache/src/store.js index 01670024e8f1..109d51510bb8 100644 --- a/packages/cache/src/store.js +++ b/packages/cache/src/store.js @@ -1,6 +1,8 @@ import { E, Far } from '@endo/far'; import { deeplyFulfilled, makeMarshal } from '@endo/marshal'; -import { matches, makeScalarMapStore } from '@agoric/store'; +import { matches } from '@endo/patterns'; + +import { makeScalarMapStore } from '@agoric/store'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { untilTrue } from '@agoric/internal'; import { withGroundState, makeState } from './state.js'; diff --git a/packages/cache/test/test-mvp.js b/packages/cache/test/test-mvp.js index f32bcc5d8e97..013138ee8d03 100644 --- a/packages/cache/test/test-mvp.js +++ b/packages/cache/test/test-mvp.js @@ -1,6 +1,8 @@ // Must be first to set up globals import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { M } from '@agoric/store'; + +import { M } from '@endo/patterns'; + import { makeScalarBigMapStore } from '@agoric/vat-data'; import { makeCache } from '../src/cache.js'; diff --git a/packages/cache/test/test-storage.js b/packages/cache/test/test-storage.js index af41dabf3ae3..5b6e683fcdf8 100644 --- a/packages/cache/test/test-storage.js +++ b/packages/cache/test/test-storage.js @@ -2,10 +2,12 @@ import '@agoric/zoe/tools/prepare-test-env.js'; import test from 'ava'; -import { makeChainStorageRoot } from '@agoric/internal/src/lib-chainStorage.js'; import { Far, makeMarshal } from '@endo/marshal'; -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; + +import { makeChainStorageRoot } from '@agoric/internal/src/lib-chainStorage.js'; + import { makeCache } from '../src/cache.js'; import { makeChainStorageCoordinator } from '../src/store.js'; diff --git a/packages/casting/package.json b/packages/casting/package.json index 44ed0ea3bda5..d7b3f4c56e70 100644 --- a/packages/casting/package.json +++ b/packages/casting/package.json @@ -30,10 +30,12 @@ "@cosmjs/proto-signing": "^0.30.1", "@cosmjs/stargate": "^0.30.1", "@cosmjs/tendermint-rpc": "^0.30.1", + "@endo/errors": "^1.0.2", "@endo/far": "^1.0.2", "@endo/init": "^1.0.2", "@endo/lockdown": "^1.0.2", "@endo/marshal": "^1.1.0", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "node-fetch": "^2.6.0" }, diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index 5792b6c8ede6..2836b3b76fd4 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -1,5 +1,11 @@ /// +import { + redacted as X, + quote as q, + throwRedacted as Fail, + makeError, +} from '@endo/errors'; import { E, Far } from '@endo/far'; import * as tendermint34 from '@cosmjs/tendermint-rpc'; import * as stargateStar from '@cosmjs/stargate'; @@ -21,7 +27,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 +269,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/netconfig.js b/packages/casting/src/netconfig.js index cc2ff7ece487..ec87ee52bc8e 100644 --- a/packages/casting/src/netconfig.js +++ b/packages/casting/src/netconfig.js @@ -1,6 +1,6 @@ // @jessie-check -import { mustMatch, M } from '@agoric/store'; +import { mustMatch, M } from '@endo/patterns'; // NB: keep type and shape in sync manually until https://github.com/Agoric/agoric-sdk/issues/6160 /** diff --git a/packages/governance/package.json b/packages/governance/package.json index 1adcfe2cfb60..de18eaeddfb7 100644 --- a/packages/governance/package.json +++ b/packages/governance/package.json @@ -41,11 +41,14 @@ "@agoric/vat-data": "^0.5.2", "@agoric/zoe": "^0.26.2", "@endo/bundle-source": "^3.0.2", + "@endo/common": "^1.0.2", "@endo/captp": "^4.0.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/far": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "import-meta-resolve": "^2.2.1" }, diff --git a/packages/governance/src/contractGovernor.js b/packages/governance/src/contractGovernor.js index 6282d561013a..0b16f8fbb41e 100644 --- a/packages/governance/src/contractGovernor.js +++ b/packages/governance/src/contractGovernor.js @@ -1,5 +1,6 @@ -import { mustMatch } from '@agoric/store'; +import { throwRedacted as Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; +import { mustMatch } from '@endo/patterns'; import { makeTracer } from '@agoric/internal'; import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js'; @@ -7,8 +8,6 @@ import { CONTRACT_ELECTORATE } from './contractGovernance/governParam.js'; import { prepareContractGovernorKit } from './contractGovernorKit.js'; import { ParamChangesQuestionDetailsShape } from './typeGuards.js'; -const { Fail } = assert; - const trace = makeTracer('CGov', false); /** @type {ContractMeta} */ diff --git a/packages/governance/src/contractHelper.js b/packages/governance/src/contractHelper.js index 894f6f041d08..1560270e4af0 100644 --- a/packages/governance/src/contractHelper.js +++ b/packages/governance/src/contractHelper.js @@ -1,6 +1,7 @@ +import { objectMap } from '@endo/common/object-map.js'; import { Far } from '@endo/marshal'; import { makeStoredPublisherKit } from '@agoric/notifier'; -import { getMethodNames, objectMap } from '@agoric/internal'; +import { getMethodNames } from '@agoric/internal'; import { ignoreContext, prepareExo } from '@agoric/vat-data'; import { keyEQ, M } from '@agoric/store'; import { AmountShape, BrandShape } from '@agoric/ertp'; diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index 49cfc77e1c3e..ddb3b87a4c6c 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -41,11 +41,14 @@ "@agoric/vat-data": "^0.5.2", "@agoric/vats": "^0.15.1", "@agoric/zoe": "^0.26.2", + "@endo/common": "^1.0.2", "@endo/captp": "^4.0.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/far": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "jessie.js": "^0.3.2" }, diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index dbd4ca0e421f..15d77b6d3aa6 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -2,11 +2,12 @@ import '@agoric/governance/exported.js'; import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; -import { AmountMath, RatioShape } from '@agoric/ertp'; -import { mustMatch } from '@agoric/store'; -import { M, prepareExoClassKit } from '@agoric/vat-data'; +import { E } from '@endo/captp'; +import { M, mustMatch } from '@endo/patterns'; import { assertAllDefined, makeTracer } from '@agoric/internal'; +import { AmountMath, RatioShape } from '@agoric/ertp'; +import { prepareExoClassKit } from '@agoric/vat-data'; import { atomicRearrange, ceilMultiplyBy, @@ -16,7 +17,6 @@ import { multiplyRatios, ratioGTE, } from '@agoric/zoe/src/contractSupport/index.js'; -import { E } from '@endo/captp'; import { observeNotifier } from '@agoric/notifier'; import { makeNatAmountShape } from '../contractSupport.js'; diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index c894964159ff..ccd5b873efde 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -2,13 +2,16 @@ import '@agoric/governance/exported.js'; import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; +import { E } from '@endo/eventual-send'; +import { Far } from '@endo/marshal'; +import { M, mustMatch } from '@endo/patterns'; + import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp'; import { handleParamGovernance } from '@agoric/governance'; import { BASIS_POINTS, makeTracer } from '@agoric/internal'; import { prepareDurablePublishKit } from '@agoric/notifier'; -import { mustMatch } from '@agoric/store'; import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js'; -import { M, provideDurableMapStore } from '@agoric/vat-data'; +import { provideDurableMapStore } from '@agoric/vat-data'; import { atomicRearrange, ceilDivideBy, @@ -26,8 +29,6 @@ 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 { makeNatAmountShape } from '../contractSupport.js'; import { makeOfferSpecShape, prepareAuctionBook } from './auctionBook.js'; diff --git a/packages/inter-protocol/src/auction/offerBook.js b/packages/inter-protocol/src/auction/offerBook.js index 77a8eb469370..2e711c3d8dde 100644 --- a/packages/inter-protocol/src/auction/offerBook.js +++ b/packages/inter-protocol/src/auction/offerBook.js @@ -1,8 +1,9 @@ // book of offers to buy liquidating vaults with prices in terms of // discount/markup from the current oracle price. +import { M, mustMatch } from '@endo/patterns'; + import { AmountMath } from '@agoric/ertp'; -import { M, mustMatch } from '@agoric/store'; import { makeScalarBigMapStore, prepareExoClass } from '@agoric/vat-data'; import { diff --git a/packages/inter-protocol/src/auction/params.js b/packages/inter-protocol/src/auction/params.js index a49ecc38ef8c..155b1ed19fad 100644 --- a/packages/inter-protocol/src/auction/params.js +++ b/packages/inter-protocol/src/auction/params.js @@ -1,10 +1,11 @@ +import { M } from '@endo/patterns'; + import { CONTRACT_ELECTORATE, makeParamManager, ParamTypes, } from '@agoric/governance'; import { TimeMath, RelativeTimeRecordShape } from '@agoric/time'; -import { M } from '@agoric/store'; /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').AsyncSpecTuple} AsyncSpecTuple */ /** @typedef {import('@agoric/governance/src/contractGovernance/typedParamManager.js').SyncSpecTuple} SyncSpecTuple */ diff --git a/packages/inter-protocol/src/auction/scheduler.js b/packages/inter-protocol/src/auction/scheduler.js index e78d8645a970..d63d850dfd15 100644 --- a/packages/inter-protocol/src/auction/scheduler.js +++ b/packages/inter-protocol/src/auction/scheduler.js @@ -1,6 +1,13 @@ +import { + redacted as X, + throwRedacted as Fail, + quote as 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'; @@ -11,8 +18,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. @@ -227,7 +232,7 @@ export const makeScheduler = async ( trace('wake step', now); clockTick(liveSchedule); } catch (e) { - console.error(`⚠️ Auction threw ${e}. Caught in PriceStepWaker.`); + makeError(`⚠️ Auction threw ${e}. Caught in PriceStepWaker.`); } }, }), @@ -248,7 +253,7 @@ export const makeScheduler = async ( // eslint-disable-next-line no-use-before-define return startAuction(); } catch (e) { - console.error(`⚠️ Auction threw ${e}. Caught in SchedulerWaker.`); + makeError(`⚠️ Auction threw ${e}. Caught in SchedulerWaker.`); } }, }), @@ -263,7 +268,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 031c73e3ebef..ddc170541972 100644 --- a/packages/inter-protocol/src/auction/sortedOffers.js +++ b/packages/inter-protocol/src/auction/sortedOffers.js @@ -1,10 +1,11 @@ // @jessie-check +import { M, mustMatch } from '@endo/patterns'; + import { makeRatio, ratioToNumber, } from '@agoric/zoe/src/contractSupport/index.js'; -import { M, mustMatch } from '@agoric/store'; import { RatioShape } from '@agoric/ertp'; import { decodeData, encodeData } from '../vaultFactory/storeUtils.js'; diff --git a/packages/inter-protocol/src/contractSupport.js b/packages/inter-protocol/src/contractSupport.js index 59d7c89d5c3c..4b1c3d005e8c 100644 --- a/packages/inter-protocol/src/contractSupport.js +++ b/packages/inter-protocol/src/contractSupport.js @@ -1,7 +1,8 @@ // @jessie-check +import { M } from '@endo/patterns'; + import { AmountMath } from '@agoric/ertp'; -import { M } from '@agoric/store'; import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js'; const { Fail, quote: q } = assert; diff --git a/packages/inter-protocol/src/provisionPool.js b/packages/inter-protocol/src/provisionPool.js index 27a7622cf643..9f3fb772e6df 100644 --- a/packages/inter-protocol/src/provisionPool.js +++ b/packages/inter-protocol/src/provisionPool.js @@ -1,13 +1,14 @@ // @jessie-check // @ts-check +import { M } from '@endo/patterns'; + import { handleParamGovernance, ParamTypes, publicMixinAPI, } from '@agoric/governance'; import { InvitationShape } from '@agoric/governance/src/typeGuards.js'; -import { M } from '@agoric/store'; import { prepareExo } from '@agoric/vat-data'; import { provideSingleton } from '@agoric/zoe/src/contractSupport/durability.js'; import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; diff --git a/packages/inter-protocol/src/provisionPoolKit.js b/packages/inter-protocol/src/provisionPoolKit.js index d5626a522f0e..d8ba8665f96c 100644 --- a/packages/inter-protocol/src/provisionPoolKit.js +++ b/packages/inter-protocol/src/provisionPoolKit.js @@ -1,4 +1,8 @@ // @ts-check +import { E } from '@endo/far'; +import { Far, deeplyFulfilled } from '@endo/marshal'; +import { M } from '@endo/patterns'; + import { AmountMath, BrandShape } from '@agoric/ertp'; import { UnguardedHelperI } from '@agoric/internal/src/typeGuards.js'; import { @@ -7,7 +11,6 @@ import { subscribeEach, } from '@agoric/notifier'; import { - M, makeScalarBigMapStore, makeScalarBigSetStore, prepareExoClassKit, @@ -18,8 +21,6 @@ import { makeRecorderTopic, } from '@agoric/zoe/src/contractSupport/topics.js'; import { InstanceHandleShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/far'; -import { Far, deeplyFulfilled } from '@endo/marshal'; const { details: X, quote: q, Fail } = assert; diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index 3b5413f331d5..9363e601c8a1 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -1,4 +1,12 @@ /* eslint-disable consistent-return */ + +import { + redacted as X, + throwRedacted as Fail, + quote as q, + makeError, +} from '@endo/errors'; + /** * @file Vault Manager object manages vault-based debts for a collateral type. * @@ -65,8 +73,6 @@ import { makePrioritizedVaults } from './prioritizedVaults.js'; import { Phase, prepareVault } from './vault.js'; import { calculateDistributionPlan } from './proceeds.js'; -const { details: X, Fail, quote: q } = assert; - const trace = makeTracer('VM'); /** @@ -410,12 +416,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/test-scheduler.js b/packages/inter-protocol/test/auction/test-scheduler.js index 8591e15317e9..befa44b0b0b9 100644 --- a/packages/inter-protocol/test/auction/test-scheduler.js +++ b/packages/inter-protocol/test/auction/test-scheduler.js @@ -1,12 +1,12 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { objectMap } from '@endo/common/object-map.js'; import { subscribeEach, makePublishKit } from '@agoric/notifier'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; import { TimeMath } from '@agoric/time'; import { prepareMockRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; import { setupZCFTest } from '@agoric/zoe/test/unitTests/zcf/setupZcfTest.js'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; -import { objectMap } from '@agoric/internal'; import { makeAuctioneerParamManager, diff --git a/packages/inter-protocol/test/auction/tools.js b/packages/inter-protocol/test/auction/tools.js index 0c78bfe8c97b..d61cebd6defb 100644 --- a/packages/inter-protocol/test/auction/tools.js +++ b/packages/inter-protocol/test/auction/tools.js @@ -1,7 +1,8 @@ +import { objectMap } from '@endo/common/object-map.js'; import { Far } from '@endo/marshal'; import { E } from '@endo/eventual-send'; import { makeStoredPublisherKit } from '@agoric/notifier'; -import { objectMap, allValues } from '@agoric/internal'; +import { allValues } from '@agoric/internal'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; import { makeFakeMarshaller } from '@agoric/notifier/tools/testSupports.js'; import { GOVERNANCE_STORAGE_KEY } from '@agoric/governance/src/contractHelper.js'; diff --git a/packages/inter-protocol/test/vaultFactory/driver.js b/packages/inter-protocol/test/vaultFactory/driver.js index e3a84aee0b60..b2892f159c29 100644 --- a/packages/inter-protocol/test/vaultFactory/driver.js +++ b/packages/inter-protocol/test/vaultFactory/driver.js @@ -1,7 +1,8 @@ import '@agoric/zoe/exported.js'; +import { objectMap } from '@endo/common/object-map.js'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; -import { allValues, makeTracer, objectMap } from '@agoric/internal'; +import { allValues, makeTracer } from '@agoric/internal'; import { makeNotifierFromSubscriber } from '@agoric/notifier'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { diff --git a/packages/inter-protocol/test/vaultFactory/test-replacePriceAuthority.js b/packages/inter-protocol/test/vaultFactory/test-replacePriceAuthority.js index 66e212477c76..5345973393d9 100644 --- a/packages/inter-protocol/test/vaultFactory/test-replacePriceAuthority.js +++ b/packages/inter-protocol/test/vaultFactory/test-replacePriceAuthority.js @@ -1,8 +1,9 @@ import '@agoric/zoe/exported.js'; import { test as unknownTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { objectMap } from '@endo/common/object-map.js'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { allValues, makeTracer, objectMap } from '@agoric/internal'; +import { allValues, makeTracer } from '@agoric/internal'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; diff --git a/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js b/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js index b6cc4e94a029..e926d6118f34 100644 --- a/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js +++ b/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js @@ -1,12 +1,16 @@ import '@agoric/zoe/exported.js'; import { test as unknownTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { E } from '@endo/eventual-send'; +import { objectMap } from '@endo/common/object-map.js'; +import { M, matches } from '@endo/patterns'; +import { deeplyFulfilled } from '@endo/marshal'; + import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { combine, split } from '@agoric/ertp/src/legacy-payment-helpers.js'; -import { allValues, makeTracer, objectMap } from '@agoric/internal'; +import { allValues, makeTracer } from '@agoric/internal'; import { eventLoopIteration } from '@agoric/internal/src/testing-utils.js'; import { makeNotifierFromAsyncIterable } from '@agoric/notifier'; -import { M, matches } from '@agoric/store'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { ceilMultiplyBy, @@ -20,8 +24,6 @@ import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority import { documentStorageSchema } from '@agoric/governance/tools/storageDoc.js'; import buildManualTimer from '@agoric/zoe/tools/manualTimer.js'; -import { E } from '@endo/eventual-send'; -import { deeplyFulfilled } from '@endo/marshal'; import { calculateCurrentDebt } from '../../src/interest-math.js'; import { SECONDS_PER_YEAR } from '../../src/interest.js'; import { startVaultFactory } from '../../src/proposals/econ-behaviors.js'; diff --git a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js index 50d4030f733d..d222a91ca9c1 100644 --- a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js +++ b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js @@ -1,8 +1,9 @@ import '@agoric/zoe/exported.js'; import { test as unknownTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { objectMap } from '@endo/common/object-map.js'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { allValues, makeTracer, objectMap } from '@agoric/internal'; +import { allValues, makeTracer } from '@agoric/internal'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; import { ceilMultiplyBy, diff --git a/packages/internal/package.json b/packages/internal/package.json index ff609e38e2f1..0c3ddfee8c1c 100755 --- a/packages/internal/package.json +++ b/packages/internal/package.json @@ -22,6 +22,7 @@ "dependencies": { "@agoric/assert": "^0.6.0", "@agoric/base-zone": "^0.1.0", + "@endo/errors": "^1.0.2", "@endo/far": "^1.0.2", "@endo/init": "^1.0.2", "@endo/marshal": "^1.1.0", diff --git a/packages/internal/src/callback.js b/packages/internal/src/callback.js index e2ef9e1b8064..60935d8e5ddc 100644 --- a/packages/internal/src/callback.js +++ b/packages/internal/src/callback.js @@ -1,10 +1,9 @@ // @ts-check +import { throwRedacted as Fail, quote as q, makeError } from '@endo/errors'; import { E } from '@endo/far'; import { isObject, isPassableSymbol } from '@endo/marshal'; import { getInterfaceMethodKeys } from '@endo/patterns'; -const { Fail, quote: q } = assert; - const { fromEntries } = Object; const { ownKeys: rawOwnKeys } = Reflect; @@ -227,9 +226,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/utils.js b/packages/internal/src/utils.js index 08a1adbdb968..c706fe62c7bf 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -1,48 +1,25 @@ // @ts-check // @jessie-check +import { + quote as q, + throwRedacted as Fail, + redacted as X, + makeError, + note as errorNote, +} from '@endo/errors'; + import { deeplyFulfilled, isObject } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; import { makeQueue } from '@endo/stream'; -import { asyncGenerate, makeSet } from 'jessie.js'; +import { asyncGenerate } from 'jessie.js'; const { fromEntries, keys, values } = Object; -const { ownKeys } = Reflect; - -const { quote: q, Fail } = assert; export const BASIS_POINTS = 10_000n; /** @template T @typedef {import('@endo/eventual-send').ERef} ERef */ -/** - * Throws if multiple entries use the same property name. Otherwise acts - * like `Object.fromEntries` but hardens the result. - * Use it to protect from property names computed from user-provided data. - * - * @template K,V - * @param {Iterable<[K,V]>} allEntries - * @returns {{[k: K]: V}} - */ -export const fromUniqueEntries = allEntries => { - const entriesArray = [...allEntries]; - const result = harden(fromEntries(entriesArray)); - if (ownKeys(result).length === entriesArray.length) { - return result; - } - const names = makeSet(); - for (const [name, _] of entriesArray) { - if (names.has(name)) { - Fail`collision on property name ${q(name)}: ${entriesArray}`; - } - names.add(name); - } - throw Fail`internal: failed to create object from unique entries`; -}; -harden(fromUniqueEntries); - -export { objectMap } from '@endo/patterns'; - /** * @template T * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify @@ -140,7 +117,8 @@ export const PromiseAllOrErrors = async items => { * trier: () => Promise, * finalizer: (error?: unknown) => Promise, * ) => Promise} - */ export const aggregateTryFinally = async (trier, finalizer) => + */ +export const aggregateTryFinally = async (trier, finalizer) => trier().then( async result => finalizer().then(() => result), async tryError => @@ -166,7 +144,6 @@ export const PromiseAllOrErrors = async items => { * @throws if any value in the object entries is not defined * @returns {asserts obj is AllDefined} */ - export const assertAllDefined = obj => { const missing = []; for (const [key, val] of Object.entries(obj)) { @@ -277,8 +254,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(X`Teed stream threw`); + errorNote(error, X`Teed rejections: ${rejections}`); result = sourceStream.throw?.(error) || Promise.resolve(sourceStream.return?.()).then(() => diff --git a/packages/internal/test/test-utils.js b/packages/internal/test/test-utils.js index ffced4aa0ed2..5126686a6fb7 100644 --- a/packages/internal/test/test-utils.js +++ b/packages/internal/test/test-utils.js @@ -3,8 +3,6 @@ import test from 'ava'; import { Far } from '@endo/far'; import { - fromUniqueEntries, - objectMap, makeMeasureSeconds, assertAllDefined, whileTrue, @@ -14,51 +12,6 @@ import { synchronizedTee, } from '../src/utils.js'; -test('fromUniqueEntries', t => { - /** @type {[string | symbol, number][]} */ - const goodEntries = [ - ['a', 7], - ['b', 8], - [Symbol.hasInstance, 9], - ]; - const goodObj1 = Object.fromEntries(goodEntries); - t.deepEqual(goodObj1, { - a: 7, - b: 8, - [Symbol.hasInstance]: 9, - }); - const goodObj2 = fromUniqueEntries(goodEntries); - t.deepEqual(goodObj2, goodObj1); - - /** @type {[string | symbol, number][]} */ - const badEntries = [ - ['a', 7], - ['a', 8], - [Symbol.hasInstance, 9], - ]; - const badObj = Object.fromEntries(badEntries); - t.deepEqual(badObj, { - a: 8, - [Symbol.hasInstance]: 9, - }); - t.throws(() => fromUniqueEntries(badEntries), { - message: /^collision on property name "a": .*$/, - }); -}); - -test('objectMap', t => { - // @ts-expect-error - t.throws(() => objectMap({ a: 1 }), { message: 'mapFn is not a function' }); - t.deepEqual( - objectMap({ a: 1 }, val => val * 2), - { a: 2 }, - ); - t.deepEqual( - objectMap({ a: 1 }, (val, key) => `${key}:${val}`), - { a: 'a:1' }, - ); -}); - test('deeplyFulfilledObject', async t => { const someFar = Far('somefar', { getAsync: () => Promise.resolve('async') }); const unfulfilled = harden({ diff --git a/packages/notifier/package.json b/packages/notifier/package.json index 0bf4015a4c5f..0cfaa0ca6208 100644 --- a/packages/notifier/package.json +++ b/packages/notifier/package.json @@ -36,6 +36,7 @@ "@agoric/assert": "^0.6.0", "@agoric/internal": "^0.3.2", "@agoric/vat-data": "^0.5.2", + "@endo/errors": "^1.0.2", "@endo/far": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/patterns": "^1.1.0", diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index e35fa153cfab..1b4dc71a16a0 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -1,10 +1,14 @@ +import { + redacted as X, + throwRedacted as Fail, + note as errorNote, +} from '@endo/errors'; import { E, Far } from '@endo/far'; import { isObject } from '@endo/marshal'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; import './types-ambient.js'; -const { details: X, Fail } = assert; const sink = () => {}; /** @@ -45,7 +49,7 @@ const reconnectAsNeeded = async (getter, seed = []) => { // for which it is a result. if (isObject(err) && disconnection && disconnection !== err) { try { - assert.note( + errorNote( err, X`Attempting to recover from disconnection: ${disconnection}`, ); diff --git a/packages/pegasus/package.json b/packages/pegasus/package.json index b62699d74378..885925ca145d 100644 --- a/packages/pegasus/package.json +++ b/packages/pegasus/package.json @@ -39,6 +39,7 @@ "@agoric/zoe": "^0.26.2", "@endo/bundle-source": "^3.0.2", "@endo/captp": "^4.0.2", + "@endo/errors": "^1.0.2", "@endo/far": "^1.0.2", "@endo/init": "^1.0.2", "@endo/nat": "^5.0.2", diff --git a/packages/pegasus/src/ics20.js b/packages/pegasus/src/ics20.js index df96c2d8f4ce..9c5310372011 100644 --- a/packages/pegasus/src/ics20.js +++ b/packages/pegasus/src/ics20.js @@ -1,7 +1,12 @@ // @ts-check import { Nat } from '@endo/nat'; import { Far } from '@endo/far'; -import { assert, details as X, Fail } from '@agoric/assert'; +import { + assert, + redacted as X, + throwRedacted as Fail, + note as errorNote, +} from '@endo/errors'; /** * @typedef {object} ICS20TransferPacket Packet shape defined at: @@ -30,7 +35,7 @@ const safeJSONParseObject = s => { try { obj = JSON.parse(s); } catch (e) { - assert.note(e, X`${s} is not valid JSON`); + errorNote(e, X`${s} is not valid JSON`); throw e; } if (typeof obj !== 'object') { diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js index 9fcc7a27fe8e..92fb1b9a27f4 100644 --- a/packages/pegasus/src/pegasus.js +++ b/packages/pegasus/src/pegasus.js @@ -1,8 +1,14 @@ // @ts-check -import { assert, details as X, Fail } from '@agoric/assert'; -import { makeLegacyWeakMap, makeLegacyMap } from '@agoric/store'; +import { + assert, + redacted as X, + throwRedacted as Fail, + makeError, +} from '@endo/errors'; import { E, Far } from '@endo/far'; + +import { makeLegacyWeakMap, makeLegacyMap } from '@agoric/store'; import { assertProposalShape, atomicTransfer, @@ -144,7 +150,7 @@ const makePegasus = (zcf, board, namesByAddress) => { // 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); @@ -422,7 +428,7 @@ const makePegasus = (zcf, board, namesByAddress) => { 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/same-structure/CHANGELOG.md b/packages/same-structure/CHANGELOG.md deleted file mode 100644 index 36f1b54921d5..000000000000 --- a/packages/same-structure/CHANGELOG.md +++ /dev/null @@ -1,496 +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.2.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.6...@agoric/same-structure@0.2.7) (2023-06-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.5...@agoric/same-structure@0.2.6) (2023-05-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.3...@agoric/same-structure@0.2.5) (2023-05-19) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.3...@agoric/same-structure@0.2.4) (2023-02-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.2...@agoric/same-structure@0.2.3) (2022-10-05) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.1...@agoric/same-structure@0.2.2) (2022-09-20) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.2.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.2.0...@agoric/same-structure@0.2.1) (2022-05-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.2.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.31...@agoric/same-structure@0.2.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.1.31](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.30...@agoric/same-structure@0.1.31) (2022-02-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.30](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.29...@agoric/same-structure@0.1.30) (2022-02-21) - - -### Bug Fixes - -* extract early changes from PR 4136 ([#4190](https://github.com/Agoric/agoric-sdk/issues/4190)) ([fea822e](https://github.com/Agoric/agoric-sdk/commit/fea822ec75c27c8758b872730424c0a3f1a1c623)) - - - -### [0.1.29](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.28...@agoric/same-structure@0.1.29) (2021-12-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.28](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.27...@agoric/same-structure@0.1.28) (2021-10-13) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.27](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.26...@agoric/same-structure@0.1.27) (2021-09-23) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.26](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.25...@agoric/same-structure@0.1.26) (2021-09-15) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.25](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.24...@agoric/same-structure@0.1.25) (2021-08-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.24](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.23...@agoric/same-structure@0.1.24) (2021-08-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.23](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.23) (2021-08-15) - - -### Bug Fixes - -* **same-structure:** Support NESM importers ([123227e](https://github.com/Agoric/agoric-sdk/commit/123227eb83c520b9c64506d2f898815163b4e9e0)) - -### 0.26.10 (2021-07-28) - - - -### [0.1.22](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.22) (2021-08-14) - - -### Bug Fixes - -* **same-structure:** Support NESM importers ([123227e](https://github.com/Agoric/agoric-sdk/commit/123227eb83c520b9c64506d2f898815163b4e9e0)) - -### 0.26.10 (2021-07-28) - - - -### [0.1.21](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.20...@agoric/same-structure@0.1.21) (2021-07-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.20](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.19...@agoric/same-structure@0.1.20) (2021-07-01) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.19](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.18...@agoric/same-structure@0.1.19) (2021-06-28) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.18](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.17...@agoric/same-structure@0.1.18) (2021-06-25) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.17](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.16...@agoric/same-structure@0.1.17) (2021-06-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.16](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.15...@agoric/same-structure@0.1.16) (2021-06-23) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.15](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.14...@agoric/same-structure@0.1.15) (2021-06-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -### [0.1.14](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.13...@agoric/same-structure@0.1.14) (2021-06-15) - - -### Bug Fixes - -* Pin ESM to forked version ([54dbb55](https://github.com/Agoric/agoric-sdk/commit/54dbb55d64d7ff7adb395bc4bd9d1461dd2d3c17)) - - - -## [0.1.13](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.12...@agoric/same-structure@0.1.13) (2021-05-10) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.11...@agoric/same-structure@0.1.12) (2021-05-05) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.10...@agoric/same-structure@0.1.11) (2021-05-05) - - -### Bug Fixes - -* settle REMOTE_STYLE name ([#2900](https://github.com/Agoric/agoric-sdk/issues/2900)) ([3dc6638](https://github.com/Agoric/agoric-sdk/commit/3dc66385b85cb3e8a1056b8d6e64cd3e448c041f)) -* split marshal module ([#2803](https://github.com/Agoric/agoric-sdk/issues/2803)) ([2e19e78](https://github.com/Agoric/agoric-sdk/commit/2e19e7878bc06dd71e166e13c9cce462b3d5ff7a)) - - - - - -## [0.1.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.9...@agoric/same-structure@0.1.10) (2021-04-22) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.8...@agoric/same-structure@0.1.9) (2021-04-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.7...@agoric/same-structure@0.1.8) (2021-04-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.7](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.6...@agoric/same-structure@0.1.7) (2021-04-14) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.5...@agoric/same-structure@0.1.6) (2021-04-07) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.4...@agoric/same-structure@0.1.5) (2021-04-06) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.3...@agoric/same-structure@0.1.4) (2021-03-24) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.2...@agoric/same-structure@0.1.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) - - - - - -## [0.1.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.1...@agoric/same-structure@0.1.2) (2021-02-22) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.1.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.1.0...@agoric/same-structure@0.1.1) (2021-02-16) - - -### Bug Fixes - -* review comments ([7db7e5c](https://github.com/Agoric/agoric-sdk/commit/7db7e5c4c569dfedff8d748dd58893218b0a2458)) -* use assert rather than FooError constructors ([f860c5b](https://github.com/Agoric/agoric-sdk/commit/f860c5bf5add165a08cb5bd543502857c3f57998)) - - - - - -# [0.1.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.12...@agoric/same-structure@0.1.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.0.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.12-dev.0...@agoric/same-structure@0.0.12) (2020-11-07) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.12-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11...@agoric/same-structure@0.0.12-dev.0) (2020-10-19) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.2...@agoric/same-structure@0.0.11) (2020-10-11) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.1...@agoric/same-structure@0.0.11-dev.2) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.11-dev.0...@agoric/same-structure@0.0.11-dev.1) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.11-dev.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.10...@agoric/same-structure@0.0.11-dev.0) (2020-09-18) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.10](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.9...@agoric/same-structure@0.0.10) (2020-09-16) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.9](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.8...@agoric/same-structure@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)) -* use REMOTE_STYLE rather than 'presence' to prepare ([#1577](https://github.com/Agoric/agoric-sdk/issues/1577)) ([6b97ae8](https://github.com/Agoric/agoric-sdk/commit/6b97ae8670303631313a65d12393d7ad226b941d)) - - - - - -## [0.0.8](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.7...@agoric/same-structure@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/same-structure@0.0.6...@agoric/same-structure@0.0.7) (2020-05-17) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.6](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.5...@agoric/same-structure@0.0.6) (2020-05-10) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.5](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.4...@agoric/same-structure@0.0.5) (2020-05-04) - - -### Bug Fixes - -* use the new (typed) harden package ([2eb1af0](https://github.com/Agoric/agoric-sdk/commit/2eb1af08fe3967629a3ce165752fd501a5c85a96)) - - - - - -## [0.0.4](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.4-alpha.0...@agoric/same-structure@0.0.4) (2020-04-13) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.4-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.3...@agoric/same-structure@0.0.4-alpha.0) (2020-04-12) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.3-alpha.0...@agoric/same-structure@0.0.3) (2020-04-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## [0.0.3-alpha.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/same-structure@0.0.2...@agoric/same-structure@0.0.3-alpha.0) (2020-04-02) - -**Note:** Version bump only for package @agoric/same-structure - - - - - -## 0.0.2 (2020-03-26) - - -### Bug Fixes - -* first draft use collection equality ([6acbde7](https://github.com/Agoric/agoric-sdk/commit/6acbde71ec82101ec8da9eaafc729bab1fdd6df9)) diff --git a/packages/same-structure/CONTRIBUTING.md b/packages/same-structure/CONTRIBUTING.md deleted file mode 100644 index 6012771398bb..000000000000 --- a/packages/same-structure/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 [same-structure] -prefix to the title and `same-structure` tag to same-structure-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/same-structure` -* `yarn test` - -## Pull Requests - -Before submitting a pull request, please: - -* run `yarn test` within `packages/same-structure` 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 same-structure-v$VERSION -m "same-structure-v$VERSION"` -* `yarn publish --access public` -* `git push` -* `git push origin same-structure-v$VERSION` diff --git a/packages/same-structure/NEWS.md b/packages/same-structure/NEWS.md deleted file mode 100644 index 2f20818b6782..000000000000 --- a/packages/same-structure/NEWS.md +++ /dev/null @@ -1,31 +0,0 @@ -User-visible changes in @agoric/same-structure: - -## Next Release - -This entire package is now deprecated, with its code migrated -to `@agoric/store` with the exports renamed to their modern -names. This package remains for now in order to -re-export the new names from `@agoric/store` under the old -deprecated names that this package used to export. Please update -uses to the new names as imported from `@agoric/store`. -```js -import { - sameStructure, - isComparable, - mustBeComparable, - allComparable, -} from '@agoric/same-structure'; -``` -to -```js -import { - keyEQ, - isKey, - assertKey, - fulfillToKey, -} from '@endo/marshal'; - -## Release 0.0.1 (3-Feb-2020) - -Moved out of ERTP and created new package `@agoric/same-structure`. -Now depends on `@agoric/insist`. diff --git a/packages/same-structure/README.md b/packages/same-structure/README.md deleted file mode 100644 index eea59758c4c9..000000000000 --- a/packages/same-structure/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Same Structure - -Deprecated. See [NEWS.md](./NEWS.md) diff --git a/packages/same-structure/index.js b/packages/same-structure/index.js deleted file mode 100644 index b6d9602d45de..000000000000 --- a/packages/same-structure/index.js +++ /dev/null @@ -1,24 +0,0 @@ -// This entire package is now deprecated, with its code migrated -// to `@endo/marshal` and `@agoric/store` with the exports renamed to their -// modern names. -// -// This package remains for now in order to -// re-export the new names from `@endo/marshal` and `@agoric/store` under -// the old deprecated names that this package used to export. Please update -// uses to the new names as imported from `@endo/marshal` -// and`@agoric/store`. - -import { keyEQ, isKey, assertKey } from '@agoric/store'; -import { deeplyFulfilled } from '@endo/marshal'; - -/** @deprecated Use `keyEQ` from `'@agoric/store'` */ -export const sameStructure = keyEQ; - -/** @deprecated Use `isKey` from `'@agoric/store'` */ -export const isComparable = isKey; - -/** @deprecated Use `assertKey` from `'@agoric/store'` */ -export const mustBeComparable = assertKey; - -/** @deprecated Use `deeplyFulfilled` from `'@endo/marshal'` */ -export const allComparable = deeplyFulfilled; diff --git a/packages/same-structure/package.json b/packages/same-structure/package.json deleted file mode 100644 index e82af41200b4..000000000000 --- a/packages/same-structure/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@agoric/same-structure", - "version": "0.2.7", - "description": "Deep equals", - "type": "module", - "main": "index.js", - "engines": { - "node": ">=14.15.0" - }, - "scripts": { - "build": "exit 0", - "test": "exit 0", - "test:xs": "exit 0", - "lint": "run-s --continue-on-error lint:*", - "lint-fix": "yarn lint:eslint --fix", - "lint:eslint": "eslint ." - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Agoric/agoric-sdk.git" - }, - "keywords": [ - "deepEquals", - "equals" - ], - "author": "Agoric", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/Agoric/agoric-sdk/issues" - }, - "homepage": "https://github.com/Agoric/agoric-sdk#readme", - "dependencies": { - "@agoric/assert": "^0.6.0", - "@agoric/store": "^0.9.2", - "@endo/marshal": "^1.1.0" - }, - "files": [ - "*.js", - "NEWS.md" - ], - "publishConfig": { - "access": "public" - }, - "typeCoverage": { - "atLeast": 100 - } -} diff --git a/packages/same-structure/tsconfig.json b/packages/same-structure/tsconfig.json deleted file mode 100644 index d5d92ea21eb8..000000000000 --- a/packages/same-structure/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -// This file can contain .js-specific Typescript compiler config. -{ - "extends": "../../tsconfig.json", - "include": [ - "*.js", - "scripts/**/*.js", - "src/**/*.js", - "test/**/*.js", - ], -} diff --git a/packages/smart-wallet/package.json b/packages/smart-wallet/package.json index 89c5dfdb4f50..1b592608ef33 100644 --- a/packages/smart-wallet/package.json +++ b/packages/smart-wallet/package.json @@ -34,10 +34,12 @@ "@agoric/vat-data": "^0.5.2", "@agoric/vats": "^0.15.1", "@agoric/zoe": "^0.26.2", + "@endo/common": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/far": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2" }, "files": [ diff --git a/packages/smart-wallet/src/invitations.js b/packages/smart-wallet/src/invitations.js index a5fcc32557db..517ad6c0d603 100644 --- a/packages/smart-wallet/src/invitations.js +++ b/packages/smart-wallet/src/invitations.js @@ -1,7 +1,8 @@ +import { E } from '@endo/far'; +import { mustMatch } from '@endo/patterns'; + import { AmountMath } from '@agoric/ertp'; -import { mustMatch } from '@agoric/store'; import { InvitationHandleShape } from '@agoric/zoe/src/typeGuards.js'; -import { E } from '@endo/far'; import { shape } from './typeGuards.js'; // Ambient types. Needed only for dev but this does a runtime import. diff --git a/packages/smart-wallet/src/offerWatcher.js b/packages/smart-wallet/src/offerWatcher.js index 85ea20619527..44b6e6b60e11 100644 --- a/packages/smart-wallet/src/offerWatcher.js +++ b/packages/smart-wallet/src/offerWatcher.js @@ -1,14 +1,15 @@ +import { objectMap } from '@endo/common/object-map.js'; import { E, passStyleOf } from '@endo/far'; +import { M } from '@endo/patterns'; +import { deeplyFulfilledObject } from '@agoric/internal'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; import { prepareExoClassKit, watchPromise } from '@agoric/vat-data'; -import { M } from '@agoric/store'; import { PaymentPKeywordRecordShape, SeatShape, } from '@agoric/zoe/src/typeGuards.js'; import { AmountShape } from '@agoric/ertp/src/typeGuards.js'; -import { deeplyFulfilledObject, objectMap } from '@agoric/internal'; import { UNPUBLISHED_RESULT } from './offers.js'; diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js index d677ab5b86ff..20c0d1b56c7c 100644 --- a/packages/smart-wallet/src/smartWallet.js +++ b/packages/smart-wallet/src/smartWallet.js @@ -1,3 +1,4 @@ +import { objectMap } from '@endo/common/object-map.js'; import { E } from '@endo/far'; import { AmountShape, @@ -10,7 +11,6 @@ import { import { deeplyFulfilledObject, makeTracer, - objectMap, StorageNodeShape, } from '@agoric/internal'; import { observeNotifier } from '@agoric/notifier'; diff --git a/packages/smart-wallet/src/utils.js b/packages/smart-wallet/src/utils.js index d89155ea8a52..e832538d7738 100644 --- a/packages/smart-wallet/src/utils.js +++ b/packages/smart-wallet/src/utils.js @@ -1,5 +1,6 @@ /* eslint-disable no-undef-init */ -import { deeplyFulfilledObject, objectMap, makeTracer } from '@agoric/internal'; +import { objectMap } from '@endo/common/object-map.js'; +import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; import { observeIteration, subscribeEach } from '@agoric/notifier'; import { E } from '@endo/far'; diff --git a/packages/solo/package.json b/packages/solo/package.json index 126c178a8ff4..10262abad334 100644 --- a/packages/solo/package.json +++ b/packages/solo/package.json @@ -37,6 +37,7 @@ "@agoric/vats": "^0.15.1", "@agoric/wallet": "^0.18.3", "@endo/captp": "^4.0.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/import-bundle": "^1.0.2", "@endo/init": "^1.0.2", diff --git a/packages/solo/src/chain-cosmos-sdk.js b/packages/solo/src/chain-cosmos-sdk.js index 573ef5336451..d929a00cbb78 100644 --- a/packages/solo/src/chain-cosmos-sdk.js +++ b/packages/solo/src/chain-cosmos-sdk.js @@ -9,10 +9,11 @@ import { open as tempOpen } from 'temp'; import WebSocket from 'ws'; import anylogger from 'anylogger'; -import { makeNotifierKit } from '@agoric/notifier'; + +import { throwRedacted as Fail, makeError } from '@endo/errors'; import { makePromiseKit } from '@endo/promise-kit'; -import { assert, Fail } from '@agoric/assert'; +import { makeNotifierKit } from '@agoric/notifier'; import { DEFAULT_BATCH_TIMEOUT_MS, makeBatchedDeliver, @@ -698,13 +699,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/pipe-entrypoint.js b/packages/solo/src/pipe-entrypoint.js index 0914ccfa36eb..0096a0faa3a5 100644 --- a/packages/solo/src/pipe-entrypoint.js +++ b/packages/solo/src/pipe-entrypoint.js @@ -3,6 +3,7 @@ import '@endo/init/pre-bundle-source.js'; import '@endo/init/unsafe-fast.js'; +import { makeError } from '@endo/errors'; import { parse, stringify } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; @@ -51,7 +52,7 @@ const main = async () => { break; } default: { - assert.error(`unknown method ${method}`); + makeError(`unknown method ${method}`); } } diff --git a/packages/store/package.json b/packages/store/package.json index 2c94e9dc631e..66247b90d991 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -31,6 +31,7 @@ "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { "@agoric/assert": "^0.6.0", + "@endo/errors": "^1.0.2", "@endo/exo": "^1.1.0", "@endo/marshal": "^1.1.0", "@endo/pass-style": "^1.1.0", diff --git a/packages/store/src/index.js b/packages/store/src/index.js index 7cafb3cb1491..c3fafcf88865 100755 --- a/packages/store/src/index.js +++ b/packages/store/src/index.js @@ -1,3 +1,13 @@ +export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js'; +export { makeScalarSetStore } from './stores/scalarSetStore.js'; +export { makeScalarWeakMapStore } from './stores/scalarWeakMapStore.js'; +export { makeScalarMapStore } from './stores/scalarMapStore.js'; + +export { provideLazy } from './stores/store-utils.js'; + +// /////////////////////// Deprecated Re-exports /////////////////////////////// +// Importers should import directly from the packages shown below + export { isKey, assertKey, @@ -42,6 +52,8 @@ export { assertPattern, matches, mustMatch, + isCopyMap, + isCopySet, } from '@endo/patterns'; export { @@ -51,13 +63,6 @@ export { makeExo, } from '@endo/exo'; -export { makeScalarWeakSetStore } from './stores/scalarWeakSetStore.js'; -export { makeScalarSetStore } from './stores/scalarSetStore.js'; -export { makeScalarWeakMapStore } from './stores/scalarWeakMapStore.js'; -export { makeScalarMapStore } from './stores/scalarMapStore.js'; - -export { provideLazy, isCopyMap, isCopySet } from './stores/store-utils.js'; - // /////////////////////// Deprecated Legacy /////////////////////////////////// export { makeLegacyMap } from './legacy/legacyMap.js'; diff --git a/packages/store/src/stores/scalarMapStore.js b/packages/store/src/stores/scalarMapStore.js index 4440e2dc81c0..97c0ed66eefa 100644 --- a/packages/store/src/stores/scalarMapStore.js +++ b/packages/store/src/stores/scalarMapStore.js @@ -1,3 +1,4 @@ +import { quote as q } from '@endo/errors'; import { Far, assertPassable, @@ -15,8 +16,6 @@ import { import { makeWeakMapStoreMethods } from './scalarWeakMapStore.js'; import { makeCurrentKeysKit } from './store-utils.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 11146e5f28cc..72ffdb24d6f4 100644 --- a/packages/store/src/stores/scalarSetStore.js +++ b/packages/store/src/stores/scalarSetStore.js @@ -1,3 +1,4 @@ +import { quote as q } from '@endo/errors'; import { Far, filterIterable } from '@endo/pass-style'; import { compareRank } from '@endo/marshal'; import { @@ -10,8 +11,6 @@ import { import { makeWeakSetStoreMethods } from './scalarWeakSetStore.js'; import { makeCurrentKeysKit } from './store-utils.js'; -const { quote: q } = assert; - /** * @template K * @param {Set} jsset diff --git a/packages/store/src/stores/scalarWeakMapStore.js b/packages/store/src/stores/scalarWeakMapStore.js index 9bd3db548230..5e99eee813d1 100644 --- a/packages/store/src/stores/scalarWeakMapStore.js +++ b/packages/store/src/stores/scalarWeakMapStore.js @@ -1,8 +1,11 @@ +import { quote as q, throwRedacted as Fail } from '@endo/errors'; import { Far, assertPassable, passStyleOf } from '@endo/pass-style'; -import { getCopyMapEntries, mustMatch, assertPattern } from '@endo/patterns'; -import { isCopyMap } from './store-utils.js'; - -const { quote: q, Fail } = assert; +import { + getCopyMapEntries, + mustMatch, + assertPattern, + isCopyMap, +} from '@endo/patterns'; /** * @template K,V diff --git a/packages/store/src/stores/scalarWeakSetStore.js b/packages/store/src/stores/scalarWeakSetStore.js index 4a256ba9207b..1d4a78f00d18 100644 --- a/packages/store/src/stores/scalarWeakSetStore.js +++ b/packages/store/src/stores/scalarWeakSetStore.js @@ -1,8 +1,11 @@ +import { quote as q, throwRedacted as Fail } from '@endo/errors'; import { Far, passStyleOf } from '@endo/pass-style'; -import { getCopySetKeys, mustMatch, assertPattern } from '@endo/patterns'; -import { isCopySet } from './store-utils.js'; - -const { quote: q, Fail } = assert; +import { + getCopySetKeys, + mustMatch, + assertPattern, + isCopySet, +} from '@endo/patterns'; /** * @template K diff --git a/packages/store/src/stores/store-utils.js b/packages/store/src/stores/store-utils.js index b6a359bbce8a..a474f06dc098 100644 --- a/packages/store/src/stores/store-utils.js +++ b/packages/store/src/stores/store-utils.js @@ -1,34 +1,8 @@ +import { quote as q, throwRedacted as Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; -import { M, matches } from '@endo/patterns'; /** @typedef {import('@endo/marshal').RankCompare} RankCompare */ -const { Fail, quote: q } = assert; - -// TODO: Undate `@endo/patterns` to export the original, and delete the -// reimplementation here. -/** - * Should behave identically to the one in `@endo/patterns`, but reimplemented - * for now because `@endo/patterns` forgot to export this one. This one is - * simple enough that I prefer a reimplementation to a deep import. - * - * @param {Passable} s - * @returns {s is CopySet} - */ -export const isCopySet = s => matches(s, M.set()); - -// TODO: Undate `@endo/patterns` to export the original, and delete the -// reimplementation here. -/** - * Should behave identically to the one in `@endo/patterns`, but reimplemented - * for now because `@endo/patterns` forgot to export this one. This one is - * simple enough that I prefer a reimplementation to a deep import. - * - * @param {Passable} m - * @returns {m is CopyMap} - */ -export const isCopyMap = m => matches(m, M.map()); - /** * @template K,V * @typedef {object} CurrentKeysKit diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index 18866dc3c6be..c1bfbf5269b0 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -20,6 +20,7 @@ "@agoric/assert": "^0.6.0", "@agoric/internal": "^0.3.2", "@agoric/store": "^0.9.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/exo": "^1.1.0", "@endo/far": "^1.0.2", diff --git a/packages/swingset-liveslots/src/collectionManager.js b/packages/swingset-liveslots/src/collectionManager.js index 9b05c53075fd..6a0714f89170 100644 --- a/packages/swingset-liveslots/src/collectionManager.js +++ b/packages/swingset-liveslots/src/collectionManager.js @@ -17,8 +17,10 @@ import { getRankCover, getCopyMapEntries, getCopySetKeys, + isCopyMap, + isCopySet, } from '@endo/patterns'; -import { isCopyMap, isCopySet } from '@agoric/store'; + import { makeBaseRef, parseVatSlot } from './parseVatSlots.js'; import { enumerateKeysStartEnd, diff --git a/packages/swingset-liveslots/src/liveslots.js b/packages/swingset-liveslots/src/liveslots.js index 1474a5d0dd52..230dc3058d71 100644 --- a/packages/swingset-liveslots/src/liveslots.js +++ b/packages/swingset-liveslots/src/liveslots.js @@ -1,13 +1,20 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { + assert, + redacted as X, + throwRedacted as Fail, + makeError, + note as errorNote, +} from '@endo/errors'; +import { isPromise } from '@endo/promise-kit'; +import { E, HandledPromise } from '@endo/eventual-send'; import { Remotable, passStyleOf, getInterfaceOf, makeMarshal, } from '@endo/marshal'; -import { assert, Fail } from '@agoric/assert'; -import { isPromise } from '@endo/promise-kit'; -import { E, HandledPromise } from '@endo/eventual-send'; + import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js'; import { insistCapData } from './capdata.js'; import { extractMethod, legibilizeMethod } from './kdebug.js'; @@ -20,8 +27,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 @@ -749,8 +754,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}`); + errorNote(wrappedError, X`Original error: ${err}`); throw wrappedError; } if (facet !== undefined) { diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index f5d59914e2c6..6d54c322c865 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -1,11 +1,17 @@ /* global globalThis */ /* eslint-disable no-use-before-define, jsdoc/require-returns-type */ -import { assert, Fail } from '@agoric/assert'; -import { assertPattern, mustMatch } from '@agoric/store'; +import { + assert, + throwRedacted as Fail, + quote as q, + bare as b, +} from '@endo/errors'; +import { assertPattern, mustMatch } from '@endo/patterns'; import { defendPrototype, defendPrototypeKit } from '@endo/exo/tools.js'; import { Far, passStyleOf } from '@endo/marshal'; import { Nat } from '@endo/nat'; + import { parseVatSlot, makeBaseRef } from './parseVatSlots.js'; import { enumerateKeysWithPrefix } from './vatstore-iterators.js'; import { makeCache } from './cache.js'; @@ -17,23 +23,9 @@ import { /** @template T @typedef {import('@agoric/vat-data').DefineKindOptions} DefineKindOptions */ /** - * @typedef {( - * representative: any - * ) => import('@endo/exo/src/exo-tools.js').ClassContext | undefined} ClassContextProvider - * Definition only temporarily copied from exo-tools.js to here. - * TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` incorporating - * https://github.com/endojs/endo/pull/1966 - * then replace with the following (fixing the implied "@") - * - * at-typedef {import('@endo/exo/src/exo-tools.js').ClassContextProvider } ClassContextProvider + * @typedef {import('@endo/exo/src/exo-tools.js').ClassContextProvider } ClassContextProvider * - * @typedef {(facet: any) => import('@endo/exo/src/exo-tools.js').KitContext | undefined} KitContextProvider - * Definition only temporarily copied from exo-tools.js to here. - * TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` incorporating - * https://github.com/endojs/endo/pull/1966 - * then replace with the following (fixing the implied "@") - * - * at-typedef {import('@endo/exo/src/exo-tools.js').KitContextProvider } KitContextProvider + * @typedef {import('@endo/exo/src/exo-tools.js').KitContextProvider } KitContextProvider */ /** @@ -43,16 +35,6 @@ import { const { hasOwn, defineProperty, getOwnPropertyNames, entries, fromEntries } = Object; const { ownKeys } = Reflect; -const { quote: q } = assert; - -// See https://github.com/Agoric/agoric-sdk/issues/8005 -// Once agoric-sdk is upgraded to depend on endo post -// https://github.com/endojs/endo/pull/1606 then remove this -// definition of `b` and say instead -// ```js -// const { quote: q, base: b } = assert; -// ``` -const b = index => q(Number(index)); // import { kdebug } from './kdebug.js'; @@ -1005,15 +987,6 @@ export const makeVirtualObjectManager = ( proto = defendPrototypeKit( tag, - // TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` - // incorporating https://github.com/endojs/endo/pull/1966 - // Then the following at-ts-ignore will no longer be needed. - // However, it is an at-ts-ignore rather than an - // at-ts-expect-error to be compat with endo both before and - // after, until we're safely across the transition. - // - // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error - // @ts-ignore harden(contextProviderKit), behavior, thisfulMethods, @@ -1028,15 +1001,6 @@ export const makeVirtualObjectManager = ( }; proto = defendPrototype( tag, - // TODO Once agoric-sdk is upgraded to depend on an `@endo/exo` - // incorporating https://github.com/endojs/endo/pull/1966 - // Then the following at-ts-ignore will no longer be needed. - // However, it is an at-ts-ignore rather than an - // at-ts-expect-error to be compat with endo both before and - // after, until we're safely across the transition. - // - // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error - // @ts-ignore harden(contextProvider), behavior, thisfulMethods, diff --git a/packages/swingset-liveslots/src/watchedPromises.js b/packages/swingset-liveslots/src/watchedPromises.js index c6dcc80979b5..c6a20063a66f 100644 --- a/packages/swingset-liveslots/src/watchedPromises.js +++ b/packages/swingset-liveslots/src/watchedPromises.js @@ -3,8 +3,9 @@ /* eslint-disable no-lonely-if */ import { assert } from '@agoric/assert'; -import { initEmpty, M } from '@agoric/store'; import { E } from '@endo/eventual-send'; +import { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; import { parseVatSlot } from './parseVatSlots.js'; /** diff --git a/packages/swingset-liveslots/test/gc-helpers.js b/packages/swingset-liveslots/test/gc-helpers.js index 2cd32a783191..c5e35619fc49 100644 --- a/packages/swingset-liveslots/test/gc-helpers.js +++ b/packages/swingset-liveslots/test/gc-helpers.js @@ -1,7 +1,8 @@ // eslint-disable-next-line import/order import { Far } from '@endo/marshal'; -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; + import { kslot, kser } from '@agoric/kmarshal'; import { parseVatSlot } from '../src/parseVatSlots.js'; diff --git a/packages/swingset-liveslots/test/test-collection-upgrade.js b/packages/swingset-liveslots/test/test-collection-upgrade.js index ca3292096595..62d70a688776 100644 --- a/packages/swingset-liveslots/test/test-collection-upgrade.js +++ b/packages/swingset-liveslots/test/test-collection-upgrade.js @@ -1,8 +1,9 @@ import test from 'ava'; import { Far } from '@endo/marshal'; +import { M } from '@endo/patterns'; + import { kser } from '@agoric/kmarshal'; -import { M } from '@agoric/store'; import { makeLiveSlots } from '../src/liveslots.js'; import { parseVatSlot } from '../src/parseVatSlots.js'; import { buildSyscall } from './liveslots-helpers.js'; diff --git a/packages/swingset-liveslots/test/test-handled-promises.js b/packages/swingset-liveslots/test/test-handled-promises.js index e13c0055cae5..20aca0ce4449 100644 --- a/packages/swingset-liveslots/test/test-handled-promises.js +++ b/packages/swingset-liveslots/test/test-handled-promises.js @@ -1,8 +1,10 @@ import test from 'ava'; +import { throwRedacted as Fail } from '@endo/errors'; import { Far } from '@endo/marshal'; -import { Fail } from '@agoric/assert'; -import { M, provideLazy as provide } from '@agoric/store'; +import { M } from '@endo/patterns'; + +import { provideLazy as provide } from '@agoric/store'; import { makePromiseKit } from '@endo/promise-kit'; // Disabled to avoid circular dependencies. // import { makeStoreUtils } from '@agoric/vat-data/src/vat-data-bindings.js'; diff --git a/packages/swingset-liveslots/test/test-initial-vrefs.js b/packages/swingset-liveslots/test/test-initial-vrefs.js index c53262d95ad9..c9273cab2d7f 100644 --- a/packages/swingset-liveslots/test/test-initial-vrefs.js +++ b/packages/swingset-liveslots/test/test-initial-vrefs.js @@ -1,8 +1,9 @@ import test from 'ava'; import { Far } from '@endo/far'; +import { M } from '@endo/patterns'; + import { kunser } from '@agoric/kmarshal'; -import { M } from '@agoric/store'; import { setupTestLiveslots } from './liveslots-helpers.js'; function buildRootObject(vatPowers, vatParameters, baggage) { diff --git a/packages/vat-data/package.json b/packages/vat-data/package.json index bc800dd27e80..2ce1bef4f0d2 100644 --- a/packages/vat-data/package.json +++ b/packages/vat-data/package.json @@ -22,7 +22,9 @@ "@agoric/assert": "^0.6.0", "@agoric/internal": "^0.3.2", "@agoric/store": "^0.9.2", - "@agoric/swingset-liveslots": "^0.10.2" + "@agoric/swingset-liveslots": "^0.10.2", + "@endo/patterns": "^1.1.0", + "@endo/exo": "^1.1.0" }, "devDependencies": { "@endo/init": "^1.0.2", diff --git a/packages/vat-data/src/exo-utils.js b/packages/vat-data/src/exo-utils.js index f175f05fe21a..4726c9642aeb 100644 --- a/packages/vat-data/src/exo-utils.js +++ b/packages/vat-data/src/exo-utils.js @@ -1,6 +1,6 @@ // @jessie-check /* eslint-disable @typescript-eslint/prefer-ts-expect-error -- for casting from deprecated types that aren't worth fixing */ -import { initEmpty } from '@agoric/store'; +import { initEmpty } from '@endo/exo'; import { provide, VatData as globalVatData } from './vat-data-bindings.js'; diff --git a/packages/vat-data/src/index.js b/packages/vat-data/src/index.js index 9218020dc098..9a6e98df1dd8 100644 --- a/packages/vat-data/src/index.js +++ b/packages/vat-data/src/index.js @@ -1,8 +1,9 @@ // @jessie-check /// +export { M } from '@endo/patterns'; + export { - M, makeScalarMapStore, makeScalarWeakMapStore, makeScalarSetStore, diff --git a/packages/vat-data/test/test-durable-classes.js b/packages/vat-data/test/test-durable-classes.js index 17c01d1ebcb8..f965242b290f 100644 --- a/packages/vat-data/test/test-durable-classes.js +++ b/packages/vat-data/test/test-durable-classes.js @@ -3,7 +3,7 @@ import { test } from './prepare-test-env-ava.js'; // eslint-disable-next-line import/order -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; import { makeKindHandle, makeScalarBigMapStore, diff --git a/packages/vat-data/test/test-prepare.js b/packages/vat-data/test/test-prepare.js index 87b8d9013a30..5c7397de0172 100644 --- a/packages/vat-data/test/test-prepare.js +++ b/packages/vat-data/test/test-prepare.js @@ -3,7 +3,7 @@ import { test } from './prepare-test-env-ava.js'; // eslint-disable-next-line import/order -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; import { prepareExoClass, prepareExoClassKit, diff --git a/packages/vat-data/test/test-scalar-only-keys.js b/packages/vat-data/test/test-scalar-only-keys.js index e3cebfaf9410..55c9a0f78b85 100644 --- a/packages/vat-data/test/test-scalar-only-keys.js +++ b/packages/vat-data/test/test-scalar-only-keys.js @@ -1,9 +1,12 @@ // From https://github.com/Agoric/agoric-sdk/pull/6903#discussion_r1098067133 +// eslint-disable-next-line import/order import { test } from './prepare-test-env-ava.js'; // eslint-disable-next-line import/order -import { M, makeScalarMapStore } from '@agoric/store'; +import { M } from '@endo/patterns'; + +import { makeScalarMapStore } from '@agoric/store'; import { makeScalarBigMapStore } from '../src/vat-data-bindings.js'; test('scalar maps should reject non-scalar keys', t => { diff --git a/packages/vat-data/test/test-virtual-classes.js b/packages/vat-data/test/test-virtual-classes.js index 245b562fddec..e6c18aefd3a6 100644 --- a/packages/vat-data/test/test-virtual-classes.js +++ b/packages/vat-data/test/test-virtual-classes.js @@ -3,7 +3,7 @@ import { test } from './prepare-test-env-ava.js'; // eslint-disable-next-line import/order -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; import { defineVirtualExoClass, defineVirtualExoClassKit, diff --git a/packages/vats/src/bridge.js b/packages/vats/src/bridge.js index 6cf236e6c7dd..79992a6c86a5 100644 --- a/packages/vats/src/bridge.js +++ b/packages/vats/src/bridge.js @@ -1,6 +1,7 @@ -import { M } from '@agoric/store'; -import '@agoric/store/exported.js'; import { E } from '@endo/far'; +import { M } from '@endo/patterns'; + +import '@agoric/store/exported.js'; const { Fail, details: X } = assert; diff --git a/packages/wallet/api/package.json b/packages/wallet/api/package.json index e927f2b41dc7..6c920d22ecb7 100644 --- a/packages/wallet/api/package.json +++ b/packages/wallet/api/package.json @@ -32,9 +32,11 @@ "@agoric/vat-data": "^0.5.2", "@agoric/zoe": "^0.26.2", "@agoric/zone": "^0.2.2", + "@endo/common": "^1.0.2", "@endo/eventual-send": "^1.1.0", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", + "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "import-meta-resolve": "^2.2.1" }, diff --git a/packages/wallet/api/src/lib-wallet.js b/packages/wallet/api/src/lib-wallet.js index 6da348d70d4f..0fe72dbf631d 100644 --- a/packages/wallet/api/src/lib-wallet.js +++ b/packages/wallet/api/src/lib-wallet.js @@ -13,8 +13,9 @@ */ import { assert, q, Fail } from '@agoric/assert'; +import { objectMap } from '@endo/common/object-map.js'; import { makeScalarStoreCoordinator } from '@agoric/cache'; -import { objectMap, WalletName } from '@agoric/internal'; +import { WalletName } from '@agoric/internal'; import { slotStringUnserialize } from '@agoric/internal/src/storage-test-utils.js'; import { makeLegacyMap, @@ -1683,7 +1684,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]); diff --git a/packages/wallet/api/test/test-lib-wallet.js b/packages/wallet/api/test/test-lib-wallet.js index c83bb6df2028..3b789594ddc5 100644 --- a/packages/wallet/api/test/test-lib-wallet.js +++ b/packages/wallet/api/test/test-lib-wallet.js @@ -3,13 +3,13 @@ import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import bundleSource from '@endo/bundle-source'; +import { E } from '@endo/eventual-send'; +import { M } from '@endo/patterns'; + import { makeCache } from '@agoric/cache'; import { makeIssuerKit, AmountMath, AssetKind } from '@agoric/ertp'; -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 { makeFakeBoard } from '@agoric/vats/tools/board-utils.js'; diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 42dc3336f9e6..ccf45e9059ca 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -22,7 +22,8 @@ "@agoric/wallet-ui": "0.1.3-solo.0", "babel-eslint": "^10.0.3", "eslint-plugin-eslint-comments": "^3.1.2", - "import-meta-resolve": "^2.2.1" + "import-meta-resolve": "^2.2.1", + "@endo/patterns": "^1.1.0" }, "publishConfig": { "access": "public" diff --git a/packages/zoe/package.json b/packages/zoe/package.json index d5d6a6fcf91f..473e664eaf3d 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -53,12 +53,16 @@ "@agoric/time": "^0.3.2", "@agoric/vat-data": "^0.5.2", "@endo/bundle-source": "^3.0.2", + "@endo/common": "^1.0.2", "@endo/captp": "^4.0.2", + "@endo/errors": "^1.0.2", "@endo/eventual-send": "^1.1.0", + "@endo/exo": "^1.1.0", "@endo/far": "^1.0.2", "@endo/import-bundle": "^1.0.2", "@endo/marshal": "^1.1.0", "@endo/nat": "^5.0.2", + "@endo/pass-style": "^1.1.0", "@endo/patterns": "^1.1.0", "@endo/promise-kit": "^1.0.2", "yargs-parser": "^21.1.1" diff --git a/packages/zoe/src/cleanProposal.js b/packages/zoe/src/cleanProposal.js index 69de51d51c21..2ba711909389 100644 --- a/packages/zoe/src/cleanProposal.js +++ b/packages/zoe/src/cleanProposal.js @@ -1,7 +1,9 @@ -import { assert, q, Fail } from '@agoric/assert'; -import { AmountMath, getAssetKind } from '@agoric/ertp'; +import { assert, quote as q, throwRedacted as Fail } from '@endo/errors'; import { assertRecord } from '@endo/marshal'; -import { assertKey, assertPattern, mustMatch, isKey } from '@agoric/store'; +import { assertKey, assertPattern, mustMatch, isKey } from '@endo/patterns'; + +import { AmountMath, getAssetKind } from '@agoric/ertp'; + import { FullProposalShape } from './typeGuards.js'; import { arrayToObj } from './objArrayConversion.js'; diff --git a/packages/zoe/src/contractFacet/exit.js b/packages/zoe/src/contractFacet/exit.js index 2d541ba28060..3745a8bf9a7e 100644 --- a/packages/zoe/src/contractFacet/exit.js +++ b/packages/zoe/src/contractFacet/exit.js @@ -1,6 +1,8 @@ import { E } from '@endo/eventual-send'; +import { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; + import { prepareExoClass, provideDurableSetStore } from '@agoric/vat-data'; -import { M, initEmpty } from '@agoric/store'; import { TimestampShape } from '@agoric/time'; import { diff --git a/packages/zoe/src/contractFacet/zcfSeat.js b/packages/zoe/src/contractFacet/zcfSeat.js index 2ba5f7e4796d..06d51cbcd5d9 100644 --- a/packages/zoe/src/contractFacet/zcfSeat.js +++ b/packages/zoe/src/contractFacet/zcfSeat.js @@ -1,4 +1,9 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { throwRedacted as Fail, note as errorNote } from '@endo/errors'; +import { E } from '@endo/eventual-send'; +import { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; + import { makeScalarBigWeakMapStore, prepareExoClass, @@ -7,9 +12,7 @@ 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 { isOfferSafe } from './offerSafety.js'; import { assertRightsConserved } from './rightsConservation.js'; @@ -23,8 +26,6 @@ import { import { makeAllocationMap } from './reallocate.js'; import { TransferPartShape } from '../contractSupport/atomicTransfer.js'; -const { Fail } = assert; - /** @type {CreateSeatManager} */ export const createSeatManager = ( zoeInstanceAdmin, @@ -168,7 +169,7 @@ export const createSeatManager = ( const { self } = this; if (typeof reason === 'string') { reason = Error(reason); - assert.note( + errorNote( 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 ed15761a015b..f35c0e60a5cb 100644 --- a/packages/zoe/src/contractFacet/zcfZygote.js +++ b/packages/zoe/src/contractFacet/zcfZygote.js @@ -1,19 +1,19 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { E } from '@endo/eventual-send'; +import { objectMap } from '@endo/common/object-map.js'; +import { makePromiseKit } from '@endo/promise-kit'; +import { passStyleOf, Remotable } from '@endo/marshal'; +import { assertPattern, mustMatch, M } from '@endo/patterns'; + import { AssetKind } from '@agoric/ertp'; -import { assertPattern, mustMatch } from '@agoric/store'; import { canBeDurable, - M, makeScalarBigMapStore, prepareExo, prepareExoClass, provideDurableMapStore, } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; -import { passStyleOf, Remotable } from '@endo/marshal'; -import { makePromiseKit } from '@endo/promise-kit'; -import { objectMap } from '@agoric/internal'; import { cleanProposal } from '../cleanProposal.js'; import { handlePKitWarning } from '../handleWarning.js'; import { makeInstanceRecordStorage } from '../instanceRecordStorage.js'; diff --git a/packages/zoe/src/contractSupport/atomicTransfer.js b/packages/zoe/src/contractSupport/atomicTransfer.js index befda09311cd..63c3072bdf3e 100644 --- a/packages/zoe/src/contractSupport/atomicTransfer.js +++ b/packages/zoe/src/contractSupport/atomicTransfer.js @@ -1,4 +1,4 @@ -import { M } from '@agoric/store'; +import { M } from '@endo/patterns'; import { AmountKeywordRecordShape, SeatShape } from '../typeGuards.js'; export const TransferPartShape = M.splitArray( diff --git a/packages/zoe/src/contractSupport/durability.js b/packages/zoe/src/contractSupport/durability.js index efde52783f37..27e829e10640 100644 --- a/packages/zoe/src/contractSupport/durability.js +++ b/packages/zoe/src/contractSupport/durability.js @@ -1,6 +1,7 @@ -import { allValues, objectMap } from '@agoric/internal'; -import { provide } from '@agoric/vat-data'; import { E } from '@endo/eventual-send'; +import { objectMap } from '@endo/common/object-map.js'; +import { allValues } from '@agoric/internal'; +import { provide } from '@agoric/vat-data'; /** * SCALE: Only for low cardinality provisioning. Every value from init() will diff --git a/packages/zoe/src/contractSupport/priceAuthority.js b/packages/zoe/src/contractSupport/priceAuthority.js index 02ac349adf3e..72f70c059e4f 100644 --- a/packages/zoe/src/contractSupport/priceAuthority.js +++ b/packages/zoe/src/contractSupport/priceAuthority.js @@ -2,11 +2,12 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; +import { M } from '@endo/patterns'; + import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp'; import { makeNotifier } from '@agoric/notifier'; import { makeTracer } from '@agoric/internal'; import { TimestampShape } from '@agoric/time'; -import { M } from '@agoric/store'; const { quote: q, Fail } = assert; diff --git a/packages/zoe/src/contractSupport/recorder.js b/packages/zoe/src/contractSupport/recorder.js index da7c84aa0a8f..8cef61c1868d 100644 --- a/packages/zoe/src/contractSupport/recorder.js +++ b/packages/zoe/src/contractSupport/recorder.js @@ -1,13 +1,14 @@ -import { Fail } from '@agoric/assert'; +import { throwRedacted as Fail } from '@endo/errors'; +import { mustMatch, M } from '@endo/patterns'; +import { E } from '@endo/eventual-send'; + import { StorageNodeShape } from '@agoric/internal'; import { prepareDurablePublishKit } from '@agoric/notifier'; import { makeFakeMarshaller, makeFakeStorage, } from '@agoric/notifier/tools/testSupports.js'; -import { mustMatch } from '@agoric/store'; -import { M, makeScalarBigMapStore, prepareExoClass } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; +import { makeScalarBigMapStore, prepareExoClass } from '@agoric/vat-data'; /** * Recorders support publishing data to vstorage. diff --git a/packages/zoe/src/contractSupport/topics.js b/packages/zoe/src/contractSupport/topics.js index 350b378e1a1b..76ecb67b99da 100644 --- a/packages/zoe/src/contractSupport/topics.js +++ b/packages/zoe/src/contractSupport/topics.js @@ -1,6 +1,7 @@ -import { SubscriberShape } from '@agoric/notifier'; -import { M } from '@agoric/store'; import { E } from '@endo/far'; +import { M } from '@endo/patterns'; + +import { SubscriberShape } from '@agoric/notifier'; export { SubscriberShape }; diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index 4de0f07c5123..74a9de92b594 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -1,9 +1,10 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ -import { mustMatch, keyEQ } from '@agoric/store'; import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; +import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; +import { mustMatch, keyEQ } from '@endo/patterns'; + import { AssetKind } from '@agoric/ertp'; -import { fromUniqueEntries } from '@agoric/internal'; import { satisfiesWant } from '../contractFacet/offerSafety.js'; import { atomicTransfer, fromOnly, toOnly } from './atomicTransfer.js'; diff --git a/packages/zoe/src/contracts/coveredCall-durable.js b/packages/zoe/src/contracts/coveredCall-durable.js index 1b1615762178..a736aceae260 100644 --- a/packages/zoe/src/contracts/coveredCall-durable.js +++ b/packages/zoe/src/contracts/coveredCall-durable.js @@ -1,4 +1,5 @@ -import { mustMatch, M } from '@agoric/store'; +import { mustMatch, M } from '@endo/patterns'; + import { prepareExo, prepareExoClass } from '@agoric/vat-data'; 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 09228dab326f..ba27574f4634 100644 --- a/packages/zoe/src/contracts/coveredCall.js +++ b/packages/zoe/src/contracts/coveredCall.js @@ -1,4 +1,5 @@ -import { M, mustMatch } from '@agoric/store'; +import { M, mustMatch } from '@endo/patterns'; + // Eventually will be importable from '@agoric/zoe-contract-support' 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 94c4678e4051..b6ba71bdc2cf 100644 --- a/packages/zoe/src/contracts/loan/updateDebt.js +++ b/packages/zoe/src/contracts/loan/updateDebt.js @@ -1,6 +1,7 @@ +import { redacted as X, note as errorNote } from '@endo/errors'; import { Far } from '@endo/marshal'; + import { makeNotifierKit, observeNotifier } from '@agoric/notifier'; -import { assert, details as X } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; @@ -70,7 +71,7 @@ export const makeDebtCalculator = debtCalculatorConfig => { } }, fail: reason => { - assert.note( + errorNote( reason, X`Period problem: ${originalDebt}, started: ${basetime}, debt: ${debt}`, ); @@ -79,7 +80,7 @@ export const makeDebtCalculator = debtCalculatorConfig => { }); observeNotifier(periodNotifier, periodObserver).catch(reason => { - assert.note( + errorNote( reason, X`Unable to updateDebt originally: ${originalDebt}, started: ${basetime}, debt: ${debt}`, ); diff --git a/packages/zoe/src/contracts/scaledPriceAuthority.js b/packages/zoe/src/contracts/scaledPriceAuthority.js index 1e8507afa9f2..d2b519e7e876 100644 --- a/packages/zoe/src/contracts/scaledPriceAuthority.js +++ b/packages/zoe/src/contracts/scaledPriceAuthority.js @@ -1,4 +1,5 @@ -import { M, prepareExo } from '@agoric/vat-data'; +import { M } from '@endo/patterns'; +import { prepareExo } from '@agoric/vat-data'; import { ceilDivideBy, ceilMultiplyBy, diff --git a/packages/zoe/src/instanceRecordStorage.js b/packages/zoe/src/instanceRecordStorage.js index caa99f02c764..779739efc55e 100644 --- a/packages/zoe/src/instanceRecordStorage.js +++ b/packages/zoe/src/instanceRecordStorage.js @@ -1,4 +1,6 @@ -import { provide, prepareExoClass, M } from '@agoric/vat-data'; +import { M } from '@endo/patterns'; + +import { provide, prepareExoClass } from '@agoric/vat-data'; import { assertKeywordName } from './cleanProposal.js'; import { BrandKeywordRecordShape, diff --git a/packages/zoe/src/makeHandle.js b/packages/zoe/src/makeHandle.js index 5af62d1b6cf6..de4c33b2043f 100644 --- a/packages/zoe/src/makeHandle.js +++ b/packages/zoe/src/makeHandle.js @@ -1,13 +1,12 @@ // @jessie-check -import { assert } from '@agoric/assert'; -import { initEmpty, makeExo } from '@agoric/store'; +import { throwRedacted as Fail } from '@endo/errors'; +import { initEmpty, makeExo } from '@endo/exo'; + import { prepareExoClass } from '@agoric/vat-data'; import { HandleI } from './typeGuards.js'; -const { Fail } = assert; - /** @typedef {import('@agoric/vat-data').Baggage} Baggage */ /** diff --git a/packages/zoe/src/typeGuards.js b/packages/zoe/src/typeGuards.js index e694725fc7ba..44b788c7cdcc 100644 --- a/packages/zoe/src/typeGuards.js +++ b/packages/zoe/src/typeGuards.js @@ -1,5 +1,7 @@ // @jessie-check +import { M } from '@endo/patterns'; + import { AmountShape, AssetKindShape, @@ -10,7 +12,6 @@ import { PaymentShape, } from '@agoric/ertp'; import { SubscriberShape } from '@agoric/notifier'; -import { M } from '@agoric/store'; import { TimestampShape } from '@agoric/time'; // keywords have an initial cap diff --git a/packages/zoe/src/zoeService/escrowStorage.js b/packages/zoe/src/zoeService/escrowStorage.js index fa717d74fef3..8af2f83bf2b1 100644 --- a/packages/zoe/src/zoeService/escrowStorage.js +++ b/packages/zoe/src/zoeService/escrowStorage.js @@ -1,7 +1,8 @@ -import { AmountMath } from '@agoric/ertp'; -import { E } from '@endo/eventual-send'; import { q, Fail } from '@agoric/assert'; -import { objectMap } from '@agoric/internal'; +import { E } from '@endo/eventual-send'; +import { objectMap } from '@endo/common/object-map.js'; + +import { AmountMath } from '@agoric/ertp'; import { provideDurableWeakMapStore } from '@agoric/vat-data'; /// diff --git a/packages/zoe/src/zoeService/feeMint.js b/packages/zoe/src/zoeService/feeMint.js index 3672c86e123b..2d614288d0c7 100644 --- a/packages/zoe/src/zoeService/feeMint.js +++ b/packages/zoe/src/zoeService/feeMint.js @@ -1,3 +1,6 @@ +import { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; + import { AssetKind, IssuerShape, @@ -5,7 +8,6 @@ import { prepareIssuerKit, hasIssuer, } from '@agoric/ertp'; -import { initEmpty, M } from '@agoric/store'; import { provideDurableMapStore, provide, diff --git a/packages/zoe/src/zoeService/installationStorage.js b/packages/zoe/src/zoeService/installationStorage.js index b06c5ed26cf8..e2a86281ee49 100644 --- a/packages/zoe/src/zoeService/installationStorage.js +++ b/packages/zoe/src/zoeService/installationStorage.js @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/prefer-ts-expect-error -- accomodate different type search depths */ -import { assert } from '@agoric/assert'; +import { throwRedacted as Fail, quote as q } from '@endo/errors'; +import { M } from '@endo/patterns'; + import { - M, prepareExo, prepareKind, provideDurableWeakMapStore, @@ -12,8 +13,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 */ /** @typedef {import('@agoric/vat-data').Baggage} Baggage */ diff --git a/packages/zoe/src/zoeService/instanceAdminStorage.js b/packages/zoe/src/zoeService/instanceAdminStorage.js index ab6b9da38e4e..e7e956a5df2f 100644 --- a/packages/zoe/src/zoeService/instanceAdminStorage.js +++ b/packages/zoe/src/zoeService/instanceAdminStorage.js @@ -1,14 +1,15 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ +import { E } from '@endo/eventual-send'; +import { M } from '@endo/patterns'; + import { canBeDurable, makeScalarBigSetStore, provideDurableWeakMapStore, prepareKindMulti, prepareExoClassKit, - M, provide, } from '@agoric/vat-data'; -import { E } from '@endo/eventual-send'; import { defineDurableHandle } from '../makeHandle.js'; import { BrandKeywordRecordShape, diff --git a/packages/zoe/src/zoeService/invitationQueries.js b/packages/zoe/src/zoeService/invitationQueries.js index dd6bc5449233..a00015a08674 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 } from '@agoric/assert'; +import { redacted as X, note as errorNote, makeError } 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}`); + errorNote(err, X`Due to ${reason}`); throw err; }; return E.get( diff --git a/packages/zoe/src/zoeService/offer/burnInvitation.js b/packages/zoe/src/zoeService/offer/burnInvitation.js index eb5b36e90c5d..44e9e84f2037 100644 --- a/packages/zoe/src/zoeService/offer/burnInvitation.js +++ b/packages/zoe/src/zoeService/offer/burnInvitation.js @@ -1,6 +1,12 @@ // @jessie-check -import { Fail, assert, details as X } from '@agoric/assert'; +import { + throwRedacted as Fail, + assert, + redacted as X, + makeError, + note as errorNote, +} from '@endo/errors'; import { E } from '@endo/eventual-send'; /** @@ -16,10 +22,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}`); + errorNote(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 bda08444ec5d..c5a5c31b1bc5 100644 --- a/packages/zoe/src/zoeService/offer/offer.js +++ b/packages/zoe/src/zoeService/offer/offer.js @@ -1,8 +1,8 @@ // @jessie-check -import { passStyleOf } from '@endo/marshal'; -import { mustMatch } from '@agoric/store'; import { E } from '@endo/eventual-send'; +import { passStyleOf } from '@endo/pass-style'; +import { mustMatch } from '@endo/patterns'; import { cleanProposal } from '../../cleanProposal.js'; import { burnInvitation } from './burnInvitation.js'; diff --git a/packages/zoe/src/zoeService/startInstance.js b/packages/zoe/src/zoeService/startInstance.js index d3eb173abdeb..db2c82f5ebf1 100644 --- a/packages/zoe/src/zoeService/startInstance.js +++ b/packages/zoe/src/zoeService/startInstance.js @@ -1,15 +1,16 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ import { E } from '@endo/eventual-send'; -import { passStyleOf } from '@endo/marshal'; +import { passStyleOf } from '@endo/pass-style'; +import { M } from '@endo/patterns'; +import { initEmpty } from '@endo/exo'; + import { - M, makeScalarBigMapStore, provideDurableWeakMapStore, prepareExoClass, prepareExo, watchPromise, } from '@agoric/vat-data'; -import { initEmpty } from '@agoric/store'; import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; import { defineDurableHandle } from '../makeHandle.js'; diff --git a/packages/zoe/src/zoeService/zoe.js b/packages/zoe/src/zoeService/zoe.js index de83352391b9..c068baa3cafd 100644 --- a/packages/zoe/src/zoeService/zoe.js +++ b/packages/zoe/src/zoeService/zoe.js @@ -17,8 +17,9 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { M } from '@endo/patterns'; + import { makeScalarBigMapStore, prepareExo } from '@agoric/vat-data'; -import { M } from '@agoric/store'; import { makeZoeStorageManager } from './zoeStorageManager.js'; import { makeStartInstance } from './startInstance.js'; diff --git a/packages/zoe/src/zoeService/zoeSeat.js b/packages/zoe/src/zoeService/zoeSeat.js index f58200e164e0..df726c79ef8c 100644 --- a/packages/zoe/src/zoeService/zoeSeat.js +++ b/packages/zoe/src/zoeService/zoeSeat.js @@ -1,9 +1,11 @@ /* eslint @typescript-eslint/no-floating-promises: "warn" */ -import { prepareDurablePublishKit, SubscriberShape } from '@agoric/notifier'; import { E } from '@endo/eventual-send'; -import { M, prepareExoClassKit } from '@agoric/vat-data'; -import { deeplyFulfilled } from '@endo/marshal'; import { makePromiseKit } from '@endo/promise-kit'; +import { deeplyFulfilled } from '@endo/marshal'; +import { M } from '@endo/patterns'; + +import { prepareDurablePublishKit, SubscriberShape } from '@agoric/notifier'; +import { prepareExoClassKit } from '@agoric/vat-data'; import { satisfiesWant } from '../contractFacet/offerSafety.js'; import '../types.js'; diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js index 6bf5f9534f7b..f9b5fac732f6 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js @@ -1,4 +1,4 @@ -import { M, mustMatch } from '@agoric/store'; +import { M, mustMatch } from '@endo/patterns'; import '../../../exported.js'; import { prepareExoClass, prepareExo } from '@agoric/vat-data'; diff --git a/packages/zoe/test/swingsetTests/zoe/vat-bob.js b/packages/zoe/test/swingsetTests/zoe/vat-bob.js index c236266ae137..07724f132782 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-bob.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-bob.js @@ -1,7 +1,8 @@ +import { assert, redacted as X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; -import { keyEQ } from '@agoric/store'; +import { keyEQ } from '@endo/patterns'; + 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 717ae70ca7ee..2420a6e13946 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-carol.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-carol.js @@ -1,7 +1,8 @@ +import { assert, redacted as X } from '@endo/errors'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; -import { assert, details as X } from '@agoric/assert'; -import { keyEQ } from '@agoric/store'; +import { keyEQ } from '@endo/patterns'; + 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 f6eba02fe3cc..3bec5f37c645 100644 --- a/packages/zoe/test/swingsetTests/zoe/vat-dave.js +++ b/packages/zoe/test/swingsetTests/zoe/vat-dave.js @@ -1,7 +1,8 @@ +import { assert, redacted as X, throwRedacted as Fail } from '@endo/errors'; import { E } from '@endo/eventual-send'; -import { Far } from '@endo/marshal'; -import { assert, details as X, Fail } from '@agoric/assert'; -import { keyEQ } from '@agoric/store'; +import { Far } from '@endo/pass-style'; +import { keyEQ } from '@endo/patterns'; + import { AmountMath } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { showPurseBalance, setupIssuers } from '../helpers.js'; diff --git a/packages/zoe/test/unitTests/contracts/test-coveredCall-want-pattern.js b/packages/zoe/test/unitTests/contracts/test-coveredCall-want-pattern.js index 800ffec96d54..aadf870823ac 100644 --- a/packages/zoe/test/unitTests/contracts/test-coveredCall-want-pattern.js +++ b/packages/zoe/test/unitTests/contracts/test-coveredCall-want-pattern.js @@ -4,7 +4,8 @@ import path from 'path'; import bundleSource from '@endo/bundle-source'; import { E } from '@endo/eventual-send'; -import { M, mustMatch, keyEQ } from '@agoric/store'; +import { M, mustMatch, keyEQ } from '@endo/patterns'; + import { AmountMath, AssetKind, BrandShape } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { TimeMath } from '@agoric/time'; diff --git a/packages/zoe/test/unitTests/contracts/test-coveredCall.js b/packages/zoe/test/unitTests/contracts/test-coveredCall.js index 12eda702891f..c6418ea48943 100644 --- a/packages/zoe/test/unitTests/contracts/test-coveredCall.js +++ b/packages/zoe/test/unitTests/contracts/test-coveredCall.js @@ -6,9 +6,10 @@ import path from 'path'; import bundleSource from '@endo/bundle-source'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; +import { keyEQ } from '@endo/patterns'; + import { AmountMath, AssetKind } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; -import { keyEQ } from '@agoric/store'; import { TimeMath } from '@agoric/time'; import buildManualTimer from '../../../tools/manualTimer.js'; diff --git a/packages/zoe/test/unitTests/test-cleanProposal.js b/packages/zoe/test/unitTests/test-cleanProposal.js index b7aea585489e..ff1e6116260b 100644 --- a/packages/zoe/test/unitTests/test-cleanProposal.js +++ b/packages/zoe/test/unitTests/test-cleanProposal.js @@ -1,5 +1,6 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { M } from '@agoric/store'; + +import { M } from '@endo/patterns'; import { cleanProposal } from '../../src/cleanProposal.js'; import { setup } from './setupBasicMints.js'; diff --git a/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js b/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js index 78d5308e1244..964c79180f93 100644 --- a/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js +++ b/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js @@ -1,6 +1,7 @@ import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js'; -import { M, mustMatch } from '@agoric/store'; +import { M, mustMatch } from '@endo/patterns'; + import { AssetKind, makeIssuerKit } from '@agoric/ertp'; import { setup } from '../setupBasicMints.js'; import { diff --git a/yarn.lock b/yarn.lock index 5df5dc01fb85..0ea10b88acc0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -443,6 +443,13 @@ resolved "https://registry.yarnpkg.com/@endo/env-options/-/env-options-1.1.0.tgz#468d18c6cab6aaa5be733ba067750624ba6bac2b" integrity sha512-5D1AcZnoeaymT0yzccceyu1fbMJ7vqyrOluFC+ebVh7pDLcF5EqP27lyBdw1/GKSM60u1MOn9h9YVxmNC/Gi4A== +"@endo/errors@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@endo/errors/-/errors-1.0.2.tgz#dc63fc6e831004e358eca0864cb8d9d46d381bfa" + integrity sha512-OiM7RiGP/iDWruTEPiZpjiZjgzfX81NHM05GyJi2dXCiaDbg78uFcjnQaoTvxFGvETfdakZe5igzgO6zm/icvQ== + dependencies: + ses "^1.1.0" + "@endo/eslint-plugin@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@endo/eslint-plugin/-/eslint-plugin-2.0.1.tgz#178ff82f84b514ffb194cf4b91699194030506d1"