Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- utxoEntrySize :: ( Era era, HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c))) => TxOut era -> Integer
- data AlonzoUTXO era
-
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]
- | UtxosFailure ( PredicateFailure ( EraRule "UTXOS" era))
- | OutputBootAddrAttrsTooBig ![ TxOut era]
- | TriesToForgeADA
- | OutputTooBigUTxO ![( Integer , Integer , TxOut era)]
- | InsufficientCollateral ! Coin ! Coin
- | ScriptsNotPaidUTxO !( UTxO era)
- | ExUnitsTooBigUTxO ! ExUnits ! ExUnits
- | CollateralContainsNonADA !( Value era)
- | WrongNetworkInTxBody ! Network ! Network
- | OutsideForecast ! SlotNo
- | TooManyCollateralInputs ! Natural ! Natural
- | NoCollateralInputs
- newtype UtxoEvent era = UtxosEvent ( Event ( EraRule "UTXOS" era))
- isKeyHashAddr :: Addr crypto -> Bool
- isKeyHashCompactAddr :: CompactAddr crypto -> Bool
- vKeyLocked :: Era era => TxOut era -> Bool
- feesOK :: forall era. ( Era era, Tx era ~ ValidatedTx era, HasField "collateral" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "txrdmrs" ( Witnesses era) ( Redeemers era), HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "_prices" ( PParams era) Prices , HasField "_collateralPercentage" ( PParams era) Natural ) => PParams era -> Tx era -> UTxO era -> Test ( UtxoPredicateFailure era)
- validateCollateral :: ( Era era, HasField "_collateralPercentage" ( PParams era) Natural ) => PParams era -> TxBody era -> Map ( TxIn ( Crypto era)) ( TxOut era) -> Value era -> Test ( UtxoPredicateFailure era)
- validateScriptsNotPaidUTxO :: Era era => Map ( TxIn ( Crypto era)) ( TxOut era) -> Test ( UtxoPredicateFailure era)
- validateInsufficientCollateral :: ( HasField "_collateralPercentage" ( PParams era) Natural , HasField "txfee" ( TxBody era) Coin , Val ( Value era)) => PParams era -> TxBody era -> Value era -> Test ( UtxoPredicateFailure era)
- validateCollateralContainsNonADA :: Val ( Value era) => Value era -> Test ( UtxoPredicateFailure era)
- validateOutsideForecast :: ( HasField "vldt" ( TxBody era) ValidityInterval , HasField "_protocolVersion" ( PParams era) ProtVer ) => PParams era -> EpochInfo ( Either a) -> SlotNo -> SystemStart -> ValidatedTx era -> Test ( UtxoPredicateFailure era)
- validateOutputTooSmallUTxO :: ( HasField "_coinsPerUTxOWord" ( PParams era) Coin , HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c)), Era era) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era)
- validateOutputTooBigUTxO :: ( HasField "_maxValSize" ( PParams era) Natural , HasField "value" ( TxOut era) ( Value era), ToCBOR ( Value era)) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era)
- validateWrongNetworkInTxBody :: HasField "txnetworkid" ( TxBody era) ( StrictMaybe Network ) => Network -> TxBody era -> Test ( UtxoPredicateFailure era)
- validateExUnitsTooBigUTxO :: ( HasField "_maxTxExUnits" ( PParams era) ExUnits , HasField "txrdmrs" ( Witnesses era) ( Redeemers era), HasField "wits" ( Tx era) ( Witnesses era)) => PParams era -> Tx era -> Test ( UtxoPredicateFailure era)
- validateTooManyCollateralInputs :: ( HasField "_maxCollateralInputs" ( PParams era) Natural , HasField "collateral" ( TxBody era) ( Set a)) => PParams era -> TxBody era -> Test ( UtxoPredicateFailure era)
- utxoTransition :: forall era. ( Era era, ValidateScript era, ConcreteAlonzo era, Tx era ~ ValidatedTx era, Witnesses era ~ TxWitness era, STS ( AlonzoUTXO era), Embed ( EraRule "UTXOS" era) ( AlonzoUTXO era), Environment ( EraRule "UTXOS" era) ~ UtxoEnv era, State ( EraRule "UTXOS" era) ~ UTxOState era, Signal ( EraRule "UTXOS" era) ~ Tx era, Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era))) => TransitionRule ( AlonzoUTXO era)
- encFail :: forall era. ( Era era, ToCBOR ( TxOut era), ToCBOR ( Value era), ToCBOR ( PredicateFailure ( EraRule "UTXOS" era))) => UtxoPredicateFailure era -> Encode ' Open ( UtxoPredicateFailure era)
- decFail :: ( Era era, FromCBOR ( TxOut era), FromCBOR ( Value era), FromCBOR ( PredicateFailure ( EraRule "UTXOS" era))) => Word -> Decode ' Open ( UtxoPredicateFailure era)
- fromShelleyFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era)
- fromShelleyMAFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era)
- utxoPredFailMaToAlonzo :: Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era)) => UtxoPredicateFailure era -> UtxoPredicateFailure era
- utxoPredFailShelleyToAlonzo :: Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era)) => UtxoPredicateFailure era -> UtxoPredicateFailure era
Documentation
utxoEntrySize :: ( Era era, HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c))) => TxOut era -> Integer Source #
Compute an estimate of the size of storing one UTxO entry. This function implements the UTxO entry size estimate done by scaledMinDeposit in the ShelleyMA era
data AlonzoUTXO era Source #
The uninhabited type that marks the Alonzo UTxO rule
Instances
data UtxoPredicateFailure era Source #
BadInputsUTxO !( Set ( TxIn ( Crypto era))) |
The bad transaction inputs |
OutsideValidityIntervalUTxO | |
|
|
MaxTxSizeUTxO | |
InputSetEmptyUTxO | |
FeeTooSmallUTxO | |
ValueNotConservedUTxO | |
WrongNetwork |
the set of addresses with incorrect network IDs |
WrongNetworkWithdrawal | |
|
|
OutputTooSmallUTxO ![ TxOut era] |
list of supplied transaction outputs that are too small |
UtxosFailure ( PredicateFailure ( EraRule "UTXOS" era)) |
Subtransition Failures |
OutputBootAddrAttrsTooBig ![ TxOut era] |
list of supplied bad transaction outputs |
TriesToForgeADA | |
OutputTooBigUTxO ![( Integer , Integer , TxOut era)] |
list of supplied bad transaction output triples (actualSize,PParameterMaxValue,TxOut) |
InsufficientCollateral | |
ScriptsNotPaidUTxO !( UTxO era) |
The UTxO entries which have the wrong kind of script |
ExUnitsTooBigUTxO | |
CollateralContainsNonADA !( Value era) |
The inputs marked for use as fees contain non-ADA tokens |
WrongNetworkInTxBody |
Wrong Network ID in body |
OutsideForecast ! SlotNo |
slot number outside consensus forecast range |
TooManyCollateralInputs |
There are too many collateral inputs |
NoCollateralInputs |
Instances
isKeyHashAddr :: Addr crypto -> Bool Source #
Returns true for VKey locked addresses, and false for any kind of script-locked address.
isKeyHashCompactAddr :: CompactAddr crypto -> Bool Source #
This is equivalent to
isKeyHashAddr
, but for compacted version of an address.
feesOK :: forall era. ( Era era, Tx era ~ ValidatedTx era, HasField "collateral" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "txrdmrs" ( Witnesses era) ( Redeemers era), HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "_prices" ( PParams era) Prices , HasField "_collateralPercentage" ( PParams era) Natural ) => PParams era -> Tx era -> UTxO era -> Test ( UtxoPredicateFailure era) Source #
feesOK is a predicate with several parts. Some parts only apply in special circumstances. 1) The fee paid is >= the minimum fee 2) If the total ExUnits are 0 in both Memory and Steps, no further part needs to be checked. 3) The collateral consists only of VKey addresses 4) The collateral is sufficient to cover the appropriate percentage of the fee marked in the transaction 5) The collateral inputs do not contain any non-ADA part 6) There is at least one collateral input As a TransitionRule it will return (), and produce a validation failure (rather than return) if any of the required parts are False.
validateCollateral :: ( Era era, HasField "_collateralPercentage" ( PParams era) Natural ) => PParams era -> TxBody era -> Map ( TxIn ( Crypto era)) ( TxOut era) -> Value era -> Test ( UtxoPredicateFailure era) Source #
validateScriptsNotPaidUTxO :: Era era => Map ( TxIn ( Crypto era)) ( TxOut era) -> Test ( UtxoPredicateFailure era) Source #
validateInsufficientCollateral :: ( HasField "_collateralPercentage" ( PParams era) Natural , HasField "txfee" ( TxBody era) Coin , Val ( Value era)) => PParams era -> TxBody era -> Value era -> Test ( UtxoPredicateFailure era) Source #
validateCollateralContainsNonADA :: Val ( Value era) => Value era -> Test ( UtxoPredicateFailure era) Source #
validateOutsideForecast Source #
:: ( HasField "vldt" ( TxBody era) ValidityInterval , HasField "_protocolVersion" ( PParams era) ProtVer ) | |
=> PParams era | |
-> EpochInfo ( Either a) | |
-> SlotNo |
Current slot number |
-> SystemStart | |
-> ValidatedTx era | |
-> Test ( UtxoPredicateFailure era) |
If tx has non-native scripts, end of validity interval must translate to time
(_,i_f) := txvldt tx ◇ ∉ { txrdmrs tx, i_f } ⇒ epochInfoSlotToUTCTime epochInfo systemTime i_f ≠ ◇
validateOutputTooSmallUTxO :: ( HasField "_coinsPerUTxOWord" ( PParams era) Coin , HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c)), Era era) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era) Source #
Ensure that there are no
TxOut
s that have value less than the sized
coinsPerUTxOWord
∀ txout ∈ txouts txb, getValue txout ≥ inject (utxoEntrySize txout ∗ coinsPerUTxOWord pp)
validateOutputTooBigUTxO :: ( HasField "_maxValSize" ( PParams era) Natural , HasField "value" ( TxOut era) ( Value era), ToCBOR ( Value era)) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era) Source #
validateWrongNetworkInTxBody :: HasField "txnetworkid" ( TxBody era) ( StrictMaybe Network ) => Network -> TxBody era -> Test ( UtxoPredicateFailure era) Source #
Ensure if NetworkId is present in the txbody it matches the global NetworkId
(txnetworkid txb = NetworkId) ∨ (txnetworkid txb = ◇)
validateExUnitsTooBigUTxO :: ( HasField "_maxTxExUnits" ( PParams era) ExUnits , HasField "txrdmrs" ( Witnesses era) ( Redeemers era), HasField "wits" ( Tx era) ( Witnesses era)) => PParams era -> Tx era -> Test ( UtxoPredicateFailure era) Source #
Ensure that execution units to not exceed the maximum allowed
maxTxExUnits
parameter.
totExunits tx ≤ maxTxExUnits pp
validateTooManyCollateralInputs :: ( HasField "_maxCollateralInputs" ( PParams era) Natural , HasField "collateral" ( TxBody era) ( Set a)) => PParams era -> TxBody era -> Test ( UtxoPredicateFailure era) Source #
Ensure that number of collaterals does not exceed the allowed
maxCollInputs
parameter.
‖collateral tx‖ ≤ maxCollInputs pp
utxoTransition :: forall era. ( Era era, ValidateScript era, ConcreteAlonzo era, Tx era ~ ValidatedTx era, Witnesses era ~ TxWitness era, STS ( AlonzoUTXO era), Embed ( EraRule "UTXOS" era) ( AlonzoUTXO era), Environment ( EraRule "UTXOS" era) ~ UtxoEnv era, State ( EraRule "UTXOS" era) ~ UTxOState era, Signal ( EraRule "UTXOS" era) ~ Tx era, Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era))) => TransitionRule ( AlonzoUTXO era) Source #
The UTxO transition rule for the Alonzo eras.
encFail :: forall era. ( Era era, ToCBOR ( TxOut era), ToCBOR ( Value era), ToCBOR ( PredicateFailure ( EraRule "UTXOS" era))) => UtxoPredicateFailure era -> Encode ' Open ( UtxoPredicateFailure era) Source #
decFail :: ( Era era, FromCBOR ( TxOut era), FromCBOR ( Value era), FromCBOR ( PredicateFailure ( EraRule "UTXOS" era))) => Word -> Decode ' Open ( UtxoPredicateFailure era) Source #
fromShelleyFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era) Source #
fromShelleyMAFailure :: UtxoPredicateFailure era -> Maybe ( UtxoPredicateFailure era) Source #
utxoPredFailMaToAlonzo :: Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era)) => UtxoPredicateFailure era -> UtxoPredicateFailure era Source #
utxoPredFailShelleyToAlonzo :: Inject ( PredicateFailure ( EraRule "PPUP" era)) ( PredicateFailure ( EraRule "UTXOS" era)) => UtxoPredicateFailure era -> UtxoPredicateFailure era Source #