Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Ledger.ShelleyMA.Rules.Utxo
Synopsis
- scaledMinDeposit :: Val v => v -> Coin -> Coin
-
data
UtxoPredicateFailure
era
- = BadInputsUTxO !( Set ( TxIn ( Crypto era)))
- | OutsideValidityIntervalUTxO ! ValidityInterval ! SlotNo
- | MaxTxSizeUTxO ! Integer ! Integer
- | InputSetEmptyUTxO
- | FeeTooSmallUTxO ! Coin ! Coin
- | ValueNotConservedUTxO !( Value era) !( Value era)
- | WrongNetwork ! Network !( Set ( Addr ( Crypto era)))
- | WrongNetworkWithdrawal ! Network !( Set ( RewardAcnt ( Crypto era)))
- | OutputTooSmallUTxO ![ TxOut era]
- | UpdateFailure !( PredicateFailure ( EraRule "PPUP" era))
- | OutputBootAddrAttrsTooBig ![ TxOut era]
- | TriesToForgeADA
- | OutputTooBigUTxO ![ TxOut era]
- newtype UtxoEvent era = UpdateEvent ( Event ( EraRule "PPUP" era))
- consumed :: forall era. ( Era era, HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "_keyDeposit" ( PParams era) Coin ) => PParams era -> UTxO era -> TxBody era -> Value era
- utxoTransition :: forall era. ( UsesTxBody era, UsesValue era, STS ( UTXO era), Tx era ~ Tx era, Embed ( EraRule "PPUP" era) ( UTXO era), Environment ( EraRule "PPUP" era) ~ PPUPEnv era, State ( EraRule "PPUP" era) ~ PPUPState era, Signal ( EraRule "PPUP" era) ~ Maybe ( Update era), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "vldt" ( TxBody era) ValidityInterval , HasField "update" ( TxBody era) ( StrictMaybe ( Update era)), HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "_minUTxOValue" ( PParams era) Coin , HasField "_maxTxSize" ( PParams era) Natural ) => TransitionRule ( UTXO era)
- validateOutsideValidityIntervalUTxO :: HasField "vldt" ( TxBody era) ValidityInterval => SlotNo -> TxBody era -> Test ( UtxoPredicateFailure era)
- validateTriesToForgeADA :: ( Val ( Value era), HasField "mint" ( TxBody era) ( Value era)) => TxBody era -> Test ( UtxoPredicateFailure era)
- validateOutputTooBigUTxO :: ( HasField "value" ( TxOut era) ( Value era), ToCBOR ( Value era)) => UTxO era -> Test ( UtxoPredicateFailure era)
- validateOutputTooSmallUTxO :: ( HasField "_minUTxOValue" ( PParams era) Coin , HasField "value" ( TxOut era) ( Value era), Val ( Value era)) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era)
- validateValueNotConservedUTxO :: ( Era era, HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "mint" ( TxBody era) ( Value era)) => PParams era -> UTxO era -> Map ( KeyHash ' StakePool ( Crypto era)) a -> TxBody era -> Test ( UtxoPredicateFailure era)
- data UTXO era
- fromShelleyFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era)
Documentation
data UtxoPredicateFailure era Source #
Constructors
BadInputsUTxO !( Set ( TxIn ( Crypto era))) | |
OutsideValidityIntervalUTxO ! ValidityInterval ! SlotNo | |
MaxTxSizeUTxO ! Integer ! Integer | |
InputSetEmptyUTxO | |
FeeTooSmallUTxO ! Coin ! Coin | |
ValueNotConservedUTxO !( Value era) !( Value era) | |
WrongNetwork ! Network !( Set ( Addr ( Crypto era))) | |
WrongNetworkWithdrawal ! Network !( Set ( RewardAcnt ( Crypto era))) | |
OutputTooSmallUTxO ![ TxOut era] | |
UpdateFailure !( PredicateFailure ( EraRule "PPUP" era)) | |
OutputBootAddrAttrsTooBig ![ TxOut era] | |
TriesToForgeADA | |
OutputTooBigUTxO ![ TxOut era] |
Instances
consumed :: forall era. ( Era era, HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "_keyDeposit" ( PParams era) Coin ) => PParams era -> UTxO era -> TxBody era -> Value era Source #
Calculate the value consumed by the transation.
This differs from the corresponding Shelley function
Shelley.consumed
since it also considers the "mint" field which creates or destroys non-Ada
tokens.
Note that this is slightly confusing, since it also covers non-Ada assets _created_ by the transaction, depending on the sign of the quantities in the mint field.
utxoTransition :: forall era. ( UsesTxBody era, UsesValue era, STS ( UTXO era), Tx era ~ Tx era, Embed ( EraRule "PPUP" era) ( UTXO era), Environment ( EraRule "PPUP" era) ~ PPUPEnv era, State ( EraRule "PPUP" era) ~ PPUPState era, Signal ( EraRule "PPUP" era) ~ Maybe ( Update era), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "vldt" ( TxBody era) ValidityInterval , HasField "update" ( TxBody era) ( StrictMaybe ( Update era)), HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "_minUTxOValue" ( PParams era) Coin , HasField "_maxTxSize" ( PParams era) Natural ) => TransitionRule ( UTXO era) Source #
The UTxO transition rule for the Shelley-MA (Mary and Allegra) eras.
validateOutsideValidityIntervalUTxO :: HasField "vldt" ( TxBody era) ValidityInterval => SlotNo -> TxBody era -> Test ( UtxoPredicateFailure era) Source #
Ensure the transaction is within the validity window.
ininterval slot (txvld tx)
validateTriesToForgeADA :: ( Val ( Value era), HasField "mint" ( TxBody era) ( Value era)) => TxBody era -> Test ( UtxoPredicateFailure era) Source #
Check that the mint field does not try to mint ADA. This is equivalent to the check:
adaPolicy ∉ supp mint tx
validateOutputTooBigUTxO :: ( HasField "value" ( TxOut era) ( Value era), ToCBOR ( Value era)) => UTxO era -> Test ( UtxoPredicateFailure era) Source #
Ensure that there are no
TxOut
s that have
Value
of size larger than
MaxValSize
∀ txout ∈ txouts txb, serSize (getValue txout) ≤ MaxValSize
validateOutputTooSmallUTxO :: ( HasField "_minUTxOValue" ( PParams era) Coin , HasField "value" ( TxOut era) ( Value era), Val ( Value era)) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era) Source #
Ensure that there are no
TxOut
s that have value less than the scaled
minUTxOValue
∀ txout ∈ txouts txb, getValue txout ≥ inject (scaledMinDeposit v (minUTxOValue pp))
validateValueNotConservedUTxO :: ( Era era, HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "mint" ( TxBody era) ( Value era)) => PParams era -> UTxO era -> Map ( KeyHash ' StakePool ( Crypto era)) a -> TxBody era -> Test ( UtxoPredicateFailure era) Source #
Ensure that value consumed and produced matches up exactly. Note that this
is different from Shelley, since implementation of
consumed
has changed.
consumed pp utxo txb = produced pp poolParams txb
Instances
fromShelleyFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era) Source #