IntersectMBO / IntersectMBO/cardano-ledger
Turn `StakePoolParams` into a type family
- Dominant language
- Haskell
- Stars
- 295
- Forks
- 179
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 29
Description
* [ ] - Create module in `cardano-ledger-core:lib:Cardano.Ledger.Core.StakePoolParams`:
```haskell
class EraStakePoolParams era where
type StakePoolParams era = (r :: Type) | r -> era
idStakePoolParamL :: Lens' StakePoolParams (KeyHash StakePool)
vrfStakePoolParamL :: Lens' StakePoolParams (VRFVerKeyHash StakePoolVRF)
...
mkStakePoolState ::
-- | Deposit
CompactForm Coin
-- | Delegations
-> Set (Credential Staking)
-> StakePoolParams era
-> StakePoolState
```
Note that presence of `mkStakePoolState` function in this type class will require import of `Cardano.Ledger.State.StakePool` module, which should be fine.
* [ ] - Re-export `Cardano.Ledger.Core.StakePoolParams` module from `Cardano.Ledger.Core`
* [ ] - Create module in `cardano-ledger-shelley:lib:Cardano.Ledger.Shelley.StakePoolParams` where original definition of `StakePoolParams era` will be moved under new name `ShelleyStakePoolParams era`. Note that this will require changing prefix on all fields from `spp*` to `sspp*`. Move `stakePoolStateToStakePoolParams` function in here as `stakePoolStateToShelleyStakePoolParams`
* [ ] - Create a module per era from Allegra to Conway in `cardano-ledger-[era]:lib:Cardano.Ledger.[Era].StakePoolParams` where helpers and types from Shelley era uill be reused, similarly to how we deal other type families, eg. `TxAuxWits`
* [ ] - Create module in `cardano-ledger-dijkstra:lib:Cardano.Ledger.Dijkstra.StakePoolParams` where new definition of `StakePoolParams era` from #5891 will be moved under new name `ShelleyStakePoolParams era`. Note that this will require changing prefix on all fields from `spp*` to `sspp*`. If necessary add here `stakePoolStateToDijkstraStakePoolParams`.
Contributor guide
Research direction
Start with the existing StakePoolParams definitions and the TxAuxWits type-family pattern. Trace the Shelley implementation and each era-specific module from Allegra through Conway, plus Dijkstra and the Cardano.Ledger.Core re-export. Done means the requested modules, renamed fields and conversion helpers are in place and the existing ledger packages build successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100