Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- mockChainAndNetwork :: forall m. (MonadTimer m, MonadAsync m, MonadMask m, MonadThrow (STM m), MonadLabelledSTM m, MonadFork m, MonadDelay m) => Tracer m DirectChainLog -> [(SigningKey HydraKey, CardanoSigningKey)] -> UTxO -> m (SimulatedChainNetwork Tx m)
- fixedTimeHandleIndefiniteHorizon :: Gen TimeHandle
- scriptLedger :: Ledger Tx
- findOwnCardanoKey :: Party -> [(SigningKey HydraKey, CardanoSigningKey)] -> (VerificationKey PaymentKey, [VerificationKey PaymentKey])
- createMockNetwork :: MonadSTM m => DraftHydraNode Tx m -> TVar m [MockHydraNode m] -> Network m (Message Tx)
- data MockHydraNode m = MockHydraNode {
- node :: HydraNode Tx m
- chainHandler :: ChainSyncHandler m
- createMockChain :: (MonadTimer m, MonadThrow (STM m)) => Tracer m DirectChainLog -> ChainContext -> SubmitTx m -> m TimeHandle -> TxIn -> LocalChainState m Tx -> Chain Tx m
- flushQueue :: MonadSTM m => TQueue m a -> STM m [a]
Documentation
mockChainAndNetwork :: forall m. (MonadTimer m, MonadAsync m, MonadMask m, MonadThrow (STM m), MonadLabelledSTM m, MonadFork m, MonadDelay m) => Tracer m DirectChainLog -> [(SigningKey HydraKey, CardanoSigningKey)] -> UTxO -> m (SimulatedChainNetwork Tx m) Source #
Create a mocked chain which connects nodes through ChainSyncHandler
and
Chain
interfaces. It calls connected chain sync handlers $sel:onRollForward:ChainSyncHandler
on
every blockTime
and performs $sel:rollbackAndForward:SimulatedChainNetwork
every couple blocks.
fixedTimeHandleIndefiniteHorizon :: Gen TimeHandle Source #
Construct fixed TimeHandle
that starts from 0 and has the era horizon far in the future.
This is used in our Model
tests and we want to make sure the tests finish before
the horizon is reached to prevent the PastHorizon
exceptions.
scriptLedger :: Ledger Tx Source #
A trimmed down ledger whose only purpose is to validate on-chain scripts.
findOwnCardanoKey :: Party -> [(SigningKey HydraKey, CardanoSigningKey)] -> (VerificationKey PaymentKey, [VerificationKey PaymentKey]) Source #
Find Cardano vkey corresponding to our Hydra vkey using signing keys lookup.
This is a bit cumbersome and a tribute to the fact the HydraNode
itself has no
direct knowlege of the cardano keys which are stored only at the ChainComponent
level.
createMockNetwork :: MonadSTM m => DraftHydraNode Tx m -> TVar m [MockHydraNode m] -> Network m (Message Tx) Source #
data MockHydraNode m Source #
MockHydraNode | |
|
createMockChain :: (MonadTimer m, MonadThrow (STM m)) => Tracer m DirectChainLog -> ChainContext -> SubmitTx m -> m TimeHandle -> TxIn -> LocalChainState m Tx -> Chain Tx m Source #
flushQueue :: MonadSTM m => TQueue m a -> STM m [a] Source #