ouroboros-consensus:protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Protocol.PolyPraos

Description

Praos, and the pieces every protocol built on Praos shares.

Each such protocol is its own proto type with its own instances, so that none of Praos's rules are reused by accident. The data types, however, are shared: they carry a proto parameter, so that there is one definition of each Praos concept regardless of which extensions the protocol enables. The functions suffixed PolyPraos are the method implementations every such protocol delegates to.

Poly means "many": a PolyPraos type or function handles multiple extensions of/overlays on Praos, the ones used for Cardano. And the PolyPraos functions are indeed polymorphic in the proto tyvar.

This is not a fully modular design: subsequent additional extensions will also need to add to these same definitions (eg adding fields for Ouroboros Phalanx). That is intentional. This code does not need to be classically extensible, since there is, unfortunately, no such thing as an extensible security proof. Our protocol changes are well studied before implemented, and have never happened concurrently.

In other words: it's a very important benefit that there is one definition to look at in order to see everything all of the Praos extensions cumulatively do. The type-level DSL used to isolate extension components is simple and legible; see the LeiosOnly data family, for example.

Synopsis

Documentation

class (Crypto c, Signable DSIGN (OCertSignable c), Signable (VRF c) InputVRF, Signable (KES c) (Signed (ShelleyProtocolHeader proto))) ⇒ PolyPraosCrypto proto c Source #

What a protocol needs of its crypto: the Praos essentials, plus signing whichever header body it is the protocol for.

data PolyPraosState proto Source #

Praos consensus state.

We track the last slot and the counters for operational certificates, as well as a series of nonces which get updated in different ways over the course of an epoch.

Constructors

PraosState 

Fields

Instances

Instances details
SerialisePraosState proto ⇒ FromCBOR (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

SerialisePraosState proto ⇒ ToCBOR (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

toCBOR ∷ PolyPraosState proto → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (PolyPraosState proto) → Size Source #

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

Eq (WhenLeios proto (Either WhyNotCertifiable LeiosAnnouncement)) ⇒ Eq (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

(==) ∷ PolyPraosState proto → PolyPraosState proto → Bool #

(/=) ∷ PolyPraosState proto → PolyPraosState proto → Bool #

Generic (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PolyPraosState proto) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosState proto) = D1 ('MetaData "PolyPraosState" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "praosStateLastSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin SlotNo)) :*: S1 ('MetaSel ('Just "praosStateOCertCounters") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'BlockIssuer) Word64))) :*: (S1 ('MetaSel ('Just "praosStateEvolvingNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStateCandidateNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce))) :*: ((S1 ('MetaSel ('Just "praosStateEpochNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStatePreviousEpochNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "praosStateLabNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: (S1 ('MetaSel ('Just "praosStateLastEpochBlockNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStateLeiosAnnouncement") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WhenLeios proto (Either WhyNotCertifiable LeiosAnnouncement))))))))

Methods

from ∷ PolyPraosState proto → Rep (PolyPraosState proto) x #

to ∷ Rep (PolyPraosState proto) x → PolyPraosState proto #

Show (WhenLeios proto (Either WhyNotCertifiable LeiosAnnouncement)) ⇒ Show (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

showsPrec ∷ Int → PolyPraosState proto → ShowS #

show ∷ PolyPraosState proto → String #

showList ∷ [PolyPraosState proto] → ShowS #

(Typeable proto, NoThunks (WhenLeios proto (Either WhyNotCertifiable LeiosAnnouncement))) ⇒ NoThunks (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

ChainDepStateSupportsPeras (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

SerialisePraosState proto ⇒ Serialise (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

ChainDepStateSupportsPeras (Ticked (PolyPraosState proto)) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

data Ticked (PolyPraosState proto ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosState proto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosState proto) = D1 ('MetaData "PolyPraosState" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "praosStateLastSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin SlotNo)) :*: S1 ('MetaSel ('Just "praosStateOCertCounters") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'BlockIssuer) Word64))) :*: (S1 ('MetaSel ('Just "praosStateEvolvingNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStateCandidateNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce))) :*: ((S1 ('MetaSel ('Just "praosStateEpochNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStatePreviousEpochNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "praosStateLabNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: (S1 ('MetaSel ('Just "praosStateLastEpochBlockNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "praosStateLeiosAnnouncement") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WhenLeios proto (Either WhyNotCertifiable LeiosAnnouncement))))))))

