Skip to content

Commit

Permalink
feat: link the auctions and vaults updates so they run sequenctially
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Aug 17, 2024
1 parent 7567edd commit 870fb59
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 14 additions & 2 deletions packages/inter-protocol/src/proposals/add-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -17,7 +26,7 @@ export const addAuction = async ({
economicCommitteeCreatorFacet: electorateCreatorFacet,
auctioneerKit: legacyKitP,
},
produce: { newAuctioneerKit },
produce: { newAuctioneerKit, auctionsDone },
instance: {
consume: { reserve: reserveInstance },
},
Expand Down Expand Up @@ -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({
Expand All @@ -158,6 +169,7 @@ export const ADD_AUCTION_MANIFEST = harden({
},
produce: {
newAuctioneerKit: true,
auctionsDone: true,
},
instance: {
consume: { reserve: true },
Expand Down
15 changes: 13 additions & 2 deletions packages/inter-protocol/src/proposals/upgrade-vaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand All @@ -44,6 +51,7 @@ export const upgradeVaults = async (powers, { options }) => {
zoe,
economicCommitteeCreatorFacet: electorateCreatorFacet,
reserveKit,
auctionsDone,
},
produce: {
auctioneerKit: auctioneerKitProducer,
Expand All @@ -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);
Expand Down Expand Up @@ -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 } },
Expand Down

0 comments on commit 870fb59

Please sign in to comment.