cardano-ledger-shelley-test-1.8.0.0: Test helpers from cardano-ledger-shelley exposed to other packages
Safe HaskellNone
LanguageHaskell2010

Test.Cardano.Ledger.Shelley.Generator.EraGen

Description

Infrastructure for generating STS Traces over any Era

Synopsis

Documentation

genUtxo0EraGen era ⇒ GenEnv c era → Gen (UTxO era) Source #

genesisIdTxId Source #

We share this dummy TxId as genesis transaction id across eras

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

Methods

genGenesisValueGenEnv c 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 c era → UTxO era → PParams era → SlotNoSet TxInStrictSeq (TxOut era) → StrictSeq (TxCert era) → WithdrawalsCoinStrictMaybe (Update era) → StrictMaybe TxAuxDataHashGen (TxBody 'TopTx 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 'TopTx era 
Coin 
Set TxIn

This overrides the existing TxFee

TxOut era

This is to be Unioned with the existing TxIn

TxBody 'TopTx era

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

Update an era-specific TxBody

addInputsTxBody 'TopTx era → Set TxInTxBody 'TopTx 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 'TopTx era, ScriptInfo era) → Set (WitVKey 'Witness) → Map ScriptHash (Script era) → TxWits era Source #

genEraGoodTxOutTxOut era → Bool Source #

constructTxTxBody 'TopTx era → TxWits era → StrictMaybe (TxAuxData era) → Tx 'TopTx 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 'TopTx era → Gen (Tx 'TopTx 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 'TopTx era) → Gen (Seq (Tx 'TopTx 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 'TopTx era → Bool Source #

feeOrCollateralTx 'TopTx era → UTxO era → Coin Source #

Instances

Instances details
EraGen ShelleyEra Source # 
Instance details

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

Methods

genGenesisValueGenEnv c ShelleyEraGen (Value ShelleyEra) Source #

genEraTwoPhase3Arg ∷ [TwoPhase3ArgInfo ShelleyEra] Source #

genEraTwoPhase2Arg ∷ [TwoPhase2ArgInfo ShelleyEra] Source #

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

genEraAuxiliaryDataConstantsGen (StrictMaybe (TxAuxData ShelleyEra)) Source #

updateEraTxBodyUTxO ShelleyEraPParams ShelleyEraTxWits ShelleyEraTxBody 'TopTx ShelleyEraCoinSet TxInTxOut ShelleyEraTxBody 'TopTx ShelleyEra Source #

addInputsTxBody 'TopTx ShelleyEraSet TxInTxBody 'TopTx ShelleyEra Source #

genEraPParamsUpdateConstantsPParams ShelleyEraGen (PParamsUpdate ShelleyEra) Source #

genEraPParamsConstantsGen (PParams ShelleyEra) Source #

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

genEraGoodTxOutTxOut ShelleyEraBool Source #

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

genEraScriptCostPParams ShelleyEraScript ShelleyEraCoin Source #

genEraDoneUTxO ShelleyEraPParams ShelleyEraTx 'TopTx ShelleyEraGen (Tx 'TopTx ShelleyEra) Source #

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

hasFailedScriptsTx 'TopTx ShelleyEraBool Source #

feeOrCollateralTx 'TopTx ShelleyEraUTxO ShelleyEraCoin Source #

type MinLEDGER_STS era = (Environment (EraRule "LEDGERS" era) ~ ShelleyLedgersEnv era, BaseM (EraRule "LEDGER" era) ~ ShelleyBase, Signal (EraRule "LEDGER" era) ~ Tx 'TopTx 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 'TopTx 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 'TopTx era, State (EraRule "UTXO" era) ~ UTxOState era, Environment (EraRule "UTXO" era) ~ UtxoEnv era, Signal (EraRule "UTXO" era) ~ Tx 'TopTx era) Source #

Minimal requirements on the UTxO instances

data Label t where Source #

Constructors

Body' ∷ ∀ era. Label (TxBody 'TopTx era) 
Wits' ∷ ∀ era. 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

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