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

Cardano.Chain.Block

Synopsis

Documentation

updateBody :: ( MonadError ChainValidationError m, MonadReader ValidationMode m) => BodyEnvironment -> BodyState -> ABlock ByteString -> m BodyState Source #

This is an implementation of the BBODY rule as per the chain specification.

Compared to updateChain , this does not validate any header level checks, nor does it carry out anything which might be considered part of the protocol.

epochTransition :: EpochEnvironment -> State -> SlotNumber -> State Source #

Perform epoch transition if we have moved across the epoch boundary

We pass through to the update interface UPIEC rule, which adopts any confirmed proposals and cleans up the state. This corresponds to the EPOCH rules from the Byron chain specification.

headerIsValid :: ( MonadError ChainValidationError m, MonadReader ValidationMode m) => State -> AHeader ByteString -> m () Source #

This is an implementation of the headerIsValid function from the Byron chain specification

updateBlock :: ( MonadError ChainValidationError m, MonadReader ValidationMode m) => Config -> ChainValidationState -> ABlock ByteString -> m ChainValidationState Source #

This represents the CHAIN rule. It is intended more for use in tests than in a real implementation, which will want to invoke its constituent rules directly.

Note that this also updates the previous block hash, which would usually be done as part of the PBFT rule.

data ChainValidationState Source #

Constructors

ChainValidationState

Fields

Instances

Instances details
Eq ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

Show ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

Generic ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

NFData ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

ToCBOR ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

FromCBOR ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

NoThunks ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

type Rep ChainValidationState Source #
Instance details

Defined in Cardano.Chain.Block.Validation

initialChainValidationState :: MonadError Error m => Config -> m ChainValidationState Source #

Create the state needed to validate the zeroth epoch of the chain. The zeroth epoch starts with a boundary block where the previous hash is the genesis hash.

data ChainValidationError Source #

Constructors

ChainValidationBoundaryTooLarge

The size of an epoch boundary block exceeds the limit

ChainValidationBlockAttributesTooLarge

The size of a block's attributes is non-zero

ChainValidationBlockTooLarge Natural Natural

The size of a regular block exceeds the limit

ChainValidationHeaderAttributesTooLarge

The size of a block header's attributes is non-zero

ChainValidationHeaderTooLarge Natural Natural

The size of a block header exceeds the limit

ChainValidationDelegationPayloadError Text

There is a problem with the delegation payload signature

ChainValidationInvalidDelegation VerificationKey VerificationKey

The delegation used in the signature is not valid according to the ledger

ChainValidationGenesisHashMismatch GenesisHash GenesisHash

Genesis hash mismatch

ChainValidationExpectedGenesisHash GenesisHash HeaderHash

Expected GenesisHash but got HeaderHash

ChainValidationExpectedHeaderHash HeaderHash GenesisHash

Expected HeaderHash but GenesisHash

ChainValidationInvalidHash HeaderHash HeaderHash

The hash of the previous block does not match the value in the header

ChainValidationMissingHash HeaderHash

The hash of the previous block is missing and should be given hash.

ChainValidationUnexpectedGenesisHash HeaderHash

There should not be a hash of the previous but there is.

ChainValidationInvalidSignature BlockSignature

The signature of the block is invalid

ChainValidationDelegationSchedulingError Error

A delegation certificate failed validation in the ledger layer

ChainValidationProtocolMagicMismatch ProtocolMagicId ProtocolMagicId

The ProtocolMagic in the block doesn't match the configured one

ChainValidationSignatureLight

A block is using unsupported lightweight delegation

ChainValidationTooManyDelegations VerificationKey

The delegator for this block has delegated in too many recent blocks

ChainValidationUpdateError SlotNumber Error

Something failed to register in the update interface

ChainValidationUTxOValidationError UTxOValidationError

A transaction failed validation in the ledger layer

ChainValidationProofValidationError ProofValidationError

A payload proof did not match.

UTxO

data Proof Source #

Proof of everything contained in the payload

Instances

Instances details
Eq Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

Show Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

Generic Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

NFData Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

ToJSON Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

ToCBOR Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

FromCBOR Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

Buildable Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

NoThunks Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

type Rep Proof Source #
Instance details

Defined in Cardano.Chain.Block.Proof

Header

data AHeader a Source #

Constructors

AHeader

Fields

Instances

Instances details
Functor AHeader Source #
Instance details

Defined in Cardano.Chain.Block.Header

Eq a => Eq ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Show a => Show ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Generic ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Associated Types

type Rep ( AHeader a) :: Type -> Type Source #

NFData a => NFData ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

