Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix latest NPM packages #8390

Merged
merged 10 commits into from
Nov 9, 2023
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint": "exit 0"
},
"files": [
"eslint-config.json"
"eslint-config.*"
],
"peerDependencies": {
"@endo/eslint-plugin": "0.4.4",
Expand Down
18 changes: 18 additions & 0 deletions packages/governance/test/unitTests/test-puppetContractGovernor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import buildManualTimer from '@agoric/zoe/tools/manualTimer.js';
import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
import { resolve as importMetaResolve } from 'import-meta-resolve';
import { AssetKind, makeIssuerKit } from '@agoric/ertp';

import { CONTRACT_ELECTORATE, ParamTypes } from '../../src/index.js';
import { setUpGovernedContract } from '../../tools/puppetGovernance.js';
Expand Down Expand Up @@ -157,3 +158,20 @@ test('call API directly', async t => {
1,
);
});

test('add issuerKeywordRecord', async t => {
const zoe = await makeZoeForTest();
const issuerKit = makeIssuerKit('Food', AssetKind.COPY_BAG);
const timer = buildManualTimer(t.log);
const { governorFacets } = await setUpGovernedContract(
zoe,
E(zoe).install(governedBundleP),
timer,
governedTerms,
{},
{ Food: issuerKit.issuer },
);

const instance = await E(governorFacets.creatorFacet).getInstance();
t.deepEqual(await E(zoe).getIssuers(instance), { Food: issuerKit.issuer });
});
4 changes: 3 additions & 1 deletion packages/governance/tools/puppetGovernance.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ const autoRefundBundleP = makeBundle(
* @param {import('@agoric/swingset-vat/src/vats/timer/vat-timer.js').TimerService} timer
* @param {{ [k: string]: any, governedParams?: Record<string, unknown>, governedApis?: string[] }} termsOfGoverned
* @param {{}} privateArgsOfGoverned
* @param {IssuerKeywordRecord} [issuerKeywordRecord]
*/
export const setUpGovernedContract = async (
zoe,
governedP,
timer,
termsOfGoverned = {},
privateArgsOfGoverned = {},
issuerKeywordRecord = {},
) => {
const [contractGovernorBundle, autoRefundBundle] = await Promise.all([
contractGovernorBundleP,
Expand Down Expand Up @@ -87,7 +89,7 @@ export const setUpGovernedContract = async (
governedContractInstallation: governed,
governed: {
terms: governedTermsWithElectorate,
issuerKeywordRecord: {},
issuerKeywordRecord,
},
};

Expand Down
9 changes: 8 additions & 1 deletion packages/internal/src/node/createBundles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global process */
// Use modules not prefixed with `node:` since some deploy scripts may
// still be running in esm emulation
import path from 'path';
Expand Down Expand Up @@ -29,7 +30,13 @@ export const createBundlesFromAbsolute = async sourceBundles => {

for (const args of cacheToArgs.values()) {
console.log(BUNDLE_SOURCE_PROGRAM, ...args);
const { status } = spawnSync(prog, args, { stdio: 'inherit' });
const env = /** @type {NodeJS.ProcessEnv} */ (
/** @type {unknown} */ ({
__proto__: process.env,
LOCKDOWN_OVERRIDE_TAMING: 'severe',
})
);
const { status } = spawnSync(prog, args, { stdio: 'inherit', env });
Comment on lines +33 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that spawnSync etc. walk the prototype chain for env. A comment explaining the insertion of LOCKDOWN_OVERRIDE_TAMING: 'severe' would be nice, but I understand that this is cherry-picking.

status === 0 ||
Fail`${q(BUNDLE_SOURCE_PROGRAM)} failed with status ${q(status)}`;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/src/walletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const makeAssetRegistry = assetPublisher => {
* @param {import('@agoric/vat-data').Baggage} baggage
*/
export const prepare = async (zcf, privateArgs, baggage) => {
const upgrading = baggage.has('walletsByAddress');
const { agoricNames, board, assetPublisher } = zcf.getTerms();

const zoe = zcf.getZoeService();
Expand Down Expand Up @@ -292,7 +293,6 @@ export const prepare = async (zcf, privateArgs, baggage) => {
if (walletBridgeManager) {
// NB: may not be in service when creatorFacet is used, or ever
// It can't be awaited because that fails vat restart
const upgrading = baggage.has('walletsByAddress');
if (upgrading) {
void E(walletBridgeManager).setHandler(handleWalletAction);
} else {
Expand Down
2 changes: 2 additions & 0 deletions packages/smart-wallet/test/supports.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ const makeFakeBridgeManager = () =>
return E(handler).fromBridge(obj);
},
initHandler(newHandler) {
!handler || Fail`Handler already set`;
handler = newHandler;
},
setHandler(newHandler) {
!!handler || Fail`Handler not set`;
handler = newHandler;
},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/solo/src/entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'esm';

// we need to enable Math.random as a workaround for 'brace-expansion' module
// (dep chain: temp->glob->minimatch->brace-expansion)
import '@endo/init';
import '@endo/init/legacy.js';

import process from 'process';
import path from 'path';
Expand Down
2 changes: 1 addition & 1 deletion packages/solo/src/pipe-entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global process */
// @ts-check
import '@endo/init/pre-bundle-source.js';
import '@endo/init';
import '@endo/init/unsafe-fast.js';

import { parse, stringify } from '@endo/marshal';
import { makePromiseKit } from '@endo/promise-kit';
Expand Down
8 changes: 7 additions & 1 deletion packages/solo/src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,14 @@ const start = async (basedir, argv) => {
const { 'agoric-wallet': { htmlBasedir = 'ui/build', deploy = [] } = {} } =
JSON.parse(fs.readFileSync(pjs, 'utf-8'));

const htmlBasePath = String(htmlBasedir).replace(
/^\.\.\/\.\.\/node_modules\//,
'',
);

const agWallet = path.dirname(pjs);
const agWalletHtml = path.resolve(agWallet, htmlBasedir);
const agWalletHtmlUrl = await importMetaResolve(htmlBasePath, packageUrl);
const agWalletHtml = new URL(agWalletHtmlUrl).pathname;

let hostport;
await Promise.all(
Expand Down
1 change: 1 addition & 0 deletions packages/swingset-liveslots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"src/**/*.js",
"src/**/*.d.ts",
"test/**/*.js",
"tools",
"exported.js"
],
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "Apache-2.0",
"author": "Agoric",
"agoric-wallet": {
"htmlBasedir": "../../node_modules/@agoric/wallet-ui/build",
"htmlBasedir": "@agoric/wallet-ui/build",
"deploy": [
"./api/deploy.js"
]
Expand Down
Loading