From 2189e6dadd283031c185b22a4c5e3f831eafb2be Mon Sep 17 00:00:00 2001 From: David Pokora Date: Thu, 2 May 2019 04:51:45 -0400 Subject: [PATCH 1/5] Added simplistic switch for json output to stdout --- slither/__main__.py | 68 ++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/slither/__main__.py b/slither/__main__.py index c5690a8fb..6ad4f16d4 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -28,7 +28,6 @@ from crytic_compile import is_supported logging.basicConfig() logger = logging.getLogger("Slither") - ################################################################################### ################################################################################### # region Process functions @@ -99,12 +98,18 @@ def process_files(filenames, args, detector_classes, printer_classes): ################################################################################### ################################################################################### + def output_json(results, filename): - if os.path.isfile(filename): - logger.info(yellow(f'{filename} exists already, the overwrite is prevented')) + if filename is None: + # Write json to console + print(json.dumps(results)) else: - with open(filename, 'w', encoding='utf8') as f: - json.dump(results, f) + # Write json to file + if os.path.isfile(filename): + logger.info(yellow(f'{filename} exists already, the overwrite is prevented')) + else: + with open(filename, 'w', encoding='utf8') as f: + json.dump(results, f) # endregion ################################################################################### @@ -456,6 +461,24 @@ class OutputWiki(argparse.Action): parser.exit() +# endregion +################################################################################### +################################################################################### +# region CustomFormatter +################################################################################### +################################################################################### + +class FormatterCryticCompile(logging.Formatter): + def format(self, record): + #for i, msg in enumerate(record.msg): + if record.msg.startswith('Compilation warnings/errors on '): + txt = record.args[1] + txt = txt.split('\n') + txt = [red(x) if 'Error' in x else x for x in txt] + txt = '\n'.join(txt) + record.args = (record.args[0], txt) + return super().format(record) + # endregion ################################################################################### ################################################################################### @@ -463,6 +486,7 @@ class OutputWiki(argparse.Action): ################################################################################### ################################################################################### + def main(): detectors, printers = get_detectors_and_printers() @@ -479,6 +503,12 @@ def main_impl(all_detector_classes, all_printer_classes): # Set colorization option set_colorization_enabled(not args.disable_color) + # If we are outputting json to stdout, we'll want to override all logger levels. + stdout_json = args.json == "-" + override_level = None + if stdout_json: + override_level = logging.ERROR + printer_classes = choose_printers(args, all_printer_classes) detector_classes = choose_detectors(args, all_detector_classes) @@ -498,17 +528,17 @@ def main_impl(all_detector_classes, all_printer_classes): #('CryticCompile', default_log) ]: l = logging.getLogger(l_name) - l.setLevel(l_level) + l.setLevel(l_level if override_level is None else override_level) console_handler = logging.StreamHandler() - console_handler.setLevel(logging.INFO) + console_handler.setLevel(logging.INFO if override_level is None else override_level) console_handler.setFormatter(FormatterCryticCompile()) crytic_compile_error = logging.getLogger(('CryticCompile')) crytic_compile_error.addHandler(console_handler) crytic_compile_error.propagate = False - crytic_compile_error.setLevel(logging.INFO) + crytic_compile_error.setLevel(logging.INFO if override_level is None else override_level) try: filename = args.filename @@ -537,7 +567,7 @@ def main_impl(all_detector_classes, all_printer_classes): raise Exception("Unrecognised file/dir path: '#{filename}'".format(filename=filename)) if args.json: - output_json(results, args.json) + output_json(results, None if stdout_json else args.json) if args.checklist: output_results_to_markdown(results) # Dont print the number of result for printers @@ -562,22 +592,4 @@ if __name__ == '__main__': main() -# endregion -################################################################################### -################################################################################### -# region CustomFormatter -################################################################################### -################################################################################### - - -class FormatterCryticCompile(logging.Formatter): - def format(self, record): - #for i, msg in enumerate(record.msg): - if record.msg.startswith('Compilation warnings/errors on '): - txt = record.args[1] - txt = txt.split('\n') - txt = [red(x) if 'Error' in x else x for x in txt] - txt = '\n'.join(txt) - record.args = (record.args[0], txt) - return super().format(record) -# endregion +# endregion \ No newline at end of file From 49273ca6ef87c5a8ec78c2a7584974152436ed4f Mon Sep 17 00:00:00 2001 From: David Pokora Date: Tue, 7 May 2019 20:55:59 -0400 Subject: [PATCH 2/5] Adjusted approach to make use of new exception scheme. Encapsulates JSON output with success, error, and results fields regardless of error or success. Disables logging globally. --- slither/__main__.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/slither/__main__.py b/slither/__main__.py index 0365a837f..3786252f6 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -100,10 +100,18 @@ def process_files(filenames, args, detector_classes, printer_classes): ################################################################################### +def wrap_json_stdout(success, error_message, results=None): + return { + "success": success, + "error": error_message, + "results": results + } + + def output_json(results, filename): if filename is None: # Write json to console - print(json.dumps(results)) + print(json.dumps(wrap_json_stdout(True, None, results))) else: # Write json to file if os.path.isfile(filename): @@ -504,11 +512,10 @@ def main_impl(all_detector_classes, all_printer_classes): # Set colorization option set_colorization_enabled(not args.disable_color) - # If we are outputting json to stdout, we'll want to override all logger levels. + # If we are outputting json to stdout, we'll want to disable any logging. stdout_json = args.json == "-" - override_level = None if stdout_json: - override_level = logging.ERROR + logging.disable() printer_classes = choose_printers(args, all_printer_classes) detector_classes = choose_detectors(args, all_detector_classes) @@ -529,17 +536,17 @@ def main_impl(all_detector_classes, all_printer_classes): #('CryticCompile', default_log) ]: l = logging.getLogger(l_name) - l.setLevel(l_level if override_level is None else override_level) + l.setLevel(l_level) console_handler = logging.StreamHandler() - console_handler.setLevel(logging.INFO if override_level is None else override_level) + console_handler.setLevel(logging.INFO) console_handler.setFormatter(FormatterCryticCompile()) crytic_compile_error = logging.getLogger(('CryticCompile')) crytic_compile_error.addHandler(console_handler) crytic_compile_error.propagate = False - crytic_compile_error.setLevel(logging.INFO if override_level is None else override_level) + crytic_compile_error.setLevel(logging.INFO) try: filename = args.filename @@ -582,15 +589,23 @@ def main_impl(all_detector_classes, all_printer_classes): return exit(results) - except SlitherException as e: - logging.error(red('Error:')) - logging.error(red(e)) - logging.error('Please report an issue to https://github.com/crytic/slither/issues') + except SlitherException as se: + # Output our error accordingly, via JSON or logging. + if stdout_json: + print(wrap_json_stdout(False, repr(se), [])) + else: + logging.error(red('Error:')) + logging.error(red(se)) + logging.error('Please report an issue to https://github.com/crytic/slither/issues') sys.exit(-1) except Exception: - logging.error('Error in %s' % args.filename) - logging.error(traceback.format_exc()) + # Output our error accordingly, via JSON or logging. + if stdout_json: + print(wrap_json_stdout(False, traceback.format_exc(), [])) + else: + logging.error('Error in %s' % args.filename) + logging.error(traceback.format_exc()) sys.exit(-1) From cc74512184c0a7b4c08c3ef3ad3cf340aed78757 Mon Sep 17 00:00:00 2001 From: David Pokora Date: Tue, 7 May 2019 21:29:41 -0400 Subject: [PATCH 3/5] Quick bug fix for lines which were not committed. --- slither/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slither/__main__.py b/slither/__main__.py index 3786252f6..9d194a633 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -592,7 +592,7 @@ def main_impl(all_detector_classes, all_printer_classes): except SlitherException as se: # Output our error accordingly, via JSON or logging. if stdout_json: - print(wrap_json_stdout(False, repr(se), [])) + print(json.dumps(wrap_json_stdout(False, repr(se), []))) else: logging.error(red('Error:')) logging.error(red(se)) @@ -602,7 +602,7 @@ def main_impl(all_detector_classes, all_printer_classes): except Exception: # Output our error accordingly, via JSON or logging. if stdout_json: - print(wrap_json_stdout(False, traceback.format_exc(), [])) + print(json.dumps(wrap_json_stdout(False, traceback.format_exc(), []))) else: logging.error('Error in %s' % args.filename) logging.error(traceback.format_exc()) From f901629a168f66632d41fcf8c28742452c80f409 Mon Sep 17 00:00:00 2001 From: Josselin Date: Wed, 8 May 2019 06:42:17 +0100 Subject: [PATCH 4/5] Use same json format output for file and stdout Improve --json helper Use logging.CRITICAL as an argument of logging.disable --- slither/__main__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/slither/__main__.py b/slither/__main__.py index 9d194a633..b37708fac 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -109,16 +109,17 @@ def wrap_json_stdout(success, error_message, results=None): def output_json(results, filename): + json_result = wrap_json_stdout(True, None, results) if filename is None: # Write json to console - print(json.dumps(wrap_json_stdout(True, None, results))) + print(json.dumps(json_result)) else: # Write json to file if os.path.isfile(filename): logger.info(yellow(f'{filename} exists already, the overwrite is prevented')) else: with open(filename, 'w', encoding='utf8') as f: - json.dump(results, f, indent=2) + json.dump(json_result, f, indent=2) # endregion ################################################################################### @@ -341,7 +342,7 @@ def parse_args(detector_classes, printer_classes): group_misc.add_argument('--json', - help='Export results as JSON', + help='Export the results as a JSON file ("--json -" to export to stdout)', action='store', default=defaults_flag_in_config['json']) @@ -515,7 +516,7 @@ def main_impl(all_detector_classes, all_printer_classes): # If we are outputting json to stdout, we'll want to disable any logging. stdout_json = args.json == "-" if stdout_json: - logging.disable() + logging.disable(logging.CRITICAL) printer_classes = choose_printers(args, all_printer_classes) detector_classes = choose_detectors(args, all_detector_classes) From 2c63abe9a81d94f52ae2cea67aded60aa976f7c5 Mon Sep 17 00:00:00 2001 From: Josselin Date: Wed, 8 May 2019 06:53:43 +0100 Subject: [PATCH 5/5] Update expected json --- .../arbitrary_send-0.5.1.arbitrary-send.json | 368 +-- .../arbitrary_send.arbitrary-send.json | 368 +-- tests/expected_json/backdoor.backdoor.json | 86 +- tests/expected_json/backdoor.suicidal.json | 86 +- ...onst_state_variables.constable-states.json | 226 +- .../constant-0.5.1.constant-function.json | 116 +- .../constant.constant-function.json | 442 +-- ..._delegatecall.controlled-delegatecall.json | 304 +- ...deprecated_calls.deprecated-standards.json | 350 +-- .../erc20_indexed.erc20-indexed.json | 296 +- .../external_function.external-function.json | 398 +-- ...external_function_2.external-function.json | 6 +- ...incorrect_equality.incorrect-equality.json | 2434 +++++++++-------- ...rrect_erc20_interface.erc20-interface.json | 408 +-- ...ect_erc721_interface.erc721-interface.json | 708 ++--- ...line_assembly_contract-0.5.1.assembly.json | 166 +- .../inline_assembly_contract.assembly.json | 166 +- ...nline_assembly_library-0.5.1.assembly.json | 386 +-- .../inline_assembly_library.assembly.json | 386 +-- .../locked_ether-0.5.1.locked-ether.json | 118 +- .../locked_ether.locked-ether.json | 118 +- .../low_level_calls.low-level-calls.json | 116 +- .../multiple_calls_in_loop.calls-loop.json | 136 +- .../naming_convention.naming-convention.json | 712 ++--- .../old_solc.sol.json.solc-version.json | 52 +- tests/expected_json/pragma.0.4.24.pragma.json | 90 +- tests/expected_json/pragma.0.4.24.pragma.txt | 40 +- .../reentrancy-0.5.1.reentrancy-eth.json | 484 ++-- .../reentrancy-0.5.1.reentrancy.txt | 6 +- .../reentrancy.reentrancy-eth.json | 556 ++-- .../right_to_left_override.rtlo.json | 22 +- ...shadowing_abstract.shadowing-abstract.json | 90 +- ...ing_builtin_symbols.shadowing-builtin.json | 730 ++--- ...dowing_local_variable.shadowing-local.json | 578 ++-- ...dowing_state_variable.shadowing-state.json | 90 +- .../solc_version_incorrect.solc-version.json | 90 +- tests/expected_json/timestamp.timestamp.json | 422 +-- .../too_many_digits.too-many-digits.json | 390 +-- .../tx_origin-0.5.1.tx-origin.json | 300 +- tests/expected_json/tx_origin.tx-origin.json | 300 +- ...initialized-0.5.1.uninitialized-state.json | 506 ++-- .../uninitialized.uninitialized-state.json | 506 ++-- ...ed_local_variable.uninitialized-local.json | 122 +- ...storage_pointer.uninitialized-storage.json | 132 +- ..._storage_pointer.uninitialized-storage.txt | 40 +- .../unused_return.unused-return.json | 176 +- .../unused_state.unused-state.json | 56 +- 47 files changed, 7463 insertions(+), 7215 deletions(-) diff --git a/tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json b/tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json index 21353bc8d..5386d287b 100644 --- a/tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json +++ b/tests/expected_json/arbitrary_send-0.5.1.arbitrary-send.json @@ -1,204 +1,208 @@ -[ - { - "check": "arbitrary-send", - "impact": "High", - "confidence": "Medium", - "description": "Test.direct (tests/arbitrary_send-0.5.1.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#12)\n", - "elements": [ - { - "type": "function", - "name": "direct", - "source_mapping": { - "start": 162, - "length": 79, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_relative": "tests/arbitrary_send-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_short": "tests/arbitrary_send-0.5.1.sol", - "lines": [ - 11, - 12, - 13 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Test", +{ + "success": true, + "error": null, + "results": [ + { + "check": "arbitrary-send", + "impact": "High", + "confidence": "Medium", + "description": "Test.direct (tests/arbitrary_send-0.5.1.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#12)\n", + "elements": [ + { + "type": "function", + "name": "direct", "source_mapping": { - "start": 0, - "length": 884, + "start": 162, + "length": 79, "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_relative": "tests/arbitrary_send-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_short": "tests/arbitrary_send-0.5.1.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, 11, 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41 + 13 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 884, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_relative": "tests/arbitrary_send-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_short": "tests/arbitrary_send-0.5.1.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "msg.sender.send(address(this).balance)", - "source_mapping": { - "start": 196, - "length": 38, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_relative": "tests/arbitrary_send-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_short": "tests/arbitrary_send-0.5.1.sol", - "lines": [ - 12 - ], - "starting_column": 9, - "ending_column": 47 - } - } - ] - }, - { - "check": "arbitrary-send", - "impact": "High", - "confidence": "Medium", - "description": "Test.indirect (tests/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20)\n", - "elements": [ - { - "type": "function", - "name": "indirect", - "source_mapping": { - "start": 316, - "length": 82, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_relative": "tests/arbitrary_send-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_short": "tests/arbitrary_send-0.5.1.sol", - "lines": [ - 19, - 20, - 21 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Test", + { + "type": "expression", + "expression": "msg.sender.send(address(this).balance)", "source_mapping": { - "start": 0, - "length": 884, + "start": 196, + "length": 38, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_relative": "tests/arbitrary_send-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_short": "tests/arbitrary_send-0.5.1.sol", + "lines": [ + 12 + ], + "starting_column": 9, + "ending_column": 47 + } + } + ] + }, + { + "check": "arbitrary-send", + "impact": "High", + "confidence": "Medium", + "description": "Test.indirect (tests/arbitrary_send-0.5.1.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send-0.5.1.sol#20)\n", + "elements": [ + { + "type": "function", + "name": "indirect", + "source_mapping": { + "start": 316, + "length": 82, "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_relative": "tests/arbitrary_send-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", "filename_short": "tests/arbitrary_send-0.5.1.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, 19, 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41 + 21 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 884, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_relative": "tests/arbitrary_send-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_short": "tests/arbitrary_send-0.5.1.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "destination.send(address(this).balance)", + "source_mapping": { + "start": 352, + "length": 39, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_relative": "tests/arbitrary_send-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", + "filename_short": "tests/arbitrary_send-0.5.1.sol", + "lines": [ + 20 + ], + "starting_column": 9, + "ending_column": 48 } } - }, - { - "type": "expression", - "expression": "destination.send(address(this).balance)", - "source_mapping": { - "start": 352, - "length": 39, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_relative": "tests/arbitrary_send-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send-0.5.1.sol", - "filename_short": "tests/arbitrary_send-0.5.1.sol", - "lines": [ - 20 - ], - "starting_column": 9, - "ending_column": 48 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/arbitrary_send.arbitrary-send.json b/tests/expected_json/arbitrary_send.arbitrary-send.json index bef229a85..1c1fd7637 100644 --- a/tests/expected_json/arbitrary_send.arbitrary-send.json +++ b/tests/expected_json/arbitrary_send.arbitrary-send.json @@ -1,204 +1,208 @@ -[ - { - "check": "arbitrary-send", - "impact": "High", - "confidence": "Medium", - "description": "Test.direct (tests/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send.sol#12)\n", - "elements": [ - { - "type": "function", - "name": "direct", - "source_mapping": { - "start": 147, - "length": 79, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_relative": "tests/arbitrary_send.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_short": "tests/arbitrary_send.sol", - "lines": [ - 11, - 12, - 13 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Test", +{ + "success": true, + "error": null, + "results": [ + { + "check": "arbitrary-send", + "impact": "High", + "confidence": "Medium", + "description": "Test.direct (tests/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/arbitrary_send.sol#12)\n", + "elements": [ + { + "type": "function", + "name": "direct", "source_mapping": { - "start": 0, - "length": 869, + "start": 147, + "length": 79, "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_relative": "tests/arbitrary_send.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_short": "tests/arbitrary_send.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, 11, 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41 + 13 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 869, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_relative": "tests/arbitrary_send.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_short": "tests/arbitrary_send.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "msg.sender.send(address(this).balance)", - "source_mapping": { - "start": 181, - "length": 38, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_relative": "tests/arbitrary_send.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_short": "tests/arbitrary_send.sol", - "lines": [ - 12 - ], - "starting_column": 9, - "ending_column": 47 - } - } - ] - }, - { - "check": "arbitrary-send", - "impact": "High", - "confidence": "Medium", - "description": "Test.indirect (tests/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send.sol#20)\n", - "elements": [ - { - "type": "function", - "name": "indirect", - "source_mapping": { - "start": 301, - "length": 82, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_relative": "tests/arbitrary_send.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_short": "tests/arbitrary_send.sol", - "lines": [ - 19, - 20, - 21 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Test", + { + "type": "expression", + "expression": "msg.sender.send(address(this).balance)", "source_mapping": { - "start": 0, - "length": 869, + "start": 181, + "length": 38, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_relative": "tests/arbitrary_send.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_short": "tests/arbitrary_send.sol", + "lines": [ + 12 + ], + "starting_column": 9, + "ending_column": 47 + } + } + ] + }, + { + "check": "arbitrary-send", + "impact": "High", + "confidence": "Medium", + "description": "Test.indirect (tests/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/arbitrary_send.sol#20)\n", + "elements": [ + { + "type": "function", + "name": "indirect", + "source_mapping": { + "start": 301, + "length": 82, "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_relative": "tests/arbitrary_send.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", "filename_short": "tests/arbitrary_send.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, 19, 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41 + 21 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 869, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_relative": "tests/arbitrary_send.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_short": "tests/arbitrary_send.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "destination.send(address(this).balance)", + "source_mapping": { + "start": 337, + "length": 39, + "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_relative": "tests/arbitrary_send.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", + "filename_short": "tests/arbitrary_send.sol", + "lines": [ + 20 + ], + "starting_column": 9, + "ending_column": 48 } } - }, - { - "type": "expression", - "expression": "destination.send(address(this).balance)", - "source_mapping": { - "start": 337, - "length": 39, - "filename_used": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_relative": "tests/arbitrary_send.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/arbitrary_send.sol", - "filename_short": "tests/arbitrary_send.sol", - "lines": [ - 20 - ], - "starting_column": 9, - "ending_column": 48 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/backdoor.backdoor.json b/tests/expected_json/backdoor.backdoor.json index 63acbe652..3a6ddd579 100644 --- a/tests/expected_json/backdoor.backdoor.json +++ b/tests/expected_json/backdoor.backdoor.json @@ -1,52 +1,56 @@ -[ - { - "check": "backdoor", - "impact": "High", - "confidence": "High", - "description": "Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6)\n", - "elements": [ - { - "type": "function", - "name": "i_am_a_backdoor", - "source_mapping": { - "start": 18, - "length": 74, - "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", - "filename_relative": "tests/backdoor.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", - "filename_short": "tests/backdoor.sol", - "lines": [ - 4, - 5, - 6 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "C", +{ + "success": true, + "error": null, + "results": [ + { + "check": "backdoor", + "impact": "High", + "confidence": "High", + "description": "Backdoor function found in C.i_am_a_backdoor (tests/backdoor.sol#4-6)\n", + "elements": [ + { + "type": "function", + "name": "i_am_a_backdoor", "source_mapping": { - "start": 1, - "length": 94, + "start": 18, + "length": 74, "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_relative": "tests/backdoor.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_short": "tests/backdoor.sol", "lines": [ - 2, - 3, 4, 5, - 6, - 7, - 8 + 6 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 1, + "length": 94, + "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", + "filename_relative": "tests/backdoor.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", + "filename_short": "tests/backdoor.sol", + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/backdoor.suicidal.json b/tests/expected_json/backdoor.suicidal.json index 518d72791..f194f3116 100644 --- a/tests/expected_json/backdoor.suicidal.json +++ b/tests/expected_json/backdoor.suicidal.json @@ -1,52 +1,56 @@ -[ - { - "check": "suicidal", - "impact": "High", - "confidence": "High", - "description": "C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract\n", - "elements": [ - { - "type": "function", - "name": "i_am_a_backdoor", - "source_mapping": { - "start": 18, - "length": 74, - "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", - "filename_relative": "tests/backdoor.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", - "filename_short": "tests/backdoor.sol", - "lines": [ - 4, - 5, - 6 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "C", +{ + "success": true, + "error": null, + "results": [ + { + "check": "suicidal", + "impact": "High", + "confidence": "High", + "description": "C.i_am_a_backdoor (tests/backdoor.sol#4-6) allows anyone to destruct the contract\n", + "elements": [ + { + "type": "function", + "name": "i_am_a_backdoor", "source_mapping": { - "start": 1, - "length": 94, + "start": 18, + "length": 74, "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_relative": "tests/backdoor.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", "filename_short": "tests/backdoor.sol", "lines": [ - 2, - 3, 4, 5, - 6, - 7, - 8 + 6 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 1, + "length": 94, + "filename_used": "/home/travis/build/crytic/slither/tests/backdoor.sol", + "filename_relative": "tests/backdoor.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/backdoor.sol", + "filename_short": "tests/backdoor.sol", + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/const_state_variables.constable-states.json b/tests/expected_json/const_state_variables.constable-states.json index ef3321911..7023ace96 100644 --- a/tests/expected_json/const_state_variables.constable-states.json +++ b/tests/expected_json/const_state_variables.constable-states.json @@ -1,112 +1,116 @@ -[ - { - "check": "constable-states", - "impact": "Informational", - "confidence": "High", - "description": "A.myFriendsAddress should be constant (tests/const_state_variables.sol#7)\nA.test should be constant (tests/const_state_variables.sol#10)\nA.text2 should be constant (tests/const_state_variables.sol#14)\nB.mySistersAddress should be constant (tests/const_state_variables.sol#26)\nMyConc.should_be_constant should be constant (tests/const_state_variables.sol#42)\nMyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43)\n", - "elements": [ - { - "type": "variable", - "name": "myFriendsAddress", - "source_mapping": { - "start": 132, - "length": 76, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 7 - ], - "starting_column": 5, - "ending_column": 81 +{ + "success": true, + "error": null, + "results": [ + { + "check": "constable-states", + "impact": "Informational", + "confidence": "High", + "description": "A.myFriendsAddress should be constant (tests/const_state_variables.sol#7)\nA.test should be constant (tests/const_state_variables.sol#10)\nA.text2 should be constant (tests/const_state_variables.sol#14)\nB.mySistersAddress should be constant (tests/const_state_variables.sol#26)\nMyConc.should_be_constant should be constant (tests/const_state_variables.sol#42)\nMyConc.should_be_constant_2 should be constant (tests/const_state_variables.sol#43)\n", + "elements": [ + { + "type": "variable", + "name": "myFriendsAddress", + "source_mapping": { + "start": 132, + "length": 76, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 7 + ], + "starting_column": 5, + "ending_column": 81 + } + }, + { + "type": "variable", + "name": "mySistersAddress", + "source_mapping": { + "start": 496, + "length": 76, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 26 + ], + "starting_column": 5, + "ending_column": 81 + } + }, + { + "type": "variable", + "name": "should_be_constant", + "source_mapping": { + "start": 793, + "length": 42, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 42 + ], + "starting_column": 5, + "ending_column": 47 + } + }, + { + "type": "variable", + "name": "should_be_constant_2", + "source_mapping": { + "start": 841, + "length": 33, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 43 + ], + "starting_column": 5, + "ending_column": 38 + } + }, + { + "type": "variable", + "name": "test", + "source_mapping": { + "start": 237, + "length": 20, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 10 + ], + "starting_column": 5, + "ending_column": 25 + } + }, + { + "type": "variable", + "name": "text2", + "source_mapping": { + "start": 333, + "length": 20, + "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_relative": "tests/const_state_variables.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", + "filename_short": "tests/const_state_variables.sol", + "lines": [ + 14 + ], + "starting_column": 5, + "ending_column": 25 + } } - }, - { - "type": "variable", - "name": "mySistersAddress", - "source_mapping": { - "start": 496, - "length": 76, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 26 - ], - "starting_column": 5, - "ending_column": 81 - } - }, - { - "type": "variable", - "name": "should_be_constant", - "source_mapping": { - "start": 793, - "length": 42, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 42 - ], - "starting_column": 5, - "ending_column": 47 - } - }, - { - "type": "variable", - "name": "should_be_constant_2", - "source_mapping": { - "start": 841, - "length": 33, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 43 - ], - "starting_column": 5, - "ending_column": 38 - } - }, - { - "type": "variable", - "name": "test", - "source_mapping": { - "start": 237, - "length": 20, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 10 - ], - "starting_column": 5, - "ending_column": 25 - } - }, - { - "type": "variable", - "name": "text2", - "source_mapping": { - "start": 333, - "length": 20, - "filename_used": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_relative": "tests/const_state_variables.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/const_state_variables.sol", - "filename_short": "tests/const_state_variables.sol", - "lines": [ - 14 - ], - "starting_column": 5, - "ending_column": 25 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/constant-0.5.1.constant-function.json b/tests/expected_json/constant-0.5.1.constant-function.json index 0193f4fa0..c5d2539b4 100644 --- a/tests/expected_json/constant-0.5.1.constant-function.json +++ b/tests/expected_json/constant-0.5.1.constant-function.json @@ -1,67 +1,71 @@ -[ - { - "check": "constant-function", - "impact": "Medium", - "confidence": "Medium", - "description": "Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code\n", - "elements": [ - { - "type": "function", - "name": "test_assembly_bug", - "source_mapping": { - "start": 185, - "length": 66, - "filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", - "filename_relative": "tests/constant-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", - "filename_short": "tests/constant-0.5.1.sol", - "lines": [ - 15, - 16, - 17 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Constant", +{ + "success": true, + "error": null, + "results": [ + { + "check": "constant-function", + "impact": "Medium", + "confidence": "Medium", + "description": "Constant.test_assembly_bug (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code\n", + "elements": [ + { + "type": "function", + "name": "test_assembly_bug", "source_mapping": { - "start": 0, - "length": 253, + "start": 185, + "length": 66, "filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", "filename_relative": "tests/constant-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", "filename_short": "tests/constant-0.5.1.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, 15, 16, - 17, - 18 + 17 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Constant", + "source_mapping": { + "start": 0, + "length": 253, + "filename_used": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", + "filename_relative": "tests/constant-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant-0.5.1.sol", + "filename_short": "tests/constant-0.5.1.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18 + ], + "starting_column": 1, + "ending_column": 2 + } } + }, + { + "type": "info", + "contains_assembly": true } - }, - { - "type": "info", - "contains_assembly": true - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/constant.constant-function.json b/tests/expected_json/constant.constant-function.json index c2206ddb0..57de386a5 100644 --- a/tests/expected_json/constant.constant-function.json +++ b/tests/expected_json/constant.constant-function.json @@ -1,252 +1,256 @@ -[ - { - "check": "constant-function", - "impact": "Medium", - "confidence": "Medium", - "description": "Constant.test_view_bug (tests/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a\n", - "elements": [ - { - "type": "function", - "name": "test_view_bug", - "source_mapping": { - "start": 45, - "length": 58, - "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_relative": "tests/constant.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_short": "tests/constant.sol", - "lines": [ - 5, - 6, - 7 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Constant", +{ + "success": true, + "error": null, + "results": [ + { + "check": "constant-function", + "impact": "Medium", + "confidence": "Medium", + "description": "Constant.test_view_bug (tests/constant.sol#5-7) is declared view but changes state variables:\n\t- Constant.a\n", + "elements": [ + { + "type": "function", + "name": "test_view_bug", "source_mapping": { - "start": 0, - "length": 392, + "start": 45, + "length": 58, "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_relative": "tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_short": "tests/constant.sol", "lines": [ - 1, - 2, - 3, - 4, 5, 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Constant", + "source_mapping": { + "start": 0, + "length": 392, + "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_relative": "tests/constant.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_short": "tests/constant.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "variable", - "name": "a", - "source_mapping": { - "start": 28, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_relative": "tests/constant.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_short": "tests/constant.sol", - "lines": [ - 3 - ], - "starting_column": 5, - "ending_column": 11 - } - }, - { - "type": "info", - "contains_assembly": false - } - ] - }, - { - "check": "constant-function", - "impact": "Medium", - "confidence": "Medium", - "description": "Constant.test_constant_bug (tests/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a\n", - "elements": [ - { - "type": "function", - "name": "test_constant_bug", - "source_mapping": { - "start": 113, - "length": 66, - "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_relative": "tests/constant.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_short": "tests/constant.sol", - "lines": [ - 9, - 10, - 11 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Constant", + { + "type": "variable", + "name": "a", "source_mapping": { - "start": 0, - "length": 392, + "start": 28, + "length": 6, "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_relative": "tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_short": "tests/constant.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25 + 3 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 11 } - } - }, - { - "type": "variable", - "name": "a", - "source_mapping": { - "start": 28, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_relative": "tests/constant.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_short": "tests/constant.sol", - "lines": [ - 3 - ], - "starting_column": 5, - "ending_column": 11 - } - }, - { - "type": "info", - "contains_assembly": false - } - ] - }, - { - "check": "constant-function", - "impact": "Medium", - "confidence": "Medium", - "description": "Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code\n", - "elements": [ - { - "type": "function", - "name": "test_assembly_bug", - "source_mapping": { - "start": 324, - "length": 66, - "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_relative": "tests/constant.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", - "filename_short": "tests/constant.sol", - "lines": [ - 22, - 23, - 24 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Constant", + { + "type": "info", + "contains_assembly": false + } + ] + }, + { + "check": "constant-function", + "impact": "Medium", + "confidence": "Medium", + "description": "Constant.test_constant_bug (tests/constant.sol#9-11) is declared view but changes state variables:\n\t- Constant.a\n", + "elements": [ + { + "type": "function", + "name": "test_constant_bug", "source_mapping": { - "start": 0, - "length": 392, + "start": 113, + "length": 66, "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_relative": "tests/constant.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", "filename_short": "tests/constant.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, 9, 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Constant", + "source_mapping": { + "start": 0, + "length": 392, + "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_relative": "tests/constant.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_short": "tests/constant.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "variable", + "name": "a", + "source_mapping": { + "start": 28, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_relative": "tests/constant.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_short": "tests/constant.sol", + "lines": [ + 3 + ], + "starting_column": 5, + "ending_column": 11 + } + }, + { + "type": "info", + "contains_assembly": false + } + ] + }, + { + "check": "constant-function", + "impact": "Medium", + "confidence": "Medium", + "description": "Constant.test_assembly_bug (tests/constant.sol#22-24) is declared view but contains assembly code\n", + "elements": [ + { + "type": "function", + "name": "test_assembly_bug", + "source_mapping": { + "start": 324, + "length": 66, + "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_relative": "tests/constant.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_short": "tests/constant.sol", + "lines": [ 22, 23, - 24, - 25 + 24 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Constant", + "source_mapping": { + "start": 0, + "length": 392, + "filename_used": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_relative": "tests/constant.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol", + "filename_short": "tests/constant.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ], + "starting_column": 1, + "ending_column": 2 + } } + }, + { + "type": "info", + "contains_assembly": true } - }, - { - "type": "info", - "contains_assembly": true - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json b/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json index 79a8c4383..21a7b3d60 100644 --- a/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json +++ b/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json @@ -1,173 +1,177 @@ -[ - { - "check": "controlled-delegatecall", - "impact": "High", - "confidence": "Medium", - "description": "C.bad_delegate_call (tests/controlled_delegatecall.sol#8-11) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(data) (tests/controlled_delegatecall.sol#10)\n", - "elements": [ - { - "type": "function", - "name": "bad_delegate_call", - "source_mapping": { - "start": 101, - "length": 134, - "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_relative": "tests/controlled_delegatecall.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_short": "tests/controlled_delegatecall.sol", - "lines": [ - 8, - 9, - 10, - 11 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "C", +{ + "success": true, + "error": null, + "results": [ + { + "check": "controlled-delegatecall", + "impact": "High", + "confidence": "Medium", + "description": "C.bad_delegate_call (tests/controlled_delegatecall.sol#8-11) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(data) (tests/controlled_delegatecall.sol#10)\n", + "elements": [ + { + "type": "function", + "name": "bad_delegate_call", "source_mapping": { - "start": 0, - "length": 585, + "start": 101, + "length": 134, "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_relative": "tests/controlled_delegatecall.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_short": "tests/controlled_delegatecall.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, 8, 9, 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25 + 11 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 585, + "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_relative": "tests/controlled_delegatecall.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_short": "tests/controlled_delegatecall.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "addr_bad.delegatecall(data)", - "source_mapping": { - "start": 201, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_relative": "tests/controlled_delegatecall.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_short": "tests/controlled_delegatecall.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 36 - } - } - ] - }, - { - "check": "controlled-delegatecall", - "impact": "High", - "confidence": "Medium", - "description": "C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19)\n", - "elements": [ - { - "type": "function", - "name": "bad_delegate_call2", - "source_mapping": { - "start": 337, - "length": 118, - "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_relative": "tests/controlled_delegatecall.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_short": "tests/controlled_delegatecall.sol", - "lines": [ - 18, - 19, - 20 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "C", + { + "type": "expression", + "expression": "addr_bad.delegatecall(data)", "source_mapping": { - "start": 0, - "length": 585, + "start": 201, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_relative": "tests/controlled_delegatecall.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_short": "tests/controlled_delegatecall.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 36 + } + } + ] + }, + { + "check": "controlled-delegatecall", + "impact": "High", + "confidence": "Medium", + "description": "C.bad_delegate_call2 (tests/controlled_delegatecall.sol#18-20) uses delegatecall to a input-controlled function id\n\taddr_bad.delegatecall(abi.encode(func_id,data)) (tests/controlled_delegatecall.sol#19)\n", + "elements": [ + { + "type": "function", + "name": "bad_delegate_call2", + "source_mapping": { + "start": 337, + "length": 118, "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_relative": "tests/controlled_delegatecall.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", "filename_short": "tests/controlled_delegatecall.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, 18, 19, - 20, - 21, - 22, - 23, - 24, - 25 + 20 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 585, + "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_relative": "tests/controlled_delegatecall.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_short": "tests/controlled_delegatecall.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "addr_bad.delegatecall(abi.encode(func_id,data))", + "source_mapping": { + "start": 400, + "length": 48, + "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_relative": "tests/controlled_delegatecall.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", + "filename_short": "tests/controlled_delegatecall.sol", + "lines": [ + 19 + ], + "starting_column": 9, + "ending_column": 57 } } - }, - { - "type": "expression", - "expression": "addr_bad.delegatecall(abi.encode(func_id,data))", - "source_mapping": { - "start": 400, - "length": 48, - "filename_used": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_relative": "tests/controlled_delegatecall.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/controlled_delegatecall.sol", - "filename_short": "tests/controlled_delegatecall.sol", - "lines": [ - 19 - ], - "starting_column": 9, - "ending_column": 57 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/deprecated_calls.deprecated-standards.json b/tests/expected_json/deprecated_calls.deprecated-standards.json index 606a2d766..850eb3a4e 100644 --- a/tests/expected_json/deprecated_calls.deprecated-standards.json +++ b/tests/expected_json/deprecated_calls.deprecated-standards.json @@ -1,180 +1,184 @@ -[ - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#2:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", - "elements": [ - { - "type": "variable", - "name": "globalBlockHash", - "source_mapping": { - "start": 48, - "length": 44, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 2 - ], - "starting_column": 5, - "ending_column": 49 +{ + "success": true, + "error": null, + "results": [ + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#2:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", + "elements": [ + { + "type": "variable", + "name": "globalBlockHash", + "source_mapping": { + "start": 48, + "length": 44, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 2 + ], + "starting_column": 5, + "ending_column": 49 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#7-10:\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n", - "elements": [ - { - "type": "expression", - "expression": "msg.gas == msg.value", - "source_mapping": { - "start": 258, - "length": 107, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 7, - 8, - 9, - 10 - ], - "starting_column": 9, - "ending_column": 10 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#7-10:\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n", + "elements": [ + { + "type": "expression", + "expression": "msg.gas == msg.value", + "source_mapping": { + "start": 258, + "length": 107, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 7, + 8, + 9, + 10 + ], + "starting_column": 9, + "ending_column": 10 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#9:\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n", - "elements": [ - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 349, - "length": 5, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 9 - ], - "starting_column": 13, - "ending_column": 18 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#9:\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n", + "elements": [ + { + "type": "expression", + "expression": "None", + "source_mapping": { + "start": 349, + "length": 5, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 9 + ], + "starting_column": 13, + "ending_column": 18 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#16:\n\t- Usage of \"sha3()\" should be replaced with \"keccak256()\"\n", - "elements": [ - { - "type": "expression", - "expression": "sha3Result = sha3()(test deprecated sha3 usage)", - "source_mapping": { - "start": 542, - "length": 55, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 16 - ], - "starting_column": 9, - "ending_column": 64 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#16:\n\t- Usage of \"sha3()\" should be replaced with \"keccak256()\"\n", + "elements": [ + { + "type": "expression", + "expression": "sha3Result = sha3()(test deprecated sha3 usage)", + "source_mapping": { + "start": 542, + "length": 55, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 16 + ], + "starting_column": 9, + "ending_column": 64 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#19:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", - "elements": [ - { - "type": "expression", - "expression": "blockHashResult = block.blockhash(0)", - "source_mapping": { - "start": 671, - "length": 44, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 19 - ], - "starting_column": 9, - "ending_column": 53 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#19:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n", + "elements": [ + { + "type": "expression", + "expression": "blockHashResult = block.blockhash(0)", + "source_mapping": { + "start": 671, + "length": 44, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 19 + ], + "starting_column": 9, + "ending_column": 53 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#22:\n\t- Usage of \"callcode\" should be replaced with \"delegatecall\"\n", - "elements": [ - { - "type": "expression", - "expression": "address(this).callcode()", - "source_mapping": { - "start": 785, - "length": 24, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 22 - ], - "starting_column": 9, - "ending_column": 33 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#22:\n\t- Usage of \"callcode\" should be replaced with \"delegatecall\"\n", + "elements": [ + { + "type": "expression", + "expression": "address(this).callcode()", + "source_mapping": { + "start": 785, + "length": 24, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 22 + ], + "starting_column": 9, + "ending_column": 33 + } } - } - ] - }, - { - "check": "deprecated-standards", - "impact": "Informational", - "confidence": "High", - "description": "Deprecated standard detected @ tests/deprecated_calls.sol#25:\n\t- Usage of \"suicide()\" should be replaced with \"selfdestruct()\"\n", - "elements": [ - { - "type": "expression", - "expression": "suicide(address)(address(0))", - "source_mapping": { - "start": 878, - "length": 19, - "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_relative": "tests/deprecated_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", - "filename_short": "tests/deprecated_calls.sol", - "lines": [ - 25 - ], - "starting_column": 9, - "ending_column": 28 + ] + }, + { + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High", + "description": "Deprecated standard detected @ tests/deprecated_calls.sol#25:\n\t- Usage of \"suicide()\" should be replaced with \"selfdestruct()\"\n", + "elements": [ + { + "type": "expression", + "expression": "suicide(address)(address(0))", + "source_mapping": { + "start": 878, + "length": 19, + "filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_relative": "tests/deprecated_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol", + "filename_short": "tests/deprecated_calls.sol", + "lines": [ + 25 + ], + "starting_column": 9, + "ending_column": 28 + } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/erc20_indexed.erc20-indexed.json b/tests/expected_json/erc20_indexed.erc20-indexed.json index e59622bbe..f26ea1407 100644 --- a/tests/expected_json/erc20_indexed.erc20-indexed.json +++ b/tests/expected_json/erc20_indexed.erc20-indexed.json @@ -1,182 +1,186 @@ -[ - { - "check": "erc20-indexed", - "impact": "Informational", - "confidence": "High", - "description": "IERC20Bad (tests/erc20_indexed.sol#12-21) does not mark important ERC20 parameters as 'indexed':\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'from'\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'to'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender'\n", - "elements": [ - { - "type": "function", - "name": "Approval", - "source_mapping": { - "start": 1148, - "length": 59, - "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_relative": "tests/erc20_indexed.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_short": "tests/erc20_indexed.sol", - "lines": [ - 20 - ], - "starting_column": 5, - "ending_column": 64 - }, - "contract": { - "type": "contract", - "name": "IERC20Bad", +{ + "success": true, + "error": null, + "results": [ + { + "check": "erc20-indexed", + "impact": "Informational", + "confidence": "High", + "description": "IERC20Bad (tests/erc20_indexed.sol#12-21) does not mark important ERC20 parameters as 'indexed':\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'from'\n\t-Transfer (tests/erc20_indexed.sol#19) does not index parameter 'to'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'owner'\n\t-Approval (tests/erc20_indexed.sol#20) does not index parameter 'spender'\n", + "elements": [ + { + "type": "function", + "name": "Approval", "source_mapping": { - "start": 622, - "length": 587, + "start": 1148, + "length": 59, "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol", "lines": [ - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 + 20 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 64 + }, + "contract": { + "type": "contract", + "name": "IERC20Bad", + "source_mapping": { + "start": 622, + "length": 587, + "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_relative": "tests/erc20_indexed.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_short": "tests/erc20_indexed.sol", + "lines": [ + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "Approval", - "source_mapping": { - "start": 1148, - "length": 59, - "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_relative": "tests/erc20_indexed.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_short": "tests/erc20_indexed.sol", - "lines": [ - 20 - ], - "starting_column": 5, - "ending_column": 64 }, - "contract": { - "type": "contract", - "name": "IERC20Bad", + { + "type": "function", + "name": "Approval", "source_mapping": { - "start": 622, - "length": 587, + "start": 1148, + "length": 59, "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol", "lines": [ - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 + 20 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 64 + }, + "contract": { + "type": "contract", + "name": "IERC20Bad", + "source_mapping": { + "start": 622, + "length": 587, + "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_relative": "tests/erc20_indexed.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_short": "tests/erc20_indexed.sol", + "lines": [ + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "Transfer", - "source_mapping": { - "start": 1090, - "length": 53, - "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_relative": "tests/erc20_indexed.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_short": "tests/erc20_indexed.sol", - "lines": [ - 19 - ], - "starting_column": 5, - "ending_column": 58 }, - "contract": { - "type": "contract", - "name": "IERC20Bad", + { + "type": "function", + "name": "Transfer", "source_mapping": { - "start": 622, - "length": 587, + "start": 1090, + "length": 53, "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol", "lines": [ - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 + 19 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 58 + }, + "contract": { + "type": "contract", + "name": "IERC20Bad", + "source_mapping": { + "start": 622, + "length": 587, + "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_relative": "tests/erc20_indexed.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_short": "tests/erc20_indexed.sol", + "lines": [ + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "Transfer", - "source_mapping": { - "start": 1090, - "length": 53, - "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_relative": "tests/erc20_indexed.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", - "filename_short": "tests/erc20_indexed.sol", - "lines": [ - 19 - ], - "starting_column": 5, - "ending_column": 58 }, - "contract": { - "type": "contract", - "name": "IERC20Bad", + { + "type": "function", + "name": "Transfer", "source_mapping": { - "start": 622, - "length": 587, + "start": 1090, + "length": 53, "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_relative": "tests/erc20_indexed.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", "filename_short": "tests/erc20_indexed.sol", "lines": [ - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 + 19 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 58 + }, + "contract": { + "type": "contract", + "name": "IERC20Bad", + "source_mapping": { + "start": 622, + "length": 587, + "filename_used": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_relative": "tests/erc20_indexed.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/erc20_indexed.sol", + "filename_short": "tests/erc20_indexed.sol", + "lines": [ + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/external_function.external-function.json b/tests/expected_json/external_function.external-function.json index 0a04a39e4..4457e9a64 100644 --- a/tests/expected_json/external_function.external-function.json +++ b/tests/expected_json/external_function.external-function.json @@ -1,231 +1,210 @@ -[ - { - "check": "external-function", - "impact": "Informational", - "confidence": "High", - "description": "ContractWithFunctionNotCalled.funcNotCalled3 (tests/external_function.sol#13-15) should be declared external\n", - "elements": [ - { - "type": "function", - "name": "funcNotCalled3", - "source_mapping": { - "start": 259, - "length": 41, - "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_relative": "tests/external_function.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_short": "tests/external_function.sol", - "lines": [ - 13, - 14, - 15 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ContractWithFunctionNotCalled", +{ + "success": true, + "error": null, + "results": [ + { + "check": "external-function", + "impact": "Informational", + "confidence": "High", + "description": "ContractWithFunctionNotCalled.funcNotCalled3 (tests/external_function.sol#13-15) should be declared external\n", + "elements": [ + { + "type": "function", + "name": "funcNotCalled3", "source_mapping": { - "start": 213, - "length": 258, + "start": 259, + "length": 41, "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_relative": "tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_short": "tests/external_function.sol", "lines": [ - 11, - 12, 13, 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29 + 15 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ContractWithFunctionNotCalled", + "source_mapping": { + "start": 213, + "length": 258, + "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_relative": "tests/external_function.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_short": "tests/external_function.sol", + "lines": [ + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "external-function", - "impact": "Informational", - "confidence": "High", - "description": "ContractWithFunctionNotCalled.funcNotCalled2 (tests/external_function.sol#17-19) should be declared external\n", - "elements": [ - { - "type": "function", - "name": "funcNotCalled2", - "source_mapping": { - "start": 306, - "length": 41, - "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_relative": "tests/external_function.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_short": "tests/external_function.sol", - "lines": [ - 17, - 18, - 19 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ContractWithFunctionNotCalled", + ] + }, + { + "check": "external-function", + "impact": "Informational", + "confidence": "High", + "description": "ContractWithFunctionNotCalled.funcNotCalled2 (tests/external_function.sol#17-19) should be declared external\n", + "elements": [ + { + "type": "function", + "name": "funcNotCalled2", "source_mapping": { - "start": 213, - "length": 258, + "start": 306, + "length": 41, "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_relative": "tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_short": "tests/external_function.sol", "lines": [ - 11, - 12, - 13, - 14, - 15, - 16, 17, 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29 + 19 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ContractWithFunctionNotCalled", + "source_mapping": { + "start": 213, + "length": 258, + "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_relative": "tests/external_function.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_short": "tests/external_function.sol", + "lines": [ + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "external-function", - "impact": "Informational", - "confidence": "High", - "description": "ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external\n", - "elements": [ - { - "type": "function", - "name": "funcNotCalled", - "source_mapping": { - "start": 353, - "length": 40, - "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_relative": "tests/external_function.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_short": "tests/external_function.sol", - "lines": [ - 21, - 22, - 23 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ContractWithFunctionNotCalled", + ] + }, + { + "check": "external-function", + "impact": "Informational", + "confidence": "High", + "description": "ContractWithFunctionNotCalled.funcNotCalled (tests/external_function.sol#21-23) should be declared external\n", + "elements": [ + { + "type": "function", + "name": "funcNotCalled", "source_mapping": { - "start": 213, - "length": 258, + "start": 353, + "length": 40, "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_relative": "tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_short": "tests/external_function.sol", "lines": [ - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, 21, 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29 + 23 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ContractWithFunctionNotCalled", + "source_mapping": { + "start": 213, + "length": 258, + "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_relative": "tests/external_function.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_short": "tests/external_function.sol", + "lines": [ + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "external-function", - "impact": "Informational", - "confidence": "High", - "description": "ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external\n", - "elements": [ - { - "type": "function", - "name": "funcNotCalled", - "source_mapping": { - "start": 554, - "length": 325, - "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_relative": "tests/external_function.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", - "filename_short": "tests/external_function.sol", - "lines": [ - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ContractWithFunctionNotCalled2", + ] + }, + { + "check": "external-function", + "impact": "Informational", + "confidence": "High", + "description": "ContractWithFunctionNotCalled2.funcNotCalled (tests/external_function.sol#32-39) should be declared external\n", + "elements": [ + { + "type": "function", + "name": "funcNotCalled", "source_mapping": { - "start": 473, - "length": 408, + "start": 554, + "length": 325, "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_relative": "tests/external_function.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", "filename_short": "tests/external_function.sol", "lines": [ - 31, 32, 33, 34, @@ -233,14 +212,39 @@ 36, 37, 38, - 39, - 40 + 39 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ContractWithFunctionNotCalled2", + "source_mapping": { + "start": 473, + "length": 408, + "filename_used": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_relative": "tests/external_function.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/external_function.sol", + "filename_short": "tests/external_function.sol", + "lines": [ + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/external_function_2.external-function.json b/tests/expected_json/external_function_2.external-function.json index 0637a088a..0e2fa6477 100644 --- a/tests/expected_json/external_function_2.external-function.json +++ b/tests/expected_json/external_function_2.external-function.json @@ -1 +1,5 @@ -[] \ No newline at end of file +{ + "success": true, + "error": null, + "results": [] +} \ No newline at end of file diff --git a/tests/expected_json/incorrect_equality.incorrect-equality.json b/tests/expected_json/incorrect_equality.incorrect-equality.json index c2bfd8c01..32f599992 100644 --- a/tests/expected_json/incorrect_equality.incorrect-equality.json +++ b/tests/expected_json/incorrect_equality.incorrect-equality.json @@ -1,1366 +1,1370 @@ -[ - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "ERC20TestBalance.bad0 (tests/incorrect_equality.sol#21-23) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(address(this)) == 10)\n", - "elements": [ - { - "type": "function", - "name": "bad0", - "source_mapping": { - "start": 404, - "length": 101, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 21, - 22, - 23 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ERC20TestBalance", +{ + "success": true, + "error": null, + "results": [ + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "ERC20TestBalance.bad0 (tests/incorrect_equality.sol#21-23) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(address(this)) == 10)\n", + "elements": [ + { + "type": "function", + "name": "bad0", "source_mapping": { - "start": 165, - "length": 445, + "start": 404, + "length": 101, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, 21, 22, - 23, - 24, - 25, - 26, - 27, - 28 + 23 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ERC20TestBalance", + "source_mapping": { + "start": 165, + "length": 445, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(erc.balanceOf(address(this)) == 10)", - "source_mapping": { - "start": 455, - "length": 43, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 22 - ], - "starting_column": 9, - "ending_column": 52 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "ERC20TestBalance.bad0 (tests/incorrect_equality.sol#21-23) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(address(this)) == 10)\nERC20TestBalance.bad1 (tests/incorrect_equality.sol#25-27) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(msg.sender) == 10)\n", - "elements": [ - { - "type": "function", - "name": "bad1", - "source_mapping": { - "start": 511, - "length": 97, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 25, - 26, - 27 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "ERC20TestBalance", + { + "type": "expression", + "expression": "require(bool)(erc.balanceOf(address(this)) == 10)", "source_mapping": { - "start": 165, - "length": 445, + "start": 455, + "length": 43, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 22 + ], + "starting_column": 9, + "ending_column": 52 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "ERC20TestBalance.bad0 (tests/incorrect_equality.sol#21-23) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(address(this)) == 10)\nERC20TestBalance.bad1 (tests/incorrect_equality.sol#25-27) uses a dangerous strict equality:\n\t- require(bool)(erc.balanceOf(msg.sender) == 10)\n", + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 511, + "length": 97, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, 25, 26, - 27, - 28 + 27 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ERC20TestBalance", + "source_mapping": { + "start": 165, + "length": 445, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(erc.balanceOf(msg.sender) == 10)", - "source_mapping": { - "start": 562, - "length": 39, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 26 - ], - "starting_column": 9, - "ending_column": 48 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\n", - "elements": [ - { - "type": "function", - "name": "bad0", - "source_mapping": { - "start": 648, - "length": 133, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 32, - 33, - 34, - 35 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + { + "type": "expression", + "expression": "require(bool)(erc.balanceOf(msg.sender) == 10)", "source_mapping": { - "start": 612, - "length": 1754, + "start": 562, + "length": 39, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 26 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 48 } } - }, - { - "type": "expression", - "expression": "require(bool)(address(address(this)).balance == 10000000000000000000)", - "source_mapping": { - "start": 683, - "length": 51, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 33 - ], - "starting_column": 9, - "ending_column": 60 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\n", - "elements": [ - { - "type": "function", - "name": "bad1", - "source_mapping": { - "start": 787, - "length": 133, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 37, - 38, - 39, - 40 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\n", + "elements": [ + { + "type": "function", + "name": "bad0", "source_mapping": { - "start": 612, - "length": 1754, + "start": 648, + "length": 133, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, 32, 33, 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 35 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(10000000000000000000 == address(address(this)).balance)", - "source_mapping": { - "start": 822, - "length": 51, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 38 - ], - "starting_column": 9, - "ending_column": 60 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\n", - "elements": [ - { - "type": "function", - "name": "bad2", - "source_mapping": { - "start": 926, - "length": 124, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 42, - 43, - 44, - 45 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + { + "type": "expression", + "expression": "require(bool)(address(address(this)).balance == 10000000000000000000)", "source_mapping": { - "start": 612, - "length": 1754, + "start": 683, + "length": 51, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 33 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 60 } } - }, - { - "type": "expression", - "expression": "require(bool)(address(this).balance == 10000000000000000000)", - "source_mapping": { - "start": 961, - "length": 42, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 43 - ], - "starting_column": 9, - "ending_column": 51 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\n", - "elements": [ - { - "type": "function", - "name": "bad3", - "source_mapping": { - "start": 1056, - "length": 124, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 47, - 48, - 49, - 50 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\n", + "elements": [ + { + "type": "function", + "name": "bad1", "source_mapping": { - "start": 612, - "length": 1754, + "start": 787, + "length": 133, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, 37, 38, 39, - 40, - 41, + 40 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(10000000000000000000 == address(address(this)).balance)", + "source_mapping": { + "start": 822, + "length": 51, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 38 + ], + "starting_column": 9, + "ending_column": 60 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\n", + "elements": [ + { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 926, + "length": 124, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 42, 43, 44, - 45, - 46, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(address(this).balance == 10000000000000000000)", + "source_mapping": { + "start": 961, + "length": 42, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 43 + ], + "starting_column": 9, + "ending_column": 51 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\n", + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1056, + "length": 124, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 47, 48, 49, - 50, - 51, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(10000000000000000000 == address(this).balance)", + "source_mapping": { + "start": 1091, + "length": 42, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 48 + ], + "starting_column": 9, + "ending_column": 51 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\n", + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1186, + "length": 170, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 52, 53, 54, 55, 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 57 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(10000000000000000000 == address(this).balance)", - "source_mapping": { - "start": 1091, - "length": 42, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 48 - ], - "starting_column": 9, - "ending_column": 51 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\n", - "elements": [ - { - "type": "function", - "name": "bad4", - "source_mapping": { - "start": 1186, - "length": 170, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 52, - 53, - 54, - 55, - 56, - 57 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + { + "type": "expression", + "expression": "balance == 10000000000000000000", "source_mapping": { - "start": 612, - "length": 1754, + "start": 1270, + "length": 80, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, 54, 55, - 56, - 57, - 58, + 56 + ], + "starting_column": 9, + "ending_column": 10 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\nTestContractBalance.bad5 (tests/incorrect_equality.sol#59-64) uses a dangerous strict equality:\n\t- 10000000000000000000 == balance\n", + "elements": [ + { + "type": "function", + "name": "bad5", + "source_mapping": { + "start": 1362, + "length": 170, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 59, 60, 61, 62, 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 64 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "balance == 10000000000000000000", - "source_mapping": { - "start": 1270, - "length": 80, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 54, - 55, - 56 - ], - "starting_column": 9, - "ending_column": 10 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\nTestContractBalance.bad5 (tests/incorrect_equality.sol#59-64) uses a dangerous strict equality:\n\t- 10000000000000000000 == balance\n", - "elements": [ - { - "type": "function", - "name": "bad5", - "source_mapping": { - "start": 1362, - "length": 170, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 59, - 60, - 61, - 62, - 63, - 64 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + { + "type": "expression", + "expression": "10000000000000000000 == balance", "source_mapping": { - "start": 612, - "length": 1754, + "start": 1446, + "length": 80, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, 61, 62, - 63, - 64, - 65, + 63 + ], + "starting_column": 9, + "ending_column": 10 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\nTestContractBalance.bad5 (tests/incorrect_equality.sol#59-64) uses a dangerous strict equality:\n\t- 10000000000000000000 == balance\nTestContractBalance.bad6 (tests/incorrect_equality.sol#66-71) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\n", + "elements": [ + { + "type": "function", + "name": "bad6", + "source_mapping": { + "start": 1538, + "length": 179, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 66, 67, 68, 69, 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 71 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestContractBalance", + "source_mapping": { + "start": 612, + "length": 1754, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "10000000000000000000 == balance", - "source_mapping": { - "start": 1446, - "length": 80, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 61, - 62, - 63 - ], - "starting_column": 9, - "ending_column": 10 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestContractBalance.bad0 (tests/incorrect_equality.sol#32-35) uses a dangerous strict equality:\n\t- require(bool)(address(address(this)).balance == 10000000000000000000)\nTestContractBalance.bad1 (tests/incorrect_equality.sol#37-40) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(address(this)).balance)\nTestContractBalance.bad2 (tests/incorrect_equality.sol#42-45) uses a dangerous strict equality:\n\t- require(bool)(address(this).balance == 10000000000000000000)\nTestContractBalance.bad3 (tests/incorrect_equality.sol#47-50) uses a dangerous strict equality:\n\t- require(bool)(10000000000000000000 == address(this).balance)\nTestContractBalance.bad4 (tests/incorrect_equality.sol#52-57) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\nTestContractBalance.bad5 (tests/incorrect_equality.sol#59-64) uses a dangerous strict equality:\n\t- 10000000000000000000 == balance\nTestContractBalance.bad6 (tests/incorrect_equality.sol#66-71) uses a dangerous strict equality:\n\t- balance == 10000000000000000000\n", - "elements": [ - { - "type": "function", - "name": "bad6", - "source_mapping": { - "start": 1538, - "length": 179, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 66, - 67, - 68, - 69, - 70, - 71 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestContractBalance", + { + "type": "expression", + "expression": "balance == 10000000000000000000", "source_mapping": { - "start": 612, - "length": 1754, + "start": 1631, + "length": 80, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, 68, 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97 + 70 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 10 } } - }, - { - "type": "expression", - "expression": "balance == 10000000000000000000", - "source_mapping": { - "start": 1631, - "length": 80, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 68, - 69, - 70 - ], - "starting_column": 9, - "ending_column": 10 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\n", - "elements": [ - { - "type": "function", - "name": "bad0", - "source_mapping": { - "start": 2935, - "length": 59, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 123, - 124, - 125 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TestSolidityKeyword", + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\n", + "elements": [ + { + "type": "function", + "name": "bad0", "source_mapping": { - "start": 2368, - "length": 774, + "start": 2935, + "length": 59, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, 123, 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135 + 125 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestSolidityKeyword", + "source_mapping": { + "start": 2368, + "length": 774, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(now == 0)", - "source_mapping": { - "start": 2969, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 124 - ], - "starting_column": 9, - "ending_column": 27 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\nTestSolidityKeyword.bad1 (tests/incorrect_equality.sol#127-129) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\n", - "elements": [ - { - "type": "function", - "name": "bad1", - "source_mapping": { - "start": 3000, - "length": 66, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 127, - 128, - 129 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TestSolidityKeyword", + { + "type": "expression", + "expression": "require(bool)(now == 0)", "source_mapping": { - "start": 2368, - "length": 774, + "start": 2969, + "length": 18, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 132, - 133, - 134, - 135 + 124 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 27 } } - }, - { - "type": "expression", - "expression": "require(bool)(block.number == 0)", - "source_mapping": { - "start": 3034, - "length": 25, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 128 - ], - "starting_column": 9, - "ending_column": 34 - } - } - ] - }, - { - "check": "incorrect-equality", - "impact": "Medium", - "confidence": "High", - "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\nTestSolidityKeyword.bad1 (tests/incorrect_equality.sol#127-129) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\nTestSolidityKeyword.bad2 (tests/incorrect_equality.sol#131-133) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\n", - "elements": [ - { - "type": "function", - "name": "bad2", - "source_mapping": { - "start": 3072, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 131, - 132, - 133 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TestSolidityKeyword", + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\nTestSolidityKeyword.bad1 (tests/incorrect_equality.sol#127-129) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\n", + "elements": [ + { + "type": "function", + "name": "bad1", "source_mapping": { - "start": 2368, - "length": 774, + "start": 3000, + "length": 66, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_relative": "tests/incorrect_equality.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", "filename_short": "tests/incorrect_equality.sol", "lines": [ - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 112, - 113, - 114, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 123, - 124, - 125, - 126, 127, 128, - 129, - 130, + 129 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestSolidityKeyword", + "source_mapping": { + "start": 2368, + "length": 774, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(block.number == 0)", + "source_mapping": { + "start": 3034, + "length": 25, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 128 + ], + "starting_column": 9, + "ending_column": 34 + } + } + ] + }, + { + "check": "incorrect-equality", + "impact": "Medium", + "confidence": "High", + "description": "TestSolidityKeyword.bad0 (tests/incorrect_equality.sol#123-125) uses a dangerous strict equality:\n\t- require(bool)(now == 0)\nTestSolidityKeyword.bad1 (tests/incorrect_equality.sol#127-129) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\nTestSolidityKeyword.bad2 (tests/incorrect_equality.sol#131-133) uses a dangerous strict equality:\n\t- require(bool)(block.number == 0)\n", + "elements": [ + { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 3072, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ 131, 132, - 133, - 134, - 135 + 133 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TestSolidityKeyword", + "source_mapping": { + "start": 2368, + "length": 774, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(block.number == 0)", + "source_mapping": { + "start": 3106, + "length": 26, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_relative": "tests/incorrect_equality.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", + "filename_short": "tests/incorrect_equality.sol", + "lines": [ + 132 + ], + "starting_column": 9, + "ending_column": 35 } } - }, - { - "type": "expression", - "expression": "require(bool)(block.number == 0)", - "source_mapping": { - "start": 3106, - "length": 26, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_relative": "tests/incorrect_equality.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_equality.sol", - "filename_short": "tests/incorrect_equality.sol", - "lines": [ - 132 - ], - "starting_column": 9, - "ending_column": 35 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/incorrect_erc20_interface.erc20-interface.json b/tests/expected_json/incorrect_erc20_interface.erc20-interface.json index dceec9be7..5497a834b 100644 --- a/tests/expected_json/incorrect_erc20_interface.erc20-interface.json +++ b/tests/expected_json/incorrect_erc20_interface.erc20-interface.json @@ -1,256 +1,260 @@ -[ - { - "check": "erc20-interface", - "impact": "Medium", - "confidence": "High", - "description": "Token (tests/incorrect_erc20_interface.sol#3-10) has incorrect ERC20 function interface(s):\n\t-transfer (tests/incorrect_erc20_interface.sol#4)\n\t-approve (tests/incorrect_erc20_interface.sol#5)\n\t-transferFrom (tests/incorrect_erc20_interface.sol#6)\n\t-totalSupply (tests/incorrect_erc20_interface.sol#7)\n\t-balanceOf (tests/incorrect_erc20_interface.sol#8)\n\t-allowance (tests/incorrect_erc20_interface.sol#9)\n", - "elements": [ - { - "type": "function", - "name": "allowance", - "source_mapping": { - "start": 319, - "length": 60, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 9 - ], - "starting_column": 5, - "ending_column": 65 - }, - "contract": { - "type": "contract", - "name": "Token", +{ + "success": true, + "error": null, + "results": [ + { + "check": "erc20-interface", + "impact": "Medium", + "confidence": "High", + "description": "Token (tests/incorrect_erc20_interface.sol#3-10) has incorrect ERC20 function interface(s):\n\t-transfer (tests/incorrect_erc20_interface.sol#4)\n\t-approve (tests/incorrect_erc20_interface.sol#5)\n\t-transferFrom (tests/incorrect_erc20_interface.sol#6)\n\t-totalSupply (tests/incorrect_erc20_interface.sol#7)\n\t-balanceOf (tests/incorrect_erc20_interface.sol#8)\n\t-allowance (tests/incorrect_erc20_interface.sol#9)\n", + "elements": [ + { + "type": "function", + "name": "allowance", "source_mapping": { - "start": 26, - "length": 355, + "start": 319, + "length": 60, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 9 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 65 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "approve", - "source_mapping": { - "start": 102, - "length": 55, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 5 - ], - "starting_column": 5, - "ending_column": 60 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "approve", "source_mapping": { - "start": 26, - "length": 355, + "start": 102, + "length": 55, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 5 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 60 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "balanceOf", - "source_mapping": { - "start": 273, - "length": 41, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 8 - ], - "starting_column": 5, - "ending_column": 46 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "balanceOf", "source_mapping": { - "start": 26, - "length": 355, + "start": 273, + "length": 41, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 8 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 46 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "totalSupply", - "source_mapping": { - "start": 236, - "length": 32, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 7 - ], - "starting_column": 5, - "ending_column": 37 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "totalSupply", "source_mapping": { - "start": 26, - "length": 355, + "start": 236, + "length": 32, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 37 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "transfer", - "source_mapping": { - "start": 46, - "length": 51, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 4 - ], - "starting_column": 5, - "ending_column": 56 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "transfer", "source_mapping": { - "start": 26, - "length": 355, + "start": 46, + "length": 51, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 4 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 56 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "transferFrom", - "source_mapping": { - "start": 162, - "length": 69, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_relative": "tests/incorrect_erc20_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", - "filename_short": "tests/incorrect_erc20_interface.sol", - "lines": [ - 6 - ], - "starting_column": 5, - "ending_column": 74 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "transferFrom", "source_mapping": { - "start": 26, - "length": 355, + "start": 162, + "length": 69, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_relative": "tests/incorrect_erc20_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", "filename_short": "tests/incorrect_erc20_interface.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 + 6 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 74 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 26, + "length": 355, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_relative": "tests/incorrect_erc20_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc20_interface.sol", + "filename_short": "tests/incorrect_erc20_interface.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/incorrect_erc721_interface.erc721-interface.json b/tests/expected_json/incorrect_erc721_interface.erc721-interface.json index 9f48193b7..2be0d3edb 100644 --- a/tests/expected_json/incorrect_erc721_interface.erc721-interface.json +++ b/tests/expected_json/incorrect_erc721_interface.erc721-interface.json @@ -1,442 +1,446 @@ -[ - { - "check": "erc721-interface", - "impact": "Medium", - "confidence": "High", - "description": "Token (tests/incorrect_erc721_interface.sol#6-16) has incorrect ERC721 function interface(s):\n\t-supportsInterface (tests/incorrect_erc721_interface.sol#4)\n\t-balanceOf (tests/incorrect_erc721_interface.sol#7)\n\t-ownerOf (tests/incorrect_erc721_interface.sol#8)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#9)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#10)\n\t-transferFrom (tests/incorrect_erc721_interface.sol#11)\n\t-approve (tests/incorrect_erc721_interface.sol#12)\n\t-setApprovalForAll (tests/incorrect_erc721_interface.sol#13)\n\t-getApproved (tests/incorrect_erc721_interface.sol#14)\n\t-isApprovedForAll (tests/incorrect_erc721_interface.sol#15)\n", - "elements": [ - { - "type": "function", - "name": "approve", - "source_mapping": { - "start": 549, - "length": 78, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 12 - ], - "starting_column": 5, - "ending_column": 83 - }, - "contract": { - "type": "contract", - "name": "Token", +{ + "success": true, + "error": null, + "results": [ + { + "check": "erc721-interface", + "impact": "Medium", + "confidence": "High", + "description": "Token (tests/incorrect_erc721_interface.sol#6-16) has incorrect ERC721 function interface(s):\n\t-supportsInterface (tests/incorrect_erc721_interface.sol#4)\n\t-balanceOf (tests/incorrect_erc721_interface.sol#7)\n\t-ownerOf (tests/incorrect_erc721_interface.sol#8)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#9)\n\t-safeTransferFrom (tests/incorrect_erc721_interface.sol#10)\n\t-transferFrom (tests/incorrect_erc721_interface.sol#11)\n\t-approve (tests/incorrect_erc721_interface.sol#12)\n\t-setApprovalForAll (tests/incorrect_erc721_interface.sol#13)\n\t-getApproved (tests/incorrect_erc721_interface.sol#14)\n\t-isApprovedForAll (tests/incorrect_erc721_interface.sol#15)\n", + "elements": [ + { + "type": "function", + "name": "approve", "source_mapping": { - "start": 109, - "length": 739, + "start": 549, + "length": 78, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 12 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 83 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "balanceOf", - "source_mapping": { - "start": 140, - "length": 44, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 7 - ], - "starting_column": 5, - "ending_column": 49 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "balanceOf", "source_mapping": { - "start": 109, - "length": 739, + "start": 140, + "length": 44, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 49 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "getApproved", - "source_mapping": { - "start": 723, - "length": 48, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 14 - ], - "starting_column": 5, - "ending_column": 53 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "getApproved", "source_mapping": { - "start": 109, - "length": 739, + "start": 723, + "length": 48, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 14 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 53 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "isApprovedForAll", - "source_mapping": { - "start": 776, - "length": 70, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 15 - ], - "starting_column": 5, - "ending_column": 75 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "isApprovedForAll", "source_mapping": { - "start": 109, - "length": 739, + "start": 776, + "length": 70, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 15 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 75 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "ownerOf", - "source_mapping": { - "start": 189, - "length": 44, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 8 - ], - "starting_column": 5, - "ending_column": 49 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "ownerOf", "source_mapping": { - "start": 109, - "length": 739, + "start": 189, + "length": 44, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 8 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 49 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "safeTransferFrom", - "source_mapping": { - "start": 238, - "length": 108, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 9 - ], - "starting_column": 5, - "ending_column": 113 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "safeTransferFrom", "source_mapping": { - "start": 109, - "length": 739, + "start": 238, + "length": 108, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 9 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 113 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "safeTransferFrom", - "source_mapping": { - "start": 351, - "length": 96, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 10 - ], - "starting_column": 5, - "ending_column": 101 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "safeTransferFrom", "source_mapping": { - "start": 109, - "length": 739, + "start": 351, + "length": 96, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 10 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 101 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "setApprovalForAll", - "source_mapping": { - "start": 632, - "length": 86, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 13 - ], - "starting_column": 5, - "ending_column": 91 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "setApprovalForAll", "source_mapping": { - "start": 109, - "length": 739, + "start": 632, + "length": 86, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 13 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 91 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "supportsInterface", - "source_mapping": { - "start": 50, - "length": 56, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 4 - ], - "starting_column": 5, - "ending_column": 61 }, - "contract": { - "type": "contract", - "name": "IERC165", + { + "type": "function", + "name": "supportsInterface", "source_mapping": { - "start": 26, - "length": 82, + "start": 50, + "length": 56, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 3, - 4, - 5 + 4 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 61 + }, + "contract": { + "type": "contract", + "name": "IERC165", + "source_mapping": { + "start": 26, + "length": 82, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 3, + 4, + 5 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "function", - "name": "transferFrom", - "source_mapping": { - "start": 452, - "length": 92, - "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_relative": "tests/incorrect_erc721_interface.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", - "filename_short": "tests/incorrect_erc721_interface.sol", - "lines": [ - 11 - ], - "starting_column": 5, - "ending_column": 97 }, - "contract": { - "type": "contract", - "name": "Token", + { + "type": "function", + "name": "transferFrom", "source_mapping": { - "start": 109, - "length": 739, + "start": 452, + "length": 92, "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_relative": "tests/incorrect_erc721_interface.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", "filename_short": "tests/incorrect_erc721_interface.sol", "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 + 11 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 97 + }, + "contract": { + "type": "contract", + "name": "Token", + "source_mapping": { + "start": 109, + "length": 739, + "filename_used": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_relative": "tests/incorrect_erc721_interface.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/incorrect_erc721_interface.sol", + "filename_short": "tests/incorrect_erc721_interface.sol", + "lines": [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json index 411804ce9..3ef498bf6 100644 --- a/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json +++ b/tests/expected_json/inline_assembly_contract-0.5.1.assembly.json @@ -1,52 +1,24 @@ -[ - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20)\n\t- tests/inline_assembly_contract-0.5.1.sol#7-20\n", - "elements": [ - { - "type": "function", - "name": "at", - "source_mapping": { - "start": 119, - "length": 707, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", - "filename_relative": "tests/inline_assembly_contract-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", - "filename_short": "tests/inline_assembly_contract-0.5.1.sol", - "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "GetCode", +{ + "success": true, + "error": null, + "results": [ + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "GetCode.at uses assembly (tests/inline_assembly_contract-0.5.1.sol#6-20)\n\t- tests/inline_assembly_contract-0.5.1.sol#7-20\n", + "elements": [ + { + "type": "function", + "name": "at", "source_mapping": { - "start": 97, - "length": 731, + "start": 119, + "length": 707, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", "filename_relative": "tests/inline_assembly_contract-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", "filename_short": "tests/inline_assembly_contract-0.5.1.sol", "lines": [ - 5, 6, 7, 8, @@ -61,44 +33,76 @@ 17, 18, 19, - 20, - 21 + 20 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "GetCode", + "source_mapping": { + "start": 97, + "length": 731, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", + "filename_relative": "tests/inline_assembly_contract-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", + "filename_short": "tests/inline_assembly_contract-0.5.1.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "None", + "source_mapping": { + "start": 198, + "length": 628, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", + "filename_relative": "tests/inline_assembly_contract-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", + "filename_short": "tests/inline_assembly_contract-0.5.1.sol", + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20 + ], + "starting_column": 9, + "ending_column": 6 } } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 198, - "length": 628, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", - "filename_relative": "tests/inline_assembly_contract-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract-0.5.1.sol", - "filename_short": "tests/inline_assembly_contract-0.5.1.sol", - "lines": [ - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 - ], - "starting_column": 9, - "ending_column": 6 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/inline_assembly_contract.assembly.json b/tests/expected_json/inline_assembly_contract.assembly.json index 5ff73de62..7765ddae0 100644 --- a/tests/expected_json/inline_assembly_contract.assembly.json +++ b/tests/expected_json/inline_assembly_contract.assembly.json @@ -1,52 +1,24 @@ -[ - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20)\n\t- tests/inline_assembly_contract.sol#7-20\n", - "elements": [ - { - "type": "function", - "name": "at", - "source_mapping": { - "start": 119, - "length": 700, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", - "filename_relative": "tests/inline_assembly_contract.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", - "filename_short": "tests/inline_assembly_contract.sol", - "lines": [ - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "GetCode", +{ + "success": true, + "error": null, + "results": [ + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "GetCode.at uses assembly (tests/inline_assembly_contract.sol#6-20)\n\t- tests/inline_assembly_contract.sol#7-20\n", + "elements": [ + { + "type": "function", + "name": "at", "source_mapping": { - "start": 97, - "length": 724, + "start": 119, + "length": 700, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", "filename_relative": "tests/inline_assembly_contract.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", "filename_short": "tests/inline_assembly_contract.sol", "lines": [ - 5, 6, 7, 8, @@ -61,44 +33,76 @@ 17, 18, 19, - 20, - 21 + 20 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "GetCode", + "source_mapping": { + "start": 97, + "length": 724, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", + "filename_relative": "tests/inline_assembly_contract.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", + "filename_short": "tests/inline_assembly_contract.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "None", + "source_mapping": { + "start": 191, + "length": 628, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", + "filename_relative": "tests/inline_assembly_contract.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", + "filename_short": "tests/inline_assembly_contract.sol", + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20 + ], + "starting_column": 9, + "ending_column": 6 } } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 191, - "length": 628, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", - "filename_relative": "tests/inline_assembly_contract.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_contract.sol", - "filename_short": "tests/inline_assembly_contract.sol", - "lines": [ - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 - ], - "starting_column": 9, - "ending_column": 6 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/inline_assembly_library-0.5.1.assembly.json b/tests/expected_json/inline_assembly_library-0.5.1.assembly.json index 6e35724ff..f205542bd 100644 --- a/tests/expected_json/inline_assembly_library-0.5.1.assembly.json +++ b/tests/expected_json/inline_assembly_library-0.5.1.assembly.json @@ -1,63 +1,135 @@ -[ - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#16-22)\n\t- tests/inline_assembly_library-0.5.1.sol#18-21\n", - "elements": [ - { - "type": "function", - "name": "sumAsm", - "source_mapping": { - "start": 599, - "length": 254, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_relative": "tests/inline_assembly_library-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_short": "tests/inline_assembly_library-0.5.1.sol", - "lines": [ - 16, - 17, - 18, - 19, - 20, - 21, - 22 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "VectorSum", +{ + "success": true, + "error": null, + "results": [ + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#16-22)\n\t- tests/inline_assembly_library-0.5.1.sol#18-21\n", + "elements": [ + { + "type": "function", + "name": "sumAsm", "source_mapping": { - "start": 97, - "length": 1602, + "start": 599, + "length": 254, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_relative": "tests/inline_assembly_library-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_short": "tests/inline_assembly_library-0.5.1.sol", "lines": [ - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, 16, 17, 18, 19, 20, 21, - 22, - 23, - 24, + 22 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "VectorSum", + "source_mapping": { + "start": 97, + "length": 1602, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_relative": "tests/inline_assembly_library-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_short": "tests/inline_assembly_library-0.5.1.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "None", + "source_mapping": { + "start": 733, + "length": 114, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_relative": "tests/inline_assembly_library-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_short": "tests/inline_assembly_library-0.5.1.sol", + "lines": [ + 18, + 19, + 20, + 21 + ], + "starting_column": 13, + "ending_column": 10 + } + } + ] + }, + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47)\n\t- tests/inline_assembly_library-0.5.1.sol#26-47\n", + "elements": [ + { + "type": "function", + "name": "sumPureAsm", + "source_mapping": { + "start": 936, + "length": 761, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_relative": "tests/inline_assembly_library-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_short": "tests/inline_assembly_library-0.5.1.sol", + "lines": [ 25, 26, 27, @@ -80,112 +152,83 @@ 44, 45, 46, - 47, - 48 + 47 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "VectorSum", + "source_mapping": { + "start": 97, + "length": 1602, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_relative": "tests/inline_assembly_library-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", + "filename_short": "tests/inline_assembly_library-0.5.1.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 733, - "length": 114, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_relative": "tests/inline_assembly_library-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_short": "tests/inline_assembly_library-0.5.1.sol", - "lines": [ - 18, - 19, - 20, - 21 - ], - "starting_column": 13, - "ending_column": 10 - } - } - ] - }, - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library-0.5.1.sol#25-47)\n\t- tests/inline_assembly_library-0.5.1.sol#26-47\n", - "elements": [ - { - "type": "function", - "name": "sumPureAsm", - "source_mapping": { - "start": 936, - "length": 761, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_relative": "tests/inline_assembly_library-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_short": "tests/inline_assembly_library-0.5.1.sol", - "lines": [ - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "VectorSum", + { + "type": "expression", + "expression": "None", "source_mapping": { - "start": 97, - "length": 1602, + "start": 1020, + "length": 677, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_relative": "tests/inline_assembly_library-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", "filename_short": "tests/inline_assembly_library-0.5.1.sol", "lines": [ - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, 26, 27, 28, @@ -207,52 +250,13 @@ 44, 45, 46, - 47, - 48 + 47 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 6 } } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 1020, - "length": 677, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_relative": "tests/inline_assembly_library-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library-0.5.1.sol", - "filename_short": "tests/inline_assembly_library-0.5.1.sol", - "lines": [ - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47 - ], - "starting_column": 9, - "ending_column": 6 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/inline_assembly_library.assembly.json b/tests/expected_json/inline_assembly_library.assembly.json index b62b14efc..2a657e2c0 100644 --- a/tests/expected_json/inline_assembly_library.assembly.json +++ b/tests/expected_json/inline_assembly_library.assembly.json @@ -1,63 +1,135 @@ -[ - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library.sol#16-22)\n\t- tests/inline_assembly_library.sol#18-21\n", - "elements": [ - { - "type": "function", - "name": "sumAsm", - "source_mapping": { - "start": 593, - "length": 247, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_relative": "tests/inline_assembly_library.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_short": "tests/inline_assembly_library.sol", - "lines": [ - 16, - 17, - 18, - 19, - 20, - 21, - 22 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "VectorSum", +{ + "success": true, + "error": null, + "results": [ + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "VectorSum.sumAsm uses assembly (tests/inline_assembly_library.sol#16-22)\n\t- tests/inline_assembly_library.sol#18-21\n", + "elements": [ + { + "type": "function", + "name": "sumAsm", "source_mapping": { - "start": 98, - "length": 1581, + "start": 593, + "length": 247, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_relative": "tests/inline_assembly_library.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_short": "tests/inline_assembly_library.sol", "lines": [ - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, 16, 17, 18, 19, 20, 21, - 22, - 23, - 24, + 22 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "VectorSum", + "source_mapping": { + "start": 98, + "length": 1581, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_relative": "tests/inline_assembly_library.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_short": "tests/inline_assembly_library.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "None", + "source_mapping": { + "start": 720, + "length": 114, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_relative": "tests/inline_assembly_library.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_short": "tests/inline_assembly_library.sol", + "lines": [ + 18, + 19, + 20, + 21 + ], + "starting_column": 13, + "ending_column": 10 + } + } + ] + }, + { + "check": "assembly", + "impact": "Informational", + "confidence": "High", + "description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47)\n\t- tests/inline_assembly_library.sol#26-47\n", + "elements": [ + { + "type": "function", + "name": "sumPureAsm", + "source_mapping": { + "start": 923, + "length": 754, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_relative": "tests/inline_assembly_library.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_short": "tests/inline_assembly_library.sol", + "lines": [ 25, 26, 27, @@ -80,112 +152,83 @@ 44, 45, 46, - 47, - 48 + 47 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "VectorSum", + "source_mapping": { + "start": 98, + "length": 1581, + "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_relative": "tests/inline_assembly_library.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", + "filename_short": "tests/inline_assembly_library.sol", + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 720, - "length": 114, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_relative": "tests/inline_assembly_library.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_short": "tests/inline_assembly_library.sol", - "lines": [ - 18, - 19, - 20, - 21 - ], - "starting_column": 13, - "ending_column": 10 - } - } - ] - }, - { - "check": "assembly", - "impact": "Informational", - "confidence": "High", - "description": "VectorSum.sumPureAsm uses assembly (tests/inline_assembly_library.sol#25-47)\n\t- tests/inline_assembly_library.sol#26-47\n", - "elements": [ - { - "type": "function", - "name": "sumPureAsm", - "source_mapping": { - "start": 923, - "length": 754, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_relative": "tests/inline_assembly_library.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_short": "tests/inline_assembly_library.sol", - "lines": [ - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "VectorSum", + { + "type": "expression", + "expression": "None", "source_mapping": { - "start": 98, - "length": 1581, + "start": 1000, + "length": 677, "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_relative": "tests/inline_assembly_library.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", "filename_short": "tests/inline_assembly_library.sol", "lines": [ - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, 26, 27, 28, @@ -207,52 +250,13 @@ 44, 45, 46, - 47, - 48 + 47 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 6 } } - }, - { - "type": "expression", - "expression": "None", - "source_mapping": { - "start": 1000, - "length": 677, - "filename_used": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_relative": "tests/inline_assembly_library.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/inline_assembly_library.sol", - "filename_short": "tests/inline_assembly_library.sol", - "lines": [ - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47 - ], - "starting_column": 9, - "ending_column": 6 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/locked_ether-0.5.1.locked-ether.json b/tests/expected_json/locked_ether-0.5.1.locked-ether.json index e6344b3e1..d028789f0 100644 --- a/tests/expected_json/locked_ether-0.5.1.locked-ether.json +++ b/tests/expected_json/locked_ether-0.5.1.locked-ether.json @@ -1,69 +1,73 @@ -[ - { - "check": "locked-ether", - "impact": "Medium", - "confidence": "High", - "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether-0.5.1.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", - "elements": [ - { - "type": "function", - "name": "receive", - "source_mapping": { - "start": 46, - "length": 72, - "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", - "filename_relative": "tests/locked_ether-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", - "filename_short": "tests/locked_ether-0.5.1.sol", - "lines": [ - 4, - 5, - 6 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Locked", +{ + "success": true, + "error": null, + "results": [ + { + "check": "locked-ether", + "impact": "Medium", + "confidence": "High", + "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether-0.5.1.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", + "elements": [ + { + "type": "function", + "name": "receive", "source_mapping": { - "start": 24, - "length": 97, + "start": 46, + "length": 72, "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", "filename_relative": "tests/locked_ether-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", "filename_short": "tests/locked_ether-0.5.1.sol", "lines": [ - 2, - 3, 4, 5, - 6, - 7, - 8 + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Locked", + "source_mapping": { + "start": 24, + "length": 97, + "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", + "filename_relative": "tests/locked_ether-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", + "filename_short": "tests/locked_ether-0.5.1.sol", + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "contract", + "name": "OnlyLocked", + "source_mapping": { + "start": 375, + "length": 32, + "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", + "filename_relative": "tests/locked_ether-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", + "filename_short": "tests/locked_ether-0.5.1.sol", + "lines": [ + 26 ], "starting_column": 1, - "ending_column": 2 + "ending_column": 33 } } - }, - { - "type": "contract", - "name": "OnlyLocked", - "source_mapping": { - "start": 375, - "length": 32, - "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", - "filename_relative": "tests/locked_ether-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether-0.5.1.sol", - "filename_short": "tests/locked_ether-0.5.1.sol", - "lines": [ - 26 - ], - "starting_column": 1, - "ending_column": 33 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/locked_ether.locked-ether.json b/tests/expected_json/locked_ether.locked-ether.json index 951c8201e..a4bd6a4c9 100644 --- a/tests/expected_json/locked_ether.locked-ether.json +++ b/tests/expected_json/locked_ether.locked-ether.json @@ -1,69 +1,73 @@ -[ - { - "check": "locked-ether", - "impact": "Medium", - "confidence": "High", - "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", - "elements": [ - { - "type": "function", - "name": "receive", - "source_mapping": { - "start": 47, - "length": 72, - "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", - "filename_relative": "tests/locked_ether.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", - "filename_short": "tests/locked_ether.sol", - "lines": [ - 4, - 5, - 6 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Locked", +{ + "success": true, + "error": null, + "results": [ + { + "check": "locked-ether", + "impact": "Medium", + "confidence": "High", + "description": "Contract locking ether found in :\n\tContract OnlyLocked has payable functions:\n\t - receive (tests/locked_ether.sol#4-6)\n\tBut does not have a function to withdraw the ether\n", + "elements": [ + { + "type": "function", + "name": "receive", "source_mapping": { - "start": 25, - "length": 97, + "start": 47, + "length": 72, "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", "filename_relative": "tests/locked_ether.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", "filename_short": "tests/locked_ether.sol", "lines": [ - 2, - 3, 4, 5, - 6, - 7, - 8 + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Locked", + "source_mapping": { + "start": 25, + "length": 97, + "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", + "filename_relative": "tests/locked_ether.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", + "filename_short": "tests/locked_ether.sol", + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "contract", + "name": "OnlyLocked", + "source_mapping": { + "start": 368, + "length": 32, + "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", + "filename_relative": "tests/locked_ether.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", + "filename_short": "tests/locked_ether.sol", + "lines": [ + 26 ], "starting_column": 1, - "ending_column": 2 + "ending_column": 33 } } - }, - { - "type": "contract", - "name": "OnlyLocked", - "source_mapping": { - "start": 368, - "length": 32, - "filename_used": "/home/travis/build/crytic/slither/tests/locked_ether.sol", - "filename_relative": "tests/locked_ether.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/locked_ether.sol", - "filename_short": "tests/locked_ether.sol", - "lines": [ - 26 - ], - "starting_column": 1, - "ending_column": 33 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/low_level_calls.low-level-calls.json b/tests/expected_json/low_level_calls.low-level-calls.json index b39cd3c89..ee5520852 100644 --- a/tests/expected_json/low_level_calls.low-level-calls.json +++ b/tests/expected_json/low_level_calls.low-level-calls.json @@ -1,67 +1,71 @@ -[ - { - "check": "low-level-calls", - "impact": "Informational", - "confidence": "High", - "description": "Low level call in Sender.send (tests/low_level_calls.sol#5-7):\n\t-_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6\n", - "elements": [ - { - "type": "function", - "name": "send", - "source_mapping": { - "start": 51, - "length": 112, - "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", - "filename_relative": "tests/low_level_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", - "filename_short": "tests/low_level_calls.sol", - "lines": [ - 5, - 6, - 7 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Sender", +{ + "success": true, + "error": null, + "results": [ + { + "check": "low-level-calls", + "impact": "Informational", + "confidence": "High", + "description": "Low level call in Sender.send (tests/low_level_calls.sol#5-7):\n\t-_receiver.call.value(msg.value).gas(7777)() tests/low_level_calls.sol#6\n", + "elements": [ + { + "type": "function", + "name": "send", "source_mapping": { - "start": 29, - "length": 136, + "start": 51, + "length": 112, "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", "filename_relative": "tests/low_level_calls.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", "filename_short": "tests/low_level_calls.sol", "lines": [ - 4, 5, 6, - 7, - 8 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Sender", + "source_mapping": { + "start": 29, + "length": 136, + "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", + "filename_relative": "tests/low_level_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", + "filename_short": "tests/low_level_calls.sol", + "lines": [ + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "_receiver.call.value(msg.value).gas(7777)()", + "source_mapping": { + "start": 111, + "length": 45, + "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", + "filename_relative": "tests/low_level_calls.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", + "filename_short": "tests/low_level_calls.sol", + "lines": [ + 6 + ], + "starting_column": 9, + "ending_column": 54 } } - }, - { - "type": "expression", - "expression": "_receiver.call.value(msg.value).gas(7777)()", - "source_mapping": { - "start": 111, - "length": 45, - "filename_used": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", - "filename_relative": "tests/low_level_calls.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/low_level_calls.sol", - "filename_short": "tests/low_level_calls.sol", - "lines": [ - 6 - ], - "starting_column": 9, - "ending_column": 54 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/multiple_calls_in_loop.calls-loop.json b/tests/expected_json/multiple_calls_in_loop.calls-loop.json index 5744f7759..d991cc3f5 100644 --- a/tests/expected_json/multiple_calls_in_loop.calls-loop.json +++ b/tests/expected_json/multiple_calls_in_loop.calls-loop.json @@ -1,79 +1,83 @@ -[ - { - "check": "calls-loop", - "impact": "Low", - "confidence": "Medium", - "description": "CallInLoop.bad has external calls inside a loop:\n\t- destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11)\n", - "elements": [ - { - "type": "function", - "name": "bad", - "source_mapping": { - "start": 153, - "length": 135, - "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", - "filename_relative": "tests/multiple_calls_in_loop.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", - "filename_short": "tests/multiple_calls_in_loop.sol", - "lines": [ - 9, - 10, - 11, - 12, - 13 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "CallInLoop", +{ + "success": true, + "error": null, + "results": [ + { + "check": "calls-loop", + "impact": "Low", + "confidence": "Medium", + "description": "CallInLoop.bad has external calls inside a loop:\n\t- destinations[i].transfer(i) (tests/multiple_calls_in_loop.sol#11)\n", + "elements": [ + { + "type": "function", + "name": "bad", "source_mapping": { - "start": 0, - "length": 291, + "start": 153, + "length": 135, "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", "filename_relative": "tests/multiple_calls_in_loop.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", "filename_short": "tests/multiple_calls_in_loop.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, 9, 10, 11, 12, - 13, - 14, - 15 + 13 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "CallInLoop", + "source_mapping": { + "start": 0, + "length": 291, + "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", + "filename_relative": "tests/multiple_calls_in_loop.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", + "filename_short": "tests/multiple_calls_in_loop.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "destinations[i].transfer(i)", + "source_mapping": { + "start": 244, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", + "filename_relative": "tests/multiple_calls_in_loop.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", + "filename_short": "tests/multiple_calls_in_loop.sol", + "lines": [ + 11 + ], + "starting_column": 13, + "ending_column": 40 } } - }, - { - "type": "expression", - "expression": "destinations[i].transfer(i)", - "source_mapping": { - "start": 244, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", - "filename_relative": "tests/multiple_calls_in_loop.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/multiple_calls_in_loop.sol", - "filename_short": "tests/multiple_calls_in_loop.sol", - "lines": [ - 11 - ], - "starting_column": 13, - "ending_column": 40 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/naming_convention.naming-convention.json b/tests/expected_json/naming_convention.naming-convention.json index bb0e83712..647382512 100644 --- a/tests/expected_json/naming_convention.naming-convention.json +++ b/tests/expected_json/naming_convention.naming-convention.json @@ -1,366 +1,370 @@ -[ - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Contract 'naming' (tests/naming_convention.sol#3-48) is not in CapWords\n", - "elements": [ - { - "target": "contract", - "convention": "CapWords", - "name": "naming", - "source_mapping": { - "start": 28, - "length": 642, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48 - ], - "starting_column": 1, - "ending_column": 2 +{ + "success": true, + "error": null, + "results": [ + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Contract 'naming' (tests/naming_convention.sol#3-48) is not in CapWords\n", + "elements": [ + { + "target": "contract", + "convention": "CapWords", + "name": "naming", + "source_mapping": { + "start": 28, + "length": 642, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Struct 'naming.test' (tests/naming_convention.sol#14-16) is not in CapWords\n", - "elements": [ - { - "target": "structure", - "convention": "CapWords", - "name": "test", - "source_mapping": { - "start": 229, - "length": 35, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 14, - 15, - 16 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Struct 'naming.test' (tests/naming_convention.sol#14-16) is not in CapWords\n", + "elements": [ + { + "target": "structure", + "convention": "CapWords", + "name": "test", + "source_mapping": { + "start": 229, + "length": 35, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 14, + 15, + 16 + ], + "starting_column": 5, + "ending_column": 6 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Event 'naming.event_' (tests/naming_convention.sol#23) is not in CapWords\n", - "elements": [ - { - "target": "event", - "convention": "CapWords", - "name": "event_", - "source_mapping": { - "start": 335, - "length": 19, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 23 - ], - "starting_column": 5, - "ending_column": 24 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Event 'naming.event_' (tests/naming_convention.sol#23) is not in CapWords\n", + "elements": [ + { + "target": "event", + "convention": "CapWords", + "name": "event_", + "source_mapping": { + "start": 335, + "length": 19, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 23 + ], + "starting_column": 5, + "ending_column": 24 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Function 'naming.GetOne' (tests/naming_convention.sol#30-33) is not in mixedCase\n", - "elements": [ - { - "target": "function", - "convention": "mixedCase", - "name": "GetOne", - "source_mapping": { - "start": 440, - "length": 75, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 30, - 31, - 32, - 33 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Function 'naming.GetOne' (tests/naming_convention.sol#30-33) is not in mixedCase\n", + "elements": [ + { + "target": "function", + "convention": "mixedCase", + "name": "GetOne", + "source_mapping": { + "start": 440, + "length": 75, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 30, + 31, + 32, + 33 + ], + "starting_column": 5, + "ending_column": 6 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Parameter 'Number2' of naming.setInt (tests/naming_convention.sol#35) is not in mixedCase\n", - "elements": [ - { - "target": "parameter", - "convention": "mixedCase", - "name": "Number2", - "source_mapping": { - "start": 551, - "length": 12, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 35 - ], - "starting_column": 35, - "ending_column": 47 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Parameter 'Number2' of naming.setInt (tests/naming_convention.sol#35) is not in mixedCase\n", + "elements": [ + { + "target": "parameter", + "convention": "mixedCase", + "name": "Number2", + "source_mapping": { + "start": 551, + "length": 12, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 35 + ], + "starting_column": 35, + "ending_column": 47 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Constant 'naming.MY_other_CONSTANT' (tests/naming_convention.sol#9) is not in UPPER_CASE_WITH_UNDERSCORES\n", - "elements": [ - { - "target": "variable_constant", - "convention": "UPPER_CASE_WITH_UNDERSCORES", - "name": "MY_other_CONSTANT", - "source_mapping": { - "start": 143, - "length": 35, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 9 - ], - "starting_column": 5, - "ending_column": 40 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Constant 'naming.MY_other_CONSTANT' (tests/naming_convention.sol#9) is not in UPPER_CASE_WITH_UNDERSCORES\n", + "elements": [ + { + "target": "variable_constant", + "convention": "UPPER_CASE_WITH_UNDERSCORES", + "name": "MY_other_CONSTANT", + "source_mapping": { + "start": 143, + "length": 35, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 9 + ], + "starting_column": 5, + "ending_column": 40 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Variable 'naming.Var_One' (tests/naming_convention.sol#11) is not in mixedCase\n", - "elements": [ - { - "target": "variable", - "convention": "mixedCase", - "name": "Var_One", - "source_mapping": { - "start": 185, - "length": 16, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 11 - ], - "starting_column": 5, - "ending_column": 21 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Variable 'naming.Var_One' (tests/naming_convention.sol#11) is not in mixedCase\n", + "elements": [ + { + "target": "variable", + "convention": "mixedCase", + "name": "Var_One", + "source_mapping": { + "start": 185, + "length": 16, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 11 + ], + "starting_column": 5, + "ending_column": 21 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Enum 'naming.numbers' (tests/naming_convention.sol#6) is not in CapWords\n", - "elements": [ - { - "target": "enum", - "convention": "CapWords", - "name": "numbers", - "source_mapping": { - "start": 79, - "length": 23, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 6 - ], - "starting_column": 5, - "ending_column": 28 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Enum 'naming.numbers' (tests/naming_convention.sol#6) is not in CapWords\n", + "elements": [ + { + "target": "enum", + "convention": "CapWords", + "name": "numbers", + "source_mapping": { + "start": 79, + "length": 23, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 6 + ], + "starting_column": 5, + "ending_column": 28 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Modifier 'naming.CantDo' (tests/naming_convention.sol#41-43) is not in mixedCase\n", - "elements": [ - { - "target": "modifier", - "convention": "mixedCase", - "name": "CantDo", - "source_mapping": { - "start": 591, - "length": 36, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 41, - 42, - 43 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Modifier 'naming.CantDo' (tests/naming_convention.sol#41-43) is not in mixedCase\n", + "elements": [ + { + "target": "modifier", + "convention": "mixedCase", + "name": "CantDo", + "source_mapping": { + "start": 591, + "length": 36, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 41, + 42, + 43 + ], + "starting_column": 5, + "ending_column": 6 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Parameter '_used' of T.test (tests/naming_convention.sol#59) is not in mixedCase\n", - "elements": [ - { - "target": "parameter", - "convention": "mixedCase", - "name": "_used", - "source_mapping": { - "start": 794, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 59 - ], - "starting_column": 33, - "ending_column": 43 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Parameter '_used' of T.test (tests/naming_convention.sol#59) is not in mixedCase\n", + "elements": [ + { + "target": "parameter", + "convention": "mixedCase", + "name": "_used", + "source_mapping": { + "start": 794, + "length": 10, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 59 + ], + "starting_column": 33, + "ending_column": 43 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase\n", - "elements": [ - { - "target": "variable", - "convention": "mixedCase", - "name": "_myPublicVar", - "source_mapping": { - "start": 741, - "length": 17, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 56 - ], - "starting_column": 5, - "ending_column": 22 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Variable 'T._myPublicVar' (tests/naming_convention.sol#56) is not in mixedCase\n", + "elements": [ + { + "target": "variable", + "convention": "mixedCase", + "name": "_myPublicVar", + "source_mapping": { + "start": 741, + "length": 17, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 56 + ], + "starting_column": 5, + "ending_column": 22 + } } - } - ] - }, - { - "check": "naming-convention", - "impact": "Informational", - "confidence": "High", - "description": "Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used\n", - "elements": [ - { - "target": "variable", - "convention": "l_O_I_should_not_be_used", - "name": "l", - "source_mapping": { - "start": 900, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_relative": "tests/naming_convention.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", - "filename_short": "tests/naming_convention.sol", - "lines": [ - 67 - ], - "starting_column": 5, - "ending_column": 15 + ] + }, + { + "check": "naming-convention", + "impact": "Informational", + "confidence": "High", + "description": "Variable 'T.l' (tests/naming_convention.sol#67) used l, O, I, which should not be used\n", + "elements": [ + { + "target": "variable", + "convention": "l_O_I_should_not_be_used", + "name": "l", + "source_mapping": { + "start": 900, + "length": 10, + "filename_used": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_relative": "tests/naming_convention.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/naming_convention.sol", + "filename_short": "tests/naming_convention.sol", + "lines": [ + 67 + ], + "starting_column": 5, + "ending_column": 15 + } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/old_solc.sol.json.solc-version.json b/tests/expected_json/old_solc.sol.json.solc-version.json index 901805d32..3fce1d9e1 100644 --- a/tests/expected_json/old_solc.sol.json.solc-version.json +++ b/tests/expected_json/old_solc.sol.json.solc-version.json @@ -1,25 +1,29 @@ -[ - { - "check": "solc-version", - "impact": "Informational", - "confidence": "High", - "description": "Detected issues with version pragma in tests/old_solc.sol.json:\n\t- pragma solidity0.4.21 (None): it allows old versions\n", - "elements": [ - { - "type": "expression", - "expression": "0.4.21", - "source_mapping": { - "start": 0, - "length": 23, - "filename_used": "old_solc.sol", - "filename_relative": null, - "filename_absolute": null, - "filename_short": null, - "lines": [], - "starting_column": null, - "ending_column": null +{ + "success": true, + "error": null, + "results": [ + { + "check": "solc-version", + "impact": "Informational", + "confidence": "High", + "description": "Detected issues with version pragma in tests/old_solc.sol.json:\n\t- pragma solidity0.4.21 (None): it allows old versions\n", + "elements": [ + { + "type": "expression", + "expression": "0.4.21", + "source_mapping": { + "start": 0, + "length": 23, + "filename_used": "old_solc.sol", + "filename_relative": null, + "filename_absolute": null, + "filename_short": null, + "lines": [], + "starting_column": null, + "ending_column": null + } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/pragma.0.4.24.pragma.json b/tests/expected_json/pragma.0.4.24.pragma.json index d5d8745d1..dd9e9e79b 100644 --- a/tests/expected_json/pragma.0.4.24.pragma.json +++ b/tests/expected_json/pragma.0.4.24.pragma.json @@ -1,44 +1,48 @@ -[ - { - "check": "pragma", - "impact": "Informational", - "confidence": "High", - "description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- tests/pragma.0.4.23.sol#1 declares pragma solidity^0.4.23\n\t- tests/pragma.0.4.24.sol#1 declares pragma solidity^0.4.24\n", - "elements": [ - { - "type": "expression", - "expression": "^0.4.23", - "source_mapping": { - "start": 0, - "length": 24, - "filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", - "filename_relative": "tests/pragma.0.4.23.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", - "filename_short": "tests/pragma.0.4.23.sol", - "lines": [ - 1 - ], - "starting_column": 1, - "ending_column": 25 +{ + "success": true, + "error": null, + "results": [ + { + "check": "pragma", + "impact": "Informational", + "confidence": "High", + "description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- tests/pragma.0.4.23.sol#1 declares pragma solidity^0.4.23\n\t- tests/pragma.0.4.24.sol#1 declares pragma solidity^0.4.24\n", + "elements": [ + { + "type": "expression", + "expression": "^0.4.23", + "source_mapping": { + "start": 0, + "length": 24, + "filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", + "filename_relative": "tests/pragma.0.4.23.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.23.sol", + "filename_short": "tests/pragma.0.4.23.sol", + "lines": [ + 1 + ], + "starting_column": 1, + "ending_column": 25 + } + }, + { + "type": "expression", + "expression": "^0.4.24", + "source_mapping": { + "start": 0, + "length": 24, + "filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol", + "filename_relative": "tests/pragma.0.4.24.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol", + "filename_short": "tests/pragma.0.4.24.sol", + "lines": [ + 1 + ], + "starting_column": 1, + "ending_column": 25 + } } - }, - { - "type": "expression", - "expression": "^0.4.24", - "source_mapping": { - "start": 0, - "length": 24, - "filename_used": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol", - "filename_relative": "tests/pragma.0.4.24.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/pragma.0.4.24.sol", - "filename_short": "tests/pragma.0.4.24.sol", - "lines": [ - 1 - ], - "starting_column": 1, - "ending_column": 25 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/pragma.0.4.24.pragma.txt b/tests/expected_json/pragma.0.4.24.pragma.txt index 8a5e1a540..5d559d60d 100644 --- a/tests/expected_json/pragma.0.4.24.pragma.txt +++ b/tests/expected_json/pragma.0.4.24.pragma.txt @@ -1,8 +1,44 @@ -ERROR:Slither:Invalid compilation -ERROR:Slither:Invalid solc compilation tests/pragma.0.4.23.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Linux.g++ - note that nightly builds are considered to be strictly less than the released version +ERROR:root:Error in tests/pragma.0.4.24.sol +ERROR:root:Traceback (most recent call last): + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 189, in _run_solc + ret = json.loads(stdout) + File "/usr/lib/python3.6/json/__init__.py", line 354, in loads + return _default_decoder.decode(s) + File "/usr/lib/python3.6/json/decoder.py", line 339, in decode + obj, end = self.raw_decode(s, idx=_w(s, 0).end()) + File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode + raise JSONDecodeError("Expecting value", s, err.value) from None +json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/monty/Private/tob/tools/slither-public/slither/slither.py", line 56, in __init__ + crytic_compile = CryticCompile(contract, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/crytic_compile.py", line 68, in __init__ + self._compile(target, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/crytic_compile.py", line 590, in _compile + self._platform.compile(self, target, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 33, in compile + working_dir=solc_working_dir) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 192, in _run_solc + raise InvalidCompilation(f'Invalid solc compilation {stderr}') +crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation tests/pragma.0.4.23.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Linux.g++ - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.4.23; ^----------------------^ tests/pragma.0.4.24.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.5.1+commit.c8a2cb62.Linux.g++ - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.4.24; ^----------------------^ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 558, in main_impl + (results, number_contracts) = process(filename, args, detector_classes, printer_classes) + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 51, in process + **vars(args)) + File "/home/monty/Private/tob/tools/slither-public/slither/slither.py", line 59, in __init__ + raise SlitherError('Invalid compilation: '+e) +TypeError: must be str, not InvalidCompilation + diff --git a/tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json b/tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json index dbab564e2..ec08a4f8a 100644 --- a/tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json +++ b/tests/expected_json/reentrancy-0.5.1.reentrancy-eth.json @@ -1,56 +1,24 @@ -[ - { - "check": "reentrancy-eth", - "impact": "High", - "confidence": "Medium", - "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy-0.5.1.sol#14-22):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(userBalance[msg.sender])() (tests/reentrancy-0.5.1.sol#17)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#21)\n", - "elements": [ - { - "type": "function", - "name": "withdrawBalance", - "source_mapping": { - "start": 298, - "length": 357, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Reentrancy", +{ + "success": true, + "error": null, + "results": [ + { + "check": "reentrancy-eth", + "impact": "High", + "confidence": "Medium", + "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy-0.5.1.sol#14-22):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(userBalance[msg.sender])() (tests/reentrancy-0.5.1.sol#17)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#21)\n", + "elements": [ + { + "type": "function", + "name": "withdrawBalance", "source_mapping": { - "start": 25, - "length": 1807, + "start": 298, + "length": 357, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_relative": "tests/reentrancy-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_short": "tests/reentrancy-0.5.1.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, 14, 15, 16, @@ -59,165 +27,134 @@ 19, 20, 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54 + 22 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Reentrancy", + "source_mapping": { + "start": 25, + "length": 1807, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "external_calls", - "expression": "(ret,mem) = msg.sender.call.value(userBalance[msg.sender])()", - "source_mapping": { - "start": 477, - "length": 81, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 17 - ], - "starting_column": 9, - "ending_column": 90 - } - }, - { - "type": "variables_written", - "name": "userBalance", - "expression": "userBalance[msg.sender] = 0", - "source_mapping": { - "start": 621, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 21 - ], - "starting_column": 9, - "ending_column": 36 - } - } - ] - }, - { - "check": "reentrancy-eth", - "impact": "High", - "confidence": "Medium", - "description": "Reentrancy in Reentrancy.withdrawBalance_fixed_3 (tests/reentrancy-0.5.1.sol#44-53):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(amount)() (tests/reentrancy-0.5.1.sol#49)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#51)\n", - "elements": [ - { - "type": "function", - "name": "withdrawBalance_fixed_3", - "source_mapping": { - "start": 1434, - "length": 393, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Reentrancy", + { + "type": "external_calls", + "expression": "(ret,mem) = msg.sender.call.value(userBalance[msg.sender])()", "source_mapping": { - "start": 25, - "length": 1807, + "start": 477, + "length": 81, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 17 + ], + "starting_column": 9, + "ending_column": 90 + } + }, + { + "type": "variables_written", + "name": "userBalance", + "expression": "userBalance[msg.sender] = 0", + "source_mapping": { + "start": 621, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 21 + ], + "starting_column": 9, + "ending_column": 36 + } + } + ] + }, + { + "check": "reentrancy-eth", + "impact": "High", + "confidence": "Medium", + "description": "Reentrancy in Reentrancy.withdrawBalance_fixed_3 (tests/reentrancy-0.5.1.sol#44-53):\n\tExternal calls:\n\t- (ret,mem) = msg.sender.call.value(amount)() (tests/reentrancy-0.5.1.sol#49)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy-0.5.1.sol#51)\n", + "elements": [ + { + "type": "function", + "name": "withdrawBalance_fixed_3", + "source_mapping": { + "start": 1434, + "length": 393, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_relative": "tests/reentrancy-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", "filename_short": "tests/reentrancy-0.5.1.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, 44, 45, 46, @@ -227,49 +164,116 @@ 50, 51, 52, - 53, - 54 + 53 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Reentrancy", + "source_mapping": { + "start": 25, + "length": 1807, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "external_calls", + "expression": "(ret,mem) = msg.sender.call.value(amount)()", + "source_mapping": { + "start": 1679, + "length": 64, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 73 + } + }, + { + "type": "variables_written", + "name": "userBalance", + "expression": "userBalance[msg.sender] = amount", + "source_mapping": { + "start": 1778, + "length": 32, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_relative": "tests/reentrancy-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", + "filename_short": "tests/reentrancy-0.5.1.sol", + "lines": [ + 51 + ], + "starting_column": 13, + "ending_column": 45 } } - }, - { - "type": "external_calls", - "expression": "(ret,mem) = msg.sender.call.value(amount)()", - "source_mapping": { - "start": 1679, - "length": 64, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 49 - ], - "starting_column": 9, - "ending_column": 73 - } - }, - { - "type": "variables_written", - "name": "userBalance", - "expression": "userBalance[msg.sender] = amount", - "source_mapping": { - "start": 1778, - "length": 32, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_relative": "tests/reentrancy-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy-0.5.1.sol", - "filename_short": "tests/reentrancy-0.5.1.sol", - "lines": [ - 51 - ], - "starting_column": 13, - "ending_column": 45 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/reentrancy-0.5.1.reentrancy.txt b/tests/expected_json/reentrancy-0.5.1.reentrancy.txt index 184c551e6..3953345b1 100644 --- a/tests/expected_json/reentrancy-0.5.1.reentrancy.txt +++ b/tests/expected_json/reentrancy-0.5.1.reentrancy.txt @@ -1,10 +1,10 @@ Traceback (most recent call last): File "/home/monty/Envs/slither/bin/slither", line 11, in load_entry_point('slither-analyzer', 'console_scripts', 'slither')() - File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 469, in main + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 503, in main main_impl(all_detector_classes=detectors, all_printer_classes=printers) - File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 483, in main_impl + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 522, in main_impl detector_classes = choose_detectors(args, all_detector_classes) - File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 176, in choose_detectors + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 191, in choose_detectors raise Exception('Error: {} is not a detector'.format(d)) Exception: Error: reentrancy is not a detector diff --git a/tests/expected_json/reentrancy.reentrancy-eth.json b/tests/expected_json/reentrancy.reentrancy-eth.json index da95d2225..3c28bd4e5 100644 --- a/tests/expected_json/reentrancy.reentrancy-eth.json +++ b/tests/expected_json/reentrancy.reentrancy-eth.json @@ -1,55 +1,24 @@ -[ - { - "check": "reentrancy-eth", - "impact": "High", - "confidence": "Medium", - "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy.sol#14-21):\n\tExternal calls:\n\t- ! (msg.sender.call.value(userBalance[msg.sender])()) (tests/reentrancy.sol#17-19)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#20)\n", - "elements": [ - { - "type": "function", - "name": "withdrawBalance", - "source_mapping": { - "start": 299, - "length": 314, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Reentrancy", +{ + "success": true, + "error": null, + "results": [ + { + "check": "reentrancy-eth", + "impact": "High", + "confidence": "Medium", + "description": "Reentrancy in Reentrancy.withdrawBalance (tests/reentrancy.sol#14-21):\n\tExternal calls:\n\t- ! (msg.sender.call.value(userBalance[msg.sender])()) (tests/reentrancy.sol#17-19)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#20)\n", + "elements": [ + { + "type": "function", + "name": "withdrawBalance", "source_mapping": { - "start": 26, - "length": 2334, + "start": 299, + "length": 314, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_relative": "tests/reentrancy.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_short": "tests/reentrancy.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, 14, 15, 16, @@ -57,253 +26,288 @@ 18, 19, 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72 + 21 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Reentrancy", + "source_mapping": { + "start": 26, + "length": 2334, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "external_calls", - "expression": "! (msg.sender.call.value(userBalance[msg.sender])())", - "source_mapping": { - "start": 478, - "length": 92, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 17, - 18, - 19 - ], - "starting_column": 9, - "ending_column": 10 - } - }, - { - "type": "variables_written", - "name": "userBalance", - "expression": "userBalance[msg.sender] = 0", - "source_mapping": { - "start": 579, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 20 - ], - "starting_column": 9, - "ending_column": 36 - } - } - ] - }, - { - "check": "reentrancy-eth", - "impact": "High", - "confidence": "Medium", - "description": "Reentrancy in Reentrancy.withdrawBalance_nested (tests/reentrancy.sol#64-70):\n\tExternal calls:\n\t- msg.sender.call.value(amount / 2)() (tests/reentrancy.sol#67)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#68)\n", - "elements": [ - { - "type": "function", - "name": "withdrawBalance_nested", - "source_mapping": { - "start": 2108, - "length": 246, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 64, - 65, - 66, - 67, - 68, - 69, - 70 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Reentrancy", + { + "type": "external_calls", + "expression": "! (msg.sender.call.value(userBalance[msg.sender])())", "source_mapping": { - "start": 26, - "length": 2334, + "start": 478, + "length": 92, "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_relative": "tests/reentrancy.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", "filename_short": "tests/reentrancy.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, 17, 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, + 19 + ], + "starting_column": 9, + "ending_column": 10 + } + }, + { + "type": "variables_written", + "name": "userBalance", + "expression": "userBalance[msg.sender] = 0", + "source_mapping": { + "start": 579, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ + 20 + ], + "starting_column": 9, + "ending_column": 36 + } + } + ] + }, + { + "check": "reentrancy-eth", + "impact": "High", + "confidence": "Medium", + "description": "Reentrancy in Reentrancy.withdrawBalance_nested (tests/reentrancy.sol#64-70):\n\tExternal calls:\n\t- msg.sender.call.value(amount / 2)() (tests/reentrancy.sol#67)\n\tState variables written after the call(s):\n\t- userBalance (tests/reentrancy.sol#68)\n", + "elements": [ + { + "type": "function", + "name": "withdrawBalance_nested", + "source_mapping": { + "start": 2108, + "length": 246, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ 64, 65, 66, 67, 68, 69, - 70, - 71, - 72 + 70 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Reentrancy", + "source_mapping": { + "start": 26, + "length": 2334, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "external_calls", + "expression": "msg.sender.call.value(amount / 2)()", + "source_mapping": { + "start": 2263, + "length": 33, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ + 67 + ], + "starting_column": 13, + "ending_column": 46 + } + }, + { + "type": "variables_written", + "name": "userBalance", + "expression": "userBalance[msg.sender] = 0", + "source_mapping": { + "start": 2310, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_relative": "tests/reentrancy.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", + "filename_short": "tests/reentrancy.sol", + "lines": [ + 68 + ], + "starting_column": 13, + "ending_column": 40 } } - }, - { - "type": "external_calls", - "expression": "msg.sender.call.value(amount / 2)()", - "source_mapping": { - "start": 2263, - "length": 33, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 67 - ], - "starting_column": 13, - "ending_column": 46 - } - }, - { - "type": "variables_written", - "name": "userBalance", - "expression": "userBalance[msg.sender] = 0", - "source_mapping": { - "start": 2310, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_relative": "tests/reentrancy.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/reentrancy.sol", - "filename_short": "tests/reentrancy.sol", - "lines": [ - 68 - ], - "starting_column": 13, - "ending_column": 40 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/right_to_left_override.rtlo.json b/tests/expected_json/right_to_left_override.rtlo.json index 4fb8449c8..931026f53 100644 --- a/tests/expected_json/right_to_left_override.rtlo.json +++ b/tests/expected_json/right_to_left_override.rtlo.json @@ -1,9 +1,13 @@ -[ - { - "check": "rtlo", - "impact": "High", - "confidence": "High", - "description": "/home/travis/build/crytic/slither/tests/right_to_left_override.sol contains a unicode right-to-left-override character:\n\t- test1(/*A\u202e/*B*/2 , 1/*\u202d\n", - "elements": [] - } -] \ No newline at end of file +{ + "success": true, + "error": null, + "results": [ + { + "check": "rtlo", + "impact": "High", + "confidence": "High", + "description": "/home/travis/build/crytic/slither/tests/right_to_left_override.sol contains a unicode right-to-left-override character:\n\t- test1(/*A\u202e/*B*/2 , 1/*\u202d\n", + "elements": [] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/shadowing_abstract.shadowing-abstract.json b/tests/expected_json/shadowing_abstract.shadowing-abstract.json index 18094ca3a..d37f723f5 100644 --- a/tests/expected_json/shadowing_abstract.shadowing-abstract.json +++ b/tests/expected_json/shadowing_abstract.shadowing-abstract.json @@ -1,44 +1,48 @@ -[ - { - "check": "shadowing-abstract", - "impact": "Medium", - "confidence": "High", - "description": "DerivedContract.owner (tests/shadowing_abstract.sol#7) shadows:\n\t- BaseContract.owner (tests/shadowing_abstract.sol#2)\n", - "elements": [ - { - "type": "variable", - "name": "owner", - "source_mapping": { - "start": 92, - "length": 13, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", - "filename_relative": "tests/shadowing_abstract.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", - "filename_short": "tests/shadowing_abstract.sol", - "lines": [ - 7 - ], - "starting_column": 5, - "ending_column": 18 +{ + "success": true, + "error": null, + "results": [ + { + "check": "shadowing-abstract", + "impact": "Medium", + "confidence": "High", + "description": "DerivedContract.owner (tests/shadowing_abstract.sol#7) shadows:\n\t- BaseContract.owner (tests/shadowing_abstract.sol#2)\n", + "elements": [ + { + "type": "variable", + "name": "owner", + "source_mapping": { + "start": 92, + "length": 13, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", + "filename_relative": "tests/shadowing_abstract.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", + "filename_short": "tests/shadowing_abstract.sol", + "lines": [ + 7 + ], + "starting_column": 5, + "ending_column": 18 + } + }, + { + "type": "variable", + "name": "owner", + "source_mapping": { + "start": 27, + "length": 13, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", + "filename_relative": "tests/shadowing_abstract.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", + "filename_short": "tests/shadowing_abstract.sol", + "lines": [ + 2 + ], + "starting_column": 5, + "ending_column": 18 + } } - }, - { - "type": "variable", - "name": "owner", - "source_mapping": { - "start": 27, - "length": 13, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", - "filename_relative": "tests/shadowing_abstract.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_abstract.sol", - "filename_short": "tests/shadowing_abstract.sol", - "lines": [ - 2 - ], - "starting_column": 5, - "ending_column": 18 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/shadowing_builtin_symbols.shadowing-builtin.json b/tests/expected_json/shadowing_builtin_symbols.shadowing-builtin.json index 390d68a5b..0104df94b 100644 --- a/tests/expected_json/shadowing_builtin_symbols.shadowing-builtin.json +++ b/tests/expected_json/shadowing_builtin_symbols.shadowing-builtin.json @@ -1,407 +1,411 @@ -[ - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "BaseContract.blockhash (state variable @ tests/shadowing_builtin_symbols.sol#4) shadows built-in symbol \"blockhash\"\n", - "elements": [ - { - "type": "variable", - "name": "blockhash", - "source_mapping": { - "start": 54, - "length": 14, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 4 - ], - "starting_column": 5, - "ending_column": 19 +{ + "success": true, + "error": null, + "results": [ + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "BaseContract.blockhash (state variable @ tests/shadowing_builtin_symbols.sol#4) shadows built-in symbol \"blockhash\"\n", + "elements": [ + { + "type": "variable", + "name": "blockhash", + "source_mapping": { + "start": 54, + "length": 14, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 4 + ], + "starting_column": 5, + "ending_column": 19 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "BaseContract.now (state variable @ tests/shadowing_builtin_symbols.sol#5) shadows built-in symbol \"now\"\n", - "elements": [ - { - "type": "variable", - "name": "now", - "source_mapping": { - "start": 74, - "length": 8, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 5 - ], - "starting_column": 5, - "ending_column": 13 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "BaseContract.now (state variable @ tests/shadowing_builtin_symbols.sol#5) shadows built-in symbol \"now\"\n", + "elements": [ + { + "type": "variable", + "name": "now", + "source_mapping": { + "start": 74, + "length": 8, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 5 + ], + "starting_column": 5, + "ending_column": 13 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "BaseContract.revert (event @ tests/shadowing_builtin_symbols.sol#7) shadows built-in symbol \"revert\"\n", - "elements": [ - { - "type": "function", - "name": "revert", - "source_mapping": { - "start": 89, - "length": 29, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 7 - ], - "starting_column": 5, - "ending_column": 34 - }, - "contract": { - "type": "contract", - "name": "BaseContract", + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "BaseContract.revert (event @ tests/shadowing_builtin_symbols.sol#7) shadows built-in symbol \"revert\"\n", + "elements": [ + { + "type": "function", + "name": "revert", "source_mapping": { - "start": 26, - "length": 94, + "start": 89, + "length": 29, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_relative": "tests/shadowing_builtin_symbols.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_short": "tests/shadowing_builtin_symbols.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 34 + }, + "contract": { + "type": "contract", + "name": "BaseContract", + "source_mapping": { + "start": 26, + "length": 94, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "ExtendedContract.assert (function @ tests/shadowing_builtin_symbols.sol#13-15) shadows built-in symbol \"assert\"\n", - "elements": [ - { - "type": "function", - "name": "assert", - "source_mapping": { - "start": 195, - "length": 64, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 13, - 14, - 15 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "ExtendedContract", + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "ExtendedContract.assert (function @ tests/shadowing_builtin_symbols.sol#13-15) shadows built-in symbol \"assert\"\n", + "elements": [ + { + "type": "function", + "name": "assert", "source_mapping": { - "start": 122, - "length": 139, + "start": 195, + "length": 64, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_relative": "tests/shadowing_builtin_symbols.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_short": "tests/shadowing_builtin_symbols.sol", "lines": [ - 10, - 11, - 12, 13, 14, - 15, - 16 + 15 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "ExtendedContract", + "source_mapping": { + "start": 122, + "length": 139, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "ExtendedContract.assert.msg (local variable @ tests/shadowing_builtin_symbols.sol#14) shadows built-in symbol \"msg\"\n", - "elements": [ - { - "type": "variable", - "name": "msg", - "source_mapping": { - "start": 244, - "length": 8, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 14 - ], - "starting_column": 9, - "ending_column": 17 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "ExtendedContract.assert.msg (local variable @ tests/shadowing_builtin_symbols.sol#14) shadows built-in symbol \"msg\"\n", + "elements": [ + { + "type": "variable", + "name": "msg", + "source_mapping": { + "start": 244, + "length": 8, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 14 + ], + "starting_column": 9, + "ending_column": 17 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "ExtendedContract.ecrecover (state variable @ tests/shadowing_builtin_symbols.sol#11) shadows built-in symbol \"ecrecover\"\n", - "elements": [ - { - "type": "variable", - "name": "ecrecover", - "source_mapping": { - "start": 170, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 11 - ], - "starting_column": 5, - "ending_column": 23 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "ExtendedContract.ecrecover (state variable @ tests/shadowing_builtin_symbols.sol#11) shadows built-in symbol \"ecrecover\"\n", + "elements": [ + { + "type": "variable", + "name": "ecrecover", + "source_mapping": { + "start": 170, + "length": 18, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 11 + ], + "starting_column": 5, + "ending_column": 23 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.require (modifier @ tests/shadowing_builtin_symbols.sol#23-28) shadows built-in symbol \"require\"\n", - "elements": [ - { - "type": "function", - "name": "require", - "source_mapping": { - "start": 380, - "length": 120, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 23, - 24, - 25, - 26, - 27, - 28 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "FurtherExtendedContract", + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.require (modifier @ tests/shadowing_builtin_symbols.sol#23-28) shadows built-in symbol \"require\"\n", + "elements": [ + { + "type": "function", + "name": "require", "source_mapping": { - "start": 263, - "length": 239, + "start": 380, + "length": 120, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_relative": "tests/shadowing_builtin_symbols.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", "filename_short": "tests/shadowing_builtin_symbols.sol", "lines": [ - 18, - 19, - 20, - 21, - 22, 23, 24, 25, 26, 27, - 28, - 29 + 28 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "FurtherExtendedContract", + "source_mapping": { + "start": 263, + "length": 239, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.require.keccak256 (local variable @ tests/shadowing_builtin_symbols.sol#25) shadows built-in symbol \"keccak256\"\n", - "elements": [ - { - "type": "variable", - "name": "keccak256", - "source_mapping": { - "start": 449, - "length": 14, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 25 - ], - "starting_column": 9, - "ending_column": 23 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.require.keccak256 (local variable @ tests/shadowing_builtin_symbols.sol#25) shadows built-in symbol \"keccak256\"\n", + "elements": [ + { + "type": "variable", + "name": "keccak256", + "source_mapping": { + "start": 449, + "length": 14, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 25 + ], + "starting_column": 9, + "ending_column": 23 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.require.sha3 (local variable @ tests/shadowing_builtin_symbols.sol#26) shadows built-in symbol \"sha3\"\n", - "elements": [ - { - "type": "variable", - "name": "sha3", - "source_mapping": { - "start": 473, - "length": 9, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 26 - ], - "starting_column": 9, - "ending_column": 18 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.require.sha3 (local variable @ tests/shadowing_builtin_symbols.sol#26) shadows built-in symbol \"sha3\"\n", + "elements": [ + { + "type": "variable", + "name": "sha3", + "source_mapping": { + "start": 473, + "length": 9, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 26 + ], + "starting_column": 9, + "ending_column": 18 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.blockhash (state variable @ tests/shadowing_builtin_symbols.sol#19) shadows built-in symbol \"blockhash\"\n", - "elements": [ - { - "type": "variable", - "name": "blockhash", - "source_mapping": { - "start": 322, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 19 - ], - "starting_column": 5, - "ending_column": 23 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.blockhash (state variable @ tests/shadowing_builtin_symbols.sol#19) shadows built-in symbol \"blockhash\"\n", + "elements": [ + { + "type": "variable", + "name": "blockhash", + "source_mapping": { + "start": 322, + "length": 18, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 19 + ], + "starting_column": 5, + "ending_column": 23 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.this (state variable @ tests/shadowing_builtin_symbols.sol#20) shadows built-in symbol \"this\"\n", - "elements": [ - { - "type": "variable", - "name": "this", - "source_mapping": { - "start": 346, - "length": 13, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 20 - ], - "starting_column": 5, - "ending_column": 18 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.this (state variable @ tests/shadowing_builtin_symbols.sol#20) shadows built-in symbol \"this\"\n", + "elements": [ + { + "type": "variable", + "name": "this", + "source_mapping": { + "start": 346, + "length": 13, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 20 + ], + "starting_column": 5, + "ending_column": 18 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.abi (state variable @ tests/shadowing_builtin_symbols.sol#21) shadows built-in symbol \"abi\"\n", - "elements": [ - { - "type": "variable", - "name": "abi", - "source_mapping": { - "start": 365, - "length": 8, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 21 - ], - "starting_column": 5, - "ending_column": 13 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.abi (state variable @ tests/shadowing_builtin_symbols.sol#21) shadows built-in symbol \"abi\"\n", + "elements": [ + { + "type": "variable", + "name": "abi", + "source_mapping": { + "start": 365, + "length": 8, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 21 + ], + "starting_column": 5, + "ending_column": 13 + } } - } - ] - }, - { - "check": "shadowing-builtin", - "impact": "Low", - "confidence": "High", - "description": "Reserved.mutable (state variable @ tests/shadowing_builtin_symbols.sol#32) shadows built-in symbol \"mutable\"\n", - "elements": [ - { - "type": "variable", - "name": "mutable", - "source_mapping": { - "start": 527, - "length": 15, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_relative": "tests/shadowing_builtin_symbols.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", - "filename_short": "tests/shadowing_builtin_symbols.sol", - "lines": [ - 32 - ], - "starting_column": 5, - "ending_column": 20 + ] + }, + { + "check": "shadowing-builtin", + "impact": "Low", + "confidence": "High", + "description": "Reserved.mutable (state variable @ tests/shadowing_builtin_symbols.sol#32) shadows built-in symbol \"mutable\"\n", + "elements": [ + { + "type": "variable", + "name": "mutable", + "source_mapping": { + "start": 527, + "length": 15, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_relative": "tests/shadowing_builtin_symbols.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_builtin_symbols.sol", + "filename_short": "tests/shadowing_builtin_symbols.sol", + "lines": [ + 32 + ], + "starting_column": 5, + "ending_column": 20 + } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/shadowing_local_variable.shadowing-local.json b/tests/expected_json/shadowing_local_variable.shadowing-local.json index 211ca1047..0f41ae862 100644 --- a/tests/expected_json/shadowing_local_variable.shadowing-local.json +++ b/tests/expected_json/shadowing_local_variable.shadowing-local.json @@ -1,322 +1,326 @@ -[ - { - "check": "shadowing-local", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.shadowingParent.x (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- FurtherExtendedContract.x (state variable @ tests/shadowing_local_variable.sol#17)\n\t- ExtendedContract.x (state variable @ tests/shadowing_local_variable.sol#9)\n\t- BaseContract.x (state variable @ tests/shadowing_local_variable.sol#4)\n", - "elements": [ - { - "type": "variable", - "name": "x", - "source_mapping": { - "start": 376, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 25 - ], - "starting_column": 30, - "ending_column": 36 - } - }, - { - "type": "variable", - "name": "x", - "source_mapping": { - "start": 256, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 17 - ], - "starting_column": 5, - "ending_column": 15 - } - }, - { - "type": "variable", - "name": "x", - "source_mapping": { - "start": 133, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 9 - ], - "starting_column": 5, - "ending_column": 15 - } - }, - { - "type": "variable", - "name": "x", - "source_mapping": { - "start": 54, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 4 - ], - "starting_column": 5, - "ending_column": 15 - } - } - ] - }, - { - "check": "shadowing-local", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.shadowingParent.y (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- BaseContract.y (state variable @ tests/shadowing_local_variable.sol#5)\n", - "elements": [ - { - "type": "variable", - "name": "y", - "source_mapping": { - "start": 398, - "length": 5, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 25 - ], - "starting_column": 52, - "ending_column": 57 - } - }, - { - "type": "variable", - "name": "y", - "source_mapping": { - "start": 70, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 5 - ], - "starting_column": 5, - "ending_column": 15 - } - } - ] - }, - { - "check": "shadowing-local", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.shadowingParent.z (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- ExtendedContract.z (function @ tests/shadowing_local_variable.sol#11)\n", - "elements": [ - { - "type": "variable", - "name": "z", - "source_mapping": { - "start": 405, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 25 - ], - "starting_column": 59, - "ending_column": 65 +{ + "success": true, + "error": null, + "results": [ + { + "check": "shadowing-local", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.shadowingParent.x (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- FurtherExtendedContract.x (state variable @ tests/shadowing_local_variable.sol#17)\n\t- ExtendedContract.x (state variable @ tests/shadowing_local_variable.sol#9)\n\t- BaseContract.x (state variable @ tests/shadowing_local_variable.sol#4)\n", + "elements": [ + { + "type": "variable", + "name": "x", + "source_mapping": { + "start": 376, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 25 + ], + "starting_column": 30, + "ending_column": 36 + } + }, + { + "type": "variable", + "name": "x", + "source_mapping": { + "start": 256, + "length": 10, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 17 + ], + "starting_column": 5, + "ending_column": 15 + } + }, + { + "type": "variable", + "name": "x", + "source_mapping": { + "start": 133, + "length": 10, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 9 + ], + "starting_column": 5, + "ending_column": 15 + } + }, + { + "type": "variable", + "name": "x", + "source_mapping": { + "start": 54, + "length": 10, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 4 + ], + "starting_column": 5, + "ending_column": 15 + } } - }, - { - "type": "function", - "name": "z", - "source_mapping": { - "start": 150, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 11 - ], - "starting_column": 5, - "ending_column": 32 + ] + }, + { + "check": "shadowing-local", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.shadowingParent.y (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- BaseContract.y (state variable @ tests/shadowing_local_variable.sol#5)\n", + "elements": [ + { + "type": "variable", + "name": "y", + "source_mapping": { + "start": 398, + "length": 5, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 25 + ], + "starting_column": 52, + "ending_column": 57 + } }, - "contract": { - "type": "contract", - "name": "ExtendedContract", + { + "type": "variable", + "name": "y", "source_mapping": { - "start": 85, - "length": 110, + "start": 70, + "length": 10, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_relative": "tests/shadowing_local_variable.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_short": "tests/shadowing_local_variable.sol", "lines": [ - 8, - 9, - 10, - 11, - 12, - 13, - 14 + 5 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 15 } } - } - ] - }, - { - "check": "shadowing-local", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.shadowingParent.w (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- FurtherExtendedContract.w (modifier @ tests/shadowing_local_variable.sol#20-23)\n", - "elements": [ - { - "type": "variable", - "name": "w", - "source_mapping": { - "start": 413, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 25 - ], - "starting_column": 67, - "ending_column": 73 + ] + }, + { + "check": "shadowing-local", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.shadowingParent.z (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- ExtendedContract.z (function @ tests/shadowing_local_variable.sol#11)\n", + "elements": [ + { + "type": "variable", + "name": "z", + "source_mapping": { + "start": 405, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 25 + ], + "starting_column": 59, + "ending_column": 65 + } + }, + { + "type": "function", + "name": "z", + "source_mapping": { + "start": 150, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 11 + ], + "starting_column": 5, + "ending_column": 32 + }, + "contract": { + "type": "contract", + "name": "ExtendedContract", + "source_mapping": { + "start": 85, + "length": 110, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 2 + } + } } - }, - { - "type": "function", - "name": "w", - "source_mapping": { - "start": 274, - "length": 71, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 20, - 21, - 22, - 23 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "shadowing-local", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.shadowingParent.w (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- FurtherExtendedContract.w (modifier @ tests/shadowing_local_variable.sol#20-23)\n", + "elements": [ + { + "type": "variable", + "name": "w", + "source_mapping": { + "start": 413, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 25 + ], + "starting_column": 67, + "ending_column": 73 + } }, - "contract": { - "type": "contract", - "name": "FurtherExtendedContract", + { + "type": "function", + "name": "w", "source_mapping": { - "start": 197, - "length": 235, + "start": 274, + "length": 71, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_relative": "tests/shadowing_local_variable.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_short": "tests/shadowing_local_variable.sol", "lines": [ - 16, - 17, - 18, - 19, 20, 21, 22, - 23, - 24, - 25, - 26 + 23 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "FurtherExtendedContract", + "source_mapping": { + "start": 197, + "length": 235, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "shadowing-local", - "impact": "Low", - "confidence": "High", - "description": "FurtherExtendedContract.shadowingParent.v (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- ExtendedContract.v (event @ tests/shadowing_local_variable.sol#13)\n", - "elements": [ - { - "type": "variable", - "name": "v", - "source_mapping": { - "start": 421, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 25 - ], - "starting_column": 75, - "ending_column": 81 - } - }, - { - "type": "function", - "name": "v", - "source_mapping": { - "start": 183, - "length": 10, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_relative": "tests/shadowing_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", - "filename_short": "tests/shadowing_local_variable.sol", - "lines": [ - 13 - ], - "starting_column": 5, - "ending_column": 15 + ] + }, + { + "check": "shadowing-local", + "impact": "Low", + "confidence": "High", + "description": "FurtherExtendedContract.shadowingParent.v (local variable @ tests/shadowing_local_variable.sol#25) shadows:\n\t- ExtendedContract.v (event @ tests/shadowing_local_variable.sol#13)\n", + "elements": [ + { + "type": "variable", + "name": "v", + "source_mapping": { + "start": 421, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 25 + ], + "starting_column": 75, + "ending_column": 81 + } }, - "contract": { - "type": "contract", - "name": "ExtendedContract", + { + "type": "function", + "name": "v", "source_mapping": { - "start": 85, - "length": 110, + "start": 183, + "length": 10, "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_relative": "tests/shadowing_local_variable.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", "filename_short": "tests/shadowing_local_variable.sol", "lines": [ - 8, - 9, - 10, - 11, - 12, - 13, - 14 + 13 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 15 + }, + "contract": { + "type": "contract", + "name": "ExtendedContract", + "source_mapping": { + "start": 85, + "length": 110, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_relative": "tests/shadowing_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_local_variable.sol", + "filename_short": "tests/shadowing_local_variable.sol", + "lines": [ + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/shadowing_state_variable.shadowing-state.json b/tests/expected_json/shadowing_state_variable.shadowing-state.json index 01c75c083..772c2f05d 100644 --- a/tests/expected_json/shadowing_state_variable.shadowing-state.json +++ b/tests/expected_json/shadowing_state_variable.shadowing-state.json @@ -1,44 +1,48 @@ -[ - { - "check": "shadowing-state", - "impact": "High", - "confidence": "High", - "description": "DerivedContract.owner (tests/shadowing_state_variable.sol#12) shadows:\n\t- BaseContract.owner (tests/shadowing_state_variable.sol#2)\n", - "elements": [ - { - "type": "variable", - "name": "owner", - "source_mapping": { - "start": 172, - "length": 13, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", - "filename_relative": "tests/shadowing_state_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", - "filename_short": "tests/shadowing_state_variable.sol", - "lines": [ - 12 - ], - "starting_column": 5, - "ending_column": 18 +{ + "success": true, + "error": null, + "results": [ + { + "check": "shadowing-state", + "impact": "High", + "confidence": "High", + "description": "DerivedContract.owner (tests/shadowing_state_variable.sol#12) shadows:\n\t- BaseContract.owner (tests/shadowing_state_variable.sol#2)\n", + "elements": [ + { + "type": "variable", + "name": "owner", + "source_mapping": { + "start": 172, + "length": 13, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", + "filename_relative": "tests/shadowing_state_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", + "filename_short": "tests/shadowing_state_variable.sol", + "lines": [ + 12 + ], + "starting_column": 5, + "ending_column": 18 + } + }, + { + "type": "variable", + "name": "owner", + "source_mapping": { + "start": 27, + "length": 13, + "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", + "filename_relative": "tests/shadowing_state_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", + "filename_short": "tests/shadowing_state_variable.sol", + "lines": [ + 2 + ], + "starting_column": 5, + "ending_column": 18 + } } - }, - { - "type": "variable", - "name": "owner", - "source_mapping": { - "start": 27, - "length": 13, - "filename_used": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", - "filename_relative": "tests/shadowing_state_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/shadowing_state_variable.sol", - "filename_short": "tests/shadowing_state_variable.sol", - "lines": [ - 2 - ], - "starting_column": 5, - "ending_column": 18 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/solc_version_incorrect.solc-version.json b/tests/expected_json/solc_version_incorrect.solc-version.json index 753975a09..22aa0b063 100644 --- a/tests/expected_json/solc_version_incorrect.solc-version.json +++ b/tests/expected_json/solc_version_incorrect.solc-version.json @@ -1,44 +1,48 @@ -[ - { - "check": "solc-version", - "impact": "Informational", - "confidence": "High", - "description": "Detected issues with version pragma in :\n\t- pragma solidity^0.4.23 (tests/solc_version_incorrect.sol#2): it allows old versions\n\t- pragma solidity>=0.4.0<0.6.0 (tests/solc_version_incorrect.sol#3): it allows old versions\n", - "elements": [ - { - "type": "expression", - "expression": "^0.4.23", - "source_mapping": { - "start": 63, - "length": 24, - "filename_used": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", - "filename_relative": "tests/solc_version_incorrect.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", - "filename_short": "tests/solc_version_incorrect.sol", - "lines": [ - 2 - ], - "starting_column": 1, - "ending_column": 25 +{ + "success": true, + "error": null, + "results": [ + { + "check": "solc-version", + "impact": "Informational", + "confidence": "High", + "description": "Detected issues with version pragma in :\n\t- pragma solidity^0.4.23 (tests/solc_version_incorrect.sol#2): it allows old versions\n\t- pragma solidity>=0.4.0<0.6.0 (tests/solc_version_incorrect.sol#3): it allows old versions\n", + "elements": [ + { + "type": "expression", + "expression": "^0.4.23", + "source_mapping": { + "start": 63, + "length": 24, + "filename_used": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", + "filename_relative": "tests/solc_version_incorrect.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", + "filename_short": "tests/solc_version_incorrect.sol", + "lines": [ + 2 + ], + "starting_column": 1, + "ending_column": 25 + } + }, + { + "type": "expression", + "expression": ">=0.4.0<0.6.0", + "source_mapping": { + "start": 89, + "length": 31, + "filename_used": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", + "filename_relative": "tests/solc_version_incorrect.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", + "filename_short": "tests/solc_version_incorrect.sol", + "lines": [ + 3 + ], + "starting_column": 1, + "ending_column": 32 + } } - }, - { - "type": "expression", - "expression": ">=0.4.0<0.6.0", - "source_mapping": { - "start": 89, - "length": 31, - "filename_used": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", - "filename_relative": "tests/solc_version_incorrect.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/solc_version_incorrect.sol", - "filename_short": "tests/solc_version_incorrect.sol", - "lines": [ - 3 - ], - "starting_column": 1, - "ending_column": 32 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/timestamp.timestamp.json b/tests/expected_json/timestamp.timestamp.json index 665e25eb1..b306376ca 100644 --- a/tests/expected_json/timestamp.timestamp.json +++ b/tests/expected_json/timestamp.timestamp.json @@ -1,243 +1,247 @@ -[ - { - "check": "timestamp", - "impact": "Low", - "confidence": "Medium", - "description": "Timestamp.bad0 (tests/timestamp.sol#4-6) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- require(bool)(block.timestamp == 0) (tests/timestamp.sol#5)\n", - "elements": [ - { - "type": "function", - "name": "bad0", - "source_mapping": { - "start": 47, - "length": 70, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 4, - 5, - 6 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Timestamp", +{ + "success": true, + "error": null, + "results": [ + { + "check": "timestamp", + "impact": "Low", + "confidence": "Medium", + "description": "Timestamp.bad0 (tests/timestamp.sol#4-6) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- require(bool)(block.timestamp == 0) (tests/timestamp.sol#5)\n", + "elements": [ + { + "type": "function", + "name": "bad0", "source_mapping": { - "start": 0, - "length": 402, + "start": 47, + "length": 70, "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_relative": "tests/timestamp.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_short": "tests/timestamp.sol", "lines": [ - 1, - 2, - 3, 4, 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 + 6 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Timestamp", + "source_mapping": { + "start": 0, + "length": 402, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(block.timestamp == 0)", - "source_mapping": { - "start": 81, - "length": 29, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 5 - ], - "starting_column": 9, - "ending_column": 38 - } - } - ] - }, - { - "check": "timestamp", - "impact": "Low", - "confidence": "Medium", - "description": "Timestamp.bad1 (tests/timestamp.sol#8-11) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- require(bool)(time == 0) (tests/timestamp.sol#10)\n", - "elements": [ - { - "type": "function", - "name": "bad1", - "source_mapping": { - "start": 126, - "length": 96, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 8, - 9, - 10, - 11 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "Timestamp", + { + "type": "expression", + "expression": "require(bool)(block.timestamp == 0)", "source_mapping": { - "start": 0, - "length": 402, + "start": 81, + "length": 29, "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_relative": "tests/timestamp.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_short": "tests/timestamp.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20 + 5 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 38 } } - }, - { - "type": "expression", - "expression": "require(bool)(time == 0)", - "source_mapping": { - "start": 197, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 27 - } - } - ] - }, - { - "check": "timestamp", - "impact": "Low", - "confidence": "Medium", - "description": "Timestamp.bad2 (tests/timestamp.sol#13-15) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- block.timestamp > 0 (tests/timestamp.sol#14)\n", - "elements": [ - { - "type": "function", - "name": "bad2", - "source_mapping": { - "start": 231, - "length": 79, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 13, - 14, - 15 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "Timestamp", + ] + }, + { + "check": "timestamp", + "impact": "Low", + "confidence": "Medium", + "description": "Timestamp.bad1 (tests/timestamp.sol#8-11) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- require(bool)(time == 0) (tests/timestamp.sol#10)\n", + "elements": [ + { + "type": "function", + "name": "bad1", "source_mapping": { - "start": 0, - "length": 402, + "start": 126, + "length": 96, "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_relative": "tests/timestamp.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", "filename_short": "tests/timestamp.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, 8, 9, 10, - 11, - 12, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Timestamp", + "source_mapping": { + "start": 0, + "length": 402, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(time == 0)", + "source_mapping": { + "start": 197, + "length": 18, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 27 + } + } + ] + }, + { + "check": "timestamp", + "impact": "Low", + "confidence": "Medium", + "description": "Timestamp.bad2 (tests/timestamp.sol#13-15) uses timestamp for comparisons\n\tDangerous comparisons:\n\t- block.timestamp > 0 (tests/timestamp.sol#14)\n", + "elements": [ + { + "type": "function", + "name": "bad2", + "source_mapping": { + "start": 231, + "length": 79, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ 13, 14, - 15, - 16, - 17, - 18, - 19, - 20 + 15 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Timestamp", + "source_mapping": { + "start": 0, + "length": 402, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "block.timestamp > 0", + "source_mapping": { + "start": 279, + "length": 24, + "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_relative": "tests/timestamp.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", + "filename_short": "tests/timestamp.sol", + "lines": [ + 14 + ], + "starting_column": 9, + "ending_column": 33 } } - }, - { - "type": "expression", - "expression": "block.timestamp > 0", - "source_mapping": { - "start": 279, - "length": 24, - "filename_used": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_relative": "tests/timestamp.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/timestamp.sol", - "filename_short": "tests/timestamp.sol", - "lines": [ - 14 - ], - "starting_column": 9, - "ending_column": 33 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/too_many_digits.too-many-digits.json b/tests/expected_json/too_many_digits.too-many-digits.json index 96768b95e..1fe47d0c6 100644 --- a/tests/expected_json/too_many_digits.too-many-digits.json +++ b/tests/expected_json/too_many_digits.too-many-digits.json @@ -1,196 +1,200 @@ -[ - { - "check": "too-many-digits", - "impact": "Informational", - "confidence": "Medium", - "description": "C.f (tests/too_many_digits.sol#9-15) uses literals with too many digits:\n\t- x1 = 0x000001\n\t- x2 = 0x0000000000001\n\t- x3 = 1000000000000000000\n\t- x4 = 100000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", - "elements": [ - { - "type": "expression", - "expression": "x1 = 0x000001", - "source_mapping": { - "start": 206, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 27 +{ + "success": true, + "error": null, + "results": [ + { + "check": "too-many-digits", + "impact": "Informational", + "confidence": "Medium", + "description": "C.f (tests/too_many_digits.sol#9-15) uses literals with too many digits:\n\t- x1 = 0x000001\n\t- x2 = 0x0000000000001\n\t- x3 = 1000000000000000000\n\t- x4 = 100000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", + "elements": [ + { + "type": "expression", + "expression": "x1 = 0x000001", + "source_mapping": { + "start": 206, + "length": 18, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 27 + } + }, + { + "type": "expression", + "expression": "x2 = 0x0000000000001", + "source_mapping": { + "start": 234, + "length": 25, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 11 + ], + "starting_column": 9, + "ending_column": 34 + } + }, + { + "type": "expression", + "expression": "x3 = 1000000000000000000", + "source_mapping": { + "start": 269, + "length": 29, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 12 + ], + "starting_column": 9, + "ending_column": 38 + } + }, + { + "type": "expression", + "expression": "x4 = 100000", + "source_mapping": { + "start": 308, + "length": 16, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 13 + ], + "starting_column": 9, + "ending_column": 25 + } } - }, - { - "type": "expression", - "expression": "x2 = 0x0000000000001", - "source_mapping": { - "start": 234, - "length": 25, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 11 - ], - "starting_column": 9, - "ending_column": 34 + ] + }, + { + "check": "too-many-digits", + "impact": "Informational", + "confidence": "Medium", + "description": "C.h (tests/too_many_digits.sol#20-24) uses literals with too many digits:\n\t- x2 = 100000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", + "elements": [ + { + "type": "expression", + "expression": "x2 = 100000", + "source_mapping": { + "start": 509, + "length": 16, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 22 + ], + "starting_column": 9, + "ending_column": 25 + } } - }, - { - "type": "expression", - "expression": "x3 = 1000000000000000000", - "source_mapping": { - "start": 269, - "length": 29, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 12 - ], - "starting_column": 9, - "ending_column": 38 + ] + }, + { + "check": "too-many-digits", + "impact": "Informational", + "confidence": "Medium", + "description": "C.i (tests/too_many_digits.sol#29-33) uses literals with too many digits:\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", + "elements": [ + { + "type": "expression", + "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", + "source_mapping": { + "start": 749, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 31 + ], + "starting_column": 9, + "ending_column": 76 + } + }, + { + "type": "expression", + "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", + "source_mapping": { + "start": 749, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 31 + ], + "starting_column": 9, + "ending_column": 76 + } + }, + { + "type": "expression", + "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", + "source_mapping": { + "start": 749, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 31 + ], + "starting_column": 9, + "ending_column": 76 + } + }, + { + "type": "expression", + "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", + "source_mapping": { + "start": 749, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 31 + ], + "starting_column": 9, + "ending_column": 76 + } + }, + { + "type": "expression", + "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", + "source_mapping": { + "start": 749, + "length": 67, + "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_relative": "tests/too_many_digits.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", + "filename_short": "tests/too_many_digits.sol", + "lines": [ + 31 + ], + "starting_column": 9, + "ending_column": 76 + } } - }, - { - "type": "expression", - "expression": "x4 = 100000", - "source_mapping": { - "start": 308, - "length": 16, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 13 - ], - "starting_column": 9, - "ending_column": 25 - } - } - ] - }, - { - "check": "too-many-digits", - "impact": "Informational", - "confidence": "Medium", - "description": "C.h (tests/too_many_digits.sol#20-24) uses literals with too many digits:\n\t- x2 = 100000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", - "elements": [ - { - "type": "expression", - "expression": "x2 = 100000", - "source_mapping": { - "start": 509, - "length": 16, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 22 - ], - "starting_column": 9, - "ending_column": 25 - } - } - ] - }, - { - "check": "too-many-digits", - "impact": "Informational", - "confidence": "Medium", - "description": "C.i (tests/too_many_digits.sol#29-33) uses literals with too many digits:\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\t- x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000\n\tUse the proper denomination (ether-unit, time-unit,or the scientific notation\n", - "elements": [ - { - "type": "expression", - "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", - "source_mapping": { - "start": 749, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 31 - ], - "starting_column": 9, - "ending_column": 76 - } - }, - { - "type": "expression", - "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", - "source_mapping": { - "start": 749, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 31 - ], - "starting_column": 9, - "ending_column": 76 - } - }, - { - "type": "expression", - "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", - "source_mapping": { - "start": 749, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 31 - ], - "starting_column": 9, - "ending_column": 76 - } - }, - { - "type": "expression", - "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", - "source_mapping": { - "start": 749, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 31 - ], - "starting_column": 9, - "ending_column": 76 - } - }, - { - "type": "expression", - "expression": "x2 = 1000000000000 + 10000000000000 + 100000000000000 + 1000000000000000 + 10000000000000000", - "source_mapping": { - "start": 749, - "length": 67, - "filename_used": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_relative": "tests/too_many_digits.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/too_many_digits.sol", - "filename_short": "tests/too_many_digits.sol", - "lines": [ - 31 - ], - "starting_column": 9, - "ending_column": 76 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/tx_origin-0.5.1.tx-origin.json b/tests/expected_json/tx_origin-0.5.1.tx-origin.json index e88d33ad9..2874b428e 100644 --- a/tests/expected_json/tx_origin-0.5.1.tx-origin.json +++ b/tests/expected_json/tx_origin-0.5.1.tx-origin.json @@ -1,174 +1,178 @@ -[ - { - "check": "tx-origin", - "impact": "Medium", - "confidence": "Medium", - "description": "TxOrigin.bug0 uses tx.origin for authorization:\n\t- require(bool)(tx.origin == owner) (tests/tx_origin-0.5.1.sol#10)\n", - "elements": [ - { - "type": "function", - "name": "bug0", - "source_mapping": { - "start": 127, - "length": 66, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_relative": "tests/tx_origin-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_short": "tests/tx_origin-0.5.1.sol", - "lines": [ - 9, - 10, - 11 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TxOrigin", +{ + "success": true, + "error": null, + "results": [ + { + "check": "tx-origin", + "impact": "Medium", + "confidence": "Medium", + "description": "TxOrigin.bug0 uses tx.origin for authorization:\n\t- require(bool)(tx.origin == owner) (tests/tx_origin-0.5.1.sol#10)\n", + "elements": [ + { + "type": "function", + "name": "bug0", "source_mapping": { - "start": 25, - "length": 442, + "start": 127, + "length": 66, "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", "filename_relative": "tests/tx_origin-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", "filename_short": "tests/tx_origin-0.5.1.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, 9, 10, - 11, - 12, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TxOrigin", + "source_mapping": { + "start": 25, + "length": 442, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_relative": "tests/tx_origin-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_short": "tests/tx_origin-0.5.1.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(tx.origin == owner)", + "source_mapping": { + "start": 159, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_relative": "tests/tx_origin-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_short": "tests/tx_origin-0.5.1.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 36 + } + } + ] + }, + { + "check": "tx-origin", + "impact": "Medium", + "confidence": "Medium", + "description": "TxOrigin.bug2 uses tx.origin for authorization:\n\t- tx.origin != owner (tests/tx_origin-0.5.1.sol#14-16)\n", + "elements": [ + { + "type": "function", + "name": "bug2", + "source_mapping": { + "start": 199, + "length": 95, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_relative": "tests/tx_origin-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_short": "tests/tx_origin-0.5.1.sol", + "lines": [ 13, 14, 15, 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 + 17 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TxOrigin", + "source_mapping": { + "start": 25, + "length": 442, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_relative": "tests/tx_origin-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", + "filename_short": "tests/tx_origin-0.5.1.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(tx.origin == owner)", - "source_mapping": { - "start": 159, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_relative": "tests/tx_origin-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_short": "tests/tx_origin-0.5.1.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 36 - } - } - ] - }, - { - "check": "tx-origin", - "impact": "Medium", - "confidence": "Medium", - "description": "TxOrigin.bug2 uses tx.origin for authorization:\n\t- tx.origin != owner (tests/tx_origin-0.5.1.sol#14-16)\n", - "elements": [ - { - "type": "function", - "name": "bug2", - "source_mapping": { - "start": 199, - "length": 95, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_relative": "tests/tx_origin-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_short": "tests/tx_origin-0.5.1.sol", - "lines": [ - 13, - 14, - 15, - 16, - 17 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TxOrigin", + { + "type": "expression", + "expression": "tx.origin != owner", "source_mapping": { - "start": 25, - "length": 442, + "start": 231, + "length": 57, "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", "filename_relative": "tests/tx_origin-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", "filename_short": "tests/tx_origin-0.5.1.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, 14, 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 + 16 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 10 } } - }, - { - "type": "expression", - "expression": "tx.origin != owner", - "source_mapping": { - "start": 231, - "length": 57, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_relative": "tests/tx_origin-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin-0.5.1.sol", - "filename_short": "tests/tx_origin-0.5.1.sol", - "lines": [ - 14, - 15, - 16 - ], - "starting_column": 9, - "ending_column": 10 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/tx_origin.tx-origin.json b/tests/expected_json/tx_origin.tx-origin.json index 692e4c4db..d935534b6 100644 --- a/tests/expected_json/tx_origin.tx-origin.json +++ b/tests/expected_json/tx_origin.tx-origin.json @@ -1,174 +1,178 @@ -[ - { - "check": "tx-origin", - "impact": "Medium", - "confidence": "Medium", - "description": "TxOrigin.bug0 uses tx.origin for authorization:\n\t- require(bool)(tx.origin == owner) (tests/tx_origin.sol#10)\n", - "elements": [ - { - "type": "function", - "name": "bug0", - "source_mapping": { - "start": 116, - "length": 60, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_relative": "tests/tx_origin.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_short": "tests/tx_origin.sol", - "lines": [ - 9, - 10, - 11 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "TxOrigin", +{ + "success": true, + "error": null, + "results": [ + { + "check": "tx-origin", + "impact": "Medium", + "confidence": "Medium", + "description": "TxOrigin.bug0 uses tx.origin for authorization:\n\t- require(bool)(tx.origin == owner) (tests/tx_origin.sol#10)\n", + "elements": [ + { + "type": "function", + "name": "bug0", "source_mapping": { - "start": 28, - "length": 393, + "start": 116, + "length": 60, "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", "filename_relative": "tests/tx_origin.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", "filename_short": "tests/tx_origin.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, 9, 10, - 11, - 12, + 11 + ], + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TxOrigin", + "source_mapping": { + "start": 28, + "length": 393, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_relative": "tests/tx_origin.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_short": "tests/tx_origin.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "require(bool)(tx.origin == owner)", + "source_mapping": { + "start": 142, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_relative": "tests/tx_origin.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_short": "tests/tx_origin.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 36 + } + } + ] + }, + { + "check": "tx-origin", + "impact": "Medium", + "confidence": "Medium", + "description": "TxOrigin.bug2 uses tx.origin for authorization:\n\t- tx.origin != owner (tests/tx_origin.sol#14-16)\n", + "elements": [ + { + "type": "function", + "name": "bug2", + "source_mapping": { + "start": 182, + "length": 89, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_relative": "tests/tx_origin.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_short": "tests/tx_origin.sol", + "lines": [ 13, 14, 15, 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 + 17 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "TxOrigin", + "source_mapping": { + "start": 28, + "length": 393, + "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_relative": "tests/tx_origin.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", + "filename_short": "tests/tx_origin.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ], + "starting_column": 1, + "ending_column": 2 + } } - } - }, - { - "type": "expression", - "expression": "require(bool)(tx.origin == owner)", - "source_mapping": { - "start": 142, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_relative": "tests/tx_origin.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_short": "tests/tx_origin.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 36 - } - } - ] - }, - { - "check": "tx-origin", - "impact": "Medium", - "confidence": "Medium", - "description": "TxOrigin.bug2 uses tx.origin for authorization:\n\t- tx.origin != owner (tests/tx_origin.sol#14-16)\n", - "elements": [ - { - "type": "function", - "name": "bug2", - "source_mapping": { - "start": 182, - "length": 89, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_relative": "tests/tx_origin.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_short": "tests/tx_origin.sol", - "lines": [ - 13, - 14, - 15, - 16, - 17 - ], - "starting_column": 5, - "ending_column": 6 }, - "contract": { - "type": "contract", - "name": "TxOrigin", + { + "type": "expression", + "expression": "tx.origin != owner", "source_mapping": { - "start": 28, - "length": 393, + "start": 208, + "length": 57, "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", "filename_relative": "tests/tx_origin.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", "filename_short": "tests/tx_origin.sol", "lines": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, 14, 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 + 16 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 9, + "ending_column": 10 } } - }, - { - "type": "expression", - "expression": "tx.origin != owner", - "source_mapping": { - "start": 208, - "length": 57, - "filename_used": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_relative": "tests/tx_origin.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/tx_origin.sol", - "filename_short": "tests/tx_origin.sol", - "lines": [ - 14, - 15, - 16 - ], - "starting_column": 9, - "ending_column": 10 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/uninitialized-0.5.1.uninitialized-state.json b/tests/expected_json/uninitialized-0.5.1.uninitialized-state.json index e21385e35..47252e62d 100644 --- a/tests/expected_json/uninitialized-0.5.1.uninitialized-state.json +++ b/tests/expected_json/uninitialized-0.5.1.uninitialized-state.json @@ -1,301 +1,305 @@ -[ - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Uninitialized.destination (tests/uninitialized-0.5.1.sol#5) is never initialized. It is used in:\n\t- transfer (tests/uninitialized-0.5.1.sol#7-9)\n", - "elements": [ - { - "type": "variable", - "name": "destination", - "source_mapping": { - "start": 54, - "length": 27, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 5 - ], - "starting_column": 5, - "ending_column": 32 - } - }, - { - "type": "function", - "name": "transfer", - "source_mapping": { - "start": 88, - "length": 82, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 7, - 8, - 9 - ], - "starting_column": 5, - "ending_column": 6 +{ + "success": true, + "error": null, + "results": [ + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Uninitialized.destination (tests/uninitialized-0.5.1.sol#5) is never initialized. It is used in:\n\t- transfer (tests/uninitialized-0.5.1.sol#7-9)\n", + "elements": [ + { + "type": "variable", + "name": "destination", + "source_mapping": { + "start": 54, + "length": 27, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 5 + ], + "starting_column": 5, + "ending_column": 32 + } }, - "contract": { - "type": "contract", - "name": "Uninitialized", + { + "type": "function", + "name": "transfer", "source_mapping": { - "start": 25, - "length": 148, + "start": 88, + "length": 82, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_relative": "tests/uninitialized-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_short": "tests/uninitialized-0.5.1.sol", "lines": [ - 3, - 4, - 5, - 6, 7, 8, - 9, - 10, - 11 + 9 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Uninitialized", + "source_mapping": { + "start": 25, + "length": 148, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test.balances (tests/uninitialized-0.5.1.sol#15) is never initialized. It is used in:\n\t- use (tests/uninitialized-0.5.1.sol#23-26)\n", - "elements": [ - { - "type": "variable", - "name": "balances", - "source_mapping": { - "start": 196, - "length": 34, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 15 - ], - "starting_column": 5, - "ending_column": 39 - } - }, - { - "type": "function", - "name": "use", - "source_mapping": { - "start": 369, - "length": 154, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 23, - 24, - 25, - 26 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test.balances (tests/uninitialized-0.5.1.sol#15) is never initialized. It is used in:\n\t- use (tests/uninitialized-0.5.1.sol#23-26)\n", + "elements": [ + { + "type": "variable", + "name": "balances", + "source_mapping": { + "start": 196, + "length": 34, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 15 + ], + "starting_column": 5, + "ending_column": 39 + } }, - "contract": { - "type": "contract", - "name": "Test", + { + "type": "function", + "name": "use", "source_mapping": { - "start": 176, - "length": 349, + "start": 369, + "length": 154, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_relative": "tests/uninitialized-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_short": "tests/uninitialized-0.5.1.sol", "lines": [ - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, 23, 24, 25, - 26, - 27 + 26 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 176, + "length": 349, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test2.st (tests/uninitialized-0.5.1.sol#45) is never initialized. It is used in:\n\t- use (tests/uninitialized-0.5.1.sol#53-56)\n", - "elements": [ - { - "type": "variable", - "name": "st", - "source_mapping": { - "start": 726, - "length": 15, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 45 - ], - "starting_column": 5, - "ending_column": 20 - } - }, - { - "type": "function", - "name": "use", - "source_mapping": { - "start": 913, - "length": 129, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 53, - 54, - 55, - 56 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test2.st (tests/uninitialized-0.5.1.sol#45) is never initialized. It is used in:\n\t- use (tests/uninitialized-0.5.1.sol#53-56)\n", + "elements": [ + { + "type": "variable", + "name": "st", + "source_mapping": { + "start": 726, + "length": 15, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 45 + ], + "starting_column": 5, + "ending_column": 20 + } }, - "contract": { - "type": "contract", - "name": "Test2", + { + "type": "function", + "name": "use", "source_mapping": { - "start": 672, - "length": 373, + "start": 913, + "length": 129, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_relative": "tests/uninitialized-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_short": "tests/uninitialized-0.5.1.sol", "lines": [ - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, 53, 54, 55, - 56, - 57, - 58 + 56 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test2", + "source_mapping": { + "start": 672, + "length": 373, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test2.v (tests/uninitialized-0.5.1.sol#47) is never initialized. It is used in:\n\t- init (tests/uninitialized-0.5.1.sol#49-51)\n", - "elements": [ - { - "type": "variable", - "name": "v", - "source_mapping": { - "start": 779, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 47 - ], - "starting_column": 5, - "ending_column": 11 - } - }, - { - "type": "function", - "name": "init", - "source_mapping": { - "start": 848, - "length": 59, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_relative": "tests/uninitialized-0.5.1.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", - "filename_short": "tests/uninitialized-0.5.1.sol", - "lines": [ - 49, - 50, - 51 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test2.v (tests/uninitialized-0.5.1.sol#47) is never initialized. It is used in:\n\t- init (tests/uninitialized-0.5.1.sol#49-51)\n", + "elements": [ + { + "type": "variable", + "name": "v", + "source_mapping": { + "start": 779, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 47 + ], + "starting_column": 5, + "ending_column": 11 + } }, - "contract": { - "type": "contract", - "name": "Test2", + { + "type": "function", + "name": "init", "source_mapping": { - "start": 672, - "length": 373, + "start": 848, + "length": 59, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_relative": "tests/uninitialized-0.5.1.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", "filename_short": "tests/uninitialized-0.5.1.sol", "lines": [ - 42, - 43, - 44, - 45, - 46, - 47, - 48, 49, 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58 + 51 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test2", + "source_mapping": { + "start": 672, + "length": 373, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_relative": "tests/uninitialized-0.5.1.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized-0.5.1.sol", + "filename_short": "tests/uninitialized-0.5.1.sol", + "lines": [ + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/uninitialized.uninitialized-state.json b/tests/expected_json/uninitialized.uninitialized-state.json index f5dfa23f3..b41ed4d83 100644 --- a/tests/expected_json/uninitialized.uninitialized-state.json +++ b/tests/expected_json/uninitialized.uninitialized-state.json @@ -1,301 +1,305 @@ -[ - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Uninitialized.destination (tests/uninitialized.sol#5) is never initialized. It is used in:\n\t- transfer (tests/uninitialized.sol#7-9)\n", - "elements": [ - { - "type": "variable", - "name": "destination", - "source_mapping": { - "start": 55, - "length": 19, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 5 - ], - "starting_column": 5, - "ending_column": 24 - } - }, - { - "type": "function", - "name": "transfer", - "source_mapping": { - "start": 81, - "length": 82, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 7, - 8, - 9 - ], - "starting_column": 5, - "ending_column": 6 +{ + "success": true, + "error": null, + "results": [ + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Uninitialized.destination (tests/uninitialized.sol#5) is never initialized. It is used in:\n\t- transfer (tests/uninitialized.sol#7-9)\n", + "elements": [ + { + "type": "variable", + "name": "destination", + "source_mapping": { + "start": 55, + "length": 19, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 5 + ], + "starting_column": 5, + "ending_column": 24 + } }, - "contract": { - "type": "contract", - "name": "Uninitialized", + { + "type": "function", + "name": "transfer", "source_mapping": { - "start": 26, - "length": 140, + "start": 81, + "length": 82, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_relative": "tests/uninitialized.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_short": "tests/uninitialized.sol", "lines": [ - 3, - 4, - 5, - 6, 7, 8, - 9, - 10, - 11 + 9 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Uninitialized", + "source_mapping": { + "start": 26, + "length": 140, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test.balances (tests/uninitialized.sol#15) is never initialized. It is used in:\n\t- use (tests/uninitialized.sol#23-26)\n", - "elements": [ - { - "type": "variable", - "name": "balances", - "source_mapping": { - "start": 189, - "length": 34, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 15 - ], - "starting_column": 5, - "ending_column": 39 - } - }, - { - "type": "function", - "name": "use", - "source_mapping": { - "start": 356, - "length": 143, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 23, - 24, - 25, - 26 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test.balances (tests/uninitialized.sol#15) is never initialized. It is used in:\n\t- use (tests/uninitialized.sol#23-26)\n", + "elements": [ + { + "type": "variable", + "name": "balances", + "source_mapping": { + "start": 189, + "length": 34, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 15 + ], + "starting_column": 5, + "ending_column": 39 + } }, - "contract": { - "type": "contract", - "name": "Test", + { + "type": "function", + "name": "use", "source_mapping": { - "start": 169, - "length": 332, + "start": 356, + "length": 143, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_relative": "tests/uninitialized.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_short": "tests/uninitialized.sol", "lines": [ - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, 23, 24, 25, - 26, - 27 + 26 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 169, + "length": 332, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test2.st (tests/uninitialized.sol#45) is never initialized. It is used in:\n\t- use (tests/uninitialized.sol#53-56)\n", - "elements": [ - { - "type": "variable", - "name": "st", - "source_mapping": { - "start": 695, - "length": 15, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 45 - ], - "starting_column": 5, - "ending_column": 20 - } - }, - { - "type": "function", - "name": "use", - "source_mapping": { - "start": 875, - "length": 117, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 53, - 54, - 55, - 56 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test2.st (tests/uninitialized.sol#45) is never initialized. It is used in:\n\t- use (tests/uninitialized.sol#53-56)\n", + "elements": [ + { + "type": "variable", + "name": "st", + "source_mapping": { + "start": 695, + "length": 15, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 45 + ], + "starting_column": 5, + "ending_column": 20 + } }, - "contract": { - "type": "contract", - "name": "Test2", + { + "type": "function", + "name": "use", "source_mapping": { - "start": 641, - "length": 354, + "start": 875, + "length": 117, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_relative": "tests/uninitialized.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_short": "tests/uninitialized.sol", "lines": [ - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, 53, 54, 55, - 56, - 57, - 58 + 56 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test2", + "source_mapping": { + "start": 641, + "length": 354, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - }, - { - "check": "uninitialized-state", - "impact": "High", - "confidence": "High", - "description": "Test2.v (tests/uninitialized.sol#47) is never initialized. It is used in:\n\t- init (tests/uninitialized.sol#49-51)\n", - "elements": [ - { - "type": "variable", - "name": "v", - "source_mapping": { - "start": 748, - "length": 6, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 47 - ], - "starting_column": 5, - "ending_column": 11 - } - }, - { - "type": "function", - "name": "init", - "source_mapping": { - "start": 817, - "length": 52, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_relative": "tests/uninitialized.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", - "filename_short": "tests/uninitialized.sol", - "lines": [ - 49, - 50, - 51 - ], - "starting_column": 5, - "ending_column": 6 + ] + }, + { + "check": "uninitialized-state", + "impact": "High", + "confidence": "High", + "description": "Test2.v (tests/uninitialized.sol#47) is never initialized. It is used in:\n\t- init (tests/uninitialized.sol#49-51)\n", + "elements": [ + { + "type": "variable", + "name": "v", + "source_mapping": { + "start": 748, + "length": 6, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 47 + ], + "starting_column": 5, + "ending_column": 11 + } }, - "contract": { - "type": "contract", - "name": "Test2", + { + "type": "function", + "name": "init", "source_mapping": { - "start": 641, - "length": 354, + "start": 817, + "length": 52, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_relative": "tests/uninitialized.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", "filename_short": "tests/uninitialized.sol", "lines": [ - 42, - 43, - 44, - 45, - 46, - 47, - 48, 49, 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58 + 51 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Test2", + "source_mapping": { + "start": 641, + "length": 354, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_relative": "tests/uninitialized.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized.sol", + "filename_short": "tests/uninitialized.sol", + "lines": [ + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/uninitialized_local_variable.uninitialized-local.json b/tests/expected_json/uninitialized_local_variable.uninitialized-local.json index 107149125..d7a0a7542 100644 --- a/tests/expected_json/uninitialized_local_variable.uninitialized-local.json +++ b/tests/expected_json/uninitialized_local_variable.uninitialized-local.json @@ -1,73 +1,77 @@ -[ - { - "check": "uninitialized-local", - "impact": "Medium", - "confidence": "Medium", - "description": "uint_not_init in Uninitialized.func (tests/uninitialized_local_variable.sol#4) is a local variable never initialiazed\n", - "elements": [ - { - "type": "variable", - "name": "uint_not_init", - "source_mapping": { - "start": 77, - "length": 18, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", - "filename_relative": "tests/uninitialized_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", - "filename_short": "tests/uninitialized_local_variable.sol", - "lines": [ - 4 - ], - "starting_column": 9, - "ending_column": 27 - } - }, - { - "type": "function", - "name": "func", - "source_mapping": { - "start": 29, - "length": 143, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", - "filename_relative": "tests/uninitialized_local_variable.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", - "filename_short": "tests/uninitialized_local_variable.sol", - "lines": [ - 3, - 4, - 5, - 6, - 7 - ], - "starting_column": 5, - "ending_column": 6 +{ + "success": true, + "error": null, + "results": [ + { + "check": "uninitialized-local", + "impact": "Medium", + "confidence": "Medium", + "description": "uint_not_init in Uninitialized.func (tests/uninitialized_local_variable.sol#4) is a local variable never initialiazed\n", + "elements": [ + { + "type": "variable", + "name": "uint_not_init", + "source_mapping": { + "start": 77, + "length": 18, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", + "filename_relative": "tests/uninitialized_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", + "filename_short": "tests/uninitialized_local_variable.sol", + "lines": [ + 4 + ], + "starting_column": 9, + "ending_column": 27 + } }, - "contract": { - "type": "contract", - "name": "Uninitialized", + { + "type": "function", + "name": "func", "source_mapping": { - "start": 0, - "length": 179, + "start": 29, + "length": 143, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", "filename_relative": "tests/uninitialized_local_variable.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", "filename_short": "tests/uninitialized_local_variable.sol", "lines": [ - 1, - 2, 3, 4, 5, 6, - 7, - 8, - 9 + 7 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Uninitialized", + "source_mapping": { + "start": 0, + "length": 179, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", + "filename_relative": "tests/uninitialized_local_variable.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_local_variable.sol", + "filename_short": "tests/uninitialized_local_variable.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json b/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json index 475c3cf7d..077254b13 100644 --- a/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json +++ b/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json @@ -1,79 +1,83 @@ -[ - { - "check": "uninitialized-storage", - "impact": "High", - "confidence": "High", - "description": "st_bug in Uninitialized.func (tests/uninitialized_storage_pointer.sol#10) is a storage variable never initialiazed\n", - "elements": [ - { - "type": "variable", - "name": "st_bug", - "source_mapping": { - "start": 171, - "length": 9, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", - "filename_relative": "tests/uninitialized_storage_pointer.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", - "filename_short": "tests/uninitialized_storage_pointer.sol", - "lines": [ - 10 - ], - "starting_column": 9, - "ending_column": 18 - } - }, - { - "type": "function", - "name": "func", - "source_mapping": { - "start": 67, - "length": 143, - "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", - "filename_relative": "tests/uninitialized_storage_pointer.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", - "filename_short": "tests/uninitialized_storage_pointer.sol", - "lines": [ - 7, - 8, - 9, - 10, - 11, - 12 - ], - "starting_column": 5, - "ending_column": 6 +{ + "success": true, + "error": null, + "results": [ + { + "check": "uninitialized-storage", + "impact": "High", + "confidence": "High", + "description": "st_bug in Uninitialized.func (tests/uninitialized_storage_pointer.sol#10) is a storage variable never initialiazed\n", + "elements": [ + { + "type": "variable", + "name": "st_bug", + "source_mapping": { + "start": 171, + "length": 9, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", + "filename_relative": "tests/uninitialized_storage_pointer.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", + "filename_short": "tests/uninitialized_storage_pointer.sol", + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 18 + } }, - "contract": { - "type": "contract", - "name": "Uninitialized", + { + "type": "function", + "name": "func", "source_mapping": { - "start": 0, - "length": 217, + "start": 67, + "length": 143, "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", "filename_relative": "tests/uninitialized_storage_pointer.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", "filename_short": "tests/uninitialized_storage_pointer.sol", "lines": [ - 1, - 2, - 3, - 4, - 5, - 6, 7, 8, 9, 10, 11, - 12, - 13, - 14 + 12 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "Uninitialized", + "source_mapping": { + "start": 0, + "length": 217, + "filename_used": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", + "filename_relative": "tests/uninitialized_storage_pointer.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/uninitialized_storage_pointer.sol", + "filename_short": "tests/uninitialized_storage_pointer.sol", + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 2 + } } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.txt b/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.txt index a7b868f1e..4ffd95f9c 100644 --- a/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.txt +++ b/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.txt @@ -1,5 +1,29 @@ -ERROR:Slither:Invalid compilation -ERROR:Slither:Invalid solc compilation tests/uninitialized_storage_pointer.sol:7:5: Error: No visibility specified. Did you intend to add "public"? +ERROR:root:Error in tests/uninitialized_storage_pointer.sol +ERROR:root:Traceback (most recent call last): + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 189, in _run_solc + ret = json.loads(stdout) + File "/usr/lib/python3.6/json/__init__.py", line 354, in loads + return _default_decoder.decode(s) + File "/usr/lib/python3.6/json/decoder.py", line 339, in decode + obj, end = self.raw_decode(s, idx=_w(s, 0).end()) + File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode + raise JSONDecodeError("Expecting value", s, err.value) from None +json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/monty/Private/tob/tools/slither-public/slither/slither.py", line 56, in __init__ + crytic_compile = CryticCompile(contract, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/crytic_compile.py", line 68, in __init__ + self._compile(target, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/crytic_compile.py", line 590, in _compile + self._platform.compile(self, target, **kwargs) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 33, in compile + working_dir=solc_working_dir) + File "/home/monty/Private/tob/tools/crytic-compile/crytic_compile/platform/solc.py", line 192, in _run_solc + raise InvalidCompilation(f'Invalid solc compilation {stderr}') +crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation tests/uninitialized_storage_pointer.sol:7:5: Error: No visibility specified. Did you intend to add "public"? function func() { ^ (Relevant source part starts here and spans across multiple lines). tests/uninitialized_storage_pointer.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.1;" @@ -12,3 +36,15 @@ tests/uninitialized_storage_pointer.sol:10:9: Error: Data location must be "stor St st_bug; ^-------^ + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 558, in main_impl + (results, number_contracts) = process(filename, args, detector_classes, printer_classes) + File "/home/monty/Private/tob/tools/slither-public/slither/__main__.py", line 51, in process + **vars(args)) + File "/home/monty/Private/tob/tools/slither-public/slither/slither.py", line 59, in __init__ + raise SlitherError('Invalid compilation: '+e) +TypeError: must be str, not InvalidCompilation + diff --git a/tests/expected_json/unused_return.unused-return.json b/tests/expected_json/unused_return.unused-return.json index 136b93c39..817745f0a 100644 --- a/tests/expected_json/unused_return.unused-return.json +++ b/tests/expected_json/unused_return.unused-return.json @@ -1,53 +1,24 @@ -[ - { - "check": "unused-return", - "impact": "Medium", - "confidence": "Medium", - "description": "User.test (tests/unused_return.sol#17-29) does not use the value returned by external calls:\n\t-t.f() (tests/unused_return.sol#18)\n\t-a.add(0) (tests/unused_return.sol#22)\n", - "elements": [ - { - "type": "function", - "name": "test", - "source_mapping": { - "start": 239, - "length": 354, - "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_relative": "tests/unused_return.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_short": "tests/unused_return.sol", - "lines": [ - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29 - ], - "starting_column": 5, - "ending_column": 6 - }, - "contract": { - "type": "contract", - "name": "User", +{ + "success": true, + "error": null, + "results": [ + { + "check": "unused-return", + "impact": "Medium", + "confidence": "Medium", + "description": "User.test (tests/unused_return.sol#17-29) does not use the value returned by external calls:\n\t-t.f() (tests/unused_return.sol#18)\n\t-a.add(0) (tests/unused_return.sol#22)\n", + "elements": [ + { + "type": "function", + "name": "test", "source_mapping": { - "start": 189, - "length": 406, + "start": 239, + "length": 354, "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", "filename_relative": "tests/unused_return.sol", "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", "filename_short": "tests/unused_return.sol", "lines": [ - 13, - 14, - 15, - 16, 17, 18, 19, @@ -60,48 +31,81 @@ 26, 27, 28, - 29, - 30 + 29 ], - "starting_column": 1, - "ending_column": 2 + "starting_column": 5, + "ending_column": 6 + }, + "contract": { + "type": "contract", + "name": "User", + "source_mapping": { + "start": 189, + "length": 406, + "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_relative": "tests/unused_return.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_short": "tests/unused_return.sol", + "lines": [ + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30 + ], + "starting_column": 1, + "ending_column": 2 + } + } + }, + { + "type": "expression", + "expression": "t.f()", + "source_mapping": { + "start": 279, + "length": 5, + "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_relative": "tests/unused_return.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_short": "tests/unused_return.sol", + "lines": [ + 18 + ], + "starting_column": 9, + "ending_column": 14 + } + }, + { + "type": "expression", + "expression": "a.add(0)", + "source_mapping": { + "start": 353, + "length": 8, + "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_relative": "tests/unused_return.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", + "filename_short": "tests/unused_return.sol", + "lines": [ + 22 + ], + "starting_column": 9, + "ending_column": 17 } } - }, - { - "type": "expression", - "expression": "t.f()", - "source_mapping": { - "start": 279, - "length": 5, - "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_relative": "tests/unused_return.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_short": "tests/unused_return.sol", - "lines": [ - 18 - ], - "starting_column": 9, - "ending_column": 14 - } - }, - { - "type": "expression", - "expression": "a.add(0)", - "source_mapping": { - "start": 353, - "length": 8, - "filename_used": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_relative": "tests/unused_return.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_return.sol", - "filename_short": "tests/unused_return.sol", - "lines": [ - 22 - ], - "starting_column": 9, - "ending_column": 17 - } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file diff --git a/tests/expected_json/unused_state.unused-state.json b/tests/expected_json/unused_state.unused-state.json index 2b9d48969..c939597f4 100644 --- a/tests/expected_json/unused_state.unused-state.json +++ b/tests/expected_json/unused_state.unused-state.json @@ -1,27 +1,31 @@ -[ - { - "check": "unused-state", - "impact": "Informational", - "confidence": "High", - "description": "A.unused (tests/unused_state.sol#4) is never used in B\n", - "elements": [ - { - "type": "variable", - "name": "unused", - "source_mapping": { - "start": 44, - "length": 14, - "filename_used": "/home/travis/build/crytic/slither/tests/unused_state.sol", - "filename_relative": "tests/unused_state.sol", - "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_state.sol", - "filename_short": "tests/unused_state.sol", - "lines": [ - 4 - ], - "starting_column": 5, - "ending_column": 19 +{ + "success": true, + "error": null, + "results": [ + { + "check": "unused-state", + "impact": "Informational", + "confidence": "High", + "description": "A.unused (tests/unused_state.sol#4) is never used in B\n", + "elements": [ + { + "type": "variable", + "name": "unused", + "source_mapping": { + "start": 44, + "length": 14, + "filename_used": "/home/travis/build/crytic/slither/tests/unused_state.sol", + "filename_relative": "tests/unused_state.sol", + "filename_absolute": "/home/travis/build/crytic/slither/tests/unused_state.sol", + "filename_short": "tests/unused_state.sol", + "lines": [ + 4 + ], + "starting_column": 5, + "ending_column": 19 + } } - } - ] - } -] \ No newline at end of file + ] + } + ] +} \ No newline at end of file