ouroboros-consensus-cardano-0.16.0.0: The instantation of the Ouroboros consensus layer used by Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Consensus.Shelley.Protocol.Abstract

Description

Commonality between multiple protocols.

Everything in this module is indexed on the protocol (or the crypto), rather than on the block type. This allows it to be imported in Ouroboros.Consensus.Shelley.Ledger.Block.

Synopsis

Documentation

type family ProtoCrypto proto ∷ Type Source #

Instances

Instances details
type ProtoCrypto (Praos c) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Praos

type ProtoCrypto (Praos c) = c
type ProtoCrypto (TPraos c) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos

type ProtoCrypto (TPraos c) = c

class (Eq (EnvelopeCheckError proto), NoThunks (EnvelopeCheckError proto), Show (EnvelopeCheckError proto)) ⇒ ProtocolHeaderSupportsEnvelope proto where Source #

Indicates that the header (determined by the protocol) supports " Envelope " functionality. Envelope functionality refers to the minimal functionality required to construct a chain.

Associated Types

type EnvelopeCheckError proto ∷ Type Source #

Methods

pHeaderHashShelleyProtocolHeader proto → ShelleyHash (ProtoCrypto proto) Source #

pHeaderPrevHashShelleyProtocolHeader proto → PrevHash (ProtoCrypto proto) Source #

pHeaderBodyHashShelleyProtocolHeader proto → Hash (ProtoCrypto proto) EraIndependentBlockBody Source #

pHeaderSlotShelleyProtocolHeader proto → SlotNo Source #

pHeaderBlockShelleyProtocolHeader proto → BlockNo Source #

pHeaderSizeShelleyProtocolHeader proto → Natural Source #

pHeaderBlockSizeShelleyProtocolHeader proto → Natural Source #

envelopeChecksConsensusConfig proto → LedgerView proto → ShelleyProtocolHeader proto → Except (EnvelopeCheckError proto) () Source #

Carry out any protocol-specific envelope checks. For example, this might check things like maximum header size.

Instances

Instances details
PraosCrypto c ⇒ ProtocolHeaderSupportsEnvelope (Praos c) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Praos

Associated Types

type EnvelopeCheckError (Praos c) Source #

PraosCrypto c ⇒ ProtocolHeaderSupportsEnvelope (TPraos c) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos

Associated Types

type EnvelopeCheckError (TPraos c) Source #

class ProtocolHeaderSupportsKES proto where Source #

ProtocolHeaderSupportsKES describes functionality common to protocols using key evolving signature schemes. This includes verifying the header integrity (e.g. validating the KES signature), as well as constructing the header (made specific to KES-using protocols through the need to handle the hot key).

Methods

configSlotsPerKESPeriodConsensusConfig proto → Word64 Source #

Extract the "slots per KES period" value from the protocol config.

Note that we do not require ConsensusConfig in verifyHeaderIntegrity since that function is also invoked with StorageConfig.

verifyHeaderIntegrity Source #

Arguments

Word64

Slots per KES period

ShelleyProtocolHeader proto 
Bool 

Verify that the signature on a header is correct and valid.

mkHeader Source #

Arguments

∷ ∀ crypto m. (Crypto crypto, Monad m, crypto ~ ProtoCrypto proto) 
HotKey crypto m 
CanBeLeader proto 
IsLeader proto 
SlotNo

Slot no

BlockNo

Block no

PrevHash crypto

Hash of the previous block

Hash crypto EraIndependentBlockBody

Hash of the block body to include in the header

Int

Size of the block body

ProtVer

Protocol version

→ m (ShelleyProtocolHeader proto) 

class ProtocolHeaderSupportsLedger proto where Source #

Indicates that the protocol header supports the Shelley ledger. We may need to generalise this if, in the future, the ledger requires different things from the protocol.

class ProtocolHeaderSupportsProtocol proto where Source #

ProtocolHeaderSupportsProtocol` provides support for the concrete block header to support the ConsensusProtocol itself.

Associated Types

type CannotForgeError proto ∷ Type Source #

Methods

protocolHeaderViewShelleyProtocolHeader proto → ValidateView proto Source #

pHeaderIssuerShelleyProtocolHeader proto → VKey 'BlockIssuer (ProtoCrypto proto) Source #

pHeaderIssueNoShelleyProtocolHeader proto → Word64 Source #

pTieBreakVRFValueShelleyProtocolHeader proto → OutputVRF (VRF (ProtoCrypto proto)) Source #

A VRF value in the header, used to choose between otherwise equally preferable chains.

newtype ShelleyHash crypto Source #

Instances

Instances details
Generic (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Associated Types

type Rep (ShelleyHash crypto) ∷ TypeType #

Methods

fromShelleyHash crypto → Rep (ShelleyHash crypto) x #

toRep (ShelleyHash crypto) x → ShelleyHash crypto #

Show (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

showsPrecIntShelleyHash crypto → ShowS #

showShelleyHash crypto → String #

showList ∷ [ShelleyHash crypto] → ShowS #

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

fromCBORDecoder s (ShelleyHash crypto) Source #

labelProxy (ShelleyHash crypto) → Text Source #

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

toCBORShelleyHash crypto → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (ShelleyHash crypto) → Size Source #

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

Eq (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

(==)ShelleyHash crypto → ShelleyHash crypto → Bool #

(/=)ShelleyHash crypto → ShelleyHash crypto → Bool #

Ord (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

compareShelleyHash crypto → ShelleyHash crypto → Ordering #

(<)ShelleyHash crypto → ShelleyHash crypto → Bool #

(<=)ShelleyHash crypto → ShelleyHash crypto → Bool #

(>)ShelleyHash crypto → ShelleyHash crypto → Bool #

(>=)ShelleyHash crypto → ShelleyHash crypto → Bool #

maxShelleyHash crypto → ShelleyHash crypto → ShelleyHash crypto #

minShelleyHash crypto → ShelleyHash crypto → ShelleyHash crypto #

NoThunks (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Condense (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

condenseShelleyHash crypto → String Source #

Crypto crypto ⇒ Serialise (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

type Rep (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

type Rep (ShelleyHash crypto) = D1 ('MetaData "ShelleyHash" "Ouroboros.Consensus.Shelley.Protocol.Abstract" "ouroboros-consensus-cardano-0.16.0.0-inplace" 'True) (C1 ('MetaCons "ShelleyHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "unShelleyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash crypto EraIndependentBlockHeader))))

type family ShelleyProtocolHeader proto = (sh ∷ Type) | sh → proto Source #

Shelley header, determined by the associated protocol.