Safe Haskell | None |
---|---|
Language | Haskell98 |
Shelley.Spec.Ledger.API.Protocol
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, DSignable c (OCertSignable c), DSignable c (Hash c EraIndependentTxBody), KESignable c (BHBody c), VRFSignable c Seed) => PraosCrypto c
- class (ChainData (ChainDepState (Crypto era)), SerialisableData (ChainDepState (Crypto era)), Eq (ChainTransitionError (Crypto era)), Show (ChainTransitionError (Crypto era)), Show (LedgerView (Crypto era)), Show (FutureLedgerViewError era)) => GetLedgerView era where
- currentLedgerView :: NewEpochState era -> LedgerView (Crypto era)
- futureLedgerView :: MonadError (FutureLedgerViewError era) m => Globals -> NewEpochState era -> SlotNo -> m (LedgerView (Crypto era))
- data LedgerView crypto = LedgerView {
- lvD :: UnitInterval
- lvExtraEntropy :: Nonce
- lvPoolDistr :: PoolDistr crypto
- lvGenDelegs :: GenDelegs crypto
- lvChainChecks :: ChainChecksData
- newtype FutureLedgerViewError era = FutureLedgerViewError [PredicateFailure (TICKF era)]
- data ChainDepState crypto = ChainDepState {
- csProtocol :: !(PrtclState crypto)
- csTickn :: !TicknState
- csLabNonce :: !Nonce
- newtype ChainTransitionError crypto = ChainTransitionError [PredicateFailure (PRTCL crypto)]
- tickChainDepState :: Globals -> LedgerView crypto -> Bool -> ChainDepState crypto -> ChainDepState crypto
- updateChainDepState :: forall crypto m. (PraosCrypto crypto, MonadError (ChainTransitionError crypto) m) => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> m (ChainDepState crypto)
- reupdateChainDepState :: forall crypto. PraosCrypto crypto => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> ChainDepState crypto
Documentation
class (Crypto c, DSignable c (OCertSignable c), DSignable c (Hash c EraIndependentTxBody), KESignable c (BHBody c), VRFSignable c Seed) => PraosCrypto c Source #
class (ChainData (ChainDepState (Crypto era)), SerialisableData (ChainDepState (Crypto era)), Eq (ChainTransitionError (Crypto era)), Show (ChainTransitionError (Crypto era)), Show (LedgerView (Crypto era)), Show (FutureLedgerViewError era)) => GetLedgerView era where Source #
Minimal complete definition
Nothing
Methods
currentLedgerView :: NewEpochState era -> LedgerView (Crypto era) Source #
futureLedgerView :: MonadError (FutureLedgerViewError era) m => Globals -> NewEpochState era -> SlotNo -> m (LedgerView (Crypto era)) Source #
default futureLedgerView :: (ShelleyBased era, MonadError (FutureLedgerViewError era) m) => Globals -> NewEpochState era -> SlotNo -> m (LedgerView (Crypto era)) Source #
Instances
PraosCrypto crypto => GetLedgerView (ShelleyEra crypto) Source # | |
Defined in Shelley.Spec.Ledger.API.Protocol Methods currentLedgerView :: NewEpochState (ShelleyEra crypto) -> LedgerView (Crypto (ShelleyEra crypto)) Source # futureLedgerView :: MonadError (FutureLedgerViewError (ShelleyEra crypto)) m => Globals -> NewEpochState (ShelleyEra crypto) -> SlotNo -> m (LedgerView (Crypto (ShelleyEra crypto))) Source # |
data LedgerView crypto Source #
Data required by the Transitional Praos protocol from the Shelley ledger.
Constructors
LedgerView | |
Fields
|
Instances
newtype FutureLedgerViewError era Source #
Constructors
FutureLedgerViewError [PredicateFailure (TICKF era)] |
Instances
Eq (PredicateFailure (TICKF era)) => Eq (FutureLedgerViewError era) Source # | |
Defined in Shelley.Spec.Ledger.API.Protocol Methods (==) :: FutureLedgerViewError era -> FutureLedgerViewError era -> Bool # (/=) :: FutureLedgerViewError era -> FutureLedgerViewError era -> Bool # | |
Show (PredicateFailure (TICKF era)) => Show (FutureLedgerViewError era) Source # | |
Defined in Shelley.Spec.Ledger.API.Protocol Methods showsPrec :: Int -> FutureLedgerViewError era -> ShowS # show :: FutureLedgerViewError era -> String # showList :: [FutureLedgerViewError era] -> ShowS # |
Chain state operations
The chain state is an amalgam of the protocol state and the ticked nonce.
data ChainDepState crypto Source #
Constructors
ChainDepState | |
Fields
|
Instances
newtype ChainTransitionError crypto Source #
Constructors
ChainTransitionError [PredicateFailure (PRTCL crypto)] |
Instances
Arguments
:: Globals | |
-> LedgerView crypto | |
-> Bool | Are we in a new epoch? |
-> ChainDepState crypto | |
-> ChainDepState crypto |
Tick the chain state to a new epoch.
updateChainDepState :: forall crypto m. (PraosCrypto crypto, MonadError (ChainTransitionError crypto) m) => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> m (ChainDepState crypto) Source #
Update the chain state based upon a new block header.
This also updates the last applied block hash.
reupdateChainDepState :: forall crypto. PraosCrypto crypto => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> ChainDepState crypto 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.