32 major breaking releases

new 35.0.0 May 24, 2024
34.0.0 May 1, 2024
33.0.0 Apr 9, 2024
32.0.0 Mar 18, 2024
0.0.0 Nov 29, 2022

#468 in Magic Beans

Download history 171/week @ 2024-02-01 641/week @ 2024-02-08 443/week @ 2024-02-15 796/week @ 2024-02-22 697/week @ 2024-02-29 323/week @ 2024-03-07 632/week @ 2024-03-14 849/week @ 2024-03-21 910/week @ 2024-03-28 812/week @ 2024-04-04 500/week @ 2024-04-11 508/week @ 2024-04-18 577/week @ 2024-04-25 592/week @ 2024-05-02 483/week @ 2024-05-09 766/week @ 2024-05-16

2,492 downloads per month
Used in 13 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

~75–115MB
~2M SLoC