darwinia-network / bridger

Relayer client implementation for Darwinia LCMP protocols.
https://rust-docs.darwinia.network/bridger
GNU General Public License v3.0
12 stars 10 forks source link

Which headers store the justificaitons? #278

Closed hackfisher closed 3 years ago

hackfisher commented 3 years ago

We found that the block emitting Grandpa.newAuthorities will store justifications, but also some other headers such as following header on pangolin.

[2021-09-21T15:32:00Z TRACE finality_relay::finality_loop] Header 488960 has persistent finality proof

For the finality loop, if there is no authority changes, the relay will loop until the best block number on source chain to retrieve all the justifications.

https://github.com/darwinia-network/parity-bridges-common/blob/7be2b478b49bc8e87ddfe034076e9e80e2f126f6/relays/finality/src/finality_loop.rs#L471

It currently does not print anything, and take a long time to sync if the header relay was not syncing. may cause confuse to relayers.

We may need to learn more about the justifications provided by client, is it deterministic behavior for every nodes? The finality in telemetry changes fast, but it seems only sparsely block store the justification.

AurevoirXavier commented 3 years ago

Example block: https://polkadot.js.org/apps/?rpc=wss://pangolin-rpc.darwinia.network#/explorer/query/488960

AurevoirXavier commented 3 years ago
André
any block that changes the authorities will have this (unless it has not been finalized yet)
there is no other guarantees of other blocks having this, we will store justifications "randomly" every justification_period blocks, which is only useful for syncing purposes
(so that you don't have long periods of unfinalized blocks)
but we have the grandpa_proveFinality endpoint which should be able to give you the latest justification available for a given block

André
and also there is a pubsub where we can stream these justifications

>    Xavier - Darwinia.Network
>    Interesting. Let me check prev-justification_period-block.

but it's not guaranteed to be the same across different nodes
and also grandpa does not guarantee that all blocks will ever have a justification, because grandpa finalizes chains and not blocks
e.g. imagine that grandpa slows down for some reason and in the meantime we already made 10 new blocks
on the next grandpa round we'll just skip ahead and vote for the latest block
AurevoirXavier commented 3 years ago

https://polkadot.js.org/apps/?rpc=wss://pangolin-rpc.darwinia.network#/explorer/query/488960 https://polkadot.js.org/apps/?rpc=wss://pangolin-rpc.darwinia.network#/explorer/query/488448 https://polkadot.js.org/apps/?rpc=wss://pangolin-rpc.darwinia.network#/explorer/query/487936

Every 512 blocks.