cardano-node-emulator-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Cardano.Node.Emulator.Internal.Node.Chain

Synopsis

Documentation

data ChainEvent Source #

Events produced by the blockchain emulator.

Constructors

TxnValidation !ValidationResult

A transaction has been validated and added to the blockchain.

SlotAdd !Slot 

Instances

Instances details
Eq ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Show ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Generic ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Associated Types

type Rep ChainEvent :: Type -> Type Source #

FromJSON ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Methods

parseJSON :: Value -> Parser ChainEvent

parseJSONList :: Value -> Parser [ChainEvent]

ToJSON ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Methods

toJSON :: ChainEvent -> Value

toEncoding :: ChainEvent -> Encoding

toJSONList :: [ChainEvent] -> Value

toEncodingList :: [ChainEvent] -> Encoding

Pretty ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Methods

pretty :: ChainEvent -> Doc ann

prettyList :: [ChainEvent] -> Doc ann

type Rep ChainEvent Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

type Rep ChainEvent = D1 ('MetaData "ChainEvent" "Cardano.Node.Emulator.Internal.Node.Chain" "cardano-node-emulator-1.2.0.0-1RjxyDmnwHSAn2KgGdAUXD" 'False) (C1 ('MetaCons "TxnValidation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ValidationResult)) :+: C1 ('MetaCons "SlotAdd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Slot)))

type TxPool = [CardanoTx] Source #

A pool of transactions which have yet to be validated.

data ChainState Source #

Constructors

ChainState 

Fields

Instances

Instances details
Show ChainState Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Generic ChainState Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

Associated Types

type Rep ChainState :: Type -> Type Source #

type Rep ChainState Source # 
Instance details

Defined in Cardano.Node.Emulator.Internal.Node.Chain

type Rep ChainState = D1 ('MetaData "ChainState" "Cardano.Node.Emulator.Internal.Node.Chain" "cardano-node-emulator-1.2.0.0-1RjxyDmnwHSAn2KgGdAUXD" 'False) (C1 ('MetaCons "ChainState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_chainNewestFirst") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Blockchain) :*: S1 ('MetaSel ('Just "_txPool") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TxPool)) :*: (S1 ('MetaSel ('Just "_index") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UtxoIndex) :*: S1 ('MetaSel ('Just "_chainCurrentSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Slot))))

index :: Lens' ChainState UtxoIndex Source #

chainNewestFirst :: Lens' ChainState Blockchain Source #

data ChainControlEffect r where Source #

Constructors

ProcessBlock :: ChainControlEffect Block 
ModifySlot :: (Slot -> Slot) -> ChainControlEffect Slot 

data ChainEffect r where Source #

Constructors

QueueTx :: CardanoTx -> ChainEffect () 
GetCurrentSlot :: ChainEffect Slot 
GetParams :: ChainEffect Params 

processBlock :: Member ChainControlEffect effs => Eff effs Block Source #

Make a new block

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

Adjust the current slot number, returning the new slot.

queueTx :: Member ChainEffect effs => CardanoTx -> Eff effs () Source #

getParams :: Member ChainEffect effs => Eff effs Params Source #

getCurrentSlot :: Member ChainEffect effs => Eff effs Slot Source #

type ChainEffs = '[State ChainState, LogMsg ChainEvent] Source #

handleControlChain :: Members ChainEffs effs => Params -> ChainControlEffect ~> Eff effs Source #

logEvent :: Member (LogMsg ChainEvent) effs => ChainEvent -> Eff effs () Source #

handleChain :: Members ChainEffs effs => Params -> ChainEffect ~> Eff effs Source #

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

data ValidationCtx Source #

Constructors

ValidationCtx 

Fields

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.

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

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

validateEm :: MonadState ValidationCtx m => Slot -> CardanoTx -> m ValidationResult Source #

Validate a transaction in the current emulator state.

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

Adds a block to ChainState, without validation.

_SlotAdd :: Prism' ChainEvent Slot Source #

_TxnValidation :: Prism' ChainEvent ValidationResult Source #