Skip to content

Commit

Permalink
refactor(vats): rename upgrade-orch-core to upgrade-vats-generic
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Dec 24, 2024
1 parent 59fa82c commit 2253ae6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/builders/scripts/vats/upgrade-orchestration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { makeHelpers } from '@agoric/deploy-script-support';
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
export const defaultProposalBuilder = async ({ publishRef, install }) =>
harden({
sourceSpec: '@agoric/vats/src/proposals/upgrade-orch-core-proposal.js',
sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
getManifestCall: [
'getManifestForUpgradingOrchCore',
'getManifestForUpgradingVats',
{
bundleRefs: {
ibc: publishRef(install('@agoric/vats/src/vat-ibc.js')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,41 @@ import { E } from '@endo/far';
* };
* }} powers
* @param {object} options
* @param {{ bundleRefs: { [vatName: string]: VatSourceRef } }} options.options
* @param {{
* bundleRefs: { [vatName: string]: VatSourceRef };
* vatOptions?: {
* [vatName: string]: import('@agoric/swingset-vat').VatUpgradeOptions;
* };
* }} options.options
*/
export const upgradeOrchCore = async (
export const upgradeVatsGeneric = async (
{ consume: { vatAdminSvc, vatStore } },
options,
) => {
const { bundleRefs } = options.options;
const { bundleRefs, vatOptions = {} } = options.options;

for await (const [name, ref] of Object.entries(bundleRefs)) {
assert(ref.bundleID, `bundleID missing for ${name}`);
console.log(name, `BUNDLE ID: `, ref.bundleID);
const bundleCap = await E(vatAdminSvc).getBundleCap(ref.bundleID);

const { adminNode } = await E(vatStore).get(name);
await E(adminNode).upgrade(bundleCap, {});
await E(adminNode).upgrade(bundleCap, vatOptions[name] || {});
}
};

export const getManifestForUpgradingOrchCore = (_powers, { bundleRefs }) => ({
export const getManifestForUpgradingVats = (
_powers,
{ bundleRefs, vatOptions },
) => ({
manifest: {
[upgradeOrchCore.name]: {
[upgradeVatsGeneric.name]: {
consume: {
vatAdminSvc: 'vatAdminSvc',
vatStore: 'vatStore',
},
produce: {},
},
},
options: { bundleRefs },
options: { bundleRefs, vatOptions },
});

0 comments on commit 2253ae6

Please sign in to comment.