#parachain #primitive #polkadot #pointers #validation #length #format

no-std polkadot-parachain-primitives

Types and utilities for creating and working with parachains (polkadot v1.12.0)

12 major breaking releases

12.0.0 May 23, 2024
11.0.0 Apr 30, 2024
10.0.0 Apr 8, 2024
9.0.0 Mar 18, 2024
0.0.0 Sep 8, 2023

#1563 in Magic Beans

Download history 2795/week @ 2024-02-26 1702/week @ 2024-03-04 1508/week @ 2024-03-11 2265/week @ 2024-03-18 1885/week @ 2024-03-25 1995/week @ 2024-04-01 3112/week @ 2024-04-08 2576/week @ 2024-04-15 1928/week @ 2024-04-22 2226/week @ 2024-04-29 2026/week @ 2024-05-06 1810/week @ 2024-05-13 2365/week @ 2024-05-20 1699/week @ 2024-05-27 2060/week @ 2024-06-03 1520/week @ 2024-06-10

7,747 downloads per month
Used in 171 crates (44 directly)

GPL-3.0-only

22KB
279 lines

Defines primitive types for creating or validating a parachain.

When compiled with standard library support, this crate exports a wasm module that can be used to validate parachain WASM.

Parachain WASM

Polkadot parachain WASM is in the form of a module which imports a memory instance and exports a function validate_block.

validate accepts as input two i32 values, representing a pointer/length pair respectively, that encodes ValidationParams.

validate returns an u64 which is a pointer to an u8 array and its length. The data in the array is expected to be a SCALE encoded ValidationResult.

ASCII-diagram demonstrating the return data format:

[pointer][length]
  32bit   32bit
        ^~~ returned pointer & length

The wasm-api (enabled only when std feature is not enabled and wasm-api feature is enabled) provides utilities for setting up a parachain WASM module in Rust.

Dependencies

~17–30MB
~495K SLoC