-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7966 from Agoric/6678-test-upgradeZoeZcf
test: a test framework for verifying upgrade of Zoe and ZCF
- Loading branch information
Showing
8 changed files
with
500 additions
and
20 deletions.
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,19 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ | ||
export const defaultProposalBuilder = async ({ publishRef, install }) => | ||
harden({ | ||
sourceSpec: '../src/proposals/zcf-proposal.js', | ||
getManifestCall: [ | ||
'getManifestForZoe', | ||
{ | ||
zoeRef: publishRef(install('../src/vat-zoe.js')), | ||
zcfRef: publishRef(install('../../zoe/src/contractFacet/vatRoot.js')), | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('replace-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,45 @@ | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @param {BootstrapPowers & { | ||
* consume: { | ||
* vatAdminSvc: VatAdminSve; | ||
* vatStore: MapStore<string, CreateVatResults>; | ||
* }; | ||
* }} powers | ||
* @param {object} options | ||
* @param {{ zoeRef: VatSourceRef; zcfRef: VatSourceRef }} options.options | ||
*/ | ||
export const upgradeZcf = async ( | ||
{ consume: { vatAdminSvc, vatStore } }, | ||
options, | ||
) => { | ||
const { zoeRef, zcfRef } = options.options; | ||
|
||
const zoeBundleCap = await E(vatAdminSvc).getBundleCap(zoeRef.bundleID); | ||
console.log(`ZOE BUNDLE ID: `, zoeRef.bundleID); | ||
|
||
const { adminNode, root: zoeRoot } = await E(vatStore).get('zoe'); | ||
|
||
await E(adminNode).upgrade(zoeBundleCap, {}); | ||
|
||
const zoeConfigFacet = await E(zoeRoot).getZoeConfigFacet(); | ||
await E(zoeConfigFacet).updateZcfBundleId(zcfRef.bundleID); | ||
console.log(`ZCF BUNDLE ID: `, zcfRef.bundleID); | ||
}; | ||
|
||
export const getManifestForZoe = (_powers, { zoeRef, zcfRef }) => ({ | ||
manifest: { | ||
[upgradeZcf.name]: { | ||
consume: { | ||
vatAdminSvc: 'vatAdminSvc', | ||
vatStore: 'vatStore', | ||
}, | ||
produce: {}, | ||
}, | ||
}, | ||
options: { | ||
zoeRef, | ||
zcfRef, | ||
}, | ||
}); |
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
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
Oops, something went wrong.