IntersectMBO / IntersectMBO/ouroboros-consensus

ImmutableDB: introduce BlockBits

Open
#661 9 comments 0 reactions 0 assignees View on GitHub
technical debt
Dominant language
Haskell
Stars
67
Forks
43
Avg merge
5d 13h
Merged PRs (30d)
43

Description

At the moment, the Chain DB is adding an envelope to the bytestrings that we read from disk. This envelope is required for binary streaming, but not required for deserialization; moreover, it means that it's hard to test this serialization as the bit twiddling doesn't happen in the instance itself, and so roundtrip tests can't easily refer to it. It would be much nicer to do something akin to

```haskell
DecodeDisk blk (IsEBB -> BlockSize -> Serialised (Header blk))
DecodeDisk blk (IsEBB -> BlockSize -> Lazy.ByteString -> Header blk)
```

or someting along these lines. The chain DB passes enough context so that the deserializer knows what to do, and only the one that actually produced the `Serialised` header needs to do actual low level bit twiddling.

A further generalization would be useful: if the secondary index of the imm DB could store some block specific data, the HFC could take advantage of this to record which era a block is from. This would mean that we don't need to look at CBOR in order to know which decoder to use, avoiding some low level bit twiddling.

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.