Skip to content

Commit

Permalink
Merge pull request #2342 from input-output-hk/jc/expand-MissingRequir…
Browse files Browse the repository at this point in the history
…edDatums-report

expand MissingRequiredDatums failure details
  • Loading branch information
Jared Corduan committed Jun 17, 2021
2 parents 6474f68 + caa7eb0 commit b590b8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions alonzo/impl/src/Cardano/Ledger/Alonzo/Rules/Utxow.hs
Expand Up @@ -95,7 +95,8 @@ data AlonzoPredFail era
= WrappedShelleyEraFailure !(UtxowPredicateFailure era)
| UnRedeemableScripts ![(ScriptPurpose (Crypto era), ScriptHash (Crypto era))]
| MissingRequiredDatums
!(Set (DataHash (Crypto era)))
!(Set (DataHash (Crypto era))) -- Set of missing data hashes
!(Set (DataHash (Crypto era))) -- Set of received data hashes
| PPViewHashesDontMatch
!(StrictMaybe (WitnessPPDataHash (Crypto era)))
-- ^ The PPHash in the TxBody
Expand Down Expand Up @@ -147,7 +148,7 @@ encodePredFail ::
Encode 'Open (AlonzoPredFail era)
encodePredFail (WrappedShelleyEraFailure x) = Sum WrappedShelleyEraFailure 0 !> E toCBOR x
encodePredFail (UnRedeemableScripts x) = Sum UnRedeemableScripts 1 !> To x
encodePredFail (MissingRequiredDatums x) = Sum MissingRequiredDatums 2 !> To x
encodePredFail (MissingRequiredDatums x y) = Sum MissingRequiredDatums 2 !> To x !> To y
encodePredFail (PPViewHashesDontMatch x y) = Sum PPViewHashesDontMatch 3 !> To x !> To y
encodePredFail (MissingRequiredSigners x) = Sum MissingRequiredSigners 4 !> To x
encodePredFail (UnspendableUTxONoDatumHash x) = Sum UnspendableUTxONoDatumHash 5 !> To x
Expand All @@ -172,7 +173,7 @@ decodePredFail ::
Decode 'Open (AlonzoPredFail era)
decodePredFail 0 = SumD WrappedShelleyEraFailure <! D fromCBOR
decodePredFail 1 = SumD UnRedeemableScripts <! From
decodePredFail 2 = SumD MissingRequiredDatums <! From
decodePredFail 2 = SumD MissingRequiredDatums <! From <! From
decodePredFail 3 = SumD PPViewHashesDontMatch <! From <! From
decodePredFail 4 = SumD MissingRequiredSigners <! From
decodePredFail 5 = SumD UnspendableUTxONoDatumHash <! From
Expand Down Expand Up @@ -270,7 +271,7 @@ alonzoStyleWitness = do
let txHashes = domain (unTxDats . txdats . wits $ tx)
inputHashes = Set.fromList utxoHashes
unmatchedInputHashes = eval (inputHashes txHashes)
Set.null unmatchedInputHashes ?! MissingRequiredDatums unmatchedInputHashes
Set.null unmatchedInputHashes ?! MissingRequiredDatums unmatchedInputHashes txHashes
{- ∀ sph ∈ scriptsNeeded utxo tx, checkScriptData tx utxo ph -}
let sphs :: [(ScriptPurpose (Crypto era), ScriptHash (Crypto era))]
sphs = scriptsNeeded utxo tx
Expand Down
Expand Up @@ -290,7 +290,7 @@ instance Mock c => Arbitrary (AlonzoPredFail (AlonzoEra c)) where
oneof
[ WrappedShelleyEraFailure <$> arbitrary,
UnRedeemableScripts <$> arbitrary,
MissingRequiredDatums <$> arbitrary,
MissingRequiredDatums <$> arbitrary <*> arbitrary,
PPViewHashesDontMatch <$> arbitrary <*> arbitrary
]

Expand Down
Expand Up @@ -1439,6 +1439,7 @@ alonzoUTXOWexamples =
( Left
[ [ MissingRequiredDatums
(Set.singleton $ hashData @A datumExample1)
mempty
]
]
),
Expand Down

0 comments on commit b590b8c

Please sign in to comment.