| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Block.SupportsPeras
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 (StandardHash blk, Typeable blk, Typeable (PerasVote blk), Show (PerasVote blk), Eq (PerasVote blk), NoThunks (PerasVote blk), IsPerasVote (PerasVote blk) blk, Typeable (BoostedBlock (PerasVote blk)), Show (BoostedBlock (PerasVote blk)), Eq (BoostedBlock (PerasVote blk)), NoThunks (BoostedBlock (PerasVote blk)), Typeable (PerasCert blk), Show (PerasCert blk), Eq (PerasCert blk), NoThunks (PerasCert blk), IsPerasCert (PerasCert blk) blk, Typeable (BoostedBlock (PerasCert blk)), Show (BoostedBlock (PerasCert blk)), Eq (BoostedBlock (PerasCert blk)), NoThunks (BoostedBlock (PerasCert blk)), Typeable (PerasError blk), Show (PerasError blk), Eq (PerasError blk), NoThunks (PerasError blk), IsPerasError (PerasError blk) blk, Exception (PerasError blk), Typeable (PerasVotingCommittee blk), Show (PerasVotingCommittee blk), Eq (PerasVotingCommittee blk), NoThunks (PerasVotingCommittee blk), Typeable (PerasEpochContext blk), Show (PerasEpochContext blk), Eq (PerasEpochContext blk), NoThunks (PerasEpochContext blk), Show (PerasCrypto blk), Eq (PerasCrypto blk), Typeable (PerasCrypto blk), NoThunks (PerasCrypto blk), Show (PerasVotingCommitteeScheme blk), Eq (PerasVotingCommitteeScheme blk), Typeable (PerasVotingCommitteeScheme blk), NoThunks (PerasVotingCommitteeScheme blk), ElectionId (PerasCrypto blk) ~ PerasRoundNo, VoteCandidate (PerasCrypto blk) ~ BoostedBlock (PerasVote blk), VoteCandidate (PerasCrypto blk) ~ BoostedBlock (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
- forgePerasVoteIfEligible ∷ PerasEpochContext blk → PoolId → PrivateKey (PerasCrypto blk) → PerasRoundNo → Point blk → Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
- verifyPerasVote ∷ PerasEpochContext blk → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk)
- forgePerasCert ∷ PerasEpochContext blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk)
- verifyPerasCert ∷ PerasEpochContext blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk)
- getPerasCertInBlock ∷ blk → Either (PerasError blk) (Maybe (PerasCert blk))
- defaultForgePerasVoteIfEligible ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PoolId → PrivateKey (PerasCrypto blk) → PerasRoundNo → Point blk → Either (PerasError blk) (Maybe (ValidatedPerasVote blk))
- defaultVerifyPerasVote ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk)
- defaultForgePerasCert ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasCertCompatibleWithVotingCommittee (PerasCert blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk)
- defaultVerifyPerasCert ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasCertCompatibleWithVotingCommittee (PerasCert blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk)
- data ValidatedPerasVote blk = ValidatedPerasVote {
- vpvVote ∷ !(PerasVote blk)
- vpvVoteWeight ∷ !VoteWeight
- data ValidatedPerasCert blk = ValidatedPerasCert {
- vpcCert ∷ !(PerasCert blk)
- vpcCertBoost ∷ !PerasWeight
- 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, ElectionId crypto ~ PerasRoundNo, CryptoSupportsVotingCommittee crypto committee, 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 (StandardHash blk, Typeable blk, Typeable (PerasVote blk), Show (PerasVote blk), Eq (PerasVote blk), NoThunks (PerasVote blk), IsPerasVote (PerasVote blk) blk, Typeable (BoostedBlock (PerasVote blk)), Show (BoostedBlock (PerasVote blk)), Eq (BoostedBlock (PerasVote blk)), NoThunks (BoostedBlock (PerasVote blk)), Typeable (PerasCert blk), Show (PerasCert blk), Eq (PerasCert blk), NoThunks (PerasCert blk), IsPerasCert (PerasCert blk) blk, Typeable (BoostedBlock (PerasCert blk)), Show (BoostedBlock (PerasCert blk)), Eq (BoostedBlock (PerasCert blk)), NoThunks (BoostedBlock (PerasCert blk)), Typeable (PerasError blk), Show (PerasError blk), Eq (PerasError blk), NoThunks (PerasError blk), IsPerasError (PerasError blk) blk, Exception (PerasError blk), Typeable (PerasVotingCommittee blk), Show (PerasVotingCommittee blk), Eq (PerasVotingCommittee blk), NoThunks (PerasVotingCommittee blk), Typeable (PerasEpochContext blk), Show (PerasEpochContext blk), Eq (PerasEpochContext blk), NoThunks (PerasEpochContext blk), Show (PerasCrypto blk), Eq (PerasCrypto blk), Typeable (PerasCrypto blk), NoThunks (PerasCrypto blk), Show (PerasVotingCommitteeScheme blk), Eq (PerasVotingCommitteeScheme blk), Typeable (PerasVotingCommitteeScheme blk), NoThunks (PerasVotingCommitteeScheme blk), ElectionId (PerasCrypto blk) ~ PerasRoundNo, VoteCandidate (PerasCrypto blk) ~ BoostedBlock (PerasVote blk), VoteCandidate (PerasCrypto blk) ~ BoostedBlock (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 PerasCert blk = (cert ∷ Type) | cert → blk Source #
The concrete Peras certificate type for this block type.
type PerasError blk = (err ∷ Type) | err → blk Source #
The concrete Peras error type for this block type.
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
forgePerasVoteIfEligible ∷ PerasEpochContext blk → PoolId → PrivateKey (PerasCrypto blk) → PerasRoundNo → Point blk → Either (PerasError blk) (Maybe (ValidatedPerasVote blk)) Source #
Forge a Peras vote if the given pool is eligible to vote in the given round.
verifyPerasVote ∷ PerasEpochContext blk → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk) Source #
Verify a Peras vote and return its weight if valid.
forgePerasCert ∷ PerasEpochContext blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
Forge a Peras certificate from a collection of votes reaching quorum.
verifyPerasCert ∷ PerasEpochContext blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
Verify a Peras certificate and return its boost if valid.
getPerasCertInBlock ∷ blk → Either (PerasError 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 (HardForkBlock xs), HashSize (HardForkBlock xs) ~ HashSizeOfHead xs, CanHardFork xs) ⇒ BlockSupportsPeras (HardForkBlock xs) Source # | |||||||||||||||||||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Associated Types
Methods forgePerasVoteIfEligible ∷ PerasEpochContext (HardForkBlock xs) → PoolId → PrivateKey (PerasCrypto (HardForkBlock xs)) → PerasRoundNo → Point (HardForkBlock xs) → Either (PerasError (HardForkBlock xs)) (Maybe (ValidatedPerasVote (HardForkBlock xs))) Source # verifyPerasVote ∷ PerasEpochContext (HardForkBlock xs) → PerasVote (HardForkBlock xs) → Either (PerasError (HardForkBlock xs)) (ValidatedPerasVote (HardForkBlock xs)) Source # forgePerasCert ∷ PerasEpochContext (HardForkBlock xs) → PerasVoteCollectionWithQuorum (HardForkBlock xs) → Either (PerasError (HardForkBlock xs)) (ValidatedPerasCert (HardForkBlock xs)) Source # verifyPerasCert ∷ PerasEpochContext (HardForkBlock xs) → PerasCert (HardForkBlock xs) → Either (PerasError (HardForkBlock xs)) (ValidatedPerasCert (HardForkBlock xs)) Source # getPerasCertInBlock ∷ HardForkBlock xs → Either (PerasError (HardForkBlock xs)) (Maybe (PerasCert (HardForkBlock xs))) Source # | |||||||||||||||||||||
| (StandardHash m, Typeable m, Typeable a) ⇒ BlockSupportsPeras (DualBlock m a) Source # | |||||||||||||||||||||
Defined in Ouroboros.Consensus.Ledger.Dual Associated Types
Methods forgePerasVoteIfEligible ∷ PerasEpochContext (DualBlock m a) → PoolId → PrivateKey (PerasCrypto (DualBlock m a)) → PerasRoundNo → Point (DualBlock m a) → Either (PerasError (DualBlock m a)) (Maybe (ValidatedPerasVote (DualBlock m a))) Source # verifyPerasVote ∷ PerasEpochContext (DualBlock m a) → PerasVote (DualBlock m a) → Either (PerasError (DualBlock m a)) (ValidatedPerasVote (DualBlock m a)) Source # forgePerasCert ∷ PerasEpochContext (DualBlock m a) → PerasVoteCollectionWithQuorum (DualBlock m a) → Either (PerasError (DualBlock m a)) (ValidatedPerasCert (DualBlock m a)) Source # verifyPerasCert ∷ PerasEpochContext (DualBlock m a) → PerasCert (DualBlock m a) → Either (PerasError (DualBlock m a)) (ValidatedPerasCert (DualBlock m a)) Source # getPerasCertInBlock ∷ DualBlock m a → Either (PerasError (DualBlock m a)) (Maybe (PerasCert (DualBlock m a))) Source # | |||||||||||||||||||||
defaultForgePerasVoteIfEligible ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PoolId → PrivateKey (PerasCrypto blk) → PerasRoundNo → Point blk → Either (PerasError blk) (Maybe (ValidatedPerasVote blk)) Source #
Forge a Peras vote if the given pool is eligible to vote in the given round.
defaultVerifyPerasVote ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasVote blk → Either (PerasError blk) (ValidatedPerasVote blk) Source #
Verify a Peras vote and return its weight if valid.
defaultForgePerasCert ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasVoteCompatibleWithVotingCommittee (PerasVote blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasCertCompatibleWithVotingCommittee (PerasCert blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasVoteCollectionWithQuorum blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
Forge a Peras certificate from a collection of votes reaching quorum.
defaultVerifyPerasCert ∷ (BlockSupportsPeras blk, CryptoSupportsVotingCommittee (PerasCrypto blk) (PerasVotingCommitteeScheme blk), PerasCertCompatibleWithVotingCommittee (PerasCert blk) (PerasCrypto blk) (PerasVotingCommitteeScheme blk)) ⇒ PerasEpochContext blk → PerasCert blk → Either (PerasError blk) (ValidatedPerasCert blk) Source #
Verify a Peras certificate and return its boost if valid.
Validated types
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 | |||||
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 | |||||
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 (MockPerasError blk) blk Source # | |
Defined in Ouroboros.Consensus.Peras.Error.Mock | |
| IsPerasError (PerasError blk) blk Source # | |
Defined in Ouroboros.Consensus.Peras.Error.V1 Methods injectVotingCommitteeError ∷ PerasVotingCommitteeError blk → PerasError blk Source # injectConversionError ∷ PerasConversionError → PerasError blk Source # injectQuorumNotReachedError ∷ VoteWeight → PerasError blk Source # | |
| 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 | |
| CanHardFork xs ⇒ IsPerasError (HardForkPerasError xs) (HardForkBlock xs) Source # | |
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, ElectionId crypto ~ PerasRoundNo, CryptoSupportsVotingCommittee crypto committee, 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.