Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Auxiliary definitions to make working with the Byron ledger easier
Synopsis
- getDelegationMap ∷ ChainValidationState → Map
- getMaxBlockSize ∷ ChainValidationState → Word32
- applyChainTick ∷ Config → SlotNumber → ChainValidationState → ChainValidationState
- validateBlock ∷ MonadError ChainValidationError m ⇒ Config → ValidationMode → ABlock ByteString → HeaderHash → ChainValidationState → m ChainValidationState
- validateBoundary ∷ MonadError ChainValidationError m ⇒ Config → ABoundaryBlock ByteString → ChainValidationState → m ChainValidationState
- data ApplyMempoolPayloadErr
- applyMempoolPayload ∷ MonadError ApplyMempoolPayloadErr m ⇒ ValidationMode → Config → SlotNumber → AMempoolPayload ByteString → ChainValidationState → m ChainValidationState
- mempoolPayloadRecoverBytes ∷ AMempoolPayload ByteString → ByteString
- mempoolPayloadReencode ∷ AMempoolPayload a → ByteString
- previewDelegationMap ∷ SlotNumber → ChainValidationState → Map
- reAnnotateBlock ∷ EpochSlots → ABlock () → ABlock ByteString
- reAnnotateBoundary ∷ ProtocolMagicId → ABoundaryBlock () → ABoundaryBlock ByteString
- reAnnotateUsing ∷ ∀ f a. Functor f ⇒ (f a → Encoding) → (∀ s. Decoder s (f ByteSpan)) → f a → f ByteString
- abobMatchesBody ∷ ABlockOrBoundaryHdr ByteString → ABlockOrBoundary ByteString → Bool
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/intersectmbo/cardano-ledger/issues/1046 https://github.com/input-output-hk/ouroboros-network/issues/1291
validateBlock ∷ MonadError ChainValidationError m ⇒ Config → ValidationMode → ABlock ByteString → HeaderHash → ChainValidationState → m ChainValidationState Source #
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.
MempoolTxErr UTxOValidationError | |
MempoolDlgErr Error | |
MempoolUpdateProposalErr Error | |
MempoolUpdateVoteErr Error |
Instances
Show ApplyMempoolPayloadErr Source # | |
Defined in Cardano.Chain.Byron.API.Mempool | |
FromCBOR ApplyMempoolPayloadErr Source # | |
ToCBOR ApplyMempoolPayloadErr Source # | |
Defined in Cardano.Chain.Byron.API.Mempool toCBOR ∷ ApplyMempoolPayloadErr → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy ApplyMempoolPayloadErr → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ApplyMempoolPayloadErr] → Size Source # | |
DecCBOR ApplyMempoolPayloadErr Source # | |
Defined in Cardano.Chain.Byron.API.Mempool | |
EncCBOR ApplyMempoolPayloadErr Source # | |
Defined in Cardano.Chain.Byron.API.Mempool encCBOR ∷ ApplyMempoolPayloadErr → Encoding Source # encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ApplyMempoolPayloadErr → Size Source # encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ApplyMempoolPayloadErr] → Size Source # | |
Eq ApplyMempoolPayloadErr Source # | |
applyMempoolPayload ∷ MonadError ApplyMempoolPayloadErr m ⇒ ValidationMode → Config → SlotNumber → AMempoolPayload ByteString → ChainValidationState → m ChainValidationState Source #
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
reAnnotateBlock ∷ EpochSlots → ABlock () → ABlock ByteString Source #
reAnnotateUsing ∷ ∀ f a. Functor f ⇒ (f a → Encoding) → (∀ 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.