Skip to content

Commit

Permalink
refactor: import assert/Fail sans agoric/assert
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Sep 13, 2023
1 parent ce58927 commit 9be10ee
Show file tree
Hide file tree
Showing 46 changed files with 92 additions and 46 deletions.
3 changes: 2 additions & 1 deletion packages/SwingSet/src/controller/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { tmpName } from 'tmp';
import anylogger from 'anylogger';
import microtime from 'microtime';

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { importBundle } from '@endo/import-bundle';
import { initSwingStore } from '@agoric/swing-store';

Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/controller/initializeKernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import { makeMarshal } from '@endo/marshal';
import { Far } from '@endo/far';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { assertKnownOptions } from '../lib/assertOptions.js';
import { insistVatID } from '../lib/id.js';
import { kser, kunser } from '../lib/kmarshal.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/controller/initializeSwingset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import fs from 'fs';
import path from 'path';

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { makeTracer } from '@agoric/internal';
import { mustMatch } from '@agoric/store';
import bundleSource from '@endo/bundle-source';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/lib/deviceTools.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { makeMarshal } from '@endo/marshal';
import { Far } from '@endo/far';
import { parseVatSlot } from '../../lib/parseVatSlots.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/mailbox/device-mailbox.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Nat } from '@endo/nat';
import { Far } from '@endo/far';

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

