cardano-protocol-tpraos-1.6.0.0: Cardano Protocol: Transitional Praos
Safe HaskellNone
LanguageHaskell2010

Cardano.Protocol.TPraos.API

Description

Integration between the Shelley ledger and its corresponding (Transitional Praos) protocol.

In particular, this code supports extracting the components of the ledger state needed for protocol execution, both now and in a 2k-slot window.

Synopsis

Documentation

class (Crypto c, Signable (KES c) (BHBody c), Signable (VRF c) Seed) ⇒ PraosCrypto c Source #

Instances

Instances details
PraosCrypto StandardCrypto Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

class (STS (EraRule "TICKF" era), BaseM (EraRule "TICKF" era) ~ ShelleyBase, Environment (EraRule "TICKF" era) ~ (), State (EraRule "TICKF" era) ~ NewEpochState era, Signal (EraRule "TICKF" era) ~ SlotNo, EraGov era, EraCertState era) ⇒ GetLedgerView era where Source #

Deprecated: Use ShelleyEraForecast for TPraos eras (Shelley-Alonzo) or EraForecast for Praos eras (Babbage+) instead.

Minimal complete definition

Nothing

Methods

currentLedgerViewNewEpochState era → LedgerView Source #

Deprecated: Use currentForecast instead.

default currentLedgerViewAtMostEra "Alonzo" era ⇒ NewEpochState era → LedgerView Source #

futureLedgerViewMonadError (FutureLedgerViewError era) m ⇒ GlobalsNewEpochState era → SlotNo → m LedgerView Source #

Deprecated: Use futureForecast instead.

default futureLedgerView ∷ (MonadError (FutureLedgerViewError era) m, AtMostEra "Alonzo" era) ⇒ GlobalsNewEpochState era → SlotNo → m LedgerView Source #

Instances

Instances details
GetLedgerView AllegraEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView AlonzoEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView BabbageEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView ConwayEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView DijkstraEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView MaryEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

GetLedgerView ShelleyEra Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

data LedgerView Source #

Deprecated: In favor of TPraosLedgerView

Data required by the TPraos protocol from the Shelley ledger.

Instances

Instances details
NFData LedgerView Source #

Preserves old semantics: does not force fields (especially the lazy lvExtraEntropy which may be error in Babbage).

Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

rnfLedgerView → () #

