-
Notifications
You must be signed in to change notification settings - Fork 231
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
A3p test zcf bundle cap #8911
A3p test zcf bundle cap #8911
Changes from all commits
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"ava": { | ||
"concurrency": 1, | ||
"serial": true, | ||
"timeout": "1m", | ||
"files": [ | ||
"!submission" | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import test from 'ava'; | ||
|
||
import { | ||
evalBundles, | ||
getIncarnation, | ||
getVatDetails, | ||
} from '@agoric/synthetic-chain'; | ||
|
||
const SUBMISSION_DIR = 'probe-submission'; | ||
|
||
test('upgrade Zoe to verify ZcfBundleCap endures', async t => { | ||
await null; | ||
t.assert((await getIncarnation('zoe')) === 1, 'zoe incarnation must be one'); | ||
|
||
// Before the test, the Wallet Factory should be using the legacy ZCF | ||
const detailsBefore = await getVatDetails('walletFactory'); | ||
t.true(detailsBefore.incarnation >= 2, 'wf incarnation must be >= 2'); | ||
|
||
await evalBundles(SUBMISSION_DIR); | ||
|
||
const detailsAfter = await getVatDetails('walletFactory'); | ||
t.is( | ||
detailsAfter.incarnation, | ||
detailsBefore.incarnation + 2, | ||
'wf incarnation must increase by 2', | ||
); | ||
|
||
// The test restarts the WalletFactory, so it'll use the recently assigned | ||
// ZCF bundle. It then restarts Zoe, so it'll revert to whichever ZCF bundle | ||
// made it to persistent store. We then restart the Wallet Factory and see if | ||
// it's gone back to the ZCF that Zoe initially knew about. If we could get the | ||
// ZCF bundleID here from the probe, we'd explicitly check for that. Instead, | ||
// we have to be content that it did indeed use the newly assigned bundle in | ||
// manual tests. | ||
t.not(detailsAfter.bundleID, detailsBefore.bundleID); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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: '@agoric/vats/src/proposals/probeZcfBundle.js', | ||
getManifestCall: [ | ||
'getManifestForProbeZcfBundleCap', | ||
{ | ||
zoeRef: publishRef(install('@agoric/vats/src/vat-zoe.js')), | ||
zcfRef: publishRef(install('@agoric/zoe/src/contractFacet/vatRoot.js')), | ||
walletRef: publishRef( | ||
install('@agoric/smart-wallet/src/walletFactory.js'), | ||
), | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('probeZcfBundle', defaultProposalBuilder); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { E } from '@endo/far'; | ||
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; | ||
|
||
// verify that Zoe remembers the zcfBundleCap across upgrades | ||
export const probeZcfBundleCap = async ( | ||
{ | ||
consume: { | ||
vatAdminSvc, | ||
walletFactoryStartResult, | ||
provisionPoolStartResult, | ||
chainStorage, | ||
walletBridgeManager: walletBridgeManagerP, | ||
vatStore, | ||
}, | ||
}, | ||
options, | ||
) => { | ||
const { zoeRef, zcfRef, walletRef } = options.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 still confused how these options can get passed in. The way things are structured now, the submission is prepared before a3p proposals are run. However I think this proposal does not actually need to generate any bundle, so the submission could be manually written, with the template mechanism used to fill the probed bundle refs? 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 you're right. My current belief is that I want to cite the Zoe and ZCF bundles that will have been included in upgrade-15. I want to do a null upgrade of Zoe to trigger reversion to a stored ZCF bundle. If I can then do a null upgrade to a contract vat (e.g. WalletFactory) then I can compare the ZCF bundle used to the ZCF bundleID just used in upgrade-15. 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. @turadg added a check so if the bundle has already been installed, it doesn't do it again. Including these bundle IDs in the manifest is necessary so I can have them to request an upgrade. 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 don't understand how that's relevant. I actually don't understand why this test needs to install any new bundle ? 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 mean I understand how one option is to do a full generation of core eval scripts and bundles, but I thought from the description we just wanted to "restart" the contracts. I suppose we may want to upgrade ZCF since the test checks it uses the new version 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. restarting the contracts would be fine. When I used Since the only productive way to upgrade the wallet factory was using With ZCF, I need to pass the bundleID to 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. With the fix in commit |
||
|
||
const { adminNode, root: zoeRoot } = await E(vatStore).get('zoe'); | ||
const zoeConfigFacet = await E(zoeRoot).getZoeConfigFacet(); | ||
|
||
// STEP 1: restart WF; it'll use the newest ZCF known to Zoe //////////////// | ||
|
||
const WALLET_STORAGE_PATH_SEGMENT = 'wallet'; | ||
const [walletBridgeManager, walletStorageNode, ppFacets] = await Promise.all([ | ||
walletBridgeManagerP, | ||
makeStorageNodeChild(chainStorage, WALLET_STORAGE_PATH_SEGMENT), | ||
provisionPoolStartResult, | ||
]); | ||
const walletReviver = await E(ppFacets.creatorFacet).getWalletReviver(); | ||
const privateArgs = { | ||
storageNode: walletStorageNode, | ||
walletBridgeManager, | ||
walletReviver, | ||
}; | ||
|
||
const { adminFacet: walletAdminFacet } = await walletFactoryStartResult; | ||
await E(walletAdminFacet).upgradeContract(walletRef.bundleID, privateArgs); | ||
|
||
// STEP 2: Set the ZCF bundle //////////////////////// | ||
await E(zoeConfigFacet).updateZcfBundleId(zcfRef.bundleID); | ||
|
||
// STEP 3: Upgrade Zoe again //////////////////////// | ||
// ////// See if Zoe forgets ZcfBundleCap ////////// | ||
turadg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const zoeBundleCap = await E(vatAdminSvc).getBundleCap(zoeRef.bundleID); | ||
await E(adminNode).upgrade(zoeBundleCap, {}); | ||
|
||
// STEP 4: restart WF //////////////////////// | ||
await E(walletAdminFacet).restartContract(privateArgs); | ||
|
||
// ////// See which zcf bundle was used ////////// | ||
turadg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
harden(probeZcfBundleCap); | ||
|
||
export const getManifestForProbeZcfBundleCap = (_powers, options) => ({ | ||
manifest: { | ||
[probeZcfBundleCap.name]: { | ||
consume: { | ||
vatAdminSvc: true, | ||
vatStore: true, | ||
walletBridgeManager: true, | ||
walletFactoryStartResult: true, | ||
provisionPoolStartResult: true, | ||
chainStorage: true, | ||
}, | ||
}, | ||
}, | ||
options, | ||
}); | ||
harden(getManifestForProbeZcfBundleCap); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -469,8 +469,12 @@ export const makeZCFZygote = async ( | |
|
||
await null; | ||
if (!zcfBaggage.has('repairedContractCompletionWatcher')) { | ||
await E(zoeInstanceAdmin).repairContractCompletionWatcher(); | ||
console.log(`Repaired contract completion watcher`); | ||
// We don't wait because it's a cross-vat call (to Zoe) that can't be | ||
// completed during this vat's start-up | ||
E(zoeInstanceAdmin) | ||
.repairContractCompletionWatcher() | ||
.catch(() => {}); | ||
Comment on lines
-472
to
+476
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. This is not strictly a testing change anymore, right? 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. correct. I'd guess you're hinting that I should change something, presumably the commit logs, but I don't understand their impact. Is it sufficient that the latest commit has a 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 main problem is that this change is in a commit titled The PR title says "test" but it's normal for other changes to be made to support a testing requirement. The problem is when the changelog leaves those changes out. 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 commit makes two changes. One is the fix to If I amend the commit to call it a 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.
Up to you.
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 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. Looks like it's still in a "test" commit. |
||
|
||
zcfBaggage.init('repairedContractCompletionWatcher', true); | ||
} | ||
|
||
|
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.
Why can't
zcfRef
be the only ref, with a dummy implementation?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.
WalletRef: The fix in
startInstance
below wasn't present the previous time that the walletFactory was upgraded, so Zoe didn't remember the bundleId as it should have.ZoeRef: adminNode.upgrade() requires a bundleCap. I'd be happy to re-use the already known one. This seems to be the most straightforward way to get it.