Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- adoptedProtocolParameters ∷ State → ProtocolParameters
- updateBody ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ BodyEnvironment → BodyState → ABlock ByteString → m BodyState
- updateChainBlockOrBoundary ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ Config → ChainValidationState → ABlockOrBoundary ByteString → m ChainValidationState
- updateChainBoundary ∷ MonadError ChainValidationError m ⇒ ChainValidationState → ABoundaryBlock ByteString → m ChainValidationState
- epochTransition ∷ EpochEnvironment → State → SlotNumber → State
- headerIsValid ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ State → AHeader ByteString → m ()
- validateHeaderMatchesBody ∷ MonadError ProofValidationError m ⇒ AHeader ByteString → ABody ByteString → m ()
- updateBlock ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ Config → ChainValidationState → ABlock ByteString → m ChainValidationState
- data BodyState = BodyState {
- utxo ∷ !UTxO
- updateState ∷ !State
- delegationState ∷ !State
- data BodyEnvironment = BodyEnvironment {}
- data EpochEnvironment = EpochEnvironment {}
- data ChainValidationState = ChainValidationState {}
- initialChainValidationState ∷ MonadError Error m ⇒ Config → m ChainValidationState
- data ChainValidationError
- = ChainValidationBoundaryTooLarge
- | ChainValidationBlockAttributesTooLarge
- | ChainValidationBlockTooLarge Natural Natural
- | ChainValidationHeaderAttributesTooLarge
- | ChainValidationHeaderTooLarge Natural Natural
- | ChainValidationDelegationPayloadError Text
- | ChainValidationInvalidDelegation VerificationKey VerificationKey
- | ChainValidationGenesisHashMismatch GenesisHash GenesisHash
- | ChainValidationExpectedGenesisHash GenesisHash HeaderHash
- | ChainValidationExpectedHeaderHash HeaderHash GenesisHash
- | ChainValidationInvalidHash HeaderHash HeaderHash
- | ChainValidationMissingHash HeaderHash
- | ChainValidationUnexpectedGenesisHash HeaderHash
- | ChainValidationInvalidSignature BlockSignature
- | ChainValidationDelegationSchedulingError Error
- | ChainValidationProtocolMagicMismatch ProtocolMagicId ProtocolMagicId
- | ChainValidationSignatureLight
- | ChainValidationTooManyDelegations VerificationKey
- | ChainValidationUpdateError SlotNumber Error
- | ChainValidationUTxOValidationError UTxOValidationError
- | ChainValidationProofValidationError ProofValidationError
- newtype HeapSize a = HeapSize {}
- newtype UTxOSize = UTxOSize {}
- calcUTxOSize ∷ UTxO → (HeapSize UTxO, UTxOSize)
- foldUTxO ∷ Environment → UTxO → Stream (Of (ABlock ByteString)) (ExceptT ParseError ResIO) () → ExceptT Error (ReaderT ValidationMode ResIO) UTxO
- foldUTxOBlock ∷ Environment → UTxO → ABlock ByteString → ExceptT Error (ReaderT ValidationMode ResIO) UTxO
Documentation
adoptedProtocolParameters ∷ State → ProtocolParameters Source #
Adopted protocol parameters
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.
updateChainBlockOrBoundary ∷ (MonadError ChainValidationError m, MonadReader ValidationMode m) ⇒ Config → ChainValidationState → ABlockOrBoundary ByteString → m ChainValidationState Source #
updateChainBoundary ∷ MonadError ChainValidationError m ⇒ ChainValidationState → ABoundaryBlock ByteString → m ChainValidationState Source #
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
validateHeaderMatchesBody ∷ MonadError ProofValidationError m ⇒ AHeader ByteString → ABody ByteString → m () Source #
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.
BodyState | |
|
data BodyEnvironment Source #
data EpochEnvironment Source #
data ChainValidationState Source #
ChainValidationState | |
|
Instances
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 #
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 |
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. |
Instances
UTxO
Number of entries in the UTxO
foldUTxO ∷ Environment → UTxO → Stream (Of (ABlock ByteString)) (ExceptT ParseError ResIO) () → ExceptT Error (ReaderT ValidationMode ResIO) UTxO Source #
Fold transaction validation over a Stream
of Block
s
foldUTxOBlock ∷ Environment → UTxO → ABlock ByteString → ExceptT Error (ReaderT ValidationMode ResIO) UTxO Source #
Fold updateUTxO
over the transactions in a single Block