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

Test.Cardano.Ledger.Shelley.Generator.Utxo

Synopsis

Documentation

genTx ∷ ∀ era. (EraGen era, EraUTxO era, Mock (EraCrypto era), Embed (EraRule "DELPL" era) (CERTS era), Environment (EraRule "DELPL" era) ~ DelplEnv era, State (EraRule "DELPL" era) ~ CertState era, Signal (EraRule "DELPL" era) ~ TxCert era) ⇒ GenEnv era → LedgerEnv era → LedgerState era → Gen (Tx era) Source #

Generates a transaction in the context of the LEDGER STS environment and state.

A generated transaction may not have sufficient spending balance and need to be discarded. In that case we try to compute a Delta, that when added (applyDelta) to the transaction, repairs it. The repair is made by adding additional inputs from which more Ada can flow into the fee. If that doesn't fix it, we add more inputs to the Delta. Experience shows that this converges quite quickly (in traces we never saw more than 3 iterations).

data Delta era Source #

Collect additional inputs (and witnesses and keys and scripts) to make the transaction balance.

Constructors

Delta 

Fields

Instances

Instances details
Show (Delta era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Shelley.Generator.Utxo

Methods

showsPrecIntDelta era → ShowS Source #

showDelta era → String Source #

showList ∷ [Delta era] → ShowS Source #

(EraTxOut era, Eq (TxWits era)) ⇒ Eq (Delta era) Source #
  • We need this instance to know when delta has stopped growing. We don't actually need to compare all the fields, because if the extraInputs has not changed then the Scripts and keys will not have changed.
Instance details

Defined in Test.Cardano.Ledger.Shelley.Generator.Utxo

Methods

(==)Delta era → Delta era → Bool Source #

(/=)Delta era → Delta era → Bool Source #

encodedLen ∷ ∀ era t. (Era era, EncCBOR t) ⇒ t → Integer Source #

pickRandomFromMapIntMap k t → Gen [(k, t)] Source #

Select n random key value pairs from the supplied map. Order of keys with respect to each other will also be random, i.e. not sorted.