Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- type family ProtoCrypto proto
- class (Eq (EnvelopeCheckError proto), NoThunks (EnvelopeCheckError proto), Show (EnvelopeCheckError proto)) ⇒ ProtocolHeaderSupportsEnvelope proto where
- type EnvelopeCheckError proto
- pHeaderHash ∷ ShelleyProtocolHeader proto → ShelleyHash
- pHeaderPrevHash ∷ ShelleyProtocolHeader proto → PrevHash
- pHeaderBodyHash ∷ ShelleyProtocolHeader proto → Hash HASH EraIndependentBlockBody
- pHeaderSlot ∷ ShelleyProtocolHeader proto → SlotNo
- pHeaderBlock ∷ ShelleyProtocolHeader proto → BlockNo
- pHeaderSize ∷ ShelleyProtocolHeader proto → Natural
- pHeaderBlockSize ∷ ShelleyProtocolHeader proto → Natural
- envelopeChecks ∷ ConsensusConfig proto → LedgerView proto → ShelleyProtocolHeader proto → Except (EnvelopeCheckError proto) ()
- class ProtocolHeaderSupportsKES proto where
- configSlotsPerKESPeriod ∷ ConsensusConfig proto → Word64
- verifyHeaderIntegrity ∷ Word64 → ShelleyProtocolHeader proto → Bool
- mkHeader ∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto proto) ⇒ HotKey crypto m → CanBeLeader proto → IsLeader proto → SlotNo → BlockNo → PrevHash → Hash HASH EraIndependentBlockBody → Int → ProtVer → m (ShelleyProtocolHeader proto)
- class ProtocolHeaderSupportsLedger proto where
- mkHeaderView ∷ ShelleyProtocolHeader proto → BHeaderView
- class ProtocolHeaderSupportsProtocol proto where
- type CannotForgeError proto
- protocolHeaderView ∷ ShelleyProtocolHeader proto → ValidateView proto
- pHeaderIssuer ∷ ShelleyProtocolHeader proto → VKey 'BlockIssuer
- pHeaderIssueNo ∷ ShelleyProtocolHeader proto → Word64
- pTieBreakVRFValue ∷ ShelleyProtocolHeader proto → OutputVRF (VRF (ProtoCrypto proto))
- newtype ShelleyHash = ShelleyHash {}
- class (ConsensusProtocol proto, Typeable (ShelleyProtocolHeader proto), ProtocolHeaderSupportsEnvelope proto, ProtocolHeaderSupportsKES proto, ProtocolHeaderSupportsProtocol proto, ProtocolHeaderSupportsLedger proto, Serialise (ChainDepState proto), SignedHeader (ShelleyProtocolHeader proto)) ⇒ ShelleyProtocol proto
- type family ShelleyProtocolHeader proto = (sh ∷ Type) | sh → proto
Documentation
type family ProtoCrypto proto Source #
Instances
type ProtoCrypto (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos | |
type ProtoCrypto (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos |
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 Source #
Methods
pHeaderHash ∷ ShelleyProtocolHeader proto → ShelleyHash Source #
pHeaderPrevHash ∷ ShelleyProtocolHeader proto → PrevHash Source #
pHeaderBodyHash ∷ ShelleyProtocolHeader proto → Hash HASH EraIndependentBlockBody Source #
pHeaderSlot ∷ ShelleyProtocolHeader proto → SlotNo Source #
pHeaderBlock ∷ ShelleyProtocolHeader proto → BlockNo Source #
pHeaderSize ∷ ShelleyProtocolHeader proto → Natural Source #
pHeaderBlockSize ∷ ShelleyProtocolHeader proto → Natural Source #
envelopeChecks ∷ ConsensusConfig 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
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
configSlotsPerKESPeriod ∷ ConsensusConfig 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.
Arguments
∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto proto) | |
⇒ HotKey crypto m | |
→ CanBeLeader proto | |
→ IsLeader proto | |
→ SlotNo | Slot no |
→ BlockNo | Block no |
→ PrevHash | Hash of the previous block |
→ Hash HASH EraIndependentBlockBody | Hash of the block body to include in the header |
→ Int | Size of the block body |
→ ProtVer | Protocol version |
→ m (ShelleyProtocolHeader proto) |
Instances
PraosCrypto c ⇒ ProtocolHeaderSupportsKES (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos Methods configSlotsPerKESPeriod ∷ ConsensusConfig (Praos c) → Word64 Source # verifyHeaderIntegrity ∷ Word64 → ShelleyProtocolHeader (Praos c) → Bool Source # mkHeader ∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto (Praos c)) ⇒ HotKey crypto m → CanBeLeader (Praos c) → IsLeader (Praos c) → SlotNo → BlockNo → PrevHash → Hash HASH EraIndependentBlockBody → Int → ProtVer → m (ShelleyProtocolHeader (Praos c)) Source # | |
PraosCrypto c ⇒ ProtocolHeaderSupportsKES (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos Methods configSlotsPerKESPeriod ∷ ConsensusConfig (TPraos c) → Word64 Source # verifyHeaderIntegrity ∷ Word64 → ShelleyProtocolHeader (TPraos c) → Bool Source # mkHeader ∷ (Crypto crypto, Monad m, crypto ~ ProtoCrypto (TPraos c)) ⇒ HotKey crypto m → CanBeLeader (TPraos c) → IsLeader (TPraos c) → SlotNo → BlockNo → PrevHash → Hash HASH EraIndependentBlockBody → Int → ProtVer → 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
mkHeaderView ∷ ShelleyProtocolHeader proto → BHeaderView Source #
Instances
PraosCrypto c ⇒ ProtocolHeaderSupportsLedger (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos Methods mkHeaderView ∷ ShelleyProtocolHeader (Praos c) → BHeaderView Source # | |
PraosCrypto c ⇒ ProtocolHeaderSupportsLedger (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos Methods mkHeaderView ∷ ShelleyProtocolHeader (TPraos c) → BHeaderView Source # |
class ProtocolHeaderSupportsProtocol proto where Source #
ProtocolHeaderSupportsProtocol` provides support for the concrete
block header to support the ConsensusProtocol
itself.
Associated Types
type CannotForgeError proto Source #
Methods
protocolHeaderView ∷ ShelleyProtocolHeader proto → ValidateView proto Source #
pHeaderIssuer ∷ ShelleyProtocolHeader proto → VKey 'BlockIssuer Source #
pHeaderIssueNo ∷ ShelleyProtocolHeader proto → Word64 Source #
pTieBreakVRFValue ∷ ShelleyProtocolHeader proto → OutputVRF (VRF (ProtoCrypto proto)) Source #
A VRF value in the header, used to choose between otherwise equally preferable chains.
Instances
PraosCrypto c ⇒ ProtocolHeaderSupportsProtocol (Praos c) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos Associated Types
Methods protocolHeaderView ∷ ShelleyProtocolHeader (Praos c) → ValidateView (Praos c) Source # pHeaderIssuer ∷ ShelleyProtocolHeader (Praos c) → VKey 'BlockIssuer Source # pHeaderIssueNo ∷ ShelleyProtocolHeader (Praos c) → Word64 Source # pTieBreakVRFValue ∷ ShelleyProtocolHeader (Praos c) → OutputVRF (VRF (ProtoCrypto (Praos c))) Source # | |||||
PraosCrypto c ⇒ ProtocolHeaderSupportsProtocol (TPraos c) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos Associated Types
Methods protocolHeaderView ∷ ShelleyProtocolHeader (TPraos c) → ValidateView (TPraos c) Source # pHeaderIssuer ∷ ShelleyProtocolHeader (TPraos c) → VKey 'BlockIssuer Source # pHeaderIssueNo ∷ ShelleyProtocolHeader (TPraos c) → Word64 Source # pTieBreakVRFValue ∷ ShelleyProtocolHeader (TPraos c) → OutputVRF (VRF (ProtoCrypto (TPraos c))) Source # |
newtype ShelleyHash Source #
Constructors
ShelleyHash | |
Instances
FromCBOR ShelleyHash Source # | |||||
ToCBOR ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Methods toCBOR ∷ ShelleyHash → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy ShelleyHash → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ShelleyHash] → Size Source # | |||||
Generic ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Associated Types
| |||||
Show ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Methods showsPrec ∷ Int → ShelleyHash → ShowS # show ∷ ShelleyHash → String # showList ∷ [ShelleyHash] → ShowS # | |||||
Eq ShelleyHash Source # | |||||
Ord ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Methods compare ∷ ShelleyHash → ShelleyHash → Ordering # (<) ∷ ShelleyHash → ShelleyHash → Bool # (<=) ∷ ShelleyHash → ShelleyHash → Bool # (>) ∷ ShelleyHash → ShelleyHash → Bool # (>=) ∷ ShelleyHash → ShelleyHash → Bool # max ∷ ShelleyHash → ShelleyHash → ShelleyHash # min ∷ ShelleyHash → ShelleyHash → ShelleyHash # | |||||
NoThunks ShelleyHash Source # | |||||
Condense ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Methods condense ∷ ShelleyHash → String Source # | |||||
Serialise ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract Methods encode ∷ ShelleyHash → Encoding Source # decode ∷ Decoder s ShelleyHash Source # encodeList ∷ [ShelleyHash] → Encoding Source # decodeList ∷ Decoder s [ShelleyHash] Source # | |||||
type Rep ShelleyHash Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Protocol.Abstract type Rep ShelleyHash = D1 ('MetaData "ShelleyHash" "Ouroboros.Consensus.Shelley.Protocol.Abstract" "ouroboros-consensus-cardano-0.25.0.0-inplace" 'True) (C1 ('MetaCons "ShelleyHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "unShelleyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash HASH EraIndependentBlockHeader)))) |
class (ConsensusProtocol proto, Typeable (ShelleyProtocolHeader proto), ProtocolHeaderSupportsEnvelope proto, ProtocolHeaderSupportsKES proto, ProtocolHeaderSupportsProtocol proto, ProtocolHeaderSupportsLedger proto, Serialise (ChainDepState proto), SignedHeader (ShelleyProtocolHeader proto)) ⇒ ShelleyProtocol proto Source #
Instances
PraosCrypto c ⇒ ShelleyProtocol (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos | |
PraosCrypto c ⇒ ShelleyProtocol (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos |
type family ShelleyProtocolHeader proto = (sh ∷ Type) | sh → proto Source #
Shelley header, determined by the associated protocol.
Instances
type ShelleyProtocolHeader (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos | |
type ShelleyProtocolHeader (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos |