-
Notifications
You must be signed in to change notification settings - Fork 155
/
Utxo.hs
540 lines (502 loc) · 18.7 KB
/
Utxo.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Cardano.Ledger.Alonzo.Rules.Utxo where
import Cardano.Binary (FromCBOR (..), ToCBOR (..), serialize)
import Cardano.Ledger.Alonzo.Data (dataHashSize)
import Cardano.Ledger.Alonzo.Rules.Utxos (UTXOS, UtxosPredicateFailure)
import Cardano.Ledger.Alonzo.Scripts (ExUnits (..), Prices, pointWiseExUnits)
import Cardano.Ledger.Alonzo.Tx
( Tx (..),
isTwoPhaseScriptAddress,
minfee,
txbody,
)
import qualified Cardano.Ledger.Alonzo.Tx as Alonzo (Tx)
import Cardano.Ledger.Alonzo.TxBody
( TxOut (..),
)
import qualified Cardano.Ledger.Alonzo.TxBody as Alonzo (TxBody, TxOut)
import Cardano.Ledger.Coin
import qualified Cardano.Ledger.Core as Core
import Cardano.Ledger.Era (Crypto, Era, ValidateScript (..))
import qualified Cardano.Ledger.Mary.Value as Alonzo (Value)
import Cardano.Ledger.Shelley.Constraints
( UsesPParams,
)
import Cardano.Ledger.ShelleyMA.Rules.Utxo (consumed)
import Cardano.Ledger.ShelleyMA.Timelocks (ValidityInterval (..), inInterval)
import qualified Cardano.Ledger.Val as Val
import Cardano.Prelude (HeapWords (..))
import Cardano.Slotting.Slot (SlotNo)
import Control.Iterate.SetAlgebra (dom, eval, (⊆), (◁), (➖))
import Control.Monad.Trans.Reader (asks)
import Control.State.Transition.Extended
import qualified Data.ByteString.Lazy as BSL (length)
import Data.Coders
( Decode (..),
Encode (..),
Wrapped (Open),
decode,
decodeList,
decodeSet,
encode,
encodeFoldable,
(!>),
(<!),
)
import Data.Coerce (coerce)
import Data.Foldable (toList)
import qualified Data.Map.Strict as Map
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import GHC.Records
import NoThunks.Class (NoThunks)
import Numeric.Natural (Natural)
import Shelley.Spec.Ledger.Address
( Addr (AddrBootstrap),
RewardAcnt,
bootstrapAddressAttrsSize,
getNetwork,
getRwdNetwork,
)
import Shelley.Spec.Ledger.BaseTypes
( Network,
ShelleyBase,
StrictMaybe (..),
networkId,
)
import Shelley.Spec.Ledger.CompactAddr (CompactAddr)
import qualified Shelley.Spec.Ledger.LedgerState as Shelley
import qualified Shelley.Spec.Ledger.STS.Utxo as Shelley
import Shelley.Spec.Ledger.Tx (TxIn)
import Shelley.Spec.Ledger.TxBody (unWdrl)
import Shelley.Spec.Ledger.UTxO
( UTxO (..),
balance,
txins,
txouts,
unUTxO,
)
-- | 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
utxoEntrySize :: Era era => TxOut era -> Integer
utxoEntrySize txout
| Val.adaOnly v =
-- no non-ada assets, no hash datum case
case dh of
SNothing -> adaOnlyUTxOSize
_ -> adaOnlyUTxOSize + dataHashSize dh
-- add the size of Value and the size of datum hash (if present) to base UTxO size
-- max function is a safeguard (in case calculation returns a smaller size than an ada-only entry)
| otherwise = max adaOnlyUTxOSize (utxoEntrySizeWithoutVal + Val.size v + dataHashSize dh)
where
v = getField @"value" txout
dh = getField @"datahash" txout
-- lengths obtained from tracing on HeapWords of inputs and outputs
-- obtained experimentally, and number used here
-- units are Word64s
txoutLenNoVal = 14
txinLen = 7
-- unpacked CompactCoin Word64 size in Word64s
coinSize :: Integer
coinSize = fromIntegral $ heapWords (CompactCoin 0)
-- size of UTxO entry excluding the Value part
utxoEntrySizeWithoutVal :: Integer
utxoEntrySizeWithoutVal = 6 + txoutLenNoVal + txinLen
-- size of commont UTxO with only ada and no datum
adaOnlyUTxOSize = utxoEntrySizeWithoutVal + coinSize
-- ============================================
-- | The uninhabited type that marks the Alonzo UTxO rule
data AlonzoUTXO era
-- ==========================================================
data UtxoPredicateFailure era
= -- | The bad transaction inputs
BadInputsUTxO
!(Set (TxIn (Crypto era)))
| OutsideValidityIntervalUTxO
!ValidityInterval
-- ^ transaction's validity interval
!SlotNo
-- ^ current slot
| MaxTxSizeUTxO
!Integer
-- ^ the actual transaction size
!Integer
-- ^ the max transaction size
| InputSetEmptyUTxO
| FeeTooSmallUTxO
!Coin
-- ^ the minimum fee for this transaction
!Coin
-- ^ the fee supplied in this transaction
| ValueNotConservedUTxO
!(Core.Value era)
-- ^ the Coin consumed by this transaction
!(Core.Value era)
-- ^ the Coin produced by this transaction
| -- | the set of addresses with incorrect network IDs
WrongNetwork
!Network -- the expected network id
!(Set (Addr (Crypto era)))
| WrongNetworkWithdrawal
!Network
-- ^ the expected network id
!(Set (RewardAcnt (Crypto era)))
-- ^ the set of reward addresses with incorrect network IDs
| -- | list of supplied transaction outputs that are too small
OutputTooSmallUTxO
![Core.TxOut era]
| -- | Subtransition Failures
UtxosFailure (PredicateFailure (Core.EraRule "UTXOS" era))
| -- | list of supplied bad transaction outputs
OutputBootAddrAttrsTooBig
![Core.TxOut era]
| TriesToForgeADA
| -- | list of supplied bad transaction outputs
OutputTooBigUTxO
![Core.TxOut era]
| FeeNotBalancedUTxO
!Coin
-- ^ balance computed
!Coin
-- ^ the fee supplied in this transaction
| -- | The UTxO entries which have the wrong kind of script
ScriptsNotPaidUTxO
!(UTxO era)
| ExUnitsTooSmallUTxO
!ExUnits
-- ^ Max EXUnits from the protocol parameters
!ExUnits
-- ^ EXUnits supplied
| -- | The inputs marked for use as fees contain non-ADA tokens
FeeContainsNonADA !(Core.Value era)
deriving (Generic)
deriving stock instance
( Era era,
Show (Core.Value era),
Show (Core.TxOut era),
Show (Core.TxBody era),
Show (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
Show (UtxoPredicateFailure era)
deriving stock instance
( Eq (Core.Value era),
Eq (Core.TxOut era),
Eq (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
Eq (UtxoPredicateFailure era)
instance
( Era era,
Shelley.TransUTxOState NoThunks era,
NoThunks (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
NoThunks (UtxoPredicateFailure era)
-- | 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 fee inputs do not belong to non-native script addresses
-- 4) The fee inputs are sufficient to cover the fee marked in the transaction
-- 5) The fee inputs do not contain any non-ADA part
-- As a TransitionRule it will return (), and raise an error (rather than
-- return) if any of the required parts are False.
feesOK ::
forall era.
( Era era,
ValidateScript era, -- isTwoPhaseScriptAddress
Core.TxOut era ~ Alonzo.TxOut era, -- balance requires this,
HasField "totExunits" (Core.Tx era) ExUnits, -- minfee requires this
HasField
"txinputs_fee" -- to get inputs to pay the fees
(Core.TxBody era)
(Set (TxIn (Crypto era))),
HasField "_minfeeA" (Core.PParams era) Natural,
HasField "_minfeeB" (Core.PParams era) Natural,
HasField "_prices" (Core.PParams era) Prices,
HasField "address" (Alonzo.TxOut era) (Addr (Crypto era))
) =>
Core.PParams era ->
Core.Tx era ->
UTxO era ->
Rule (AlonzoUTXO era) 'Transition ()
feesOK pp tx (UTxO m) = do
let txb = getField @"body" tx
theFee = getField @"txfee" txb -- Coin supplied to pay fees
fees = getField @"txinputs_fee" txb -- Inputs allocated to pay theFee
utxoFees = eval (fees ◁ m) -- restrict Utxo to those inputs we use to pay fees.
bal = balance @era (UTxO utxoFees)
nonNative txout = isTwoPhaseScriptAddress @era tx (getField @"address" txout)
minimumFee = minfee @era pp tx
-- Part 1
(minimumFee <= theFee) ?! FeeTooSmallUTxO minimumFee theFee
-- Part 2
if (getField @"totExunits" tx) == (ExUnits 0 0)
then pure ()
else do
-- Part 3
not (any nonNative utxoFees) ?! ScriptsNotPaidUTxO (UTxO (Map.filter nonNative utxoFees))
-- Part 4
(Val.coin bal >= theFee) ?! FeeNotBalancedUTxO (Val.coin bal) theFee
-- Part 5
Val.inject (Val.coin bal) == bal ?! FeeContainsNonADA bal
pure ()
-- ================================================================
-- | The UTxO transition rule for the Alonzo eras.
utxoTransition ::
forall era.
( Era era,
ValidateScript era,
Show (CompactAddr (Crypto era)),
-- instructions for calling UTXOS from AlonzoUTXO
Embed (Core.EraRule "UTXOS" era) (AlonzoUTXO era),
Environment (Core.EraRule "UTXOS" era) ~ Shelley.UtxoEnv era,
State (Core.EraRule "UTXOS" era) ~ Shelley.UTxOState era,
Signal (Core.EraRule "UTXOS" era) ~ Tx era,
-- We leave Core.PParams abstract
UsesPParams era,
HasField "_minfeeA" (Core.PParams era) Natural,
HasField "_minfeeB" (Core.PParams era) Natural,
HasField "_keyDeposit" (Core.PParams era) Coin,
HasField "_poolDeposit" (Core.PParams era) Coin,
HasField "_maxTxSize" (Core.PParams era) Natural,
HasField "_prices" (Core.PParams era) Prices,
HasField "_maxTxExUnits" (Core.PParams era) ExUnits,
HasField "_adaPerUTxOByte" (Core.PParams era) Coin,
HasField "_maxValSize" (Core.PParams era) Natural,
-- We fix Core.Tx, Core.Value, Core.TxBody, and Core.TxOut
Core.TxOut era ~ Alonzo.TxOut era,
Core.Value era ~ Alonzo.Value (Crypto era),
Core.TxBody era ~ Alonzo.TxBody era,
Core.TxOut era ~ Alonzo.TxOut era,
Core.Tx era ~ Alonzo.Tx era
) =>
TransitionRule (AlonzoUTXO era)
utxoTransition = do
TRC (Shelley.UtxoEnv slot pp stakepools _genDelegs, u, tx) <- judgmentContext
let Shelley.UTxOState utxo _deposits _fees _ppup = u
let txb = txbody tx
inInterval slot (getField @"vldt" txb)
?! OutsideValidityIntervalUTxO (getField @"vldt" txb) slot
not (Set.null (txins @era txb)) ?! InputSetEmptyUTxO
feesOK pp tx utxo -- Generalizes the fee to small from earlier Era's
eval (txins @era txb ⊆ dom utxo)
?! BadInputsUTxO (eval (txins @era txb ➖ dom utxo))
let consumed_ = consumed pp utxo txb
produced_ = Shelley.produced @era pp stakepools txb
consumed_ == produced_ ?! ValueNotConservedUTxO consumed_ produced_
-- Check that the mint field does not try to mint ADA. This is equivalent to
-- the check `adaPolicy ∉ supp mint tx` in the spec.
Val.coin (getField @"mint" txb) == Val.zero ?! TriesToForgeADA
-- use serialized length of Value because this Value size is being limited inside a serialized Tx
let outputs = Map.elems $ unUTxO (txouts @era txb)
maxValSize = getField @"_maxValSize" pp
outputsTooBig =
filter
( \out ->
let v = getField @"value" out
in (fromIntegral . BSL.length . serialize) v > maxValSize
)
outputs
null outputsTooBig ?! OutputTooBigUTxO outputsTooBig
ni <- liftSTS $ asks networkId
let addrsWrongNetwork =
filter
(\a -> getNetwork a /= ni)
(fmap (getField @"address") $ toList $ getField @"outputs" txb)
null addrsWrongNetwork ?! WrongNetwork ni (Set.fromList addrsWrongNetwork)
let wdrlsWrongNetwork =
filter
(\a -> getRwdNetwork a /= ni)
(Map.keys . unWdrl . getField @"wdrls" $ txb)
null wdrlsWrongNetwork
?! WrongNetworkWithdrawal
ni
(Set.fromList wdrlsWrongNetwork)
-- pointwise is used because non-ada amounts must be >= 0 too
let (Coin adaPerUTxOByte) = getField @"_adaPerUTxOByte" pp
outputsTooSmall =
filter
( \out ->
let v = getField @"value" out
in not $
Val.pointwise
(>=)
v
(Val.inject $ Coin (utxoEntrySize out * adaPerUTxOByte))
)
outputs
null outputsTooSmall ?! OutputTooSmallUTxO outputsTooSmall
let maxTxSize_ = fromIntegral (getField @"_maxTxSize" pp)
txSize_ = getField @"txsize" tx
txSize_ <= maxTxSize_ ?! MaxTxSizeUTxO txSize_ maxTxSize_
let maxTxEx = getField @"_maxTxExUnits" pp
totExunits = getField @"totExunits" tx
pointWiseExUnits (<=) totExunits maxTxEx ?! ExUnitsTooSmallUTxO maxTxEx totExunits
-- This does not appear in the Alonzo specification. But the test should be in every Era.
-- Bootstrap (i.e. Byron) addresses have variable sized attributes in them.
-- It is important to limit their overall size.
let outputsAttrsTooBig =
filter
( \out -> case getField @"address" out of
AddrBootstrap addr -> bootstrapAddressAttrsSize addr > 64
_ -> False
)
outputs
null outputsAttrsTooBig ?! OutputBootAddrAttrsTooBig outputsAttrsTooBig
trans @(Core.EraRule "UTXOS" era) =<< coerce <$> judgmentContext
--------------------------------------------------------------------------------
-- AlonzoUTXO STS
--------------------------------------------------------------------------------
instance
forall era.
( ValidateScript era,
Show (CompactAddr (Crypto era)),
-- Instructions needed to call the UTXOS transition from this one.
Embed (Core.EraRule "UTXOS" era) (AlonzoUTXO era),
Environment (Core.EraRule "UTXOS" era) ~ Shelley.UtxoEnv era,
State (Core.EraRule "UTXOS" era) ~ Shelley.UTxOState era,
Signal (Core.EraRule "UTXOS" era) ~ Tx era,
-- We leave Core.PParams abstract
UsesPParams era,
HasField "_keyDeposit" (Core.PParams era) Coin,
HasField "_minfeeA" (Core.PParams era) Natural,
HasField "_minfeeB" (Core.PParams era) Natural,
HasField "_keyDeposit" (Core.PParams era) Coin,
HasField "_poolDeposit" (Core.PParams era) Coin,
HasField "_adaPerUTxOByte" (Core.PParams era) Coin,
HasField "_maxTxSize" (Core.PParams era) Natural,
HasField "_prices" (Core.PParams era) Prices,
HasField "_maxTxExUnits" (Core.PParams era) ExUnits,
HasField "_adaPerUTxOByte" (Core.PParams era) Coin,
HasField "_maxValSize" (Core.PParams era) Natural,
-- We fix Core.Value, Core.TxBody, and Core.TxOut
Core.Value era ~ Alonzo.Value (Crypto era),
Core.TxBody era ~ Alonzo.TxBody era,
Core.TxOut era ~ Alonzo.TxOut era,
Core.Tx era ~ Alonzo.Tx era
) =>
STS (AlonzoUTXO era)
where
type State (AlonzoUTXO era) = Shelley.UTxOState era
type Signal (AlonzoUTXO era) = Tx era
type
Environment (AlonzoUTXO era) =
Shelley.UtxoEnv era
type BaseM (AlonzoUTXO era) = ShelleyBase
type
PredicateFailure (AlonzoUTXO era) =
UtxoPredicateFailure era
initialRules = []
transitionRules = [utxoTransition]
instance
( Era era,
STS (UTXOS era),
PredicateFailure (Core.EraRule "UTXOS" era) ~ UtxosPredicateFailure era
) =>
Embed (UTXOS era) (AlonzoUTXO era)
where
wrapFailed = UtxosFailure
--------------------------------------------------------------------------------
-- Serialisation
--------------------------------------------------------------------------------
instance
( Typeable era,
Era era,
ToCBOR (Core.TxOut era),
ToCBOR (Core.Value era),
ToCBOR (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
ToCBOR (UtxoPredicateFailure era)
where
toCBOR x = encode (encFail x)
encFail ::
forall era.
( Era era,
ToCBOR (Core.TxOut era),
ToCBOR (Core.Value era),
ToCBOR (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
UtxoPredicateFailure era ->
Encode 'Open (UtxoPredicateFailure era)
encFail (BadInputsUTxO ins) =
Sum (BadInputsUTxO @era) 0 !> E encodeFoldable ins
encFail (OutsideValidityIntervalUTxO a b) =
Sum OutsideValidityIntervalUTxO 1 !> To a !> To b
encFail (MaxTxSizeUTxO a b) =
Sum MaxTxSizeUTxO 2 !> To a !> To b
encFail (InputSetEmptyUTxO) =
Sum InputSetEmptyUTxO 3
encFail (FeeTooSmallUTxO a b) =
Sum FeeTooSmallUTxO 4 !> To a !> To b
encFail (ValueNotConservedUTxO a b) =
Sum (ValueNotConservedUTxO @era) 5 !> To a !> To b
encFail (OutputTooSmallUTxO outs) =
Sum (OutputTooSmallUTxO @era) 6 !> E encodeFoldable outs
encFail (UtxosFailure a) =
Sum (UtxosFailure @era) 7 !> To a
encFail (WrongNetwork right wrongs) =
Sum (WrongNetwork @era) 8 !> To right !> E encodeFoldable wrongs
encFail (WrongNetworkWithdrawal right wrongs) =
Sum (WrongNetworkWithdrawal @era) 9 !> To right !> E encodeFoldable wrongs
encFail (OutputBootAddrAttrsTooBig outs) =
Sum (OutputBootAddrAttrsTooBig @era) 10 !> E encodeFoldable outs
encFail (TriesToForgeADA) =
Sum TriesToForgeADA 11
encFail (OutputTooBigUTxO outs) =
Sum (OutputTooBigUTxO @era) 12 !> E encodeFoldable outs
encFail (FeeNotBalancedUTxO a b) =
Sum FeeNotBalancedUTxO 13 !> To a !> To b
encFail (ScriptsNotPaidUTxO a) =
Sum ScriptsNotPaidUTxO 14 !> To a
encFail (ExUnitsTooSmallUTxO a b) =
Sum ExUnitsTooSmallUTxO 15 !> To a !> To b
encFail (FeeContainsNonADA a) =
Sum FeeContainsNonADA 16 !> To a
decFail ::
( Era era,
FromCBOR (Core.TxOut era),
FromCBOR (Core.Value era),
FromCBOR (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
Word ->
Decode 'Open (UtxoPredicateFailure era)
decFail 0 = SumD (BadInputsUTxO) <! D (decodeSet fromCBOR)
decFail 1 = SumD OutsideValidityIntervalUTxO <! From <! From
decFail 2 = SumD MaxTxSizeUTxO <! From <! From
decFail 3 = SumD InputSetEmptyUTxO
decFail 4 = SumD FeeTooSmallUTxO <! From <! From
decFail 5 = SumD (ValueNotConservedUTxO) <! From <! From
decFail 6 = SumD (OutputTooSmallUTxO) <! D (decodeList fromCBOR)
decFail 7 = SumD (UtxosFailure) <! From
decFail 8 = SumD (WrongNetwork) <! From <! D (decodeSet fromCBOR)
decFail 9 = SumD (WrongNetworkWithdrawal) <! From <! D (decodeSet fromCBOR)
decFail 10 = SumD (OutputBootAddrAttrsTooBig) <! D (decodeList fromCBOR)
decFail 11 = SumD TriesToForgeADA
decFail 12 = SumD (OutputTooBigUTxO) <! D (decodeList fromCBOR)
decFail 13 = SumD FeeNotBalancedUTxO <! From <! From
decFail 14 = SumD ScriptsNotPaidUTxO <! From
decFail 15 = SumD ExUnitsTooSmallUTxO <! From <! From
decFail 16 = SumD FeeContainsNonADA <! From
decFail n = Invalid n
instance
( Era era,
FromCBOR (Core.TxOut era),
FromCBOR (Core.Value era),
FromCBOR (PredicateFailure (Core.EraRule "UTXOS" era))
) =>
FromCBOR (UtxoPredicateFailure era)
where
fromCBOR = decode (Summands "UtxoPredicateFailure" decFail)