Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Protocol.TPraos
Contents
Description
Transitional Praos.
Transitional praos allows for the overlaying of Praos with an overlay schedule determining slots to be produced by BFT
Synopsis
- newtype MaxMajorProtVer = MaxMajorProtVer {}
- data PraosChainSelectView c = PraosChainSelectView {}
- data TPraos c
- data TPraosFields c toSign = TPraosFields {
- tpraosSignature ∷ SignedKES (KES c) toSign
- tpraosToSign ∷ toSign
- data TPraosIsLeader c = TPraosIsLeader {
- tpraosIsLeaderEta ∷ CertifiedVRF (VRF c) Nonce
- tpraosIsLeaderProof ∷ CertifiedVRF (VRF c) Natural
- tpraosIsLeaderGenVRFHash ∷ Maybe (Hash HASH (VerKeyVRF (VRF c)))
- data TPraosParams = TPraosParams {
- tpraosSlotsPerKESPeriod ∷ !Word64
- tpraosLeaderF ∷ !ActiveSlotCoeff
- tpraosSecurityParam ∷ !SecurityParam
- tpraosMaxKESEvo ∷ !Word64
- tpraosQuorum ∷ !Word64
- tpraosMaxMajorPV ∷ !MaxMajorProtVer
- tpraosMaxLovelaceSupply ∷ !Word64
- tpraosNetworkId ∷ !Network
- tpraosInitialNonce ∷ !Nonce
- tpraosSystemStart ∷ !SystemStart
- data TPraosState = TPraosState {}
- data TPraosToSign c = TPraosToSign {}
- type TPraosValidateView c = BHeader c
- forgeTPraosFields ∷ (PraosCrypto c, Signable (KES c) toSign, Monad m) ⇒ HotKey c m → CanBeLeader (TPraos c) → IsLeader (TPraos c) → (TPraosToSign c → toSign) → m (TPraosFields c toSign)
- mkShelleyGlobals ∷ ConsensusConfig (TPraos c) → Globals
- mkTPraosParams ∷ MaxMajorProtVer → Nonce → ShelleyGenesis → TPraosParams
- class (Crypto c, Signable (KES c) (BHBody c), Signable (VRF c) Seed) ⇒ PraosCrypto c
- data StandardCrypto
- data TPraosCannotForge c
- tpraosCheckCanForge ∷ ConsensusConfig (TPraos c) → Hash HASH (VerKeyVRF (VRF c)) → SlotNo → IsLeader (TPraos c) → KESInfo → Either (TPraosCannotForge c) ()
- data family ConsensusConfig p
- data family Ticked (st ∷ k) ∷ k
Documentation
newtype MaxMajorProtVer Source #
The maximum major protocol version.
This refers to the largest ledger version that this node supports.
Once the ledger protocol version (as reported by the ledger state)
exceeds this version we will consider all blocks invalid. This is
called the "obsolete node check" (see the ObsoleteNode
error
constructor).
Major ledger protocol versions are used to trigger both intra and inter era hard forks, which can potentially change the set of ledger rules that are applied.
Minor ledger protocol versions were intended to signal soft forks but they're currently unused, and they're irrelevant for the consensus logic.
For Cardano mainnet, the Shelley era has major protocol version 2. For more details, see this table
Constructors
MaxMajorProtVer | |
Fields |
Instances
data PraosChainSelectView c Source #
View of the tip of a header fragment for chain selection.
Constructors
PraosChainSelectView | |
Fields
|
Instances
Generic (PraosChainSelectView c) Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos.Common Associated Types
Methods from ∷ PraosChainSelectView c → Rep (PraosChainSelectView c) x # to ∷ Rep (PraosChainSelectView c) x → PraosChainSelectView c # | |||||||||||||
Show (PraosChainSelectView c) Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods showsPrec ∷ Int → PraosChainSelectView c → ShowS # show ∷ PraosChainSelectView c → String # showList ∷ [PraosChainSelectView c] → ShowS # | |||||||||||||
Eq (PraosChainSelectView c) Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods (==) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # (/=) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # | |||||||||||||
Crypto c ⇒ Ord (PraosChainSelectView c) Source # | We order between chains as follows:
IMPORTANT: This is not a complete picture of the Praos chain order, do also
consult the documentation of | ||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods compare ∷ PraosChainSelectView c → PraosChainSelectView c → Ordering # (<) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # (<=) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # (>) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # (>=) ∷ PraosChainSelectView c → PraosChainSelectView c → Bool # max ∷ PraosChainSelectView c → PraosChainSelectView c → PraosChainSelectView c # min ∷ PraosChainSelectView c → PraosChainSelectView c → PraosChainSelectView c # | |||||||||||||
NoThunks (PraosChainSelectView c) Source # | |||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos.Common | |||||||||||||
Crypto c ⇒ ChainOrder (PraosChainSelectView c) Source # | IMPORTANT: This is not a RulesConcretely, we have
Non-transitivity of |
a | b | c | |
---|---|---|---|
Slot | 0 | 3 | 6 |
VRF | 3 | 2 | 1 |
Then we have
and preferCandidate
cfg a b
, but
not preferCandidate
b c
(despite preferCandidate
a ca < c
).
Rationale for the rules
- The abstract Consensus layer requires that we first compare based on chain
length (see Chain extension precedence in
ChainOrder
).
Consider the scenario where the hot key of a block issuer was compromised, and the attacker is now minting blocks using that identity. The actual block issuer can use their cold key to issue a new hot key with a higher opcert issue number and set up a new pool. Due to this tiebreaker rule, the blocks minted by that pool will take precedence (allowing the actual block issuer to decide on eg the block contents and the predecessor) over blocks with the same block and slot number minted by the attacker, and they will end up on the honest chain quickly, which means that the adversary can't extend any chain containing such a block as it would violate the monotonicity requirement on opcert issue numbers.
See "3.7 Block Validity and Operational Key Certificates" in "Design Specification for Delegation and Incentives in Cardano" by Kant et al for more context.
The main motivation to do VRF comparisons is to avoid the "Frankfurt problem":
With only the first two rules for the chain order, almost all blocks with equal block number are equally preferrable. Consider two block issuers minting blocks in very nearby slots. As we never change our selection from one chain to an equally preferrable one, the first block to arrive at another pool is the one to be adopted, and will be extended the next time the pool is elected if no blocks with a higher block number arrive in the meantime. We observed that this effectively incentivizes block producers to concentrate geographically (historically, in Frankfurt) in order to minimize their diffusion times. This works against the goal of geographic decentralisation.
Also, with the VRF tiebreaker, a block with a somewhat lower propagation speed has a random chance to be selected instead of the one that arrived first by pools before the next block is forged.
See
VRFTiebreakerFlavor
for more context on the exact conditions under which the VRF comparison takes place.
Defined in Ouroboros.Consensus.Protocol.Praos.Common
Associated Types
type ChainOrderConfig (PraosChainSelectView c) | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common |
Methods
preferCandidate ∷ ChainOrderConfig (PraosChainSelectView c) → PraosChainSelectView c → PraosChainSelectView c → Bool Source #
Defined in Ouroboros.Consensus.Protocol.Praos.Common
Defined in Ouroboros.Consensus.Protocol.Praos.Common
Instances
Generic (ConsensusConfig (TPraos c)) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ ConsensusConfig (TPraos c) → Rep (ConsensusConfig (TPraos c)) x # to ∷ Rep (ConsensusConfig (TPraos c)) x → ConsensusConfig (TPraos c) # | |||||||||||||||||||||||||||||
PraosCrypto c ⇒ NoThunks (ConsensusConfig (TPraos c)) Source # | |||||||||||||||||||||||||||||
PraosCrypto c ⇒ ConsensusProtocol (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods checkIsLeader ∷ ConsensusConfig (TPraos c) → CanBeLeader (TPraos c) → SlotNo → Ticked (ChainDepState (TPraos c)) → Maybe (IsLeader (TPraos c)) Source # tickChainDepState ∷ ConsensusConfig (TPraos c) → LedgerView (TPraos c) → SlotNo → ChainDepState (TPraos c) → Ticked (ChainDepState (TPraos c)) Source # updateChainDepState ∷ ConsensusConfig (TPraos c) → ValidateView (TPraos c) → SlotNo → Ticked (ChainDepState (TPraos c)) → Except (ValidationErr (TPraos c)) (ChainDepState (TPraos c)) Source # reupdateChainDepState ∷ ConsensusConfig (TPraos c) → ValidateView (TPraos c) → SlotNo → Ticked (ChainDepState (TPraos c)) → ChainDepState (TPraos c) Source # protocolSecurityParam ∷ ConsensusConfig (TPraos c) → SecurityParam Source # | |||||||||||||||||||||||||||||
PraosCrypto c ⇒ PraosProtocolSupportsNode (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods getPraosNonces ∷ proxy (TPraos c) → ChainDepState (TPraos c) → PraosNonces Source # getOpCertCounters ∷ proxy (TPraos c) → ChainDepState (TPraos c) → Map (KeyHash 'BlockIssuer) Word64 Source # | |||||||||||||||||||||||||||||
TranslateProto (TPraos c) (Praos c) Source # | We can translate between TPraos and Praos, provided:
| ||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.Praos Methods translateLedgerView ∷ Proxy (TPraos c, Praos c) → LedgerView (TPraos c) → LedgerView (Praos c) Source # translateChainDepState ∷ Proxy (TPraos c, Praos c) → ChainDepState (TPraos c) → ChainDepState (Praos c) Source # | |||||||||||||||||||||||||||||
type Rep (ConsensusConfig (TPraos c)) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (ConsensusConfig (TPraos c)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "tpraosParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TPraosParams) :*: S1 ('MetaSel ('Just "tpraosEpochInfo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (EpochInfo (Except PastHorizonException))))) | |||||||||||||||||||||||||||||
type CanBeLeader (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type ChainDepState (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
data ConsensusConfig (TPraos c) Source # | Static configuration | ||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type IsLeader (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type LedgerView (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type SelectView (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type ValidateView (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type ValidationErr (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||||||||||||||||||||||||||
type PraosProtocolSupportsNodeCrypto (TPraos c) Source # | |||||||||||||||||||||||||||||
Defined in Ouroboros.Consensus.Protocol.TPraos |
data TPraosFields c toSign Source #
Constructors
TPraosFields | |
Fields
|
Instances
Generic (TPraosFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ TPraosFields c toSign → Rep (TPraosFields c toSign) x # to ∷ Rep (TPraosFields c toSign) x → TPraosFields c toSign # | |||||
(Show toSign, PraosCrypto c) ⇒ Show (TPraosFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods showsPrec ∷ Int → TPraosFields c toSign → ShowS # show ∷ TPraosFields c toSign → String # showList ∷ [TPraosFields c toSign] → ShowS # | |||||
(NoThunks toSign, PraosCrypto c) ⇒ NoThunks (TPraosFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
(Condense toSign, PraosCrypto c) ⇒ Condense (TPraosFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods condense ∷ TPraosFields c toSign → String Source # | |||||
type Rep (TPraosFields c toSign) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (TPraosFields c toSign) = D1 ('MetaData "TPraosFields" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosFields" 'PrefixI 'True) (S1 ('MetaSel ('Just "tpraosSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SignedKES (KES c) toSign)) :*: S1 ('MetaSel ('Just "tpraosToSign") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 toSign))) |
data TPraosIsLeader c Source #
Assembled proof that the issuer has the right to issue a block in the selected slot.
Constructors
TPraosIsLeader | |
Fields
|
Instances
Generic (TPraosIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ TPraosIsLeader c → Rep (TPraosIsLeader c) x # to ∷ Rep (TPraosIsLeader c) x → TPraosIsLeader c # | |||||
PraosCrypto c ⇒ NoThunks (TPraosIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
type Rep (TPraosIsLeader c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (TPraosIsLeader c) = D1 ('MetaData "TPraosIsLeader" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosIsLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "tpraosIsLeaderEta") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) Nonce)) :*: (S1 ('MetaSel ('Just "tpraosIsLeaderProof") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) Natural)) :*: S1 ('MetaSel ('Just "tpraosIsLeaderGenVRFHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (Hash HASH (VerKeyVRF (VRF c)))))))) |
data TPraosParams Source #
TPraos parameters that are node independent
Constructors
TPraosParams | |
Fields
|
Instances
Generic TPraosParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
| |||||
NoThunks TPraosParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
type Rep TPraosParams Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep TPraosParams = D1 ('MetaData "TPraosParams" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosParams" 'PrefixI 'True) (((S1 ('MetaSel ('Just "tpraosSlotsPerKESPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "tpraosLeaderF") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ActiveSlotCoeff)) :*: (S1 ('MetaSel ('Just "tpraosSecurityParam") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecurityParam) :*: (S1 ('MetaSel ('Just "tpraosMaxKESEvo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64) :*: S1 ('MetaSel ('Just "tpraosQuorum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)))) :*: ((S1 ('MetaSel ('Just "tpraosMaxMajorPV") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MaxMajorProtVer) :*: S1 ('MetaSel ('Just "tpraosMaxLovelaceSupply") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :*: (S1 ('MetaSel ('Just "tpraosNetworkId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network) :*: (S1 ('MetaSel ('Just "tpraosInitialNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce) :*: S1 ('MetaSel ('Just "tpraosSystemStart") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SystemStart)))))) |
data TPraosState Source #
Transitional Praos consensus state.
In addition to the ChainDepState
provided by the ledger, we track the slot
number of the last applied header.
Constructors
TPraosState | |
Fields |
Instances
FromCBOR TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
ToCBOR TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods toCBOR ∷ TPraosState → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy TPraosState → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [TPraosState] → Size Source # | |||||
Generic TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
| |||||
Show TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods showsPrec ∷ Int → TPraosState → ShowS # show ∷ TPraosState → String # showList ∷ [TPraosState] → ShowS # | |||||
Eq TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
NoThunks TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
Serialise TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods encode ∷ TPraosState → Encoding Source # decode ∷ Decoder s TPraosState Source # encodeList ∷ [TPraosState] → Encoding Source # decodeList ∷ Decoder s [TPraosState] Source # | |||||
type Rep TPraosState Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep TPraosState = D1 ('MetaData "TPraosState" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosState" 'PrefixI 'True) (S1 ('MetaSel ('Just "tpraosStateLastSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (WithOrigin SlotNo)) :*: S1 ('MetaSel ('Just "tpraosStateChainDepState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainDepState))) | |||||
data Ticked TPraosState Source # | |||||
data TPraosToSign c Source #
Fields arising from transitional praos execution which must be included in the block signature.
Constructors
TPraosToSign | |
Fields
|
Instances
Generic (TPraosToSign c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ TPraosToSign c → Rep (TPraosToSign c) x # to ∷ Rep (TPraosToSign c) x → TPraosToSign c # | |||||
PraosCrypto c ⇒ Show (TPraosToSign c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods showsPrec ∷ Int → TPraosToSign c → ShowS # show ∷ TPraosToSign c → String # showList ∷ [TPraosToSign c] → ShowS # | |||||
PraosCrypto c ⇒ NoThunks (TPraosToSign c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
type Rep (TPraosToSign c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (TPraosToSign c) = D1 ('MetaData "TPraosToSign" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosToSign" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tpraosToSignIssuerVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VKey 'BlockIssuer)) :*: S1 ('MetaSel ('Just "tpraosToSignVrfVK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyVRF (VRF c)))) :*: (S1 ('MetaSel ('Just "tpraosToSignEta") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) Nonce)) :*: (S1 ('MetaSel ('Just "tpraosToSignLeader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CertifiedVRF (VRF c) Natural)) :*: S1 ('MetaSel ('Just "tpraosToSignOCert") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OCert c)))))) |
type TPraosValidateView c = BHeader c Source #
Because we are using the executable spec, rather than implementing the protocol directly here, we have a fixed header type rather than an abstraction. So our validate view is fixed to this.
forgeTPraosFields ∷ (PraosCrypto c, Signable (KES c) toSign, Monad m) ⇒ HotKey c m → CanBeLeader (TPraos c) → IsLeader (TPraos c) → (TPraosToSign c → toSign) → m (TPraosFields c toSign) Source #
mkShelleyGlobals ∷ ConsensusConfig (TPraos c) → Globals Source #
Arguments
∷ MaxMajorProtVer | |
→ Nonce | Initial nonce |
→ ShelleyGenesis | |
→ TPraosParams |
Crypto
class (Crypto c, Signable (KES c) (BHBody c), Signable (VRF c) Seed) ⇒ PraosCrypto c Source #
Instances
PraosCrypto StandardCrypto | |
Defined in Cardano.Protocol.TPraos.API |
data StandardCrypto Source #
The same crypto used on the net
Instances
Crypto StandardCrypto | |||||||||
Defined in Cardano.Ledger.Crypto.Internal Associated Types
| |||||||||
PraosCrypto StandardCrypto | |||||||||
Defined in Cardano.Protocol.TPraos.API | |||||||||
PraosCrypto StandardCrypto Source # | |||||||||
Defined in Ouroboros.Consensus.Protocol.Praos | |||||||||
type KES StandardCrypto | |||||||||
Defined in Cardano.Ledger.Crypto.Internal | |||||||||
type VRF StandardCrypto | |||||||||
Defined in Cardano.Ledger.Crypto.Internal |
CannotForge
data TPraosCannotForge c Source #
Expresses that, whilst we believe ourselves to be a leader for this slot, we are nonetheless unable to forge a block.
Constructors
TPraosCannotForgeKeyNotUsableYet | 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
|
TPraosCannotForgeWrongVRF !(Hash HASH (VerKeyVRF (VRF c))) !(Hash HASH (VerKeyVRF (VRF c))) | We are a genesis delegate, but our VRF key (second argument) does not match the registered key for that delegate (first argument). |
Instances
Generic (TPraosCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ TPraosCannotForge c → Rep (TPraosCannotForge c) x # to ∷ Rep (TPraosCannotForge c) x → TPraosCannotForge c # | |||||
PraosCrypto c ⇒ Show (TPraosCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Methods showsPrec ∷ Int → TPraosCannotForge c → ShowS # show ∷ TPraosCannotForge c → String # showList ∷ [TPraosCannotForge c] → ShowS # | |||||
type Rep (TPraosCannotForge c) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (TPraosCannotForge c) = D1 ('MetaData "TPraosCannotForge" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosCannotForgeKeyNotUsableYet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod)) :+: C1 ('MetaCons "TPraosCannotForgeWrongVRF" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Hash HASH (VerKeyVRF (VRF c)))))) |
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)) | |||||
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)) | |||||
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)) | |||||
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)) | |||||
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) # | |||||
Generic (ConsensusConfig (Praos c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.Praos Associated Types
Methods from ∷ ConsensusConfig (Praos c) → Rep (ConsensusConfig (Praos c)) x # to ∷ Rep (ConsensusConfig (Praos c)) x → ConsensusConfig (Praos c) # | |||||
Generic (ConsensusConfig (TPraos c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos Associated Types
Methods from ∷ ConsensusConfig (TPraos c) → Rep (ConsensusConfig (TPraos c)) x # to ∷ Rep (ConsensusConfig (TPraos c)) x → ConsensusConfig (TPraos c) # | |||||
CanHardFork xs ⇒ NoThunks (ConsensusConfig (HardForkProtocol xs)) | |||||
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)) | |||||
ConsensusProtocol p ⇒ NoThunks (ConsensusConfig (ModChainSel p s)) | |||||
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)) | |||||
PraosCrypto c ⇒ NoThunks (ConsensusConfig (Praos c)) Source # | |||||
PraosCrypto c ⇒ NoThunks (ConsensusConfig (TPraos c)) Source # | |||||
type Rep (ConsensusConfig (HardForkProtocol xs)) | |||||
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)) | |||||
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)) | |||||
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)) | |||||
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))) | |||||
type Rep (ConsensusConfig (Praos c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.Praos type Rep (ConsensusConfig (Praos c)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.Praos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "PraosConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "praosParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PraosParams) :*: S1 ('MetaSel ('Just "praosEpochInfo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (EpochInfo (Except PastHorizonException))))) | |||||
type Rep (ConsensusConfig (TPraos c)) Source # | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos type Rep (ConsensusConfig (TPraos c)) = D1 ('MetaData "ConsensusConfig" "Ouroboros.Consensus.Protocol.TPraos" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "TPraosConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "tpraosParams") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TPraosParams) :*: S1 ('MetaSel ('Just "tpraosEpochInfo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (EpochInfo (Except PastHorizonException))))) | |||||
data ConsensusConfig (HardForkProtocol xs) | |||||
data ConsensusConfig (Bft c) | (Static) node configuration | ||||
Defined in Ouroboros.Consensus.Protocol.BFT data ConsensusConfig (Bft c) = BftConfig {
| |||||
newtype ConsensusConfig (PBft c) | (Static) node configuration | ||||
Defined in Ouroboros.Consensus.Protocol.PBFT | |||||
data ConsensusConfig (Praos c) Source # | Static configuration | ||||
Defined in Ouroboros.Consensus.Protocol.Praos | |||||
data ConsensusConfig (TPraos c) Source # | Static configuration | ||||
Defined in Ouroboros.Consensus.Protocol.TPraos | |||||
newtype ConsensusConfig (ModChainSel p s) | |||||
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 ()) | |
Bridge m a ⇒ GetTip (Ticked (LedgerState (DualBlock m a))) | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
IsLedger (LedgerState blk) ⇒ GetTip (Ticked (ExtLedgerState blk)) | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked (ExtLedgerState blk) mk → Point (Ticked (ExtLedgerState blk)) 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))) | |
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)) | |
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)) | |
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) | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
Show (Ticked (f a)) ⇒ Show (((Ticked ∷ Type → Type) :.: f) a) | |
NoThunks (Ticked (f a)) ⇒ NoThunks (((Ticked ∷ Type → Type) :.: f) a) | |
data Ticked PraosState Source # | |
data Ticked TPraosState Source # | |
data Ticked () | |
Defined in Ouroboros.Consensus.Ticked | |
data Ticked (HardForkChainDepState xs ∷ Type) | |
data Ticked (HeaderState blk ∷ Type) | |
Defined in Ouroboros.Consensus.HeaderValidation | |
data Ticked (PBftState c ∷ Type) | |
Defined in Ouroboros.Consensus.Protocol.PBFT | |
newtype Ticked (WrapChainDepState blk ∷ Type) | |
Defined in Ouroboros.Consensus.TypeFamilyWrappers | |
type HeaderHash (Ticked l ∷ k) | |
Defined in Ouroboros.Consensus.Ticked | |
type TxIn (Ticked l) | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
type TxOut (Ticked l) | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
data Ticked (LedgerState (HardForkBlock xs) ∷ MapKind → Type) (mk ∷ MapKind) | |
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) | |
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) | |
Defined in Ouroboros.Consensus.Ledger.Extended data Ticked (ExtLedgerState blk ∷ MapKind → Type) (mk ∷ MapKind) = TickedExtLedgerState {
|