Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- shrinkByRemovingAdversaries ∷ GenesisTestFull TestBlock → StateView TestBlock → [GenesisTestFull TestBlock]
- shrinkHonestPeer ∷ PeerSchedule blk → [PeerSchedule blk]
- shrinkHonestPeers ∷ Peers (PeerSchedule blk) → [Peers (PeerSchedule blk)]
- shrinkPeerSchedules ∷ GenesisTestFull TestBlock → StateView TestBlock → [GenesisTestFull TestBlock]
Documentation
Exported only for testing (that is, checking the properties of the function)
shrinkByRemovingAdversaries ∷ GenesisTestFull TestBlock → StateView TestBlock → [GenesisTestFull TestBlock] Source #
Shrink a PointSchedule
by removing adversaries. This does not affect
the honest peers; and it does not remove ticks from the schedules of the
remaining adversaries.
shrinkHonestPeer ∷ PeerSchedule blk → [PeerSchedule blk] Source #
shrinkHonestPeers ∷ Peers (PeerSchedule blk) → [Peers (PeerSchedule blk)] Source #
Shrinks honest peers by removing ticks. Because we are manipulating
PeerSchedule
at this point, there is no proper notion of a tick. Instead,
we remove points from the honest PeerSchedule
, and move all other points sooner.
We check that this operation does not changes the final state of the honest peers, that is, it keeps the same final tip point, header point, and block point.
NOTE: This operation makes the honest peers end their schedule sooner, which *may* trigger disconnections when the timeout for MsgAwaitReply is reached. In those cases, it is probably more pertinent to disable this timeout in tests than to disable shrinking.
shrinkPeerSchedules ∷ GenesisTestFull TestBlock → StateView TestBlock → [GenesisTestFull TestBlock] Source #
Shrink a PointSchedule
. We use a different logic to shrink honest and
adversarial peers. For adversarial peers, we just remove arbitrary points,
or peers altogether. For honest peers, we "speed up" the schedule by merging
adjacent points.
The block tree is trimmed to keep only parts that are necessary for the shrunk
schedules.