-
Notifications
You must be signed in to change notification settings - Fork 6
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 incompatibilities GRPC (crw-client package) #4
Comments
[UPDATE 1]: |
[UPDATE 2]: So after this I've made some other researches and found out that this should be the things that should be done in order to let the client (and the wallet consequently) build to WASM.
All references here: hyperium/tonic#31 |
In this there's a guy who made a grpc-web client generator from proto files. |
This worked. I was able to generate buildable WASM code for |
@manu0466 The tonic team has implemented the support for |
Tendermint has an api - https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit. Which takes signed proto transaction encoded in hex as an arguement and broadcasts it. Using this instead of grpc will make it completely cross platform. Since grpc is an optional feature in cosmos-sdk-proto, we can disable it and directly send it to the tendermint endpoint. This should allow us to build for wasm. Will be building this feature out on a fork, I can create a PR in main when its ready? |
Hi @shravanshetty1! Thanks for pointing this out but the doccumentation says also that the |
Of course will implement all 3 broadcast api's(sync, async, commit), its upto the user on which api he would like to use |
I have talked with one of my collegues and we prefer to use the gRPC instead of the tendermint REST API. |
I am also looking into using gRPC client for a cosmos node https://github.com/noandrea/cosmos-cash-credentials/tree/feat/grpc |
I agree grpc would definitely be better I tried to use https://github.com/titanous/grpc-web-client but it wont work because according to Not sure why the dependencies of generated files from tonic are different in these crates. |
Here a working implementation for grpc client for a cosmos-sdk based project. Hope it helps |
Since this project is intended to be WASM-compilable I'm opening this issue to track down and clarify why currently it's not.
By design, the environment of WASM is completely isolated (or sandboxed) from the native functionality of the underlying host system.
This means that by default, WASM is designed to perform nothing more than pure computation.
Consequently, access to "OS"-level resources such as file descriptors, network sockets, the system clock, and random numbers is not normally possible from it.
Due to this, the
crw-client
package is not actually buildable to WASM, but I found a patch that let me compile it for WASM. It needs some more work because I need to update the adapt the patch to the latest version of the library where it's applied.I'm not sure if this patch approach is the best one in the long term.
Probably it will make difficult to maintain the library unless those patches are merged to the libraries that I linked above.
Another approach could be wasmer which is the same library that cosmWASM use.
I'll study it and how it works and see if it's a better option than patches' Tetris.
The text was updated successfully, but these errors were encountered: