diff --git a/packages/builders/scripts/vats/upgradeVaults.js b/packages/builders/scripts/vats/upgradeVaults.js index 406a5990796..d2996e1d5aa 100644 --- a/packages/builders/scripts/vats/upgradeVaults.js +++ b/packages/builders/scripts/vats/upgradeVaults.js @@ -13,12 +13,6 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => '../bundles/bundle-vaultFactory.js', ), ), - contractGovernorRef: publishRef( - install( - '@agoric/governance/src/contractGovernor.js', - '../bundles/bundle-contractGovernor.js', - ), - ), }, ], }); diff --git a/packages/inter-protocol/src/proposals/add-auction.js b/packages/inter-protocol/src/proposals/add-auction.js index 29f32c4c477..89769e4cb25 100644 --- a/packages/inter-protocol/src/proposals/add-auction.js +++ b/packages/inter-protocol/src/proposals/add-auction.js @@ -9,40 +9,56 @@ const trace = makeTracer('NewAuction', true); /** * @typedef {PromiseSpaceOf<{ * auctionUpgradeNewInstance: Instance; + * newContractGovBundleId: string; * }>} interlockPowers */ /** * @param {import('./econ-behaviors.js').EconomyBootstrapPowers & * interlockPowers} powers + * @param {{ + * options: { + * contractGovernorRef: { bundleID: string }; + * contractGovernorInstallation: Installation; + * }; + * }} options */ -export const addAuction = async ({ - consume: { - agoricNamesAdmin, - auctioneerKit: legacyKitP, - board, - chainStorage, - chainTimerService, - economicCommitteeCreatorFacet: electorateCreatorFacet, - econCharterKit, - priceAuthority8400, - zoe, - }, - produce: { auctioneerKit: produceAuctioneerKit, auctionUpgradeNewInstance }, - instance: { - consume: { reserve: reserveInstance }, - produce: { auctioneer: auctionInstance }, - }, - installation: { +export const addAuction = async ( + { consume: { - auctioneer: auctioneerInstallationP, - contractGovernor: governorInstallationP, + agoricNamesAdmin, + auctioneerKit: legacyKitP, + board, + chainStorage, + chainTimerService, + economicCommitteeCreatorFacet: electorateCreatorFacet, + econCharterKit, + priceAuthority8400, + zoe, + }, + produce: { + auctioneerKit: produceAuctioneerKit, + auctionUpgradeNewInstance, + newContractGovBundleId, + }, + instance: { + consume: { reserve: reserveInstance }, + produce: { auctioneer: auctionInstance }, + }, + installation: { + consume: { auctioneer: auctioneerInstallationP }, + }, + issuer: { + consume: { [Stable.symbol]: stableIssuerP }, }, }, - issuer: { - consume: { [Stable.symbol]: stableIssuerP }, + { + options: { + contractGovernorRef: contractGovernorBundle, + contractGovernorInstallation, + }, }, -}) => { +) => { trace('addAuction start'); const STORAGE_PATH = 'auction'; @@ -53,14 +69,12 @@ export const addAuction = async ({ stableIssuer, legacyKit, auctioneerInstallation, - governorInstallation, ] = await Promise.all([ poserInvitationP, E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP), stableIssuerP, legacyKitP, auctioneerInstallationP, - governorInstallationP, ]); // Each field has an extra layer of type + value: @@ -109,9 +123,14 @@ export const addAuction = async ({ }), ); + const bundleIdFromZoe = await E(zoe).getBundleIDFromInstallation( + contractGovernorInstallation, + ); + trace('governor bundle ID', bundleIdFromZoe, contractGovernorBundle.bundleID); + /** @type {GovernorStartedInstallationKit} */ const governorStartResult = await E(zoe).startInstance( - governorInstallation, + contractGovernorInstallation, undefined, governorTerms, harden({ @@ -179,6 +198,7 @@ export const addAuction = async ({ ); auctionUpgradeNewInstance.resolve(governedInstance); + newContractGovBundleId.resolve(contractGovernorBundle.bundleID); }; export const ADD_AUCTION_MANIFEST = harden({ @@ -197,6 +217,7 @@ export const ADD_AUCTION_MANIFEST = harden({ produce: { auctioneerKit: true, auctionUpgradeNewInstance: true, + newContractGovBundleId: true, }, instance: { consume: { reserve: true }, @@ -222,9 +243,12 @@ export const getManifestForAddAuction = async ( { restoreRef }, { auctioneerRef, contractGovernorRef }, ) => { + const contractGovernorInstallation = restoreRef(contractGovernorRef); return { manifest: ADD_AUCTION_MANIFEST, - options: { auctioneerRef, contractGovernorRef }, + // XXX we should be able to receive contractGovernorInstallation via + // installations.consume, but the received installation isn't right. + options: { contractGovernorRef, contractGovernorInstallation }, installations: { auctioneer: restoreRef(auctioneerRef), contractGovernor: restoreRef(contractGovernorRef), diff --git a/packages/inter-protocol/src/proposals/upgrade-vaults.js b/packages/inter-protocol/src/proposals/upgrade-vaults.js index 94885fdb743..ab516d4bc37 100644 --- a/packages/inter-protocol/src/proposals/upgrade-vaults.js +++ b/packages/inter-protocol/src/proposals/upgrade-vaults.js @@ -10,6 +10,7 @@ const trace = makeTracer('upgrade Vaults proposal'); * @typedef {PromiseSpaceOf<{ * priceAuthority8400: Instance; * auctionUpgradeNewInstance: Instance; + * newContractGovBundleId: string; * }>} interlockPowers */ @@ -19,7 +20,6 @@ const trace = makeTracer('upgrade Vaults proposal'); * @param {{ * options: { * VaultFactoryBundle: { bundleID: string }; - * contractGovernorBundle: { bundleID: string }; * }; * }} options */ @@ -33,13 +33,17 @@ export const upgradeVaults = async ( vaultFactoryKit, zoe, priceAuthority8400, + newContractGovBundleId: newContractGovBundleIdP, + }, + produce: { + auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer, + newContractGovBundleId: newContractGovBundleIdErasor, }, - produce: { auctionUpgradeNewInstance: auctionUpgradeNewInstanceProducer }, instance: { consume: { auctioneer: auctioneerInstanceP }, }, }, - { options: { VaultFactoryBundle: vaultBundleRef, contractGovernorBundle } }, + { options: { VaultFactoryBundle: vaultBundleRef } }, ) => { const kit = await vaultFactoryKit; const { instance: directorInstance } = kit; @@ -151,10 +155,15 @@ export const upgradeVaults = async ( const vaultFactoryPrivateArgs = kit.privateArgs; trace('restarting governor'); - const ecf = await electorateCreatorFacet; + const [ecf, newContractGovBundleId] = await Promise.all([ + electorateCreatorFacet, + newContractGovBundleIdP, + ]); + newContractGovBundleIdErasor.reset(); + // upgrade vaultFactory governor. Won't be needed next time: see #10063 await E(kit.governorAdminFacet).upgradeContract( - contractGovernorBundle.bundleID, + newContractGovBundleId, harden({ electorateCreatorFacet: ecf, governed: vaultFactoryPrivateArgs, @@ -174,7 +183,7 @@ const uV = 'upgradeVaults'; */ export const getManifestForUpgradeVaults = async ( { restoreRef }, - { VaultFactoryRef, contractGovernorRef }, + { VaultFactoryRef }, ) => { return { manifest: { @@ -187,18 +196,16 @@ export const getManifestForUpgradeVaults = async ( reserveKit: uV, vaultFactoryKit: uV, zoe: uV, + newContractGovBundleId: uV, + }, + produce: { + auctionUpgradeNewInstance: uV, + newContractGovBundleId: uV, }, - produce: { auctionUpgradeNewInstance: uV }, instance: { consume: { auctioneer: uV } }, }, }, - installations: { - VaultFactory: restoreRef(VaultFactoryRef), - contractGovernor: restoreRef(contractGovernorRef), - }, - options: { - VaultFactoryBundle: VaultFactoryRef, - contractGovernorBundle: contractGovernorRef, - }, + installations: { VaultFactory: restoreRef(VaultFactoryRef) }, + options: { VaultFactoryBundle: VaultFactoryRef }, }; };