There are 4 ways to add shard blocks.
-
Synchronizer
that download blocks starting from a given header going backward to the latest known block in local db -
blocks broadcasted from peers: This path is mainly for propagating new blocks mined across the network.
-
Master to download and add missing shard blocks when syncing root blocks
-
Create Block: adding block generate shard
Ultimately they follow the same path.
Each step starts after the previous one completes (i.e. all the RPCs returned). -
The shard validates the block, updating the local shard chain, EVM state, and put the block in db.
-
The shard broadcasts the block (header hash, [xshard tx]) (
CrossShardTransactionDeposits
) to all its neighbor shards in parallel. -
The shard sends the block header to root chain and the root chain will persist the header in its db.
This process guarantees that if the root chain has a shard block then this exact shard block must have been known to all the shards reaching a consistent cluster state - all the processes in the cluster have this shard block. This guarantee is required for adding root block (as described below) to succeed.
- Syncing Root Blocks
- Syncing Shard Blocks
- Blocks broadcasted from peers
- Create Block