From 870fb59dcb85a15235746909e7e142980684adf6 Mon Sep 17 00:00:00 2001 From: Chris Hibbert Date: Fri, 16 Aug 2024 17:09:05 -0700 Subject: [PATCH] feat: link the auctions and vaults updates so they run sequenctially --- .../inter-protocol/src/proposals/add-auction.js | 16 ++++++++++++++-- .../src/proposals/upgrade-vaults.js | 15 +++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/inter-protocol/src/proposals/add-auction.js b/packages/inter-protocol/src/proposals/add-auction.js index 38657e53ef2b..88ee4a58d8fd 100644 --- a/packages/inter-protocol/src/proposals/add-auction.js +++ b/packages/inter-protocol/src/proposals/add-auction.js @@ -6,7 +6,16 @@ import { makeGovernedTerms as makeGovernedATerms } from '../auction/params.js'; const trace = makeTracer('NewAuction', true); -/** @param {import('./econ-behaviors.js').EconomyBootstrapPowers} powers */ +/** + * @typedef {PromiseSpaceOf<{ + * auctionsDone: boolean; + * }>} interlockPowers + */ + +/** + * @param {import('./econ-behaviors.js').EconomyBootstrapPowers & + * interlockPowers} powers + */ export const addAuction = async ({ consume: { zoe, @@ -17,7 +26,7 @@ export const addAuction = async ({ economicCommitteeCreatorFacet: electorateCreatorFacet, auctioneerKit: legacyKitP, }, - produce: { newAuctioneerKit }, + produce: { newAuctioneerKit, auctionsDone }, instance: { consume: { reserve: reserveInstance }, }, @@ -143,6 +152,8 @@ export const addAuction = async ({ ); // don't overwrite auctioneerKit or auction instance yet. Wait until // upgrade-vault.js + + auctionsDone.resolve(true); }; export const ADD_AUCTION_MANIFEST = harden({ @@ -158,6 +169,7 @@ export const ADD_AUCTION_MANIFEST = harden({ }, produce: { newAuctioneerKit: true, + auctionsDone: true, }, instance: { consume: { reserve: true }, diff --git a/packages/inter-protocol/src/proposals/upgrade-vaults.js b/packages/inter-protocol/src/proposals/upgrade-vaults.js index 2a92ebd65157..08814feb8673 100644 --- a/packages/inter-protocol/src/proposals/upgrade-vaults.js +++ b/packages/inter-protocol/src/proposals/upgrade-vaults.js @@ -31,7 +31,14 @@ const any = promises => }); /** - * @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers} powers + * @typedef {PromiseSpaceOf<{ + * auctionsDone: boolean; + * }>} interlockPowers + */ + +/** + * @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers & + * interlockPowers} powers * @param {{ options: { vaultsRef: { bundleID: string } } }} options */ export const upgradeVaults = async (powers, { options }) => { @@ -44,6 +51,7 @@ export const upgradeVaults = async (powers, { options }) => { zoe, economicCommitteeCreatorFacet: electorateCreatorFacet, reserveKit, + auctionsDone, }, produce: { auctioneerKit: auctioneerKitProducer, @@ -68,7 +76,9 @@ export const upgradeVaults = async (powers, { options }) => { * >} */ let installationP; - await null; + + await auctionsDone; + if (vaultsRef) { if (bundleID) { installationP = E(zoe).installBundleID(bundleID); @@ -261,6 +271,7 @@ export const getManifestForUpgradeVaults = async ( vaultFactoryKit: uV, board: uV, zoe: uV, + auctionsDone: uV, }, produce: { auctioneerKit: uV, newAuctioneerKit: uV }, instance: { produce: { auctioneer: uV, newAuctioneerKit: uV } },