Generic LedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep LedgerView 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep LedgerView = D1 ('MetaData "LedgerView" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "LedgerView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "lvD") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "lvExtraEntropy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "lvPoolDistr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PoolDistr) :*: (S1 ('MetaSel ('Just "lvGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GenDelegs) :*: S1 ('MetaSel ('Just "lvChainChecks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainChecksPParams)))))
Show LedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Eq LedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

(==)LedgerViewLedgerViewBool #

(/=)LedgerViewLedgerViewBool #

NoThunks LedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep LedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep LedgerView = D1 ('MetaData "LedgerView" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "LedgerView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "lvD") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "lvExtraEntropy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "lvPoolDistr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PoolDistr) :*: (S1 ('MetaSel ('Just "lvGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GenDelegs) :*: S1 ('MetaSel ('Just "lvChainChecks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainChecksPParams)))))

mkInitialShelleyLedgerViewFromByronTranslationContextLedgerView Source #

We construct a LedgerView using the Shelley genesis config in the same way as translateToShelleyLedgerState.

data TPraosLedgerView Source #

Data required by the TPraos protocol from the Shelley ledger.

Instances

Instances details
NFData TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

rnfTPraosLedgerView → () #

Generic TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep TPraosLedgerView 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep TPraosLedgerView = D1 ('MetaData "TPraosLedgerView" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "TPraosLedgerView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tplvD") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "tplvExtraEntropy") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "tplvPoolDistr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PoolDistr) :*: (S1 ('MetaSel ('Just "tplvGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GenDelegs) :*: S1 ('MetaSel ('Just "tplvChainChecks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainChecksPParams)))))
Show TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Eq TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

NoThunks TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep TPraosLedgerView Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep TPraosLedgerView = D1 ('MetaData "TPraosLedgerView" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "TPraosLedgerView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tplvD") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "tplvExtraEntropy") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "tplvPoolDistr") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PoolDistr) :*: (S1 ('MetaSel ('Just "tplvGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GenDelegs) :*: S1 ('MetaSel ('Just "tplvChainChecks") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChainChecksPParams)))))

forecastToTPraosLedgerView ∷ ∀ (t ∷ Timeline) era. ShelleyEraForecast era ⇒ Forecast t era → TPraosLedgerView Source #

Convert a Forecast to TPraosLedgerView for use by consensus.

mkInitialShelleyForecastFromByronTranslationContextShelleyForecast 'Current ShelleyEra Source #

Construct an initial ShelleyForecast from the Byron translation context. This can be used with forecastToTPraosLedgerView to get a TPraosLedgerView.

newtype FutureLedgerViewError era Source #

Constructors

FutureLedgerViewError (NonEmpty (PredicateFailure (EraRule "TICKF" era))) 

Instances

Instances details
Show (PredicateFailure (EraRule "TICKF" era)) ⇒ Show (FutureLedgerViewError era) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Eq (PredicateFailure (EraRule "TICKF" era)) ⇒ Eq (FutureLedgerViewError era) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Chain state operations

The chain state is an amalgam of the protocol state and the ticked nonce.

data ChainDepState Source #

Constructors

ChainDepState 

Fields

Instances

Instances details
FromCBOR ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

ToCBOR ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

DecCBOR ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

EncCBOR ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Generic ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep ChainDepState 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ChainDepState = D1 ('MetaData "ChainDepState" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "ChainDepState" 'PrefixI 'True) (S1 ('MetaSel ('Just "csProtocol") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PrtclState) :*: (S1 ('MetaSel ('Just "csTickn") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TicknState) :*: S1 ('MetaSel ('Just "csLabNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce))))
Show ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Eq ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

NoThunks ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ChainDepState Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ChainDepState = D1 ('MetaData "ChainDepState" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'False) (C1 ('MetaCons "ChainDepState" 'PrefixI 'True) (S1 ('MetaSel ('Just "csProtocol") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PrtclState) :*: (S1 ('MetaSel ('Just "csTickn") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TicknState) :*: S1 ('MetaSel ('Just "csLabNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce))))

newtype ChainTransitionError c Source #

Instances

Instances details
Generic (ChainTransitionError c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep (ChainTransitionError c) 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (ChainTransitionError c) = D1 ('MetaData "ChainTransitionError" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (PredicateFailure (PRTCL c))))))
Crypto c ⇒ Show (ChainTransitionError c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ Eq (ChainTransitionError c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (ChainTransitionError c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (ChainTransitionError c) = D1 ('MetaData "ChainTransitionError" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.6.0.0-inplace" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (PredicateFailure (PRTCL c))))))

tickChainDepStateGlobalsTPraosLedgerViewBoolChainDepStateChainDepState Source #

Tick the chain state to a new epoch.

updateChainDepState ∷ (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ GlobalsTPraosLedgerViewBHeader c → ChainDepState → m ChainDepState Source #

Update the chain state based upon a new block header.

This also updates the last applied block hash.

reupdateChainDepStatePraosCrypto c ⇒ GlobalsTPraosLedgerViewBHeader c → ChainDepStateChainDepState Source #

Re-update the chain state based upon a new block header.

This function does no validation of whether the header is internally valid or consistent with the chain it is being applied to; the caller must ensure that this is valid through having previously applied it.

initialChainDepStateNonceMap (KeyHash 'GenesisRole) GenDelegPairChainDepState Source #

Construct an initial chain state given an initial nonce and a set of genesis delegates.

checkLeaderValueVRFAlgorithm v ⇒ OutputVRF v → RationalActiveSlotCoeffBool Source #

Check that the certified VRF output, when used as a natural, is valid for being slot leader.

getLeaderSchedule ∷ (EraPParams era, VRFAlgorithm v, ContextVRF v ~ (), Signable v Seed) ⇒ GlobalsNewEpochState era → ChainDepStateKeyHash 'StakePoolSignKeyVRF v → PParams era → Set SlotNo Source #

Get the (private) leader schedule for this epoch.

Given a private VRF key, returns the set of slots in which this node is eligible to lead.

newtype HashHeader Source #

Instances

Instances details
DecCBOR HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

EncCBOR HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

NFData HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfHashHeader → () #

Generic HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep HashHeader = D1 ('MetaData "HashHeader" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.21.0.0-inplace" 'True) (C1 ('MetaCons "HashHeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "unHashHeader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash HASH EraIndependentBlockHeader))))
Show HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

Eq HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

(==)HashHeaderHashHeaderBool #

(/=)HashHeaderHashHeaderBool #

Ord HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

NoThunks HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep HashHeader 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep HashHeader = D1 ('MetaData "HashHeader" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.21.0.0-inplace" 'True) (C1 ('MetaCons "HashHeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "unHashHeader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash HASH EraIndependentBlockHeader))))