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

WasmCalculator can only be created with FS access #72

Open
CPerezz opened this issue Aug 20, 2024 · 0 comments · Fixed by arnaucube/circom-compat#3
Open

WasmCalculator can only be created with FS access #72

CPerezz opened this issue Aug 20, 2024 · 0 comments · Fixed by arnaucube/circom-compat#3

Comments

@CPerezz
Copy link

CPerezz commented Aug 20, 2024

I ignore if this is done on purpose or not, but when trying to make Sonobe wasm-compat, one of the things I had to change is to receive bytes directly instead of paths to .r1cs and wasm files.
For the former, this was easy. But for the latter, it turns out to not be possible.

At some point, there's the need to create a WitnessCalculator. This, presents a problem. Which is that the only way for us to create this is to call the API functions this crate exposes as constructors. Which can be seen here.

As seen, all of them rely to pass a Path and read from fs. But this is not possible if we're in a browser env.
So what we would need (and is supported in wasmer already), is another constructor which calls wasmer/struct.Module.html#method.new underneath.

On this way, the WitnessCalculator can be generated from a wasm binary already read by JS previously.

I wonder if this is something that just hasn't been done because no-one needed it, or because there's something I'm missing which explains clearly why this isn't supported.

I'm happy to PR to add this feature :)

CPerezz added a commit to CPerezz/circom-compat that referenced this issue Aug 21, 2024
As discussed in arkworks-rs#72
it's not currently possible to load parameters from their binary.

This would help a lot in browser envoiroments where JS can take care of
handling the read and we just open the door in the WASM module to allow
to load new ones from the bytes read.

The commit adds a change in the tests which now load from binary instead
of reading from file. This ensures that the reading is indeed working as
expected although we rely on a different fn from `wasmer`.

Closes arkworks-rs#72
arnaucube pushed a commit to arnaucube/circom-compat that referenced this issue Aug 22, 2024
As discussed in arkworks-rs#72
it's not currently possible to load parameters from their binary.

This would help a lot in browser envoiroments where JS can take care of
handling the read and we just open the door in the WASM module to allow
to load new ones from the bytes read.

The commit adds a change in the tests which now load from binary instead
of reading from file. This ensures that the reading is indeed working as
expected although we rely on a different fn from `wasmer`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant