IntersectMBO / IntersectMBO/ouroboros-consensus
Immutable DB: make the model polymorphic in its block type
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
input-output-hk/ouroboros-network#1144 adds `dbmTipBlock :: DBModel hash -> Maybe TestBlock`, which requires deserialising the block at the tip. This is needed to generate the next block in the state machine tests. We should avoiding such costly/ugly deserialisations by storing the unserialised block directly. The `DBModel` can be made parametric in the block type. It can be instantiated to `TestBlock`, `ByteString`, or even `(TestBlock, ByteString)`. Note that the corruption simulation code needs the `ByteString`s.
Such a change would mean that we no longer have one `run` function in the state machine tests, as the ImmutableDB API is in terms of `Builder`s (for appending) and `ByteString`s (for reading), but one for the model and one for the real implementation. This split will also make simulating corruptions easier and will help us avoid passing around the `runCorruption` function.
Contributor guide
Assessment
This issue has not been assessed yet.