From dcaad431b300e747c04bfd7022b4b1273acfa128 Mon Sep 17 00:00:00 2001 From: Artur Cygan Date: Thu, 6 Jun 2024 13:23:56 +0200 Subject: [PATCH] Improve max code size error message --- lib/Echidna/Types.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/Echidna/Types.hs b/lib/Echidna/Types.hs index e2eccf62a..316d49e83 100644 --- a/lib/Echidna/Types.hs +++ b/lib/Echidna/Types.hs @@ -11,9 +11,18 @@ import EVM.Types data ExecException = IllegalExec EvmError | UnknownFailure EvmError instance Show ExecException where - show (IllegalExec e) = "VM attempted an illegal operation: " ++ show e - show (UnknownFailure e) = "VM failed for unhandled reason, " ++ show e - ++ ". This shouldn't happen. Please file a ticket with this error message and steps to reproduce!" + show = \case + IllegalExec e -> "VM attempted an illegal operation: " ++ show e + UnknownFailure (MaxCodeSizeExceeded limit actual) -> + "Max code size exceeded. " ++ codeSizeErrorDetails limit actual + UnknownFailure (MaxInitCodeSizeExceeded limit actual) -> + "Max init code size exceeded. " ++ codeSizeErrorDetails limit actual + UnknownFailure e -> "VM failed for unhandled reason, " ++ show e + ++ ". This shouldn't happen. Please file a ticket with this error message and steps to reproduce!" + where + codeSizeErrorDetails limit actual = + "Configured limit: " ++ show limit ++ ", actual: " ++ show actual + ++ ". Set 'codeSize: 0xffffffff' in the config file to increase the limit." instance Exception ExecException