Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- predsTests ∷ TestTree
- txBodySize ∷ ∀ era. Reflect era ⇒ TxBody era → Int
- byteSize ∷ ∀ era a. (EncCBOR a, Reflect era) ⇒ Proof era → a → Int
- byteSizeT ∷ ∀ era a. (EncCBOR a, Reflect era) ⇒ Term era a → Target era Int
- txFL ∷ Lens' (TxF era) (Tx era)
- computeFinalFee ∷ EraUTxO era ⇒ PParamsF era → TxF era → Map (TxIn (EraCrypto era)) (TxOutF era) → Coin
- integrityHash ∷ Era era1 ⇒ Proof era1 → Term era2 (PParamsF era1) → Term era2 (Set Language) → Term era2 (Map (PlutusPointerF era1) (Data era1, ExUnits)) → Term era2 (Map (DataHash (EraCrypto era1)) (Data era1)) → Target era2 (Maybe (ScriptIntegrityHash (EraCrypto era1)))
- needT ∷ ∀ era. EraUTxO era ⇒ Proof era → Target era (TxBodyF era → Map (TxIn (EraCrypto era)) (TxOutF era) → ScriptsNeededF era)
- rdmrPtrsT ∷ AlonzoEraScript era ⇒ Target era ([(PlutusPurposeF era, ScriptHash (EraCrypto era))] → Map (ScriptHash (EraCrypto era)) any → Set (PlutusPointerF era))
- getRdmrPtrs ∷ AlonzoEraScript era ⇒ [(PlutusPurposeF era, ScriptHash (EraCrypto era))] → Map (ScriptHash (EraCrypto era)) any → Set (PlutusPointerF era)
- getPlutusDataHashes ∷ (AlonzoEraTxOut era, EraTxBody era, AlonzoEraScript era) ⇒ Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyF era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Set (DataHash (EraCrypto era))
- bootWitsT ∷ ∀ era. Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyF era → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Set (BootstrapWitness (EraCrypto era))
- hashBody ∷ ∀ era. Proof era → TxBody era → Hash (EraCrypto era) EraIndependentTxBody
- sufficientGenDelegs ∷ Map k (GenDelegPair c) → Set (KeyHash 'Witness c)
- sufficientTxCert ∷ ∀ era. Reflect era ⇒ [TxCertF era] → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era))
- sufficientScriptKeys ∷ Proof era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Set (KeyHash 'Witness (EraCrypto era))
- sufficientKeyHashes ∷ Reflect era ⇒ Proof era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → [TxCertF era] → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era))
- pcUtxo ∷ Reflect era ⇒ Map (TxIn (EraCrypto era)) (TxOutF era) → String
- pcUtxoDoc ∷ Reflect era ⇒ Map (TxIn (EraCrypto era)) (TxOutF era) → PDoc
- necessaryKeyHashTarget ∷ ∀ era. Reflect era ⇒ Term era (TxBodyF era) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Target era (Set (KeyHash 'Witness (EraCrypto era)))
- necessaryKeyHashes ∷ ∀ era. Reflect era ⇒ TxBodyF era → Map (TxIn (EraCrypto era)) (TxOutF era) → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era))
- makeKeyWitnessTarget ∷ Reflect era ⇒ Term era (TxBodyF era) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Term era (Map (ScriptHash (EraCrypto era)) (ScriptF era)) → Term era (Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey)) → Target era (Set (WitVKey 'Witness (EraCrypto era)))
- makeKeyWitness ∷ ∀ era. Reflect era ⇒ TxBodyF era → Set (KeyHash 'Witness (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) → Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)) → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Set (WitVKey 'Witness (EraCrypto era))
- allValid ∷ [IsValid] → IsValid
- scriptWitsLangs ∷ Map k (ScriptF era) → Set Language
- adjustNeededByRefScripts ∷ Proof era → Set (TxIn (EraCrypto era)) → Set (TxIn (EraCrypto era)) → Map (TxIn (EraCrypto era)) (TxOutF era) → Set (ScriptHash (EraCrypto era)) → Set (ScriptHash (EraCrypto era))
- getUtxoCoinT ∷ Reflect era ⇒ Term era (TxIn (EraCrypto era)) → Term era (Map (TxIn (EraCrypto era)) (TxOutF era)) → Target era Coin
- getNTxOut ∷ (HasCallStack, Reflect era) ⇒ Size → TxOutF era → [TxOutF era] → [TxOutF era]
- txoutSum ∷ ∀ era t. (Foldable t, Reflect era) ⇒ t (TxOutF era) → Value era
- minusMultiValue ∷ ∀ era. Reflect era ⇒ Proof era → Value era → Value era → Map (ScriptHash (EraCrypto era)) (Map AssetName Integer)
- txBodyPreds ∷ ∀ era. (HasCallStack, Reflect era) ⇒ UnivSize → Proof era → [Pred era]
- txBodyStage ∷ Reflect era ⇒ UnivSize → Proof era → Subst era → Gen (Subst era)
- balanceMap ∷ Ord k ⇒ [(k, Coin)] → Map k t → Lens' t Coin → Map k t
- adjustFeeInput ∷ (HasCallStack, Reflect era) ⇒ Env era → Typed (Env era)
- adjustColInput ∷ (HasCallStack, Reflect era) ⇒ Env era → Typed (Gen (Env era))
- adjustC ∷ (Ord k, Show k) ⇒ [k] → Map k v → Coin → Lens' v Coin → Maybe (Map k v)
- updateVal ∷ (a → b → a) → Term era a → b → Env era → Typed (Env era)
- updateTerm ∷ (a → b → a) → Term era a → Term era b → Env era → Typed (Env era)
- updateTarget ∷ (a → b → a) → Term era a → Target era b → Env era → Typed (Env era, b)
- override ∷ x → x → x
- genTxAndLedger ∷ Reflect era ⇒ UnivSize → Proof era → Gen (LedgerState era, Tx era, Env era)
- genTxAndNewEpoch ∷ Reflect era ⇒ UnivSize → Proof era → Gen (NewEpochState era, Tx era, Env era)
- demoTxNes ∷ IO ()
- demoTx ∷ IO ()
- gone ∷ Gen (IO ())
- test ∷ Maybe Int → IO ()
- bad ∷ [Int]
- go ∷ Int → IO ()
- pgenTxBodyField ∷ Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyField era → [(Text, PDoc)]
- pgenTxBody ∷ Reflect era ⇒ Proof era → TxBody era → Map (TxIn (EraCrypto era)) (TxOutF era) → PDoc
- pgenTxField ∷ ∀ era. Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxField era → [(Text, PDoc)]
- pgenTx ∷ Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → Tx era → PDoc
- pcTxWithUTxO ∷ Reflect era ⇒ Proof era → UTxO era → Tx era → PDoc
- oneTest ∷ (Reflect era, Environment (EraRule "LEDGER" era) ~ LedgerEnv era, State (EraRule "LEDGER" era) ~ LedgerState era, Signal (EraRule "LEDGER" era) ~ Tx era, Show (PredicateFailure (EraRule "LEDGER" era))) ⇒ UnivSize → Proof era → Gen Property
- main1 ∷ IO ()
- main2 ∷ IO ()
- demo ∷ ReplMode → IO ()
- demoTest ∷ TestTree
- main ∷ IO ()
Documentation
computeFinalFee ∷ EraUTxO era ⇒ PParamsF era → TxF era → Map (TxIn (EraCrypto era)) (TxOutF era) → Coin Source #
integrityHash ∷ Era era1 ⇒ Proof era1 → Term era2 (PParamsF era1) → Term era2 (Set Language) → Term era2 (Map (PlutusPointerF era1) (Data era1, ExUnits)) → Term era2 (Map (DataHash (EraCrypto era1)) (Data era1)) → Target era2 (Maybe (ScriptIntegrityHash (EraCrypto era1))) Source #
needT ∷ ∀ era. EraUTxO era ⇒ Proof era → Target era (TxBodyF era → Map (TxIn (EraCrypto era)) (TxOutF era) → ScriptsNeededF era) Source #
"Construct the Scripts Needed to compute the Script Witnesses from the UTxO and the partial TxBody
rdmrPtrsT ∷ AlonzoEraScript era ⇒ Target era ([(PlutusPurposeF era, ScriptHash (EraCrypto era))] → Map (ScriptHash (EraCrypto era)) any → Set (PlutusPointerF era)) Source #
getRdmrPtrs ∷ AlonzoEraScript era ⇒ [(PlutusPurposeF era, ScriptHash (EraCrypto era))] → Map (ScriptHash (EraCrypto era)) any → Set (PlutusPointerF era) Source #
getPlutusDataHashes ∷ (AlonzoEraTxOut era, EraTxBody era, AlonzoEraScript era) ⇒ Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyF era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Set (DataHash (EraCrypto era)) Source #
bootWitsT ∷ ∀ era. Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyF era → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Set (BootstrapWitness (EraCrypto era)) Source #
sufficientGenDelegs ∷ Map k (GenDelegPair c) → Set (KeyHash 'Witness c) Source #
Get enough GenDeleg KeyHashes to satisfy the quorum constraint.
sufficientTxCert ∷ ∀ era. Reflect era ⇒ [TxCertF era] → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) Source #
sufficientScriptKeys ∷ Proof era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Set (KeyHash 'Witness (EraCrypto era)) Source #
Compute sufficient set of keys to make the scripts succeed.
The script map is the map of all needed
scripts. Some of those
scripts may NOT be in the scriptWits
(those which are reference scripts)
but all needed scripts will need to have their KeyHashes added.
sufficientKeyHashes ∷ Reflect era ⇒ Proof era → Map (ScriptHash (EraCrypto era)) (ScriptF era) → [TxCertF era] → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) Source #
necessaryKeyHashTarget ∷ ∀ era. Reflect era ⇒ Term era (TxBodyF era) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Target era (Set (KeyHash 'Witness (EraCrypto era))) Source #
necessaryKeyHashes ∷ ∀ era. Reflect era ⇒ TxBodyF era → Map (TxIn (EraCrypto era)) (TxOutF era) → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) Source #
Compute the needed key witnesses from a transaction body.
First find all the key hashes from every use of keys in the transaction
Then find the KeyPair's associated with those hashes, then
using the hash of the TxBody, turn the KeyPair into a witness.
In Eras Shelley to Mary, reqsigners
should be empty. In Eras Alonzo to Conway
we will need to add the witnesses for the required signer hashes, so they are
passed in. To compute the witnsses we need the hash of the TxBody. We will call this function
twice. Once when we have constructed the tempTxBody
used to estimate the fee, and a second time
with txBodyTerm
where the fee is correct.
The underlying function shelleyWitsVKeyNeeded
computes the necesary (but not sufficient)
key witnesses. The missing ones have to do with MultiSig (and Timelock) scripts and Mir
certificates (ones where isInstantaneousRewards
predicate is True). So we have to add these as well.
A MultiSig (Timelock) scripts needs witnesses for enough Signature scripts to make it True.
MIRCert needs enough witnesses from genDelegs to make the quorum constraint true.
makeKeyWitnessTarget ∷ Reflect era ⇒ Term era (TxBodyF era) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Term era (Set (KeyHash 'Witness (EraCrypto era))) → Term era (Map (ScriptHash (EraCrypto era)) (ScriptF era)) → Term era (Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey)) → Target era (Set (WitVKey 'Witness (EraCrypto era))) Source #
makeKeyWitness ∷ ∀ era. Reflect era ⇒ TxBodyF era → Set (KeyHash 'Witness (EraCrypto era)) → Set (KeyHash 'Witness (EraCrypto era)) → Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)) → Map (ScriptHash (EraCrypto era)) (ScriptF era) → Map (KeyHash 'Genesis (EraCrypto era)) (GenDelegPair (EraCrypto era)) → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Set (WitVKey 'Witness (EraCrypto era)) Source #
adjustNeededByRefScripts ∷ Proof era → Set (TxIn (EraCrypto era)) → Set (TxIn (EraCrypto era)) → Map (TxIn (EraCrypto era)) (TxOutF era) → Set (ScriptHash (EraCrypto era)) → Set (ScriptHash (EraCrypto era)) Source #
Starting in the Babbage era, we can adjust the script witnesses by not supplying
those that appear as a reference script in the UTxO resolved spending
inputs.
{- neededHashes − dom(refScripts tx utxo) = dom(txwitscripts txw) -}
This function computes the exact set of hashes that must appear in the witnesses.
getUtxoCoinT ∷ Reflect era ⇒ Term era (TxIn (EraCrypto era)) → Term era (Map (TxIn (EraCrypto era)) (TxOutF era)) → Target era Coin Source #
txoutSum ∷ ∀ era t. (Foldable t, Reflect era) ⇒ t (TxOutF era) → Value era Source #
Compute the sum of all the Values in a List(Set,Map, ...) of TxOut
minusMultiValue ∷ ∀ era. Reflect era ⇒ Proof era → Value era → Value era → Map (ScriptHash (EraCrypto era)) (Map AssetName Integer) Source #
txBodyPreds ∷ ∀ era. (HasCallStack, Reflect era) ⇒ UnivSize → Proof era → [Pred era] Source #
adjustFeeInput ∷ (HasCallStack, Reflect era) ⇒ Env era → Typed (Env era) Source #
adjustColInput ∷ (HasCallStack, Reflect era) ⇒ Env era → Typed (Gen (Env era)) Source #
Adjust UTxO image of collateral
to pay for the collateral fees. Do this by
adding extraCol
to the TxOuts associated with col inputs
adjustC ∷ (Ord k, Show k) ⇒ [k] → Map k v → Coin → Lens' v Coin → Maybe (Map k v) Source #
Adjust the part of the UTxO that maps the collateral
inputs, to pay the collateral fee.
This will adjust 1 or more of the TxOuts associated with the collateral , to make up the difference.
It may happen on rare occaisions, there is not enough Coin to make the adjustment, so return Nothing
genTxAndLedger ∷ Reflect era ⇒ UnivSize → Proof era → Gen (LedgerState era, Tx era, Env era) Source #
genTxAndNewEpoch ∷ Reflect era ⇒ UnivSize → Proof era → Gen (NewEpochState era, Tx era, Env era) Source #
pgenTxBodyField ∷ Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxBodyField era → [(Text, PDoc)] Source #
Pretty print the fields of a Randomly generated TxBody, except resolve the inputs with the given Ut map.
pgenTxBody ∷ Reflect era ⇒ Proof era → TxBody era → Map (TxIn (EraCrypto era)) (TxOutF era) → PDoc Source #
pgenTxField ∷ ∀ era. Reflect era ⇒ Proof era → Map (TxIn (EraCrypto era)) (TxOutF era) → TxField era → [(Text, PDoc)] Source #