cardano-ledger-shelley-test-1.4.0.3: Test helpers from cardano-ledger-shelley exposed to other packages
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Shelley.Rules.TestChain

Synopsis

Documentation

delegTraceFromBlock ∷ ∀ era. (ChainProperty era, ShelleyEraTxBody era, EraSegWits era) ⇒ ChainState era → Block (BHeader (EraCrypto era)) era → (DelegEnv era, Trace (ShelleyDELEG era)) Source #

Reconstruct a DELEG trace from all the transaction certificates in a Block

forAllChainTrace ∷ ∀ era prop. (Testable prop, EraGen era, HasTrace (CHAIN era) (GenEnv era), EraGov era) ⇒ Word64Constants → (Trace (CHAIN era) → prop) → Property Source #

ledgerTraceFromBlock ∷ ∀ era ledger. (ChainProperty era, EraSegWits era, TestingLedger era ledger) ⇒ ChainState era → Block (BHeader (EraCrypto era)) era → (ChainState era, Trace ledger) Source #

Reconstruct a LEDGER trace from the transactions in a Block and ChainState

ledgerTraceFromBlockWithRestrictedUTxO ∷ ∀ era ledger. (ChainProperty era, EraSegWits era, TestingLedger era ledger) ⇒ ChainState era → Block (BHeader (EraCrypto era)) era → (UTxO era, Trace ledger) Source #

This function is nearly the same as ledgerTraceFromBlock, but it restricts the UTxO state to only those needed by the block. It also returns the unused UTxO for comparison later.

chainSstWithTick ∷ ∀ era. ChainProperty era ⇒ Trace (CHAIN era) → [SourceSignalTarget (CHAIN era)] Source #

Transform the [(source, signal, target)] of a CHAIN Trace by manually applying the Chain TICK Rule to each source and producing [(source, signal, target')].

This allows for testing properties on Chain traces while excluding the effects of Transactions and Certificates. For example we can check that pools that are due for retirement at an epoch transition, are indeed retired.

Had we not excluded the effects of Transactions/Certificates, we might have a pool that was correctly retired, but is again registered by a certificate in the block following the transition.

poolTraceFromBlock ∷ ∀ era. (ChainProperty era, ShelleyEraTxBody era, EraSegWits era) ⇒ ChainState era → Block (BHeader (EraCrypto era)) era → (ChainState era, Trace (ShelleyPOOL era)) Source #

Reconstruct a POOL trace from the transactions in a Block and ChainState

type TestingLedger era ledger = (BaseM ledger ~ ReaderT Globals Identity, Environment ledger ~ LedgerEnv era, State ledger ~ LedgerState era, Signal ledger ~ Tx era, Embed (EraRule "DELEGS" era) ledger, Embed (EraRule "UTXOW" era) ledger, STS ledger) Source #

splitTrace ∷ (State s → State s → Bool) → Trace s → [Trace s] Source #

Split a Trace into several shorter traces. The leftmost Trace (at the front of the list) might be ill-formed, depending on what p does.

forEachEpochTrace ∷ ∀ era prop. (EraGen era, Testable prop, HasTrace (CHAIN era) (GenEnv era), EraGov era) ⇒ IntWord64Constants → (Trace (CHAIN era) → prop) → Property Source #

Test a property on the first subtracecount sub-Traces that end on an EpochBoundary

shortChainTrace ∷ ∀ era. (EraGen era, HasTrace (CHAIN era) (GenEnv era), EraGov era) ⇒ Constants → (SourceSignalTarget (CHAIN era) → Property) → Property Source #

Properties on really short chains, with only 100 successes