[zk-sdk] Separate out wasm components in zk-sdk to zk-sdk-wasm-js#78
Conversation
065c9c7 to
88ff541
Compare
grod220
left a comment
There was a problem hiding this comment.
Looks really good! Just a few questions.
There was a problem hiding this comment.
Can we add pnpm zk-sdk-wasm-js:test-wasm to the workflow as well?
There was a problem hiding this comment.
Yep, good idea. This is now added to the workflow.
There was a problem hiding this comment.
Looks like these artifacts should be .gitignore'd?
There was a problem hiding this comment.
Sorry for the sloppiness. These files should be now removed and the gitgnore updated.
| mod tests { | ||
| use {super::*, wasm_bindgen_test::*}; | ||
|
|
||
| wasm_bindgen_test_configure!(run_in_browser); |
There was a problem hiding this comment.
How does this work with https://github.com/solana-program/zk-elgamal-proof/pull/78/files#diff-0577d06b028a6e80c90c97c93ae5d6a499ae8eb2753ab383b2b77497721f57c0R8? This says run_in_browser, but the other command runs them in node?
There was a problem hiding this comment.
Sorry this was sloppiness from my side. I was playing around with both node and the browser setting and forgot to delete these lines. It seems like we can't reuse unit tests for both node and the browser setting. The tests run by default in node and then if we have the wasm_bindgen_test_configure!(run_in_browser) line, then the tests run in the browser setting.
If we refactor the unit tests into a dedicated test file, then it seems possible to reuse the tests for both node and the browser setting, but since these unit tests are for sanity check any way, I removed wasm_bindgen_test_configure!(run_in_browser) to run the tests in node for now.
6813776 to
253b666
Compare
I am starting to tackle #69.
As a preliminary step, I created
zk-sdk-wasm-jsas was done in anza-xyz/solana-sdk#138. The following is the motivation:zk-sdkhas both cdylib and rlib, but we can't remove cdylib if we want to use wasm-bindgen inside.So I went ahead and removed wasm-bindgen in the
zk-sdk(b78d644). I am basically starting over from the beginning. I left in cdylib for now because this seems to require some additional changes to the ci script that I have to figure out. I'll address this in a follow-up.Then, I created
zk-sdk-wasm-js(449eee1). This crate should contain the wrapper types/functions of the zk-sdk types/functions that we want to include in our wasm build. For now, I just started with the types in theencryptionmodule of thezk-sdk. In follow-up PRs, I will add wrapper types for the rest of the components in thezk-sdk.Then I updated the CI accordingly to test the
zk-sdk-wasm-jscrate (88ff541). I added some simple wasm-bindgen tests. These tests are definitely not sufficient for the "Testing and CI/CD" as mentioned in #69, but I think it should do the job of sanity checking for now.