Skip to content

Support no_std builds - #21

Open
dharjeezy wants to merge 3 commits into
sigp:mainfrom
polytope-labs:no-std-support
Open

dharjeezy wants to merge 3 commits into
sigp:mainfrom
polytope-labs:no-std-support

Conversation

@dharjeezy

@dharjeezy dharjeezy commented Sep 10, 2026 •

Copy link
Copy Markdown

Part of a five crate series adding no_std support across the SSZ stack, so it can be used from a Substrate runtime. This one has no dependencies on the others and is ready to review. The order is ethereum_hashing#23 and ethereum_serde_utils#21 first, then ethereum_ssz#86, then tree_hash#53, then ssz_types#85. The later three are drafts because they cannot resolve until these two are released.

What this does

Adds no_std support, so the crate can be used from a wasm runtime.

Why

Substrate runtimes compile to wasm32-unknown-unknown without std. The serde helpers here need only core and alloc, so the change is mostly swapping std imports for alloc ones and gating the crate.

Changes

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

The std build is unchanged.

Verification

Check Result
cargo test 40 passed
cargo check --no-default-features --target wasm32-unknown-unknown clean
cargo fmt --check no diffs

A note on the diff size

Two of the three commits are unrelated housekeeping that the tooling flagged while working here: one applies rustfmt, one fixes current clippy lints. They are what makes this touch 16 files rather than a handful.

They are kept as separate commits, so if you would rather review the no_std work alone, say so and I will drop them and open them separately, or not at all.

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.

1 participant