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

Test.Cardano.Ledger.Shelley.Generator.EraGen

Description

Infrastructure for generating STS Traces over any Era

Synopsis

Documentation

genUtxo0 ∷ ∀ era. EraGen era ⇒ GenEnv era → Gen (UTxO era) Source #

genesisIdTxId Source #

We share this dummy TxId as genesis transaction id across eras

class (EraSegWits era, ShelleyEraTxBody era, Split (Value era), ScriptClass era, EraPParams era, MinGenTxout era, Default (StashedAVVMAddresses era)) ⇒ EraGen era where Source #

Methods

genGenesisValueGenEnv era → Gen (Value era) Source #

Generate a genesis value for the Era

genEraTwoPhase3Arg ∷ [TwoPhase3ArgInfo era] Source #

A list of three-phase scripts that can be chosen for payment when building a transaction

genEraTwoPhase2Arg ∷ [TwoPhase2ArgInfo era] Source #

A list of two-phase scripts that can be chosen for Delegating, Minting, or Rewarding when building a transaction

genEraTxBodyGenEnv era → UTxO era → PParams era → SlotNoSet TxInStrictSeq (TxOut era) → StrictSeq (TxCert era) → WithdrawalsCoinStrictMaybe (Update era) → StrictMaybe TxAuxDataHashGen (TxBody era, [Script era]) Source #

Given some pre-generated data, generate an era-specific TxBody, and a list of additional scripts for eras that sometimes require additional script witnessing.

genEraAuxiliaryDataConstantsGen (StrictMaybe (TxAuxData era)) Source #

Generate era-specific auxiliary data

updateEraTxBody Source #

Arguments

UTxO era 
PParams era 
TxWits era 
TxBody era 
Coin 
Set TxIn

This overrides the existing TxFee

TxOut era

This is to be Unioned with the existing TxIn

TxBody era

This is to be Appended to the end of the existing TxOut

Update an era-specific TxBody

addInputsTxBody era → Set TxInTxBody era Source #

Union the TxIn with the existing TxIn in the TxBody

genEraPParamsUpdateConstantsPParams era → Gen (PParamsUpdate era) Source #

genEraPParamsConstantsGen (PParams era) Source #

genEraTxWits ∷ (UTxO era, TxBody era, ScriptInfo era) → Set (WitVKey 'Witness) → Map ScriptHash (Script era) → TxWits era Source #

genEraGoodTxOutTxOut era → Bool Source #

constructTxTxBody era → TxWits era → StrictMaybe (TxAuxData era) → Tx era Source #

Construct a transaction given its constituent parts.

genEraScriptCostPParams era → Script era → Coin Source #

compute the delta cost of an additional script on per Era basis.

genEraDoneUTxO era → PParams era → Tx era → Gen (Tx era) Source #

A final opportunity to tweak things when the generator is done. Possible uses 1) Add tracing when debugging on a per Era basis

genEraTweakBlockPParams era → Seq (Tx era) → Gen (Seq (Tx era)) Source #

A final opportunity to tweak things at the block level. Possible uses 2) Run a test that might decide to discard the test, because we got unlucky, and a rare unfixible condition has occurred.

hasFailedScriptsTx era → Bool Source #

feeOrCollateralTx era → UTxO era → Coin Source #

Instances

Instances details
EraGen ShelleyEra Source # 
Instance details

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

Methods

genGenesisValueGenEnv ShelleyEraGen (Value ShelleyEra) Source #

genEraTwoPhase3Arg ∷ [TwoPhase3ArgInfo ShelleyEra] Source #

genEraTwoPhase2Arg ∷ [TwoPhase2ArgInfo ShelleyEra] Source #

genEraTxBodyGenEnv ShelleyEraUTxO ShelleyEraPParams ShelleyEraSlotNoSet TxInStrictSeq (TxOut ShelleyEra) → StrictSeq (TxCert ShelleyEra) → WithdrawalsCoinStrictMaybe (Update ShelleyEra) → StrictMaybe TxAuxDataHashGen (TxBody ShelleyEra, [Script ShelleyEra]) Source #

genEraAuxiliaryDataConstantsGen (StrictMaybe (TxAuxData ShelleyEra)) Source #

updateEraTxBodyUTxO ShelleyEraPParams ShelleyEraTxWits ShelleyEraTxBody ShelleyEraCoinSet TxInTxOut ShelleyEraTxBody ShelleyEra Source #

addInputsTxBody ShelleyEraSet TxInTxBody ShelleyEra Source #

genEraPParamsUpdateConstantsPParams ShelleyEraGen (PParamsUpdate ShelleyEra) Source #

genEraPParamsConstantsGen (PParams ShelleyEra) Source #

genEraTxWits ∷ (UTxO ShelleyEra, TxBody ShelleyEra, ScriptInfo ShelleyEra) → Set (WitVKey 'Witness) → Map ScriptHash (Script ShelleyEra) → TxWits ShelleyEra Source #

genEraGoodTxOutTxOut ShelleyEraBool Source #

constructTxTxBody ShelleyEraTxWits ShelleyEraStrictMaybe (TxAuxData ShelleyEra) → Tx ShelleyEra Source #

genEraScriptCostPParams ShelleyEraScript ShelleyEraCoin Source #

genEraDoneUTxO ShelleyEraPParams ShelleyEraTx ShelleyEraGen (Tx ShelleyEra) Source #

genEraTweakBlockPParams ShelleyEraSeq (Tx ShelleyEra) → Gen (Seq (Tx ShelleyEra)) Source #

hasFailedScriptsTx ShelleyEraBool Source #

feeOrCollateralTx ShelleyEraUTxO ShelleyEraCoin Source #

type MinLEDGER_STS era = (Environment (EraRule "LEDGERS" era) ~ ShelleyLedgersEnv era, BaseM (EraRule "LEDGER" era) ~ ShelleyBase, Signal (EraRule "LEDGER" era) ~ Tx era, State (EraRule "LEDGER" era) ~ LedgerState era, Environment (EraRule "LEDGER" era) ~ LedgerEnv era, BaseM (EraRule "LEDGERS" era) ~ ShelleyBase, State (EraRule "LEDGERS" era) ~ LedgerState era, Signal (EraRule "LEDGERS" era) ~ Seq (Tx era), STS (EraRule "LEDGER" era)) Source #

Minimal requirements on the LEDGER and LEDGERS instances

type MinCHAIN_STS era = (STS (CHAIN era), BaseM (CHAIN era) ~ ShelleyBase, Environment (CHAIN era) ~ (), State (CHAIN era) ~ ChainState era, Signal (CHAIN era) ~ Block (BHeader MockCrypto) era) Source #

Minimal requirements on the CHAIN instances

type MinUTXO_STS era = (STS (EraRule "UTXOW" era), BaseM (EraRule "UTXOW" era) ~ ShelleyBase, State (EraRule "UTXOW" era) ~ UTxOState era, Environment (EraRule "UTXOW" era) ~ UtxoEnv era, Signal (EraRule "UTXOW" era) ~ Tx era, State (EraRule "UTXO" era) ~ UTxOState era, Environment (EraRule "UTXO" era) ~ UtxoEnv era, Signal (EraRule "UTXO" era) ~ Tx era) Source #

Minimal requirements on the UTxO instances

data Label t where Source #

Constructors

Body'Label (TxBody era) 
Wits'Label (TxWits era) 

class Sets (x ∷ Label t) y where Source #

Methods

setLabel t → y → y Source #

someKeyPairsConstants → (Int, Int) → Gen KeyPairs Source #

Select between _lower_ and _upper_ keys from keyPairs

allScripts ∷ ∀ era. EraGen era ⇒ Constants → [(Script era, Script era)] Source #

A list of all possible kinds of scripts in the current Era. Might include Keylocked scripts, Start-Finish Timelock scripts, Quantified scripts (All, Any, MofN), Plutus Scripts Note that genEraTwoPhase3Arg and genEraTwoPhase2Arg may be the empty list ([]) in some Eras.

mkDummyHash ∷ (HashAlgorithm h, EncCBOR a) ⇒ a → Hash h b Source #

It is possible to use a hash of a binary representation of any type as a source of randomness, since hash value by its definiteion is uniformly distributed.