cardano-ledger-shelley-test-1.4.0.1: 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 #

genesisIdHashAlgorithm (HASH c) ⇒ TxId c 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 (TxIn (EraCrypto era)) → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals (EraCrypto era) → CoinStrictMaybe (Update era) → StrictMaybe (AuxiliaryDataHash (EraCrypto era)) → Gen (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 (EraCrypto era))

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 (TxIn (EraCrypto era)) → TxBody 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 (EraCrypto era)) → Map (ScriptHash (EraCrypto era)) (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
(PraosCrypto c, Signable (DSIGN c) ~ SignableRepresentation, Signable (KES c) ~ SignableRepresentation) ⇒ EraGen (ShelleyEra c) Source # 
Instance details

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

Methods

genGenesisValueGenEnv (ShelleyEra c) → Gen (Value (ShelleyEra c)) Source #

genEraTwoPhase3Arg ∷ [TwoPhase3ArgInfo (ShelleyEra c)] Source #

genEraTwoPhase2Arg ∷ [TwoPhase2ArgInfo (ShelleyEra c)] Source #

genEraTxBodyGenEnv (ShelleyEra c) → UTxO (ShelleyEra c) → PParams (ShelleyEra c) → SlotNoSet (TxIn (EraCrypto (ShelleyEra c))) → StrictSeq (TxOut (ShelleyEra c)) → StrictSeq (TxCert (ShelleyEra c)) → Withdrawals (EraCrypto (ShelleyEra c)) → CoinStrictMaybe (Update (ShelleyEra c)) → StrictMaybe (AuxiliaryDataHash (EraCrypto (ShelleyEra c))) → Gen (TxBody (ShelleyEra c), [Script (ShelleyEra c)]) Source #

genEraAuxiliaryDataConstantsGen (StrictMaybe (TxAuxData (ShelleyEra c))) Source #

updateEraTxBodyUTxO (ShelleyEra c) → PParams (ShelleyEra c) → TxWits (ShelleyEra c) → TxBody (ShelleyEra c) → CoinSet (TxIn (EraCrypto (ShelleyEra c))) → TxOut (ShelleyEra c) → TxBody (ShelleyEra c) Source #

addInputsTxBody (ShelleyEra c) → Set (TxIn (EraCrypto (ShelleyEra c))) → TxBody (ShelleyEra c) Source #

genEraPParamsUpdateConstantsPParams (ShelleyEra c) → Gen (PParamsUpdate (ShelleyEra c)) Source #

genEraPParamsConstantsGen (PParams (ShelleyEra c)) Source #

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

genEraGoodTxOutTxOut (ShelleyEra c) → Bool Source #

constructTxTxBody (ShelleyEra c) → TxWits (ShelleyEra c) → StrictMaybe (TxAuxData (ShelleyEra c)) → Tx (ShelleyEra c) Source #

genEraScriptCostPParams (ShelleyEra c) → Script (ShelleyEra c) → Coin Source #

genEraDoneUTxO (ShelleyEra c) → PParams (ShelleyEra c) → Tx (ShelleyEra c) → Gen (Tx (ShelleyEra c)) Source #

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

hasFailedScriptsTx (ShelleyEra c) → Bool Source #

feeOrCollateralTx (ShelleyEra c) → UTxO (ShelleyEra c) → Coin 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 (EraCrypto era)) 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

class Show (TxOut era) ⇒ MinGenTxout era where Source #

Methods

calcEraMinUTxOTxOut era → PParams era → Coin Source #

addValToTxOutValue era → TxOut era → TxOut era Source #

genEraTxOutGenEnv era → Gen (Value era) → [Addr (EraCrypto era)] → Gen [TxOut era] Source #

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 #

someKeyPairsCrypto c ⇒ ConstantsIntIntGen (KeyPairs c) 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.