cardano-protocol-tpraos-1.2.0.1: Cardano Protocol: Transitional Praos
Safe HaskellSafe-Inferred
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, DSignable c (OCertSignable c), KESignable c (BHBody c), VRFSignable c Seed) ⇒ PraosCrypto c Source #

Instances

Instances details
PraosCrypto StandardCrypto Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

class (Eq (ChainTransitionError (EraCrypto era)), Show (ChainTransitionError (EraCrypto era)), Show (LedgerView (EraCrypto era)), Show (FutureLedgerViewError era), 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) ⇒ GetLedgerView era where Source #

Minimal complete definition

Nothing

Instances

Instances details
Crypto c ⇒ GetLedgerView (AllegraEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ GetLedgerView (AlonzoEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ GetLedgerView (BabbageEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ GetLedgerView (ConwayEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ GetLedgerView (MaryEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ GetLedgerView (ShelleyEra c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

data LedgerView c Source #

Data required by the Transitional Praos protocol from the Shelley ledger.

Instances

Instances details
Generic (LedgerView c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep (LedgerView c) ∷ TypeType Source #

Methods

fromLedgerView c → Rep (LedgerView c) x Source #

toRep (LedgerView c) x → LedgerView c Source #

Show (LedgerView c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Eq (LedgerView c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

(==)LedgerView c → LedgerView c → Bool Source #

(/=)LedgerView c → LedgerView c → Bool Source #

NoThunks (LedgerView c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (LedgerView c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

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

mkInitialShelleyLedgerViewCrypto c ⇒ FromByronTranslationContext c → LedgerView c Source #

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

Chain state operations

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

data ChainDepState c Source #

Constructors

ChainDepState 

Fields

Instances

Instances details
Generic (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep (ChainDepState c) ∷ TypeType Source #

Show (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ FromCBOR (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ ToCBOR (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

toCBORChainDepState c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (ChainDepState c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ChainDepState c] → Size Source #

Crypto c ⇒ DecCBOR (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ EncCBOR (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Methods

encCBORChainDepState c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (ChainDepState c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ChainDepState c] → Size Source #

Eq (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c ⇒ NoThunks (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (ChainDepState c) Source # 
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep (ChainDepState c) = D1 ('MetaData "ChainDepState" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-1.2.0.1-inplace" 'False) (C1 ('MetaCons "ChainDepState" 'PrefixI 'True) (S1 ('MetaSel ('Just "csProtocol") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PrtclState c)) :*: (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) ∷ TypeType Source #

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

Crypto c ⇒ NoThunks (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.2.0.1-inplace" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (PredicateFailure (PRTCL c))))))

tickChainDepState Source #

Arguments

Globals 
LedgerView c 
Bool

Are we in a new epoch?

ChainDepState c 
ChainDepState c 

Tick the chain state to a new epoch.

updateChainDepState ∷ ∀ c m. (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ GlobalsLedgerView c → BHeader c → ChainDepState c → m (ChainDepState c) Source #

Update the chain state based upon a new block header.

This also updates the last applied block hash.

reupdateChainDepState ∷ ∀ c. PraosCrypto c ⇒ GlobalsLedgerView c → BHeader c → ChainDepState c → ChainDepState c 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 'Genesis c) (GenDelegPair c) → ChainDepState c Source #

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

checkLeaderValue ∷ ∀ v. VRFAlgorithm 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, Signable (VRF (EraCrypto era)) Seed) ⇒ GlobalsNewEpochState era → ChainDepState (EraCrypto era) → KeyHash 'StakePool (EraCrypto era) → SignKeyVRF (EraCrypto era) → 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.