Skip to content

Commit

Permalink
Merge pull request #1244 from Agoric/stop-importing-harden
Browse files Browse the repository at this point in the history
Stop importing harden
  • Loading branch information
FUDCo authored Jul 2, 2020
2 parents 4eba39f + e94f4d3 commit 54f67a7
Show file tree
Hide file tree
Showing 327 changed files with 475 additions and 388 deletions.
1 change: 0 additions & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"dependencies": {
"@agoric/assert": "^0.0.8",
"@agoric/eventual-send": "^0.9.3",
"@agoric/harden": "^0.0.8",
"@agoric/import-manager": "^0.0.7",
"@agoric/layer-cake": "^0.0.1",
"@agoric/marshal": "^0.2.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/amountMath.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global harden */
// @ts-check
import harden from '@agoric/harden';

import { assert, details } from '@agoric/assert';

import { mustBeComparable } from '@agoric/same-structure';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/issuer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0

/* global harden */
// @ts-check

import harden from '@agoric/harden';
import { assert, details } from '@agoric/assert';
import makeStore from '@agoric/weak-store';
import { isPromise } from '@agoric/produce-promise';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/natMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global harden */

import Nat from '@agoric/nat';
import harden from '@agoric/harden';

// Fungible digital assets use the natMathHelpers to manage balances -
// the operations are merely arithmetic on natural, non-negative
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/setMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { passStyleOf } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';
import { sameStructure } from '@agoric/same-structure';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/strSetMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { passStyleOf } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

import produceIssuer from '../../../src/issuer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

function makeAliceMaker(E, log) {
return harden({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
1 change: 1 addition & 0 deletions packages/ERTP/test/unitTests/test-issuerObj.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import '@agoric/install-ses';
import test from 'tape-promise/tape';
import { E } from '@agoric/eventual-send';

Expand Down
4 changes: 3 additions & 1 deletion packages/ERTP/test/unitTests/test-mintObj.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import produceIssuer from '../../src/issuer';

Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/demo/encouragementBot/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

console.log(`=> loading bootstrap.js`);

Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/demo/encouragementBot/vat-bot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

export default function setup(syscall, state, helpers) {
function log(what) {
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/demo/encouragementBot/vat-user.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

export default function setup(syscall, state, helpers) {
function log(what) {
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/demo/encouragementBotComms/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { E } from '@agoric/eventual-send';

console.log(`=> loading bootstrap.js`);
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/demo/encouragementBotComms/vat-bot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

export default function setup(syscall, state, helpers) {
function log(what) {
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/demo/encouragementBotComms/vat-user.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { E } from '@agoric/eventual-send';

export default function setup(syscall, state, helpers) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// This javascript source file uses the "tildot" syntax (foo~.bar()) for
// eventual sends.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// This javascript source file uses the "tildot" syntax (foo~.bar()) for
// eventual sends.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// This javascript source file uses the "tildot" syntax (foo~.bar()) for
// eventual sends.
Expand Down
1 change: 0 additions & 1 deletion packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@agoric/babel-parser": "^7.6.4",
"@agoric/bundle-source": "^1.1.6",
"@agoric/eventual-send": "^0.9.3",
"@agoric/harden": "^0.0.8",
"@agoric/import-bundle": "^0.0.8",
"@agoric/marshal": "^0.2.3",
"@agoric/nat": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/blockBuffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// buildBlockBuffer() is used by all hosts, to wrap whatever hostDB they use

Expand Down
8 changes: 2 additions & 6 deletions packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-redeclare
/* global Compartment harden */

import fs from 'fs';
import path from 'path';
import re2 from 're2';
Expand Down Expand Up @@ -168,11 +168,7 @@ export async function buildVatController(config, argv = []) {
// import anything outside their bundle.

function vatRequire(what) {
if (what === '@agoric/harden') {
return harden;
} else {
throw Error(`vatRequire unprepared to satisfy require(${what})`);
}
throw Error(`vatRequire unprepared to satisfy require(${what})`);
}

const vatEndowments = harden({
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/devices/bridge-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

function sanitize(data) {
// TODO: Use @agoric/marshal:pureCopy when it exists.
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/command-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import Nat from '@agoric/nat';

export default function setup(syscall, state, helpers, endowments) {
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/devices/loopbox-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

export default function setup(syscall, state, helpers, _endowments) {
const inboundHandlers = harden(new Map());
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/mailbox-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import Nat from '@agoric/nat';

export default function setup(syscall, state, helpers, endowments) {
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/mailbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global harden */

/*
The 'mailbox' device helps manage bidirectional communication with a number
of 'peers'. Each peer is identified with a string. We exchange ordered
Expand Down Expand Up @@ -64,7 +66,6 @@
*/

import harden from '@agoric/harden';
import Nat from '@agoric/nat';

// This Map-based mailboxState object is a good starting point, but we may
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/devices/timer-src.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global harden */

/**
* A Timer device that provides a capability that can be used to schedule wake()
* calls at particular times. The simpler form is a handler object with a wake()
Expand All @@ -24,7 +26,6 @@
* expose only capabilities that don't reveal them.
*/

import harden from '@agoric/harden';
import Nat from '@agoric/nat';
import { assert, details } from '@agoric/assert';

Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/hostStorage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { initSwingStore } from '@agoric/swing-store-simple';

/*
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 harden from '@agoric/harden';
/* global harden */

import { assert, details } from '@agoric/assert';
import { insistKernelType } from './parseKernelSlots';
import { insistVatType, parseVatSlot } from '../parseVatSlots';
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,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { mustPassByPresence, makeMarshal } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';
import { insistVatType, makeVatSlot, parseVatSlot } from '../parseVatSlots';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/id.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import Nat from '@agoric/nat';

// Vats are identified by an integer index, which (for typechecking purposes)
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 harden from '@agoric/harden';
/* global harden */

import { makeMarshal, Remotable, getInterfaceOf } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';
import { makeMeter } from '@agoric/transform-metering';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/liveSlots.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { E, HandledPromise } from '@agoric/eventual-send';
import {
QCLASS,
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
@@ -1,8 +1,9 @@
/* global harden */

/**
* Kernel's keeper of persistent state for a device.
*/

import harden from '@agoric/harden';
import Nat from '@agoric/nat';
import { assert, details } from '@agoric/assert';
import { parseKernelSlot } from '../parseKernelSlots';
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,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import Nat from '@agoric/nat';
import { assert, details } from '@agoric/assert';
import { initializeVatState, makeVatKeeper } from './vatKeeper';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/storageWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { insistStorageAPI } from '../../storageAPI';

// We manage a host-realm Storage object with a has/getKeys/get/set/del API.
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/vatKeeper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* global harden */

/**
* Kernel's keeper of persistent state for a vat.
*/

import harden from '@agoric/harden';
import Nat from '@agoric/nat';
import { assert, details } from '@agoric/assert';
import { parseKernelSlot } from '../parseKernelSlots';
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/vatAdmin/vatAdmin-src.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

/**
* A Vat management device that provides a capability that can be used to
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* global harden */

/**
* The VatAdmin wrapper vat.
*
* This is the only vat that has a direct pointer to the vatAdmin device, so it
* must ensure that only data goes in and out. It's also responsible for turning
* device affordances into objects that can be used by code in other vats.
*/
import harden from '@agoric/harden';
import { producePromise } from '@agoric/produce-promise';

function producePRR() {
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/vatManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { assert, details } from '@agoric/assert';
import djson from './djson';
import { insistKernelType, parseKernelSlot } from './parseKernelSlots';
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 @@
/* global harden */

import Nat from '@agoric/nat';
import harden from '@agoric/harden';
import { assert, details } from '@agoric/assert';
import { addRemote } from './remote';
import { addEgress, addIngress } from './clist';
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 harden from '@agoric/harden';
/* global harden */

import { assert, details } from '@agoric/assert';
import { makeVatSlot } from '../../parseVatSlots';
import { getRemote } from './remote';
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/vats/comms/inbound.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { assert, details } from '@agoric/assert';
import { insistRemoteType } from './parseRemoteSlot';
import { getInbound, mapInbound, mapInboundResult } from './clist';
Expand Down
5 changes: 2 additions & 3 deletions packages/SwingSet/src/vats/network/network.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* global harden */
// @ts-check

import makeStore from '@agoric/store';
import rawHarden from '@agoric/harden';
import { E as defaultE } from '@agoric/eventual-send';
import { producePromise } from '@agoric/produce-promise';
import { toBytes } from './bytes';

const harden = /** @type {<T>(x: T) => T} */ (rawHarden);

/**
* Compatibility note: this must match what our peers use,
* so don't change it casually.
Expand Down
Loading

0 comments on commit 54f67a7

Please sign in to comment.