| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Peras.Voting.Adapter
Description
Conversion between concrete Peras types and abstract committee types
Synopsis
- class PerasVoteCompatibleWithVotingCommittee vote crypto committee | vote → crypto where
- toPerasVote ∷ Vote crypto committee → Either PerasConversionError vote
- fromPerasVote ∷ vote → Either PerasConversionError (Vote crypto committee)
- class PerasCertCompatibleWithVotingCommittee cert crypto committee | cert → crypto where
- toPerasCert ∷ Cert crypto committee → Either PerasConversionError cert
- fromPerasCert ∷ cert → Either PerasConversionError (Cert crypto committee)
- data PerasConversionError
- fromPerasSeatIndex ∷ PerasSeatIndex → SeatIndex
- toPerasSeatIndex ∷ SeatIndex → Either PerasConversionError PerasSeatIndex
Documentation
class PerasVoteCompatibleWithVotingCommittee vote crypto committee | vote → crypto where Source #
Conversion between (concrete) Peras votes and (abstract) committee votes.
NOTE: the functional dependency vote -> crypto explicitly ties each
concrete Peras vote type to a specific crypto scheme.
Methods
toPerasVote ∷ Vote crypto committee → Either PerasConversionError vote Source #
fromPerasVote ∷ vote → Either PerasConversionError (Vote crypto committee) Source #
Instances
class PerasCertCompatibleWithVotingCommittee cert crypto committee | cert → crypto where Source #
Conversion between (concrete) Peras certificates and (abstract) committee certificates.
NOTE: the functional dependency cert -> crypto explicitly ties each
concrete Peras certificate type to a specific crypto scheme.
Methods
toPerasCert ∷ Cert crypto committee → Either PerasConversionError cert Source #
fromPerasCert ∷ cert → Either PerasConversionError (Cert crypto committee) Source #
Instances
data PerasConversionError Source #
Errors that can occur when converting between Peras and committee types
Constructors
| EveryoneVotesButFoundNonPersistentVoterInVote SeatIndex | |
| EveryoneVotesButFoundNonPersistentVotersInCert (NE [SeatIndex]) | |
| SeatIndexOverflowError Word64 | |
| CryptoError String |
Instances
fromPerasSeatIndex ∷ PerasSeatIndex → SeatIndex Source #
Convert a Peras seat index to a committee seat index.
toPerasSeatIndex ∷ SeatIndex → Either PerasConversionError PerasSeatIndex Source #
Convert a committee seat index to a Peras seat index
NOTE: this can fail if the seat index in the committee vote or certificate
overflows the smaller Word16 type used by Peras votes and certificates.
In practice, this should never happen unless there is a bug in the voting
committee logic.