-
Notifications
You must be signed in to change notification settings - Fork 69
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
WASM IO compat #147
Comments
I went so far for the easiest approach. Which is simply to allow to pass bytes directly into the The only main issue, is that even it is implemented, the pub fn new(path: impl AsRef<std::path::Path>) -> Result<Self> {
Self::from_file(path)
} See the constructors avaliable here It's sad because indeed, For now, this will get slightly stuck. I'll try to PR to both |
Thank you very much for delving into this! 🙌 |
In order to support WASM. And specially browser witgen, one of the first steps is to actually eliminate the need to use `std::fs`. As aside from `emscripten`-wasm target, the rest don't even have an implementation so they will just fail in runtime. This allows to load `Program` from binary therefore allowig in-browser support for the crate. This work is done towards privacy-scaling-explorations/sonobe#147
In order to support WASM. And specially browser witgen, one of the first steps is to actually eliminate the need to use `std::fs`. As aside from `emscripten`-wasm target, the rest don't even have an implementation so they will just fail in runtime. This allows to load `Program` from binary therefore allowig in-browser support for the crate. This work is done towards privacy-scaling-explorations/sonobe#147
#149 definitely fixed this. I think we can close the issue and revisit it in the future if further improved support is required. |
In this crate, we rely on functions that require reading
.r1cs
and.wasm
files from the user's computer in order to be able to generate folding circuits.The problem is that when we try to use
sonobe
inwasm
(particularly in the browser) this crate only knows 1 way to get served this two files and it's though file paths that will then be read.So an alternative is needed that is compatible with
in-browser file reading
.One good example is how is done in Nova-Scotia. But with this, we are only able to fetch stuff from a website.
This can be a low-hanging-fruit to enable a very minimal browser-compat. We should later evaluate if we should also try to go for other alternatives like using FileReader from MDN web-docs which is available in toolkits like gloo. Specifically, gloo-file.
A final option is to use Web Storage API which should allow us to let the developers of apps load the file with JS or whatever it is, and then to provide a key with which this data was stored with and let us query it from Rust obtaining the file contents which we can then pass to
sonobe
to do it's work.IMO, we should go for the Nova-Scotia approach. Which is simple and easy to implement without trouble. And later, we can figure out if we need to improve this or not.
The text was updated successfully, but these errors were encountered: