-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify a bundle to use when upgrading auctions #9937
Changes from 2 commits
b6e0739
37505e3
cbcc513
cdebfe1
b0df701
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,35 +15,47 @@ const trace = makeTracer('NewAuction', true); | |
/** | ||
* @param {import('./econ-behaviors.js').EconomyBootstrapPowers & | ||
* interlockPowers} powers | ||
* @param {{ options: { auctionsRef: { bundleID: string } } }} options | ||
*/ | ||
export const addAuction = async ({ | ||
consume: { | ||
zoe, | ||
board, | ||
chainTimerService, | ||
priceAuthority, | ||
chainStorage, | ||
economicCommitteeCreatorFacet: electorateCreatorFacet, | ||
auctioneerKit: legacyKitP, | ||
}, | ||
produce: { newAuctioneerKit, auctionsUpgradeComplete }, | ||
instance: { | ||
consume: { reserve: reserveInstance }, | ||
}, | ||
installation: { | ||
export const addAuction = async ( | ||
{ | ||
consume: { | ||
auctioneer: auctionInstallation, | ||
contractGovernor: contractGovernorInstallation, | ||
zoe, | ||
board, | ||
chainTimerService, | ||
priceAuthority, | ||
chainStorage, | ||
economicCommitteeCreatorFacet: electorateCreatorFacet, | ||
auctioneerKit: legacyKitP, | ||
}, | ||
produce: { newAuctioneerKit, auctionsUpgradeComplete }, | ||
instance: { | ||
consume: { reserve: reserveInstance }, | ||
}, | ||
installation: { | ||
consume: { contractGovernor: contractGovernorInstallation }, | ||
produce: { auctioneer: produceInstallation }, | ||
}, | ||
issuer: { | ||
consume: { [Stable.symbol]: stableIssuerP }, | ||
}, | ||
}, | ||
issuer: { | ||
consume: { [Stable.symbol]: stableIssuerP }, | ||
}, | ||
}) => { | ||
trace('addAuction start'); | ||
{ options }, | ||
) => { | ||
trace('addAuction start', options); | ||
const STORAGE_PATH = 'auction'; | ||
const { auctionsRef } = options; | ||
|
||
const poserInvitationP = E(electorateCreatorFacet).getPoserInvitation(); | ||
const bundleID = auctionsRef.bundleID; | ||
/** | ||
* @type {Promise< | ||
* Installation<import('../../src/auction/auctioneer.js')['start']> | ||
* >} | ||
*/ | ||
const installationP = E(zoe).installBundleID(bundleID); | ||
produceInstallation.reset(); | ||
produceInstallation.resolve(installationP); | ||
|
||
const [ | ||
initialPoserInvitation, | ||
|
@@ -89,10 +101,12 @@ export const addAuction = async ({ | |
}, | ||
); | ||
|
||
const installation = await installationP; | ||
|
||
const governorTerms = await deeplyFulfilledObject( | ||
harden({ | ||
timer: chainTimerService, | ||
governedContractInstallation: auctionInstallation, | ||
governedContractInstallation: installation, | ||
governed: { | ||
terms: auctionTerms, | ||
issuerKeywordRecord: { Bid: stableIssuer }, | ||
|
@@ -103,7 +117,7 @@ export const addAuction = async ({ | |
}), | ||
); | ||
|
||
/** @type {GovernorStartedInstallationKit<typeof auctionInstallation>} */ | ||
/** @type {GovernorStartedInstallationKit<typeof installationP>} */ | ||
const governorStartResult = await E(zoe).startInstance( | ||
contractGovernorInstallation, | ||
undefined, | ||
|
@@ -179,14 +193,23 @@ export const ADD_AUCTION_MANIFEST = harden({ | |
auctioneer: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't need to consume the auctioneer installation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
contractGovernor: true, | ||
}, | ||
produce: { auctioneer: true }, | ||
}, | ||
issuer: { | ||
consume: { [Stable.symbol]: true }, | ||
}, | ||
}, | ||
}); | ||
|
||
/* Add a new auction to a chain that already has one. */ | ||
export const getManifestForAddAuction = async () => { | ||
return { manifest: ADD_AUCTION_MANIFEST }; | ||
/** | ||
* Add a new auction to a chain that already has one. | ||
* | ||
* @param {object} _ign | ||
* @param {any} addAuctionOptions | ||
*/ | ||
export const getManifestForAddAuction = async (_ign, addAuctionOptions) => { | ||
return { | ||
manifest: ADD_AUCTION_MANIFEST, | ||
options: addAuctionOptions, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -41,8 +41,8 @@ const any = promises => | |||||||
* interlockPowers} powers | ||||||||
* @param {{ options: { vaultsRef: { bundleID: string } } }} options | ||||||||
*/ | ||||||||
export const upgradeVaults = async (powers, { options }) => { | ||||||||
const { | ||||||||
export const upgradeVaults = async ( | ||||||||
{ | ||||||||
consume: { | ||||||||
agoricNamesAdmin, | ||||||||
newAuctioneerKit: auctioneerKitP, | ||||||||
|
@@ -58,10 +58,15 @@ export const upgradeVaults = async (powers, { options }) => { | |||||||
newAuctioneerKit: tempAuctioneerKit, | ||||||||
auctionsUpgradeComplete: auctionsUpgradeCompleteProducer, | ||||||||
}, | ||||||||
installation: { | ||||||||
produce: { VaultFactory: produceVaultInstallation }, | ||||||||
}, | ||||||||
instance: { | ||||||||
produce: { auctioneer: auctioneerProducer }, | ||||||||
}, | ||||||||
} = powers; | ||||||||
}, | ||||||||
{ options }, | ||||||||
) => { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm struggling to understand this change. Is it just formatting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's mostly formatting. The old code had access to the name It was just (bad?) luck that the differ matches the expansion of powers in the param list with the identical one in the body. I would have accepted a suggestion that it was unrelated to this PR, but now that I'm changing the expansion of powers in order to get |
||||||||
const { vaultsRef } = options; | ||||||||
const kit = await vaultFactoryKit; | ||||||||
const auctioneerKit = await auctioneerKitP; | ||||||||
|
@@ -76,27 +81,13 @@ export const upgradeVaults = async (powers, { options }) => { | |||||||
* Installation<import('../../src/vaultFactory/vaultFactory.js')['start']> | ||||||||
* >} | ||||||||
*/ | ||||||||
let installationP; | ||||||||
const installationP = E(zoe).installBundleID(bundleID); | ||||||||
produceVaultInstallation.reset(); | ||||||||
produceVaultInstallation.resolve(installationP); | ||||||||
Comment on lines
+51
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The But the only cost to doing it this way is 1 cross-vat call and a bit of allocation / GC. And there's benefit in clarity. And it looks like the agoric-sdk/packages/deploy-script-support/src/coreProposalBehavior.js Lines 169 to 171 in aedfac6
|
||||||||
|
||||||||
await auctionsUpgradeComplete; | ||||||||
auctionsUpgradeCompleteProducer.reset(); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a little surprising that the vaults upgrade is producing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think your earlier suggestion of a naming convention is good. My theory here is that names like fooProcessCompletion should be considered to be single-use flags and should be cleaned up once consumed. |
||||||||
|
||||||||
if (vaultsRef) { | ||||||||
if (bundleID) { | ||||||||
installationP = E(zoe).installBundleID(bundleID); | ||||||||
await E.when( | ||||||||
installationP, | ||||||||
installation => | ||||||||
E(E(agoricNamesAdmin).lookupAdmin('installation')).update( | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||
'vaultFactory', | ||||||||
installation, | ||||||||
), | ||||||||
err => | ||||||||
console.error(`🚨 failed to update vaultFactory installation`, err), | ||||||||
); | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
const readCurrentDirectorParams = async () => { | ||||||||
const { publicFacet: directorPF } = kit; | ||||||||
|
||||||||
|
@@ -280,6 +271,9 @@ export const getManifestForUpgradeVaults = async ( | |||||||
newAuctioneerKit: uV, | ||||||||
auctionsUpgradeComplete: uV, | ||||||||
}, | ||||||||
installation: { | ||||||||
produce: { VaultFactory: true }, | ||||||||
}, | ||||||||
instance: { produce: { auctioneer: uV, newAuctioneerKit: uV } }, | ||||||||
}, | ||||||||
}, | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in discussion, we agreed
newAuctioneerKit
should go away in favor of theauctionsUpgradeComplete
sync point and replacingauctioneerKit
( with reset, resolve ).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done