From 469d7183d5d2d5644145d1ea359cf5dedcf566f2 Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Wed, 24 Jul 2024 13:52:48 +0200 Subject: [PATCH] Modify pPlutusReferenceScriptWitness parser to relax the requirement for a spending script datum in Conway --- .../Cardano/CLI/EraBased/Options/Common.hs | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 560ad915ae..37bb1e013f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -2227,17 +2227,33 @@ pTxIn balance = let simpleLang = AnyScriptLanguage SimpleScriptLanguage in SimpleReferenceScriptWitnessFiles refTxIn simpleLang Nothing - pPlutusReferenceScriptWitness :: BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxTxIn) - pPlutusReferenceScriptWitness autoBalanceExecUnits = - createPlutusReferenceScriptWitnessFiles - <$> pReferenceTxIn "spending-" "plutus" - <*> pPlutusScriptLanguage "spending-" - <*> pScriptDatumOrFile "spending-reference-tx-in" WitCtxTxIn - <*> pScriptRedeemerOrFile "spending-reference-tx-in" - <*> ( case autoBalanceExecUnits of - AutoBalance -> pure (ExecutionUnits 0 0) - ManualBalance -> pExecutionUnits "spending-reference-tx-in" - ) + pPlutusReferenceScriptWitness + :: ShelleyBasedEra era -> BalanceTxExecUnits -> Parser (ScriptWitnessFiles WitCtxTxIn) + pPlutusReferenceScriptWitness sbe' autoBalanceExecUnits = + caseShelleyToBabbageOrConwayEraOnwards + ( const $ + createPlutusReferenceScriptWitnessFiles + <$> pReferenceTxIn "spending-" "plutus" + <*> pPlutusScriptLanguage "spending-" + <*> pScriptDatumOrFile "spending-reference-tx-in" WitCtxTxIn + <*> pScriptRedeemerOrFile "spending-reference-tx-in" + <*> ( case autoBalanceExecUnits of + AutoBalance -> pure (ExecutionUnits 0 0) + ManualBalance -> pExecutionUnits "spending-reference-tx-in" + ) + ) + ( const $ + createPlutusReferenceScriptWitnessFiles + <$> pReferenceTxIn "spending-" "plutus" + <*> pPlutusScriptLanguage "spending-" + <*> pScriptDatumOrFileCip69 "spending-reference-tx-in" WitCtxTxIn + <*> pScriptRedeemerOrFile "spending-reference-tx-in" + <*> ( case autoBalanceExecUnits of + AutoBalance -> pure (ExecutionUnits 0 0) + ManualBalance -> pExecutionUnits "spending-reference-tx-in" + ) + ) + sbe' where createPlutusReferenceScriptWitnessFiles :: TxIn