shelley-spec-ledger-0.1.0.0
Safe HaskellNone
LanguageHaskell98

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

Documentation

data LedgerView crypto Source #

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

Instances

Instances details
Eq (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

(==) :: LedgerView crypto -> LedgerView crypto -> Bool #

(/=) :: LedgerView crypto -> LedgerView crypto -> Bool #

Show (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

showsPrec :: Int -> LedgerView crypto -> ShowS #

show :: LedgerView crypto -> String #

showList :: [LedgerView crypto] -> ShowS #

Generic (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Associated Types

type Rep (LedgerView crypto) :: Type -> Type #

Methods

from :: LedgerView crypto -> Rep (LedgerView crypto) x #

to :: Rep (LedgerView crypto) x -> LedgerView crypto #

NoThunks (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (LedgerView crypto) = D1 ('MetaData "LedgerView" "Shelley.Spec.Ledger.API.Protocol" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "LedgerView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "lvD") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UnitInterval) :*: S1 ('MetaSel ('Just "lvExtraEntropy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Nonce)) :*: (S1 ('MetaSel ('Just "lvPoolDistr") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (PoolDistr crypto)) :*: (S1 ('MetaSel ('Just "lvGenDelegs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (GenDelegs crypto)) :*: S1 ('MetaSel ('Just "lvChainChecks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainChecksData)))))

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

Instances details
Eq (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

(==) :: ChainDepState crypto -> ChainDepState crypto -> Bool #

(/=) :: ChainDepState crypto -> ChainDepState crypto -> Bool #

Show (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

showsPrec :: Int -> ChainDepState crypto -> ShowS #

show :: ChainDepState crypto -> String #

showList :: [ChainDepState crypto] -> ShowS #

Generic (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Associated Types

type Rep (ChainDepState crypto) :: Type -> Type #

Methods

from :: ChainDepState crypto -> Rep (ChainDepState crypto) x #

to :: Rep (ChainDepState crypto) x -> ChainDepState crypto #

Crypto crypto => ToCBOR (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

toCBOR :: ChainDepState crypto -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (ChainDepState crypto) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [ChainDepState crypto] -> Size Source #

Crypto crypto => FromCBOR (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Crypto crypto => NoThunks (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (ChainDepState crypto) = D1 ('MetaData "ChainDepState" "Shelley.Spec.Ledger.API.Protocol" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "ChainDepState" 'PrefixI 'True) (S1 ('MetaSel ('Just "csProtocol") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PrtclState crypto)) :*: (S1 ('MetaSel ('Just "csTickn") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TicknState) :*: S1 ('MetaSel ('Just "csLabNonce") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Nonce))))

newtype ChainTransitionError crypto Source #

Instances

Instances details
Crypto crypto => Eq (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Crypto crypto => Show (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Generic (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Associated Types

type Rep (ChainTransitionError crypto) :: Type -> Type #

Methods

from :: ChainTransitionError crypto -> Rep (ChainTransitionError crypto) x #

to :: Rep (ChainTransitionError crypto) x -> ChainTransitionError crypto #

Crypto crypto => NoThunks (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

type Rep (ChainTransitionError crypto) = D1 ('MetaData "ChainTransitionError" "Shelley.Spec.Ledger.API.Protocol" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PredicateFailure (PRTCL crypto)])))

tickChainDepState Source #

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.