data PolyPraosValidationErr proto c Source #

Errors which we might encounter

Constructors

VRFKeyUnknown !(KeyHash 'StakePool) 
VRFKeyWrongVRFKey !(KeyHash 'StakePool) !(Hash HASH (VerKeyVRF (VRF c))) !(Hash HASH (VerKeyVRF (VRF c))) 
VRFKeyBadProof !SlotNo !Nonce !(CertifiedVRF (VRF c) InputVRF) 
VRFLeaderValueTooBig Natural Rational ActiveSlotCoeff 
KESBeforeStartOCERT !KESPeriod !KESPeriod 
KESAfterEndOCERT !KESPeriod !KESPeriod !Word64 
CounterTooSmallOCERT !Word64 !Word64 
CounterOverIncrementedOCERT !Word64 !Word64

The KES counter has been incremented by more than 1

InvalidSignatureOCERT !Word64 !KESPeriod !String 
InvalidKesSignatureOCERT !Word !Word !Word !Word64 !String 
NoCounterForKeyHashOCERT !(KeyHash 'BlockIssuer) 
LeiosCertWithoutAnnouncement !(VoidUnlessLeios proto ()) !WhyNotCertifiable !(WithOrigin SlotNo) !SlotNo

The header sets its cert bit, but there is no announcement for the certificate to certify.

LeiosCertTooYoung !(VoidUnlessLeios proto ()) !SlotNo !SlotNo !SlotNo

The header sets its cert bit too soon after its predecessor's announcement: the announcement, voting and diffusion periods have not all elapsed.

LeiosEbTooBig !(VoidUnlessLeios proto ()) !Word32 !Word32

The header announces an endorser block larger than the protocol parameters allow.

Instances

Instances details
(Crypto c, Eq (VoidUnlessLeios proto ())) ⇒ Eq (PolyPraosValidationErr proto c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

(==) ∷ PolyPraosValidationErr proto c → PolyPraosValidationErr proto c → Bool #

(/=) ∷ PolyPraosValidationErr proto c → PolyPraosValidationErr proto c → Bool #

Generic (PolyPraosValidationErr proto c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PolyPraosValidationErr proto c) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosValidationErr proto c) = D1 ('MetaData "PolyPraosValidationErr" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (((C1 ('MetaCons "VRFKeyUnknown" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool))) :+: (C1 ('MetaCons "VRFKeyWrongVRFKey" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))))) :+: C1 ('MetaCons "VRFKeyBadProof" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CertifiedVRF (VRF c) InputVRF)))))) :+: ((C1 ('MetaCons "VRFLeaderValueTooBig" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ActiveSlotCoeff))) :+: C1 ('MetaCons "KESBeforeStartOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod))) :+: (C1 ('MetaCons "KESAfterEndOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :+: C1 ('MetaCons "CounterTooSmallOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))))) :+: ((C1 ('MetaCons "CounterOverIncrementedOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: (C1 ('MetaCons "InvalidSignatureOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String))) :+: C1 ('MetaCons "InvalidKesSignatureOCERT" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String)))))) :+: ((C1 ('MetaCons "NoCounterForKeyHashOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'BlockIssuer))) :+: C1 ('MetaCons "LeiosCertWithoutAnnouncement" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 WhyNotCertifiable)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin SlotNo)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)))) :+: (C1 ('MetaCons "LeiosCertTooYoung" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo))) :+: C1 ('MetaCons "LeiosEbTooBig" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)))))))

Methods

from ∷ PolyPraosValidationErr proto c → Rep (PolyPraosValidationErr proto c) x #

to ∷ Rep (PolyPraosValidationErr proto c) x → PolyPraosValidationErr proto c #

(Crypto c, Show (VoidUnlessLeios proto ())) ⇒ Show (PolyPraosValidationErr proto c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

(Typeable proto, Crypto c, NoThunks (VoidUnlessLeios proto ())) ⇒ NoThunks (PolyPraosValidationErr proto c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosValidationErr proto c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PolyPraosValidationErr proto c) = D1 ('MetaData "PolyPraosValidationErr" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (((C1 ('MetaCons "VRFKeyUnknown" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool))) :+: (C1 ('MetaCons "VRFKeyWrongVRFKey" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))))) :+: C1 ('MetaCons "VRFKeyBadProof" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CertifiedVRF (VRF c) InputVRF)))))) :+: ((C1 ('MetaCons "VRFLeaderValueTooBig" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Rational) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ActiveSlotCoeff))) :+: C1 ('MetaCons "KESBeforeStartOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod))) :+: (C1 ('MetaCons "KESAfterEndOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :+: C1 ('MetaCons "CounterTooSmallOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))))) :+: ((C1 ('MetaCons "CounterOverIncrementedOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: (C1 ('MetaCons "InvalidSignatureOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String))) :+: C1 ('MetaCons "InvalidKesSignatureOCERT" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 String)))))) :+: ((C1 ('MetaCons "NoCounterForKeyHashOCERT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'BlockIssuer))) :+: C1 ('MetaCons "LeiosCertWithoutAnnouncement" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 WhyNotCertifiable)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin SlotNo)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)))) :+: (C1 ('MetaCons "LeiosCertTooYoung" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo))) :+: C1 ('MetaCons "LeiosEbTooBig" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VoidUnlessLeios proto ())) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)))))))

data PraosCannotForge c Source #

Expresses that, whilst we believe ourselves to be a leader for this slot, we are nonetheless unable to forge a block.

Constructors

PraosCannotForgeKeyNotUsableYet

The KES key in our operational certificate can't be used because the current (wall clock) period is before the start period of the key. current KES period.

Note: the opposite case, i.e., the wall clock period being after the end period of the key, is caught when trying to update the key in updateForgeState.

Fields

  • !KESPeriod

    Current KES period according to the wallclock slot, i.e., the KES period in which we want to use the key.

  • !KESPeriod

    Start KES period of the KES key.

Instances

Instances details
Generic (PraosCannotForge c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PraosCannotForge c) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosCannotForge c) = D1 ('MetaData "PraosCannotForge" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosCannotForgeKeyNotUsableYet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod)))
Crypto c ⇒ Show (PraosCannotForge c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosCannotForge c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosCannotForge c) = D1 ('MetaData "PraosCannotForge" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosCannotForgeKeyNotUsableYet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod)))

data PraosFields c toSign Source #

Constructors

PraosFields 

Fields

Instances

Instances details
Generic (PraosFields c toSign) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PraosFields c toSign) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosFields c toSign) = D1 ('MetaData "PraosFields" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosFields" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SignedKES (KES c) toSign)) :*: S1 ('MetaSel ('Just "praosToSign") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 toSign)))

Methods

from ∷ PraosFields c toSign → Rep (PraosFields c toSign) x #

to ∷ Rep (PraosFields c toSign) x → PraosFields c toSign #

(Show toSign, Crypto c) ⇒ Show (PraosFields c toSign) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

showsPrec ∷ Int → PraosFields c toSign → ShowS #

show ∷ PraosFields c toSign → String #

showList ∷ [PraosFields c toSign] → ShowS #

(NoThunks toSign, Crypto c) ⇒ NoThunks (PraosFields c toSign) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosFields c toSign) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosFields c toSign) = D1 ('MetaData "PraosFields" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosFields" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SignedKES (KES c) toSign)) :*: S1 ('MetaSel ('Just "praosToSign") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 toSign)))

newtype PraosIsLeader c Source #

Assembled proof that the issuer has the right to issue a block in the selected slot.

Instances

Instances details
Generic (PraosIsLeader c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PraosIsLeader c) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosIsLeader c) = D1 ('MetaData "PraosIsLeader" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'True) (C1 ('MetaCons "PraosIsLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosIsLeaderVrfRes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) InputVRF))))

Methods

from ∷ PraosIsLeader c → Rep (PraosIsLeader c) x #

to ∷ Rep (PraosIsLeader c) x → PraosIsLeader c #

Crypto c ⇒ NoThunks (PraosIsLeader c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosIsLeader c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosIsLeader c) = D1 ('MetaData "PraosIsLeader" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'True) (C1 ('MetaCons "PraosIsLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosIsLeaderVrfRes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) InputVRF))))

data PraosParams Source #

Praos parameters that are node independent

Constructors

PraosParams 

Fields

Instances

Instances details
Generic PraosParams Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep PraosParams 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep PraosParams = D1 ('MetaData "PraosParams" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "praosSlotsPerKESPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "praosLeaderF") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ActiveSlotCoeff) :*: S1 ('MetaSel ('Just "praosSecurityParam") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecurityParam))) :*: (S1 ('MetaSel ('Just "praosMaxKESEvo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "praosMaxMajorPV") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MaxMajorProtVer) :*: S1 ('MetaSel ('Just "praosRandomnessStabilisationWindow") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))
NoThunks PraosParams Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep PraosParams Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep PraosParams = D1 ('MetaData "PraosParams" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosParams" 'PrefixI 'True) ((S1 ('MetaSel ('Just "praosSlotsPerKESPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "praosLeaderF") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ActiveSlotCoeff) :*: S1 ('MetaSel ('Just "praosSecurityParam") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecurityParam))) :*: (S1 ('MetaSel ('Just "praosMaxKESEvo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: (S1 ('MetaSel ('Just "praosMaxMajorPV") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MaxMajorProtVer) :*: S1 ('MetaSel ('Just "praosRandomnessStabilisationWindow") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))))

data PraosToSign c Source #

Fields arising from praos execution which must be included in the block signature.

Constructors

PraosToSign 

Fields

Instances

Instances details
Generic (PraosToSign c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep (PraosToSign c) 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosToSign c) = D1 ('MetaData "PraosToSign" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosToSign" 'PrefixI 'True) ((S1 ('MetaSel ('Just "praosToSignIssuerVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VKey 'BlockIssuer)) :*: S1 ('MetaSel ('Just "praosToSignVrfVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyVRF (VRF c)))) :*: (S1 ('MetaSel ('Just "praosToSignVrfRes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) InputVRF)) :*: S1 ('MetaSel ('Just "praosToSignOCert") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OCert c)))))

Methods

from ∷ PraosToSign c → Rep (PraosToSign c) x #

to ∷ Rep (PraosToSign c) x → PraosToSign c #

Crypto c ⇒ Show (PraosToSign c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Methods

showsPrec ∷ Int → PraosToSign c → ShowS #

show ∷ PraosToSign c → String #

showList ∷ [PraosToSign c] → ShowS #

Crypto c ⇒ NoThunks (PraosToSign c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosToSign c) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep (PraosToSign c) = D1 ('MetaData "PraosToSign" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "PraosToSign" 'PrefixI 'True) ((S1 ('MetaSel ('Just "praosToSignIssuerVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VKey 'BlockIssuer)) :*: S1 ('MetaSel ('Just "praosToSignVrfVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyVRF (VRF c)))) :*: (S1 ('MetaSel ('Just "praosToSignVrfRes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) InputVRF)) :*: S1 ('MetaSel ('Just "praosToSignOCert") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OCert c)))))

type SerialisePraosState proto = (Typeable proto, Applicative (WhenLeios proto), Traversable (WhenLeios proto)) Source #

What encoding PolyPraosState needs of its protocol.

LeiosOnly decides which fields are written. There is no inner version: the snapshot version covers it, and the HFC's era index precedes it, so the codec is already chosen when it is read.

data family Ticked (st ∷ k) ∷ k Source #

" Ticked " piece of state, either LedgerState or ChainDepState

Ticking refers to the passage of time (the ticking of the clock). When a piece of state is marked as ticked, it means that time-related changes have been applied to the state. There are exactly two methods in the interface that do that: tickChainDepState and applyChainTickLedgerResult.

Also note that a successful forecast forecastFor (ledgerViewForecastAt cfg st) slot must equal protocolLedgerView cfg (applyChainTick cfg slot st). Thus a LedgerView can only be projected from a Ticked state, but cannot itself be ticked.

Some examples of time related changes:

  • Scheduled delegations might have been applied in Byron
  • New leader schedule computed for Shelley
  • Transition from Byron to Shelley activated in the hard fork combinator.
  • Nonces switched out at the start of a new epoch.

Ticked is used mainly in two ways:

  • Ticked (Ext)LedgerState where its kind gets concretized to StateKind -> StateKind
  • Ticked (HeaderState blk) where its kind gets concretized to Type -> Type

Instances

Instances details
Show (Ticked ()) Source # 
Instance details

Defined in Ouroboros.Consensus.Ticked

Methods

showsPrec ∷ Int → Ticked () → ShowS #

show ∷ Ticked () → String #

showList ∷ [Ticked ()] → ShowS #

ChainDepStateSupportsPeras (Ticked (ChainDepState (BlockProtocol blk))) ⇒ ChainDepStateSupportsPeras (Ticked (HeaderState blk)) Source # 
Instance details

Defined in Ouroboros.Consensus.HeaderValidation

ChainDepStateSupportsPeras (Ticked (PolyPraosState proto)) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

ChainDepStateSupportsPeras (Ticked TPraosState) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.TPraos

ChainDepStateSupportsPeras (Ticked ()) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Abstract

Methods

getEpochNonce ∷ Ticked () → Nonce Source #

(NoThunks (TxIn blk), NoThunks (TxOut blk), HasLedgerTables (Ticked LedgerState) blk) ⇒ HasLedgerTables (Ticked ExtLedgerState) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

Methods

projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked ExtLedgerState blk mk → LedgerTables blk mk Source #

withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked ExtLedgerState blk any → LedgerTables blk mk → Ticked ExtLedgerState blk mk Source #

(Bridge m a, HasLedgerTables (Ticked LedgerState) m) ⇒ HasLedgerTables (Ticked LedgerState) (DualBlock m a) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState (DualBlock m a) mk → LedgerTables (DualBlock m a) mk Source #

withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState (DualBlock m a) any → LedgerTables (DualBlock m a) mk → Ticked LedgerState (DualBlock m a) mk Source #

Bridge m a ⇒ GetTip (Ticked LedgerState (DualBlock m a)) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Methods

getTip ∷ ∀ (mk ∷ MapKind). Ticked LedgerState (DualBlock m a) mk → Point (Ticked LedgerState (DualBlock m a)) Source #

IsLedger LedgerState blk ⇒ GetTip (Ticked ExtLedgerState blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

Methods

getTip ∷ ∀ (mk ∷ MapKind). Ticked ExtLedgerState blk mk → Point (Ticked ExtLedgerState blk) Source #

LedgerStateSupportsPeras (Ticked LedgerState (DualBlock m a)) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

NoThunks (Ticked LedgerState (DualBlock m a) mk) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

Show (Ticked (f a)) ⇒ Show (((Ticked ∷ Type → Type) :.: f) a) Source # 
Instance details

Defined in Ouroboros.Consensus.Ticked

Methods

showsPrec ∷ Int → ((Ticked ∷ Type → Type) :.: f) a → ShowS #

show ∷ ((Ticked ∷ Type → Type) :.: f) a → String #

showList ∷ [((Ticked ∷ Type → Type) :.: f) a] → ShowS #

NoThunks (Ticked (f a)) ⇒ NoThunks (((Ticked ∷ Type → Type) :.: f) a) Source # 
Instance details

Defined in Ouroboros.Consensus.Ticked

Methods

noThunks ∷ Context → ((Ticked ∷ Type → Type) :.: f) a → IO (Maybe ThunkInfo) Source #

wNoThunks ∷ Context → ((Ticked ∷ Type → Type) :.: f) a → IO (Maybe ThunkInfo) Source #

showTypeOf ∷ Proxy (((Ticked ∷ Type → Type) :.: f) a) → String Source #

data Ticked TPraosState Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.TPraos

data Ticked () Source # 
Instance details

Defined in Ouroboros.Consensus.Ticked

data Ticked (HardForkChainDepState xs ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Protocol

data Ticked (HeaderState blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.HeaderValidation

data Ticked (PBftState c ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PBFT

newtype Ticked (WrapChainDepState blk ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.TypeFamilyWrappers

data Ticked (PolyPraosState proto ∷ Type) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type HeaderHash (Ticked l blk ∷ k2) Source # 
Instance details

Defined in Ouroboros.Consensus.Ticked

type HeaderHash (Ticked l blk ∷ k2) = HeaderHash (l blk)
data Ticked ExtLedgerState (blk ∷ Type) (mk ∷ MapKind) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

data Ticked LedgerState (HardForkBlock xs ∷ Type) (mk ∷ MapKind) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

data Ticked LedgerState (DualBlock m a ∷ Type) (mk ∷ MapKind) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

forgePraosFields ∷ (Crypto c, Signable (KES c) toSign, Monad m) ⇒ HotKey c m → PraosCanBeLeader c → PraosIsLeader c → (PraosToSign c → toSign) → m (PraosFields c toSign) Source #

leiosContextFreeHeaderChecks ∷ (Applicative (WhenLeios proto), Foldable (WhenLeios proto), TypeSwitch (LeiosOnly proto)) ⇒ PolyPraosLedgerView proto → PolyPraosValidateView proto c → Except (PolyPraosValidationErr proto c) () Source #

The Leios header checks that read only the header and the ledger view.

Sound out of context: the bound they check is forecast for the header's own slot, so any path that validates the header reads the same value.

They run only for protocols with Leios, which are the ones that fill typeSwitchR.

markUncertifiable ∷ WhyNotCertifiable → Either WhyNotCertifiable LeiosAnnouncement → Either WhyNotCertifiable LeiosAnnouncement Source #

What the next header may certify after crossing a boundary that rules out certifying the pending announcement, for this reason.

reupdateChainDepStatePolyPraos ∷ Functor (WhenLeios proto) ⇒ PraosParams → EpochInfo (Except PastHorizonException) → PolyPraosValidateView proto c → SlotNo → Ticked (PolyPraosState proto) → PolyPraosState proto Source #

reupdateChainDepState for every Praos.

Re-update the chain dependent state as a result of processing a header.

This consists of: - Update the last applied block hash. - Update the evolving and (potentially) candidate nonces based on the position in the epoch. - Update the operational certificate counter. - Record the header's announcement, if any, replacing the previous one.

updateChainDepStatePolyPraos ∷ (PolyPraosCrypto proto c, Applicative (WhenLeios proto), Foldable (WhenLeios proto), TypeSwitch (LeiosOnly proto)) ⇒ PraosParams → EpochInfo (Except PastHorizonException) → PolyPraosValidateView proto c → SlotNo → Ticked (PolyPraosState proto) → Except (PolyPraosValidationErr proto c) (PolyPraosState proto) Source #

updateChainDepState for every Praos.

Validate and update the chain dependent state as a result of processing a new header.

This consists of: - Validate the VRF checks - Validate the KES checks - Call reupdateChainDepState

tickChainDepStatePolyPraos ∷ Functor (WhenLeios proto) ⇒ EpochInfo (Except PastHorizonException) → PolyPraosLedgerView proto → SlotNo → PolyPraosState proto → Ticked (PolyPraosState proto) Source #

tickChainDepState for every Praos.

Updating the chain dependent state for Praos.

If we are not in a new epoch, then nothing happens. If we are in a new epoch, we do four things: - Store the existing current epoch nonce as the "previous epoch" nonce. This is needed to validate Peras certificates when they appear in blocks. - Update the epoch nonce to the combination of the candidate nonce and the nonce derived from the last block of the previous epoch. - Update the "last block of previous epoch" nonce to the nonce derived from the last applied block. - Mark the pending announcement as no longer certifiable, since an endorser block may not be certified across an epoch boundary.

For testing purposes

doValidateKESSignature' ∷ PolyPraosCrypto proto c ⇒ WhetherToUpperBoundOCERT → Word64 → Word64 → Map (KeyHash 'StakePool) IndividualPoolStake → Map (KeyHash 'BlockIssuer) Word64 → PolyPraosValidateView proto c → Except (PolyPraosValidationErr proto c) () Source #

doValidateKESSignature, parameterized by whether to enforce the OCERT counter's upper bound (see WhetherToUpperBoundOCERT).

getLeiosAnnouncementPolyPraos ∷ Foldable (WhenLeios proto) ⇒ PolyPraosValidateView proto c → Maybe LeiosAnnouncement Source #

getLeiosAnnouncement for every Praos.

getLeiosLedgerViewPolyPraos ∷ Foldable (WhenLeios proto) ⇒ PolyPraosLedgerView proto → Maybe LeiosLedgerView Source #

getLeiosLedgerView for every Praos.

validateLeiosAnnouncementPolyPraos ∷ (PolyPraosCrypto proto c, Applicative (WhenLeios proto), Foldable (WhenLeios proto), TypeSwitch (LeiosOnly proto)) ⇒ PraosParams → PolyPraosValidateView proto c → Ticked (PolyPraosState proto) → Except (PolyPraosValidationErr proto c) OCINStaleness Source #

validateLeiosAnnouncement for every Praos.

The election proof (VRF) and the signature (KES and operational certificate) are checked in full. The operational certificate counter is not upper bounded, since a counter ahead of our immutable tip's record is honest lag. A counter below that record, or no record at all, yields StaleOCIN rather than a rejection, since that lag can explain either too. The certification gap check is skipped: it needs the header's predecessor, and an announcement is checked without one.

data WhetherToUpperBoundOCERT Source #

Whether doValidateKESSignature' enforces the OCERT counter's upper bound, i.e. rejects (with CounterOverIncrementedOCERT) a counter more than one greater than the one we have recorded for this issuer.

Normal header validation enforces it (UpperBoundOCERT). Validating a relayed Leios announcement out-of-context against a (possibly lagging) immutable tip legitimately sees counters that have run ahead of our recorded view, so that path skips it (DoNotUpperBoundOCERT). The counter's lower bound (CounterTooSmallOCERT, a revoked key) is enforced either way.

data WhyNotCertifiable Source #

Why the next header may certify no announcement.

Constructors

NothingAnnounced

The most recently applied header carried none.

AnnouncedInPreviousEra

It was announced in the previous era, and an endorser block may not be certified across an era boundary.

AnnouncedInPreviousEpoch

It was announced in the previous epoch, and an endorser block may not be certified across an epoch boundary.

(This restriction avoids some engineering complexity that wouldn't be worthwhile, since this restriction only loses one EB opportunity per epoch.)

Instances

Instances details
Semigroup WhyNotCertifiable Source #

Keeps the more specific reason: NothingAnnounced, then AnnouncedInPreviousEra, then AnnouncedInPreviousEpoch.

An era boundary is also an epoch boundary, and either may be crossed first, so neither may trample the other's more specific reason.

Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Eq WhyNotCertifiable Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Generic WhyNotCertifiable Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

Associated Types

type Rep WhyNotCertifiable 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep WhyNotCertifiable = D1 ('MetaData "WhyNotCertifiable" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "NothingAnnounced" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "AnnouncedInPreviousEra" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "AnnouncedInPreviousEpoch" 'PrefixI 'False) (U1 ∷ Type → Type)))
Show WhyNotCertifiable Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

NoThunks WhyNotCertifiable Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep WhyNotCertifiable Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.PolyPraos

type Rep WhyNotCertifiable = D1 ('MetaData "WhyNotCertifiable" "Ouroboros.Consensus.Protocol.PolyPraos" "ouroboros-consensus-5.0.0.0-inplace-protocol" 'False) (C1 ('MetaCons "NothingAnnounced" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "AnnouncedInPreviousEra" 'PrefixI 'False) (U1 ∷ Type → Type) :+: C1 ('MetaCons "AnnouncedInPreviousEpoch" 'PrefixI 'False) (U1 ∷ Type → Type)))