From fc64897c2f774afd5e6e155a9dc7225281fd088c Mon Sep 17 00:00:00 2001 From: tuturu-tech Date: Fri, 22 Mar 2024 12:49:12 +0100 Subject: [PATCH 1/3] fix medusa parsing for v0.1.3 --- fuzz_utils/fuzzers/Medusa.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fuzz_utils/fuzzers/Medusa.py b/fuzz_utils/fuzzers/Medusa.py index 57e17ea..9724075 100644 --- a/fuzz_utils/fuzzers/Medusa.py +++ b/fuzz_utils/fuzzers/Medusa.py @@ -76,8 +76,12 @@ def _parse_call_object(self, call_dict: dict) -> tuple[str, str]: has_delay = time_delay > 0 or block_delay > 0 # TODO check how Medusa handles empty calls - - function_name = call_dict["call"]["dataAbiValues"]["methodName"] + if "methodName" in call_dict["call"]["dataAbiValues"]: + function_name = call_dict["call"]["dataAbiValues"]["methodName"] + elif "methodSignature" in call_dict["call"]["dataAbiValues"]: + function_name = call_dict["call"]["dataAbiValues"]["methodSignature"].split("(")[0] + else: + handle_exit("There was an issue parsing the Medusa call sequences. This indicates a breaking change in the call sequence format, please open an issue at https://github.com/crytic/fuzz-utils/issues") function_parameters = call_dict["call"]["dataAbiValues"]["inputValues"] if len(function_parameters) == 0: function_parameters = "" From c64e51480560567f6c52b66ed4574ee65b062b64 Mon Sep 17 00:00:00 2001 From: tuturu-tech Date: Fri, 22 Mar 2024 13:00:28 +0100 Subject: [PATCH 2/3] formatting --- fuzz_utils/fuzzers/Medusa.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fuzz_utils/fuzzers/Medusa.py b/fuzz_utils/fuzzers/Medusa.py index 9724075..c01e9bb 100644 --- a/fuzz_utils/fuzzers/Medusa.py +++ b/fuzz_utils/fuzzers/Medusa.py @@ -81,7 +81,9 @@ def _parse_call_object(self, call_dict: dict) -> tuple[str, str]: elif "methodSignature" in call_dict["call"]["dataAbiValues"]: function_name = call_dict["call"]["dataAbiValues"]["methodSignature"].split("(")[0] else: - handle_exit("There was an issue parsing the Medusa call sequences. This indicates a breaking change in the call sequence format, please open an issue at https://github.com/crytic/fuzz-utils/issues") + handle_exit( + "There was an issue parsing the Medusa call sequences. This indicates a breaking change in the call sequence format, please open an issue at https://github.com/crytic/fuzz-utils/issues" + ) function_parameters = call_dict["call"]["dataAbiValues"]["inputValues"] if len(function_parameters) == 0: function_parameters = "" From 713a2612ff37f7012d27ba029078e33ed8170f91 Mon Sep 17 00:00:00 2001 From: tuturu-tech Date: Fri, 22 Mar 2024 13:27:39 +0100 Subject: [PATCH 3/3] change variable scope --- fuzz_utils/fuzzers/Medusa.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fuzz_utils/fuzzers/Medusa.py b/fuzz_utils/fuzzers/Medusa.py index c01e9bb..037fab9 100644 --- a/fuzz_utils/fuzzers/Medusa.py +++ b/fuzz_utils/fuzzers/Medusa.py @@ -74,6 +74,7 @@ def _parse_call_object(self, call_dict: dict) -> tuple[str, str]: time_delay = int(call_dict["blockTimestampDelay"]) block_delay = int(call_dict["blockNumberDelay"]) has_delay = time_delay > 0 or block_delay > 0 + function_name: str = "" # TODO check how Medusa handles empty calls if "methodName" in call_dict["call"]["dataAbiValues"]: