IntersectMBO / IntersectMBO/ouroboros-consensus

Volatile DB: cache SelectView

Open
#670 1 comment 0 reactions 0 assignees View on GitHub
🏎️ performance enhancement
Dominant language
Haskell
Stars
67
Forks
43
Avg merge
5d 13h
Merged PRs (30d)
43

Description

When a block is added to the ChainDB is on a fork, the ChainDB will [read](https://github.com/input-output-hk/ouroboros-network/blob/d8cf08c10c511158bab6dd883d6332236041b742/ouroboros-consensus/src/Ouroboros/Consensus/Storage/ChainDB/Impl/ChainSel.hs#L687) the headers corresponding to that fork from disk (the new block's header and the current chain's headers are cached) so that it can perform chain selection on them. Afterwards, when the candidates are validated, the candidates' blocks are read from disk. This means first the headers are read, and then the blocks.

To perform chain selection, we only need the `SelectView` (of the tip), so we don't even need to read the headers from the VolatileDB. If the VolatileDB cached the `SelectView`, we wouldn't incur this read from disk.

Idea: instead of making the VolatileDB aware of the `SelectView`, add `BlockComponent (ChainDB m blk) (SelectView (BlockProtocol blk))` to `RunNode`? This means the VolatileDB doesn't have to be changed. Problem: for Shelley, the `SelectView` will include the certificate number. It can be extract from the header, but that means we're back to square one.

(We don't expect many forks in Byron, so this will only be really useful for Shelley)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.