Add warning for non durably handled promises #9771
Labels
contract-upgrade
enhancement
New feature or request
liveslots
requires vat-upgrade to deploy changes
SwingSet
package: SwingSet
What is the Problem Being Solved?
One kind of resumability bug is when subscribing without watching a promise in one incarnation and getting upgraded before that promise resolves. These issues are particularly pernicious as they currently result in a silent disconnection of the handler, with a lack of forward progress on resolution of the promise.
To be resumable, the vat should use
watchPromise
on the subscribed promise. While most code should callwatchPromise
by the end of the crank in which the promise was subscribed to, in practice vats do not get upgraded in the middle of swingset runs, and as such it's ok for a promise to not be watched if it gets resolved "promptly".Note that not all subscribed promises at the liveslots layer are actually promises observed by the program: liveslots proactively subscribes to all imported promises (#6074 & #8469), and creates a subscribed promise for every message send even if using
E.sendOnly
(#3894).Description of the Design
To diagnose occurrences of this issue triggering, we should change liveslots to warn if it receives a promise resolution for a promise it doesn't have in its map. This is likely a sign that a previous incarnation subscribed to the promise but we didn't have a watch registration for it. I believe there are currently other cases where this situation arises (false positives), and we should minimize those if possible.
To prevent this issue from arising, we should provide diagnostics to the author akin to unhandled promise rejections:
Finally liveslots should implement support for
E.sendOnly
and contracts should adopt where appropriate. We can likely ignore the case of dropped imported promises for now.Security Considerations
None
Scaling Considerations
The lists should be kept durably to avoid unbounded heap growth (and to facilitate offline diagnostics)
Test Plan
TBD
Upgrade Considerations
Requires a chain software upgrade to upgrade liveslots, and vat upgrades to use the new liveslots version with these diagnostics.
The text was updated successfully, but these errors were encountered: