Skip to content

Support no_std builds - #53

Draft
dharjeezy wants to merge 1 commit into
sigp:mainfrom
polytope-labs:no-std-and-proofs
Draft

dharjeezy wants to merge 1 commit into
sigp:mainfrom
polytope-labs:no-std-and-proofs

Conversation

@dharjeezy

@dharjeezy dharjeezy commented Sep 10, 2026 •

Copy link
Copy Markdown

Draft: blocked on ethereum_hashing#23 and ethereum_ssz#86. CI here will fail dependency resolution until those are merged and released. Part of a series adding no_std support across the SSZ stack so it can be used from a Substrate runtime.

What this does

Adds no_std support. Nothing else.

This previously also added merkle proof and multiproof generation. That is split out per your request and will come as its own PR once this lands, so each can be judged on its own. The diff here drops from 1583 additions to 32.

Why

Substrate runtimes compile to wasm32-unknown-unknown without std. Everything this crate needs is in core and alloc.

Changes

  • #![cfg_attr(not(feature = "std"), no_std)] with extern crate alloc
  • std imports replaced with alloc equivalents
  • the std feature wires through to the dependencies that need it

7 files, 32 insertions, 20 deletions. The std build is unchanged.

Why it cannot build yet

tree_hash depends on ethereum_hashing with the sha2 feature, which #23 adds, and on ethereum_ssz no_std from #86.

Verification

Verified locally against the proposed branches via path patches.

Check Result
cargo test 54 + 28 + 6 passed
cargo check --no-default-features --features sha2 --target wasm32-unknown-unknown clean
cargo fmt --check no diffs

One caveat: the trybuild test cannot pass under a path patch, since it spawns its own cargo build that does not inherit the patch and resolves ethereum_hashing from crates.io. It should pass normally once #23 releases.

Where this sits

  1. ethereum_hashing#23 and ethereum_serde_utils#21
  2. ethereum_ssz#86
  3. this PR
  4. ssz_types#85

Proof generation follows separately after this. The branch name is unchanged so the review thread is preserved, and no longer describes the contents.

@michaelsproul

Copy link
Copy Markdown
Member

one feature per PR please

@dharjeezy dharjeezy changed the title Support no_std builds, and generate merkle proofs and multiproofs Support no_std builds Sep 11, 2026
@dharjeezy

dharjeezy commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

Understood, split. This PR is now the no_std change only.

The proof generation and multiproof work is held back and will come as its own PR once this lands, so it can be judged separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants