cardano-node-emulator-1.2.0.0
Safe Haskell None
Language Haskell2010

Cardano.Node.Emulator.Chain

Synopsis

Documentation

data ChainEvent Source #

Events produced by the blockchain emulator.

Constructors

TxnValidate TxId CardanoTx [ Text ]

A transaction has been validated and added to the blockchain.

TxnValidationFail ValidationPhase TxId CardanoTx ValidationError Value [ Text ]

A transaction failed to validate. The Value indicates the amount of collateral stored in the transaction.

SlotAdd Slot

Instances

Instances details
Eq ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

Show ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

Generic ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

ToJSON ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

FromJSON ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

Pretty ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

type Rep ChainEvent Source #
Instance details

Defined in Cardano.Node.Emulator.Chain

type Rep ChainEvent = D1 (' MetaData "ChainEvent" "Cardano.Node.Emulator.Chain" "cardano-node-emulator-1.2.0.0-AoNv3krP7ndKjYjVelWOdO" ' False ) ( C1 (' MetaCons "TxnValidate" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxId ) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 CardanoTx) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Text ]))) :+: ( C1 (' MetaCons "TxnValidationFail" ' PrefixI ' False ) (( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ValidationPhase) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxId ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 CardanoTx))) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ValidationError) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Value ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Text ])))) :+: C1 (' MetaCons "SlotAdd" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Slot))))

type TxPool = [CardanoTx] Source #

A pool of transactions which have yet to be validated.

data ChainState Source #

Constructors

ChainState

Fields

modifySlot :: Member ChainControlEffect effs => (Slot -> Slot) -> Eff effs Slot Source #

Adjust the current slot number, returning the new slot.

data ValidatedBlock Source #

The result of validating a block.

Constructors

ValidatedBlock

Fields

  • vlbValid :: Block

    The transactions that have been validated in this block.

  • vlbEvents :: [ ChainEvent ]

    Transaction validation events for the transactions in this block.

  • vlbIndex :: UtxoIndex

    The updated UTxO index after processing the block

validateBlock :: Params -> Slot -> UtxoIndex -> TxPool -> ValidatedBlock Source #

Validate a block given the current slot and UTxO index, returning the valid transactions, success/failure events and the updated UTxO set.

getCollateral :: UtxoIndex -> CardanoTx -> Value Source #

canValidateNow :: Slot -> CardanoTx -> Bool Source #

Check whether the given transaction can be validated in the given slot.

mkValidationEvent :: UtxoIndex -> CardanoTx -> Either ValidationErrorInPhase ValidationSuccess -> ChainEvent Source #

validateEm :: MonadState ValidationCtx m => Slot -> CardanoTx -> m ( Either ValidationErrorInPhase ValidationSuccess) Source #

Validate a transaction in the current emulator state.

addBlock :: Block -> ChainState -> ChainState Source #

Adds a block to ChainState, without validation.

_TxnValidationFail :: Prism' ChainEvent (ValidationPhase, TxId , CardanoTx, ValidationError, Value , [ Text ]) Source #