Skip to content

Cannot compile for WASM or RISC-V target #79

Description

@koxu1996

I discovered that SSZ types cannot be used inside zkVMs or compiled to WASM for browser 😔.

Short reproduction

cargo new --bin demo
cd ./demo
cargo add --no-default-features ssz_types@=0.14.0
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown

Compilation fails on ethereum_hashing:

   Compiling ethereum_hashing v0.8.0
error: Ring must be enabled on non-x86_64 architectures
   --> /home/andrew/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ethereum_hashing-0.8.0/src/lib.rs:128:13
    |
128 |             compile_error!("Ring must be enabled on non-x86_64 architectures");
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

NOTE: ethereum_hashing gets included as dependency of tree_hash.

Solutions

Option A) Feature-gate tree hash related parts of the crate. In my case I just want to parse basic SSZ data, without merkleization. This is quite messy solution for the current codebase...

Option B) Allow enabling sha2 in ethereum_hashing on arbitrary platform. IMO really good option!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions