IntersectMBO / IntersectMBO/ouroboros-consensus
Abstract out logic from pure model to (mock) API interface
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
Our model based tests always have a stateful api (`ChainDB.API`, `VolatileDB.API`, etc.), which is then tested against a pure model. We then _reuse_ the model as a mock implementation of the API. Doing this requires various kinds of wrapping functions (`update_`, `query`, `queryE`, etc), which currently are duplicated across every component. It would be nice if we could abstract some of that out.
Even nicer would be if we could define a type-level funciton (`generics-sop` or similar?) so that we can `_compute_` a type of record of pure functions that we would expect in order to be able to simulate a particular stateful API, along with a translation from that record to the pure API.
Contributor guide
Research direction
Start by comparing the stateful APIs named in the issue, including ChainDB.API and VolatileDB.API, with their pure model tests and the duplicated update_, query, and queryE wrappers. Define the scope and expected abstraction before implementation; done means the repeated wrapping logic is shared without losing the existing model-versus-API test coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend-api-design, testing
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100