From 330b7a26da9a8eefb95e3e0fd082714fdfad7873 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Thu, 14 Sep 2023 13:59:06 -0500 Subject: [PATCH 1/8] fix(walletFactory): move upgrading check before baggage is populated (#8322) * fix(walletFactory): move upgrading check before baggage is populated The `baggage.has('walletsByAddress')` check has to come before the `provideDurableMapStore(baggage, 'walletsByAddress')` call. * test(smart-wallet): fake bridge manager detects handler not set ... and handler already set * fixup! test(smart-wallet): fake bridge manager detects handler not set --- packages/smart-wallet/src/walletFactory.js | 2 +- packages/smart-wallet/test/supports.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/smart-wallet/src/walletFactory.js b/packages/smart-wallet/src/walletFactory.js index b7ad6709bd6..bc9cb0c8c48 100644 --- a/packages/smart-wallet/src/walletFactory.js +++ b/packages/smart-wallet/src/walletFactory.js @@ -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(); @@ -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 { diff --git a/packages/smart-wallet/test/supports.js b/packages/smart-wallet/test/supports.js index dd51dc9c75e..6c8e7a8d03c 100644 --- a/packages/smart-wallet/test/supports.js +++ b/packages/smart-wallet/test/supports.js @@ -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; }, }); From 90f43ba8a2430804ceccfd1152cd21fc812242a6 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Mon, 18 Sep 2023 17:25:06 -0700 Subject: [PATCH 2/8] feat: puppetGovernor pass the Issuerkeywordrecord through (#8351) closes: #8350 --- .../unitTests/test-puppetContractGovernor.js | 18 ++++++++++++++++++ packages/governance/tools/puppetGovernance.js | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/governance/test/unitTests/test-puppetContractGovernor.js b/packages/governance/test/unitTests/test-puppetContractGovernor.js index 173523739f3..05574bf4854 100644 --- a/packages/governance/test/unitTests/test-puppetContractGovernor.js +++ b/packages/governance/test/unitTests/test-puppetContractGovernor.js @@ -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'; @@ -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 }); +}); diff --git a/packages/governance/tools/puppetGovernance.js b/packages/governance/tools/puppetGovernance.js index 4f41593befe..038864c2366 100644 --- a/packages/governance/tools/puppetGovernance.js +++ b/packages/governance/tools/puppetGovernance.js @@ -28,6 +28,7 @@ const autoRefundBundleP = makeBundle( * @param {import('@agoric/swingset-vat/src/vats/timer/vat-timer.js').TimerService} timer * @param {{ [k: string]: any, governedParams?: Record, governedApis?: string[] }} termsOfGoverned * @param {{}} privateArgsOfGoverned + * @param {IssuerKeywordRecord} [issuerKeywordRecord] */ export const setUpGovernedContract = async ( zoe, @@ -35,6 +36,7 @@ export const setUpGovernedContract = async ( timer, termsOfGoverned = {}, privateArgsOfGoverned = {}, + issuerKeywordRecord = {}, ) => { const [contractGovernorBundle, autoRefundBundle] = await Promise.all([ contractGovernorBundleP, @@ -87,7 +89,7 @@ export const setUpGovernedContract = async ( governedContractInstallation: governed, governed: { terms: governedTermsWithElectorate, - issuerKeywordRecord: {}, + issuerKeywordRecord, }, }; From 7b7364f3597b711b8c37f2399f4bf6baa83d1e83 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 12 Jun 2023 15:00:37 -0700 Subject: [PATCH 3/8] build: export tools from swingset-liveslots --- packages/swingset-liveslots/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index 6b015f09882..025c60b49fb 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -38,6 +38,7 @@ "src/**/*.js", "src/**/*.d.ts", "test/**/*.js", + "tools", "exported.js" ], "repository": { From 3f6b83b55c320c710aa57c796a6c166ae396fe38 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 13 Jun 2023 12:25:46 -0700 Subject: [PATCH 4/8] fix: export of eslint-config.cjs --- packages/eslint-config/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index bd1735f3c72..fd544d7836c 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -22,7 +22,7 @@ "lint": "exit 0" }, "files": [ - "eslint-config.json" + "eslint-config.*" ], "peerDependencies": { "@endo/eslint-plugin": "0.4.4", From 670fc25f30964c40fc887fac77ebf54bf58c7b8e Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Tue, 26 Sep 2023 23:35:23 +0000 Subject: [PATCH 5/8] fix(solo): correct lookup of wallet-ui --- packages/solo/src/start.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/solo/src/start.js b/packages/solo/src/start.js index e9c6684e5f1..443397ec1f7 100644 --- a/packages/solo/src/start.js +++ b/packages/solo/src/start.js @@ -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( From a17b5ccabad92a91de7db4a61f7812b9f696ef71 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Wed, 27 Sep 2023 00:54:30 +0000 Subject: [PATCH 6/8] fix(wallet): don't assume node_modules layout --- packages/wallet/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wallet/package.json b/packages/wallet/package.json index e4f0214a620..a9891d9016f 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -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" ] From 60a680a2124ee9868ba3b8352a3a5a9f30ce7ab6 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Mon, 25 Sep 2023 21:11:05 +0000 Subject: [PATCH 7/8] fix(solo): use alternative endo init Work around babel dep override mistake --- packages/solo/src/entrypoint.js | 2 +- packages/solo/src/pipe-entrypoint.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/solo/src/entrypoint.js b/packages/solo/src/entrypoint.js index bde40a0f0f1..4ca2f5601af 100755 --- a/packages/solo/src/entrypoint.js +++ b/packages/solo/src/entrypoint.js @@ -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'; diff --git a/packages/solo/src/pipe-entrypoint.js b/packages/solo/src/pipe-entrypoint.js index e03c0b9ac55..5c6803fa8e5 100644 --- a/packages/solo/src/pipe-entrypoint.js +++ b/packages/solo/src/pipe-entrypoint.js @@ -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'; From 9486c772ab7daaebad0a19ac85653307ba461065 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Wed, 27 Sep 2023 00:37:19 +0000 Subject: [PATCH 8/8] fix(internal): severe override taming for bundle-source Work around babel dep override mistake --- packages/internal/src/node/createBundles.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/internal/src/node/createBundles.js b/packages/internal/src/node/createBundles.js index e78078bd744..d17d1bb45ea 100644 --- a/packages/internal/src/node/createBundles.js +++ b/packages/internal/src/node/createBundles.js @@ -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'; @@ -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 }); status === 0 || Fail`${q(BUNDLE_SOURCE_PROGRAM)} failed with status ${q(status)}`; }