| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- class (Crypto c, Signable (KES c) (BHBody c), Signable (VRF c) Seed) ⇒ PraosCrypto c
- 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
- currentLedgerView ∷ NewEpochState era → LedgerView
- futureLedgerView ∷ MonadError (FutureLedgerViewError era) m ⇒ Globals → NewEpochState era → SlotNo → m LedgerView
- data LedgerView = LedgerView {}
- mkInitialShelleyLedgerView ∷ FromByronTranslationContext → LedgerView
- data TPraosLedgerView = TPraosLedgerView {}
- forecastToTPraosLedgerView ∷ ∀ (t ∷ Timeline) era. ShelleyEraForecast era ⇒ Forecast t era → TPraosLedgerView
- mkInitialShelleyForecast ∷ FromByronTranslationContext → ShelleyForecast 'Current ShelleyEra
- newtype FutureLedgerViewError era = FutureLedgerViewError (NonEmpty (PredicateFailure (EraRule "TICKF" era)))
- data ChainDepState = ChainDepState {}
- newtype ChainTransitionError c = ChainTransitionError (NonEmpty (PredicateFailure (PRTCL c)))
- tickChainDepState ∷ Globals → TPraosLedgerView → Bool → ChainDepState → ChainDepState
- updateChainDepState ∷ (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ Globals → TPraosLedgerView → BHeader c → ChainDepState → m ChainDepState
- reupdateChainDepState ∷ PraosCrypto c ⇒ Globals → TPraosLedgerView → BHeader c → ChainDepState → ChainDepState
- initialChainDepState ∷ Nonce → Map (KeyHash 'GenesisRole) GenDelegPair → ChainDepState
- checkLeaderValue ∷ VRFAlgorithm v ⇒ OutputVRF v → Rational → ActiveSlotCoeff → Bool
- getLeaderSchedule ∷ (EraPParams era, VRFAlgorithm v, ContextVRF v ~ (), Signable v Seed) ⇒ Globals → NewEpochState era → ChainDepState → KeyHash 'StakePool → SignKeyVRF v → PParams era → Set SlotNo
- newtype HashHeader = HashHeader {}
Documentation
class (Crypto c, Signable (KES c) (BHBody c), Signable (VRF c) Seed) ⇒ PraosCrypto c Source #
Instances
| PraosCrypto StandardCrypto Source # | |
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
currentLedgerView ∷ NewEpochState era → LedgerView Source #
Deprecated: Use currentForecast instead.
default currentLedgerView ∷ AtMostEra "Alonzo" era ⇒ NewEpochState era → LedgerView Source #
futureLedgerView ∷ MonadError (FutureLedgerViewError era) m ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
Deprecated: Use futureForecast instead.
default futureLedgerView ∷ (MonadError (FutureLedgerViewError era) m, AtMostEra "Alonzo" era) ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
Instances
data LedgerView Source #
Deprecated: In favor of TPraosLedgerView
Data required by the TPraos protocol from the Shelley ledger.
Constructors
| LedgerView | Deprecated: In favor of |
Fields | |
Instances
mkInitialShelleyLedgerView ∷ FromByronTranslationContext → LedgerView Source #
Deprecated: Use mkInitialShelleyForecast and forecastToTPraosLedgerView instead.
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.
Constructors
| TPraosLedgerView | |
Fields | |
Instances
| NFData TPraosLedgerView Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods rnf ∷ TPraosLedgerView → () # | |||||
| Generic TPraosLedgerView Source # | |||||
Defined in Cardano.Protocol.TPraos.API Associated Types
Methods from ∷ TPraosLedgerView → Rep TPraosLedgerView x # to ∷ Rep TPraosLedgerView x → TPraosLedgerView # | |||||
| Show TPraosLedgerView Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods showsPrec ∷ Int → TPraosLedgerView → ShowS # show ∷ TPraosLedgerView → String # showList ∷ [TPraosLedgerView] → ShowS # | |||||
| Eq TPraosLedgerView Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods | |||||
| NoThunks TPraosLedgerView Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| type Rep TPraosLedgerView Source # | |||||
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.
mkInitialShelleyForecast ∷ FromByronTranslationContext → ShelleyForecast '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
| Show (PredicateFailure (EraRule "TICKF" era)) ⇒ Show (FutureLedgerViewError era) Source # | |
Defined in Cardano.Protocol.TPraos.API Methods showsPrec ∷ Int → FutureLedgerViewError era → ShowS # show ∷ FutureLedgerViewError era → String # showList ∷ [FutureLedgerViewError era] → ShowS # | |
| Eq (PredicateFailure (EraRule "TICKF" era)) ⇒ Eq (FutureLedgerViewError era) Source # | |
Defined in Cardano.Protocol.TPraos.API Methods (==) ∷ FutureLedgerViewError era → FutureLedgerViewError era → Bool # (/=) ∷ FutureLedgerViewError era → FutureLedgerViewError era → Bool # | |
Chain state operations
The chain state is an amalgam of the protocol state and the ticked nonce.
data ChainDepState Source #
Constructors
| ChainDepState | |
Fields
| |
Instances
| FromCBOR ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| ToCBOR ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods toCBOR ∷ ChainDepState → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy ChainDepState → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ChainDepState] → Size Source # | |||||
| DecCBOR ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| EncCBOR ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods | |||||
| Generic ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API Associated Types
| |||||
| Show ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods showsPrec ∷ Int → ChainDepState → ShowS # show ∷ ChainDepState → String # showList ∷ [ChainDepState] → ShowS # | |||||
| Eq ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| NoThunks ChainDepState Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| type Rep ChainDepState Source # | |||||
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 #
Constructors
| ChainTransitionError (NonEmpty (PredicateFailure (PRTCL c))) |
Instances
| Generic (ChainTransitionError c) Source # | |||||
Defined in Cardano.Protocol.TPraos.API Associated Types
Methods from ∷ ChainTransitionError c → Rep (ChainTransitionError c) x # to ∷ Rep (ChainTransitionError c) x → ChainTransitionError c # | |||||
| Crypto c ⇒ Show (ChainTransitionError c) Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods showsPrec ∷ Int → ChainTransitionError c → ShowS # show ∷ ChainTransitionError c → String # showList ∷ [ChainTransitionError c] → ShowS # | |||||
| Crypto c ⇒ Eq (ChainTransitionError c) Source # | |||||
Defined in Cardano.Protocol.TPraos.API Methods (==) ∷ ChainTransitionError c → ChainTransitionError c → Bool # (/=) ∷ ChainTransitionError c → ChainTransitionError c → Bool # | |||||
| type Rep (ChainTransitionError c) Source # | |||||
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 ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (PredicateFailure (PRTCL c)))))) | |||||
tickChainDepState ∷ Globals → TPraosLedgerView → Bool → ChainDepState → ChainDepState Source #
Tick the chain state to a new epoch.
updateChainDepState ∷ (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ Globals → TPraosLedgerView → BHeader c → ChainDepState → m ChainDepState Source #
Update the chain state based upon a new block header.
This also updates the last applied block hash.
reupdateChainDepState ∷ PraosCrypto c ⇒ Globals → TPraosLedgerView → BHeader c → ChainDepState → ChainDepState 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.
initialChainDepState ∷ Nonce → Map (KeyHash 'GenesisRole) GenDelegPair → ChainDepState Source #
Construct an initial chain state given an initial nonce and a set of genesis delegates.
checkLeaderValue ∷ VRFAlgorithm v ⇒ OutputVRF v → Rational → ActiveSlotCoeff → Bool 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) ⇒ Globals → NewEpochState era → ChainDepState → KeyHash 'StakePool → SignKeyVRF 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 #
Constructors
| HashHeader | |
Instances
| DecCBOR HashHeader | |||||
Defined in Cardano.Ledger.Hashes | |||||
| EncCBOR HashHeader | |||||
Defined in Cardano.Ledger.Hashes Methods encCBOR ∷ HashHeader → Encoding Source # | |||||
| NFData HashHeader | |||||
Defined in Cardano.Ledger.Hashes Methods rnf ∷ HashHeader → () # | |||||
| Generic HashHeader | |||||
Defined in Cardano.Ledger.Hashes Associated Types
| |||||
| Show HashHeader | |||||
Defined in Cardano.Ledger.Hashes Methods showsPrec ∷ Int → HashHeader → ShowS # show ∷ HashHeader → String # showList ∷ [HashHeader] → ShowS # | |||||
| Eq HashHeader | |||||
Defined in Cardano.Ledger.Hashes | |||||
| Ord HashHeader | |||||
Defined in Cardano.Ledger.Hashes Methods compare ∷ HashHeader → HashHeader → Ordering # (<) ∷ HashHeader → HashHeader → Bool # (<=) ∷ HashHeader → HashHeader → Bool # (>) ∷ HashHeader → HashHeader → Bool # (>=) ∷ HashHeader → HashHeader → Bool # max ∷ HashHeader → HashHeader → HashHeader # min ∷ HashHeader → HashHeader → HashHeader # | |||||
| NoThunks HashHeader | |||||
Defined in Cardano.Ledger.Hashes | |||||
| type Rep HashHeader | |||||
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)))) | |||||