-
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.
test: a test framework for verifying upgrade of Zoe and ZCF
It starts from the currently installed version of Zoe and ZCF. First it verifies that reallocation via staging and via the helper work and that the version internal to ZCF is not present. It then upgrades Zoe and ZCF as necessary to introduce the new behavior. Finally, it re-runs the initial verification to show that the ZCF internal version works. This currently fails on the first step since it runs in a state in which the new Zoe/ZCF code has already replaced the old. Variants of this test will run on master without this PR to verify that upgrading to the new Zoe/ZCF works, and in deployment/upgrade-test to show that the upgrade to the new zoe & zcf will succeed.
- Loading branch information
1 parent
a7895a9
commit 700e334
Showing
8 changed files
with
587 additions
and
153 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,44 @@ | ||
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); | ||
|
||
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); | ||
}; | ||
|
||
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
Oops, something went wrong.