Skip to content

Commit

Permalink
fix: better ocap discipline
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 24, 2021
1 parent fcf93ad commit eef6540
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/cosmic-swingset/lib/chain-entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const agcc = require('@agoric/cosmos');
esmRequire('@agoric/install-metering-and-ses');

const path = require('path');
const os = require('os');

esmRequire('./anylogger-agoric');
const anylogger = require('anylogger');
Expand All @@ -22,6 +23,7 @@ const main = esmRequire('./chain-main.js').default;

main(process.argv[1], process.argv.splice(2), {
path,
homedir: os.homedir(),
env: process.env,
agcc,
}).then(
Expand Down
13 changes: 8 additions & 5 deletions packages/cosmic-swingset/lib/chain-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '@agoric/swingset-vat/src/devices/mailbox';

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

import { launch } from './launch-chain';
import makeBlockManager from './block-manager';
Expand Down Expand Up @@ -77,7 +76,11 @@ const makeChainStorage = (call, prefix = '', imp = x => x, exp = x => x) => {
return storage;
};

export default async function main(progname, args, { path, env, agcc }) {
export default async function main(
progname,
args,
{ path, env, homedir, agcc },
) {
const portNums = {};

// TODO: use the 'basedir' pattern
Expand Down Expand Up @@ -105,7 +108,7 @@ export default async function main(progname, args, { path, env, agcc }) {

// We try to find the actual cosmos state directory (default=~/.ag-chain-cosmos), which
// is better than scribbling into the current directory.
const cosmosHome = getFlagValue('home', `${os.homedir()}/.ag-chain-cosmos`);
const cosmosHome = getFlagValue('home', `${homedir}/.ag-chain-cosmos`);
const stateDBDir = `${cosmosHome}/data/ag-cosmos-chain-state`;

// console.log('Have AG_COSMOS', agcc);
Expand Down Expand Up @@ -223,9 +226,9 @@ export default async function main(progname, args, { path, env, agcc }) {
const vatsdir = path.resolve(__dirname, '../lib/ag-solo/vats');
const argv = {
ROLE: 'chain',
noFakeCurrencies: process.env.NO_FAKE_CURRENCIES,
noFakeCurrencies: env.NO_FAKE_CURRENCIES,
};
const meterProvider = getMeterProvider(console, process.env);
const meterProvider = getMeterProvider(console, env);
const s = await launch(
stateDBDir,
mailboxStorage,
Expand Down

0 comments on commit eef6540

Please sign in to comment.