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

Build more runtimes targeting PolkaVM #3209

Merged
merged 8 commits into from
Feb 6, 2024

Conversation

koute
Copy link
Contributor

@koute koute commented Feb 5, 2024

This PR improves compatibility with RISC-V and PolkaVM, allowing more runtimes to successfully compile.

In particular, it makes the following changes:

  • The sp-mmr-primitives and sp-consensus-beefy crates unconditionally required an std-only dependency; now they only require those dependencies when the std feature is actually enabled. (Our RISC-V target is, unlike WASM, a true no_std target where you can't accidentally use stuff from std anymore.)
  • One of our dependencies (the bitvec trace) uses a crate called radium which doesn't compile under RISC-V due to incomplete autodetection logic in their build.rs file. The good news is that this is already fixed in the newest upstream version of radium, and the newest version of bitvec uses it. The bad news is that the newest version of bitvec is not currently released on crates.io, so we can't use it. I've created an issue asking for a new release, but in the meantime I forked the currently used radium 0.7, fixed the faulty logic and used cargo's patching capabilities to use it for the RISC-V runtime builds. This might be a little hacky, but it is the least intrusive way to fix the problem, doesn't affect WASM builds at all, and we can trivially remove it once a new bitvec is released.
  • The new runtimes are added to the CI to make sure their compilation doesn't break.

@koute koute added the R0-silent Changes should not be mentioned in any release notes label Feb 5, 2024
@koute koute requested a review from a team February 5, 2024 11:53
@koute koute requested review from acatangiu and a team as code owners February 5, 2024 11:53
Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wasm-builder should be renamed to runtime-builder, or something like that, at some point

@koute
Copy link
Contributor Author

koute commented Feb 6, 2024

maybe wasm-builder should be renamed to runtime-builder, or something like that, at some point

Yes, I'm planning to rename a bunch of stuff in a future refactoring PR.

@koute koute added this pull request to the merge queue Feb 6, 2024
Merged via the queue into paritytech:master with commit 402b64c Feb 6, 2024
129 checks passed
@koute koute deleted the master_more_polkavm_compatibility branch February 6, 2024 14:53
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This PR improves compatibility with RISC-V and PolkaVM, allowing more
runtimes to successfully compile.

In particular, it makes the following changes:

- The `sp-mmr-primitives` and `sp-consensus-beefy` crates
unconditionally required an `std`-only dependency; now they only require
those dependencies when the `std` feature is actually enabled. (Our
RISC-V target is, unlike WASM, a true `no_std` target where you can't
accidentally use stuff from `std` anymore.)
- One of our dependencies (the `bitvec` trace) uses a crate called
`radium` which doesn't compile under RISC-V due to incomplete
autodetection logic in their `build.rs` file. The good news is that this
is already fixed in the newest upstream version of `radium`, and the
newest version of `bitvec` uses it. The bad news is that the newest
version of `bitvec` is not currently released on crates.io, so we can't
use it. I've [created an
issue](ferrilab/ferrilab#5) asking for a new
release, but in the meantime I forked the currently used `radium` 0.7,
[fixed the faulty
logic](paritytech/radium-0.7-fork@ed66c8a)
and used cargo's patching capabilities to use it for the RISC-V runtime
builds. This might be a little hacky, but it is the least intrusive way
to fix the problem, doesn't affect WASM builds at all, and we can
trivially remove it once a new `bitvec` is released.
- The new runtimes are added to the CI to make sure their compilation
doesn't break.
@athei athei mentioned this pull request Apr 8, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants