Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ChainEvent
- = TxnValidation !ValidationResult
- | SlotAdd !Slot
- chainEventOnChainTx :: ChainEvent -> Maybe OnChainTx
- type TxPool = [CardanoTx]
- data ChainState = ChainState {
- _chainNewestFirst :: !Blockchain
- _txPool :: !TxPool
- _index :: !UtxoIndex
- _chainCurrentSlot :: !Slot
- txPool :: Lens' ChainState TxPool
- index :: Lens' ChainState UtxoIndex
- chainNewestFirst :: Lens' ChainState Blockchain
- chainCurrentSlot :: Lens' ChainState Slot
- emptyChainState :: ChainState
- fromBlockchain :: Blockchain -> ChainState
- data ChainControlEffect r where
- ProcessBlock :: ChainControlEffect Block
- ModifySlot :: (Slot -> Slot) -> ChainControlEffect Slot
- data ChainEffect r where
- QueueTx :: CardanoTx -> ChainEffect ()
- GetCurrentSlot :: ChainEffect Slot
- GetParams :: ChainEffect Params
- processBlock :: Member ChainControlEffect effs => Eff effs Block
- modifySlot :: Member ChainControlEffect effs => (Slot -> Slot) -> Eff effs Slot
- queueTx :: Member ChainEffect effs => CardanoTx -> Eff effs ()
- getParams :: Member ChainEffect effs => Eff effs Params
- getCurrentSlot :: Member ChainEffect effs => Eff effs Slot
- type ChainEffs = '[State ChainState, LogMsg ChainEvent]
- handleControlChain :: Members ChainEffs effs => Params -> ChainControlEffect ~> Eff effs
- logEvent :: Member (LogMsg ChainEvent) effs => ChainEvent -> Eff effs ()
- handleChain :: Members ChainEffs effs => Params -> ChainEffect ~> Eff effs
- data ValidatedBlock = ValidatedBlock {
- vlbValid :: !Block
- vlbEvents :: ![ChainEvent]
- vlbIndex :: !UtxoIndex
- data ValidationCtx = ValidationCtx {
- vctxIndex :: !UtxoIndex
- vctxParams :: !Params
- validateBlock :: Params -> Slot -> UtxoIndex -> TxPool -> ValidatedBlock
- canValidateNow :: Slot -> CardanoTx -> Bool
- validateEm :: MonadState ValidationCtx m => Slot -> CardanoTx -> m ValidationResult
- addBlock :: Block -> ChainState -> ChainState
- addTxToPool :: CardanoTx -> ChainState -> ChainState
- _SlotAdd :: Prism' ChainEvent Slot
- _TxnValidation :: Prism' ChainEvent ValidationResult
Documentation
data ChainEvent Source #
Events produced by the blockchain emulator.
TxnValidation !ValidationResult | A transaction has been validated and added to the blockchain. |
SlotAdd !Slot |
Instances
chainEventOnChainTx :: ChainEvent -> Maybe OnChainTx Source #
data ChainState Source #
ChainState | |
|
Instances
Show ChainState Source # | |
Defined in Cardano.Node.Emulator.Internal.Node.Chain | |
Generic ChainState Source # | |
Defined in Cardano.Node.Emulator.Internal.Node.Chain from :: ChainState -> Rep ChainState x Source # to :: Rep ChainState x -> ChainState Source # | |
type Rep ChainState Source # | |
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)))) |
txPool :: Lens' ChainState TxPool Source #
index :: Lens' ChainState UtxoIndex Source #
chainNewestFirst :: Lens' ChainState Blockchain Source #
chainCurrentSlot :: Lens' ChainState Slot Source #
fromBlockchain :: Blockchain -> ChainState Source #
data ChainControlEffect r where Source #
ProcessBlock :: ChainControlEffect Block | |
ModifySlot :: (Slot -> Slot) -> ChainControlEffect Slot |
data ChainEffect r where Source #
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.
ValidatedBlock | |
|
data ValidationCtx Source #
ValidationCtx | |
|
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.
addTxToPool :: CardanoTx -> ChainState -> ChainState Source #
_SlotAdd :: Prism' ChainEvent Slot Source #
_TxnValidation :: Prism' ChainEvent ValidationResult Source #