-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🚀
Although, I'm not sure I'm convinced about the "upgrade" approach for the TCP case. It seems that it introduces unnecessary complexity and I'm not sure how clients are going to behave with it.
I'm now wondering if it would be better to split these services up to different ports. Having to establish a new connection isn't too big of a deal, given we now know that axum/hyper is not very good at supporting what we need. We can put the websocket endpoint on something like ws.tlsnotary.org
.
What do you think about the following:
- New route called
/new_session
which is used for configuration negotation and issues the prover a session ID as it does now. - TCP clients get to reuse the connection, but now hit
/notarize
to intiiate notarization sending an HTTP Close. If the session id is good, we set a flag indicating the connection info in the Notary global state. We use thewithout_shutdown
provided by axum and when a connection closes we check if the flag is set and act accordingly. - Websocket clients hit a different port which we run a separate service on which only provides the websocket handler you've written.
This shouldn't be that much of a backtrack, lmk what you think.
Mulling this over further, I'm not completely against the "upgrade" approach for TCP clients. However, I do think we should decouple the configuration negotiation/session id issuance from the route for starting notarization. What do you think about combining the websocket and tcp extractors into 1? |
Agreed on separating configuration from notarization — it was coupled together because originally I didn't know Axum can reuse the same TCP connection for consecutive HTTP requests — separating will make configuration endpoint much simpler and straightforward to understand and interact with. For combining websocket and tcp extractor into one, if I understand correctly, it means we only have one handler (hence one endpoint with either (1) from prover developer perspective, they only have one notarization endpoint to deal with regardless of client type and the request format is very similar where it only differs in the value of (2) from notary developer perspective, the pro is that the logic of retrieving Please let me know if I understand your statement of combining the extractors correctly, and also if you have any other reasons that I did not think of when you suggested this :) |
Yes, that is essentially what I have in mind for composing the extractors. You would first strip the session ID off, then you would check which protocol is present in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
* Add logic to promote to http and then downgrade to tcp for notarization. * Fix client hang issue * Change channel message type. * Fix response parsing from notary. * Fix websocket implementation and use upgrade protocol for raw tcp. * Modify test to mimick browser extension for websocket test. * Refactor tcp client handling. * Add global store for persistent data. * Finish websocket handler and test. * Add comments. * Add more comments and documentation. * Add openapi.yaml. * Modify README. * Add architecture explanation. * Modify README. * Fix PR based on comments. * Combine tcp and websocket extractors. * Refactor and fix documentations.
* Add logic to promote to http and then downgrade to tcp for notarization. * Fix client hang issueno * Change channel message type. * Fix response parsing from notary. * Fix websocket implementation and use upgrade protocol for raw tcp. * Modify test to mimick browser extension for websocket test. * Refactor tcp client handling. * Add global store for persistent data. * Finish websocket handler and test. * Add comments. * Add more comments and documentation. * Add openapi.yaml. * Modify README. * Add architecture explanation. * Modify README. * Fix PR based on comments. * Combine tcp and websocket extractors. * Refactor and fix documentations.
#3.