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

no-std polkadot-parachain-primitives

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

10 major breaking releases

10.0.0 Apr 8, 2024
9.0.0 Mar 18, 2024
8.0.0 Feb 26, 2024
7.0.0 Feb 13, 2024
0.0.0 Sep 8, 2023

#1752 in Magic Beans

Download history 1009/week @ 2024-01-02 1160/week @ 2024-01-09 674/week @ 2024-01-16 1080/week @ 2024-01-23 590/week @ 2024-01-30 850/week @ 2024-02-06 2279/week @ 2024-02-13 2696/week @ 2024-02-20 2326/week @ 2024-02-27 1582/week @ 2024-03-05 1883/week @ 2024-03-12 2328/week @ 2024-03-19 1682/week @ 2024-03-26 2137/week @ 2024-04-02 2929/week @ 2024-04-09 2304/week @ 2024-04-16

9,674 downloads per month
Used in 166 crates (45 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

~16–30MB
~481K SLoC