Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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) ⇒ 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 ∷ ∀ c m. (PraosCrypto c, MonadError (ChainTransitionError c) m) ⇒ Globals → LedgerView → BHeader c → ChainDepState → m ChainDepState
- reupdateChainDepState ∷ ∀ c. PraosCrypto c ⇒ Globals → LedgerView → BHeader c → ChainDepState → ChainDepState
- initialChainDepState ∷ Nonce → Map (KeyHash 'Genesis) GenDelegPair → ChainDepState
- checkLeaderValue ∷ ∀ v. 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
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) ⇒ GetLedgerView era where Source #
Nothing
currentLedgerView ∷ NewEpochState era → LedgerView Source #
default currentLedgerView ∷ ProtVerAtMost era 6 ⇒ NewEpochState era → LedgerView Source #
futureLedgerView ∷ MonadError (FutureLedgerViewError era) m ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
default futureLedgerView ∷ (MonadError (FutureLedgerViewError era) m, ProtVerAtMost era 6) ⇒ Globals → NewEpochState era → SlotNo → m LedgerView Source #
data LedgerView Source #
Data required by the Transitional Praos protocol from the Shelley ledger.
Instances
mkInitialShelleyLedgerView ∷ FromByronTranslationContext → LedgerView Source #
We construct a LedgerView
using the Shelley genesis config in the same
way as translateToShelleyLedgerState
.
newtype FutureLedgerViewError era Source #
FutureLedgerViewError (NonEmpty (PredicateFailure (EraRule "TICKF" era))) |
Instances
Show (PredicateFailure (EraRule "TICKF" era)) ⇒ Show (FutureLedgerViewError era) Source # | |
Defined in Cardano.Protocol.TPraos.API | |
Eq (PredicateFailure (EraRule "TICKF" era)) ⇒ Eq (FutureLedgerViewError era) Source # | |
Defined in Cardano.Protocol.TPraos.API (==) ∷ FutureLedgerViewError era → FutureLedgerViewError era → Bool Source # (/=) ∷ FutureLedgerViewError era → FutureLedgerViewError era → Bool Source # |
Chain state operations
The chain state is an amalgam of the protocol state and the ticked nonce.
data ChainDepState Source #
ChainDepState | |
|
Instances
newtype ChainTransitionError c Source #
Instances
∷ Globals | |
→ LedgerView | |
→ Bool | Are we in a new epoch? |
→ ChainDepState | |
→ ChainDepState |
Tick the chain state to a new epoch.
updateChainDepState ∷ ∀ c m. (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 ∷ ∀ c. 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 'Genesis) GenDelegPair → ChainDepState Source #
Construct an initial chain state given an initial nonce and a set of genesis delegates.
checkLeaderValue ∷ ∀ v. 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.