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.SimpleTx

Synopsis

Documentation

getSTSLedgerEnvReflect era ⇒ Proof era → TxIxEnv era → Typed (LedgerEnv era, LedgerState era) Source #

Given an (Env era) construct the pair the the LendgerEnv and the LedgerState

plutusFree ∷ ∀ era a. Reflect era ⇒ Map (ScriptHash (EraCrypto era)) a → TxOut era → Bool Source #

Does a TxOut have only Non-Plutus Scripts. Non-Plutus status is measured by non-membership in the Map of script hashes of all Plutus scripts.

plutusFreeValueProof era → Map (ScriptHash (EraCrypto era)) a → Value era → Bool Source #

simpleTxBodyReflect era ⇒ Proof era → CoinTraceM era [TxBodyField era] Source #

Make a simple TxBody with 1 input and 1 output. We estimate that such a TxBody will lead to a fee of less than feeEstimate. So only pick inputs from the utxo that have at least that much coin. Balance the Coin in the TxOut with the feeEstimate and the actual Coin in the UTxO output that corresponds to the input. Only works if the internal Env of the TraceM monad stores variables capable of creating the LedgerState See genLedgerStateEnv for an example of how to do that.

simpleTxReflect era ⇒ Proof era → CoinTraceM era (Tx era) Source #

Generate a (Tx era) from a simple (TxBody era), with 1 input and 1 output. Apply the "finishing" function completeTxBody to make the result a valid Tx. Only works if the internal Env of the TraceM monad stores variables capable of creating the LedgerState. The parameter maxFeeEstimate has to be chosen by experience. The fee for most simpleTx as less than 60000. But in at least one case we have seen as high as 108407. If that case happens we will discard. A large fee is rare because it is caused by many scripts and fees that need large witnesses,

completeTxBodyReflect era ⇒ Proof era → CoinTxBody era → TraceM era (Tx era) Source #

Complete a TxBody, by running a fix-point computation that 1) Adds the appropriate witnesses. 2) Adjusts the the first output to pay the estimated fee. Run the computation until both the fee and the hash of the TxBody reach a fixpoint. Only works if the internal Env of the TraceM monad stores variables capable of creating the LedgerState

addWitnesses ∷ ∀ era. Reflect era ⇒ Proof era → Map (ScriptHash (EraCrypto era)) (Script era) → Map (ScriptHash (EraCrypto era)) (IsValid, ScriptF era) → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)) → Map (DataHash (EraCrypto era)) (Data era) → TxBody era → UTxO era → GenDelegs (EraCrypto era) → Tx era Source #

Add witnesses to the TxBody to construct a Tx with the appropriate witnesses. This is a compilcated function, but it should be applicable to ANY Tx generated using the Universes.

adjustTxForFeeEraTx era ⇒ Proof era → CoinTx era → Tx era Source #

adjust a Tx for the fee, by setting the fee to the correct value then moving the excess to the outputs

feeCoinLEraTx era ⇒ Lens' (Tx era) Coin Source #