-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
In the context of sidechain fork mitigation, we need to detect forks when we import sidechain blocks.
Fork means:
- For a given block
n: Parent hash inndoes not match last imported block && (block number ofnis a successor of last imported block || block number ofnis lower than the last imported)
This can be tracked in the substrate ForkTree data structure (see #1001), where we can insert all the sidechain blocks we find in the import queue.
In a second step, we can then determine if a block should be imported, or if it's part of a forked branch. In a first approach, this can be done in a first-come-first-serve manner.
In addition, it is important we can distinguish between a fork event and an on-boarding scenario (where we detect missing blocks and then fetch blocks from a peer).