From 1995d4f57b35d5ed2354f64a8cb64f6def5d145c Mon Sep 17 00:00:00 2001 From: Josselin Date: Thu, 29 Nov 2018 10:40:00 +0000 Subject: [PATCH] Json refactor: - merge similar fields - convert last detectors output --- .../detectors/attributes/const_functions.py | 6 +- .../detectors/attributes/constant_pragma.py | 4 +- slither/detectors/attributes/old_solc.py | 4 +- slither/detectors/functions/arbitrary_send.py | 6 +- .../detectors/operations/low_level_calls.py | 2 +- .../operations/unused_return_values.py | 2 +- .../statements/controlled_delegatecall.py | 2 +- slither/detectors/statements/tx_origin.py | 2 +- .../uninitialized_local_variables.py | 11 +- .../uninitialized_state_variables.py | 17 +- .../uninitialized_storage_variables.py | 13 +- .../variables/unused_state_variables.py | 11 +- .../arbitrary_send.arbitrary-send.json | 6 +- .../constant.constant-function.json | 30 +++- ..._delegatecall.controlled-delegatecall.json | 4 +- .../low_level_calls.low-level-calls.json | 28 +-- .../old_solc.sol.json.solc-version.json | 6 +- tests/expected_json/pragma.0.4.24.pragma.json | 10 +- tests/expected_json/tx_origin.tx-origin.json | 52 +++--- .../uninitialized.uninitialized-state.json | 168 +++++++++--------- ...ed_local_variable.uninitialized-local.json | 32 ++-- ...storage_pointer.uninitialized-storage.json | 32 ++-- .../unused_return.unused-return.json | 50 +++--- .../unused_state.unused-state.json | 26 ++- 24 files changed, 273 insertions(+), 251 deletions(-) diff --git a/slither/detectors/attributes/const_functions.py b/slither/detectors/attributes/const_functions.py index cf4fcf97c..7872ae2e6 100644 --- a/slither/detectors/attributes/const_functions.py +++ b/slither/detectors/attributes/const_functions.py @@ -39,7 +39,7 @@ class ConstantFunctions(AbstractDetector): results.append({'check':self.ARGUMENT, 'function':{'name': f.name, 'source_mapping': f.source_mapping}, 'contains_assembly': True, - 'variables_written': []}) + 'variables': []}) variables_written = f.all_state_variables_written() if variables_written: @@ -53,6 +53,8 @@ class ConstantFunctions(AbstractDetector): results.append({'check':self.ARGUMENT, 'function':{'name': f.name, 'source_mapping': f.source_mapping}, - 'variables_written': [v.name for v in variables_written], + 'variables': [{'name': v.name, + 'source_mapping': v.source_mapping} + for v in variables_written], 'contains_assembly': False}) return results diff --git a/slither/detectors/attributes/constant_pragma.py b/slither/detectors/attributes/constant_pragma.py index 368c98508..eb23919e7 100644 --- a/slither/detectors/attributes/constant_pragma.py +++ b/slither/detectors/attributes/constant_pragma.py @@ -30,8 +30,8 @@ class ConstantPragma(AbstractDetector): info += "\t- {} declares {}\n".format(p.source_mapping_str, str(p)) self.log(info) - pragma_json = [{'version': p.version, 'source_mapping': p.source_mapping} for p in pragma] + pragma_json = [{'expression': p.version, 'source_mapping': p.source_mapping} for p in pragma] results.append({'check': self.ARGUMENT, - 'pragmas': pragma_json}) + 'expressions': pragma_json}) return results diff --git a/slither/detectors/attributes/old_solc.py b/slither/detectors/attributes/old_solc.py index 4577d34d4..a1d7c3344 100644 --- a/slither/detectors/attributes/old_solc.py +++ b/slither/detectors/attributes/old_solc.py @@ -33,8 +33,8 @@ class OldSolc(AbstractDetector): info += "\t- {} declares {}\n".format(p.source_mapping_str, str(p)) self.log(info) - pragma_json = [{'version': p.version, 'source_mapping': p.source_mapping} for p in old_pragma] + pragma_json = [{'expression': p.version, 'source_mapping': p.source_mapping} for p in old_pragma] results.append({'check': self.ARGUMENT, - 'pragmas': pragma_json}) + 'expressions': pragma_json}) return results diff --git a/slither/detectors/functions/arbitrary_send.py b/slither/detectors/functions/arbitrary_send.py index f2ee5ea88..e0d06d371 100644 --- a/slither/detectors/functions/arbitrary_send.py +++ b/slither/detectors/functions/arbitrary_send.py @@ -116,6 +116,10 @@ class ArbitrarySend(AbstractDetector): 'name' : func.name, 'source_mapping': func.source_mapping }, - 'dangerous_calls':[{'source_mapping':n.source_mapping} for n in nodes]}) + 'expressions':[{ + 'expression': str(n.expression), + 'source_mapping':n.source_mapping} + for n in nodes] + }) return results diff --git a/slither/detectors/operations/low_level_calls.py b/slither/detectors/operations/low_level_calls.py index 1c40d9000..0de56061e 100644 --- a/slither/detectors/operations/low_level_calls.py +++ b/slither/detectors/operations/low_level_calls.py @@ -55,7 +55,7 @@ class LowLevelCalls(AbstractDetector): 'function':{ 'name': func.name, 'source_mapping': func.source_mapping}, - 'low_level_calls': [ + 'expressions': [ {'expression': str(node.expression), 'source_mapping':node.source_mapping} for node in nodes]}) diff --git a/slither/detectors/operations/unused_return_values.py b/slither/detectors/operations/unused_return_values.py index 799d24352..2f1b5977f 100644 --- a/slither/detectors/operations/unused_return_values.py +++ b/slither/detectors/operations/unused_return_values.py @@ -64,7 +64,7 @@ class UnusedReturnValues(AbstractDetector): 'function':{ 'name': f.name, 'source_mapping': f.source_mapping}, - 'unused_returns': [ + 'expressions': [ {'expression': str(node.expression), 'source_mapping': node.source_mapping} for node in unused_return]}) diff --git a/slither/detectors/statements/controlled_delegatecall.py b/slither/detectors/statements/controlled_delegatecall.py index 027e65691..e5ea12096 100644 --- a/slither/detectors/statements/controlled_delegatecall.py +++ b/slither/detectors/statements/controlled_delegatecall.py @@ -41,7 +41,7 @@ class ControlledDelegateCall(AbstractDetector): 'function':{ 'name': f.name, 'source_mapping': f.source_mapping}, - 'controlled_delegatecalls': [ + 'expressions': [ {'expression': str(node.expression), 'source_mapping':node.source_mapping} for node in nodes]}) return results diff --git a/slither/detectors/statements/tx_origin.py b/slither/detectors/statements/tx_origin.py index 5b52fce67..262012b87 100644 --- a/slither/detectors/statements/tx_origin.py +++ b/slither/detectors/statements/tx_origin.py @@ -62,7 +62,7 @@ class TxOrigin(AbstractDetector): 'function':{ 'name': func.name, 'source_mapping': func.source_mapping}, - 'tx_origin': [ + 'expressions': [ {'expression': str(node.expression), 'source_mapping':node.source_mapping} for node in nodes]}) diff --git a/slither/detectors/variables/uninitialized_local_variables.py b/slither/detectors/variables/uninitialized_local_variables.py index eefb9c290..2987d25b7 100644 --- a/slither/detectors/variables/uninitialized_local_variables.py +++ b/slither/detectors/variables/uninitialized_local_variables.py @@ -92,11 +92,10 @@ class UninitializedLocalVars(AbstractDetector): source = [function.source_mapping, uninitialized_local_variable.source_mapping] - results.append({'vuln': 'UninitializedLocalVars', - 'sourceMapping': source, - 'filename': self.filename, - 'contract': function.contract.name, - 'function': function.name, - 'variable': var_name}) + results.append({'check': self.ARGUMENT, + 'variable':{'name': uninitialized_local_variable.name, + 'source_mapping': uninitialized_local_variable.source_mapping}, + 'function':{'name':function.name, + 'source_mapping': function.source_mapping}}) return results diff --git a/slither/detectors/variables/uninitialized_state_variables.py b/slither/detectors/variables/uninitialized_state_variables.py index 3046268a8..d43d26107 100644 --- a/slither/detectors/variables/uninitialized_state_variables.py +++ b/slither/detectors/variables/uninitialized_state_variables.py @@ -75,7 +75,9 @@ class UninitializedStateVarsDetection(AbstractDetector): ret = self.detect_uninitialized(c) for variable, functions in ret: info = "{}.{} ({}) is never initialized. It is used in:\n" - info = info.format(variable.contract.name, variable.name, variable.source_mapping_str) + info = info.format(variable.contract.name, + variable.name, + variable.source_mapping_str) for f in functions: info += "\t- {} ({})\n".format(f.name, f.source_mapping_str) self.log(info) @@ -83,11 +85,12 @@ class UninitializedStateVarsDetection(AbstractDetector): source = [variable.source_mapping] source += [f.source_mapping for f in functions] - results.append({'vuln': 'UninitializedStateVars', - 'sourceMapping': source, - 'filename': self.filename, - 'contract': c.name, - 'functions': [str(f) for f in functions], - 'variable': str(variable)}) + results.append({'check': self.ARGUMENT, + 'variable':{'name': variable.name, + 'source_mapping': variable.source_mapping}, + 'functions':[ + {'name':function.name, + 'source_mapping': function.source_mapping} + for function in functions]}) return results diff --git a/slither/detectors/variables/uninitialized_storage_variables.py b/slither/detectors/variables/uninitialized_storage_variables.py index ccc3fbc77..5d60ea7bf 100644 --- a/slither/detectors/variables/uninitialized_storage_variables.py +++ b/slither/detectors/variables/uninitialized_storage_variables.py @@ -88,13 +88,10 @@ class UninitializedStorageVars(AbstractDetector): self.log(info) - source = [function.source_mapping, uninitialized_storage_variable.source_mapping] - - results.append({'vuln': 'UninitializedStorageVars', - 'sourceMapping': source, - 'filename': self.filename, - 'contract': function.contract.name, - 'function': function.name, - 'variable': var_name}) + results.append({'check': self.ARGUMENT, + 'variable':{'name': uninitialized_storage_variable.name, + 'source_mapping': uninitialized_storage_variable.source_mapping}, + 'function':{'name':function.name, + 'source_mapping': function.source_mapping}}) return results diff --git a/slither/detectors/variables/unused_state_variables.py b/slither/detectors/variables/unused_state_variables.py index c1abb1374..54aa1f42c 100644 --- a/slither/detectors/variables/unused_state_variables.py +++ b/slither/detectors/variables/unused_state_variables.py @@ -36,7 +36,6 @@ class UnusedStateVars(AbstractDetector): for c in self.slither.contracts_derived: unusedVars = self.detect_unused(c) if unusedVars: - unusedVarsName = [v.name for v in unusedVars] info = '' for var in unusedVars: info += "{}.{} ({}) is never used in {}\n".format(var.contract.name, @@ -45,13 +44,11 @@ class UnusedStateVars(AbstractDetector): c.name) all_info += info - sourceMapping = [v.source_mapping for v in unusedVars] - results.append({'vuln': 'unusedStateVars', - 'sourceMapping': sourceMapping, - 'filename': self.filename, - 'contract': c.name, - 'unusedVars': unusedVarsName}) + results.append({'check': self.ARGUMENT, + 'variables':[{'name': variable.name, + 'source_mapping': variable.source_mapping} + for variable in unusedVars]}) if all_info != '': self.log(all_info) return results diff --git a/tests/expected_json/arbitrary_send.arbitrary-send.json b/tests/expected_json/arbitrary_send.arbitrary-send.json index b7eb60c44..282ccc2f5 100644 --- a/tests/expected_json/arbitrary_send.arbitrary-send.json +++ b/tests/expected_json/arbitrary_send.arbitrary-send.json @@ -1,8 +1,9 @@ [ { "check": "arbitrary-send", - "dangerous_calls": [ + "expressions": [ { + "expression": "msg.sender.send(this.balance)", "source_mapping": { "filename": "tests/arbitrary_send.sol", "length": 29, @@ -29,8 +30,9 @@ }, { "check": "arbitrary-send", - "dangerous_calls": [ + "expressions": [ { + "expression": "destination.send(this.balance)", "source_mapping": { "filename": "tests/arbitrary_send.sol", "length": 30, diff --git a/tests/expected_json/constant.constant-function.json b/tests/expected_json/constant.constant-function.json index 98fd4c1f8..79b23f9ff 100644 --- a/tests/expected_json/constant.constant-function.json +++ b/tests/expected_json/constant.constant-function.json @@ -15,8 +15,18 @@ "start": 45 } }, - "variables_written": [ - "a" + "variables": [ + { + "name": "a", + "source_mapping": { + "filename": "tests/constant.sol", + "length": 6, + "lines": [ + 3 + ], + "start": 28 + } + } ] }, { @@ -35,8 +45,18 @@ "start": 113 } }, - "variables_written": [ - "a" + "variables": [ + { + "name": "a", + "source_mapping": { + "filename": "tests/constant.sol", + "length": 6, + "lines": [ + 3 + ], + "start": 28 + } + } ] }, { @@ -55,6 +75,6 @@ "start": 324 } }, - "variables_written": [] + "variables": [] } ] \ 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 6db58ee96..b70701d11 100644 --- a/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json +++ b/tests/expected_json/controlled_delegatecall.controlled-delegatecall.json @@ -1,7 +1,7 @@ [ { "check": "controlled-delegatecall", - "controlled_delegatecalls": [ + "expressions": [ { "expression": "addr_bad.delegatecall(data)", "source_mapping": { @@ -31,7 +31,7 @@ }, { "check": "controlled-delegatecall", - "controlled_delegatecalls": [ + "expressions": [ { "expression": "addr_bad.delegatecall(func_id,data)", "source_mapping": { 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 c16f6330c..e727ef0c3 100644 --- a/tests/expected_json/low_level_calls.low-level-calls.json +++ b/tests/expected_json/low_level_calls.low-level-calls.json @@ -1,6 +1,19 @@ [ { "check": "low-level-calls", + "expressions": [ + { + "expression": "_receiver.call.value(msg.value).gas(7777)()", + "source_mapping": { + "filename": "tests/low_level_calls.sol", + "length": 43, + "lines": [ + 6 + ], + "start": 100 + } + } + ], "function": { "name": "send", "source_mapping": { @@ -13,19 +26,6 @@ ], "start": 49 } - }, - "low_level_calls": [ - { - "expression": "_receiver.call.value(msg.value).gas(7777)()", - "source_mapping": { - "filename": "tests/low_level_calls.sol", - "length": 43, - "lines": [ - 6 - ], - "start": 100 - } - } - ] + } } ] \ 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 157371ae1..51a2a33dc 100644 --- a/tests/expected_json/old_solc.sol.json.solc-version.json +++ b/tests/expected_json/old_solc.sol.json.solc-version.json @@ -1,15 +1,15 @@ [ { "check": "solc-version", - "pragmas": [ + "expressions": [ { + "expression": "0.4.21", "source_mapping": { "filename": "old_solc.sol", "length": 23, "lines": [], "start": 0 - }, - "version": "0.4.21" + } } ] } diff --git a/tests/expected_json/pragma.0.4.24.pragma.json b/tests/expected_json/pragma.0.4.24.pragma.json index 3dfe33411..6d7c96cb5 100644 --- a/tests/expected_json/pragma.0.4.24.pragma.json +++ b/tests/expected_json/pragma.0.4.24.pragma.json @@ -1,8 +1,9 @@ [ { "check": "pragma", - "pragmas": [ + "expressions": [ { + "expression": "^0.4.23", "source_mapping": { "filename": "tests/pragma.0.4.23.sol", "length": 24, @@ -10,10 +11,10 @@ 1 ], "start": 0 - }, - "version": "^0.4.23" + } }, { + "expression": "^0.4.24", "source_mapping": { "filename": "tests/pragma.0.4.24.sol", "length": 24, @@ -21,8 +22,7 @@ 1 ], "start": 0 - }, - "version": "^0.4.24" + } } ] } diff --git a/tests/expected_json/tx_origin.tx-origin.json b/tests/expected_json/tx_origin.tx-origin.json index f92735c74..323cf2fb5 100644 --- a/tests/expected_json/tx_origin.tx-origin.json +++ b/tests/expected_json/tx_origin.tx-origin.json @@ -1,6 +1,19 @@ [ { "check": "tx-origin", + "expressions": [ + { + "expression": "require(bool)(tx.origin == owner)", + "source_mapping": { + "filename": "tests/tx_origin.sol", + "length": 27, + "lines": [ + 10 + ], + "start": 140 + } + } + ], "function": { "name": "bug0", "source_mapping": { @@ -13,23 +26,25 @@ ], "start": 114 } - }, - "tx_origin": [ + } + }, + { + "check": "tx-origin", + "expressions": [ { - "expression": "require(bool)(tx.origin == owner)", + "expression": "tx.origin != owner", "source_mapping": { "filename": "tests/tx_origin.sol", - "length": 27, + "length": 57, "lines": [ - 10 + 14, + 15, + 16 ], - "start": 140 + "start": 206 } } - ] - }, - { - "check": "tx-origin", + ], "function": { "name": "bug2", "source_mapping": { @@ -44,21 +59,6 @@ ], "start": 180 } - }, - "tx_origin": [ - { - "expression": "tx.origin != owner", - "source_mapping": { - "filename": "tests/tx_origin.sol", - "length": 57, - "lines": [ - 14, - 15, - 16 - ], - "start": 206 - } - } - ] + } } ] \ 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 e57b7fe44..6b0497f0e 100644 --- a/tests/expected_json/uninitialized.uninitialized-state.json +++ b/tests/expected_json/uninitialized.uninitialized-state.json @@ -1,120 +1,120 @@ [ { - "contract": "Test", - "filename": "tests/uninitialized.sol", + "check": "uninitialized-state", "functions": [ - "use" - ], - "sourceMapping": [ { + "name": "transfer", + "source_mapping": { + "filename": "tests/uninitialized.sol", + "length": 82, + "lines": [ + 7, + 8, + 9 + ], + "start": 81 + } + } + ], + "variable": { + "name": "destination", + "source_mapping": { "filename": "tests/uninitialized.sol", - "length": 34, + "length": 19, "lines": [ - 15 + 5 ], - "start": 189 - }, + "start": 55 + } + } + }, + { + "check": "uninitialized-state", + "functions": [ { + "name": "use", + "source_mapping": { + "filename": "tests/uninitialized.sol", + "length": 143, + "lines": [ + 23, + 24, + 25, + 26 + ], + "start": 356 + } + } + ], + "variable": { + "name": "balances", + "source_mapping": { "filename": "tests/uninitialized.sol", - "length": 143, + "length": 34, "lines": [ - 23, - 24, - 25, - 26 + 15 ], - "start": 356 + "start": 189 } - ], - "variable": "balances", - "vuln": "UninitializedStateVars" + } }, { - "contract": "Test2", - "filename": "tests/uninitialized.sol", + "check": "uninitialized-state", "functions": [ - "use" - ], - "sourceMapping": [ { + "name": "use", + "source_mapping": { + "filename": "tests/uninitialized.sol", + "length": 117, + "lines": [ + 53, + 54, + 55, + 56 + ], + "start": 875 + } + } + ], + "variable": { + "name": "st", + "source_mapping": { "filename": "tests/uninitialized.sol", "length": 15, "lines": [ 45 ], "start": 695 - }, - { - "filename": "tests/uninitialized.sol", - "length": 117, - "lines": [ - 53, - 54, - 55, - 56 - ], - "start": 875 } - ], - "variable": "st", - "vuln": "UninitializedStateVars" + } }, { - "contract": "Test2", - "filename": "tests/uninitialized.sol", + "check": "uninitialized-state", "functions": [ - "init" - ], - "sourceMapping": [ { + "name": "init", + "source_mapping": { + "filename": "tests/uninitialized.sol", + "length": 52, + "lines": [ + 49, + 50, + 51 + ], + "start": 817 + } + } + ], + "variable": { + "name": "v", + "source_mapping": { "filename": "tests/uninitialized.sol", "length": 6, "lines": [ 47 ], "start": 748 - }, - { - "filename": "tests/uninitialized.sol", - "length": 52, - "lines": [ - 49, - 50, - 51 - ], - "start": 817 - } - ], - "variable": "v", - "vuln": "UninitializedStateVars" - }, - { - "contract": "Uninitialized", - "filename": "tests/uninitialized.sol", - "functions": [ - "transfer" - ], - "sourceMapping": [ - { - "filename": "tests/uninitialized.sol", - "length": 19, - "lines": [ - 5 - ], - "start": 55 - }, - { - "filename": "tests/uninitialized.sol", - "length": 82, - "lines": [ - 7, - 8, - 9 - ], - "start": 81 } - ], - "variable": "destination", - "vuln": "UninitializedStateVars" + } } ] \ 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 b6d922b15..2ff5b0631 100644 --- a/tests/expected_json/uninitialized_local_variable.uninitialized-local.json +++ b/tests/expected_json/uninitialized_local_variable.uninitialized-local.json @@ -1,18 +1,9 @@ [ { - "contract": "Uninitialized", - "filename": "tests/uninitialized_local_variable.sol", - "function": "func", - "sourceMapping": [ - { - "filename": "tests/uninitialized_local_variable.sol", - "length": 18, - "lines": [ - 4 - ], - "start": 77 - }, - { + "check": "uninitialized-local", + "function": { + "name": "func", + "source_mapping": { "filename": "tests/uninitialized_local_variable.sol", "length": 143, "lines": [ @@ -24,8 +15,17 @@ ], "start": 29 } - ], - "variable": "uint_not_init", - "vuln": "UninitializedLocalVars" + }, + "variable": { + "name": "uint_not_init", + "source_mapping": { + "filename": "tests/uninitialized_local_variable.sol", + "length": 18, + "lines": [ + 4 + ], + "start": 77 + } + } } ] \ 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 eefb6befb..616a30f76 100644 --- a/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json +++ b/tests/expected_json/uninitialized_storage_pointer.uninitialized-storage.json @@ -1,18 +1,9 @@ [ { - "contract": "Uninitialized", - "filename": "tests/uninitialized_storage_pointer.sol", - "function": "func", - "sourceMapping": [ - { - "filename": "tests/uninitialized_storage_pointer.sol", - "length": 9, - "lines": [ - 10 - ], - "start": 171 - }, - { + "check": "uninitialized-storage", + "function": { + "name": "func", + "source_mapping": { "filename": "tests/uninitialized_storage_pointer.sol", "length": 138, "lines": [ @@ -25,8 +16,17 @@ ], "start": 67 } - ], - "variable": "st_bug", - "vuln": "UninitializedStorageVars" + }, + "variable": { + "name": "st_bug", + "source_mapping": { + "filename": "tests/uninitialized_storage_pointer.sol", + "length": 9, + "lines": [ + 10 + ], + "start": 171 + } + } } ] \ No newline at end of file diff --git a/tests/expected_json/unused_return.unused-return.json b/tests/expected_json/unused_return.unused-return.json index ef9267013..d667c6518 100644 --- a/tests/expected_json/unused_return.unused-return.json +++ b/tests/expected_json/unused_return.unused-return.json @@ -1,30 +1,7 @@ [ { "check": "unused-return", - "function": { - "name": "test", - "source_mapping": { - "filename": "tests/unused_return.sol", - "length": 347, - "lines": [ - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29 - ], - "start": 230 - } - }, - "unused_returns": [ + "expressions": [ { "expression": "a.add(0)", "source_mapping": { @@ -47,6 +24,29 @@ "start": 263 } } - ] + ], + "function": { + "name": "test", + "source_mapping": { + "filename": "tests/unused_return.sol", + "length": 347, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29 + ], + "start": 230 + } + } } ] \ 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 2703c7cc0..f2a4e84e9 100644 --- a/tests/expected_json/unused_state.unused-state.json +++ b/tests/expected_json/unused_state.unused-state.json @@ -1,20 +1,18 @@ [ { - "contract": "B", - "filename": "tests/unused_state.sol", - "sourceMapping": [ + "check": "unused-state", + "variables": [ { - "filename": "tests/unused_state.sol", - "length": 14, - "lines": [ - 4 - ], - "start": 42 + "name": "unused", + "source_mapping": { + "filename": "tests/unused_state.sol", + "length": 14, + "lines": [ + 4 + ], + "start": 42 + } } - ], - "unusedVars": [ - "unused" - ], - "vuln": "unusedStateVars" + ] } ] \ No newline at end of file