-
Notifications
You must be signed in to change notification settings - Fork 25
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
Tracking issue for building IPA against wasm-unknown-unknown
target
#385
Comments
executing rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown |
brace for impact
|
Based on conversations here seanmonstar/reqwest#1300 and the way Reqwest deals with Tokio: https://github.com/seanmonstar/reqwest/blob/master/Cargo.toml#L159 my conclusion is we have to take the whole Tokio crate out in order to build for WASM. Tokio supports |
IPA uses tokio channels and runtime
|
hmm, CF have added support for WASI recently: https://blog.cloudflare.com/announcing-wasi-on-workers/ |
wow, tokio is actually fine with
|
Setting |
I've spent sometime researching on this topic, here is what I found We basically have two ways to deploy IPA to CF Workers Use workers-rs crateThis crate seems to be a wrapper around Pros:
Cons:
Work required to eliminate Tokio from WASM build:
Use WASIAccording to https://blog.cloudflare.com/announcing-wasi-on-workers/, there is an experimental support for WASI on CF workers. It requires IPA to compile for Pros
Cons
Note that it is probably possible to support native routing in Rust, but would require us to replicate the work done in ConclusionIf we decide that it is worth investing in CF workers support, I'd go with option 1 and use |
There's sort of two dimensions to consider here. The first is the software ecosystem for deploying rust on Workers, which for the moment is fairly immature. (As you saw.) FWIW, I have been using workers-rs for a while, and it seems to work well enough when you're developing your application specifically for that platform. For instance, Daphne has much of the core protocol logic in a separate rust crate The second question is whether Workers is a suitable architecture for this protocol. Beyond trying to get the code to build, have you spent any time looking into how the backend components would work? What is needed for long term storage, and how would you implement it? (There are lots of options here.) |
@akoshelev did you manage to get past the ring compilation issue with the wasm32-wasi target? I noticed the following issues on the ring repo: Would it be possible to switch to another crypto library that has wasm32-wasi support? A subset of Tokio can be used with wasm32-wasi. Since I can't compile the project i'm not able to tell if it's going to work on Cloudflare Workers. The WASI support on Workers is incomplete. For instance, WASI's |
@cjpatton apologies, somehow I missed the notification about this response.
I agree with it, we did not realize the need to support CF workers until late 2022. Tokio crate brings more than just a scheduler so our code uses it extensively. It does still seem to be possible to use workers-rs crate, but the limitations I outlined above.
So far it does look promising for IPA use case. MPC helper state is ephemeral, does not require durable storage (mod helper configuration) and MPC computation is network heavy. There is an open question how to store the query results, but this operation is relatively infrequent for the duration of worker lifetime. Summarizing it, Durable objects seem to cover our use cases for storage well, but ofc it remains to be seen whether DO is enough. |
@xtuc I was some time ago, but think @martinthomson suggestion to use |
According to https://github.com/cloudflare/workers-rs this is required to run IPA on CF Workers
The text was updated successfully, but these errors were encountered: