Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Transaction generator for testing
Synopsis
- class TxGen blk where
- type TxGenExtra blk ∷ Type
- testGenTxs ∷ CoreNodeId → NumCoreNodes → SlotNo → TopLevelConfig blk → TxGenExtra blk → LedgerState blk → Gen [GenTx blk]
- newtype WrapTxGenExtra blk = WrapTxGenExtra {
- unwrapTxGenExtra ∷ TxGenExtra blk
- testGenTxsHfc ∷ ∀ xs. (All TxGen xs, CanHardFork xs) ⇒ CoreNodeId → NumCoreNodes → SlotNo → TopLevelConfig (HardForkBlock xs) → NP WrapTxGenExtra xs → LedgerState (HardForkBlock xs) → Gen [GenTx (HardForkBlock xs)]
Documentation
class TxGen blk where Source #
type TxGenExtra blk ∷ Type Source #
Extra information required to generate transactions
type TxGenExtra blk = ()
testGenTxs ∷ CoreNodeId → NumCoreNodes → SlotNo → TopLevelConfig blk → TxGenExtra blk → LedgerState blk → Gen [GenTx blk] Source #
Generate a number of transactions, valid or invalid, that can be submitted to a node's Mempool.
This function will be called to generate transactions in consensus tests.
Note: this function returns a list so that an empty list can be returned
in case we are unable to generate transactions for a blk
.
Implementation for HFC
newtype WrapTxGenExtra blk Source #
Newtypes wrapper around the TxGenExtra
type family so that it can be
partially applied.
testGenTxsHfc ∷ ∀ xs. (All TxGen xs, CanHardFork xs) ⇒ CoreNodeId → NumCoreNodes → SlotNo → TopLevelConfig (HardForkBlock xs) → NP WrapTxGenExtra xs → LedgerState (HardForkBlock xs) → Gen [GenTx (HardForkBlock xs)] Source #
Function that can be used for TxGen
instances for HardForkBlock
.
We don't provide a generic instance of TxGen
because it might be desirable
to provide custom implementations for specific instantiations of the eras of
HardForkBlock
. Instead, we provide this function that can be used when a
generic implemenation is desired.
Choose NP WrapTxGenExtra xs
for the instance of the TxGenExtra
type
family, where xs
matches the concrete instantiation.