ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Peras.Voting.Adapter

Description

Conversion between concrete Peras types and abstract committee types

Synopsis

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

toPerasVoteVote crypto committee → Either PerasConversionError vote Source #

fromPerasVote ∷ vote → Either PerasConversionError (Vote crypto committee) Source #

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

toPerasCertCert crypto committee → Either PerasConversionError cert Source #

fromPerasCert ∷ cert → Either PerasConversionError (Cert crypto committee) Source #

data PerasConversionError Source #

Errors that can occur when converting between Peras and committee types

Instances

Instances details
Eq PerasConversionError Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

Generic PerasConversionError Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

Associated Types

type Rep PerasConversionError 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

type Rep PerasConversionError = D1 ('MetaData "PerasConversionError" "Ouroboros.Consensus.Peras.Voting.Adapter" "ouroboros-consensus-4.0.0.0-inplace" 'False) ((C1 ('MetaCons "EveryoneVotesButFoundNonPersistentVoterInVote" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SeatIndex)) :+: C1 ('MetaCons "EveryoneVotesButFoundNonPersistentVotersInCert" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NE [SeatIndex])))) :+: (C1 ('MetaCons "SeatIndexOverflowError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)) :+: C1 ('MetaCons "CryptoError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))
Show PerasConversionError Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

NoThunks PerasConversionError Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

type Rep PerasConversionError Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Voting.Adapter

type Rep PerasConversionError = D1 ('MetaData "PerasConversionError" "Ouroboros.Consensus.Peras.Voting.Adapter" "ouroboros-consensus-4.0.0.0-inplace" 'False) ((C1 ('MetaCons "EveryoneVotesButFoundNonPersistentVoterInVote" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SeatIndex)) :+: C1 ('MetaCons "EveryoneVotesButFoundNonPersistentVotersInCert" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NE [SeatIndex])))) :+: (C1 ('MetaCons "SeatIndexOverflowError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)) :+: C1 ('MetaCons "CryptoError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

fromPerasSeatIndexPerasSeatIndexSeatIndex Source #

Convert a Peras seat index to a committee seat index.

toPerasSeatIndexSeatIndexEither 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.