Skip to content

Status of the riscv32im-risc0-zkvm-elf target #135376

Open
@Noratrieb

Description

@Noratrieb

We currently have a target called riscv32im-risc0-zkvm-elf, which targets the RISC Zero Zero Knowledge VM. This target is maintained by @SchmErik, @jbruestle, @flaub #134721 has revealed some issues in this target.

The biggest issue is that the target sets target_os = "zkvm". A "Zero Knowledge VM" is a generic concept and not an operating system. The correct target_os would be risc0.

But there is another question, whether this target should exist in the first place. The alternative to this target would be using the existing riscv32im-unknown-none-elf target with a RISC0-provided crate for the system calls.

The thing that is currently gained from having this target is that it can have std, where the very few syscalls that exist are used to implement some standard library interfaces.
Concretely, the following functionality is provided:

  • program arguments
  • environment variables (read-only)
  • stdio
  • the system global allocator
  • and of course HashMap
  • (no_threads) std::sync

other features like std::fs, std::io, std::process, std::thread, std::time, std::net are not supported.

@SchmErik, who is a maintainer of the target, highlights how the std support is useful in #134721 (comment):

Having std support is important to us because it allows developers to use crates outside of no_std. This has enabled many others to use our target much more easily with existing crates

Additionally, they mentioned how having the target allows them to add cfgs to forked ecosystem crates to make them use more of RISC Zero's APIs (though this could also be implemented without a target and a normal custom cfg).

It is always unsatisfactory to have targets with such incomplete standard libraries (at least it's not as bad as wasm32-unknown-unknown in this case). On the other hand, (just like the wasm target) the APIs that are implemented are likely useful.

This issue is about figuring out what to do with this target, whether to keep it (renamed) or remove it alltogether.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-risc0Operating system: RISC0 zkVM https://risczero.com/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions