Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 ∷ Type
- class (Eq (EnvelopeCheckError proto), NoThunks (EnvelopeCheckError proto), Show (EnvelopeCheckError proto)) ⇒ ProtocolHeaderSupportsEnvelope proto where
- type EnvelopeCheckError proto ∷ Type
- pHeaderHash ∷ ShelleyProtocolHeader proto → ShelleyHash (ProtoCrypto proto)
- pHeaderPrevHash ∷ ShelleyProtocolHeader proto → PrevHash (ProtoCrypto proto)
- pHeaderBodyHash ∷ ShelleyProtocolHeader proto → Hash (ProtoCrypto proto) 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 m. (Crypto crypto, Monad m, crypto ~ ProtoCrypto proto) ⇒ HotKey crypto m → CanBeLeader proto → IsLeader proto → SlotNo → BlockNo → PrevHash crypto → Hash crypto EraIndependentBlockBody → Int → ProtVer → m (ShelleyProtocolHeader proto)
- class ProtocolHeaderSupportsLedger proto where
- mkHeaderView ∷ ShelleyProtocolHeader proto → BHeaderView (ProtoCrypto proto)
- class ProtocolHeaderSupportsProtocol proto where
- type CannotForgeError proto ∷ Type
- protocolHeaderView ∷ ShelleyProtocolHeader proto → ValidateView proto
- pHeaderIssuer ∷ ShelleyProtocolHeader proto → VKey 'BlockIssuer (ProtoCrypto proto)
- pHeaderIssueNo ∷ ShelleyProtocolHeader proto → Word64
- pTieBreakVRFValue ∷ ShelleyProtocolHeader proto → OutputVRF (VRF (ProtoCrypto proto))
- newtype ShelleyHash crypto = ShelleyHash {
- unShelleyHash ∷ Hash crypto EraIndependentBlockHeader
- 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 ∷ Type 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.
type EnvelopeCheckError proto ∷ Type Source #
pHeaderHash ∷ ShelleyProtocolHeader proto → ShelleyHash (ProtoCrypto proto) Source #
pHeaderPrevHash ∷ ShelleyProtocolHeader proto → PrevHash (ProtoCrypto proto) Source #
pHeaderBodyHash ∷ ShelleyProtocolHeader proto → Hash (ProtoCrypto proto) 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).
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 #
∷ Word64 | Slots per KES period |
→ ShelleyProtocolHeader proto | |
→ Bool |
Verify that the signature on a header is correct and valid.
∷ ∀ 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
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.
mkHeaderView ∷ ShelleyProtocolHeader proto → BHeaderView (ProtoCrypto proto) Source #
Instances
PraosCrypto c ⇒ ProtocolHeaderSupportsLedger (Praos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.Praos mkHeaderView ∷ ShelleyProtocolHeader (Praos c) → BHeaderView (ProtoCrypto (Praos c)) Source # | |
PraosCrypto c ⇒ ProtocolHeaderSupportsLedger (TPraos c) Source # | |
Defined in Ouroboros.Consensus.Shelley.Protocol.TPraos mkHeaderView ∷ ShelleyProtocolHeader (TPraos c) → BHeaderView (ProtoCrypto (TPraos c)) Source # |
class ProtocolHeaderSupportsProtocol proto where Source #
ProtocolHeaderSupportsProtocol` provides support for the concrete
block header to support the ConsensusProtocol
itself.
type CannotForgeError proto ∷ Type Source #
protocolHeaderView ∷ ShelleyProtocolHeader proto → ValidateView proto Source #
pHeaderIssuer ∷ ShelleyProtocolHeader proto → VKey 'BlockIssuer (ProtoCrypto proto) 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
newtype ShelleyHash crypto Source #
Instances
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 |