Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 280c6c2

Browse files
authored
note pruning of orphan blocks in the overseer description (#1189)
* note pruning of orphan blocks in the overseer description * remove note about finalization events being maybe not needed
1 parent 3b5bce8 commit 280c6c2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

roadmap/implementors-guide/guide.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,22 +856,28 @@ The hierarchy of subsystems:
856856
857857
```
858858

859-
The overseer determines work to do based on block import events and block finalization events (TODO: are finalization events needed?). It does this by keeping track of the set of relay-parents for which work is currently being done. This is known as the "active leaves" set. It determines an initial set of active leaves on startup based on the data on-disk, and uses events about blockchain import to update the active leaves. Updates lead to `OverseerSignal::StartWork` and `OverseerSignal::StopWork` being sent according to new relay-parents, as well as relay-parents to stop considering.
859+
The overseer determines work to do based on block import events and block finalization events. It does this by keeping track of the set of relay-parents for which work is currently being done. This is known as the "active leaves" set. It determines an initial set of active leaves on startup based on the data on-disk, and uses events about blockchain import to update the active leaves. Updates lead to `OverseerSignal::StartWork` and `OverseerSignal::StopWork` being sent according to new relay-parents, as well as relay-parents to stop considering. Block import events inform the overseer of leaves that no longer need to be built on, now that they have children, and inform us to begin building on those children. Block finalization events inform us when we can stop focusing on blocks that appear to have been orphaned.
860860

861861
The overseer's logic can be described with these functions:
862862

863863
*On Startup*
864864
* Start all subsystems
865865
* Determine all blocks of the blockchain that should be built on. This should typically be the head of the best fork of the chain we are aware of. Sometimes add recent forks as well.
866866
* For each of these blocks, send an `OverseerSignal::StartWork` to all subsystems.
867-
* Begin listening for block import events.
867+
* Begin listening for block import and finality events
868868

869869
*On Block Import Event*
870870
* Apply the block import event to the active leaves. A new block should lead to its addition to the active leaves set and its parent being deactivated.
871871
* For any deactivated leaves send an `OverseerSignal::StopWork` message to all subsystems.
872872
* For any activated leaves send an `OverseerSignal::StartWork` message to all subsystems.
873+
* Ensure all `StartWork` messages are flushed before resuming activity as a message router.
873874

874-
(TODO: in the future, we may want to avoid building on too many sibling blocks at once. the notion of a "preferred head" among many competing sibling blocks would imply changes in our "active set" update rules here)
875+
(TODO: in the future, we may want to avoid building on too many sibling blocks at once. the notion of a "preferred head" among many competing sibling blocks would imply changes in our "active leaves" update rules here)
876+
877+
*On Finalization Event*
878+
* Note the height `h` of the newly finalized block `B`.
879+
* Prune all leaves from the active leaves which have height `<= h` and are not `B`.
880+
* Issue `OverseerSignal::StopWork` for all deactivated leaves.
875881

876882
*On Subsystem Failure*
877883

0 commit comments

Comments
 (0)