Skip to content

Commit

Permalink
Merge pull request #7260 from Agoric/ta/cleaner-deps
Browse files Browse the repository at this point in the history
reduce package `dependencies` cycles
  • Loading branch information
turadg authored Jun 28, 2023
2 parents a6737cd + 464ec03 commit f010e07
Show file tree
Hide file tree
Showing 172 changed files with 278 additions and 393 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: sudo apt install -y graphviz

- name: Check for cycles
run: scripts/check-dependency-cycles.sh 3
run: scripts/check-dependency-cycles.sh 1

##################
# Lint tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

// eslint-disable-next-line import/no-extraneous-dependencies
import { loadBasedir, buildVatController } from '@agoric/swingset-vat';

async function main(basedir, argv) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

// eslint-disable-next-line import/no-extraneous-dependencies
import { loadBasedir, buildVatController } from '@agoric/swingset-vat';

async function main(basedir, argv) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
import { M } from '@agoric/store';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { Far } from '@endo/marshal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { AmountMath as m, AssetKind } from '../../../src/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/ERTP/test/unitTests/test-inputValidation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { E } from '@endo/eventual-send';
Expand Down
1 change: 0 additions & 1 deletion packages/ERTP/test/unitTests/test-interfaces.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { getInterfaceOf } from '@endo/marshal';
Expand Down
1 change: 0 additions & 1 deletion packages/ERTP/test/unitTests/test-issuerObj.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { E } from '@endo/eventual-send';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { makeIssuerKit, AmountMath } from '../../src/index.js';
Expand Down
1 change: 0 additions & 1 deletion packages/ERTP/test/unitTests/test-mintObj.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { initEmpty, M } from '@agoric/store';
// eslint-disable-next-line import/no-extraneous-dependencies
import { assert } from '@agoric/assert';

import { defineDurableKind, makeKindHandle } from '@agoric/vat-data';
Expand Down
1 change: 0 additions & 1 deletion packages/ERTP/test/unitTests/test-recovery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
import { getCopySetKeys, keyEQ, makeCopySet } from '@agoric/store';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable import/no-extraneous-dependencies,no-unused-vars,no-empty-function */
import { Far } from '@endo/far';
// XXX cyclic dependency; TODO move this tool out of swingset-vat
import { makeIssuerKit, AmountMath } from '@agoric/ertp';

export function buildRootObject(vatPowers) {
Expand Down
3 changes: 0 additions & 3 deletions packages/SwingSet/misc-tools/replay-transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ import { promisify } from 'util';
import { createHash } from 'crypto';
import { Readable, finished as finishedCallback } from 'stream';
import { performance } from 'perf_hooks';
// eslint-disable-next-line import/no-extraneous-dependencies
import { tmpName, dirSync as tmpDirSync } from 'tmp';
// eslint-disable-next-line import/no-extraneous-dependencies
import sqlite3 from 'better-sqlite3';
// eslint-disable-next-line import/no-extraneous-dependencies
import yargsParser from 'yargs-parser';
import { makeMeasureSeconds } from '@agoric/internal';
import { makeWithQueue } from '@agoric/internal/src/queue.js';
Expand Down
9 changes: 4 additions & 5 deletions packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
"devDependencies": {
"@types/better-sqlite3": "^7.5.0",
"@types/microtime": "^2.1.0",
"@types/tmp": "^0.2.0",
"better-sqlite3": "^8.2.0",
"yargs-parser": "^21.1.1"
"@types/tmp": "^0.2.0"
},
"dependencies": {
"@agoric/assert": "^0.6.0",
Expand All @@ -52,13 +50,14 @@
"@endo/promise-kit": "^0.2.56",
"@endo/ses-ava": "^0.2.40",
"@endo/zip": "^0.2.31",
"better-sqlite3": "^8.2.0",
"ansi-styles": "^6.2.1",
"anylogger": "^0.21.0",
"better-sqlite3": "^8.2.0",
"import-meta-resolve": "^2.2.1",
"microtime": "^3.1.0",
"semver": "^6.3.0",
"tmp": "^0.2.1"
"tmp": "^0.2.1",
"yargs-parser": "^21.1.1"
},
"peerDependencies": {
"ava": "^5.3.0"
Expand Down
1 change: 0 additions & 1 deletion packages/SwingSet/tools/bundleTool.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeNodeBundleCache as wrappedMaker } from '@endo/bundle-source/cache.js';
import styles from 'ansi-styles'; // less authority than 'chalk'

Expand Down
1 change: 0 additions & 1 deletion packages/agoric-cli/integration-tests/test-workflow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { gettingStartedWorkflowTest } from '../tools/getting-started.js';
Expand Down
21 changes: 11 additions & 10 deletions packages/agoric-cli/src/chain-config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import djson from 'deterministic-json';
import TOML from '@iarna/toml';
import * as Tokens from '@agoric/inter-protocol/src/tokens.js';

export const STAKING_MAX_VALIDATORS = 150;
// Required for IBC connections not to time out.
Expand All @@ -13,38 +14,38 @@ export const ICA_HOST_ALLOW_MESSAGES = [
];

const Stake = /** @type {const} */ ({
name: 'Agoric Staking Token',
name: Tokens.Stake.proposedName,
description: 'The token used by delegates to stake on the Agoric chain',
denom_units: [
{
denom: 'ubld',
denom: Tokens.Stake.denom,
exponent: 0,
},
{
denom: 'bld',
exponent: 6,
exponent: Tokens.Stake.displayInfo.decimalPlaces,
},
],
base: 'ubld',
base: Tokens.Stake.denom,
display: 'bld',
symbol: 'BLD',
symbol: Tokens.Stake.symbol,
});
const Stable = /** @type {const} */ ({
name: 'Agoric stable token',
name: Tokens.Stable.proposedName,
description: 'The stable token used by the Agoric chain',
denom_units: [
{
denom: 'uist',
denom: Tokens.Stable.denom,
exponent: 0,
},
{
denom: 'ist',
exponent: 6,
exponent: Tokens.Stable.displayInfo.decimalPlaces,
},
],
base: 'uist',
base: Tokens.Stable.denom,
display: 'ist',
symbol: 'IST',
symbol: Tokens.Stable.symbol,
});
export const DENOM_METADATA = /** @type {const} */ ([Stake, Stable]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AmountMath } from '@agoric/ertp';
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeDurableZone } from '@agoric/zone/durable.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AmountMath } from '@agoric/ertp';
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeDurableZone } from '@agoric/zone/durable.js';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global process */