ToJSON a => ToJSON ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Decoded ( AHeader ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Buildable ( WithEpochSlots Header ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

NoThunks a => NoThunks ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ( AHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ( AHeader a) = D1 (' MetaData "AHeader" "Cardano.Chain.Block.Header" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "AHeader" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "aHeaderProtocolMagicId") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Annotated ProtocolMagicId a)) :*: S1 (' MetaSel (' Just "aHeaderPrevHash") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Annotated HeaderHash a))) :*: ( S1 (' MetaSel (' Just "aHeaderSlot") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Annotated SlotNumber a)) :*: ( S1 (' MetaSel (' Just "aHeaderDifficulty") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Annotated ChainDifficulty a)) :*: S1 (' MetaSel (' Just "headerProtocolVersion") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ProtocolVersion )))) :*: (( S1 (' MetaSel (' Just "headerSoftwareVersion") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SoftwareVersion ) :*: ( S1 (' MetaSel (' Just "aHeaderProof") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Annotated Proof a)) :*: S1 (' MetaSel (' Just "headerGenesisKey") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 VerificationKey ))) :*: ( S1 (' MetaSel (' Just "headerSignature") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( ABlockSignature a)) :*: ( S1 (' MetaSel (' Just "headerAnnotation") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 a) :*: S1 (' MetaSel (' Just "headerExtraAnnotation") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 a))))))
type BaseType ( AHeader ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Header Constructors

mkHeader Source #

Arguments

:: ProtocolMagicId
-> Either GenesisHash Header
-> EpochSlots

Number of slots per epoch. This is needed to convert the slot number to the legacy format used in ToSign , where a slot is identified by the epoch to which it belongs and the offset within that epoch (counted in number of slots).

-> SlotNumber
-> SigningKey

The SigningKey used for signing the block

-> Certificate

A certificate of delegation from a genesis key to the SigningKey

-> Body
-> ProtocolVersion
-> SoftwareVersion
-> Header

Smart constructor for Header

mkHeaderExplicit Source #

Arguments

:: ProtocolMagicId
-> HeaderHash

Parent

-> ChainDifficulty
-> EpochSlots

See mkHeader .

-> SlotNumber
-> SigningKey

The SigningKey used for signing the block

-> Certificate

A certificate of delegation from a genesis key to the SigningKey

-> Body
-> ProtocolVersion
-> SoftwareVersion
-> Header

Make a Header for a given slot, with a given body, parent hash, and difficulty. This takes care of some signing and consensus data.

Header Accessors

Header Binary Serialization

toCBORHeader :: EpochSlots -> Header -> Encoding Source #

Encode a header, without taking in to account deprecated epoch boundary blocks.

toCBORHeaderToHash :: EpochSlots -> Header -> Encoding Source #

Encode a Header accounting for deprecated epoch boundary blocks

This encoding is only used when hashing the header for backwards compatibility, but should not be used when serializing a header within a block

wrapHeaderBytes :: ByteString -> ByteString Source #

These bytes must be prepended when hashing raw boundary header data

In the Byron release, hashes were taken over a data type that was never directly serialized to the blockchain, so these magic bytes cannot be determined from the raw header data.

These bytes are from `encodeListLen 2 <> toCBOR (1 :: Word8)`

Header Formatting

Boundary Header

data ABoundaryHeader a Source #

Instances

Instances details
Functor ABoundaryHeader Source #
Instance details

Defined in Cardano.Chain.Block.Header

Eq a => Eq ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Show a => Show ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Generic ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

ToJSON a => ToJSON ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Decoded ( ABoundaryHeader ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

NoThunks a => NoThunks ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ( ABoundaryHeader a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type BaseType ( ABoundaryHeader ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

toCBORABoundaryHeader :: ProtocolMagicId -> ABoundaryHeader a -> Encoding Source #

Encode from a boundary header with any annotation. This does not necessarily invert fromCBORBoundaryHeader , because that decoder drops information that this encoder replaces, such as the body proof (assumes the body is empty) and the extra header data (sets it to empty map).

boundaryHeaderHashAnnotated :: ABoundaryHeader ByteString -> HeaderHash Source #

Compute the hash of a boundary block header from its annotation. It uses wrapBoundaryBytes , for the hash must be computed on the header bytes tagged with the CBOR list length and tag discriminator, which is the encoding chosen by cardano-sl.

wrapBoundaryBytes :: ByteString -> ByteString Source #

These bytes must be prepended when hashing raw boundary header data

In the Byron release, hashes were taken over a data type that was never directly serialized to the blockchain, so these magic bytes cannot be determined from the raw header data.

HeaderHash

hashHeader :: EpochSlots -> Header -> HeaderHash Source #

Hash the serialised representation of a Header

For backwards compatibility we have to take the hash of the header serialised with toCBORHeaderToHash

genesisHeaderHash :: GenesisHash -> HeaderHash Source #

Extract the genesis hash and cast it into a header hash.

BlockSignature

data ABlockSignature a Source #

Signature of the Block

We use a heavyweight delegation scheme, so the signature has two parts:

  1. A delegation certificate from a genesis key to the block signer
  2. The actual signature over ToSign

Instances

Instances details
Functor ABlockSignature Source #
Instance details

Defined in Cardano.Chain.Block.Header

ToCBOR BlockSignature Source #
Instance details

Defined in Cardano.Chain.Block.Header

FromCBOR BlockSignature Source #
Instance details

Defined in Cardano.Chain.Block.Header

Buildable BlockSignature Source #
Instance details

Defined in Cardano.Chain.Block.Header

Eq a => Eq ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Show a => Show ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

Generic ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

NFData a => NFData ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

ToJSON a => ToJSON ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

FromCBOR ( ABlockSignature ByteSpan ) Source #
Instance details

Defined in Cardano.Chain.Block.Header

NoThunks a => NoThunks ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ( ABlockSignature a) Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ( ABlockSignature a) = D1 (' MetaData "ABlockSignature" "Cardano.Chain.Block.Header" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "ABlockSignature" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "delegationCertificate") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( ACertificate a)) :*: S1 (' MetaSel (' Just "signature") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Signature ToSign ))))

ToSign

data ToSign Source #

Data to be signed in Block

Instances

Instances details
Eq ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

Show ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

Generic ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

ToCBOR ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

FromCBOR ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

type Rep ToSign Source #
Instance details

Defined in Cardano.Chain.Block.Header

dropBoundaryExtraHeaderDataRetainGenesisTag :: Decoder s Bool Source #

When starting a new chain in ourorobos-consensus, we often start from a non-zero epoch. This is done in order to ensure synchronisation between nodes - we assume that the chain started at some fixed point in the past (e.g. midnight) which all nodes can agree on despite different node start times. However, the standard deserialisation assumes that the genesis EBB is precisely that in epoch zero.

In order to successfully round-trip a genesis EBB in a non-zero epoch, then, we add a "magic" tag which indicates the presense of the genesis hash. The choice of 255 and the word Genesis is completely arbitrary, and only done to correspond with the matching encoder. This encoding will only ever be seen when processing blocks from a demo.

type Body = ABody () Source #

Body consists of payloads of all block components

data ABody a Source #

Body consists of payloads of all block components

Constructors

ABody

Fields

Instances

Instances details
Functor ABody Source #
Instance details

Defined in Cardano.Chain.Block.Body

ToCBOR Body Source #
Instance details

Defined in Cardano.Chain.Block.Body

FromCBOR Body Source #
Instance details

Defined in Cardano.Chain.Block.Body

Eq a => Eq ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

Show a => Show ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

Generic ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

Associated Types

type Rep ( ABody a) :: Type -> Type Source #

NFData a => NFData ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

Methods

rnf :: ABody a -> () Source #

ToJSON a => ToJSON ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

FromCBOR ( ABody ByteSpan ) Source #
Instance details

Defined in Cardano.Chain.Block.Body

type Rep ( ABody a) Source #
Instance details

Defined in Cardano.Chain.Block.Body

Block

data ABlock a Source #

Instances

Instances details
Functor ABlock Source #
Instance details

Defined in Cardano.Chain.Block.Block

Eq a => Eq ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Show a => Show ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Generic ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Associated Types

type Rep ( ABlock a) :: Type -> Type Source #

NFData a => NFData ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Methods

rnf :: ABlock a -> () Source #

ToJSON a => ToJSON ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Buildable ( WithEpochSlots Block ) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Block Constructors

mkBlock Source #

Arguments

:: ProtocolMagicId
-> ProtocolVersion
-> SoftwareVersion
-> Either GenesisHash Header
-> EpochSlots
-> SlotNumber
-> SigningKey

The SigningKey used for signing the block

-> Certificate

A certificate of delegation from a genesis key to the SigningKey

-> Body
-> Block

Smart constructor for Block

mkBlockExplicit Source #

Arguments

:: ProtocolMagicId
-> ProtocolVersion
-> SoftwareVersion
-> HeaderHash
-> ChainDifficulty
-> EpochSlots
-> SlotNumber
-> SigningKey

The SigningKey used for signing the block

-> Certificate

A certificate of delegation from a genesis key to the SigningKey

-> Body
-> Block

Smart constructor for Block , without requiring the entire previous Header . Instead, you give its hash and the difficulty of this block. These are derived from the previous header in mkBlock so if you have the previous header, consider using that one.

Block Accessors

Block Binary Serialization

toCBORBlock :: EpochSlots -> Block -> Encoding Source #

Encode a block, given a number of slots-per-epoch.

Unlike toCBORABOBBlock , this function does not take the deprecated epoch boundary blocks into account.

Block Formatting

ABlockOrBoundary

data ABlockOrBoundary a Source #

Instances

Instances details
Functor ABlockOrBoundary Source #
Instance details

Defined in Cardano.Chain.Block.Block

Eq a => Eq ( ABlockOrBoundary a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Show a => Show ( ABlockOrBoundary a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Generic ( ABlockOrBoundary a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

ToJSON a => ToJSON ( ABlockOrBoundary a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABlockOrBoundary a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

toCBORABOBBlock :: EpochSlots -> ABlock a -> Encoding Source #

Encode a Block accounting for deprecated epoch boundary blocks

fromCBORABOBBlock :: EpochSlots -> Decoder s ( Maybe Block ) Source #

Decode a Block accounting for deprecated epoch boundary blocks

fromCBORABlockOrBoundary :: EpochSlots -> Decoder s ( ABlockOrBoundary ByteSpan ) Source #

Decode a Block accounting for deprecated epoch boundary blocks

Previous versions of Cardano had an explicit boundary block between epochs. A Block was then represented as 'Either BoundaryBlock MainBlock'. We have now deprecated these explicit boundary blocks, but we still need to decode blocks in the old format. In the case that we find a boundary block, we drop it using dropBoundaryBlock and return a Nothing .

ABoundaryBlock

data ABoundaryBlock a Source #

For a boundary block, we keep the header, body, and an annotation for the whole thing (commonly the bytes from which it was decoded).

Instances

Instances details
Functor ABoundaryBlock Source #
Instance details

Defined in Cardano.Chain.Block.Block

Eq a => Eq ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Show a => Show ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Generic ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

ToJSON a => ToJSON ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Decoded ( ABoundaryBlock ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Buildable ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABoundaryBlock a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type BaseType ( ABoundaryBlock ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Block

boundaryHashAnnotated :: ABoundaryBlock ByteString -> HeaderHash Source #

Extract the hash of a boundary block from its annotation.

toCBORABOBBoundary :: ProtocolMagicId -> ABoundaryBlock a -> Encoding Source #

toCBORABoundaryBlock but with the list length and tag discriminator bytes.

boundaryBlockSlot Source #

Arguments

:: EpochSlots
-> Word64

Epoch number

-> SlotNumber

Compute the slot number assigned to a boundary block

data ABoundaryBody a Source #

For boundary body data, we only keep an annotation. It's the body and extra body data.

Instances

Instances details
Functor ABoundaryBody Source #
Instance details

Defined in Cardano.Chain.Block.Block

Eq a => Eq ( ABoundaryBody a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Show a => Show ( ABoundaryBody a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Generic ( ABoundaryBody a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

ToJSON a => ToJSON ( ABoundaryBody a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Decoded ( ABoundaryBody ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABoundaryBody a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABoundaryBody a) = D1 (' MetaData "ABoundaryBody" "Cardano.Chain.Block.Block" "cardano-ledger-byron-0.1.0.0-1U5kXR8zMRrE7QjCz70XVD" ' False ) ( C1 (' MetaCons "ABoundaryBody" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "boundaryBodyAnnotation") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 a)))
type BaseType ( ABoundaryBody ByteString ) Source #
Instance details

Defined in Cardano.Chain.Block.Block

ABlockOrBoundaryHdr

data ABlockOrBoundaryHdr a Source #

Instances

Instances details
Functor ABlockOrBoundaryHdr Source #
Instance details

Defined in Cardano.Chain.Block.Block

Eq a => Eq ( ABlockOrBoundaryHdr a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Show a => Show ( ABlockOrBoundaryHdr a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

Generic ( ABlockOrBoundaryHdr a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

NoThunks a => NoThunks ( ABlockOrBoundaryHdr a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

type Rep ( ABlockOrBoundaryHdr a) Source #
Instance details

Defined in Cardano.Chain.Block.Block

toCBORABlockOrBoundaryHdr :: ABlockOrBoundaryHdr ByteString -> Encoding Source #

Encoder for ABlockOrBoundaryHdr which is using the annotation. It is right inverse of fromCBORAblockOrBoundaryHdr .

TODO: add a round trip test, e.g.

fromCBORABlockOrBoundaryHdr . toCBORABlockOrBoundaryHdr = id

which does not type check, but convey the meaning.

abobHdrSlotNo :: EpochSlots -> ABlockOrBoundaryHdr a -> SlotNumber Source #

Slot number of the header

NOTE: Epoch slot number calculation must match the one in applyBoundary .