Skip to content

Detect and track forks upon processing sidechain block import queue #687

@murerfel

Description

@murerfel

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 in n does not match last imported block && (block number of n is a successor of last imported block || block number of n is 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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions