38 major breaking releases

new 43.0.0 Jan 29, 2025
42.0.0 Jan 14, 2025
40.0.0 Sep 26, 2024
39.0.0 Jul 18, 2024
0.0.0 Nov 29, 2022

#5 in #off-chain

Download history 731/week @ 2024-10-09 694/week @ 2024-10-16 784/week @ 2024-10-23 960/week @ 2024-10-30 762/week @ 2024-11-06 990/week @ 2024-11-13 1176/week @ 2024-11-20 987/week @ 2024-11-27 1217/week @ 2024-12-04 1403/week @ 2024-12-11 1257/week @ 2024-12-18 892/week @ 2024-12-25 880/week @ 2025-01-01 1232/week @ 2025-01-08 1156/week @ 2025-01-15 857/week @ 2025-01-22

4,296 downloads per month
Used in 14 crates (2 directly)

GPL-3.0-or-later…

1.5MB
22K SLoC

Release

Polkadot SDK Stable 2412


lib.rs:

MMR offchain gadget

The MMR offchain gadget is run alongside pallet-mmr to assist it with offchain canonicalization of finalized MMR leaves and nodes. The gadget should only be run on nodes that have Indexing API enabled (otherwise pallet-mmr cannot write to offchain and this gadget has nothing to do).

The runtime pallet-mmr creates one new MMR leaf per block and all inner MMR parent nodes generated by the MMR when adding said leaf. MMR nodes are stored both in:

  • on-chain storage - hashes only; not full leaf content;
  • off-chain storage - via Indexing API, full leaf content (and all internal nodes as well) is saved to the Off-chain DB using a key derived from parent_hash and node index in MMR. The parent_hash is also used within the key to avoid conflicts and overwrites on forks (leaf data is only allowed to reference data coming from parent block).

This gadget is driven by block finality and in responsible for pruning stale forks from offchain db, and moving finalized forks under a "canonical" key based solely on node pos in the MMR.

Dependencies

~74–110MB
~2M SLoC