// eslint-disable-next-line import/no-extraneous-dependencies
import { makeHelpers } from '@agoric/deploy-script-support';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global process */

// eslint-disable-next-line import/no-extraneous-dependencies
import { makeHelpers } from '@agoric/deploy-script-support';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
Expand Down
1 change: 0 additions & 1 deletion packages/agoric-cli/tools/getting-started.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import fs from 'fs';
import path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import tmp from 'tmp';
import { makePromiseKit } from '@endo/promise-kit';
import { request } from 'http';
Expand Down
1 change: 0 additions & 1 deletion packages/agoric-cli/tools/resm-plugin/deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* globals setTimeout */
// eslint-disable-next-line import/no-extraneous-dependencies
import { E } from '@endo/eventual-send';

const PONG_TIMEOUT = 10_000;
Expand Down
6 changes: 5 additions & 1 deletion packages/agoric-cli/tools/resm-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"name": "@agoric/test-resm-plugin",
"version": "1.0.0",
"type": "commonjs"
"type": "commonjs",
"dependencies": {
"@endo/eventual-send": "^0.17.2",
"@endo/marshal": "^0.8.5"
}
}
1 change: 0 additions & 1 deletion packages/agoric-cli/tools/resm-plugin/src/plugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @jessie-check

// eslint-disable-next-line import/no-extraneous-dependencies
import { Far } from '@endo/marshal';
import { start } from './output.js';

Expand Down
1 change: 1 addition & 0 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@agoric/internal": "^0.3.2",
"@agoric/notifier": "^0.6.2",
"@agoric/store": "^0.9.2",
"@agoric/swingset-vat": "^0.32.2",
"@agoric/vat-data": "^0.5.2",
"@endo/far": "^0.2.18",
"@endo/marshal": "^0.8.5"
Expand Down
1 change: 0 additions & 1 deletion packages/cache/test/test-storage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Must be first to set up globals
// import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
// eslint-disable-next-line import/no-extraneous-dependencies -- XXX
import '@agoric/swingset-vat/tools/prepare-test-env.js';

import test from 'ava';
Expand Down
1 change: 0 additions & 1 deletion packages/deployment/scripts/crunch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/* global process,Buffer */

import fs from 'fs';
// eslint-disable-next-line import/no-extraneous-dependencies
import ReadlineTransform from 'readline-transform';

