IntersectMBO / IntersectMBO/ouroboros-consensus
Strengthen compile time guarantees when adding new era
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
When working on https://github.com/input-output-hk/ouroboros-network/issues/2871 I've learned that changes to
```
type CardanoEras c =
'[ ByronBlock
, ShelleyBlock (ShelleyEra c)
, ShelleyBlock (AllegraEra c)
, ShelleyBlock (MaryEra c)
]
```
do not trigger compilation errors in
```
-- | Consensus protocol to use
data Protocol (m :: Type -> Type) blk p where
(....)
ProtocolCardano
:: ProtocolParamsByron
-> ProtocolParamsShelleyBased StandardShelley
-> ProtocolParamsShelley
-> ProtocolParamsAllegra
-> ProtocolParamsMary
-> ProtocolParamsTransition
ByronBlock
(ShelleyBlock StandardShelley)
-> ProtocolParamsTransition
(ShelleyBlock StandardShelley)
(ShelleyBlock StandardAllegra)
-> ProtocolParamsTransition
(ShelleyBlock StandardAllegra)
(ShelleyBlock StandardMary)
-> Protocol m (CardanoBlock StandardCrypto) ProtocolCardano
```
There is a place for improvement here. `ProtocolCardano` could for instance take a single argument (instead of 8), that would be an `NP` of 8 elements. This is a simplest solution that comes to mind.
That simple solution might need to be tweaked. I'm not sure but `ProtocolCardano` constructor might be a direct dependency to the upstream dependencies. Maintainers of those might not be happy about the change. Thus that `NP` would have to find it's place somewhere in the code, not necessarily the constructor itself. This is needs to be researched and /or consulted with upstream dependencies.
# Done when
Adding new Era breaks compilation of `Protocol (m :: Type -> Type) blk p` in `Cardano.hs`
Contributor guide
Assessment
This issue has not been assessed yet.