cardano-ledger-byron-0.1.0.0: The blockchain layer of Cardano during the Byron era
Safe Haskell None
Language Haskell2010

Cardano.Chain.Byron.API

Description

Auxiliary definitions to make working with the Byron ledger easier

Synopsis

Extract info from chain state

Applying blocks

applyChainTick :: Config -> SlotNumber -> ChainValidationState -> ChainValidationState Source #

Apply chain tick

This is the part of block processing that depends only on the slot number of the block: We update

  • The update state
  • The delegation state
  • The last applied slot number

NOTE: The spec currently only updates the update state here; this is not good enough. Fortunately, updating the delegation state and slot number here (currently done in body processing) is at least conform spec, as these updates are conform spec. See

https://github.com/input-output-hk/cardano-ledger/issues/1046 https://github.com/input-output-hk/ouroboros-network/issues/1291

validateBoundary :: MonadError ChainValidationError m => Config -> ABoundaryBlock ByteString -> ChainValidationState -> m ChainValidationState Source #

Apply a boundary block

NOTE: The cvsLastSlot calculation must match the one in abobHdrSlotNo .

Applying transactions

data ApplyMempoolPayloadErr Source #

Errors that arise from applying an arbitrary mempool payload

Although cardano-legder defines MempoolPayload , it does not define a corresponding error type. We could ChainValidationError , but it's too large, which is problematic because we actually sent encoded versions of these errors across the wire.

mempoolPayloadRecoverBytes :: AMempoolPayload ByteString -> ByteString Source #

The encoding of the mempool payload (without a AMempoolPayload envelope)

mempoolPayloadReencode :: AMempoolPayload a -> ByteString Source #

Re-encode the mempool payload (without any envelope)

Protocol

previewDelegationMap :: SlotNumber -> ChainValidationState -> Map Source #

Preview the delegation map at a slot assuming no new delegations are | scheduled.

Annotations

reAnnotateUsing :: forall f a. Functor f => (f a -> Encoding ) -> ( forall s. Decoder s (f ByteSpan )) -> f a -> f ByteString Source #

Generalization of reAnnotate

Headers

abobMatchesBody :: ABlockOrBoundaryHdr ByteString -> ABlockOrBoundary ByteString -> Bool Source #

Check if a block matches its header

For EBBs, we're currently being more permissive here and not performing any header-body validation but only checking whether an EBB header and EBB block were provided. This seems to be fine as it won't cause any loss of consensus with the old `cardano-sl` nodes.