| 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
- newtype FutureLedgerViewError era = FutureLedgerViewError (NonEmpty (PredicateFailure (EraRule "TICKF" era)))
- data ChainDepState = ChainDepState {}
- newtype ChainTransitionError c = ChainTransitionError (NonEmpty (PredicateFailure (PRTCL c)))
- tickChainDepState ∷ Globals → LedgerView → Bool → ChainDepState → ChainDepState
- updateChainDepState ∷ (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ Globals → LedgerView → BHeader c → ChainDepState → m ChainDepState
- reupdateChainDepState ∷ PraosCrypto c ⇒ Globals → LedgerView → 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 #
Minimal complete definition
Nothing
Methods
currentLedgerView ∷ NewEpochState era → LedgerView Source #
default currentLedgerView ∷ AtMostEra "Alonzo" era ⇒ NewEpochState era → LedgerView Source #
futureLedgerView ∷ MonadError (FutureLedgerViewError era) m ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
default futureLedgerView ∷ (MonadError (FutureLedgerViewError era) m, AtMostEra "Alonzo" era) ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
Instances
data LedgerView Source #
Data required by the Transitional Praos protocol from the Shelley ledger.
Constructors
| LedgerView | |
Instances
mkInitialShelleyLedgerView ∷ FromByronTranslationContext → LedgerView Source #
We construct a LedgerView using the Shelley genesis config in the same
way as translateToShelleyLedgerState.
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.5.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 # | |||||
| Crypto c ⇒ NoThunks (ChainTransitionError c) Source # | |||||
Defined in Cardano.Protocol.TPraos.API | |||||
| 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.5.0.0-inplace" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (PredicateFailure (PRTCL c)))))) | |||||
Arguments
| ∷ Globals | |
| → LedgerView | |
| → Bool | Are we in a new epoch? |
| → ChainDepState | |
| → ChainDepState |
Tick the chain state to a new epoch.
updateChainDepState ∷ (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ Globals → LedgerView → 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 → LedgerView → 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.19.0.0-inplace" 'True) (C1 ('MetaCons "HashHeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "unHashHeader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash HASH EraIndependentBlockHeader)))) | |||||