Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Protocol.PBFT
Synopsis
- data PBft c
- data PBftCanBeLeader c = PBftCanBeLeader {}
- data PBftFields c toSign = PBftFields {
- pbftIssuer ∷ VerKeyDSIGN (PBftDSIGN c)
- pbftGenKey ∷ VerKeyDSIGN (PBftDSIGN c)
- pbftSignature ∷ SignedDSIGN (PBftDSIGN c) toSign
- data PBftIsLeader c = PBftIsLeader {}
- newtype PBftLedgerView c = PBftLedgerView {
- pbftDelegates ∷ Bimap (PBftVerKeyHash c) (PBftVerKeyHash c)
- data PBftParams = PBftParams {}
- data PBftSelectView = PBftSelectView {}
- newtype PBftSignatureThreshold = PBftSignatureThreshold {}
- mkPBftSelectView ∷ GetHeader blk ⇒ Header blk → PBftSelectView
- pbftWindowExceedsThreshold ∷ PBftCrypto c ⇒ PBftWindowParams → PBftState c → PBftVerKeyHash c → Either Word64 ()
- pbftWindowSize ∷ SecurityParam → WindowSize
- forgePBftFields ∷ (PBftCrypto c, Signable (PBftDSIGN c) toSign) ⇒ (VerKeyDSIGN (PBftDSIGN c) → ContextDSIGN (PBftDSIGN c)) → IsLeader (PBft c) → toSign → PBftFields c toSign
- class (Typeable c, DSIGNAlgorithm (PBftDSIGN c), Condense (SigDSIGN (PBftDSIGN c)), Show (PBftVerKeyHash c), Ord (PBftVerKeyHash c), Eq (PBftVerKeyHash c), Show (PBftVerKeyHash c), NoThunks (PBftVerKeyHash c), NoThunks (PBftDelegationCert c), Serialise (PBftVerKeyHash c)) ⇒ PBftCrypto c where
- type PBftDSIGN c
- type PBftDelegationCert c = (d ∷ Type) | d → c
- type PBftVerKeyHash c = (d ∷ Type) | d → c
- dlgCertGenVerKey ∷ PBftDelegationCert c → VerKeyDSIGN (PBftDSIGN c)
- dlgCertDlgVerKey ∷ PBftDelegationCert c → VerKeyDSIGN (PBftDSIGN c)
- hashVerKey ∷ VerKeyDSIGN (PBftDSIGN c) → PBftVerKeyHash c
- data PBftMockCrypto
- newtype PBftMockVerKeyHash = PBftMockVerKeyHash {}
- data PBftValidateView c
- = Signable (PBftDSIGN c) signed ⇒ PBftValidateRegular (PBftFields c signed) signed (ContextDSIGN (PBftDSIGN c))
- | PBftValidateBoundary
- pbftValidateBoundary ∷ hdr → PBftValidateView c
- pbftValidateRegular ∷ (SignedHeader hdr, Signable (PBftDSIGN c) (Signed hdr)) ⇒ ContextDSIGN (PBftDSIGN c) → (hdr → PBftFields c (Signed hdr)) → hdr → PBftValidateView c
- data PBftCannotForge c
- pbftCheckCanForge ∷ PBftCrypto c ⇒ ConsensusConfig (PBft c) → PBftCanBeLeader c → SlotNo → Ticked (PBftState c) → Either (PBftCannotForge c) ()
- data family ConsensusConfig p
- data family Ticked (st ∷ k) ∷ k
- data PBftValidationErr c
Documentation
Permissive BFT
As defined in https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/byronChainSpec/latest/download-by-type/doc-pdf/blockchain-spec
Instances
data PBftCanBeLeader c Source #
If we are a core node (i.e. a block producing node) we know which core node we are, and we have the operational key pair and delegation certificate.
Constructors
PBftCanBeLeader | |
Fields |
Instances
Generic (PBftCanBeLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftCanBeLeader c → Rep (PBftCanBeLeader c) x # to ∷ Rep (PBftCanBeLeader c) x → PBftCanBeLeader c # | |||||
PBftCrypto c ⇒ NoThunks (PBftCanBeLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep (PBftCanBeLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftCanBeLeader c) = D1 ('MetaData "PBftCanBeLeader" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftCanBeLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftCanBeLeaderCoreNodeId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CoreNodeId) :*: (S1 ('MetaSel ('Just "pbftCanBeLeaderSignKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (SignKeyDSIGN (PBftDSIGN c))) :*: S1 ('MetaSel ('Just "pbftCanBeLeaderDlgCert") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftDelegationCert c))))) |
data PBftFields c toSign Source #
Constructors
PBftFields | |
Fields
|
Instances
Generic (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftFields c toSign → Rep (PBftFields c toSign) x # to ∷ Rep (PBftFields c toSign) x → PBftFields c toSign # | |||||
PBftCrypto c ⇒ Show (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftFields c toSign → ShowS # show ∷ PBftFields c toSign → String # showList ∷ [PBftFields c toSign] → ShowS # | |||||
PBftCrypto c ⇒ Eq (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods (==) ∷ PBftFields c toSign → PBftFields c toSign → Bool # (/=) ∷ PBftFields c toSign → PBftFields c toSign → Bool # | |||||
(PBftCrypto c, Typeable toSign) ⇒ NoThunks (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
PBftCrypto c ⇒ Condense (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods condense ∷ PBftFields c toSign → String Source # | |||||
type Rep (PBftFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftFields c toSign) = D1 ('MetaData "PBftFields" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftFields" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftIssuer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyDSIGN (PBftDSIGN c))) :*: (S1 ('MetaSel ('Just "pbftGenKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyDSIGN (PBftDSIGN c))) :*: S1 ('MetaSel ('Just "pbftSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SignedDSIGN (PBftDSIGN c) toSign))))) |
data PBftIsLeader c Source #
Information required to produce a block.
Constructors
PBftIsLeader | |
Fields
|
Instances
Generic (PBftIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftIsLeader c → Rep (PBftIsLeader c) x # to ∷ Rep (PBftIsLeader c) x → PBftIsLeader c # | |||||
PBftCrypto c ⇒ NoThunks (PBftIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep (PBftIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftIsLeader c) = D1 ('MetaData "PBftIsLeader" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftIsLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftIsLeaderSignKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (SignKeyDSIGN (PBftDSIGN c))) :*: S1 ('MetaSel ('Just "pbftIsLeaderDlgCert") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftDelegationCert c)))) |
newtype PBftLedgerView c Source #
Constructors
PBftLedgerView | |
Fields
|
Instances
Generic (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftLedgerView c → Rep (PBftLedgerView c) x # to ∷ Rep (PBftLedgerView c) x → PBftLedgerView c # | |||||
Show (PBftVerKeyHash c) ⇒ Show (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftLedgerView c → ShowS # show ∷ PBftLedgerView c → String # showList ∷ [PBftLedgerView c] → ShowS # | |||||
Eq (PBftVerKeyHash c) ⇒ Eq (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods (==) ∷ PBftLedgerView c → PBftLedgerView c → Bool # (/=) ∷ PBftLedgerView c → PBftLedgerView c → Bool # | |||||
PBftCrypto c ⇒ NoThunks (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
(Serialise (PBftVerKeyHash c), Ord (PBftVerKeyHash c)) ⇒ Serialise (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods encode ∷ PBftLedgerView c → Encoding Source # decode ∷ Decoder s (PBftLedgerView c) Source # encodeList ∷ [PBftLedgerView c] → Encoding Source # decodeList ∷ Decoder s [PBftLedgerView c] Source # | |||||
type Rep (PBftLedgerView c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftLedgerView c) = D1 ('MetaData "PBftLedgerView" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "PBftLedgerView" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftDelegates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Bimap (PBftVerKeyHash c) (PBftVerKeyHash c))))) |
data PBftParams Source #
Protocol parameters
Constructors
PBftParams | |
Fields
|
Instances
Generic PBftParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
| |||||
Show PBftParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftParams → ShowS # show ∷ PBftParams → String # showList ∷ [PBftParams] → ShowS # | |||||
NoThunks PBftParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep PBftParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep PBftParams = D1 ('MetaData "PBftParams" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftParams" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftSecurityParam") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecurityParam) :*: (S1 ('MetaSel ('Just "pbftNumNodes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NumCoreNodes) :*: S1 ('MetaSel ('Just "pbftSignatureThreshold") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PBftSignatureThreshold)))) |
data PBftSelectView Source #
Part of the header required for chain selection
EBBs share a block number with regular blocks, and so for chain selection we need to know if a block is an EBB or not (because a chain ending on an EBB with a particular block number is longer than a chain on a regular block with that same block number).
Constructors
PBftSelectView | |
Fields |
Instances
Generic PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
| |||||
Show PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftSelectView → ShowS # show ∷ PBftSelectView → String # showList ∷ [PBftSelectView] → ShowS # | |||||
Eq PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods (==) ∷ PBftSelectView → PBftSelectView → Bool # (/=) ∷ PBftSelectView → PBftSelectView → Bool # | |||||
Ord PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods compare ∷ PBftSelectView → PBftSelectView → Ordering # (<) ∷ PBftSelectView → PBftSelectView → Bool # (<=) ∷ PBftSelectView → PBftSelectView → Bool # (>) ∷ PBftSelectView → PBftSelectView → Bool # (>=) ∷ PBftSelectView → PBftSelectView → Bool # | |||||
NoThunks PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
ChainOrder PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods preferCandidate ∷ ChainOrderConfig PBftSelectView → PBftSelectView → PBftSelectView → Bool Source # | |||||
type Rep PBftSelectView Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep PBftSelectView = D1 ('MetaData "PBftSelectView" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftSelectView" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftSelectViewBlockNo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BlockNo) :*: S1 ('MetaSel ('Just "pbftSelectViewIsEBB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IsEBB))) | |||||
type ChainOrderConfig PBftSelectView Source # | |||||
newtype PBftSignatureThreshold Source #
Signature threshold. This represents the proportion of blocks in a
pbftSignatureWindow
-sized window which may be signed by any single key.
Constructors
PBftSignatureThreshold | |
Fields |
Instances
Generic PBftSignatureThreshold Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftSignatureThreshold → Rep PBftSignatureThreshold x # to ∷ Rep PBftSignatureThreshold x → PBftSignatureThreshold # | |||||
Show PBftSignatureThreshold Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftSignatureThreshold → ShowS # show ∷ PBftSignatureThreshold → String # showList ∷ [PBftSignatureThreshold] → ShowS # | |||||
Eq PBftSignatureThreshold Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods (==) ∷ PBftSignatureThreshold → PBftSignatureThreshold → Bool # (/=) ∷ PBftSignatureThreshold → PBftSignatureThreshold → Bool # | |||||
NoThunks PBftSignatureThreshold Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep PBftSignatureThreshold Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep PBftSignatureThreshold = D1 ('MetaData "PBftSignatureThreshold" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "PBftSignatureThreshold" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPBftSignatureThreshold") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) |
mkPBftSelectView ∷ GetHeader blk ⇒ Header blk → PBftSelectView Source #
pbftWindowExceedsThreshold ∷ PBftCrypto c ⇒ PBftWindowParams → PBftState c → PBftVerKeyHash c → Either Word64 () Source #
Does the number of blocks signed by this key exceed the threshold?
Returns Just
the number of blocks signed if exceeded.
pbftWindowSize ∷ SecurityParam → WindowSize Source #
Window size used by PBFT
We set the window size to be equal to k.
Forging
Arguments
∷ (PBftCrypto c, Signable (PBftDSIGN c) toSign) | |
⇒ (VerKeyDSIGN (PBftDSIGN c) → ContextDSIGN (PBftDSIGN c)) | Construct DSIGN context given |
→ IsLeader (PBft c) | |
→ toSign | |
→ PBftFields c toSign |
Classes
class (Typeable c, DSIGNAlgorithm (PBftDSIGN c), Condense (SigDSIGN (PBftDSIGN c)), Show (PBftVerKeyHash c), Ord (PBftVerKeyHash c), Eq (PBftVerKeyHash c), Show (PBftVerKeyHash c), NoThunks (PBftVerKeyHash c), NoThunks (PBftDelegationCert c), Serialise (PBftVerKeyHash c)) ⇒ PBftCrypto c where Source #
Crypto primitives required by BFT
Cardano stores a map of stakeholder IDs rather than the verification key directly. We make this family injective for convenience - whilst it's _possible_ that there could be non-injective instances, the chances of there being more than the two instances here are basically non-existent.
Associated Types
type PBftDelegationCert c = (d ∷ Type) | d → c Source #
type PBftVerKeyHash c = (d ∷ Type) | d → c Source #
Methods
dlgCertGenVerKey ∷ PBftDelegationCert c → VerKeyDSIGN (PBftDSIGN c) Source #
dlgCertDlgVerKey ∷ PBftDelegationCert c → VerKeyDSIGN (PBftDSIGN c) Source #
hashVerKey ∷ VerKeyDSIGN (PBftDSIGN c) → PBftVerKeyHash c Source #
Instances
PBftCrypto PBftMockCrypto Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Associated Types
Methods dlgCertGenVerKey ∷ PBftDelegationCert PBftMockCrypto → VerKeyDSIGN (PBftDSIGN PBftMockCrypto) Source # dlgCertDlgVerKey ∷ PBftDelegationCert PBftMockCrypto → VerKeyDSIGN (PBftDSIGN PBftMockCrypto) Source # hashVerKey ∷ VerKeyDSIGN (PBftDSIGN PBftMockCrypto) → PBftVerKeyHash PBftMockCrypto Source # |
data PBftMockCrypto Source #
Instances
PBftCrypto PBftMockCrypto Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Associated Types
Methods dlgCertGenVerKey ∷ PBftDelegationCert PBftMockCrypto → VerKeyDSIGN (PBftDSIGN PBftMockCrypto) Source # dlgCertDlgVerKey ∷ PBftDelegationCert PBftMockCrypto → VerKeyDSIGN (PBftDSIGN PBftMockCrypto) Source # hashVerKey ∷ VerKeyDSIGN (PBftDSIGN PBftMockCrypto) → PBftVerKeyHash PBftMockCrypto Source # | |||||||||||||
type PBftDSIGN PBftMockCrypto Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto | |||||||||||||
type PBftDelegationCert PBftMockCrypto Source # | |||||||||||||
type PBftVerKeyHash PBftMockCrypto Source # | |||||||||||||
newtype PBftMockVerKeyHash Source #
We don't hash and just use the underlying Word64
.
Constructors
PBftMockVerKeyHash | |
Instances
Generic PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Associated Types
Methods | |||||
Show PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Methods showsPrec ∷ Int → PBftMockVerKeyHash → ShowS # show ∷ PBftMockVerKeyHash → String # showList ∷ [PBftMockVerKeyHash] → ShowS # | |||||
Eq PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Methods | |||||
Ord PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Methods compare ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → Ordering # (<) ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → Bool # (<=) ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → Bool # (>) ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → Bool # (>=) ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → Bool # max ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → PBftMockVerKeyHash # min ∷ PBftMockVerKeyHash → PBftMockVerKeyHash → PBftMockVerKeyHash # | |||||
NoThunks PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto | |||||
Serialise PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto Methods encode ∷ PBftMockVerKeyHash → Encoding Source # decode ∷ Decoder s PBftMockVerKeyHash Source # | |||||
type Rep PBftMockVerKeyHash Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT.Crypto type Rep PBftMockVerKeyHash = D1 ('MetaData "PBftMockVerKeyHash" "Ouroboros.Consensus.Protocol.PBFT.Crypto" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "PBftMockVerKeyHash" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPBftMockVerKeyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyDSIGN MockDSIGN)))) |
data PBftValidateView c Source #
Part of the header that we validate
Constructors
Signable (PBftDSIGN c) signed ⇒ PBftValidateRegular (PBftFields c signed) signed (ContextDSIGN (PBftDSIGN c)) | Regular block Regular blocks are signed, and so we need to validate them. We also need to know the slot number of the block |
PBftValidateBoundary | Boundary block (EBB) EBBs are not signed and they do not affect the consensus state. |
pbftValidateBoundary ∷ hdr → PBftValidateView c Source #
Convenience constructor for PBftValidateView
for boundary blocks
pbftValidateRegular ∷ (SignedHeader hdr, Signable (PBftDSIGN c) (Signed hdr)) ⇒ ContextDSIGN (PBftDSIGN c) → (hdr → PBftFields c (Signed hdr)) → hdr → PBftValidateView c Source #
Convenience constructor for PBftValidateView
for regular blocks
CannotForge
data PBftCannotForge c Source #
Expresses that, whilst we believe ourselves to be a leader for this slot, we are nonetheless unable to forge a block.
Constructors
PBftCannotForgeInvalidDelegation !(PBftVerKeyHash c) | We cannot forge a block because we are not the current delegate of the genesis key we have a delegation certificate from. |
PBftCannotForgeThresholdExceeded !Word64 | We cannot lead because delegates of the genesis key we have a delegation from have already forged the maximum number of blocks in this signing window. |
Instances
Generic (PBftCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftCannotForge c → Rep (PBftCannotForge c) x # to ∷ Rep (PBftCannotForge c) x → PBftCannotForge c # | |||||
PBftCrypto c ⇒ Show (PBftCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftCannotForge c → ShowS # show ∷ PBftCannotForge c → String # showList ∷ [PBftCannotForge c] → ShowS # | |||||
PBftCrypto c ⇒ NoThunks (PBftCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep (PBftCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftCannotForge c) = D1 ('MetaData "PBftCannotForge" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "PBftCannotForgeInvalidDelegation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftVerKeyHash c))) :+: C1 ('MetaCons "PBftCannotForgeThresholdExceeded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) |
pbftCheckCanForge ∷ PBftCrypto c ⇒ ConsensusConfig (PBft c) → PBftCanBeLeader c → SlotNo → Ticked (PBftState c) → Either (PBftCannotForge c) () Source #
Type instances
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
Generic (ConsensusConfig (HardForkProtocol xs)) Source # | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Associated Types
Methods from ∷ ConsensusConfig (HardForkProtocol xs) → Rep (ConsensusConfig (HardForkProtocol xs)) x # to ∷ Rep (ConsensusConfig (HardForkProtocol xs)) x → ConsensusConfig (HardForkProtocol xs) # | |||||
Generic (ConsensusConfig (Bft c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.BFT Associated Types
Methods from ∷ ConsensusConfig (Bft c) → Rep (ConsensusConfig (Bft c)) x # to ∷ Rep (ConsensusConfig (Bft c)) x → ConsensusConfig (Bft c) # | |||||
Generic (ConsensusConfig (ModChainSel p s)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.ModChainSel Associated Types
Methods from ∷ ConsensusConfig (ModChainSel p s) → Rep (ConsensusConfig (ModChainSel p s)) x # to ∷ Rep (ConsensusConfig (ModChainSel p s)) x → ConsensusConfig (ModChainSel p s) # | |||||
Generic (ConsensusConfig (PBft c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ ConsensusConfig (PBft c) → Rep (ConsensusConfig (PBft c)) x # to ∷ Rep (ConsensusConfig (PBft c)) x → ConsensusConfig (PBft c) # | |||||
CanHardFork xs ⇒ NoThunks (ConsensusConfig (HardForkProtocol xs)) Source # | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Methods noThunks ∷ Context → ConsensusConfig (HardForkProtocol xs) → IO (Maybe ThunkInfo) Source # wNoThunks ∷ Context → ConsensusConfig (HardForkProtocol xs) → IO (Maybe ThunkInfo) Source # showTypeOf ∷ Proxy (ConsensusConfig (HardForkProtocol xs)) → String Source # | |||||
BftCrypto c ⇒ NoThunks (ConsensusConfig (Bft c)) Source # | |||||
ConsensusProtocol p ⇒ NoThunks (ConsensusConfig (ModChainSel p s)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.ModChainSel Methods noThunks ∷ Context → ConsensusConfig (ModChainSel p s) → IO (Maybe ThunkInfo) Source # wNoThunks ∷ Context → ConsensusConfig (ModChainSel p s) → IO (Maybe ThunkInfo) Source # showTypeOf ∷ Proxy (ConsensusConfig (ModChainSel p s)) → String Source # | |||||
NoThunks (ConsensusConfig (PBft c)) Source # | |||||
type Rep (ConsensusConfig (HardForkProtocol xs)) Source # | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics type Rep (ConsensusConfig (HardForkProtocol xs)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.HardFork.Combinator.Basics" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "HardForkConsensusConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "hardForkConsensusConfigK") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecurityParam) :*: (S1 ('MetaSel ('Just "hardForkConsensusConfigShape") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Shape xs)) :*: S1 ('MetaSel ('Just "hardForkConsensusConfigPerEra") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PerEraConsensusConfig xs))))) | |||||
type Rep (ConsensusConfig (Bft c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.BFT type Rep (ConsensusConfig (Bft c)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.BFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) (C1 ('MetaCons "BftConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "bftParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BftParams) :*: (S1 ('MetaSel ('Just "bftSignKey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (SignKeyDSIGN (BftDSIGN c))) :*: S1 ('MetaSel ('Just "bftVerKeys") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map NodeId (VerKeyDSIGN (BftDSIGN c))))))) | |||||
type Rep (ConsensusConfig (ModChainSel p s)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.ModChainSel type Rep (ConsensusConfig (ModChainSel p s)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.ModChainSel" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "McsConsensusConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "mcsConfigP") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ConsensusConfig p)))) | |||||
type Rep (ConsensusConfig (PBft c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (ConsensusConfig (PBft c)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "PBftConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "pbftParams") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PBftParams))) | |||||
data ConsensusConfig (HardForkProtocol xs) Source # | |||||
data ConsensusConfig (Bft c) Source # | (Static) node configuration | ||||
Defined in Ouroboros.Consensus.Protocol.BFT data ConsensusConfig (Bft c) = BftConfig {
| |||||
newtype ConsensusConfig (PBft c) Source # | (Static) node configuration | ||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
newtype ConsensusConfig (ModChainSel p s) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.ModChainSel |
data family Ticked (st ∷ k) ∷ k 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 ()) Source # | |
CanHardFork xs ⇒ GetTip (Ticked (LedgerState (HardForkBlock xs))) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked (LedgerState (HardForkBlock xs)) mk → Point (Ticked (LedgerState (HardForkBlock xs))) Source # | |
Bridge m a ⇒ GetTip (Ticked (LedgerState (DualBlock m a))) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
IsLedger (LedgerState blk) ⇒ GetTip (Ticked (ExtLedgerState blk)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked (ExtLedgerState blk) mk → Point (Ticked (ExtLedgerState blk)) Source # | |
(CanHardFork xs, HasCanonicalTxIn xs, HasHardForkTxOut xs) ⇒ HasLedgerTables (Ticked (LedgerState (HardForkBlock xs))) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (LedgerState (HardForkBlock xs)) mk → LedgerTables (Ticked (LedgerState (HardForkBlock xs))) mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (LedgerState (HardForkBlock xs)) any → LedgerTables (Ticked (LedgerState (HardForkBlock xs))) mk → Ticked (LedgerState (HardForkBlock xs)) mk Source # | |
(Bridge m a, NoThunks (TxOut (LedgerState m)), NoThunks (TxIn (LedgerState m)), Show (TxOut (LedgerState m)), Show (TxIn (LedgerState m)), Eq (TxOut (LedgerState m)), Ord (TxIn (LedgerState m)), MemPack (TxIn (LedgerState m))) ⇒ HasLedgerTables (Ticked (LedgerState (DualBlock m a))) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (LedgerState (DualBlock m a)) mk → LedgerTables (Ticked (LedgerState (DualBlock m a))) mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (LedgerState (DualBlock m a)) any → LedgerTables (Ticked (LedgerState (DualBlock m a))) mk → Ticked (LedgerState (DualBlock m a)) mk Source # | |
(HasLedgerTables (Ticked (LedgerState blk)), NoThunks (TxOut (LedgerState blk)), NoThunks (TxIn (LedgerState blk)), Show (TxOut (LedgerState blk)), Show (TxIn (LedgerState blk)), Eq (TxOut (LedgerState blk)), Ord (TxIn (LedgerState blk)), MemPack (TxIn (LedgerState blk))) ⇒ HasLedgerTables (Ticked (ExtLedgerState blk)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (ExtLedgerState blk) mk → LedgerTables (Ticked (ExtLedgerState blk)) mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked (ExtLedgerState blk) any → LedgerTables (Ticked (ExtLedgerState blk)) mk → Ticked (ExtLedgerState blk) mk Source # | |
LedgerTablesAreTrivial (Ticked (LedgerState blk)) ⇒ LedgerTablesAreTrivial (Ticked (ExtLedgerState blk)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods convertMapKind ∷ ∀ (mk ∷ MapKind) (mk' ∷ MapKind). Ticked (ExtLedgerState blk) mk → Ticked (ExtLedgerState blk) mk' Source # | |
NoThunks (Ticked (LedgerState (DualBlock m a)) mk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
Show (Ticked (f a)) ⇒ Show (((Ticked ∷ Type → Type) :.: f) a) Source # | |
NoThunks (Ticked (f a)) ⇒ NoThunks (((Ticked ∷ Type → Type) :.: f) a) Source # | |
data Ticked () Source # | |
Defined in Ouroboros.Consensus.Ticked | |
data Ticked (HardForkChainDepState xs ∷ Type) Source # | |
data Ticked (HeaderState blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.HeaderValidation | |
data Ticked (PBftState c ∷ Type) Source # | |
Defined in Ouroboros.Consensus.Protocol.PBFT | |
newtype Ticked (WrapChainDepState blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.TypeFamilyWrappers | |
type HeaderHash (Ticked l ∷ k) Source # | |
Defined in Ouroboros.Consensus.Ticked | |
type TxIn (Ticked l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
type TxOut (Ticked l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
data Ticked (LedgerState (HardForkBlock xs) ∷ MapKind → Type) (mk ∷ MapKind) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger data Ticked (LedgerState (HardForkBlock xs) ∷ MapKind → Type) (mk ∷ MapKind) = TickedHardForkLedgerState {} | |
data Ticked (LedgerState (DualBlock m a) ∷ MapKind → Type) (mk ∷ MapKind) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual data Ticked (LedgerState (DualBlock m a) ∷ MapKind → Type) (mk ∷ MapKind) = TickedDualLedgerState {} | |
data Ticked (ExtLedgerState blk ∷ MapKind → Type) (mk ∷ MapKind) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended data Ticked (ExtLedgerState blk ∷ MapKind → Type) (mk ∷ MapKind) = TickedExtLedgerState {
|
Exported for tracing errors
data PBftValidationErr c Source #
NOTE: this type is stored in the state, so it must be in normal form to avoid space leaks.
Constructors
PBftInvalidSignature !Text | |
PBftNotGenesisDelegate !(PBftVerKeyHash c) !(PBftLedgerView c) | |
PBftExceededSignThreshold !(PBftVerKeyHash c) !Word64 | We record how many slots this key signed |
PBftInvalidSlot |
Instances
Generic (PBftValidationErr c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Associated Types
Methods from ∷ PBftValidationErr c → Rep (PBftValidationErr c) x # to ∷ Rep (PBftValidationErr c) x → PBftValidationErr c # | |||||
PBftCrypto c ⇒ Show (PBftValidationErr c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods showsPrec ∷ Int → PBftValidationErr c → ShowS # show ∷ PBftValidationErr c → String # showList ∷ [PBftValidationErr c] → ShowS # | |||||
PBftCrypto c ⇒ Eq (PBftValidationErr c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT Methods (==) ∷ PBftValidationErr c → PBftValidationErr c → Bool # (/=) ∷ PBftValidationErr c → PBftValidationErr c → Bool # | |||||
PBftCrypto c ⇒ NoThunks (PBftValidationErr c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
type Rep (PBftValidationErr c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.PBFT type Rep (PBftValidationErr c) = D1 ('MetaData "PBftValidationErr" "Ouroboros.Consensus.Protocol.PBFT" "ouroboros-consensus-0.26.0.0-inplace" 'False) ((C1 ('MetaCons "PBftInvalidSignature" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "PBftNotGenesisDelegate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftVerKeyHash c)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftLedgerView c)))) :+: (C1 ('MetaCons "PBftExceededSignThreshold" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PBftVerKeyHash c)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: C1 ('MetaCons "PBftInvalidSlot" 'PrefixI 'False) (U1 ∷ Type → Type))) |