Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Infrastructure for generating STS Traces over any Era
Synopsis
- genUtxo0 ∷ ∀ era. EraGen era ⇒ GenEnv era → Gen (UTxO era)
- genesisId ∷ TxId
- class (EraSegWits era, ShelleyEraTxBody era, Split (Value era), ScriptClass era, EraPParams era, MinGenTxout era, Default (StashedAVVMAddresses era)) ⇒ EraGen era where
- genGenesisValue ∷ GenEnv era → Gen (Value era)
- genEraTwoPhase3Arg ∷ [TwoPhase3ArgInfo era]
- genEraTwoPhase2Arg ∷ [TwoPhase2ArgInfo era]
- genEraTxBody ∷ GenEnv era → UTxO era → PParams era → SlotNo → Set TxIn → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals → Coin → StrictMaybe (Update era) → StrictMaybe TxAuxDataHash → Gen (TxBody era, [Script era])
- genEraAuxiliaryData ∷ Constants → Gen (StrictMaybe (TxAuxData era))
- updateEraTxBody ∷ UTxO era → PParams era → TxWits era → TxBody era → Coin → Set TxIn → TxOut era → TxBody era
- addInputs ∷ TxBody era → Set TxIn → TxBody era
- genEraPParamsUpdate ∷ Constants → PParams era → Gen (PParamsUpdate era)
- genEraPParams ∷ Constants → Gen (PParams era)
- genEraTxWits ∷ (UTxO era, TxBody era, ScriptInfo era) → Set (WitVKey 'Witness) → Map ScriptHash (Script era) → TxWits era
- genEraGoodTxOut ∷ TxOut era → Bool
- constructTx ∷ TxBody era → TxWits era → StrictMaybe (TxAuxData era) → Tx era
- genEraScriptCost ∷ PParams era → Script era → Coin
- genEraDone ∷ UTxO era → PParams era → Tx era → Gen (Tx era)
- genEraTweakBlock ∷ PParams era → Seq (Tx era) → Gen (Seq (Tx era))
- hasFailedScripts ∷ Tx era → Bool
- feeOrCollateral ∷ Tx era → UTxO era → Coin
- 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))
- 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)
- 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)
- class Show (TxOut era) ⇒ MinGenTxout era where
- calcEraMinUTxO ∷ TxOut era → PParams era → Coin
- addValToTxOut ∷ Value era → TxOut era → TxOut era
- genEraTxOut ∷ GenEnv era → Gen (Value era) → [Addr] → Gen [TxOut era]
- data Label t where
- class Sets (x ∷ Label t) y where
- someKeyPairs ∷ Constants → (Int, Int) → Gen KeyPairs
- allScripts ∷ ∀ era. EraGen era ⇒ Constants → [(Script era, Script era)]
- mkDummyHash ∷ (HashAlgorithm h, EncCBOR a) ⇒ a → Hash h b
Documentation
class (EraSegWits era, ShelleyEraTxBody era, Split (Value era), ScriptClass era, EraPParams era, MinGenTxout era, Default (StashedAVVMAddresses era)) ⇒ EraGen era where Source #
genGenesisValue, genEraTxBody, genEraAuxiliaryData, updateEraTxBody, genEraPParamsUpdate, genEraPParams, genEraTxWits
genGenesisValue ∷ GenEnv 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
genEraTxBody ∷ GenEnv era → UTxO era → PParams era → SlotNo → Set TxIn → StrictSeq (TxOut era) → StrictSeq (TxCert era) → Withdrawals → Coin → StrictMaybe (Update era) → StrictMaybe TxAuxDataHash → 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.
genEraAuxiliaryData ∷ Constants → Gen (StrictMaybe (TxAuxData era)) Source #
Generate era-specific auxiliary data
∷ 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
addInputs ∷ TxBody era → Set TxIn → TxBody era Source #
Union the TxIn with the existing TxIn in the TxBody
genEraPParamsUpdate ∷ Constants → PParams era → Gen (PParamsUpdate era) Source #
genEraPParams ∷ Constants → Gen (PParams era) Source #
genEraTxWits ∷ (UTxO era, TxBody era, ScriptInfo era) → Set (WitVKey 'Witness) → Map ScriptHash (Script era) → TxWits era Source #
genEraGoodTxOut ∷ TxOut era → Bool Source #
constructTx ∷ TxBody era → TxWits era → StrictMaybe (TxAuxData era) → Tx era Source #
Construct a transaction given its constituent parts.
genEraScriptCost ∷ PParams era → Script era → Coin Source #
compute the delta cost of an additional script on per Era basis.
genEraDone ∷ UTxO 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
genEraTweakBlock ∷ PParams 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.
hasFailedScripts ∷ Tx era → Bool Source #
Instances
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
class Show (TxOut era) ⇒ MinGenTxout era where Source #
calcEraMinUTxO ∷ TxOut era → PParams era → Coin Source #
addValToTxOut ∷ Value era → TxOut era → TxOut era Source #
genEraTxOut ∷ GenEnv era → Gen (Value era) → [Addr] → Gen [TxOut era] Source #
Instances
someKeyPairs ∷ Constants → (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.