ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Mempool.Util

Synopsis

Documentation

type TestBlock = SimpleBftBlock SimpleMockCrypto BftMockCrypto Source #

applyTxToLedgerLedgerConfig TestBlockLedgerState TestBlock ValuesMKTestTxExcept TestTxError (LedgerState TestBlock ValuesMK) Source #

Apply a transaction to the ledger

We don't have blocks in this test, but transactions only. In this function we pretend the transaction is a block, apply it to the UTxO, and then update the tip of the ledger state, incrementing the slot number and faking a hash.

bumpTipLedgerState TestBlock ValuesMKLedgerState TestBlock ValuesMK Source #

Advance the ledger tip by one slot while keeping the UTxO unchanged.

Unlike applyTxToLedger, this consumes no inputs, so any transaction that was valid against the input state is still valid against the result. This is exactly the base change needed to make a mempool sync do real work without invalidating any of the transactions it already holds.

genLargeInvalidTxTheMeasureGen TestTx Source #

Generate an invalid tx that is larger than the given measure.

genTxs Source #

Arguments

Int

The number of transactions to generate

LedgerState TestBlock ValuesMK 
Gen ([(TestTx, Bool)], LedgerState TestBlock ValuesMK) 

Generate a number of valid and invalid transactions and apply the valid transactions to the given LedgerState. The transactions along with a Bool indicating whether its valid (True) or invalid (False) and the resulting LedgerState are returned.

genValidTxLedgerState TestBlock ValuesMKGen (TestTx, LedgerState TestBlock ValuesMK) Source #

Generate a valid transaction (but ignoring any per-tx size limits, see Note [Transaction size limit]).

genValidTxs Source #

Arguments

Int

The number of valid transactions to generate

LedgerState TestBlock ValuesMK 
Gen ([TestTx], LedgerState TestBlock ValuesMK) 

Generate a number of valid transactions and apply these to the given LedgerState. The transactions and the resulting LedgerState are returned.

mkTestLedgerConfig ∷ MockConfig → LedgerConfig TestBlock Source #

Test config

(We don't really care about these values here)