IntersectMBO / IntersectMBO/ouroboros-consensus
ImmutableDB: introduce BlockBits
- 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
Assessment
This issue has not been assessed yet.