Finalize blocks in parallel with contextual validation #9162
Open
Description
Motivation
When non-checkpointed blocks are committed to a best chain in the non-finalized state with over 99 blocks (max_block_reorg_height), Zebra will remove the root of the non-finalized part of the best chain from the non-finalized state and will block contextual validation of the next block on adding it to the finalized state.
The write block task is often the critical constraint limiting initial sync performance, and is generally difficult to further parallelize as note commitment tree updates must happen in sequence.
Design
- When a non-finalized best chain contains over 99 blocks, read its root block without removing it
- Write the block to disk in a spawned thread
- Remove blocks in the non-finalized state below the finalized tip height before committing more blocks
Metadata
Assignees
Labels
Type
Projects
Status
New