-
Notifications
You must be signed in to change notification settings - Fork 208
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
zoe will be confused by vat-vat-admin upgrade cancelling the 'done' promise #8263
Comments
How does it even work today across Zoe upgrades? |
And yeah I'm really concerned about simply tail recurring with |
It does not, that's what I tried to capture in:
|
My bad, I hadn't gotten to that part yet. That feels like a separate but related issue. Effectively Zoe upgrades don't handle vat termination cleanup today already. |
I tested this more directly with my "ghost-replay" tool (not yet landed). It shows that the upgrade11 version of zoe will react to a cancelled promise (like kp146) by setting % node src/run-ghost.js swing-store cancel-promise kp146
...
% cat vatstore.out
## v9.vom.o+d33/2
- state.acceptingOffers:
old: body: "#true" slots:
new: body: "#false" slots: Looking at the slogfile from this test, I see this |
What is the Problem Being Solved?
When a parent vat uses
E(vatAdminService).createVat()
to create a new vat, one thing it gets back is anadminNode
: the "control facet" for the new vat. If you callE(adminNode).done()
, the result Promise you get back will not generally fire until the new vat is upgraded.However, vat-vat-admin could get upgraded, and all Promises decided by an upgraded vat are cancelled. This results in a distinctive rejection of the promise (the rejection value is an object, with
{ name: 'vatUpgraded' }
and some other properties), which can be recognized by theisUpgradeDisconnection
function from@agoric/internal
.While planning changes that would require
vat-vat-admin
to be upgraded, we realized that the currently-deployed Zoe will probably react to a vat-vat-admin upgrade as if the child vat had terminated, because the code that follows the.done()
promise does not useisUpgradeDisconnection
:agoric-sdk/packages/zoe/src/zoeService/startInstance.js
Lines 283 to 289 in 2ffcef2
Description of the Design
The zoe code needs to examine the rejection result using
isUpgradeDisconnection(reason)
. Iftrue
, then vat-vat-admin was upgraded, and zoe needs to fetch a newdone
promise (by callingE(adminNode).done()
) and attach the same sort of callback. The original usesE.when()
so I'm not quite sure of the sequence, but if it were using.then
, the fixed version might look like:Security Considerations
I know we use
E.when
as a guard against malicious promise-like objects with a fake.then
method, and I wouldn't want to reduce our defensiveness by adding a.then
, please adapt the code above to the local norms.Contract vats which call
vatPowers.exitVatWithFailure(makeUpgradeDisconnection())
could confuse this code into an infinite loop, or maybe not, depending upon whatadminNode.done()
does on a terminated vat: I think the second call might trigger a different kind of error.Scaling Considerations
Test Plan
We need Zoe unit tests that simulate the
done()
promise being abandoned, to ensure that Zoe will react properly. We also need Zoe upgrade tests to ensure that Zoe re-acquires the promise after an upgrade, or that its use of a DurablePromiseWatcher (see below) is doing the right thing.Upgrade Considerations
The deployed Zoe has the old code, and will react the bad way unless/until Zoe is upgraded. So we must defer any upgrades of vat-vat-admin until after a zoe upgrade that fixes this issue.
The zoe code that calls
E(adminNode).done()
lives instartInstance
, which would not be called again during a Zoe upgrade. Unless we add something that re-runsE(adminNode).done()
on all existing contract instances during a Zoe upgrade, I think a Zoe upgrade will basically forget the old handler, so subsequent contract vat terminations will just be ignored. That's probably bad for cleanup.It may be a good idea to have Zoe use
globalThis.VatData.providePromiseWatcher()
to establish a durable watcher on thedone
Promise. That would remove the need to re-fetch adone
promise when zoe is upgraded, however we would still need theisUpgradedDisconnection()
check to guard against vat-vat-admin being upgraded.cc @Chris-Hibbert to think about the Zoe changes
cc @mhofman to help me remember that we cannot upgrade vat-vat-admin until a Zoe fix+upgrade is deployed
The text was updated successfully, but these errors were encountered: