-
Notifications
You must be signed in to change notification settings - Fork 155
/
Utxow.hs
485 lines (453 loc) · 19.2 KB
/
Utxow.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
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Cardano.Ledger.Alonzo.Rules.Utxow where
import Cardano.Binary (FromCBOR (..), ToCBOR (..))
import Cardano.Ledger.Address (Addr (..), bootstrapKeyHash, getRwdCred)
import Cardano.Ledger.Alonzo.Data (DataHash)
import Cardano.Ledger.Alonzo.Language (Language (..))
import Cardano.Ledger.Alonzo.PParams (PParams)
import Cardano.Ledger.Alonzo.PlutusScriptApi (language, scriptsNeeded)
import Cardano.Ledger.Alonzo.Rules.Utxo (AlonzoUTXO)
import qualified Cardano.Ledger.Alonzo.Rules.Utxo as Alonzo (UtxoEvent, UtxoPredicateFailure)
import Cardano.Ledger.Alonzo.Scripts (Script (..))
import Cardano.Ledger.Alonzo.Tx
( ScriptPurpose,
ValidatedTx (..),
hashScriptIntegrity,
isTwoPhaseScriptAddress,
rdptr,
)
import Cardano.Ledger.Alonzo.TxBody (ScriptIntegrityHash)
import Cardano.Ledger.Alonzo.TxWitness
( RdmrPtr,
TxWitness (..),
unRedeemers,
unTxDats,
)
import Cardano.Ledger.BaseTypes
( ShelleyBase,
StrictMaybe (..),
strictMaybeToMaybe,
)
import qualified Cardano.Ledger.Core as Core
import Cardano.Ledger.Credential (Credential (KeyHashObj))
import Cardano.Ledger.Era (Crypto, Era, ValidateScript (..))
import Cardano.Ledger.Keys (GenDelegs, KeyHash, KeyRole (..), asWitness)
import Cardano.Ledger.Rules.ValidationMode ((?!#))
import Cardano.Ledger.Shelley.Delegation.Certificates
( delegCWitness,
genesisCWitness,
poolCWitness,
requiresVKeyWitness,
)
import Cardano.Ledger.Shelley.LedgerState
( UTxOState (..),
WitHashes (..),
propWits,
unWitHashes,
witsFromTxWitnesses,
)
import Cardano.Ledger.Shelley.PParams (Update)
import Cardano.Ledger.Shelley.Rules.Utxo (UtxoEnv (..))
import Cardano.Ledger.Shelley.Rules.Utxow
( ShelleyStyleWitnessNeeds,
UtxowEvent (UtxoEvent),
UtxowPredicateFailure (..),
shelleyStyleWitness,
)
import Cardano.Ledger.Shelley.Scripts (ScriptHash (..))
import Cardano.Ledger.Shelley.Tx (TxIn (..), extractKeyHashWitnessSet)
import Cardano.Ledger.Shelley.TxBody
( DCert (DCertDeleg, DCertGenesis, DCertPool),
PoolCert (RegPool),
PoolParams (..),
Wdrl,
unWdrl,
)
import Cardano.Ledger.Shelley.UTxO (UTxO (..), txinLookup)
import Control.Iterate.SetAlgebra (domain, eval, (⊆), (◁), (➖))
import Control.State.Transition.Extended
import Data.Coders
import Data.Foldable (toList)
import qualified Data.Map.Strict as Map
import Data.Sequence.Strict (StrictSeq)
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import GHC.Records
import NoThunks.Class
-- =================================================
-- | The Predicate failure type in the Alonzo Era. It embeds the Predicate
-- failure type of the Shelley Era, as they share some failure modes.
data AlonzoPredFail era
= WrappedShelleyEraFailure !(UtxowPredicateFailure era)
| MissingRedeemers ![(ScriptPurpose (Crypto era), ScriptHash (Crypto era))]
| MissingRequiredDatums
!(Set (DataHash (Crypto era))) -- Set of missing data hashes
!(Set (DataHash (Crypto era))) -- Set of received data hashes
| NonOutputSupplimentaryDatums
!(Set (DataHash (Crypto era))) -- Set of unallowed data hashes
!(Set (DataHash (Crypto era))) -- Set of acceptable supplimental data hashes
| PPViewHashesDontMatch
!(StrictMaybe (ScriptIntegrityHash (Crypto era)))
-- ^ The PPHash in the TxBody
!(StrictMaybe (ScriptIntegrityHash (Crypto era)))
-- ^ Computed from the current Protocol Parameters
| MissingRequiredSigners (Set (KeyHash 'Witness (Crypto era)))
| UnspendableUTxONoDatumHash (Set (TxIn (Crypto era)))
| ExtraRedeemers ![RdmrPtr]
deriving (Generic)
deriving instance
( Era era,
Show (PredicateFailure (Core.EraRule "UTXO" era)), -- The Shelley UtxowPredicateFailure needs this to Show
Show (Core.Script era)
) =>
Show (AlonzoPredFail era)
deriving instance
( Era era,
Eq (PredicateFailure (Core.EraRule "UTXO" era)), -- The Shelley UtxowPredicateFailure needs this to Eq
Eq (Core.Script era)
) =>
Eq (AlonzoPredFail era)
instance
( Era era,
NoThunks (Core.Script era),
NoThunks (PredicateFailure (Core.EraRule "UTXO" era))
) =>
NoThunks (AlonzoPredFail era)
instance
( Era era,
ToCBOR (PredicateFailure (Core.EraRule "UTXO" era)),
Typeable (Core.AuxiliaryData era),
Typeable (Core.Script era),
ToCBOR (Core.Script era)
) =>
ToCBOR (AlonzoPredFail era)
where
toCBOR x = encode (encodePredFail x)
newtype AlonzoEvent era
= WrappedShelleyEraEvent (UtxowEvent era)
encodePredFail ::
( Era era,
ToCBOR (PredicateFailure (Core.EraRule "UTXO" era)),
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era)
) =>
AlonzoPredFail era ->
Encode 'Open (AlonzoPredFail era)
encodePredFail (WrappedShelleyEraFailure x) = Sum WrappedShelleyEraFailure 0 !> E toCBOR x
encodePredFail (MissingRedeemers x) = Sum MissingRedeemers 1 !> To x
encodePredFail (MissingRequiredDatums x y) = Sum MissingRequiredDatums 2 !> To x !> To y
encodePredFail (NonOutputSupplimentaryDatums x y) = Sum NonOutputSupplimentaryDatums 3 !> To x !> To y
encodePredFail (PPViewHashesDontMatch x y) = Sum PPViewHashesDontMatch 4 !> To x !> To y
encodePredFail (MissingRequiredSigners x) = Sum MissingRequiredSigners 5 !> To x
encodePredFail (UnspendableUTxONoDatumHash x) = Sum UnspendableUTxONoDatumHash 6 !> To x
encodePredFail (ExtraRedeemers x) = Sum ExtraRedeemers 7 !> To x
instance
( Era era,
FromCBOR (PredicateFailure (Core.EraRule "UTXO" era)),
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era)
) =>
FromCBOR (AlonzoPredFail era)
where
fromCBOR = decode (Summands "(AlonzoPredFail" decodePredFail)
decodePredFail ::
( Era era,
FromCBOR (PredicateFailure (Core.EraRule "UTXO" era)), -- TODO, we should be able to get rid of this constraint
Typeable (Core.Script era),
Typeable (Core.AuxiliaryData era)
) =>
Word ->
Decode 'Open (AlonzoPredFail era)
decodePredFail 0 = SumD WrappedShelleyEraFailure <! D fromCBOR
decodePredFail 1 = SumD MissingRedeemers <! From
decodePredFail 2 = SumD MissingRequiredDatums <! From <! From
decodePredFail 3 = SumD NonOutputSupplimentaryDatums <! From <! From
decodePredFail 4 = SumD PPViewHashesDontMatch <! From <! From
decodePredFail 5 = SumD MissingRequiredSigners <! From
decodePredFail 6 = SumD UnspendableUTxONoDatumHash <! From
decodePredFail 7 = SumD ExtraRedeemers <! From
decodePredFail n = Invalid n
-- =============================================
-- | given the "txscripts" field of the Witnesses, compute the set of languages used in a transaction
langsUsed :: forall era. (Core.Script era ~ Script era, ValidateScript era) => Map.Map (ScriptHash (Crypto era)) (Script era) -> Set Language
langsUsed hashScriptMap =
Set.fromList
[ l | (_hash, script) <- Map.toList hashScriptMap, (not . isNativeScript @era) script, Just l <- [language @era script]
]
{- Defined in the Shelley Utxow rule.
type ShelleyStyleWitnessNeeds era =
( HasField "certs" (Core.TxBody era) (StrictSeq (DCert (Crypto era))),
HasField "inputs" (Core.TxBody era) (Set (TxIn (Crypto era))),
HasField "wdrls" (Core.TxBody era) (Wdrl (Crypto era)),
HasField "addrWits" (Core.Tx era) (Set (WitVKey 'Witness (Crypto era))),
HasField "update" (Core.TxBody era) (StrictMaybe (Update era)),
HasField "_protocolVersion" (Core.PParams era) ProtVer,
ValidateAuxiliaryData era (Crypto era),
ValidateScript era,
DSignable (Crypto era) (Hash (Crypto era) EraIndependentTxBody)
)
-}
-- | Constraints to make an Alonzo Utxow STS instance
-- (in addition to ShelleyStyleWitnessNeeds)
type AlonzoStyleAdditions era =
( HasField "datahash" (Core.TxOut era) (StrictMaybe (DataHash (Crypto era))), -- BE SURE AND ADD THESE INSTANCES
HasField "scriptIntegrityHash" (Core.TxBody era) (StrictMaybe (ScriptIntegrityHash (Crypto era)))
)
-- | A somewhat generic STS transitionRule function for the Alonzo Era.
alonzoStyleWitness ::
forall era utxow.
( Era era,
-- Fix some Core types to the Alonzo Era
Core.Tx era ~ ValidatedTx era, -- scriptsNeeded, checkScriptData etc. are fixed at Alonzo.Tx
Core.PParams era ~ PParams era,
Core.Script era ~ Script era,
-- Allow UTXOW to call UTXO
Embed (Core.EraRule "UTXO" era) (utxow era),
Environment (Core.EraRule "UTXO" era) ~ UtxoEnv era,
State (Core.EraRule "UTXO" era) ~ UTxOState era,
Signal (Core.EraRule "UTXO" era) ~ ValidatedTx era,
-- Asumptions needed since we are going to fix utxow when we use this in an STS Era
BaseM (utxow era) ~ ShelleyBase,
Environment (utxow era) ~ UtxoEnv era,
State (utxow era) ~ UTxOState era,
Signal (utxow era) ~ ValidatedTx era,
PredicateFailure (utxow era) ~ AlonzoPredFail era,
STS (utxow era),
-- Supply the HasField and Validate instances for Alonzo
ShelleyStyleWitnessNeeds era,
AlonzoStyleAdditions era,
-- New transaction body fields needed for Alonzo
HasField "reqSignerHashes" (Core.TxBody era) (Set (KeyHash 'Witness (Crypto era))),
HasField "collateral" (Core.TxBody era) (Set (TxIn (Crypto era)))
) =>
TransitionRule (utxow era)
alonzoStyleWitness = do
(TRC (UtxoEnv _slot pp _stakepools _genDelegs, u', tx)) <- judgmentContext
{- (utxo,_,_,_ ) := utxoSt -}
{- txb := txbody tx -}
{- txw := txwits tx -}
{- witsKeyHashes := { hashKey vk | vk ∈ dom(txwitsVKey txw) } -}
let utxo = _utxo u'
txbody = getField @"body" (tx :: Core.Tx era)
witsKeyHashes = unWitHashes $ witsFromTxWitnesses @era tx
{- { h | (_ → (a,_,h)) ∈ txins tx ◁ utxo, isNonNativeScriptAddress tx a} = dom(txdats txw) -}
let inputs = getField @"inputs" txbody :: (Set (TxIn (Crypto era)))
smallUtxo = eval (inputs ◁ utxo) :: Map.Map (TxIn (Crypto era)) (Core.TxOut era)
twoPhaseOuts =
[ output
| (_input, output) <- Map.toList smallUtxo,
isTwoPhaseScriptAddress @era tx (getField @"address" output)
]
utxoHashes' = mapM (getField @"datahash") twoPhaseOuts
case utxoHashes' of
SNothing ->
-- In the spec, the Nothing value can end up on the left hand side
-- of the equality check, but we must explicitly rule it out.
failBecause . UnspendableUTxONoDatumHash . Set.fromList $
[ input
| (input, output) <- Map.toList smallUtxo,
SNothing <- [getField @"datahash" output],
isTwoPhaseScriptAddress @era tx (getField @"address" output)
]
SJust utxoHashes -> do
let txHashes = domain (unTxDats . txdats . wits $ tx)
inputHashes = Set.fromList utxoHashes
unmatchedDatumHashes = eval (inputHashes ➖ txHashes)
Set.null unmatchedDatumHashes ?! MissingRequiredDatums unmatchedDatumHashes txHashes
-- Check that all supplimental datums contained in the witness set appear in the outputs.
let outputDatumHashes =
Set.fromList
[ dh
| out <- toList $ getField @"outputs" txbody,
SJust dh <- [getField @"datahash" out]
]
supplimentalDatumHashes = eval (txHashes ➖ inputHashes)
(okSupplimentalDHs, notOkSupplimentalDHs) =
Set.partition (`Set.member` outputDatumHashes) supplimentalDatumHashes
Set.null notOkSupplimentalDHs
?! NonOutputSupplimentaryDatums notOkSupplimentalDHs okSupplimentalDHs
{- dom (txrdmrs tx) = { rdptr txb sp | (sp, h) ∈ scriptsNeeded utxo tx,
h \mapsto s ∈ txscripts txw, s ∈ Scriptph2} -}
let redeemersNeeded =
[ (rp, (sp, sh))
| (sp, sh) <- scriptsNeeded utxo tx,
SJust rp <- [rdptr @era txbody sp],
Just script <- [Map.lookup sh (getField @"scriptWits" tx)],
(not . isNativeScript @era) script
]
(extraRdmrs, missingRdmrs) =
extSymmetricDifference
(Map.keys $ unRedeemers $ txrdmrs $ wits tx)
id
redeemersNeeded
fst
null extraRdmrs ?! ExtraRedeemers extraRdmrs
null missingRdmrs ?! MissingRedeemers (map snd missingRdmrs)
{- THIS DOES NOT APPPEAR IN THE SPEC as a separate check, but
witsVKeyNeeded includes the reqSignerHashes in the union -}
let reqSignerHashes' = getField @"reqSignerHashes" txbody
eval (reqSignerHashes' ⊆ witsKeyHashes)
?!# MissingRequiredSigners (eval $ reqSignerHashes' ➖ witsKeyHashes)
{- scriptIntegrityHash txb = hashScriptIntegrity pp (languages txw) (txrdmrs txw) -}
let languages =
[ l
| (_hash, script) <- Map.toList (getField @"scriptWits" tx),
(not . isNativeScript @era) script,
Just l <- [language @era script]
]
computedPPhash = hashScriptIntegrity pp (Set.fromList languages) (txrdmrs . wits $ tx) (txdats . wits $ tx)
bodyPPhash = getField @"scriptIntegrityHash" txbody
bodyPPhash == computedPPhash ?! PPViewHashesDontMatch bodyPPhash computedPPhash
{- The shelleyStyleWitness calls the UTXO rule which applies all these rules -}
{- ∀ s ∈ range(txscripts txw) ∩ Scriptnative), runNativeScript s tx -}
{- { s | (_,s) ∈ scriptsNeeded utxo tx} = dom(txscripts txw) -}
{- ∀ (vk ↦ σ) ∈ (txwitsVKey txw), V_vk⟦ txbodyHash ⟧_σ -}
{- witsVKeyNeeded utxo tx genDelegs ⊆ witsKeyHashes -}
{- genSig := { hashKey gkey | gkey ∈ dom(genDelegs)} ∩ witsKeyHashes -}
{- { c ∈ txcerts txb ∩ DCert_mir} ≠ ∅ ⇒ (|genSig| ≥ Quorum) ∧ (d pp > 0) -}
{- adh := txADhash txb; ad := auxiliaryData tx -}
{- ((adh = ◇) ∧ (ad= ◇)) ∨ (adh = hashAD ad) -}
shelleyStyleWitness witsVKeyNeeded WrappedShelleyEraFailure
-- | Collect the set of hashes of keys that needs to sign a given transaction.
-- This set consists of the txin owners, certificate authors, and withdrawal
-- reward accounts.
--
-- Compared to pre-Alonzo eras, we additionally gather the certificates
-- required to authenticate collateral witnesses.
witsVKeyNeeded ::
forall era tx.
( Era era,
HasField "body" tx (Core.TxBody era),
HasField "wdrls" (Core.TxBody era) (Wdrl (Crypto era)),
HasField "certs" (Core.TxBody era) (StrictSeq (DCert (Crypto era))),
HasField "inputs" (Core.TxBody era) (Set (TxIn (Crypto era))),
HasField "collateral" (Core.TxBody era) (Set (TxIn (Crypto era))),
HasField "update" (Core.TxBody era) (StrictMaybe (Update era)),
HasField "address" (Core.TxOut era) (Addr (Crypto era))
) =>
UTxO era ->
tx ->
GenDelegs (Crypto era) ->
WitHashes (Crypto era)
witsVKeyNeeded utxo' tx genDelegs =
WitHashes $
certAuthors
`Set.union` inputAuthors
`Set.union` owners
`Set.union` wdrlAuthors
`Set.union` updateKeys
where
txbody = getField @"body" tx
inputAuthors :: Set (KeyHash 'Witness (Crypto era))
inputAuthors =
foldr
accum
Set.empty
( getField @"inputs" txbody
`Set.union` getField @"collateral" txbody
)
where
accum txin ans =
case txinLookup txin utxo' of
Just out ->
case getField @"address" out of
Addr _ (KeyHashObj pay) _ -> Set.insert (asWitness pay) ans
AddrBootstrap bootAddr ->
Set.insert (asWitness (bootstrapKeyHash bootAddr)) ans
_ -> ans
Nothing -> ans
wdrlAuthors :: Set (KeyHash 'Witness (Crypto era))
wdrlAuthors = Map.foldrWithKey accum Set.empty (unWdrl (getField @"wdrls" txbody))
where
accum key _ ans = Set.union (extractKeyHashWitnessSet [getRwdCred key]) ans
owners :: Set (KeyHash 'Witness (Crypto era))
owners = foldr accum Set.empty (getField @"certs" txbody)
where
accum (DCertPool (RegPool pool)) ans =
Set.union
(Set.map asWitness (_poolOwners pool))
ans
accum _cert ans = ans
cwitness (DCertDeleg dc) = extractKeyHashWitnessSet [delegCWitness dc]
cwitness (DCertPool pc) = extractKeyHashWitnessSet [poolCWitness pc]
cwitness (DCertGenesis gc) = Set.singleton (asWitness $ genesisCWitness gc)
cwitness c = error $ show c ++ " does not have a witness"
-- key reg requires no witness but this is already filtered outby requiresVKeyWitness
-- before the call to `cwitness`, so this error should never be reached.
certAuthors :: Set (KeyHash 'Witness (Crypto era))
certAuthors = foldr accum Set.empty (getField @"certs" txbody)
where
accum cert ans | requiresVKeyWitness cert = Set.union (cwitness cert) ans
accum _cert ans = ans
updateKeys :: Set (KeyHash 'Witness (Crypto era))
updateKeys =
asWitness
`Set.map` propWits
( strictMaybeToMaybe $
getField @"update" txbody
)
genDelegs
extSymmetricDifference :: (Ord k) => [a] -> (a -> k) -> [b] -> (b -> k) -> ([a], [b])
extSymmetricDifference as fa bs fb = (extraA, extraB)
where
intersection = Set.fromList (map fa as) `Set.intersection` Set.fromList (map fb bs)
extraA = filter (\x -> not $ fa x `Set.member` intersection) as
extraB = filter (\x -> not $ fb x `Set.member` intersection) bs
-- ====================================
-- Make the STS instance
data AlonzoUTXOW era
instance
forall era.
( -- Fix some Core types to the Alonzo Era
Core.Tx era ~ ValidatedTx era,
Core.PParams era ~ PParams era,
Core.Script era ~ Script era,
-- Allow UTXOW to call UTXO
Embed (Core.EraRule "UTXO" era) (AlonzoUTXOW era),
Environment (Core.EraRule "UTXO" era) ~ UtxoEnv era,
State (Core.EraRule "UTXO" era) ~ UTxOState era,
Signal (Core.EraRule "UTXO" era) ~ ValidatedTx era,
-- New transaction body fields needed for Alonzo
HasField "reqSignerHashes" (Core.TxBody era) (Set (KeyHash 'Witness (Crypto era))),
HasField "collateral" (Core.TxBody era) (Set (TxIn (Crypto era))),
-- Supply the HasField and Validate instances for Alonzo
ShelleyStyleWitnessNeeds era, -- supplies a subset of those needed. All the old Shelley Needs still apply.
Show (Core.TxOut era),
AlonzoStyleAdditions era
) =>
STS (AlonzoUTXOW era)
where
type State (AlonzoUTXOW era) = UTxOState era
type Signal (AlonzoUTXOW era) = ValidatedTx era
type Environment (AlonzoUTXOW era) = UtxoEnv era
type BaseM (AlonzoUTXOW era) = ShelleyBase
type PredicateFailure (AlonzoUTXOW era) = AlonzoPredFail era
type Event (AlonzoUTXOW era) = AlonzoEvent era
transitionRules = [alonzoStyleWitness]
initialRules = []
instance
( Era era,
STS (AlonzoUTXO era),
PredicateFailure (Core.EraRule "UTXO" era) ~ Alonzo.UtxoPredicateFailure era,
Event (Core.EraRule "UTXO" era) ~ Alonzo.UtxoEvent era,
BaseM (AlonzoUTXOW era) ~ ShelleyBase,
PredicateFailure (AlonzoUTXOW era) ~ AlonzoPredFail era,
Event (AlonzoUTXOW era) ~ AlonzoEvent era
) =>
Embed (AlonzoUTXO era) (AlonzoUTXOW era)
where
wrapFailed = WrappedShelleyEraFailure . UtxoFailure
wrapEvent = WrappedShelleyEraEvent . UtxoEvent