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

Support wasm #272

Closed
haerdib opened this issue Aug 29, 2022 · 4 comments
Closed

Support wasm #272

haerdib opened this issue Aug 29, 2022 · 4 comments
Assignees
Labels
F8-newfeature Introduces a new feature Q9-needsdesign

Comments

@haerdib
Copy link
Contributor

haerdib commented Aug 29, 2022

Previous work done: #48

@haerdib haerdib added F7-enhancement Enhances an already existing functionality Q9-needsdesign labels Nov 2, 2022
@haerdib haerdib added F8-newfeature Introduces a new feature and removed F7-enhancement Enhances an already existing functionality labels Nov 11, 2022
@Niederb
Copy link
Contributor

Niederb commented Mar 27, 2023

One issue is that substrate has a dependency on wasmtime. This leads to a compilation error, but it probably does not make sense to compile a webassembly runtime with webassembly to begin with. So we would have to configure our code such that the dependency is not needed.

Compilation error:

...
cargo:warning=src/helpers.c:1:10: fatal error: 'setjmp.h' file not found
...

The dependency is triggered as soon as std is enabled in either sp-core or sp-io. sp-core is used by so many substrate crates that this basically means the dependency is enabled as soon as we enable std on any substrate crate.

Related issue: paritytech/substrate#13087

@haerdib
Copy link
Contributor Author

haerdib commented Apr 3, 2023

Okay. To summarize:

  • the api-client is wasm compatible in no-std mode ✔️
  • To make std mode wasm compatible we would have to either
    1. get rid of sp-core / sp-io dependencies
    2. only depend on no-std part of spi-io, sp-core (not guaranteed though that it stops here, because the runtime is compiled to wasm in no-std mode)

Correct?

@Niederb
Copy link
Contributor

Niederb commented Apr 3, 2023

Yes, pretty much. Basically we would need to make sure that std is not enabled in sp-wasm-interface. See here:
https://github.com/paritytech/substrate/blob/dd45632f298db02f6946c906296bbf86a74f4f46/primitives/wasm-interface/Cargo.toml#L27
I tried by not enabling std in sp-core, but this triggers other issues regarding Serialization/Deserialization and the ones described here paritytech/substrate#13087 (comment)

@Niederb
Copy link
Contributor

Niederb commented Apr 4, 2023

Close this for now. See #513 for a follow up issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F8-newfeature Introduces a new feature Q9-needsdesign
Projects
None yet
Development

No branches or pull requests

2 participants