export function buildRootDeviceNode(tools) {
const { SO, getDeviceState, setDeviceState, endowments } = tools;
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/timer/device-timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*/

import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { Far } from '@endo/far';

// Since we use harden when saving the state, we need to copy the arrays so they
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/deviceManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { makeDeviceSlots } from './deviceSlots.js';
import { insistCapData } from '../lib/capdata.js';

Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/deviceSlots.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Remotable, makeMarshal } from '@endo/marshal';
import { passStyleOf } from '@endo/far';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import {
insistVatType,
makeVatSlot,
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/deviceTranslator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-nocheck
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistMessage } from '../lib/message.js';
import { insistKernelType } from './parseKernelSlots.js';
import { insistVatType, parseVatSlot } from '../lib/parseVatSlots.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { isNat } from '@endo/nat';
import { importBundle } from '@endo/import-bundle';
import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/kernelSyscall.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistKernelType } from './parseKernelSlots.js';
import { insistCapData } from '../lib/capdata.js';
import { insistDeviceID, insistVatID } from '../lib/id.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/parseKernelSlots.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// Object/promise references (in the kernel) contain a two-tuple of (type,
// index). All object references point to entries in the kernel Object
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/deviceKeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { parseKernelSlot } from '../parseKernelSlots.js';
import { makeVatSlot, parseVatSlot } from '../../lib/parseVatSlots.js';
import { insistDeviceID } from '../../lib/id.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
import { Nat, isNat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { initializeVatState, makeVatKeeper } from './vatKeeper.js';
import { initializeDeviceState, makeDeviceKeeper } from './deviceKeeper.js';
import { parseReachableAndVatSlot } from './reachable.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/reachable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

export function parseReachableAndVatSlot(value) {
typeof value === 'string' || Fail`non-string value: ${value}`;
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vat-loader/manager-factory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { assertKnownOptions } from '../../lib/assertOptions.js';
import { makeLocalVatManagerFactory } from './manager-local.js';
import { makeNodeSubprocessFactory } from './manager-subprocess-node.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vat-loader/manager-local.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global globalThis */

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { importBundle } from '@endo/import-bundle';
import { makeLiveSlots } from '@agoric/swingset-liveslots';
import { makeManagerKit } from './manager-helper.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// import { spawn } from 'child_process'; // not from Compartment

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { E } from '@endo/eventual-send';
import { makePromiseKit } from '@endo/promise-kit';
import { makeManagerKit } from './manager-helper.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vat-loader/vat-loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { assertKnownOptions } from '../../lib/assertOptions.js';
import { makeVatSlot } from '../../lib/parseVatSlots.js';

Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vatTranslator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistMessage } from '../lib/message.js';
import { insistKernelType, parseKernelSlot } from './parseKernelSlots.js';
import { insistVatType, parseVatSlot } from '../lib/parseVatSlots.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/lib/assertOptions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

export function assertKnownOptions(options, knownNames) {
assert(knownNames instanceof Array);
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/lib/message.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistCapData } from './capdata.js';

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/lib/parseVatSlots.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// NOTE: confusing terminology: "slot" vs. "reference". All these things
// called "slots" are references, but the word "slot" suggests something into
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { kser, kunser, kslot, krefOf } from '../../lib/kmarshal.js';

// deliverToController() is used for local vats which want to talk to us as a
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/delivery.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-use-before-define */

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js';
import { makeUndeliverableError } from '../../lib/makeUndeliverableError.js';
import { extractSingleSlot, insistCapData } from '../../lib/capdata.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/dispatch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { makeVatSlot } from '../../lib/parseVatSlots.js';
import { insistMessage } from '../../lib/message.js';
import { makeState } from './state.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/gc-comms.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { parseVatSlot } from '../../lib/parseVatSlots.js';
import { parseRemoteSlot } from './parseRemoteSlot.js';

Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/parseLocalSlots.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// Local object/promise references (in the comms vat) contain a two-tuple of
// (type, index). All object references point to entries in the Local Object
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/parseRemoteSlot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// Object/promise references (in remote messages) contain a three-tuple of
// (type, allocator flag, index). The allocator flag inside an inbound
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/remote.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { parseLocalSlot, insistLocalType } from './parseLocalSlots.js';
import {
makeRemoteSlot,
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/state.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistCapData } from '../../lib/capdata.js';
import {
makeVatSlot,
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/test/commsVatDriver.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-nocheck
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import buildCommsDispatch from '../src/vats/comms/index.js';
import { debugState } from '../src/vats/comms/dispatch.js';
import { flipRemoteSlot } from '../src/vats/comms/parseRemoteSlot.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/cosmic-swingset/src/helpers/bufferedStorage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// XXX Do these "StorageAPI" functions belong in their own package?

Expand Down
3 changes: 2 additions & 1 deletion packages/cosmic-swingset/src/launch-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
loadSwingsetConfigFile,
} from '@agoric/swingset-vat';
import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { openSwingStore } from '@agoric/swing-store';
import { BridgeId as BRIDGE_ID } from '@agoric/internal';
import { makeWithQueue } from '@agoric/internal/src/queue.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/solo/src/chain-cosmos-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import anylogger from 'anylogger';
import { makeNotifierKit } from '@agoric/notifier';
import { makePromiseKit } from '@endo/promise-kit';

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import {
DEFAULT_BATCH_TIMEOUT_MS,
makeBatchedDeliver,
Expand Down
3 changes: 2 additions & 1 deletion packages/solo/src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import anylogger from 'anylogger';
// import connect from 'lotion-connect';
// import djson from 'deterministic-json';

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { makeSlogSender, tryFlushSlogSender } from '@agoric/telemetry';
import {
loadSwingsetConfigFile,
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/src/liveslots.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
getInterfaceOf,
makeMarshal,
} from '@endo/marshal';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { isPromise } from '@endo/promise-kit';
import { E, HandledPromise } from '@endo/eventual-send';
import { insistVatType, makeVatSlot, parseVatSlot } from './parseVatSlots.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/src/message.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { insistCapData } from './capdata.js';

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/src/parseVatSlots.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Nat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';

// NOTE: confusing terminology: "slot" vs. "reference". All these things
// called "slots" are references, but the word "slot" suggests something into
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/src/virtualObjectManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global globalThis */
/* eslint-disable no-use-before-define, jsdoc/require-returns-type */

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { assertPattern, mustMatch } from '@agoric/store';
import { defendPrototype, defendPrototypeKit } from '@endo/exo/tools.js';
import { Far, passStyleOf } from '@endo/marshal';
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-liveslots/src/virtualReferences.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-use-before-define, jsdoc/require-returns-type */

import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { Nat } from '@endo/nat';
import { parseVatSlot } from './parseVatSlots.js';
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/swingset-runner/demo/zoeTests/vat-carol.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { E } from '@endo/eventual-send';
import { Far } from '@endo/marshal';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { keyEQ } from '@agoric/store';
import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js';
import { showPurseBalance, setupIssuers } from './helpers.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global globalThis WeakRef FinalizationRegistry */
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { importBundle } from '@endo/import-bundle';
import {
makeLiveSlots,
Expand Down
3 changes: 2 additions & 1 deletion packages/zoe/src/contractFacet/rightsConservation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { makeScalarMapStore } from '@agoric/store';
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { AmountMath } from '@agoric/ertp';

import '../internal-types.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/zoe/src/contracts/loan/borrow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { E } from '@endo/eventual-send';
import { Far } from '@endo/marshal';
import { makePromiseKit } from '@endo/promise-kit';
Expand Down
3 changes: 2 additions & 1 deletion packages/zoe/src/contracts/oracle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint @typescript-eslint/no-floating-promises: "warn" */
import { assert, Fail } from '@agoric/assert';
import { assert } from '@endo/errors';
import { Fail } from '@agoric/internal';
import { Far } from '@endo/marshal';
import { AmountMath } from '@agoric/ertp';

Expand Down

0 comments on commit 9be10ee

Please sign in to comment.