ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
431 stars 112 forks source link

Implement state sync strategy #4238

Open dimartiro opened 3 weeks ago

dimartiro commented 3 weeks ago

When the warp sync finished getting the fragments and its completed, we need to request and import the latest state. This is a task that could take time and needs its own logic to be handle correctly. For this reason we are not going to implement the state sync as part of the warp sync, instead, we are going to implement it as an independent strategy that might be run right after the warp sync strategy finished.

We can read more about how the state sync is started after warp sync finishes here

An idea of how to implement the state sync strategy based on parity's implementation is here

Open questions:

dimartiro commented 2 weeks ago

How can we update the babe randomenss and validate babe to import new blocks after executing the state sync?

Some findings regarding how to update the babe randomness using the state (so we can validate babe and import blocks on top of that)

https://github.com/paritytech/polkadot-sdk/blob/a2c75758034d920f4b163685377df2ef7a1c9299/substrate/client/consensus/babe/src/lib.rs#L1375

https://github.com/paritytech/polkadot-sdk/blob/master/substrate/client/consensus/grandpa/src/import.rs