IntersectMBO / IntersectMBO/cardano-ledger

Add `LeiosCommittee` to the `SnapShot` type

Open
#5,978 0 comments 0 reactions 1 assignee Claimed by @ch1bo View on GitHub
DijkstraEra Leios
Dominant language
Haskell
Stars
295
Forks
179
Avg merge
4d 7h
Merged PRs (30d)
29

Description

Upon `SnapShot` creation we will need to calculate `LeiosCommittee` from the `StakePoolSnapShots`, which has all the info that is needed and add it to the `SnapShot` as a new field.
```haskell
data LeiosCommitteeMember = LeiosCommitteeMember
{ lcmPoolId :: !(KeyHash StakePool)
, lcmPoolStake :: !Coin
, lcmPoolBlsKey :: !BlsKey
}

newtype LeiosCommittee = LeiosCommittee { unLeiosCommittee :: Vector LeiosCommitteeMember }

data SnapShot = SnapShot
{ ssActiveStake :: !ActiveStake
, ssTotalActiveStake :: !(NonZero Coin)
, ssStakePoolsSnapShot :: !(VMap VB VB (KeyHash StakePool) StakePoolSnapShot)
, ssLeiosCommittee :: LeiosCommittee -- ^ Lazy on purpose!
}
```
Stake pools in the committee will be sorted by their `Stake` using `vector-algorithms`. During construction the above vector will contain only some of the stake pools, so the vector need to be sliced to include only percentage of the total stake, which will be controlled by `ppLeiosCommitteeStakeCoverage` parameter added in from #5965

It is important that the field is lazy, so we do not do any work for pre-Dijkstra eras. It is ok to make it lazy, because that new field will depend only on `ssStakePoolsSnapShot`

This means that we will need to:
* Add `BlsKey` to `StakePoolSnapshot`
* `resetStakePoolsSnapShot` and `mkSnapShot` populate that new field in the `SnapShot` using the above logic. They will also need to accept a new argument `ppLeiosCommitteeStakeCoverage`. For pre-dijkstra era 0 can be used for that argument
* New SNAP rule that passes value of `ppLeiosCommitteeStakeCoverage` as an argument will need to be created for Dijkstra era

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.