-
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
liveslots should expose sendOnly functionality to vat userspace code #2691
Comments
It depends how soon you need it. The proposal-eventual-send needs some work and there will be an API change (likely If you have a specific use case, you're welcome to propose something based on |
@michaelfig has anything changed on the eventual-send side since then? I'd like to implement something on this soon. |
No change. You can use |
Incidentally, the primary use case for this is to allow I don't expect much userspace to take advantage of |
What is the Problem Being Solved?
Messages sent through the SwingSet kernel have an optional
result
parameter, which identifies the promise that should be resolved with the results of delivering the message. Our usualp = E(target).method(args)
syntax returns a javascript Promise which is allocated avpid
(vat-side promise identifier), and thatvpid
is included as theresult
of asyscall.send
.Messages which lack a
result
are "send only": the sender is not informed about the results in any way (not even if the message is sent to a dead vat). When appropriate, this is more efficient, because we don't need to allocate/track/resolve a result promise identifier.Liveslots doesn't currently expose a way to do "send only" to userspace. #1865 added
E.sendOnly()
support to@agoric/eventual-send
, so that's the preferred thing to call, but I don't think liveslots knows how to handle this any differently than a regular result-bearingE()
call.We'd especially like to use this in the vattp vat, which is a regular liveslots-based vat, but wants to send unidirectional
sendOnly
messages into the comms vat.Description of the Design
I think this will involve changing the
fulfilledHandler
inmakeImportedPresence()
to have more than just theapplyMethod
property, maybe anapplyMethodOnly
one. Likewise for theunfulfilledHandler
inmakeImportedPromise()
. Maybe this should callqueueMessage
too, but withreturnedP=undefined
. We also need to changequeueMessage
to realize when it's getting an emptyreturnedP
and not attempt to register it invalToSlot
/slotToVal
.@michaelfig does that sound right? The best docs I've been able to find are https://github.com/tc39/proposal-eventual-send , and they talk about handler traps for
sendOnly
, but the names they use (eventualSend
/eventualSendOnly
) don't match theapplyMethod
that we're using in liveslots right now. I can dig into the@agoric/eventual-send
code if that's a better source of truth.Security Considerations
This won't increase the authority available to user code. Using
sendOnly
has a different set of debugging properties than a normal send: if something breaks, you won't hear about it, and unless we have a usable way to record/publish/reveal all exceptions that occur during message sends, nobody else will hear about it either. It is frequently better to log-and-ignore the error than to do a realsendOnly
, so a developer can at least have a chance to discover a coding error. But if the message recipient takes responsibility for log-and-ignore, perhaps at the top level of the receiving object, thensendOnly
can be appropriate.Test Plan
regular unit tests
The text was updated successfully, but these errors were encountered: