From b843840b6e4d87864eea1379b8a253fed1d5b8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 7 Jun 2024 10:33:31 +0200 Subject: [PATCH] Remove a number of error types, replace by a generic error with one custom Text message instead. --- .../Cardano/CLI/EraBased/Run/Transaction.hs | 67 +++--- .../src/Cardano/CLI/Legacy/Run/Transaction.hs | 4 +- .../Cardano/CLI/Types/Errors/TxCmdError.hs | 33 +-- .../CLI/Types/Errors/TxValidationError.hs | 204 ++++-------------- 4 files changed, 80 insertions(+), 228 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 713ef3d9bf..2f7a283bd6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -68,7 +68,7 @@ import Data.Function ((&)) import qualified Data.List as List import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map -import Data.Maybe (catMaybes, fromMaybe) +import Data.Maybe (catMaybes, fromMaybe, mapMaybe) import Data.Set (Set) import qualified Data.Set as Set import qualified Data.Text as Text @@ -644,8 +644,7 @@ constructTxBodyContent sbe mScriptValidity mPparams inputsAndMaybeScriptWits rea reqSigners fee txAuxScripts txMetadata txUpdateProposal votingProcedures proposals = do - let era = toCardanoEra sbe -- TODO: Propagate SBE - allReferenceInputs = getAllReferenceInputs + let allReferenceInputs = getAllReferenceInputs inputsAndMaybeScriptWits (snd valuesWithScriptWits) certsAndMaybeScriptWits @@ -656,20 +655,14 @@ constructTxBodyContent sbe mScriptValidity mPparams inputsAndMaybeScriptWits rea validatedCollateralTxIns <- validateTxInsCollateral sbe txinsc validatedRefInputs <- validateTxInsReference sbe allReferenceInputs - validatedTotCollateral - <- first TxCmdTotalCollateralValidationError $ validateTxTotalCollateral era mTotCollateral - validatedRetCol - <- first TxCmdReturnCollateralValidationError $ validateTxReturnCollateral era mReturnCollateral + validatedTotCollateral <- first TxCmdNotSupportedInAnyCardanoEraValidationError $ validateTxTotalCollateral sbe mTotCollateral + validatedRetCol <- first TxCmdNotSupportedInAnyCardanoEraValidationError $ validateTxReturnCollateral sbe mReturnCollateral let txFee = TxFeeExplicit sbe fee - validatedLowerBound <- first TxCmdTxValidityLowerBoundValidationError (validateTxValidityLowerBound era mLowerBound) - validatedReqSigners <- first TxCmdRequiredSignersValidationError $ validateRequiredSigners era reqSigners - validatedTxWtdrwls <- first TxCmdTxWithdrawalsValidationError $ validateTxWithdrawals era withdrawals - validatedTxCerts <- first TxCmdTxCertificatesValidationError $ validateTxCertificates era certsAndMaybeScriptWits + validatedLowerBound <- first TxCmdNotSupportedInAnyCardanoEraValidationError $ validateTxValidityLowerBound sbe mLowerBound + validatedReqSigners <- first TxCmdNotSupportedInAnyCardanoEraValidationError $ validateRequiredSigners sbe reqSigners validatedMintValue <- createTxMintValue sbe valuesWithScriptWits - validatedTxScriptValidity <- first TxCmdScriptValidityValidationError $ validateTxScriptValidity era mScriptValidity + validatedTxScriptValidity <- first TxCmdNotSupportedInAnyCardanoEraValidationError $ validateTxScriptValidity sbe mScriptValidity validatedVotingProcedures <- first TxCmdTxGovDuplicateVotes $ convertToTxVotingProcedures votingProcedures - validatedPParams <- first TxCmdProtocolParametersValidationError - $ validateProtocolParameters era (LedgerProtocolParameters <$> mPparams) return $ shelleyBasedEraConstraints sbe $ (defaultTxBodyContent sbe & setTxIns (validateTxIns inputsAndMaybeScriptWits) & setTxInsCollateral validatedCollateralTxIns @@ -683,20 +676,24 @@ constructTxBodyContent sbe mScriptValidity mPparams inputsAndMaybeScriptWits rea & setTxMetadata txMetadata & setTxAuxScripts txAuxScripts & setTxExtraKeyWits validatedReqSigners - & setTxProtocolParams validatedPParams - & setTxWithdrawals validatedTxWtdrwls - & setTxCertificates validatedTxCerts + & setTxProtocolParams (BuildTxWith $ LedgerProtocolParameters <$> mPparams) + & setTxWithdrawals (TxWithdrawals sbe $ map convertWithdrawals withdrawals) + & setTxCertificates (convertCertificates sbe certsAndMaybeScriptWits) & setTxUpdateProposal txUpdateProposal & setTxMintValue validatedMintValue & setTxScriptValidity validatedTxScriptValidity) -- TODO: Create set* function for proposal procedures and voting procedures - { txProposalProcedures = forEraInEonMaybe era (`Featured` convToTxProposalProcedures proposals) - , txVotingProcedures = forEraInEonMaybe era (`Featured` validatedVotingProcedures) + { txProposalProcedures = forShelleyBasedEraInEonMaybe sbe (`Featured` convToTxProposalProcedures proposals) + , txVotingProcedures = forShelleyBasedEraInEonMaybe sbe (`Featured` validatedVotingProcedures) } - - - - + where + convertWithdrawals + :: (StakeAddress, L.Coin, Maybe (ScriptWitness WitCtxStake era)) + -> (StakeAddress, L.Coin, BuildTxWith BuildTx (Witness WitCtxStake era)) + convertWithdrawals (sAddr, ll, mScriptWitnessFiles) = + case mScriptWitnessFiles of + Just sWit -> (sAddr, ll, BuildTxWith $ ScriptWitness ScriptWitnessForStakeAddr sWit) + Nothing -> (sAddr, ll, BuildTxWith $ KeyWitness KeyWitnessForStakeAddr) runTxBuild :: () => ShelleyBasedEra era @@ -773,13 +770,8 @@ runTxBuild Refl <- testEquality era nodeEra & hoistMaybe (TxCmdTxNodeEraMismatchError $ NodeEraMismatchError era nodeEra) - validatedTxCerts - <- hoistEither - . first TxCmdTxCertificatesValidationError - $ validateTxCertificates era certsAndMaybeScriptWits - let certs = - case validatedTxCerts of + case convertCertificates sbe certsAndMaybeScriptWits of TxCertificates _ cs _ -> cs _ -> [] @@ -828,6 +820,23 @@ runTxBuild return balancedTxBody +convertCertificates :: () + => ShelleyBasedEra era + -> [(Certificate era, Maybe (ScriptWitness WitCtxStake era))] + -> TxCertificates BuildTx era +convertCertificates sbe certsAndScriptWitnesses = + TxCertificates sbe certs $ BuildTxWith reqWits + where + certs = map fst certsAndScriptWitnesses + reqWits = Map.fromList $ mapMaybe convert certsAndScriptWitnesses + convert :: (Certificate era, Maybe (ScriptWitness WitCtxStake era)) + -> Maybe (StakeCredential, Witness WitCtxStake era) + convert (cert, mScriptWitnessFiles) = do + sCred <- selectStakeCredentialWitness cert + Just $ case mScriptWitnessFiles of + Just sWit -> (sCred, ScriptWitness ScriptWitnessForStakeAddr sWit) + Nothing -> (sCred, KeyWitness KeyWitnessForStakeAddr) + -- ---------------------------------------------------------------------------- -- Transaction body validation and conversion -- diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index c25d48fe8a..ce417c3e78 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -103,7 +103,7 @@ runLegacyTransactionBuildCmd mUpdateProposalFile <- validateUpdateProposalFile (shelleyBasedToCardanoEra sbe) mUpdateProposal & hoistEither - & firstExceptT TxCmdTxUpdateProposalValidationError + & firstExceptT TxCmdNotSupportedInAnyCardanoEraValidationError let upperBound = TxValidityUpperBound sbe mUpperBound @@ -169,7 +169,7 @@ runLegacyTransactionBuildRawCmd (\sbe -> do mUpdateProposalFile <- validateUpdateProposalFile era mUpdateProposal & hoistEither - & firstExceptT TxCmdTxUpdateProposalValidationError + & firstExceptT TxCmdNotSupportedInAnyCardanoEraValidationError let upperBound = TxValidityUpperBound sbe mUpperBound diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs index 4ea6338f7a..e1eb9967f6 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs @@ -79,17 +79,8 @@ data TxCmdError | TxCmdCddlWitnessError CddlWitnessError | TxCmdRequiredSignerError RequiredSignerError -- Validation errors + | forall era. TxCmdNotSupportedInAnyCardanoEraValidationError (TxNotSupportedInAnyCardanoEraValidationError era) | TxCmdAuxScriptsValidationError TxAuxScriptsValidationError - | TxCmdTotalCollateralValidationError TxTotalCollateralValidationError - | TxCmdReturnCollateralValidationError TxReturnCollateralValidationError - | TxCmdTxValidityLowerBoundValidationError TxValidityLowerBoundValidationError - | TxCmdTxValidityUpperBoundValidationError TxValidityUpperBoundValidationError - | TxCmdRequiredSignersValidationError TxRequiredSignersValidationError - | TxCmdProtocolParametersValidationError TxProtocolParametersValidationError - | TxCmdTxWithdrawalsValidationError TxWithdrawalsValidationError - | TxCmdTxCertificatesValidationError TxCertificatesValidationError - | TxCmdTxUpdateProposalValidationError TxUpdateProposalValidationError - | TxCmdScriptValidityValidationError TxScriptValidityValidationError | TxCmdProtocolParamsConverstionError ProtocolParametersConversionError | forall era. TxCmdTxGovDuplicateVotes (TxGovDuplicateVotes era) | forall era. TxCmdFeeEstimationError (TxFeeEstimationError era) @@ -213,27 +204,9 @@ renderTxCmdError = \case TxCmdRequiredSignerError e -> prettyError e -- Validation errors - TxCmdAuxScriptsValidationError e -> - prettyError e - TxCmdTotalCollateralValidationError e -> - prettyError e - TxCmdReturnCollateralValidationError e -> - prettyError e - TxCmdTxValidityLowerBoundValidationError e -> - prettyError e - TxCmdTxValidityUpperBoundValidationError e -> - prettyError e - TxCmdRequiredSignersValidationError e -> + TxCmdNotSupportedInAnyCardanoEraValidationError e -> prettyError e - TxCmdProtocolParametersValidationError e -> - prettyError e - TxCmdTxWithdrawalsValidationError e -> - prettyError e - TxCmdTxCertificatesValidationError e -> - prettyError e - TxCmdTxUpdateProposalValidationError e -> - prettyError e - TxCmdScriptValidityValidationError e -> + TxCmdAuxScriptsValidationError e -> prettyError e TxCmdTxGovDuplicateVotes e -> prettyError e diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs index bd9d1a9447..a067b15d38 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs @@ -8,29 +8,17 @@ module Cardano.CLI.Types.Errors.TxValidationError ( TxAuxScriptsValidationError(..) - , TxCertificatesValidationError(..) , TxGovDuplicateVotes(..) - , TxProtocolParametersValidationError - , TxScriptValidityValidationError(..) - , TxUpdateProposalValidationError(..) - , TxValidityLowerBoundValidationError(..) - , TxValidityUpperBoundValidationError(..) - , TxRequiredSignersValidationError - , TxReturnCollateralValidationError(..) - , TxTotalCollateralValidationError(..) - , TxWithdrawalsValidationError(..) + , TxNotSupportedInAnyCardanoEraValidationError(..) , convToTxProposalProcedures , convertToTxVotingProcedures - , validateProtocolParameters , validateScriptSupportedInEra , validateTxAuxScripts - , validateTxCertificates , validateRequiredSigners , validateTxReturnCollateral , validateTxScriptValidity , validateTxTotalCollateral , validateTxValidityLowerBound - , validateTxWithdrawals , validateUpdateProposalFile ) where @@ -48,6 +36,7 @@ import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Maybe import qualified Data.OSet.Strict as OSet +import qualified Data.Text as T import Prettyprinter (viaShow) data ScriptLanguageValidationError @@ -70,64 +59,43 @@ validateScriptSupportedInEra era script@(ScriptInAnyLang lang _) = (AnyScriptLanguage lang) (anyCardanoEra $ toCardanoEra era) Just script' -> pure script' -newtype TxTotalCollateralValidationError - = TxTotalCollateralNotSupported AnyCardanoEra - deriving Show +data TxNotSupportedInAnyCardanoEraValidationError era = + -- | First argument is the kind of data that is not supported. + -- Second argument is the era that doesn't support the data. + TxNotSupportedInAnyCardanoEraValidationError T.Text AnyCardanoEra + +instance Show (TxNotSupportedInAnyCardanoEraValidationError era) where + show (TxNotSupportedInAnyCardanoEraValidationError a era) = + show (pretty a) <> " not supported in " <> show era -instance Error TxTotalCollateralValidationError where - prettyError (TxTotalCollateralNotSupported era) = - "Transaction collateral not supported in " <> pretty era +instance Error (TxNotSupportedInAnyCardanoEraValidationError era) where + prettyError (TxNotSupportedInAnyCardanoEraValidationError a era) = + pretty a <+> "not supported in" <+> viaShow era -validateTxTotalCollateral :: CardanoEra era +validateTxTotalCollateral :: ShelleyBasedEra era -> Maybe L.Coin - -> Either TxTotalCollateralValidationError (TxTotalCollateral era) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (TxTotalCollateral era) validateTxTotalCollateral _ Nothing = return TxTotalCollateralNone -validateTxTotalCollateral era (Just coll) = do - supported <- conjureWitness era TxTotalCollateralNotSupported +validateTxTotalCollateral sbe (Just coll) = do + supported <- conjureWitness (toCardanoEra sbe) $ TxNotSupportedInAnyCardanoEraValidationError "Transaction collateral" pure $ TxTotalCollateral supported coll -newtype TxReturnCollateralValidationError - = TxReturnCollateralNotSupported AnyCardanoEra - deriving Show - -instance Error TxReturnCollateralValidationError where - prettyError (TxReturnCollateralNotSupported era) = - "Transaction return collateral not supported in " <> pretty era - -validateTxReturnCollateral :: CardanoEra era +validateTxReturnCollateral :: ShelleyBasedEra era -> Maybe (TxOut CtxTx era) - -> Either TxReturnCollateralValidationError (TxReturnCollateral CtxTx era) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (TxReturnCollateral CtxTx era) validateTxReturnCollateral _ Nothing = return TxReturnCollateralNone -validateTxReturnCollateral era (Just retColTxOut) = do - supported <- conjureWitness era TxReturnCollateralNotSupported +validateTxReturnCollateral sbe (Just retColTxOut) = do + supported <- conjureWitness (toCardanoEra sbe) $ TxNotSupportedInAnyCardanoEraValidationError "Transaction return collateral" pure $ TxReturnCollateral supported retColTxOut -newtype TxValidityLowerBoundValidationError - = TxValidityLowerBoundNotSupported AnyCardanoEra - deriving Show - -instance Error TxValidityLowerBoundValidationError where - prettyError (TxValidityLowerBoundNotSupported era) = - "Transaction validity lower bound not supported in " <> pretty era - - -validateTxValidityLowerBound :: CardanoEra era +validateTxValidityLowerBound :: ShelleyBasedEra era -> Maybe SlotNo - -> Either TxValidityLowerBoundValidationError (TxValidityLowerBound era) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (TxValidityLowerBound era) validateTxValidityLowerBound _ Nothing = return TxValidityNoLowerBound -validateTxValidityLowerBound era (Just slot) = do - supported <- conjureWitness era TxValidityLowerBoundNotSupported +validateTxValidityLowerBound sbe (Just slot) = do + supported <- conjureWitness (toCardanoEra sbe) $ TxNotSupportedInAnyCardanoEraValidationError "Transaction validity lower bound" pure $ TxValidityLowerBound supported slot -newtype TxValidityUpperBoundValidationError - = TxValidityUpperBoundNotSupported AnyCardanoEra - deriving Show - -instance Error TxValidityUpperBoundValidationError where - prettyError (TxValidityUpperBoundNotSupported era) = - "Transaction validity upper bound must be specified in " <> pretty era - - data TxAuxScriptsValidationError = TxAuxScriptsNotSupportedInEra AnyCardanoEra | TxAuxScriptsLanguageError ScriptLanguageValidationError @@ -149,135 +117,37 @@ validateTxAuxScripts era scripts = do scriptsInEra <- mapM (first TxAuxScriptsLanguageError . validateScriptSupportedInEra era) scripts pure $ TxAuxScripts supported scriptsInEra -newtype TxRequiredSignersValidationError - = TxRequiredSignersValidationError AnyCardanoEra - deriving Show - -instance Error TxRequiredSignersValidationError where - prettyError (TxRequiredSignersValidationError e) = - "Transaction required signers are not supported in " <> pretty e - validateRequiredSigners - :: CardanoEra era + :: ShelleyBasedEra era -> [Hash PaymentKey] - -> Either TxRequiredSignersValidationError (TxExtraKeyWitnesses era) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (TxExtraKeyWitnesses era) validateRequiredSigners _ [] = return TxExtraKeyWitnessesNone -validateRequiredSigners era reqSigs = do - supported <- conjureWitness era TxRequiredSignersValidationError +validateRequiredSigners sbe reqSigs = do + supported <- conjureWitness (toCardanoEra sbe) $ TxNotSupportedInAnyCardanoEraValidationError "Transaction required signers" pure $ TxExtraKeyWitnesses supported reqSigs -newtype TxWithdrawalsValidationError - = TxWithdrawalsNotSupported AnyCardanoEra - deriving Show - -instance Error TxWithdrawalsValidationError where - prettyError (TxWithdrawalsNotSupported e) = - "Transaction withdrawals are not supported in " <> pretty e - -validateTxWithdrawals - :: forall era. - CardanoEra era - -> [(StakeAddress, L.Coin, Maybe (ScriptWitness WitCtxStake era))] - -> Either TxWithdrawalsValidationError (TxWithdrawals BuildTx era) -validateTxWithdrawals _ [] = return TxWithdrawalsNone -validateTxWithdrawals era withdrawals = do - supported <- conjureWitness era TxWithdrawalsNotSupported - let convWithdrawals = map convert withdrawals - pure $ TxWithdrawals supported convWithdrawals - where - convert - :: (StakeAddress, L.Coin, Maybe (ScriptWitness WitCtxStake era)) - -> (StakeAddress, L.Coin, BuildTxWith BuildTx (Witness WitCtxStake era)) - convert (sAddr, ll, mScriptWitnessFiles) = - case mScriptWitnessFiles of - Just sWit -> (sAddr, ll, BuildTxWith $ ScriptWitness ScriptWitnessForStakeAddr sWit) - Nothing -> (sAddr, ll, BuildTxWith $ KeyWitness KeyWitnessForStakeAddr) - -newtype TxCertificatesValidationError - = TxCertificatesValidationNotSupported AnyCardanoEra - deriving Show - -instance Error TxCertificatesValidationError where - prettyError (TxCertificatesValidationNotSupported e) = - "Transaction certificates are not supported in " <> pretty e - --- TODO: Because we have separated Byron related transaction --- construction into separate commands, we can parameterize this --- on ShelleyBasedEra era and remove Either TxCertificatesValidationError -validateTxCertificates - :: forall era. - CardanoEra era - -> [(Certificate era, Maybe (ScriptWitness WitCtxStake era))] - -> Either TxCertificatesValidationError (TxCertificates BuildTx era) -validateTxCertificates _ [] = return TxCertificatesNone -validateTxCertificates era certsAndScriptWitnesses = cardanoEraConstraints era $ do - supported <- conjureWitness era TxCertificatesValidationNotSupported - let certs = map fst certsAndScriptWitnesses - reqWits = Map.fromList $ mapMaybe convert certsAndScriptWitnesses - pure $ TxCertificates supported certs $ BuildTxWith reqWits - where - convert - :: (Certificate era, Maybe (ScriptWitness WitCtxStake era)) - -> Maybe (StakeCredential, Witness WitCtxStake era) - convert (cert, mScriptWitnessFiles) = do - sCred <- selectStakeCredentialWitness cert - Just $ case mScriptWitnessFiles of - Just sWit -> (sCred, ScriptWitness ScriptWitnessForStakeAddr sWit) - Nothing -> (sCred, KeyWitness KeyWitnessForStakeAddr) - -newtype TxProtocolParametersValidationError - = ProtocolParametersNotSupported AnyCardanoEra - deriving Show - -instance Error TxProtocolParametersValidationError where - prettyError (ProtocolParametersNotSupported e) = - "Transaction protocol parameters are not supported in " <> pretty e - -validateProtocolParameters - :: CardanoEra era - -> Maybe (LedgerProtocolParameters era) - -> Either TxProtocolParametersValidationError (BuildTxWith BuildTx (Maybe (LedgerProtocolParameters era))) -validateProtocolParameters _ Nothing = return (BuildTxWith Nothing) -validateProtocolParameters era (Just pparams) = do - _ <- conjureWitness @ShelleyBasedEra era ProtocolParametersNotSupported - pure . BuildTxWith $ Just pparams - -newtype TxUpdateProposalValidationError - = TxUpdateProposalNotSupported AnyCardanoEra - deriving Show - -instance Error TxUpdateProposalValidationError where - prettyError (TxUpdateProposalNotSupported e) = - "Transaction update proposal is not supported in " <> pretty e - -newtype TxScriptValidityValidationError - = ScriptValidityNotSupported AnyCardanoEra - deriving Show - -instance Error TxScriptValidityValidationError where - prettyError (ScriptValidityNotSupported e) = - "Transaction script validity is not supported in " <> pretty e - validateTxScriptValidity - :: CardanoEra era + :: ShelleyBasedEra era -> Maybe ScriptValidity - -> Either TxScriptValidityValidationError (TxScriptValidity era) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (TxScriptValidity era) validateTxScriptValidity _ Nothing = pure TxScriptValidityNone -validateTxScriptValidity era (Just scriptValidity) = do - supported <- conjureWitness era ScriptValidityNotSupported +validateTxScriptValidity sbe (Just scriptValidity) = do + supported <- conjureWitness (toCardanoEra sbe) $ TxNotSupportedInAnyCardanoEraValidationError "Transaction script validity" pure $ TxScriptValidity supported scriptValidity -- TODO legacy. This can be deleted when legacy commands are removed. validateUpdateProposalFile :: CardanoEra era -> Maybe UpdateProposalFile - -> Either TxUpdateProposalValidationError (Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) + -> Either (TxNotSupportedInAnyCardanoEraValidationError era) (Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) validateUpdateProposalFile era = \case Nothing -> pure Nothing Just updateProposal -> do - supported <- conjureWitness era TxUpdateProposalNotSupported + supported <- conjureWitness era $ TxNotSupportedInAnyCardanoEraValidationError "Transaction update proposal" pure $ Just $ Featured supported $ Just updateProposal +-- TODO make this function take a ShelleyBasedEra when the last +-- CardanoEra caller is removed (there remains only one). conjureWitness :: Eon eon => CardanoEra era -- ^ era to try to conjure eon from -> (AnyCardanoEra -> e) -- ^ error wrapper function