ouroboros-consensus-shelley-0.4.0.0: Shelley ledger integration in the Ouroboros consensus layer
Safe HaskellNone
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 → Ticked (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) 

Instances

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Praos

Methods

configSlotsPerKESPeriodConsensusConfig (Praos c) → Word64 Source #

verifyHeaderIntegrityWord64ShelleyProtocolHeader (Praos c) → Bool Source #

mkHeader ∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto (Praos c)) ⇒ HotKey crypto m → CanBeLeader (Praos c) → IsLeader (Praos c) → SlotNoBlockNo → PrevHash crypto → Hash crypto EraIndependentBlockBody → IntProtVer → m (ShelleyProtocolHeader (Praos c)) Source #

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

Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos

Methods

configSlotsPerKESPeriodConsensusConfig (TPraos c) → Word64 Source #

verifyHeaderIntegrityWord64ShelleyProtocolHeader (TPraos c) → Bool Source #

mkHeader ∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto (TPraos c)) ⇒ HotKey crypto m → CanBeLeader (TPraos c) → IsLeader (TPraos c) → SlotNoBlockNo → PrevHash crypto → Hash crypto EraIndependentBlockBody → IntProtVer → m (ShelleyProtocolHeader (TPraos c)) Source #

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.

Methods

mkHeaderViewShelleyProtocolHeader proto → BHeaderView (ProtoCrypto proto) Source #

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 #

Constructors

ShelleyHash 

Fields

Instances

Instances details
Eq (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

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

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

Ord (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

compareShelleyHash crypto → ShelleyHash crypto → Ordering Source #

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

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

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

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

maxShelleyHash crypto → ShelleyHash crypto → ShelleyHash crypto Source #

minShelleyHash crypto → ShelleyHash crypto → ShelleyHash crypto Source #

Show (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

showsPrecIntShelleyHash crypto → ShowS Source #

showShelleyHash crypto → String Source #

showList ∷ [ShelleyHash crypto] → ShowS Source #

Generic (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Associated Types

type Rep (ShelleyHash crypto) ∷ TypeType Source #

Methods

fromShelleyHash crypto → Rep (ShelleyHash crypto) x Source #

toRep (ShelleyHash crypto) x → ShelleyHash crypto Source #

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

encodeShelleyHash crypto → Encoding #

decode ∷ Decoder s (ShelleyHash crypto) #

encodeList ∷ [ShelleyHash crypto] → Encoding #

decodeList ∷ Decoder s [ShelleyHash crypto] #

Condense (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

condenseShelleyHash crypto → String Source #

NoThunks (ShelleyHash crypto) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

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

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

showTypeOfProxy (ShelleyHash crypto) → String #

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

toCBORShelleyHash crypto → Encoding

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

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

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract

Methods

fromCBOR ∷ Decoder s (ShelleyHash crypto)

labelProxy (ShelleyHash crypto) → Text

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-shelley-0.4.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.

Instances

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

Defined in Ouroboros.Consensus.Shelley.Protocol.Praos

type ShelleyProtocolHeader (TPraos c) Source # 
Instance details

Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos

type ShelleyProtocolHeader (TPraos c) = BHeader c