From 5c937750fee74ebd7b1df175ced6bb9a630deb03 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 09:28:24 -0700 Subject: [PATCH] refactor: rename writeCoreEvalParts for clarity --- .../deploy-script-support/src/coreProposalBehavior.js | 4 ++-- packages/deploy-script-support/src/helpers.js | 4 ++-- .../src/{writeCoreProposal.js => writeCoreEvalParts.js} | 9 +++++---- .../test/unitTests/coreProposalBehavior.test.js | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) rename packages/deploy-script-support/src/{writeCoreProposal.js => writeCoreEvalParts.js} (94%) diff --git a/packages/deploy-script-support/src/coreProposalBehavior.js b/packages/deploy-script-support/src/coreProposalBehavior.js index 6551b0dfb92..52cb7641541 100644 --- a/packages/deploy-script-support/src/coreProposalBehavior.js +++ b/packages/deploy-script-support/src/coreProposalBehavior.js @@ -24,7 +24,7 @@ const t = 'makeCoreProposalBehavior'; * They are merged with all of the manifest getter's permits to produce the * total permits needed by the resulting core proposal (such as might be---and * generally are---written into a *-permit.json file). - * @see {@link ./writeCoreProposal.js} + * @see {@link ./writeCoreEvalParts.js} */ export const permits = { consume: { agoricNamesAdmin: t, vatAdminSvc: t, zoe: t }, @@ -106,7 +106,7 @@ export const makeCoreProposalBehavior = ({ // HOWEVER, do note that this function is invoked with at least the *union* of powers // required by individual moduleBehaviors declared by the manifest getter, which is // necessary so it can use `runModuleBehaviors` to provide the appropriate subset to - // each one (see ./writeCoreProposal.js). + // each one (see ./writeCoreEvalParts.js). // Handle `powers` with the requisite care. const { consume: { vatAdminSvc, zoe, agoricNamesAdmin }, diff --git a/packages/deploy-script-support/src/helpers.js b/packages/deploy-script-support/src/helpers.js index 86bf8bc29d9..0ae7f62750f 100644 --- a/packages/deploy-script-support/src/helpers.js +++ b/packages/deploy-script-support/src/helpers.js @@ -17,7 +17,7 @@ import { makeSaveIssuer } from './saveIssuer.js'; import { makeGetBundlerMaker } from './getBundlerMaker.js'; import { assertOfferResult } from './assertOfferResult.js'; import { installInPieces } from './installInPieces.js'; -import { makeWriteCoreEval } from './writeCoreProposal.js'; +import { makeWriteCoreEval } from './writeCoreEvalParts.js'; export * from '@agoric/internal/src/node/createBundles.js'; @@ -137,7 +137,7 @@ export const makeHelpers = async (homePromise, endowments) => { get getBundlerMaker() { return makeGetBundlerMaker(homePromise, { bundleSource, lookup }); }, - /** @returns {import('./writeCoreProposal.js').WriteCoreEval} */ + /** @returns {import('./writeCoreEvalParts.js').WriteCoreEval} */ get writeCoreEval() { return makeWriteCoreEval(homePromise, endowments, { getBundleSpec: deps.cacheAndGetBundleSpec, diff --git a/packages/deploy-script-support/src/writeCoreProposal.js b/packages/deploy-script-support/src/writeCoreEvalParts.js similarity index 94% rename from packages/deploy-script-support/src/writeCoreProposal.js rename to packages/deploy-script-support/src/writeCoreEvalParts.js index 658d70439d4..4bc45b454f3 100644 --- a/packages/deploy-script-support/src/writeCoreProposal.js +++ b/packages/deploy-script-support/src/writeCoreEvalParts.js @@ -11,9 +11,10 @@ import { } from './coreProposalBehavior.js'; /** - * @callback WriteCoreEval write to disk the files needed for a CoreEval (permits, code, and the bundles the code loads) + * @callback WriteCoreEval write to disk the files needed for a CoreEval (js code to`${filePrefix}.js`, permits to `${filePrefix}-permit.json`, an overall + * summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads) * see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'} - * @param {string} filePrefix - name on disk + * @param {string} filePrefix name on disk * @param {import('./externalTypes.js').CoreEvalBuilder} builder * @returns {Promise} */ @@ -59,10 +60,10 @@ export const makeWriteCoreEval = ( getManifestCall: [manifestGetterName, ...manifestGetterArgs], } = coreEval; - const evalNS = await import(pathResolve(sourceSpec)); + const moduleRecord = await import(pathResolve(sourceSpec)); // We only care about the manifest, not any restoreRef calls. - const { manifest } = await evalNS[manifestGetterName]( + const { manifest } = await moduleRecord[manifestGetterName]( harden({ restoreRef: x => `restoreRef:${x}` }), ...manifestGetterArgs, ); diff --git a/packages/deploy-script-support/test/unitTests/coreProposalBehavior.test.js b/packages/deploy-script-support/test/unitTests/coreProposalBehavior.test.js index 1ddca5b82de..9faea35cbca 100644 --- a/packages/deploy-script-support/test/unitTests/coreProposalBehavior.test.js +++ b/packages/deploy-script-support/test/unitTests/coreProposalBehavior.test.js @@ -8,7 +8,7 @@ import { } from '@agoric/vats/src/core/utils.js'; import { makeCoreProposalBehavior } from '../../src/coreProposalBehavior.js'; -// TODO: we need to rewrite writeCoreProposal.js to produce BundleIDs, +// TODO: we need to rewrite writeCoreEvalParts.js to produce BundleIDs, // although this test doesn't exercise that. test('coreProposalBehavior', async t => {