Skip to content

Finalize blocks in parallel with contextual validation #9162

Open
@arya2

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

No one assigned

    Labels

    A-concurrencyArea: Async code, needs extra work to make it work properly.A-stateArea: State / database changesI-slowProblems with performance or responsivenessP-Low ❄️

    Type

    No type

    Projects

    • Status

      New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions