From 9787f42696b5c9e40bb7be4ac3f480c705ec055b Mon Sep 17 00:00:00 2001 From: Nikolaos Bezirgiannis Date: Wed, 31 Aug 2022 17:21:14 +0200 Subject: [PATCH] Remove the "dead" error about builtin arity --- .../src/PlutusCore/Evaluation/Machine/Exception.hs | 7 ------- plutus-errors/src/Errors.hs | 7 +++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs index d70f18fa87d..b0f5073e6d9 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs @@ -75,10 +75,6 @@ data MachineError fun -- ^ A builtin expected a term argument, but something else was received | UnexpectedBuiltinTermArgumentMachineError -- ^ A builtin received a term argument when something else was expected - | EmptyBuiltinArityMachineError - -- ^ We've reached a state where a builtin instantiation or application is attempted - -- when the arity is zero. In the absence of nullary builtins, this should be impossible. - -- See the machine implementations for details. | UnknownBuiltin fun deriving stock (Show, Eq, Functor, Generic) deriving anyclass (NFData) @@ -201,8 +197,6 @@ instance (HasPrettyDefaults config ~ 'True, Pretty fun) => "A builtin expected a term argument, but something else was received" prettyBy _ UnexpectedBuiltinTermArgumentMachineError = "A builtin received a term argument when something else was expected" - prettyBy _ EmptyBuiltinArityMachineError = - "A builtin was applied to a term or type where no more arguments were expected" prettyBy _ (UnliftingMachineError unliftingError) = pretty unliftingError prettyBy _ (UnknownBuiltin fun) = @@ -240,7 +234,6 @@ instance HasErrorCode UnliftingError where errorCode UnliftingErrorE {} = ErrorCode 30 instance HasErrorCode (MachineError err) where - errorCode EmptyBuiltinArityMachineError {} = ErrorCode 34 errorCode UnexpectedBuiltinTermArgumentMachineError {} = ErrorCode 33 errorCode BuiltinTermArgumentExpectedMachineError {} = ErrorCode 32 errorCode OpenTermEvaluatedMachineError {} = ErrorCode 27 diff --git a/plutus-errors/src/Errors.hs b/plutus-errors/src/Errors.hs index 401c0430291..a35ae2b3d4c 100644 --- a/plutus-errors/src/Errors.hs +++ b/plutus-errors/src/Errors.hs @@ -22,10 +22,14 @@ See plutus-errors/README.md {-# WARNING ObsoleteErrors "These errors and their error codes *should* not be thrown by any plutus code anymore" #-} data ObsoleteErrors = ReservedErrorCode + | EmptyBuiltinArityMachineError + -- ^ an old error when we were checking arities of builtins during evaluation + -- append here the obsolete errors instance HasErrorCode ObsoleteErrors where - errorCode ReservedErrorCode {} = ErrorCode 0 + errorCode ReservedErrorCode {} = ErrorCode 0 + errorCode EmptyBuiltinArityMachineError {} = ErrorCode 34 -- append here the corresponding obsolete error codes -- | All errors among the whole Plutus project. This includes both existing and obsolete errors. @@ -61,7 +65,6 @@ allErrors = , 'PLC.UnliftingErrorE , 'PLC.BuiltinTermArgumentExpectedMachineError , 'PLC.UnexpectedBuiltinTermArgumentMachineError - , 'PLC.EmptyBuiltinArityMachineError , 'PLC.CekOutOfExError , 'PLC.CekEvaluationFailure , 'PLC.ParseErrorB