31 major breaking releases

new 34.0.0 May 1, 2024
33.0.0 Apr 9, 2024
32.0.0 Mar 18, 2024
31.0.0 Feb 26, 2024
0.0.0 Nov 29, 2022

#385 in Magic Beans

Download history 178/week @ 2024-01-09 102/week @ 2024-01-16 190/week @ 2024-01-23 107/week @ 2024-01-30 362/week @ 2024-02-06 675/week @ 2024-02-13 596/week @ 2024-02-20 876/week @ 2024-02-27 399/week @ 2024-03-05 505/week @ 2024-03-12 858/week @ 2024-03-19 772/week @ 2024-03-26 734/week @ 2024-04-02 764/week @ 2024-04-09 467/week @ 2024-04-16 472/week @ 2024-04-23

2,678 downloads per month
Used in 12 crates (via polkadot-service)

GPL-3.0-or-later…

1MB
20K SLoC

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

~73–115MB
~2M SLoC