| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Node.Emulator.Chain
Synopsis
- data ChainEvent
- type TxPool = [CardanoTx]
- data ChainState = ChainState {}
- emptyChainState :: ChainState
- txPool :: Lens' ChainState TxPool
- index :: Lens' ChainState UtxoIndex
- chainNewestFirst :: Lens' ChainState Blockchain
- chainCurrentSlot :: Lens' ChainState Slot
- 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 {}
- data ValidationCtx = ValidationCtx {}
- validateBlock :: Params -> Slot -> UtxoIndex -> TxPool -> ValidatedBlock
- getCollateral :: UtxoIndex -> CardanoTx -> Value
- canValidateNow :: Slot -> CardanoTx -> Bool
- mkValidationEvent :: UtxoIndex -> CardanoTx -> Either ValidationErrorInPhase ValidationSuccess -> ChainEvent
- validateEm :: MonadState ValidationCtx m => Slot -> CardanoTx -> m (Either ValidationErrorInPhase ValidationSuccess)
- addBlock :: Block -> ChainState -> ChainState
- addTxToPool :: CardanoTx -> TxPool -> TxPool
- _SlotAdd :: Prism' ChainEvent Slot
- _TxnValidationFail :: Prism' ChainEvent (ValidationPhase, TxId, CardanoTx, ValidationError, Value, [Text])
- _TxnValidate :: Prism' ChainEvent (TxId, CardanoTx, [Text])
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 |
| SlotAdd Slot |
Instances
data ChainState Source #
Constructors
| ChainState | |
Fields
| |
Instances
| Show ChainState Source # | |
Defined in Cardano.Node.Emulator.Chain | |
| Generic ChainState Source # | |
Defined in Cardano.Node.Emulator.Chain | |
| type Rep ChainState Source # | |
Defined in Cardano.Node.Emulator.Chain type Rep ChainState = D1 ('MetaData "ChainState" "Cardano.Node.Emulator.Chain" "cardano-node-emulator-1.1.0.0-86RbaXcxDhk56O3Y8j0lgb" 'False) (C1 ('MetaCons "ChainState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_chainNewestFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Blockchain) :*: S1 ('MetaSel ('Just "_txPool") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxPool)) :*: (S1 ('MetaSel ('Just "_index") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UtxoIndex) :*: S1 ('MetaSel ('Just "_chainCurrentSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Slot)))) | |
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.
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 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.
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 #
_TxnValidate :: Prism' ChainEvent (TxId, CardanoTx, [Text]) Source #