Skip to content

Commit

Permalink
Make powerful globals explicit (Agoric#2594)
Browse files Browse the repository at this point in the history
* fix: make powerful globals explicit
  • Loading branch information
erights authored Mar 8, 2021
1 parent ac15f4a commit 42bd6e8
Show file tree
Hide file tree
Showing 164 changed files with 174 additions and 6 deletions.
1 change: 1 addition & 0 deletions golang/cosmos/src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* global module require */
module.exports = require('bindings')('agcosmosdaemon.node');
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import test from 'ava';
import { loadBasedir, buildVatController } from '@agoric/swingset-vat';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import fs from 'fs';
import process from 'process';
import re2 from 're2';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/bridge.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
/*
The 'bridge' devices provides bidirectional function calls between objects
on the host and code within a swingset.
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/command.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import { makePromiseKit } from '@agoric/promise-kit';
import { Nat } from '@agoric/nat';

Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/loopbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import { assert, details as X } from '@agoric/assert';

/*
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/mailbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
/*
The 'mailbox' device helps manage bidirectional communication with a number
of 'peers'. Each peer is identified with a string. We exchange ordered
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/plugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
export function buildPlugin(pluginDir, pluginRequire, queueThunkForKernel) {
const srcPath = require.resolve('./plugin-src');
let resetter;
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/timer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import { Nat } from '@agoric/nat';

import { assert, details as X } from '@agoric/assert';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/initializeSwingset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import fs from 'fs';
import path from 'path';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global module require */
// `tap` and `node -r esm` were able to allow the swingset process to create
// a thread (`new Worker()`) from the (ESM) supervisor file without problems,
// but for some reason AVA cannot. The file loaded into the new thread
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global globalThis */
// @ts-check
import { assert, details as X } from '@agoric/assert';
import { importBundle } from '@agoric/import-bundle';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/main.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* global module require */
module.exports = require('./index.js');
1 change: 1 addition & 0 deletions packages/SwingSet/src/netstring.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require Buffer */
import { assert, details as X } from '@agoric/assert';

// adapted from 'netstring-stream', https://github.com/tlivings/netstring-stream/
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/waitUntilQuiescent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global setImmediate */
import { makePromiseKit } from '@agoric/promise-kit';

// This can only be imported from the Start Compartment, where 'setImmediate'
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/weakref.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global globalThis */
import { assert, details as X } from '@agoric/assert';

const { defineProperties } = Object;
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/worker-protocol.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Buffer */
import { Transform } from 'stream';

// Transform objects which convert from hardened Arrays of JSON-serializable
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/definition/test-vat-definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { buildVatController } from '../../src/index';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/device-plugin/test-device.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require __dirname */
import '@agoric/install-ses';
import test from 'ava';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/metering/test-metering.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
// eslint-disable-next-line import/order
import { replaceGlobalMeter } from './install-global-metering';
import '@agoric/install-ses';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/metering/test-within-vat.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-controller.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require __dirname */
import '@agoric/install-ses';
import test from 'ava';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-demos-comms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import { initSwingStore } from '@agoric/swing-store-simple';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-demos.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import { initSwingStore } from '@agoric/swing-store-simple';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-device-bridge.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-devices.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '@agoric/bundle-source';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-exomessages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { buildVatController } from '../src/index';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-marshal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global setImmediate */
import '@agoric/install-ses';
import { Far } from '@agoric/marshal';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-message-patterns.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
/* eslint no-await-in-loop: "off" */
/* eslint dot-notation: "off" */
/* eslint object-shorthand: "off" */
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-netstring.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Buffer */
import '@agoric/install-ses'; // adds 'harden' to global

import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-promises.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-syscall-failure.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-tildot.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { buildVatController } from '../src/index';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-transcript-light.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-transcript.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-vattp.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/test-worker-protocol.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Buffer */
import '@agoric/install-ses'; // adds 'harden' to global

import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/timer-device/test-device.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import '@agoric/install-ses';
import test from 'ava';
import { initSwingStore } from '@agoric/swing-store-simple';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import path from 'path';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/vat-admin/test-innerVat.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-metering-and-ses';
import path from 'path';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/vat-admin/test-replay.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-metering-and-ses';
import path from 'path';
import test from 'ava';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import path from 'path';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/workers/test-worker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require __dirname */
import '@agoric/install-ses';
import test from 'ava';
import { loadBasedir, buildVatController } from '../../src/index';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/tools/prepare-test-env.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global globalThis */
/**
* Prepare Agoric SwingSet vat global environment for testing.
*
Expand Down
1 change: 1 addition & 0 deletions packages/acorn-eventual-send/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global module */
const tilde = '~'.charCodeAt(0);
const dot = '.'.charCodeAt(0);
const zero = '0'.charCodeAt(0);
Expand Down
1 change: 1 addition & 0 deletions packages/acorn-eventual-send/test/test-rollup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require */
import test from 'ava';
import { rollup } from 'rollup/dist/rollup.es';
import * as acorn from 'acorn';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/integration-tests/test-workflow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname process setTimeout clearTimeout setInterval clearInterval */
/* eslint-disable import/no-extraneous-dependencies */
import '@agoric/install-ses';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/anylogger-agoric.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
import anylogger from 'anylogger';
import chalk from 'chalk';

Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/deploy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require process setTimeout setInterval clearInterval */
/* eslint-disable no-await-in-loop */
import { E, makeCapTP } from '@agoric/captp';
import { makePromiseKit } from '@agoric/promise-kit';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
import '@agoric/install-ses';

import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
// @ts-check

/** @typedef {import('child_process').ChildProcess} ChildProcess */
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/install.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname process */
import path from 'path';
import chalk from 'chalk';
import { makePspawn } from './helpers';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname process */
import { Command } from 'commander';

import { assert, details as X } from '@agoric/assert';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/open.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process setInterval clearInterval */
import { promises as defaultFs } from 'fs';
import opener from 'opener';
import crypto from 'crypto';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/lib/start.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname process setTimeout */
import path from 'path';
import chalk from 'chalk';
import { createHash } from 'crypto';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/test/test-main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global globalThis */
import test from 'ava';
import '@agoric/install-ses';
import fs from 'fs';
Expand Down
1 change: 1 addition & 0 deletions packages/assert/src/assert.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global globalThis */
// Copyright (C) 2019 Agoric, under Apache License 2.0
// @ts-check

Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/demo/dir1/sub/more.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global exports require */
const things = require('./things.js');

exports.more = `have more ${things.description}`;
1 change: 1 addition & 0 deletions packages/bundle-source/demo/dir1/sub/things.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* global exports */
exports.description = 'many different things';
1 change: 1 addition & 0 deletions packages/bundle-source/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
import fs from 'fs';
import { rollup as rollup0 } from 'rollup';
import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/sanity.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
// 'lockdown' appears on the global as a side-effect of importing 'ses'
import 'ses';

Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/test-bigint-transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/test-circular.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/test-comment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/test-external-fs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/test-tildot-transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/calc-gci.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
/* global require */

const fs = require('fs');
const djson = require('deterministic-json');
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/calc-rpcport.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node
/* global require */

// NOTE: Runs outside SES

Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/add-chain.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
import fetch from 'node-fetch';
import crypto from 'crypto';
import djson from 'deterministic-json';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/batched-deliver.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global setTimeout clearTimeout */
const DEFAULT_BATCH_TIMEOUT_MS = 1000;

export function makeBatchedDeliver(
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/chain-cosmos-sdk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global setTimeout */
import path from 'path';
import fs from 'fs';
import { execFile } from 'child_process';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /usr/bin/env node
/* global module require */

const esmRequire = require('esm')(module);

Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/fake-chain.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process setTimeout clearTimeout */
/* eslint-disable no-await-in-loop */
import path from 'path';
import fs from 'fs';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/html/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global setTimeout */
// NOTE: Runs outside SES

/* global WebSocket fetch document window walletFrame localStorage */
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/init-basedir.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname Buffer */
import fs from 'fs';
import path from 'path';
import { execFileSync } from 'child_process';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __dirname */
import fs from 'fs';
import path from 'path';
import parseArgs from 'minimist';
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/lib/ag-solo/start.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global require process setTimeout */
import fs from 'fs';
import path from 'path';
import temp from 'temp';
Expand Down
Loading

0 comments on commit 42bd6e8

Please sign in to comment.