cardano-ledger-byron-1.0.1.0: The blockchain layer of Cardano during the Byron era
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Chain.Block.Validation

Contents

Synopsis

Documentation

adoptedProtocolParametersStateProtocolParameters Source #

Adopted protocol parameters

updateBody ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ BodyEnvironmentBodyStateABlock 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.

epochTransitionEpochEnvironmentStateSlotNumberState 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) ⇒ StateAHeader ByteString → m () Source #

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

updateBlock ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ ConfigChainValidationStateABlock 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 BodyState Source #

Constructors

BodyState 

Fields

data ChainValidationState Source #

Constructors

ChainValidationState 

Fields

Instances

Instances details
Generic ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Associated Types

type Rep ChainValidationStateTypeType Source #

Show ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

FromCBOR ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

ToCBOR ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

DecCBOR ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

EncCBOR ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

NFData ChainValidationState Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Methods

rnfChainValidationState → () Source #

Eq 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

type Rep ChainValidationState = D1 ('MetaData "ChainValidationState" "Cardano.Chain.Block.Validation" "cardano-ledger-byron-1.0.1.0-inplace" 'False) (C1 ('MetaCons "ChainValidationState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cvsLastSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNumber) :*: S1 ('MetaSel ('Just "cvsPreviousHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Either GenesisHash HeaderHash))) :*: (S1 ('MetaSel ('Just "cvsUtxo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UTxO) :*: (S1 ('MetaSel ('Just "cvsUpdateState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 State) :*: S1 ('MetaSel ('Just "cvsDelegationState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 State)))))

initialChainValidationStateMonadError 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

newtype HeapSize a Source #

Size of a heap value, in words

Constructors

HeapSize 

Fields

Instances

Instances details
Show (HeapSize a) Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Buildable (HeapSize a) Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Methods

buildHeapSize a → Builder Source #

newtype UTxOSize Source #

Number of entries in the UTxO

Constructors

UTxOSize 

Fields

Instances

Instances details
Show UTxOSize Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Buildable UTxOSize Source # 
Instance details

Defined in Cardano.Chain.Block.Validation

Methods

buildUTxOSizeBuilder Source #

foldUTxOEnvironmentUTxOStream (Of (ABlock ByteString)) (ExceptT ParseError ResIO) () → ExceptT Error (ReaderT ValidationMode ResIO) UTxO Source #

Fold transaction validation over a Stream of Blocks

foldUTxOBlockEnvironmentUTxOABlock ByteStringExceptT Error (ReaderT ValidationMode ResIO) UTxO Source #

Fold updateUTxO over the transactions in a single Block