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

Cmj.wasm test #327

Closed
wants to merge 6 commits into from
Closed

Cmj.wasm test #327

wants to merge 6 commits into from

Conversation

ChiaMineJP
Copy link
Contributor

@ChiaMineJP ChiaMineJP commented Nov 30, 2023

Experimental PR to make chia-protocol available as a wasm module.
Current status:


Building wasm module only with struct / enum succeeded

Steps to reproduce:

  1. Make sure you have wasm-pack installed on your system. (Just invoke cargo add wasm-pack to install)
  2. cd chia-protocol
  3. wasm-pack build

To convert methods with fixed sized byte array arguments/return value like &[u8; 4], we need to wait wasm-bindgen' update

rustwasm/wasm-bindgen#3458


u128 not supported yet by wasm-bindgen

wasm-bindgen does not yet support u128 so only when compiling for wasm32 the type will be converted to u64 temporarily by #[wasm_patch::conv_u128_to_u64_for_wasm] proc macro attritute.


BytesImpl should not be used outside chia-protocol/src/bytes.rs

BytesImpl<T> is basically aliased to types like Bytes32, Bytes48, and so on.
Since wasm-bindgen cannot treat generic parameters well when it is converting rust code to wasm, please do not use BytesImpl<T> notation outside bytes.rs.

@ChiaMineJP ChiaMineJP self-assigned this Dec 4, 2023
@Rigidity
Copy link
Contributor

Is it fine to close this? This is quite out of date

@ChiaMineJP
Copy link
Contributor Author

@Rigidity Yes, this's too old. Closing.

@ChiaMineJP ChiaMineJP closed this Aug 21, 2024
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 this pull request may close these issues.

2 participants