-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade zcf: install bundle and call updateZcfBundleId()
copied from #9250.
- Loading branch information
1 parent
34ce82d
commit 7debf1d
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('packages/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ | ||
export const defaultProposalBuilder = async ({ publishRef, install }) => | ||
harden({ | ||
sourceSpec: '@agoric/vats/src/proposals/zcf-only-proposal.js', | ||
getManifestCall: [ | ||
'getManifestForUpgradingZcf', | ||
{ | ||
zcfRef: publishRef(install('@agoric/zoe/src/contractFacet/vatRoot.js')), | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('upgrade-zcf', defaultProposalBuilder); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// @ts-check | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @param {BootstrapPowers} powers | ||
* @param {object} options | ||
* @param {{ zcfRef: VatSourceRef }} options.options | ||
*/ | ||
export const upgradeZcfOnly = async ({ consume: { vatStore } }, options) => { | ||
const { zcfRef } = options.options; | ||
|
||
const { root: zoeRoot } = await E(vatStore).get('zoe'); | ||
|
||
const zoeConfigFacet = await E(zoeRoot).getZoeConfigFacet(); | ||
await E(zoeConfigFacet).updateZcfBundleId(zcfRef.bundleID); | ||
console.log(`ZCF BUNDLE ID: `, zcfRef.bundleID); | ||
}; | ||
harden(upgradeZcfOnly); | ||
|
||
// main and permit are for use with rollup-plugin-core-eval.js | ||
export const main = upgradeZcfOnly; | ||
|
||
export const permit = { | ||
consume: { | ||
vatStore: true, | ||
}, | ||
}; | ||
|
||
export const manifest = { | ||
[upgradeZcfOnly.name]: permit, | ||
}; | ||
|
||
export const getManifestForUpgradingZcf = (_powers, options) => ({ | ||
manifest, | ||
options, | ||
}); |