cardano-ledger-test-9.9.9.9: Testing harness, tests and benchmarks for Shelley style cardano ledgers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Synopsis

Documentation

data TraceState era Source #

Constructors

TraceState !Int !(Env era) 

newtype TraceM era x Source #

Constructors

TraceM (StateT (TraceState era) (ExceptT [String] Gen) x) 

Instances

Instances details
MonadFail (TraceM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Methods

failStringTraceM era a Source #

Applicative (TraceM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Methods

pure ∷ a → TraceM era a Source #

(<*>)TraceM era (a → b) → TraceM era a → TraceM era b Source #

liftA2 ∷ (a → b → c) → TraceM era a → TraceM era b → TraceM era c Source #

(*>)TraceM era a → TraceM era b → TraceM era b Source #

(<*)TraceM era a → TraceM era b → TraceM era a Source #

Functor (TraceM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Methods

fmap ∷ (a → b) → TraceM era a → TraceM era b Source #

(<$) ∷ a → TraceM era b → TraceM era a Source #

Monad (TraceM era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Methods

(>>=)TraceM era a → (a → TraceM era b) → TraceM era b Source #

(>>)TraceM era a → TraceM era b → TraceM era b Source #

return ∷ a → TraceM era a Source #

runTraceMIntEnv era → TraceM era a → Gen (a, Int, Env era) Source #

fstTriple ∷ (a, b, c) → a Source #

toGenTraceM era a → Gen a Source #

failTrace ∷ [String] → TraceM era a Source #

liftTypedTyped a → TraceM era a Source #

liftGenGen a → TraceM era a Source #

getEnvTraceM era (Env era) Source #

putEnvEnv era → TraceM era (Env era) Source #

putCountIntTraceM era () Source #

liftCounter ∷ ((Int, a) → Gen (Int, b)) → a → TraceM era b Source #

getTermTerm era a → TraceM era a Source #

Lookup the value of a Term in the Env internal to TraceM.

getTargetRootTarget era r a → TraceM era a Source #

fromMapTermTerm era (Map k a) → TraceM era (k, a) Source #

Pick a random (key,value) pair from a Map

fromMapTermSuchThatTerm era (Map k a) → ((k, a) → Bool) → TraceM era (k, a) Source #

Pick a random (key,value) pair from a Map such that the (key,value) pair meets predicate p

fromSetTermTerm era (Set b) → TraceM era b Source #

Pick a random element from a Set

update ∷ (Env era → TraceM era (Env era)) → TraceM era () Source #

Update the Env internal to TraceM.

updateVarTerm era t → (t → t) → TraceM era () Source #

Update the value of one variable stored in the Env internal to TraceM.

setVarTerm era t → t → TraceM era () Source #

refInputsProof era → TxBody era → Set (TxIn (EraCrypto era)) Source #

reqSigProof era → TxBody era → Set (KeyHash 'Witness (EraCrypto era)) Source #

compileTraceWithSubstEra era ⇒ OrderInfoSubst era → [Pred era] → TraceM era (DependGraph era) Source #

Compile [Pred era] in the TraceM monad First: Apply the Rewriter Second: appy the Subst Third: Construct the DependGraph

toolChainTraceEra era ⇒ Proof era → OrderInfo → [Pred era] → Subst era → TraceM era (Subst era) Source #

Use the tool chain to generate a Subst from a list of Pred, in the TraceM monad.

universeTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

pparamsTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

utxoTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

pstateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

vstateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

dstateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

ledgerStateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

epochStateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

newEpochStateTraceReflect era ⇒ Proof era → Subst era → TraceM era (Subst era) Source #

makeTraceIntTraceM era a → TraceM era [(Env era, a)] Source #

Iterate a function make to make a trace of length n. Each call to make gets the most recent value of the Env internal to TraceM. The function make is supposed to compute a, and (possibly) update the Env internal to TraceM.

data TraceStep era a Source #

Constructors

TraceStep 

Fields

beforeAfterTraceInt → (IntTraceM era a) → TraceM era [TraceStep era a] Source #

genLedgerStateEnvReflect era ⇒ Proof era → TraceM era (Env era) Source #

Generate an Env that contains the pieces of the LedgerState by chaining smaller pieces together.

genNewEpochStateEnvReflect era ⇒ Proof era → TraceM era (Env era) Source #

Generate an Env that contains the pieces of the NewEpochState by chaining smaller pieces together.

data PredGen era Source #

How we encode a trace, when we run STS of (MOCKCHAIN era)

Constructors

PredGen (Vector (StrictSeq (Tx era), SlotNo)) (Env era) 

Instances

Instances details
Reflect era ⇒ Show (PredGen era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Methods

showsPrecIntPredGen era → ShowS Source #

showPredGen era → String Source #

showList ∷ [PredGen era] → ShowS Source #

(STS (MOCKCHAIN era), Reflect era) ⇒ HasTrace (MOCKCHAIN era) (PredGen era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Trace.TraceMonad

Associated Types

type BaseEnv (MOCKCHAIN era) Source #

Methods

interpretSTSHasCallStackBaseEnv (MOCKCHAIN era) → BaseM (MOCKCHAIN era) a → a Source #

envGenPredGen era → Gen (Environment (MOCKCHAIN era)) Source #

sigGenPredGen era → Environment (MOCKCHAIN era) → State (MOCKCHAIN era) → Gen (Signal (MOCKCHAIN era)) Source #

shrinkSignalSignal (MOCKCHAIN era) → [Signal (MOCKCHAIN era)] Source #

genTracePartsReflect era ⇒ Proof era → Int → (Proof era → TraceM era (Tx era)) → TraceM era ([TraceStep era (Tx era)], Maybe (IRC (MOCKCHAIN era) → Gen (Either a (MockChainState era))), PredGen era) Source #

traceStepToVector ∷ (step → Tx era) → [step] → Word64 → [([Tx era], SlotNo)] → TraceM era (Vector (StrictSeq (Tx era), SlotNo)) Source #

newStsTrace ∷ (Reflect era, STS (MOCKCHAIN era)) ⇒ Proof era → Int → (Proof era → TraceM era (Tx era)) → Gen (Trace (MOCKCHAIN era)) Source #

Generate a Control.State.Transition.Trace(Trace) from a (TraceM era (Tx era))

mockChainProp ∷ ∀ era. (Reflect era, STS (MOCKCHAIN era)) ⇒ Proof era → Int → (Proof era → TraceM era (Tx era)) → (Trace (MOCKCHAIN era) → Property) → Property Source #

Create a testable Property from two things 1) A function that generates Tx 2) A function that creates a property from a (Trace (MOCKCHAIN era))

stepProp ∷ (MockChainState era → MockBlock era → MockChainState era → Property) → Trace (MOCKCHAIN era) → Property Source #

Given trace [(sig0,state0),(sig1,state1),(sig2,state2),(sig3,state3)] conjoin [p pstate0 sig1 state1, p state0 sig2 state2, p state0 sig3 state3] test that p holds between state0 and stateN for all N

deltaProp ∷ (MockChainState era → MockBlock era → MockChainState era → Property) → Trace (MOCKCHAIN era) → Property Source #

Given trace [(sig0,state0),(sig1,state1),(sig2,state2),(sig3,state3)] conjoin [p pstate0 sig1 state1, p state1 sig2 state2, p state2 sig3 state3] test that p holds bteween (state0 stateN sig(N+1) state(N+1) for all N

preserveProp ∷ (MockChainState era → MockChainState era → Property) → Trace (MOCKCHAIN era) → Property Source #

Given trace [(sig0,state0),(sig1,state1),(sig2,state2),(sig3,state3)] test that (p state0 stateN), where stateN is the last state in the trace

epochPropConwayEraGov era ⇒ (MockChainState era → MockChainState era → Property) → Trace (MOCKCHAIN era) → Property Source #

Apply '(preserveProp p)' to each full Epoch in a Trace. A partial epoch at the end of the trace is not tested.