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

Make the fuel-vm no-std or WASM/RiscV compatible #536

Closed
SilentCicero opened this issue Jul 28, 2023 · 4 comments
Closed

Make the fuel-vm no-std or WASM/RiscV compatible #536

SilentCicero opened this issue Jul 28, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@SilentCicero
Copy link
Member

SilentCicero commented Jul 28, 2023

Abstract

We need to make the entire fuel-vm implementation RiscV compatible for fraud proving.

This would also allow for better browser, debugging and educational tools for the FuelVM.

Currently Compatible

  • fuel-asm
  • fuel-types
  • fuel-merkle
  • fuel-storage
  • fuel-crypto
  • fuel-tx (uses fuel-crypto)
  • fuel-vm (uses fuel-tx)

Related:
#443
#533

@SilentCicero SilentCicero added the enhancement New feature or request label Jul 28, 2023
@Dentosal
Copy link
Member

Dentosal commented Aug 2, 2023

Related: getrandom doesn't support freestanding riscv64, so we'll need a fallback rng or some other way to work around that.

@DefiCake
Copy link
Member

Just reporting the state of compatibility with risc0 / riscV, fuel-crypto is compiling correctly now.

Currently, the build process complains about fuel-tx.

error[E0277]: the trait bound `Transaction: fuel_tx::FormatValidityChecks` is not satisfied
   --> /Users/mad/fuel/vm/fuel-vm/src/checked_transaction.rs:577:22
    |
577 | impl IntoChecked for Transaction {
    |                      ^^^^^^^^^^^ the trait `fuel_tx::FormatValidityChecks` is not implemented for `Transaction`
    |
    = help: the following other types implement trait `fuel_tx::FormatValidityChecks`:
              fuel_tx::Create
              fuel_tx::Mint
              fuel_tx::Script
... 

Not very experienced in rs, but it looks to me as the FormatValidityChecks is only available under std:

#[cfg(feature = "std")]
impl FormatValidityChecks for Transaction {
...

@Dentosal
Copy link
Member

This is almost achieved in #536, which makes the VM itself runnable under no_std conditions but still lacks some of the RiscV-specific stuff.

@xgreenx
Copy link
Collaborator

xgreenx commented Sep 25, 2023

After https://danielmangum.com/posts/risc-v-bytes-rust-cross-compilation/, we are able to compile fuel-vm and fuel-tx into WASM and RiscV.

cargo build --target wasm32-unknown-unknown --no-default-features -p fuel-tx --features alloc
cargo build --target wasm32-unknown-unknown --no-default-features -p fuel-vm --features alloc
cargo build --target riscv64imac-unknown-none-elf --no-default-features -p fuel-tx --features alloc
cargo build --target riscv64imac-unknown-none-elf --no-default-features -p fuel-vm --features alloc

Closing this issue=)

@xgreenx xgreenx closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants