Skip to content

Commit

Permalink
Remove the "dead" error about builtin arity
Browse files Browse the repository at this point in the history
  • Loading branch information
bezirg authored and brainrake committed Dec 8, 2022
1 parent ecad3b4 commit 9787f42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) =
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions plutus-errors/src/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -61,7 +65,6 @@ allErrors =
, 'PLC.UnliftingErrorE
, 'PLC.BuiltinTermArgumentExpectedMachineError
, 'PLC.UnexpectedBuiltinTermArgumentMachineError
, 'PLC.EmptyBuiltinArityMachineError
, 'PLC.CekOutOfExError
, 'PLC.CekEvaluationFailure
, 'PLC.ParseErrorB
Expand Down

0 comments on commit 9787f42

Please sign in to comment.