ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Block.SupportsPeras

Synopsis

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.

Instances

Instances details
(Typeable blk, FromCBOR (PerasVotingCommittee blk))FromCBOR (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(Typeable blk, ToCBOR (PerasVotingCommittee blk))ToCBOR (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

toCBORPerasEpochContext blk → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (PerasEpochContext blk) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [PerasEpochContext blk] → Size Source #

Eq (PerasVotingCommittee blk) ⇒ Eq (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (PerasEpochContext blk) 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasEpochContext blk) = D1 ('MetaData "PerasEpochContext" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "PerasEpochContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "pecCommittee") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PerasVotingCommittee blk)) :*: S1 ('MetaSel ('Just "pecParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PerasParams blk))))

Methods

fromPerasEpochContext blk → Rep (PerasEpochContext blk) x #

toRep (PerasEpochContext blk) x → PerasEpochContext blk #

Show (PerasVotingCommittee blk) ⇒ Show (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

NoThunks (PerasVotingCommittee blk) ⇒ NoThunks (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasEpochContext blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasEpochContext blk) = D1 ('MetaData "PerasEpochContext" "Ouroboros.Consensus.Block.SupportsPeras" "ouroboros-consensus-4.0.0.0-inplace" 'False) (C1 ('MetaCons "PerasEpochContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "pecCommittee") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PerasVotingCommittee blk)) :*: S1 ('MetaSel ('Just "pecParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PerasParams blk))))

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 PerasVotingCommitteeScheme blk Source #

The voting committee scheme used for Peras.

Used to dispatch a block type to a its corresponding voting committee scheme.

Methods

validatePerasCertPerasParams blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #

validatePerasVotePerasParams blk → PerasVoteStakeDistrPerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk) Source #

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

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 

Instances

Instances details
ConvertRawHash blk ⇒ SerialiseNodeToNode blk (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

ShowProxy blk ⇒ ShowProxy (PerasCert' blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

showProxyProxy (PerasCert' blk) → String #

StandardHash blk ⇒ Eq (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

(==)PerasCert' blk → PerasCert' blk → Bool #

(/=)PerasCert' blk → PerasCert' blk → Bool #

StandardHash blk ⇒ Ord (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

comparePerasCert' blk → PerasCert' blk → Ordering #

(<)PerasCert' blk → PerasCert' blk → Bool #

(<=)PerasCert' blk → PerasCert' blk → Bool #

(>)PerasCert' blk → PerasCert' blk → Bool #

(>=)PerasCert' blk → PerasCert' blk → Bool #

maxPerasCert' blk → PerasCert' blk → PerasCert' blk #

minPerasCert' blk → PerasCert' blk → PerasCert' blk #

Generic (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (PerasCert' blk) 
Instance details

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))))

Methods

fromPerasCert' blk → Rep (PerasCert' blk) x #

toRep (PerasCert' blk) x → PerasCert' blk #

StandardHash blk ⇒ Show (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

showsPrecIntPerasCert' blk → ShowS #

showPerasCert' blk → String #

showList ∷ [PerasCert' blk] → ShowS #

StandardHash blk ⇒ NoThunks (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Serialise (HeaderHash blk) ⇒ Serialise (PerasCert' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

IsPerasCert (PerasCert' blk) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasCert' blk) Source # 
Instance details

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 # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type BoostedBlock (PerasCert' blk) = Point blk

data PerasVote' blk Source #

NOTE: to be removed in favor of using per-blk definitions.

Instances

Instances details
ConvertRawHash blk ⇒ SerialiseNodeToNode blk (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Node.Serialisation

ShowProxy blk ⇒ ShowProxy (PerasVote' blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

showProxyProxy (PerasVote' blk) → String #

StandardHash blk ⇒ Eq (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

(==)PerasVote' blk → PerasVote' blk → Bool #

(/=)PerasVote' blk → PerasVote' blk → Bool #

StandardHash blk ⇒ Ord (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

comparePerasVote' blk → PerasVote' blk → Ordering #

(<)PerasVote' blk → PerasVote' blk → Bool #

(<=)PerasVote' blk → PerasVote' blk → Bool #

(>)PerasVote' blk → PerasVote' blk → Bool #

(>=)PerasVote' blk → PerasVote' blk → Bool #

maxPerasVote' blk → PerasVote' blk → PerasVote' blk #

minPerasVote' blk → PerasVote' blk → PerasVote' blk #

Generic (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (PerasVote' blk) 
Instance details

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))))

Methods

fromPerasVote' blk → Rep (PerasVote' blk) x #

toRep (PerasVote' blk) x → PerasVote' blk #

StandardHash blk ⇒ Show (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Methods

showsPrecIntPerasVote' blk → ShowS #

showPerasVote' blk → String #

showList ∷ [PerasVote' blk] → ShowS #

StandardHash blk ⇒ NoThunks (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Serialise (HeaderHash blk) ⇒ Serialise (PerasVote' blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

IsPerasVote (PerasVote' blk) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasVote' blk) Source # 
Instance details

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 # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type BoostedBlock (PerasVote' blk) = Point blk

To be removed in favor of using a PerasEpochContext directly

newtype PerasVoteStakeDistr Source #

Instances

Instances details
Eq PerasVoteStakeDistr Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic PerasVoteStakeDistr Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep PerasVoteStakeDistr 
Instance details

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))))
Show PerasVoteStakeDistr Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

NoThunks PerasVoteStakeDistr Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep PerasVoteStakeDistr Source # 
Instance details

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

Instances details
Eq (PerasCert blk) ⇒ Eq (ValidatedPerasCert blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Ord (PerasCert blk) ⇒ Ord (ValidatedPerasCert blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic (ValidatedPerasCert blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (ValidatedPerasCert blk) 
Instance details

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)))
Show (PerasCert blk) ⇒ Show (ValidatedPerasCert blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

NoThunks (PerasCert blk) ⇒ NoThunks (ValidatedPerasCert blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(IsPerasCert (PerasCert blk) blk, BoostedBlockCompatibleWithPoint (BoostedBlock (PerasCert blk)) blk)IsPerasCert (ValidatedPerasCert blk) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (ValidatedPerasCert blk) Source # 
Instance details

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 # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

data ValidatedPerasVote blk Source #

Constructors

ValidatedPerasVote 

Fields

Instances

Instances details
Eq (PerasVote blk) ⇒ Eq (ValidatedPerasVote blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Ord (PerasVote blk) ⇒ Ord (ValidatedPerasVote blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic (ValidatedPerasVote blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (ValidatedPerasVote blk) 
Instance details

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)))
Show (PerasVote blk) ⇒ Show (ValidatedPerasVote blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

NoThunks (PerasVote blk) ⇒ NoThunks (ValidatedPerasVote blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(IsPerasVote (PerasVote blk) blk, BoostedBlockCompatibleWithPoint (BoostedBlock (PerasVote blk)) blk)IsPerasVote (ValidatedPerasVote blk) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (ValidatedPerasVote blk) Source # 
Instance details

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 # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Peras error types

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

Instances details
(StandardHash blk, Eq (PerasVote blk), Eq (PerasCert blk))Eq (PerasVoteCollection blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic (PerasVoteCollection blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Associated Types

type Rep (PerasVoteCollection blk) 
Instance details

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))))
(StandardHash blk, Show (PerasVote blk), Show (PerasCert blk))Show (PerasVoteCollection blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(StandardHash blk, NoThunks (PerasVote blk), NoThunks (PerasCert blk))NoThunks (PerasVoteCollection blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasVoteCollection blk) Source # 
Instance details

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))))

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

Instances details
(StandardHash blk, Eq (PerasVote blk), Eq (PerasCert blk))Eq (PerasVoteCollectionWithQuorum blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

Generic (PerasVoteCollectionWithQuorum blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(StandardHash blk, Show (PerasVote blk), Show (PerasCert blk))Show (PerasVoteCollectionWithQuorum blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

(StandardHash blk, NoThunks (PerasVote blk), NoThunks (PerasCert blk))NoThunks (PerasVoteCollectionWithQuorum blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

type Rep (PerasVoteCollectionWithQuorum blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.SupportsPeras

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

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

weightAboveThresholdPerasParams blk → VoteWeightBool 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.

Convenience re-exports