-
Notifications
You must be signed in to change notification settings - Fork 313
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
Support for wasm32-unknown-unknown
target?
#138
Comments
Hi ! We plan to remove rust-crypto . |
|
Thanks @omershlo and @survived, I am excited to see those changes land!
It would be really useful to keep track of these to get an idea when we might be able to use |
@survived rust-secp256k1 should work on wasm, we even try to test it in the CI: https://github.com/rust-bitcoin/rust-secp256k1/blob/master/.github/workflows/rust.yml#L32 (I say try because there are dozens of different flavors of wasm interpreters ) |
Hey, I noticed that ZenGo-X/curv#137 has landed in What is the recommended process to test out updating the |
Hi @tmpfs, as you correctly observed, |
@survived, heads up that I just got this repository compiling and we move past the
I will return to this problem once #144 is ready for review 👍 |
@tmpfs Small note, if you want to enable a feature in a transitive dependency you can add |
Thanks @elichai, setting the feature flag for the transitive dependency fixes that issue and I move on to the next error:
So I figured I needed to enable the
But that doesn't help. Any ideas? |
Interestingly, when I try compiling for the
As I have disabled |
@tmpfs Note that if you have other dependencies that depend on The reason why you see this message is that some of your dependencies enforces |
Thanks for the tip @survived, it seems like all I needed was to set Using these dependencies: [dependencies]
multi-party-ecdsa = {path = "../../git/multi-party-ecdsa", default-features = false}
getrandom = {version = "0.2", features = ["js"]}
curv-kzen = {version = "0.9", features = ["num-bigint"], default-features = false} Running |
@survived, having some issues getting entropy in WASM, I wonder if you have any ideas. First I hit this error calling
So I added the
Which yields:
Any pointers on how I should set up the RNG for WASM? Full |
I have been looking into the When I look at the
I noticed that the |
I managed to get it working by downgrading
To
Phew! |
@survived and anyone else following this thread I found an interesting problem. For context, I am trying to port the gg18 example to WASM using a websocket server backend, the code is here. I got to the point of verifying correctness of round 2 answers during key generation and hit this error:
Using Once I managed to integrate with
Which leads to this issue about So I think it is fair to say that adding threads to webassembly leads to the call to I think that supporting Would it be feasible to introduce a feature flag for those crates that disabled use of Maybe we could have a Happy to do the work to land this if you think it is a good approach 🙏 |
So this gets a bit strange, I have learnt that the multi-threaded So I tried to reproduce this using Which ultimately led me to find out that rand@0.6.5 does not use getrandom which is why that fix is not present. The code that is actually executing is here: https://github.com/rust-random/rand/blob/0.6.5/rand_os/src/wasm32_bindgen.rs. And because @survived, some guidance on the best way forward here would be useful. Should we try to get |
Looks like we need to wait for this PR (related issue) to land and then we should be good. I also wanted to update Once they land we can update |
I'm waiting for Regarding ( |
I like the sound of this, makes a lot of sense. Happy to help out if needed! For anyone that wants to try building for // Temporary hack for getRandomValues() error
const getRandomValues = crypto.getRandomValues;
crypto.getRandomValues = function(buffer) {
const array = new Uint8Array(buffer);
const value = getRandomValues.call(crypto, array);
buffer.set(value);
return buffer;
} |
Hi! I was just about to go down this path, and wanted to ask. @tmpfs were you able to compile for wasm? Were those conflicts solved or did you have to keep on using the hacked you mentioned? Thanks! |
@tmpfs great! Well I'll try to make it work following this thread. If you happen to have somewhere a repo where this is implemented that'd be awesome. Thanks for the help! |
@tmpfs Thanks! |
I have been investigating using multi-party ECDSA in WASM and wanted to know if there are plans to support the
wasm32-unknown-unknown
target so we could use this library from the browser?I have explored your emerald-city library and have used it to put together a very simple demo of using WASM (via
wasm-pack
) but would prefer to use something that is ready for production and has been audited, like this library or threshold-signatures.All my attempts to compile for
wasm32-unknown-unknown
have failed so far and when I tried withmulti-party-ecdsa
I get an error (that is now quite familiar!):Which is due to the deprecated
rustc-serialize
library being used byrust-crypto
. If we look at the code there is no implementation for theunknown
target OS.We can't fix
rustc-serialize
so the solution I would imagine is to remove the dependency onrust-crypto
which I believe is now deprecated in favour ofRustCrypto
.Would it be possible to merge the experimental work in
emerald-city
so we can build this library for WASM?Thanks 🙏
The text was updated successfully, but these errors were encountered: