ouroboros-consensus-protocol-0.1.0.0: Cardano consensus protocols.
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Protocol.Praos.Header

Description

Block header associated with Praos.

The choice of whether to associate the header with the ledger era or the protocol is a little artitrary. Functionally the header contains things which are associated with both ledger and protocol, and which are used by both.

We choose to associate the header with the protocol, since it more strongly binds in that direction, and to assist with the mental picture that the protocol is concerned with the block header, while the ledger is concerned with the block body. However, in order to more cleanly illustrate which parts of the header are _strictly_ protocol concerns, we also provide a view of the header (in Views) which extracts just the fields needed for the Praos protocol. This also allows us to hide the more detailed construction of the header.

Synopsis

Documentation

data Header crypto where Source #

Full header type, carrying its own memoised bytes.

Bundled Patterns

pattern Header ∷ Crypto crypto ⇒ HeaderBody crypto → SignedKES crypto (HeaderBody crypto) → Header crypto 

Instances

Instances details
Eq (Header crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

(==)Header crypto → Header crypto → Bool Source #

(/=)Header crypto → Header crypto → Bool Source #

Crypto crypto ⇒ Show (Header crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

showsPrecIntHeader crypto → ShowS Source #

showHeader crypto → String Source #

showList ∷ [Header crypto] → ShowS Source #

Crypto crypto ⇒ NoThunks (Header crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

noThunks ∷ Context → Header crypto → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → Header crypto → IO (Maybe ThunkInfo) #

showTypeOfProxy (Header crypto) → String #

Crypto crypto ⇒ FromCBOR (Annotator (Header crypto)) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

fromCBOR ∷ Decoder s (Annotator (Header crypto))

labelProxy (Annotator (Header crypto)) → Text

Typeable crypto ⇒ ToCBOR (Header crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

toCBORHeader crypto → Encoding

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (Header crypto) → Size

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [Header crypto] → Size

data HeaderBody crypto Source #

The body of the header is the part which gets hashed to form the hash chain.

Constructors

HeaderBody 

Fields

  • hbBlockNo ∷ !BlockNo

    block number

  • hbSlotNo ∷ !SlotNo

    block slot

  • hbPrev ∷ !(PrevHash crypto)

    Hash of the previous block header

  • hbVk ∷ !(VKey 'BlockIssuer crypto)

    verification key of block issuer

  • hbVrfVk ∷ !(VerKeyVRF crypto)

    VRF verification key for block issuer

  • hbVrfRes ∷ !(CertifiedVRF crypto InputVRF)

    Certified VRF value

  • hbBodySize ∷ !Word32

    Size of the block body

  • hbBodyHash ∷ !(Hash crypto EraIndependentBlockBody)

    Hash of block body

  • hbOCert ∷ !(OCert crypto)

    operational certificate

  • hbProtVer ∷ !ProtVer

    protocol version

Instances

Instances details
Crypto crypto ⇒ Eq (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

(==)HeaderBody crypto → HeaderBody crypto → Bool Source #

(/=)HeaderBody crypto → HeaderBody crypto → Bool Source #

Crypto crypto ⇒ Show (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

showsPrecIntHeaderBody crypto → ShowS Source #

showHeaderBody crypto → String Source #

showList ∷ [HeaderBody crypto] → ShowS Source #

Generic (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Associated Types

type Rep (HeaderBody crypto) ∷ TypeType Source #

Methods

fromHeaderBody crypto → Rep (HeaderBody crypto) x Source #

toRep (HeaderBody crypto) x → HeaderBody crypto Source #

Crypto crypto ⇒ NoThunks (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

noThunks ∷ Context → HeaderBody crypto → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → HeaderBody crypto → IO (Maybe ThunkInfo) #

showTypeOfProxy (HeaderBody crypto) → String #

Crypto crypto ⇒ FromCBOR (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

fromCBOR ∷ Decoder s (HeaderBody crypto)

labelProxy (HeaderBody crypto) → Text

Crypto crypto ⇒ ToCBOR (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

Methods

toCBORHeaderBody crypto → Encoding

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (HeaderBody crypto) → Size

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [HeaderBody crypto] → Size

Crypto crypto ⇒ SignableRepresentation (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

type Rep (HeaderBody crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Header

type Rep (HeaderBody crypto) = D1 ('MetaData "HeaderBody" "Ouroboros.Consensus.Protocol.Praos.Header" "ouroboros-consensus-protocol-0.1.0.0-inplace" 'False) (C1 ('MetaCons "HeaderBody" 'PrefixI 'True) (((S1 ('MetaSel ('Just "hbBlockNo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BlockNo) :*: S1 ('MetaSel ('Just "hbSlotNo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)) :*: (S1 ('MetaSel ('Just "hbPrev") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PrevHash crypto)) :*: (S1 ('MetaSel ('Just "hbVk") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VKey 'BlockIssuer crypto)) :*: S1 ('MetaSel ('Just "hbVrfVk") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VerKeyVRF crypto))))) :*: ((S1 ('MetaSel ('Just "hbVrfRes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CertifiedVRF crypto InputVRF)) :*: S1 ('MetaSel ('Just "hbBodySize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :*: (S1 ('MetaSel ('Just "hbBodyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash crypto EraIndependentBlockBody)) :*: (S1 ('MetaSel ('Just "hbOCert") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (OCert crypto)) :*: S1 ('MetaSel ('Just "hbProtVer") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProtVer))))))

headerHash ∷ Crypto crypto ⇒ Header crypto → Hash (HASH crypto) EraIndependentBlockHeader Source #

Hash a header

headerSizeHeader crypto → Int Source #

Compute the size of the header