Modulecardano-ledger-shelley-test-1.9.0.0Haskell2010
Test.Cardano.Ledger.Shelley.Generator.EraGen
Infrastructure for generating STS Traces over any Era
- 4 types
- 3 classes
- 5 values
- Packagecardano-ledger-shelley-test-1.9.0.0
- Exports12
- LanguageHaskell2010
- LicenceApache-2.0
- SourceEraGen.hs
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 whereMethods
genGenesisValue :: GenEnv c era -> Gen (Value era)Generate a genesis value for the Era
genEraTwoPhase3Arg :: [TwoPhase3ArgInfo era]A list of three-phase scripts that can be chosen for payment when building a transaction
genEraTwoPhase2Arg :: [TwoPhase2ArgInfo era]A list of two-phase scripts that can be chosen for Delegating, Minting, or Rewarding when building a transaction
genEraTxBody :: GenEnv c era -> UTxO era -> PParams era -> SlotNo -> Set TxIn -> StrictSeq (TxOut era) -> StrictSeq (TxCert era) -> Withdrawals -> Coin -> StrictMaybe (Update era) -> StrictMaybe TxAuxDataHash -> Gen (TxBody TopTx era, [Script era])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))Generate era-specific auxiliary data
updateEraTxBody :: UTxO era -> PParams era -> TxWits era -> TxBody TopTx era -> Coin -> Set TxIn -> TxOut era -> TxBody TopTx eraUpdate an era-specific TxBody
addInputs :: TxBody TopTx era -> Set TxIn -> TxBody TopTx eraUnion the TxIn with the existing TxIn in the TxBody
genEraPParamsUpdate :: Constants -> PParams era -> Gen (PParamsUpdate era)genEraPParams :: Constants -> Gen (PParams era)genEraTxWits :: (UTxO era, TxBody TopTx era, ScriptInfo era) -> Set (WitVKey Witness) -> Map ScriptHash (Script era) -> TxWits eragenEraGoodTxOut :: TxOut era -> BoolconstructTx :: TxBody TopTx era -> TxWits era -> StrictMaybe (TxAuxData era) -> Tx TopTx eraConstruct a transaction given its constituent parts.
genEraScriptCost :: PParams era -> Script era -> Coincompute the delta cost of an additional script on per Era basis.
genEraDone :: UTxO era -> PParams era -> Tx TopTx era -> Gen (Tx TopTx era)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 TopTx era) -> Gen (Seq (Tx TopTx era))A final opportunity to tweak things at the block level. Possible uses 2) Run a test that might decide to
discardthe test, because we got unlucky, and a rare unfixible condition has occurred.hasFailedScripts :: Tx TopTx era -> BoolfeeOrCollateral :: Tx TopTx era -> UTxO era -> Coin
Instances1EraGen
EraGen ShelleyEraDefined in cardano-ledger-shelley-test-1.9.0.0 · Test.Cardano.Ledger.Shelley.Generator.ShelleyEraGen · orphan
type MinLEDGER_STS era = (Environment (EraRule "LEDGERS"
era) ~ ShelleyLedgersEnv era, BaseM (EraRule "LEDGER"
era) ~ ShelleyBase, Signal (EraRule "LEDGER"
era) ~ StAnnTx 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))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)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) ~ StAnnTx TopTx era, State (EraRule "UTXO"
era) ~ UTxOState era, Environment (EraRule "UTXO"
era) ~ UtxoEnv era, Signal (EraRule "UTXO"
era) ~ StAnnTx TopTx era)Minimal requirements on the UTxO instances
Methods
calcEraMinUTxO :: TxOut era -> PParams era -> CoinaddValToTxOut :: Value era -> TxOut era -> TxOut eragenEraTxOut :: GenEnv c era -> Gen (Value era) -> [Addr] -> Gen [TxOut era]
Instances1MinGenTxout
MinGenTxout ShelleyEraDefined in cardano-ledger-shelley-test-1.9.0.0 · Test.Cardano.Ledger.Shelley.Generator.ShelleyEraGen · orphan
Select between _lower_ and _upper_ keys from keyPairs
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.