-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add protocol subtyping for read-only operations #289
Comments
The implementation definitely needs refactoring, but at bottom the "mandatory participating hosts" thing is quite similar to what you're proposing:
You are essentially proposing to replace 1. But all the complexity is really in 2. In your example, how would you calculate the protocol of I do like the idea that queries don't have to have the same protocol as the object being queried; as you said, how the read of |
Doesn't the backend have to do something special with the current setup anyway? Or be written in a way that makes this all magically work? E.g., |
The backend interpreter keeps track of the set of participating hosts for each statement and will only call out a protocol backend for a host if the host is participating. Within the protocol backends themselves, this is not a problem since everything is done through communication events. So for example if there is a read at a variable in Again, I'm not opposed to the idea, but there are some questions that need to be answered:
|
Consider the following program:
This program gets compiled as follows:
Note that
$tmp_1
is placed atReplication(alice, bob)
sincelimit
is placed there. Viaduct currently requires all method calls (queries and updates) to an object to happen on the protocol that stores that object. This has an unfortunate side effect: it looks like bothalice
andbob
must be involved in the loop. This is a performance problem sincebob
uselessly has to follow the control flow. Worse, if the guard is invisible tobob
(e.g., imaginei
is labelled as{A}
), then this program will fail to compile.Our current solution to this problem is the notion of "mandatory participating hosts" which I do not understand. It looks pretty hacky, and the logic is spread across the entire protocol selection pipeline which makes the concept pretty mysterious.
I'd like to propose a more uniform solution: use-site subtyping for protocols. Protocols are allowed to declare sub-protocols that they can act like. We then allow executing read-only operations only (e.g., queries) at a subprotocol. For example,
Replication(alice, bob, chuck)
would declareand
Commitment(sender=alice, receivers=H)
would declareas subprotocols. The above program can now read
limit
atLocal(alice)
and it's clear from the compiled program (and not just some weird internal state the compiler maintains) thatbob
is not involved in the loop.The text was updated successfully, but these errors were encountered: