Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data family ConsensusConfig p
- data Praos c
- data PraosCannotForge c = PraosCannotForgeKeyNotUsableYet !KESPeriod !KESPeriod
- class (Crypto c, Signable (DSIGN c) (OCertSignable c), Signable (DSIGN c) (Hash c EraIndependentTxBody), Signable (KES c) (HeaderBody c), Signable (VRF c) InputVRF) ⇒ PraosCrypto c
- data PraosFields c toSign = PraosFields {
- praosSignature ∷ SignedKES c toSign
- praosToSign ∷ toSign
- newtype PraosIsLeader c = PraosIsLeader {}
- data PraosParams = PraosParams {}
- data PraosState c = PraosState {}
- data PraosToSign c = PraosToSign {}
- data PraosValidationErr c
- = VRFKeyUnknown !(KeyHash StakePool c)
- | VRFKeyWrongVRFKey !(KeyHash StakePool c) !(Hash c (VerKeyVRF c)) !(Hash c (VerKeyVRF c))
- | VRFKeyBadProof !SlotNo !Nonce !(CertifiedVRF (VRF c) InputVRF)
- | VRFLeaderValueTooBig Natural Rational ActiveSlotCoeff
- | KESBeforeStartOCERT !KESPeriod !KESPeriod
- | KESAfterEndOCERT !KESPeriod !KESPeriod !Word64
- | CounterTooSmallOCERT !Word64 !Word64
- | CounterOverIncrementedOCERT !Word64 !Word64
- | InvalidSignatureOCERT !Word64 !KESPeriod !String
- | InvalidKesSignatureOCERT !Word !Word !Word !Word64 !String
- | NoCounterForKeyHashOCERT !(KeyHash 'BlockIssuer c)
- data family Ticked st
- forgePraosFields ∷ (PraosCrypto c, KESignable c toSign, Monad m) ⇒ HotKey c m → CanBeLeader (Praos c) → IsLeader (Praos c) → (PraosToSign c → toSign) → m (PraosFields c toSign)
- praosCheckCanForge ∷ ConsensusConfig (Praos c) → SlotNo → KESInfo → Either (PraosCannotForge c) ()
- doValidateKESSignature ∷ PraosCrypto c ⇒ Word64 → Word64 → Map (KeyHash StakePool c) (IndividualPoolStake c) → Map (KeyHash BlockIssuer c) Word64 → HeaderView c → Except (PraosValidationErr c) ()
- doValidateVRFSignature ∷ ∀ c. PraosCrypto c ⇒ Nonce → Map (KeyHash StakePool c) (IndividualPoolStake c) → ActiveSlotCoeff → HeaderView c → Except (PraosValidationErr c) ()
Documentation
data family ConsensusConfig p Source #
Static configuration required to run the consensus protocol
Every method in the ConsensusProtocol
class takes the consensus
configuration as a parameter, so having this as a data family rather than a
type family resolves most ambiguity.
Defined out of the class so that protocols can define this type without having to define the entire protocol at the same time (or indeed in the same module).
Instances
Instances
data PraosCannotForge c Source #
Expresses that, whilst we believe ourselves to be a leader for this slot, we are nonetheless unable to forge a block.
PraosCannotForgeKeyNotUsableYet | The KES key in our operational certificate can't be used because the current (wall clock) period is before the start period of the key. current KES period. Note: the opposite case, i.e., the wall clock period being after the
end period of the key, is caught when trying to update the key in
|
Instances
Generic (PraosCannotForge c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos type Rep (PraosCannotForge c) ∷ Type → Type # from ∷ PraosCannotForge c → Rep (PraosCannotForge c) x # to ∷ Rep (PraosCannotForge c) x → PraosCannotForge c # | |
PraosCrypto c ⇒ Show (PraosCannotForge c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos showsPrec ∷ Int → PraosCannotForge c → ShowS # show ∷ PraosCannotForge c → String # showList ∷ [PraosCannotForge c] → ShowS # | |
type Rep (PraosCannotForge c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos type Rep (PraosCannotForge c) = D1 ('MetaData "PraosCannotForge" "Ouroboros.Consensus.Protocol.Praos" "ouroboros-consensus-protocol-0.9.0.2-inplace" 'False) (C1 ('MetaCons "PraosCannotForgeKeyNotUsableYet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod))) |
class (Crypto c, Signable (DSIGN c) (OCertSignable c), Signable (DSIGN c) (Hash c EraIndependentTxBody), Signable (KES c) (HeaderBody c), Signable (VRF c) InputVRF) ⇒ PraosCrypto c Source #
Instances
data PraosFields c toSign Source #
PraosFields | |
|
Instances
newtype PraosIsLeader c Source #
Assembled proof that the issuer has the right to issue a block in the selected slot.
Instances
Generic (PraosIsLeader c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos type Rep (PraosIsLeader c) ∷ Type → Type # from ∷ PraosIsLeader c → Rep (PraosIsLeader c) x # to ∷ Rep (PraosIsLeader c) x → PraosIsLeader c # | |
PraosCrypto c ⇒ NoThunks (PraosIsLeader c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos | |
type Rep (PraosIsLeader c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos type Rep (PraosIsLeader c) = D1 ('MetaData "PraosIsLeader" "Ouroboros.Consensus.Protocol.Praos" "ouroboros-consensus-protocol-0.9.0.2-inplace" 'True) (C1 ('MetaCons "PraosIsLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosIsLeaderVrfRes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF c InputVRF)))) |
data PraosParams Source #
Praos parameters that are node independent
PraosParams | |
|
Instances
data PraosState c Source #
Praos consensus state.
We track the last slot and the counters for operational certificates, as well as a series of nonces which get updated in different ways over the course of an epoch.
PraosState | |
|
Instances
data PraosToSign c Source #
Fields arising from praos execution which must be included in the block signature.
PraosToSign | |
|
Instances
data PraosValidationErr c Source #
Errors which we might encounter
VRFKeyUnknown !(KeyHash StakePool c) | |
VRFKeyWrongVRFKey !(KeyHash StakePool c) !(Hash c (VerKeyVRF c)) !(Hash c (VerKeyVRF c)) | |
VRFKeyBadProof !SlotNo !Nonce !(CertifiedVRF (VRF c) InputVRF) | |
VRFLeaderValueTooBig Natural Rational ActiveSlotCoeff | |
KESBeforeStartOCERT !KESPeriod !KESPeriod | |
KESAfterEndOCERT !KESPeriod !KESPeriod !Word64 | |
CounterTooSmallOCERT !Word64 !Word64 | |
CounterOverIncrementedOCERT !Word64 !Word64 | The KES counter has been incremented by more than 1 |
InvalidSignatureOCERT !Word64 !KESPeriod !String | |
InvalidKesSignatureOCERT !Word !Word !Word !Word64 !String | |
NoCounterForKeyHashOCERT !(KeyHash 'BlockIssuer c) |
Instances
data family Ticked st Source #
" Ticked " piece of state, either LedgerState
or ChainDepState
Ticking refers to the passage of time (the ticking of the clock). When a
piece of state is marked as ticked, it means that time-related changes have
been applied to the state. There are exactly two methods in the interface
that do that: tickChainDepState
and
applyChainTickLedgerResult
.
Also note that a successful forecast
must equal
forecastFor
(ledgerViewForecastAt
cfg st)
slot
. Thus a
protocolLedgerView
cfg
(applyChainTick
cfg slot st)LedgerView
can only be projected
from a Ticked
state, but cannot itself be ticked.
Some examples of time related changes:
- Scheduled delegations might have been applied in Byron
- New leader schedule computed for Shelley
- Transition from Byron to Shelley activated in the hard fork combinator.
- Nonces switched out at the start of a new epoch.
Instances
Show (Ticked ()) | |
Show (Ticked (f a)) ⇒ Show ((Ticked :.: f) a) | |
NoThunks (Ticked (f a)) ⇒ NoThunks ((Ticked :.: f) a) | |
data Ticked () | |
Defined in Ouroboros.Consensus.Ticked | |
type HeaderHash (Ticked l ∷ Type) | |
Defined in Ouroboros.Consensus.Ticked | |
data Ticked (PraosState c) Source # | |
Defined in Ouroboros.Consensus.Protocol.Praos | |
data Ticked (TPraosState c) Source # | |
Defined in Ouroboros.Consensus.Protocol.TPraos |
forgePraosFields ∷ (PraosCrypto c, KESignable c toSign, Monad m) ⇒ HotKey c m → CanBeLeader (Praos c) → IsLeader (Praos c) → (PraosToSign c → toSign) → m (PraosFields c toSign) Source #
praosCheckCanForge ∷ ConsensusConfig (Praos c) → SlotNo → KESInfo → Either (PraosCannotForge c) () Source #
For testing purposes
doValidateKESSignature ∷ PraosCrypto c ⇒ Word64 → Word64 → Map (KeyHash StakePool c) (IndividualPoolStake c) → Map (KeyHash BlockIssuer c) Word64 → HeaderView c → Except (PraosValidationErr c) () Source #
doValidateVRFSignature ∷ ∀ c. PraosCrypto c ⇒ Nonce → Map (KeyHash StakePool c) (IndividualPoolStake c) → ActiveSlotCoeff → HeaderView c → Except (PraosValidationErr c) () Source #