From 09fe78cb718b93a601a7d063bcaf488d7edab66d Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 08:56:12 -0700 Subject: [PATCH 1/7] chore(types): s/ProposalBuilder/CoreEvalBuilder more accurate. What's built is a code/permit pair (and its bundles), not a proposal (which has a title and a list of core evals) --- .../test/upgrade-contract/propose-buggy-contract.js | 2 +- .../test/upgrade-contract/propose-upgrade-contract.js | 2 +- packages/builders/scripts/inter-protocol/add-STARS.js | 4 ++-- .../scripts/inter-protocol/add-collateral-core.js | 4 ++-- packages/builders/scripts/inter-protocol/init-core.js | 2 +- .../scripts/inter-protocol/invite-committee-core.js | 2 +- .../builders/scripts/inter-protocol/price-feed-core.js | 2 +- .../builders/scripts/orchestration/init-stakeAtom.js | 2 +- .../builders/scripts/orchestration/init-stakeBld.js | 2 +- packages/builders/scripts/pegasus/init-core.js | 2 +- .../builders/scripts/smart-wallet/build-game1-start.js | 2 +- .../smart-wallet/build-wallet-factory2-upgrade.js | 2 +- .../smart-wallet/build-walletFactory-upgrade.js | 2 +- packages/builders/scripts/vats/add-auction.js | 2 +- packages/builders/scripts/vats/init-core.js | 2 +- packages/builders/scripts/vats/init-localchain.js | 2 +- packages/builders/scripts/vats/init-network.js | 2 +- packages/builders/scripts/vats/init-orchestration.js | 2 +- packages/builders/scripts/vats/init-transfer.js | 2 +- packages/builders/scripts/vats/priceFeedSupport.js | 2 +- packages/builders/scripts/vats/probe-zcf-bundle.js | 2 +- packages/builders/scripts/vats/replace-provisioning.js | 2 +- packages/builders/scripts/vats/replace-zoe.js | 2 +- packages/builders/scripts/vats/restart-vats.js | 2 +- packages/builders/scripts/vats/test-localchain.js | 2 +- packages/builders/scripts/vats/test-vtransfer.js | 2 +- packages/builders/scripts/vats/updateAtomPriceFeed.js | 2 +- .../builders/scripts/vats/updateStAtomPriceFeed.js | 2 +- .../builders/scripts/vats/updateStOsmoPriceFeed.js | 2 +- packages/builders/scripts/vats/updateStTiaPriceFeed.js | 2 +- .../builders/scripts/vats/updateStkAtomPriceFeed.js | 2 +- packages/builders/scripts/vats/upgrade-zcf.js | 2 +- packages/builders/scripts/vats/upgrade-zoe.js | 2 +- .../scripts/vats/upgradeScaledPriceAuthorities.js | 2 +- packages/builders/scripts/vats/upgradeVaults.js | 2 +- packages/deploy-script-support/src/externalTypes.js | 10 ++-------- packages/deploy-script-support/src/extract-proposal.js | 2 +- 37 files changed, 40 insertions(+), 46 deletions(-) diff --git a/packages/agoric-cli/test/upgrade-contract/propose-buggy-contract.js b/packages/agoric-cli/test/upgrade-contract/propose-buggy-contract.js index fcb880e9044..8e6b313394e 100644 --- a/packages/agoric-cli/test/upgrade-contract/propose-buggy-contract.js +++ b/packages/agoric-cli/test/upgrade-contract/propose-buggy-contract.js @@ -2,7 +2,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: './init-proposal.js', diff --git a/packages/agoric-cli/test/upgrade-contract/propose-upgrade-contract.js b/packages/agoric-cli/test/upgrade-contract/propose-upgrade-contract.js index ff640c4b1bd..308707792fa 100644 --- a/packages/agoric-cli/test/upgrade-contract/propose-upgrade-contract.js +++ b/packages/agoric-cli/test/upgrade-contract/propose-upgrade-contract.js @@ -2,7 +2,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: './upgrade-proposal.js', diff --git a/packages/builders/scripts/inter-protocol/add-STARS.js b/packages/builders/scripts/inter-protocol/add-STARS.js index 8e6b0025bf4..bc4e8a7a7cd 100644 --- a/packages/builders/scripts/inter-protocol/add-STARS.js +++ b/packages/builders/scripts/inter-protocol/add-STARS.js @@ -2,7 +2,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; import { defaultProposalBuilder as vaultProposalBuilder } from './add-collateral-core.js'; import { defaultProposalBuilder as oraclesProposalBuilder } from './price-feed-core.js'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const starsVaultProposalBuilder = async powers => { return vaultProposalBuilder(powers, { interchainAssetOptions: { @@ -17,7 +17,7 @@ export const starsVaultProposalBuilder = async powers => { }); }; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const starsOraclesProposalBuilder = async powers => { return oraclesProposalBuilder(powers, { AGORIC_INSTANCE_NAME: `STARS-USD price feed`, diff --git a/packages/builders/scripts/inter-protocol/add-collateral-core.js b/packages/builders/scripts/inter-protocol/add-collateral-core.js index 19d81eacc8a..b5fe7adfaee 100644 --- a/packages/builders/scripts/inter-protocol/add-collateral-core.js +++ b/packages/builders/scripts/inter-protocol/add-collateral-core.js @@ -5,7 +5,7 @@ import { getManifestForAddAssetToVault } from '@agoric/inter-protocol/src/propos import { getManifestForPsm } from '@agoric/inter-protocol/src/proposals/startPSM.js'; import { makeInstallCache } from '@agoric/inter-protocol/src/proposals/utils.js'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ( { publishRef, install: install0, wrapInstall }, { @@ -62,7 +62,7 @@ export const defaultProposalBuilder = async ( }); }; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const psmProposalBuilder = async ( { publishRef, install: install0, wrapInstall }, { anchorOptions = /** @type {object} */ ({}) } = {}, diff --git a/packages/builders/scripts/inter-protocol/init-core.js b/packages/builders/scripts/inter-protocol/init-core.js index fa9fe1052a9..fde857421c5 100644 --- a/packages/builders/scripts/inter-protocol/init-core.js +++ b/packages/builders/scripts/inter-protocol/init-core.js @@ -125,7 +125,7 @@ export const mainProposalBuilder = async ({ }; // Build proposal for sim-chain etc. -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ( { publishRef, install }, options = {}, diff --git a/packages/builders/scripts/inter-protocol/invite-committee-core.js b/packages/builders/scripts/inter-protocol/invite-committee-core.js index 8b4e0a51021..b2ce9d0d252 100644 --- a/packages/builders/scripts/inter-protocol/invite-committee-core.js +++ b/packages/builders/scripts/inter-protocol/invite-committee-core.js @@ -4,7 +4,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; import { getManifestForInviteCommittee } from '@agoric/inter-protocol/src/proposals/committee-proposal.js'; // Build proposal for sim-chain etc. -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ( { publishRef, install }, options = {}, diff --git a/packages/builders/scripts/inter-protocol/price-feed-core.js b/packages/builders/scripts/inter-protocol/price-feed-core.js index a58f2d8cb22..971df0b3168 100644 --- a/packages/builders/scripts/inter-protocol/price-feed-core.js +++ b/packages/builders/scripts/inter-protocol/price-feed-core.js @@ -11,7 +11,7 @@ export const DEFAULT_CONTRACT_TERMS = { maxSubmissionValue: 2n ** 256n, }; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ( { publishRef, install }, options = {}, diff --git a/packages/builders/scripts/orchestration/init-stakeAtom.js b/packages/builders/scripts/orchestration/init-stakeAtom.js index 3ab10b627e2..d453ef2aeee 100644 --- a/packages/builders/scripts/orchestration/init-stakeAtom.js +++ b/packages/builders/scripts/orchestration/init-stakeAtom.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ( { publishRef, install }, options = {}, diff --git a/packages/builders/scripts/orchestration/init-stakeBld.js b/packages/builders/scripts/orchestration/init-stakeBld.js index cf4999e424d..835483e4d11 100644 --- a/packages/builders/scripts/orchestration/init-stakeBld.js +++ b/packages/builders/scripts/orchestration/init-stakeBld.js @@ -1,7 +1,7 @@ // @ts-check import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/orchestration/src/proposals/start-stakeBld.js', diff --git a/packages/builders/scripts/pegasus/init-core.js b/packages/builders/scripts/pegasus/init-core.js index 7fdadf984cf..b3b74ba8933 100644 --- a/packages/builders/scripts/pegasus/init-core.js +++ b/packages/builders/scripts/pegasus/init-core.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/pegasus/src/proposals/core-proposal.js', diff --git a/packages/builders/scripts/smart-wallet/build-game1-start.js b/packages/builders/scripts/smart-wallet/build-game1-start.js index 6b0dfb10917..29d568d7d0e 100644 --- a/packages/builders/scripts/smart-wallet/build-game1-start.js +++ b/packages/builders/scripts/smart-wallet/build-game1-start.js @@ -8,7 +8,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; import { getManifestForGame1 } from '@agoric/smart-wallet/test/start-game1-proposal.js'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const game1ProposalBuilder = async ({ publishRef, install }) => { return harden({ sourceSpec: '@agoric/smart-wallet/test/start-game1-proposal.js', diff --git a/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js b/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js index dfe372a4a07..e3c795670fa 100644 --- a/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js +++ b/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js @@ -7,7 +7,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; * also prints helpful instructions for copying the files and installing them. */ -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: diff --git a/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js b/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js index ca8d566c744..77f9a487c13 100644 --- a/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js +++ b/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js @@ -8,7 +8,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; import { getManifestForUpgrade } from '@agoric/smart-wallet/src/proposals/upgrade-walletFactory-proposal.js'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return harden({ sourceSpec: diff --git a/packages/builders/scripts/vats/add-auction.js b/packages/builders/scripts/vats/add-auction.js index 8a248f17d17..b8c21021d1f 100644 --- a/packages/builders/scripts/vats/add-auction.js +++ b/packages/builders/scripts/vats/add-auction.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async () => { return harden({ sourceSpec: '@agoric/inter-protocol/src/proposals/add-auction.js', diff --git a/packages/builders/scripts/vats/init-core.js b/packages/builders/scripts/vats/init-core.js index 44f8e600883..9552a5c02d0 100644 --- a/packages/builders/scripts/vats/init-core.js +++ b/packages/builders/scripts/vats/init-core.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/core/startWalletFactory.js', diff --git a/packages/builders/scripts/vats/init-localchain.js b/packages/builders/scripts/vats/init-localchain.js index adcd80db443..22bb2127d54 100644 --- a/packages/builders/scripts/vats/init-localchain.js +++ b/packages/builders/scripts/vats/init-localchain.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/localchain-proposal.js', diff --git a/packages/builders/scripts/vats/init-network.js b/packages/builders/scripts/vats/init-network.js index 47462a721c1..3604f8baf62 100644 --- a/packages/builders/scripts/vats/init-network.js +++ b/packages/builders/scripts/vats/init-network.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/network-proposal.js', diff --git a/packages/builders/scripts/vats/init-orchestration.js b/packages/builders/scripts/vats/init-orchestration.js index 371e9976a1b..a641f555c97 100644 --- a/packages/builders/scripts/vats/init-orchestration.js +++ b/packages/builders/scripts/vats/init-orchestration.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/orchestration/src/proposals/orchestration-proposal.js', diff --git a/packages/builders/scripts/vats/init-transfer.js b/packages/builders/scripts/vats/init-transfer.js index 5437e768ccb..2129c5c087f 100644 --- a/packages/builders/scripts/vats/init-transfer.js +++ b/packages/builders/scripts/vats/init-transfer.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/transfer-proposal.js', diff --git a/packages/builders/scripts/vats/priceFeedSupport.js b/packages/builders/scripts/vats/priceFeedSupport.js index 0ec2d4eca4f..309d4f0a821 100644 --- a/packages/builders/scripts/vats/priceFeedSupport.js +++ b/packages/builders/scripts/vats/priceFeedSupport.js @@ -14,7 +14,7 @@ const ORACLE_ADDRESSES = [ /** * modified copy of ../inter-protocol/price-feed-core.js * - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const priceFeedProposalBuilder = async ( { publishRef, install }, diff --git a/packages/builders/scripts/vats/probe-zcf-bundle.js b/packages/builders/scripts/vats/probe-zcf-bundle.js index 9fdf0c69d23..d9e5fea56d9 100644 --- a/packages/builders/scripts/vats/probe-zcf-bundle.js +++ b/packages/builders/scripts/vats/probe-zcf-bundle.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/probeZcfBundle.js', diff --git a/packages/builders/scripts/vats/replace-provisioning.js b/packages/builders/scripts/vats/replace-provisioning.js index 7b8cc3edff4..3978fb9fc81 100644 --- a/packages/builders/scripts/vats/replace-provisioning.js +++ b/packages/builders/scripts/vats/replace-provisioning.js @@ -3,7 +3,7 @@ import { makeHelpers } from '@agoric/deploy-script-support'; import { getManifestForProvisioning } from '@agoric/vats/src/proposals/namesByAddress-fix-proposal.js'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/namesByAddress-fix-proposal.js', diff --git a/packages/builders/scripts/vats/replace-zoe.js b/packages/builders/scripts/vats/replace-zoe.js index 8f559a6ee62..2cdd86a8c0c 100644 --- a/packages/builders/scripts/vats/replace-zoe.js +++ b/packages/builders/scripts/vats/replace-zoe.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/zcf-proposal.js', diff --git a/packages/builders/scripts/vats/restart-vats.js b/packages/builders/scripts/vats/restart-vats.js index a8dbf8ffe9d..5dfe2a2ba3c 100644 --- a/packages/builders/scripts/vats/restart-vats.js +++ b/packages/builders/scripts/vats/restart-vats.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async () => { // An includelist isn't necessary because the collections are known to be complete (tested in test-vaults-upgrade.js) const skip = [ diff --git a/packages/builders/scripts/vats/test-localchain.js b/packages/builders/scripts/vats/test-localchain.js index f516f1ff666..f24add20fe6 100644 --- a/packages/builders/scripts/vats/test-localchain.js +++ b/packages/builders/scripts/vats/test-localchain.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async _powers => harden({ sourceSpec: '@agoric/vats/src/proposals/localchain-test.js', diff --git a/packages/builders/scripts/vats/test-vtransfer.js b/packages/builders/scripts/vats/test-vtransfer.js index f55fa5ad5e3..96c1bbd9a78 100644 --- a/packages/builders/scripts/vats/test-vtransfer.js +++ b/packages/builders/scripts/vats/test-vtransfer.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async _powers => harden({ sourceSpec: '@agoric/vats/src/proposals/vtransfer-echoer.js', diff --git a/packages/builders/scripts/vats/updateAtomPriceFeed.js b/packages/builders/scripts/vats/updateAtomPriceFeed.js index 6941c3bf3b8..66909636ec6 100644 --- a/packages/builders/scripts/vats/updateAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateAtomPriceFeed.js @@ -8,7 +8,7 @@ const OPTIONS = { }; /** - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return priceFeedProposalBuilder({ publishRef, install }, OPTIONS); diff --git a/packages/builders/scripts/vats/updateStAtomPriceFeed.js b/packages/builders/scripts/vats/updateStAtomPriceFeed.js index 85f8b861ace..080a4d3f137 100644 --- a/packages/builders/scripts/vats/updateStAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStAtomPriceFeed.js @@ -8,7 +8,7 @@ const OPTIONS = { }; /** - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return priceFeedProposalBuilder({ publishRef, install }, OPTIONS); diff --git a/packages/builders/scripts/vats/updateStOsmoPriceFeed.js b/packages/builders/scripts/vats/updateStOsmoPriceFeed.js index 39d688cee21..3de46b3ed5c 100644 --- a/packages/builders/scripts/vats/updateStOsmoPriceFeed.js +++ b/packages/builders/scripts/vats/updateStOsmoPriceFeed.js @@ -8,7 +8,7 @@ const OPTIONS = { }; /** - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return priceFeedProposalBuilder({ publishRef, install }, OPTIONS); diff --git a/packages/builders/scripts/vats/updateStTiaPriceFeed.js b/packages/builders/scripts/vats/updateStTiaPriceFeed.js index 695f134535d..d943ff5428b 100644 --- a/packages/builders/scripts/vats/updateStTiaPriceFeed.js +++ b/packages/builders/scripts/vats/updateStTiaPriceFeed.js @@ -8,7 +8,7 @@ const OPTIONS = { }; /** - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return priceFeedProposalBuilder({ publishRef, install }, OPTIONS); diff --git a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js index 22d120c444b..ef2d04a8767 100644 --- a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js @@ -8,7 +8,7 @@ const OPTIONS = { }; /** - * @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} + * @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => { return priceFeedProposalBuilder({ publishRef, install }, OPTIONS); diff --git a/packages/builders/scripts/vats/upgrade-zcf.js b/packages/builders/scripts/vats/upgrade-zcf.js index 73afe7e1a64..ed95165ac2f 100644 --- a/packages/builders/scripts/vats/upgrade-zcf.js +++ b/packages/builders/scripts/vats/upgrade-zcf.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/zcf-only-proposal.js', diff --git a/packages/builders/scripts/vats/upgrade-zoe.js b/packages/builders/scripts/vats/upgrade-zoe.js index e7503efbb13..7bd94f8a7ab 100644 --- a/packages/builders/scripts/vats/upgrade-zoe.js +++ b/packages/builders/scripts/vats/upgrade-zoe.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/vats/src/proposals/upgrade-zoe-proposal.js', diff --git a/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js b/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js index a3a92b03e33..51e4095b354 100644 --- a/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js +++ b/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: diff --git a/packages/builders/scripts/vats/upgradeVaults.js b/packages/builders/scripts/vats/upgradeVaults.js index ac69a81a37c..4653924f0af 100644 --- a/packages/builders/scripts/vats/upgradeVaults.js +++ b/packages/builders/scripts/vats/upgradeVaults.js @@ -1,6 +1,6 @@ import { makeHelpers } from '@agoric/deploy-script-support'; -/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ +/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ export const defaultProposalBuilder = async ({ publishRef, install }) => harden({ sourceSpec: '@agoric/inter-protocol/src/proposals/upgrade-vaults.js', diff --git a/packages/deploy-script-support/src/externalTypes.js b/packages/deploy-script-support/src/externalTypes.js index 364149da559..ad98a6b44fb 100644 --- a/packages/deploy-script-support/src/externalTypes.js +++ b/packages/deploy-script-support/src/externalTypes.js @@ -9,12 +9,6 @@ export {}; * origin. We are migrating away from using plain strings, for consistency. */ -/** - * @typedef ProposalResult - * @property {string} sourceSpec - * @property {[exportedGetManifest: string, ...manifestArgs: any[]]} getManifestCall - */ - /** * @typedef {{fileName?: string} & ({ bundleName: string } | { bundleID: string}) } ManifestBundleRef */ @@ -34,12 +28,12 @@ export {}; */ /** - * @callback ProposalBuilder + * @callback CoreEvalBuilder * @param {{ * publishRef: PublishBundleRef, * install: InstallEntrypoint, * wrapInstall?: (f: T) => T } * } powers * @param {...any} args - * @returns {Promise} + * @returns {Promise<{sourceSpec: string, getManifestCall: [exportedGetManifest: string, ...manifestArgs: any[]]}>} */ diff --git a/packages/deploy-script-support/src/extract-proposal.js b/packages/deploy-script-support/src/extract-proposal.js index 026bc6f7c1e..1ebf8519232 100644 --- a/packages/deploy-script-support/src/extract-proposal.js +++ b/packages/deploy-script-support/src/extract-proposal.js @@ -156,7 +156,7 @@ export const extractCoreProposalBundles = async ( const thisProposalSequence = getSequenceForProposal(key); const initPath = findModule(dirname, module); const initDir = path.dirname(initPath); - /** @type {Record} */ + /** @type {Record} */ const ns = await import(initPath); const install = (srcSpec, bundlePath) => { const absoluteSrc = findModule(initDir, srcSpec); From 9349c1d7d1378821e9447ddf23200073268a1991 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 08:56:32 -0700 Subject: [PATCH 2/7] chore: s/writeCoreProposal/writeCoreEval --- .../src/writeCoreProposal.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/deploy-script-support/src/writeCoreProposal.js b/packages/deploy-script-support/src/writeCoreProposal.js index 768ba5dce0c..d35a6204ca2 100644 --- a/packages/deploy-script-support/src/writeCoreProposal.js +++ b/packages/deploy-script-support/src/writeCoreProposal.js @@ -8,9 +8,10 @@ import { defangAndTrim, mergePermits, stringify } from './code-gen.js'; import { makeCoreProposalBehavior, permits } from './coreProposalBehavior.js'; /** - * @callback WriteCoreProposal - * @param {string} filePrefix - * @param {import('./externalTypes.js').ProposalBuilder} proposalBuilder + * @callback WriteCoreEval write to disk the files needed for a CoreEval (permits, code, and the bundles the code loads) + * see CoreEval in {@link '/golang/cosmos/x/swingset/types/swingset.pb.go'} + * @param {string} filePrefix - name on disk + * @param {import('./externalTypes.js').CoreEvalBuilder} builder * @returns {Promise} */ @@ -24,9 +25,9 @@ import { makeCoreProposalBehavior, permits } from './coreProposalBehavior.js'; * log?: typeof console.log, * writeFile?: typeof fs.promises.writeFile * }} io - * @returns {WriteCoreProposal} + * @returns {WriteCoreEval} */ -export const makeWriteCoreProposal = ( +export const makeWriteCoreEval = ( homeP, endowments, { @@ -74,8 +75,8 @@ export const makeWriteCoreProposal = ( /** @type {Promise} */ ( Promise.resolve() ); - /** @type {WriteCoreProposal} */ - const writeCoreProposal = async (filePrefix, proposalBuilder) => { + /** @type {WriteCoreEval} */ + const writeCoreEval = async (filePrefix, proposalBuilder) => { /** * * @param {string} entrypoint @@ -147,7 +148,7 @@ export const makeWriteCoreProposal = ( // console.log('writing', { filePrefix, manifestBundleRef, sourceSpec }); const code = `\ -// This is generated by writeCoreProposal; please edit! +// This is generated by writeCoreEval; please edit! /* eslint-disable */ const manifestBundleRef = ${stringify(manifestBundleRef)}; @@ -197,5 +198,7 @@ Remember to install bundles before submitting the proposal: `); }; - return writeCoreProposal; + return writeCoreEval; }; +/** @deprecated use makeWriteCoreEval */ +export const makeWriteCoreProposal = makeWriteCoreEval; From 03c6382c4c626a25f4249523e44f514e5ac1330c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 08:59:53 -0700 Subject: [PATCH 3/7] chore: s/writeCoreProposal/writeCoreEval --- packages/builders/scripts/inter-protocol/add-STARS.js | 6 +++--- .../scripts/inter-protocol/add-collateral-core.js | 6 +++--- packages/builders/scripts/inter-protocol/init-core.js | 6 +++--- .../scripts/inter-protocol/invite-committee-core.js | 4 ++-- .../scripts/inter-protocol/price-feed-core.js | 4 ++-- .../builders/scripts/orchestration/init-stakeAtom.js | 4 ++-- .../builders/scripts/orchestration/init-stakeBld.js | 4 ++-- packages/builders/scripts/pegasus/init-core.js | 4 ++-- .../scripts/smart-wallet/build-game1-start.js | 4 ++-- .../smart-wallet/build-wallet-factory2-upgrade.js | 4 ++-- .../smart-wallet/build-walletFactory-upgrade.js | 4 ++-- packages/builders/scripts/vats/add-auction.js | 4 ++-- packages/builders/scripts/vats/init-core.js | 4 ++-- packages/builders/scripts/vats/init-localchain.js | 4 ++-- packages/builders/scripts/vats/init-network.js | 4 ++-- packages/builders/scripts/vats/init-orchestration.js | 4 ++-- packages/builders/scripts/vats/probe-zcf-bundle.js | 4 ++-- .../builders/scripts/vats/replace-provisioning.js | 4 ++-- packages/builders/scripts/vats/replace-zoe.js | 4 ++-- packages/builders/scripts/vats/restart-vats.js | 4 ++-- packages/builders/scripts/vats/test-localchain.js | 4 ++-- packages/builders/scripts/vats/updateAtomPriceFeed.js | 4 ++-- .../builders/scripts/vats/updateStAtomPriceFeed.js | 4 ++-- .../builders/scripts/vats/updateStOsmoPriceFeed.js | 4 ++-- .../builders/scripts/vats/updateStTiaPriceFeed.js | 4 ++-- .../builders/scripts/vats/updateStkAtomPriceFeed.js | 4 ++-- packages/builders/scripts/vats/upgrade-zcf.js | 4 ++-- packages/builders/scripts/vats/upgrade-zoe.js | 4 ++-- .../scripts/vats/upgradeScaledPriceAuthorities.js | 7 ++----- packages/builders/scripts/vats/upgradeVaults.js | 4 ++-- packages/deploy-script-support/src/helpers.js | 11 +++++++++-- 31 files changed, 72 insertions(+), 68 deletions(-) diff --git a/packages/builders/scripts/inter-protocol/add-STARS.js b/packages/builders/scripts/inter-protocol/add-STARS.js index bc4e8a7a7cd..48809f22daa 100644 --- a/packages/builders/scripts/inter-protocol/add-STARS.js +++ b/packages/builders/scripts/inter-protocol/add-STARS.js @@ -37,7 +37,7 @@ export const starsOraclesProposalBuilder = async powers => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('add-STARS', starsVaultProposalBuilder); - await writeCoreProposal('add-STARS-oracles', starsOraclesProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('add-STARS', starsVaultProposalBuilder); + await writeCoreEval('add-STARS-oracles', starsOraclesProposalBuilder); }; diff --git a/packages/builders/scripts/inter-protocol/add-collateral-core.js b/packages/builders/scripts/inter-protocol/add-collateral-core.js index b5fe7adfaee..12aac0786c8 100644 --- a/packages/builders/scripts/inter-protocol/add-collateral-core.js +++ b/packages/builders/scripts/inter-protocol/add-collateral-core.js @@ -104,14 +104,14 @@ export const psmProposalBuilder = async ( }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); const tool = await makeInstallCache(homeP, { loadBundle: spec => import(spec), }); - await writeCoreProposal('gov-add-collateral', defaultProposalBuilder); - await writeCoreProposal('gov-start-psm', opts => + await writeCoreEval('gov-add-collateral', defaultProposalBuilder); + await writeCoreEval('gov-start-psm', opts => // @ts-expect-error XXX makeInstallCache types psmProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }), ); diff --git a/packages/builders/scripts/inter-protocol/init-core.js b/packages/builders/scripts/inter-protocol/init-core.js index fde857421c5..d4825239bed 100644 --- a/packages/builders/scripts/inter-protocol/init-core.js +++ b/packages/builders/scripts/inter-protocol/init-core.js @@ -185,17 +185,17 @@ export const defaultProposalBuilder = async ( }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); const tool = await makeInstallCache(homeP, { loadBundle: spec => import(spec), }); await Promise.all([ - writeCoreProposal('gov-econ-committee', opts => + writeCoreEval('gov-econ-committee', opts => // @ts-expect-error XXX makeInstallCache types committeeProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }), ), - writeCoreProposal('gov-amm-vaults-etc', opts => + writeCoreEval('gov-amm-vaults-etc', opts => // @ts-expect-error XXX makeInstallCache types mainProposalBuilder({ ...opts, wrapInstall: tool.wrapInstall }), ), diff --git a/packages/builders/scripts/inter-protocol/invite-committee-core.js b/packages/builders/scripts/inter-protocol/invite-committee-core.js index b2ce9d0d252..03daa4d0990 100644 --- a/packages/builders/scripts/inter-protocol/invite-committee-core.js +++ b/packages/builders/scripts/inter-protocol/invite-committee-core.js @@ -37,6 +37,6 @@ export const defaultProposalBuilder = async ( }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-invite-committee', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-invite-committee', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/inter-protocol/price-feed-core.js b/packages/builders/scripts/inter-protocol/price-feed-core.js index 971df0b3168..9abbf9cd20b 100644 --- a/packages/builders/scripts/inter-protocol/price-feed-core.js +++ b/packages/builders/scripts/inter-protocol/price-feed-core.js @@ -84,7 +84,7 @@ export const createGov = async (homeP, endowments) => { const oracleAddresses = ORACLE_ADDRESSES.split(','); - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); const inLookup = JSON.parse(IN_BRAND_LOOKUP); const outLookup = JSON.parse(OUT_BRAND_LOOKUP); @@ -98,7 +98,7 @@ export const createGov = async (homeP, endowments) => { brandIn: lookup(inLookup).catch(() => undefined), brandOut: lookup(outLookup).catch(() => undefined), }); - await writeCoreProposal('gov-price-feed', proposalBuilder); // gov-price-feed.js gov-price-feed-permit.json + await writeCoreEval('gov-price-feed', proposalBuilder); // gov-price-feed.js gov-price-feed-permit.json }; export default createGov; diff --git a/packages/builders/scripts/orchestration/init-stakeAtom.js b/packages/builders/scripts/orchestration/init-stakeAtom.js index d453ef2aeee..f3919ab399f 100644 --- a/packages/builders/scripts/orchestration/init-stakeAtom.js +++ b/packages/builders/scripts/orchestration/init-stakeAtom.js @@ -29,6 +29,6 @@ export const defaultProposalBuilder = async ( }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('start-stakeAtom', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('start-stakeAtom', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/orchestration/init-stakeBld.js b/packages/builders/scripts/orchestration/init-stakeBld.js index 835483e4d11..992c10d0a91 100644 --- a/packages/builders/scripts/orchestration/init-stakeBld.js +++ b/packages/builders/scripts/orchestration/init-stakeBld.js @@ -18,6 +18,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('start-stakeBld', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('start-stakeBld', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/pegasus/init-core.js b/packages/builders/scripts/pegasus/init-core.js index b3b74ba8933..e236bb4a86c 100644 --- a/packages/builders/scripts/pegasus/init-core.js +++ b/packages/builders/scripts/pegasus/init-core.js @@ -18,6 +18,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-pegasus', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-pegasus', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/smart-wallet/build-game1-start.js b/packages/builders/scripts/smart-wallet/build-game1-start.js index 29d568d7d0e..20ecee5b4d2 100644 --- a/packages/builders/scripts/smart-wallet/build-game1-start.js +++ b/packages/builders/scripts/smart-wallet/build-game1-start.js @@ -28,6 +28,6 @@ export const game1ProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('start-game1', game1ProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('start-game1', game1ProposalBuilder); }; diff --git a/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js b/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js index e3c795670fa..4ddf795737d 100644 --- a/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js +++ b/packages/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js @@ -23,6 +23,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('upgrade-wallet-factory', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('upgrade-wallet-factory', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js b/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js index 77f9a487c13..f42794efa4d 100644 --- a/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js +++ b/packages/builders/scripts/smart-wallet/build-walletFactory-upgrade.js @@ -29,6 +29,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('upgrade-walletFactory', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('upgrade-walletFactory', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/add-auction.js b/packages/builders/scripts/vats/add-auction.js index b8c21021d1f..2f7a2fd12c7 100644 --- a/packages/builders/scripts/vats/add-auction.js +++ b/packages/builders/scripts/vats/add-auction.js @@ -9,6 +9,6 @@ export const defaultProposalBuilder = async () => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('add-auction', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('add-auction', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/init-core.js b/packages/builders/scripts/vats/init-core.js index 9552a5c02d0..ea98a1a1aca 100644 --- a/packages/builders/scripts/vats/init-core.js +++ b/packages/builders/scripts/vats/init-core.js @@ -26,6 +26,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-vats', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-vats', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/init-localchain.js b/packages/builders/scripts/vats/init-localchain.js index 22bb2127d54..5c98c57a8a7 100644 --- a/packages/builders/scripts/vats/init-localchain.js +++ b/packages/builders/scripts/vats/init-localchain.js @@ -15,6 +15,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-localchain', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-localchain', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/init-network.js b/packages/builders/scripts/vats/init-network.js index 3604f8baf62..760e2020a36 100644 --- a/packages/builders/scripts/vats/init-network.js +++ b/packages/builders/scripts/vats/init-network.js @@ -14,6 +14,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-network', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-network', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/init-orchestration.js b/packages/builders/scripts/vats/init-orchestration.js index a641f555c97..ed878c74cc8 100644 --- a/packages/builders/scripts/vats/init-orchestration.js +++ b/packages/builders/scripts/vats/init-orchestration.js @@ -15,6 +15,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-orchestration', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-orchestration', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/probe-zcf-bundle.js b/packages/builders/scripts/vats/probe-zcf-bundle.js index d9e5fea56d9..2baf0fa9d0f 100644 --- a/packages/builders/scripts/vats/probe-zcf-bundle.js +++ b/packages/builders/scripts/vats/probe-zcf-bundle.js @@ -17,6 +17,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('probeZcfBundle', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('probeZcfBundle', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/replace-provisioning.js b/packages/builders/scripts/vats/replace-provisioning.js index 3978fb9fc81..d7d43246c5b 100644 --- a/packages/builders/scripts/vats/replace-provisioning.js +++ b/packages/builders/scripts/vats/replace-provisioning.js @@ -18,6 +18,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('gov-provisioning', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('gov-provisioning', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/replace-zoe.js b/packages/builders/scripts/vats/replace-zoe.js index 2cdd86a8c0c..a610c433f72 100644 --- a/packages/builders/scripts/vats/replace-zoe.js +++ b/packages/builders/scripts/vats/replace-zoe.js @@ -14,6 +14,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('replace-zcf', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('replace-zcf', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/restart-vats.js b/packages/builders/scripts/vats/restart-vats.js index 5dfe2a2ba3c..0ae8af2af8b 100644 --- a/packages/builders/scripts/vats/restart-vats.js +++ b/packages/builders/scripts/vats/restart-vats.js @@ -20,6 +20,6 @@ export const defaultProposalBuilder = async () => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('restart-vats', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('restart-vats', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/test-localchain.js b/packages/builders/scripts/vats/test-localchain.js index f24add20fe6..9f7c4de5bc6 100644 --- a/packages/builders/scripts/vats/test-localchain.js +++ b/packages/builders/scripts/vats/test-localchain.js @@ -13,6 +13,6 @@ export const defaultProposalBuilder = async _powers => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('test-localchain', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('test-localchain', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/updateAtomPriceFeed.js b/packages/builders/scripts/vats/updateAtomPriceFeed.js index 66909636ec6..8651462510f 100644 --- a/packages/builders/scripts/vats/updateAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateAtomPriceFeed.js @@ -15,7 +15,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal('atomPriceFeed', defaultProposalBuilder); + await writeCoreEval('atomPriceFeed', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/updateStAtomPriceFeed.js b/packages/builders/scripts/vats/updateStAtomPriceFeed.js index 080a4d3f137..6d3c226b30e 100644 --- a/packages/builders/scripts/vats/updateStAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStAtomPriceFeed.js @@ -15,7 +15,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal('stAtomPriceFeed', defaultProposalBuilder); + await writeCoreEval('stAtomPriceFeed', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/updateStOsmoPriceFeed.js b/packages/builders/scripts/vats/updateStOsmoPriceFeed.js index 3de46b3ed5c..da8e272c5fb 100644 --- a/packages/builders/scripts/vats/updateStOsmoPriceFeed.js +++ b/packages/builders/scripts/vats/updateStOsmoPriceFeed.js @@ -15,7 +15,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal('stOsmoPriceFeed', defaultProposalBuilder); + await writeCoreEval('stOsmoPriceFeed', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/updateStTiaPriceFeed.js b/packages/builders/scripts/vats/updateStTiaPriceFeed.js index d943ff5428b..d004c65bea0 100644 --- a/packages/builders/scripts/vats/updateStTiaPriceFeed.js +++ b/packages/builders/scripts/vats/updateStTiaPriceFeed.js @@ -15,7 +15,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal('stTiaPriceFeed', defaultProposalBuilder); + await writeCoreEval('stTiaPriceFeed', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js index ef2d04a8767..2fd2a671f1e 100644 --- a/packages/builders/scripts/vats/updateStkAtomPriceFeed.js +++ b/packages/builders/scripts/vats/updateStkAtomPriceFeed.js @@ -15,7 +15,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => { }; export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal('stkATOMPriceFeed', defaultProposalBuilder); + await writeCoreEval('stkATOMPriceFeed', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/upgrade-zcf.js b/packages/builders/scripts/vats/upgrade-zcf.js index ed95165ac2f..4ba46b8f3db 100644 --- a/packages/builders/scripts/vats/upgrade-zcf.js +++ b/packages/builders/scripts/vats/upgrade-zcf.js @@ -13,6 +13,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('upgrade-zcf', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('upgrade-zcf', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/upgrade-zoe.js b/packages/builders/scripts/vats/upgrade-zoe.js index 7bd94f8a7ab..279a47b41dc 100644 --- a/packages/builders/scripts/vats/upgrade-zoe.js +++ b/packages/builders/scripts/vats/upgrade-zoe.js @@ -13,6 +13,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('upgrade-zoe', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('upgrade-zoe', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js b/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js index 51e4095b354..0191830cfcd 100644 --- a/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js +++ b/packages/builders/scripts/vats/upgradeScaledPriceAuthorities.js @@ -16,10 +16,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); + const { writeCoreEval } = await makeHelpers(homeP, endowments); - await writeCoreProposal( - 'upgradeScaledPriceAuthorities', - defaultProposalBuilder, - ); + await writeCoreEval('upgradeScaledPriceAuthorities', defaultProposalBuilder); }; diff --git a/packages/builders/scripts/vats/upgradeVaults.js b/packages/builders/scripts/vats/upgradeVaults.js index 4653924f0af..fb77d4ee5f6 100644 --- a/packages/builders/scripts/vats/upgradeVaults.js +++ b/packages/builders/scripts/vats/upgradeVaults.js @@ -18,6 +18,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => }); export default async (homeP, endowments) => { - const { writeCoreProposal } = await makeHelpers(homeP, endowments); - await writeCoreProposal('upgrade-vaults', defaultProposalBuilder); + const { writeCoreEval } = await makeHelpers(homeP, endowments); + await writeCoreEval('upgrade-vaults', defaultProposalBuilder); }; diff --git a/packages/deploy-script-support/src/helpers.js b/packages/deploy-script-support/src/helpers.js index a2fb0617a82..b7b4c79662a 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 { makeWriteCoreProposal } from './writeCoreProposal.js'; +import { makeWriteCoreEval } from './writeCoreProposal.js'; export * from '@agoric/internal/src/node/createBundles.js'; @@ -137,8 +137,15 @@ export const makeHelpers = async (homePromise, endowments) => { get getBundlerMaker() { return makeGetBundlerMaker(homePromise, { bundleSource, lookup }); }, + get writeCoreEval() { + return makeWriteCoreEval(homePromise, endowments, { + getBundleSpec: deps.cacheAndGetBundleSpec, + getBundlerMaker: helpers.getBundlerMaker, + }); + }, + /** @deprecated use writeCoreEval */ get writeCoreProposal() { - return makeWriteCoreProposal(homePromise, endowments, { + return makeWriteCoreEval(homePromise, endowments, { getBundleSpec: deps.cacheAndGetBundleSpec, getBundlerMaker: helpers.getBundlerMaker, }); From f6b46c5046afe9f6069e268dbc1d196b8692ba54 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 09:08:18 -0700 Subject: [PATCH 4/7] refactor: remove Proposal terminology --- packages/deploy-script-support/src/helpers.js | 1 + .../src/writeCoreProposal.js | 50 +++++++++---------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/packages/deploy-script-support/src/helpers.js b/packages/deploy-script-support/src/helpers.js index b7b4c79662a..86bf8bc29d9 100644 --- a/packages/deploy-script-support/src/helpers.js +++ b/packages/deploy-script-support/src/helpers.js @@ -137,6 +137,7 @@ export const makeHelpers = async (homePromise, endowments) => { get getBundlerMaker() { return makeGetBundlerMaker(homePromise, { bundleSource, lookup }); }, + /** @returns {import('./writeCoreProposal.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/writeCoreProposal.js index d35a6204ca2..658d70439d4 100644 --- a/packages/deploy-script-support/src/writeCoreProposal.js +++ b/packages/deploy-script-support/src/writeCoreProposal.js @@ -5,7 +5,10 @@ import { deeplyFulfilled } from '@endo/marshal'; import { createBundles } from '@agoric/internal/src/node/createBundles.js'; import { defangAndTrim, mergePermits, stringify } from './code-gen.js'; -import { makeCoreProposalBehavior, permits } from './coreProposalBehavior.js'; +import { + makeCoreProposalBehavior, + permits as defaultPermits, +} from './coreProposalBehavior.js'; /** * @callback WriteCoreEval write to disk the files needed for a CoreEval (permits, code, and the bundles the code loads) @@ -50,16 +53,16 @@ export const makeWriteCoreEval = ( return bundlerCache; }; - const mergeProposalPermit = async (proposal, additionalPermits) => { + const mergeEvalPermit = async (coreEval, additionalPermits) => { const { sourceSpec, getManifestCall: [manifestGetterName, ...manifestGetterArgs], - } = proposal; + } = coreEval; - const proposalNS = await import(pathResolve(sourceSpec)); + const evalNS = await import(pathResolve(sourceSpec)); // We only care about the manifest, not any restoreRef calls. - const { manifest } = await proposalNS[manifestGetterName]( + const { manifest } = await evalNS[manifestGetterName]( harden({ restoreRef: x => `restoreRef:${x}` }), ...manifestGetterArgs, ); @@ -76,7 +79,7 @@ export const makeWriteCoreEval = ( Promise.resolve() ); /** @type {WriteCoreEval} */ - const writeCoreEval = async (filePrefix, proposalBuilder) => { + const writeCoreEval = async (filePrefix, builder) => { /** * * @param {string} entrypoint @@ -132,16 +135,16 @@ export const makeWriteCoreEval = ( return harden(ref); }; - // Create the proposal structure. - const proposal = await deeplyFulfilled( - harden(proposalBuilder({ publishRef, install })), + // Create the eval structure. + const evalParts = await deeplyFulfilled( + harden(builder({ publishRef, install })), ); - const { sourceSpec, getManifestCall } = proposal; + const { sourceSpec, getManifestCall } = evalParts; // console.log('created', { filePrefix, sourceSpec, getManifestCall }); // Extract the top-level permit. - const { permits: proposalPermit, manifest: customManifest } = - await mergeProposalPermit(proposal, permits); + const { permits: evalPermits, manifest: customManifest } = + await mergeEvalPermit(evalParts, defaultPermits); // Get an install const manifestBundleRef = await publishRef(install(sourceSpec)); @@ -165,21 +168,18 @@ behavior; const trimmed = defangAndTrim(code); - const proposalPermitJsonFile = `${filePrefix}-permit.json`; - log(`creating ${proposalPermitJsonFile}`); - await writeFile( - proposalPermitJsonFile, - JSON.stringify(proposalPermit, null, 2), - ); + const permitFile = `${filePrefix}-permit.json`; + log(`creating ${permitFile}`); + await writeFile(permitFile, JSON.stringify(evalPermits, null, 2)); - const proposalJsFile = `${filePrefix}.js`; - log(`creating ${proposalJsFile}`); - await writeFile(proposalJsFile, trimmed); + const codeFile = `${filePrefix}.js`; + log(`creating ${codeFile}`); + await writeFile(codeFile, trimmed); const plan = { name: filePrefix, - script: proposalJsFile, - permit: proposalPermitJsonFile, + script: codeFile, + permit: permitFile, bundles, }; @@ -190,8 +190,8 @@ behavior; log(`\ You can now run a governance submission command like: - agd tx gov submit-proposal swingset-core-eval ${proposalPermitJsonFile} ${proposalJsFile} \\ - --title="Enable " --description="Evaluate ${proposalJsFile}" --deposit=1000000ubld \\ + agd tx gov submit-proposal swingset-core-eval ${permitFile} ${codeFile} \\ + --title="Enable " --description="Evaluate ${codeFile}" --deposit=1000000ubld \\ --gas=auto --gas-adjustment=1.2 Remember to install bundles before submitting the proposal: ${cmds.join('\n ')} From 5c937750fee74ebd7b1df175ced6bb9a630deb03 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 7 Jun 2024 09:28:24 -0700 Subject: [PATCH 5/7] 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 => { From 16ca97e056f2e354c71302562f3f838ca9d5ab03 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 8 Jun 2024 06:37:58 -0700 Subject: [PATCH 6/7] chore(types): define CoreEvalDescriptor --- packages/deploy-script-support/src/externalTypes.js | 12 +++++++++++- .../deploy-script-support/src/writeCoreEvalParts.js | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/deploy-script-support/src/externalTypes.js b/packages/deploy-script-support/src/externalTypes.js index ad98a6b44fb..60a3a2ce5dc 100644 --- a/packages/deploy-script-support/src/externalTypes.js +++ b/packages/deploy-script-support/src/externalTypes.js @@ -27,6 +27,16 @@ export {}; * @returns {Promise} */ +/** + * @typedef CoreEvalDescriptor + * @property {string} sourceSpec import specifier for a module + * @property {[manifestGetterName: string, ...manifestGetterArgs: any[]]} getManifestCall + * the name of a function exported by the module and arguments to invoke it + * with in order to get a manifest (a Record that associates functions to be + * invoked and permits defining bootstrap-space powers they will have access + * to, see {@link ../README.md} and {@link runModuleBehaviors}) + */ + /** * @callback CoreEvalBuilder * @param {{ @@ -35,5 +45,5 @@ export {}; * wrapInstall?: (f: T) => T } * } powers * @param {...any} args - * @returns {Promise<{sourceSpec: string, getManifestCall: [exportedGetManifest: string, ...manifestArgs: any[]]}>} + * @returns {Promise} */ diff --git a/packages/deploy-script-support/src/writeCoreEvalParts.js b/packages/deploy-script-support/src/writeCoreEvalParts.js index 4bc45b454f3..06d93a3c1bf 100644 --- a/packages/deploy-script-support/src/writeCoreEvalParts.js +++ b/packages/deploy-script-support/src/writeCoreEvalParts.js @@ -10,6 +10,10 @@ import { permits as defaultPermits, } from './coreProposalBehavior.js'; +/** + * @import {CoreEvalDescriptor} from './externalTypes.js'; + */ + /** * @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) @@ -54,6 +58,11 @@ export const makeWriteCoreEval = ( return bundlerCache; }; + /** + * + * @param {CoreEvalDescriptor} coreEval + * @param {*} additionalPermits + */ const mergeEvalPermit = async (coreEval, additionalPermits) => { const { sourceSpec, From 593361d5bef428ddbb6e9c345f0c32960d6925d6 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 8 Jun 2024 06:49:38 -0700 Subject: [PATCH 7/7] refactor: naming --- .../src/writeCoreEvalParts.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/deploy-script-support/src/writeCoreEvalParts.js b/packages/deploy-script-support/src/writeCoreEvalParts.js index 06d93a3c1bf..35039187312 100644 --- a/packages/deploy-script-support/src/writeCoreEvalParts.js +++ b/packages/deploy-script-support/src/writeCoreEvalParts.js @@ -26,7 +26,10 @@ import { /** * * @param {*} homeP - * @param {*} endowments + * @param {{ + * bundleSource: (path: string) => Promise, + * pathResolve: (path: string) => string, + * }} endowments * @param {{ * getBundlerMaker: () => Promise, * getBundleSpec: (...args: *) => Promise, @@ -69,10 +72,10 @@ export const makeWriteCoreEval = ( getManifestCall: [manifestGetterName, ...manifestGetterArgs], } = coreEval; - const moduleRecord = await import(pathResolve(sourceSpec)); + const moduleNamespace = await import(pathResolve(sourceSpec)); // We only care about the manifest, not any restoreRef calls. - const { manifest } = await moduleRecord[manifestGetterName]( + const { manifest } = await moduleNamespace[manifestGetterName]( harden({ restoreRef: x => `restoreRef:${x}` }), ...manifestGetterArgs, ); @@ -146,15 +149,15 @@ export const makeWriteCoreEval = ( }; // Create the eval structure. - const evalParts = await deeplyFulfilled( + const evalDescriptor = await deeplyFulfilled( harden(builder({ publishRef, install })), ); - const { sourceSpec, getManifestCall } = evalParts; + const { sourceSpec, getManifestCall } = evalDescriptor; // console.log('created', { filePrefix, sourceSpec, getManifestCall }); // Extract the top-level permit. const { permits: evalPermits, manifest: customManifest } = - await mergeEvalPermit(evalParts, defaultPermits); + await mergeEvalPermit(evalDescriptor, defaultPermits); // Get an install const manifestBundleRef = await publishRef(install(sourceSpec));