const [TRACE_FILE, FIRST_BLOCK_HEIGHT = 0, LAST_BLOCK_HEIGHT = Infinity] =
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config/eslint-config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ module.exports = {
'**/*.config.*.js',
// leading wildcard to work in CLI (package path) and IDE (repo path)
'**/test/**',
'**/demo*/**/*.js',
'**/scripts/**/*.js',
'**/demo*/**/*js',
'**/scripts/**/*js',
],
},
],
Expand Down
9 changes: 5 additions & 4 deletions packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@
"@agoric/swingset-vat": "^0.32.2",
"@agoric/time": "^0.3.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/vats": "^0.15.1",
"@agoric/zoe": "^0.26.2",
"@endo/bundle-source": "^2.5.1",
"@endo/captp": "^3.1.1",
"@endo/eventual-send": "^0.17.2",
"@endo/far": "^0.2.18",
"@endo/marshal": "^0.8.5",
"@endo/nat": "^4.1.27",
"@endo/promise-kit": "^0.2.56"
"@endo/promise-kit": "^0.2.56",
"import-meta-resolve": "^2.2.1"
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.10.3",
"@agoric/vats": "^0.15.1",
"@endo/bundle-source": "^2.5.1",
"@endo/init": "^0.5.56",
"ava": "^5.3.0",
"c8": "^7.13.0",
"import-meta-resolve": "^2.2.1"
"c8": "^7.13.0"
},
"files": [
"README.md",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import '@endo/init/debug.js';
import test from 'ava';
import { buildVatController, buildKernelBundles } from '@agoric/swingset-vat';
Expand Down Expand Up @@ -40,7 +39,7 @@ test.before(async t => {
};
const bootstrapSource = `${dirname}/bootstrap.js`;
vats.bootstrap = {
bundle: await bundleSource(bootstrapSource),
bundle: await bundleSource(bootstrapSource, { dev: true }),
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '@endo/init/debug.js';
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
import path from 'path';

Expand Down Expand Up @@ -55,7 +54,7 @@ test.before(async t => {
};
const bootstrapSource = `${dirname}/bootstrap.js`;
vats.bootstrap = {
bundle: await bundleSource(bootstrapSource),
bundle: await bundleSource(bootstrapSource, { dev: true }),
parameters: { contractBundles }, // argv will be added to this
};
const config = { bootstrap: 'bootstrap', vats };
Expand Down
2 changes: 0 additions & 2 deletions packages/governance/tools/puppetGovernance.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */

import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
import { resolve as importMetaResolve } from 'import-meta-resolve';
Expand Down
2 changes: 0 additions & 2 deletions packages/import-manager/test/unitTests/test-importsA.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';

import { makeGoodImportManager } from './goodImports.js';
Expand Down
3 changes: 2 additions & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@agoric/store": "^0.9.2",
"@agoric/time": "^0.3.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/vats": "^0.15.1",
"@agoric/zoe": "^0.26.2",
"@endo/captp": "^3.1.1",
"@endo/eventual-send": "^0.17.2",
Expand All @@ -52,6 +51,8 @@
"@agoric/smart-wallet": "^0.5.3",
"@agoric/swingset-liveslots": "^0.10.2",
"@agoric/swingset-vat": "^0.32.2",
"@agoric/vats": "^0.15.1",
"@agoric/zone": "^0.2.2",
"@endo/bundle-source": "^2.5.1",
"@endo/init": "^0.5.56",
"@endo/promise-kit": "^0.2.56",
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/src/proposals/addAssetToVault.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { AmountMath, AssetKind } from '@agoric/ertp';
import { deeplyFulfilledObject } from '@agoric/internal';
import { Stable } from '@agoric/vats/src/tokens.js';
import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js';
import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js';
import { E } from '@endo/far';
import { Stable } from '../tokens.js';
import { instanceNameFor } from './price-feed-proposal.js';
import { reserveThenGetNames } from './utils.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/src/proposals/core-proposal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @jessie-check

import { Stable } from '@agoric/vats/src/tokens.js';
import { Stable } from '../tokens.js';
import * as econBehaviors from './econ-behaviors.js';
import { ECON_COMMITTEE_MANIFEST } from './startEconCommittee.js';

Expand Down
4 changes: 1 addition & 3 deletions packages/inter-protocol/src/proposals/econ-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import { AmountMath } from '@agoric/ertp';
import '@agoric/governance/exported.js';
import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
import '@agoric/vats/exported.js';
import '@agoric/vats/src/core/types.js';
import { Stable } from '@agoric/vats/src/tokens.js';
import { E } from '@endo/far';
import { makeScalarBigMapStore } from '@agoric/vat-data';
import { Stable } from '../tokens.js';
import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js';
import { makeReserveTerms } from '../reserve/params.js';
import { makeGovernedTerms as makeGovernedVFTerms } from '../vaultFactory/params.js';
Expand Down
Loading

0 comments on commit f010e07

Please sign in to comment.