#recovery #block #candidate #parachain #protocols #networking #po-v

cumulus-client-pov-recovery

Cumulus-specific networking protocol (polkadot v1.12.0)

12 breaking releases

0.13.0 May 24, 2024
0.11.0 Apr 9, 2024
0.10.0 Mar 19, 2024
0.6.0 Dec 13, 2023
0.0.0 Nov 21, 2022

#2152 in Magic Beans

Download history 486/week @ 2024-02-26 163/week @ 2024-03-04 294/week @ 2024-03-11 491/week @ 2024-03-18 342/week @ 2024-03-25 749/week @ 2024-04-01 512/week @ 2024-04-08 169/week @ 2024-04-15 246/week @ 2024-04-22 506/week @ 2024-04-29 419/week @ 2024-05-06 338/week @ 2024-05-13 545/week @ 2024-05-20 426/week @ 2024-05-27 609/week @ 2024-06-03 358/week @ 2024-06-10

1,953 downloads per month
Used in 12 crates (2 directly)

GPL-3.0-or-later…

30KB
559 lines

Parachain PoV recovery

A parachain needs to build PoVs that are send to the relay chain to progress. These PoVs are erasure encoded and one piece of it is stored by each relay chain validator. As the relay chain decides on which PoV per parachain to include and thus, to progress the parachain it can happen that the block corresponding to this PoV isn't propagated in the parachain network. This can have several reasons, either a malicious collator that managed to include its own PoV and doesn't want to share it with the rest of the network or maybe a collator went down before it could distribute the block in the network. When something like this happens we can use the PoV recovery algorithm implemented in this crate to recover a PoV and to propagate it with the rest of the network.

It works in the following way:

  1. For every included relay chain block we note the backed candidate of our parachain. If the block belonging to the PoV is already known, we do nothing. Otherwise we start a timer that waits for a randomized time inside a specified interval before starting to recover the PoV.

  2. If between starting and firing the timer the block is imported, we skip the recovery of the PoV.

  3. If the timer fired we recover the PoV using the relay chain PoV recovery protocol.

4a. After it is recovered, we restore the block and import it.

4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block PoV is not yet available, we retry.

If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we make sure that the blocks are imported in the correct order.

Dependencies

~93–135MB
~2.5M SLoC