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

showsPrecIntLedgerView crypto → ShowS #

showLedgerView 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) ∷ TypeType #

Methods

fromLedgerView crypto → Rep (LedgerView crypto) x #

toRep (LedgerView crypto) x → LedgerView crypto #

NoThunks (LedgerView crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

noThunks ∷ Context → LedgerView crypto → IO (Maybe ThunkInfo)

wNoThunks ∷ Context → LedgerView crypto → IO (Maybe ThunkInfo)

showTypeOfProxy (LedgerView crypto) → String

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-inplace" '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

showsPrecIntChainDepState crypto → ShowS #

showChainDepState 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) ∷ TypeType #

Methods

fromChainDepState crypto → Rep (ChainDepState crypto) x #

toRep (ChainDepState crypto) x → ChainDepState crypto #

Crypto crypto ⇒ ToCBOR (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

toCBORChainDepState crypto → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (ChainDepState crypto) → Size Source #

encodedListSizeExpr ∷ (∀ 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

Methods

fromCBORDecoder s (ChainDepState crypto) Source #

labelProxy (ChainDepState crypto) → Text Source #

Crypto crypto ⇒ NoThunks (ChainDepState crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

noThunks ∷ Context → ChainDepState crypto → IO (Maybe ThunkInfo)

wNoThunks ∷ Context → ChainDepState crypto → IO (Maybe ThunkInfo)

showTypeOfProxy (ChainDepState crypto) → String

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-inplace" '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

Methods

(==)ChainTransitionError crypto → ChainTransitionError crypto → Bool #

(/=)ChainTransitionError crypto → ChainTransitionError crypto → Bool #

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) ∷ TypeType #

Methods

fromChainTransitionError crypto → Rep (ChainTransitionError crypto) x #

toRep (ChainTransitionError crypto) x → ChainTransitionError crypto #

Crypto crypto ⇒ NoThunks (ChainTransitionError crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.API.Protocol

Methods

noThunks ∷ Context → ChainTransitionError crypto → IO (Maybe ThunkInfo)

wNoThunks ∷ Context → ChainTransitionError crypto → IO (Maybe ThunkInfo)

showTypeOfProxy (ChainTransitionError crypto) → String

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-inplace" 'True) (C1 ('MetaCons "ChainTransitionError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe 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 ∷ ∀ crypto m. (PraosCrypto crypto, MonadError (ChainTransitionError crypto) m) ⇒ GlobalsLedgerView 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 ∷ ∀ crypto. PraosCrypto crypto ⇒ GlobalsLedgerView 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.