Skip to content
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

asyncFlow should directly support E via promise handlers #9299

Open
Tracked by #9281
erights opened this issue Apr 28, 2024 · 3 comments · May be fixed by #9322
Open
Tracked by #9281

asyncFlow should directly support E via promise handlers #9299

erights opened this issue Apr 28, 2024 · 3 comments · May be fixed by #9322
Assignees
Labels
asyncFlow related to membrane-based replay and upgrade of async functions bug Something isn't working

Comments

@erights
Copy link
Member

erights commented Apr 28, 2024

See #9097 (comment)

makeGuestForHostVow will need to create a handled promise whose handler reflects an invocation into a logged checkSend, which is analogous to checkCall. But where checkCall proceeds to do a synchronous host call, checkSend needs to do a host eventual-send. An important design question is what the hander should do with the host promise for the result of the host eventual send, since it can only track host vows, not host promises.

Likewise, makeGuestForHostRemotable will need to use the handled promise API to create the guest remotable as a remote presence. Unlike liveslot remote presences, this one can retain the same one methods that the current makeGuestForHostRemotable gives it, if the host remotable is just a local far object with methods. These will still support synchronous guest-side calls. But a guest use of E to do an eventual send will bypass these guest-side methods and go directly to the appropriate promise handler which acts like the one described above.

So the extra log opcode this will need is checkSend. The "return" side should already be well taken case of by doFulfill and doReject. Huh. The doFulfill and doReject don't happen until the host promise is settled, so we'd only need to convert a settled host promise to a settled host vow for the log, which is not a problem. Whew! (@mhofman , you might have tried to explain it to me and I didn't get it until now.)

@erights erights added bug Something isn't working asyncFlow related to membrane-based replay and upgrade of async functions labels Apr 28, 2024
@erights
Copy link
Member Author

erights commented Apr 28, 2024

Although this support will likely happen after #9097, it needs to happen before we commit to durable log state on chain, since this E support will take some correct programs that work, leaving behind one log, into one that behaves the essentially the same but produces a different log, causing it to fail replay.

@erights
Copy link
Member Author

erights commented Apr 28, 2024

If #9301 has already happened without checkSend or doSend, then to fix this issue in that context, we'll also need to add the dual opcode doSend.

@erights
Copy link
Member Author

erights commented Apr 28, 2024

Capturing here what @mhofman wrote at #9097 (comment)

When supporting E, the handler is given a resultP for send operations. That resultP is the guest promise, and the result promise returned by the send handler is adopted by that promise, so the resolvers of the returned promise can be mapped to the resultP guest promise. The bijection can map the resultP guest promise to the host vow / result promise of the actual eventual send performed on the host object.

@ivanlei ivanlei assigned erights and unassigned erights, iomekam and mhofman Apr 29, 2024
@erights erights linked a pull request May 6, 2024 that will close this issue
3 tasks
mergify bot pushed a commit that referenced this issue Jun 10, 2024
closes: #XXXX
refs: #9299 #9322

## Description

Prepare for #9322 by making any guest use of `E` until then cause an
error. We expect that it might be a while before #9322 is ready for
review. By merging this PR soon, we prevent any guest code or logs that
would commit us to an incompat way of handling `E`.

### Security Considerations

none
### Scaling Considerations

none
### Documentation Considerations

Should document that guests cannot invoke host vows or remotables with
`E` until #9322 , which won't happen immediately.
### Testing Considerations

- [x] need to test what kind of error state this goes into. Should be a
panic, so that an upgrade can unblock guest execution that got stuck
trying to `E`.
### Upgrade Considerations

The point. By making such use of `E` an error now, we ensure that #9322
can proceed without causing any compat problem with committed durable
state.

Co-authored-by: Mathieu Hofman <86499+mhofman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asyncFlow related to membrane-based replay and upgrade of async functions bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants