| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Block.SupportsPeras
Contents
- Voting committee types for Peras
- Epoch-dependent context for Peras
- BlockSupportsPeras class
- To be removed in favor of using per-blk definitions
- To be removed in favor of using a
PerasEpochContextdirectly - Validated types
- Peras error types
- Types and functions related to Peras vote collection and quorum checking
- Helpers
- Convenience re-exports
Synopsis
- type PerasVotingCommittee blk = VotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk)
- type PerasVotingCommitteeError blk = VotingCommitteeError (PerasCrypto blk) (PerasVotingCommitteeScheme blk)
- type PerasVotingCommitteeInput blk = VotingCommitteeInput (PerasCrypto blk) (PerasVotingCommitteeScheme blk)
- data PerasEpochContext blk = PerasEpochContext {
- pecCommittee ∷ PerasVotingCommittee blk
- pecParams ∷ PerasParams blk
- class (Show (PerasParams blk), NoThunks (PerasCert blk)) ⇒ BlockSupportsPeras blk where
- type PerasVote blk = (vote ∷ Type) | vote → blk
- type PerasCert blk = (cert ∷ Type) | cert → blk
- type PerasError blk = (err ∷ Type) | err → blk
- type PerasCrypto blk
- type PerasVotingCommitteeScheme blk
- validatePerasCert ∷ PerasParams blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk)
- validatePerasVote ∷ PerasParams blk → PerasVoteStakeDistr → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk)
- forgePerasCert ∷ PerasParams blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk)
- getPerasCertInBlock ∷ blk → Maybe (PerasCert blk)
- data PerasCert' blk = PerasCert {}
- data PerasVote' blk = PerasVote {}
- newtype PerasVoteStakeDistr = PerasVoteStakeDistr {}
- data ValidatedPerasCert blk = ValidatedPerasCert {
- vpcCert ∷ !(PerasCert blk)
- vpcCertBoost ∷ !PerasWeight
- data ValidatedPerasVote blk = ValidatedPerasVote {
- vpvVote ∷ !(PerasVote blk)
- vpvVoteWeight ∷ !VoteWeight
- class IsPerasError err blk | err → blk where
- data PerasVoteCollection blk
- perasVoteCollectionSingleton ∷ IsPerasVote (PerasVote blk) blk ⇒ WithArrivalTime (ValidatedPerasVote blk) → PerasVoteCollection blk
- perasVoteCollectionAddVote ∷ (StandardHash blk, IsPerasVote (PerasVote blk) blk) ⇒ WithArrivalTime (ValidatedPerasVote blk) → PerasVoteCollection blk → PerasVoteCollection blk
- unsafePerasVoteCollection ∷ (IsPerasVote (PerasVote blk) blk, StandardHash blk) ⇒ NE (Map PerasVoteId (WithArrivalTime (ValidatedPerasVote blk))) → PerasVoteCollection blk
- data PerasVoteCollectionWithQuorum blk
- unsafeAssumeQuorum ∷ PerasVoteCollection blk → PerasVoteCollectionWithQuorum blk
- perasVoteCollectionCheckQuorum ∷ PerasParams blk → PerasVoteCollection blk → Maybe (PerasVoteCollectionWithQuorum blk)
- toUniqueVotesWithSameTarget ∷ (vote ~ PerasVote blk, crypto ~ PerasCrypto blk, committee ~ PerasVotingCommitteeScheme blk, PerasVoteCompatibleWithVotingCommittee vote crypto committee, Eq (VoteCandidate crypto)) ⇒ PerasVoteCollectionWithQuorum blk → Either PerasConversionError (UniqueVotesWithSameTarget (PerasCrypto blk) (PerasVotingCommitteeScheme blk))
- weightAboveThreshold ∷ PerasParams blk → VoteWeight → Bool
- module Ouroboros.Consensus.Peras.Cert.Class
- module Ouroboros.Consensus.Peras.Params
- module Ouroboros.Consensus.Peras.Types
- module Ouroboros.Consensus.Peras.Void
- module Ouroboros.Consensus.Peras.Vote.Class
Voting committee types for Peras
type PerasVotingCommittee blk = VotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk) Source #
Voting committee for Peras indexed by block type
type PerasVotingCommitteeError blk = VotingCommitteeError (PerasCrypto blk) (PerasVotingCommitteeScheme blk) Source #
Error type for Peras voting committee errors
type PerasVotingCommitteeInput blk = VotingCommitteeInput (PerasCrypto blk) (PerasVotingCommitteeScheme blk) Source #
Input needed to build a Peras voting committee
Epoch-dependent context for Peras
data PerasEpochContext blk Source #
Epoch-dependent context used for forging and validation of objects.
Constructors
| PerasEpochContext | |
Fields
| |
Instances
BlockSupportsPeras class
class (Show (PerasParams blk), NoThunks (PerasCert blk)) ⇒ BlockSupportsPeras blk where Source #
Associated Types
type PerasVote blk = (vote ∷ Type) | vote → blk Source #
The concrete Peras vote type for this block type.
type PerasVote blk = VoidPerasVote blk
type PerasCert blk = (cert ∷ Type) | cert → blk Source #
The concrete Peras certificate type for this block type.
type PerasCert blk = VoidPerasCert blk
type PerasError blk = (err ∷ Type) | err → blk Source #
The concrete Peras error type for this block type.
type PerasError blk = VoidPerasError blk
type PerasCrypto blk Source #
The crypto scheme used for Peras votes and certificates.
Used to dispatch a block type to a its corresponding voting crypto scheme.
type PerasCrypto blk = VoidPerasCrypto blk
type PerasVotingCommitteeScheme blk Source #
The voting committee scheme used for Peras.
Used to dispatch a block type to a its corresponding voting committee scheme.
Methods
validatePerasCert ∷ PerasParams blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
validatePerasVote ∷ PerasParams blk → PerasVoteStakeDistr → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk) Source #
forgePerasCert ∷ PerasParams blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
getPerasCertInBlock ∷ blk → Maybe (PerasCert blk) Source #
Extract a Peras certificate optionally stored in a block.
Returns Nothing if the block does not contain a Peras certificate, or
if the block is from an era that does not support Peras certificates.
Instances
| StandardHash blk ⇒ BlockSupportsPeras blk Source # | |||||||||||||||||||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods validatePerasCert ∷ PerasParams blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk) Source # validatePerasVote ∷ PerasParams blk → PerasVoteStakeDistr → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk) Source # forgePerasCert ∷ PerasParams blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk) Source # getPerasCertInBlock ∷ blk → Maybe (PerasCert blk) Source # | |||||||||||||||||||||
To be removed in favor of using per-blk definitions
data PerasCert' blk Source #
NOTE: to be removed in favor of using per-blk definitions.
Constructors
| PerasCert | |
Fields | |
Instances
| ConvertRawHash blk ⇒ SerialiseNodeToNode blk (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Node.Serialisation Methods encodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → PerasCert' blk → Encoding Source # decodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s (PerasCert' blk) Source # | |||||
| ShowProxy blk ⇒ ShowProxy (PerasCert' blk ∷ Type) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showProxy ∷ Proxy (PerasCert' blk) → String # | |||||
| StandardHash blk ⇒ Eq (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ PerasCert' blk → PerasCert' blk → Bool # (/=) ∷ PerasCert' blk → PerasCert' blk → Bool # | |||||
| StandardHash blk ⇒ Ord (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods compare ∷ PerasCert' blk → PerasCert' blk → Ordering # (<) ∷ PerasCert' blk → PerasCert' blk → Bool # (<=) ∷ PerasCert' blk → PerasCert' blk → Bool # (>) ∷ PerasCert' blk → PerasCert' blk → Bool # (>=) ∷ PerasCert' blk → PerasCert' blk → Bool # max ∷ PerasCert' blk → PerasCert' blk → PerasCert' blk # min ∷ PerasCert' blk → PerasCert' blk → PerasCert' blk # | |||||
| Generic (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ PerasCert' blk → Rep (PerasCert' blk) x # to ∷ Rep (PerasCert' blk) x → PerasCert' blk # | |||||
| StandardHash blk ⇒ Show (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → PerasCert' blk → ShowS # show ∷ PerasCert' blk → String # showList ∷ [PerasCert' blk] → ShowS # | |||||
| StandardHash blk ⇒ NoThunks (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| Serialise (HeaderHash blk) ⇒ Serialise (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods encode ∷ PerasCert' blk → Encoding Source # decode ∷ Decoder s (PerasCert' blk) Source # encodeList ∷ [PerasCert' blk] → Encoding Source # decodeList ∷ Decoder s [PerasCert' blk] Source # | |||||
| IsPerasCert (PerasCert' blk) blk Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods getPerasCertRound ∷ PerasCert' blk → PerasRoundNo Source # getPerasCertBlock ∷ PerasCert' blk → BoostedBlock (PerasCert' blk) Source # getPerasCertPoint ∷ PerasCert' blk → Point blk Source # | |||||
| type Rep (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep (PerasCert' blk) = D1 ('MetaData "PerasCert'" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "PerasCert" 'PrefixI 'True) (S1 ('MetaSel ('Just "pcCertRound") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PerasRoundNo) :*: S1 ('MetaSel ('Just "pcCertBoostedBlock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)))) | |||||
| type BoostedBlock (PerasCert' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
data PerasVote' blk Source #
NOTE: to be removed in favor of using per-blk definitions.
Constructors
| PerasVote | |
Fields | |
Instances
| ConvertRawHash blk ⇒ SerialiseNodeToNode blk (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Node.Serialisation Methods encodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → PerasVote' blk → Encoding Source # decodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s (PerasVote' blk) Source # | |||||
| ShowProxy blk ⇒ ShowProxy (PerasVote' blk ∷ Type) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showProxy ∷ Proxy (PerasVote' blk) → String # | |||||
| StandardHash blk ⇒ Eq (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ PerasVote' blk → PerasVote' blk → Bool # (/=) ∷ PerasVote' blk → PerasVote' blk → Bool # | |||||
| StandardHash blk ⇒ Ord (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods compare ∷ PerasVote' blk → PerasVote' blk → Ordering # (<) ∷ PerasVote' blk → PerasVote' blk → Bool # (<=) ∷ PerasVote' blk → PerasVote' blk → Bool # (>) ∷ PerasVote' blk → PerasVote' blk → Bool # (>=) ∷ PerasVote' blk → PerasVote' blk → Bool # max ∷ PerasVote' blk → PerasVote' blk → PerasVote' blk # min ∷ PerasVote' blk → PerasVote' blk → PerasVote' blk # | |||||
| Generic (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ PerasVote' blk → Rep (PerasVote' blk) x # to ∷ Rep (PerasVote' blk) x → PerasVote' blk # | |||||
| StandardHash blk ⇒ Show (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → PerasVote' blk → ShowS # show ∷ PerasVote' blk → String # showList ∷ [PerasVote' blk] → ShowS # | |||||
| StandardHash blk ⇒ NoThunks (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| Serialise (HeaderHash blk) ⇒ Serialise (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods encode ∷ PerasVote' blk → Encoding Source # decode ∷ Decoder s (PerasVote' blk) Source # encodeList ∷ [PerasVote' blk] → Encoding Source # decodeList ∷ Decoder s [PerasVote' blk] Source # | |||||
| IsPerasVote (PerasVote' blk) blk Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods getPerasVoteRound ∷ PerasVote' blk → PerasRoundNo Source # getPerasVoteBlock ∷ PerasVote' blk → BoostedBlock (PerasVote' blk) Source # getPerasVoteSeatIndex ∷ PerasVote' blk → PerasSeatIndex Source # getPerasVotePoint ∷ PerasVote' blk → Point blk Source # | |||||
| type Rep (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep (PerasVote' blk) = D1 ('MetaData "PerasVote'" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "PerasVote" 'PrefixI 'True) (S1 ('MetaSel ('Just "pvVoteRound") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PerasRoundNo) :*: (S1 ('MetaSel ('Just "pvVoteBlock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Point blk)) :*: S1 ('MetaSel ('Just "pvVoteVoterId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PerasSeatIndex)))) | |||||
| type BoostedBlock (PerasVote' blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
To be removed in favor of using a PerasEpochContext directly
newtype PerasVoteStakeDistr Source #
Constructors
| PerasVoteStakeDistr | |
Instances
| Eq PerasVoteStakeDistr Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods | |||||
| Generic PerasVoteStakeDistr Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods | |||||
| Show PerasVoteStakeDistr Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → PerasVoteStakeDistr → ShowS # show ∷ PerasVoteStakeDistr → String # showList ∷ [PerasVoteStakeDistr] → ShowS # | |||||
| NoThunks PerasVoteStakeDistr Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| type Rep PerasVoteStakeDistr Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep PerasVoteStakeDistr = D1 ('MetaData "PerasVoteStakeDistr" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'True) (C1 ('MetaCons "PerasVoteStakeDistr" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPerasVoteStakeDistr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PerasSeatIndex VoteWeight)))) | |||||
Validated types
data ValidatedPerasCert blk Source #
Constructors
| ValidatedPerasCert | |
Fields
| |
Instances
| Eq (PerasCert blk) ⇒ Eq (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # (/=) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # | |||||
| Ord (PerasCert blk) ⇒ Ord (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods compare ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Ordering # (<) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # (<=) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # (>) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # (>=) ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → Bool # max ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → ValidatedPerasCert blk # min ∷ ValidatedPerasCert blk → ValidatedPerasCert blk → ValidatedPerasCert blk # | |||||
| Generic (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ ValidatedPerasCert blk → Rep (ValidatedPerasCert blk) x # to ∷ Rep (ValidatedPerasCert blk) x → ValidatedPerasCert blk # | |||||
| Show (PerasCert blk) ⇒ Show (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → ValidatedPerasCert blk → ShowS # show ∷ ValidatedPerasCert blk → String # showList ∷ [ValidatedPerasCert blk] → ShowS # | |||||
| NoThunks (PerasCert blk) ⇒ NoThunks (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| (IsPerasCert (PerasCert blk) blk, BoostedBlockCompatibleWithPoint (BoostedBlock (PerasCert blk)) blk) ⇒ IsPerasCert (ValidatedPerasCert blk) blk Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods getPerasCertRound ∷ ValidatedPerasCert blk → PerasRoundNo Source # getPerasCertBlock ∷ ValidatedPerasCert blk → BoostedBlock (ValidatedPerasCert blk) Source # getPerasCertPoint ∷ ValidatedPerasCert blk → Point blk Source # | |||||
| type Rep (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep (ValidatedPerasCert blk) = D1 ('MetaData "ValidatedPerasCert" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "ValidatedPerasCert" 'PrefixI 'True) (S1 ('MetaSel ('Just "vpcCert") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PerasCert blk)) :*: S1 ('MetaSel ('Just "vpcCertBoost") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PerasWeight))) | |||||
| type BoostedBlock (ValidatedPerasCert blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
data ValidatedPerasVote blk Source #
Constructors
| ValidatedPerasVote | |
Fields
| |
Instances
| Eq (PerasVote blk) ⇒ Eq (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # (/=) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # | |||||
| Ord (PerasVote blk) ⇒ Ord (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods compare ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Ordering # (<) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # (<=) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # (>) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # (>=) ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → Bool # max ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → ValidatedPerasVote blk # min ∷ ValidatedPerasVote blk → ValidatedPerasVote blk → ValidatedPerasVote blk # | |||||
| Generic (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ ValidatedPerasVote blk → Rep (ValidatedPerasVote blk) x # to ∷ Rep (ValidatedPerasVote blk) x → ValidatedPerasVote blk # | |||||
| Show (PerasVote blk) ⇒ Show (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → ValidatedPerasVote blk → ShowS # show ∷ ValidatedPerasVote blk → String # showList ∷ [ValidatedPerasVote blk] → ShowS # | |||||
| NoThunks (PerasVote blk) ⇒ NoThunks (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| (IsPerasVote (PerasVote blk) blk, BoostedBlockCompatibleWithPoint (BoostedBlock (PerasVote blk)) blk) ⇒ IsPerasVote (ValidatedPerasVote blk) blk Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods getPerasVoteRound ∷ ValidatedPerasVote blk → PerasRoundNo Source # getPerasVoteBlock ∷ ValidatedPerasVote blk → BoostedBlock (ValidatedPerasVote blk) Source # getPerasVoteSeatIndex ∷ ValidatedPerasVote blk → PerasSeatIndex Source # getPerasVotePoint ∷ ValidatedPerasVote blk → Point blk Source # | |||||
| type Rep (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep (ValidatedPerasVote blk) = D1 ('MetaData "ValidatedPerasVote" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "ValidatedPerasVote" 'PrefixI 'True) (S1 ('MetaSel ('Just "vpvVote") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PerasVote blk)) :*: S1 ('MetaSel ('Just "vpvVoteWeight") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 VoteWeight))) | |||||
| type BoostedBlock (ValidatedPerasVote blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
Peras error types
class IsPerasError err blk | err → blk where Source #
Error types that support injecting certain types of Peras errors
Methods
injectVotingCommitteeError ∷ PerasVotingCommitteeError blk → err Source #
injectConversionError ∷ PerasConversionError → err Source #
injectQuorumNotReachedError ∷ VoteWeight → err Source #
Instances
| IsPerasError (VoidPerasError blk) blk Source # | |
Defined in Ouroboros.Consensus.Block.SupportsPeras | |
| IsPerasError (PerasError blk) blk ⇒ IsPerasError (WrapPerasError blk) blk Source # | |
Defined in Ouroboros.Consensus.TypeFamilyWrappers | |
Types and functions related to Peras vote collection and quorum checking
data PerasVoteCollection blk Source #
Collection of Peras votes for a given target.
NOTE: votes in this collection are uniquely identified by their vote ID.
Instances
| (StandardHash blk, Eq (PerasVote blk), Eq (PerasCert blk)) ⇒ Eq (PerasVoteCollection blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ PerasVoteCollection blk → PerasVoteCollection blk → Bool # (/=) ∷ PerasVoteCollection blk → PerasVoteCollection blk → Bool # | |||||
| Generic (PerasVoteCollection blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ PerasVoteCollection blk → Rep (PerasVoteCollection blk) x # to ∷ Rep (PerasVoteCollection blk) x → PerasVoteCollection blk # | |||||
| (StandardHash blk, Show (PerasVote blk), Show (PerasCert blk)) ⇒ Show (PerasVoteCollection blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → PerasVoteCollection blk → ShowS # show ∷ PerasVoteCollection blk → String # showList ∷ [PerasVoteCollection blk] → ShowS # | |||||
| (StandardHash blk, NoThunks (PerasVote blk), NoThunks (PerasCert blk)) ⇒ NoThunks (PerasVoteCollection blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| type Rep (PerasVoteCollection blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras type Rep (PerasVoteCollection blk) = D1 ('MetaData "PerasVoteCollection" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "PerasVoteCollection" 'PrefixI 'True) (S1 ('MetaSel ('Just "pvcTarget") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PerasVoteTarget blk)) :*: (S1 ('MetaSel ('Just "pvcVotes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NE (Map PerasVoteId (WithArrivalTime (ValidatedPerasVote blk))))) :*: S1 ('MetaSel ('Just "pvcTotalWeight") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 VoteWeight)))) | |||||
perasVoteCollectionSingleton ∷ IsPerasVote (PerasVote blk) blk ⇒ WithArrivalTime (ValidatedPerasVote blk) → PerasVoteCollection blk Source #
Construct a PerasVoteCollection with a single vote.
perasVoteCollectionAddVote ∷ (StandardHash blk, IsPerasVote (PerasVote blk) blk) ⇒ WithArrivalTime (ValidatedPerasVote blk) → PerasVoteCollection blk → PerasVoteCollection blk Source #
Add a vote to an existing vote collection if it isn't already present, and update the total weight accordingly.
PRECONDITION: the vote's target must match the collection's target.
unsafePerasVoteCollection ∷ (IsPerasVote (PerasVote blk) blk, StandardHash blk) ⇒ NE (Map PerasVoteId (WithArrivalTime (ValidatedPerasVote blk))) → PerasVoteCollection blk Source #
Unsafe constructor for PerasVoteCollection.
The only recorded use at the moment is in the HFC implementation, to turn an
existing PerasVoteCollection for the HardForkBlock into a
PerasVoteCollection of a concrete era.
data PerasVoteCollectionWithQuorum blk Source #
A collection of Peras votes for a given target that has reached quorum
Instances
| (StandardHash blk, Eq (PerasVote blk), Eq (PerasCert blk)) ⇒ Eq (PerasVoteCollectionWithQuorum blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods (==) ∷ PerasVoteCollectionWithQuorum blk → PerasVoteCollectionWithQuorum blk → Bool # (/=) ∷ PerasVoteCollectionWithQuorum blk → PerasVoteCollectionWithQuorum blk → Bool # | |||||
| Generic (PerasVoteCollectionWithQuorum blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Associated Types
Methods from ∷ PerasVoteCollectionWithQuorum blk → Rep (PerasVoteCollectionWithQuorum blk) x # to ∷ Rep (PerasVoteCollectionWithQuorum blk) x → PerasVoteCollectionWithQuorum blk # | |||||
| (StandardHash blk, Show (PerasVote blk), Show (PerasCert blk)) ⇒ Show (PerasVoteCollectionWithQuorum blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras Methods showsPrec ∷ Int → PerasVoteCollectionWithQuorum blk → ShowS # show ∷ PerasVoteCollectionWithQuorum blk → String # showList ∷ [PerasVoteCollectionWithQuorum blk] → ShowS # | |||||
| (StandardHash blk, NoThunks (PerasVote blk), NoThunks (PerasCert blk)) ⇒ NoThunks (PerasVoteCollectionWithQuorum blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
| type Rep (PerasVoteCollectionWithQuorum blk) Source # | |||||
Defined in Ouroboros.Consensus.Block.SupportsPeras | |||||
unsafeAssumeQuorum ∷ PerasVoteCollection blk → PerasVoteCollectionWithQuorum blk Source #
Transforms a PerasVoteCollection into a PerasVoteCollectionWithQuorum
without actually checking the quorum condition.
NOTE: the only recorded use at the moment is in the HFC implementation, to
turn an existing PerasVoteCollectionWithQuorum for the HardForkBlock into
a PerasVoteCollectionWithQuorum of a concrete era.
perasVoteCollectionCheckQuorum ∷ PerasParams blk → PerasVoteCollection blk → Maybe (PerasVoteCollectionWithQuorum blk) Source #
Smart constructor for PerasVoteCollectionWithQuorum
toUniqueVotesWithSameTarget ∷ (vote ~ PerasVote blk, crypto ~ PerasCrypto blk, committee ~ PerasVotingCommitteeScheme blk, PerasVoteCompatibleWithVotingCommittee vote crypto committee, Eq (VoteCandidate crypto)) ⇒ PerasVoteCollectionWithQuorum blk → Either PerasConversionError (UniqueVotesWithSameTarget (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) Source #
Convert a collection of Peras votes that has reached quorum into the corresponding abstract representation of votes used by the voting committee to forge certificates.
UniqueVotesWithSameTarget and PerasVoteCollection enforce the same
invariants, which are:
- The collection is not empty
- All votes have the same target
- All votes have a unique vote ID (or unique seat index, which is equivalent
assuming they also have the same target, see second point)
In addition to that, PerasVoteCollectionWithQuorum guarantees that the
total weight of the votes is above the threshold.
Helpers
weightAboveThreshold ∷ PerasParams blk → VoteWeight → Bool Source #
Check whether a given vote weight is above the quorum threshold.
NOTE: this function assumes that the VoteWeight and the quorum
threshold used in PerasParams are expressed in the same units. That is,
both are either absolute or relative (normalized) values. Under the current
current implementation of PerasParams, this function only makes sense when
both values are relative (normalized) values.