diff --git a/slither/detectors/statements/controlled_delegatecall.py b/slither/detectors/statements/controlled_delegatecall.py index fbe657f32..4b952426e 100644 --- a/slither/detectors/statements/controlled_delegatecall.py +++ b/slither/detectors/statements/controlled_delegatecall.py @@ -46,14 +46,14 @@ Bob calls `delegate` and delegates the execution to its malicious contract. As a continue nodes = self.controlled_delegatecall(f) if nodes: - info = '{}.{} ({}) uses delegatecall to a input-controlled function id\n' - info = info.format(contract.name, f.name, f.source_mapping_str) + func_info = '{}.{} ({}) uses delegatecall to a input-controlled function id\n' + func_info = func_info.format(contract.name, f.name, f.source_mapping_str) for node in nodes: - info += '\t{} ({})\n'.format(node.expression, node.source_mapping_str) + node_info = func_info + '\t- {} ({})\n'.format(node.expression, node.source_mapping_str) - json = self.generate_json_result(info) - self.add_function_to_json(f, json) - self.add_nodes_to_json(nodes, json) - results.append(json) + json = self.generate_json_result(node_info) + self.add_node_to_json(node, json) + self.add_function_to_json(f, json) + results.append(json) return results diff --git a/slither/detectors/statements/too_many_digits.py b/slither/detectors/statements/too_many_digits.py index ed80e7467..b5565094d 100644 --- a/slither/detectors/statements/too_many_digits.py +++ b/slither/detectors/statements/too_many_digits.py @@ -64,17 +64,15 @@ Use: # iterate over all the nodes ret = self._detect_too_many_digits(f) if ret: - info = '{}.{} ({}) uses literals with too many digits:'.format(f.contract.name, + func_info = '{}.{} ({}) uses literals with too many digits:'.format(f.contract.name, f.name, f.source_mapping_str) for node in ret: - info += '\n\t- {}'.format(node.expression) - info += '\n\tUse the proper denomination (ether-unit, time-unit,' - info += 'or the scientific notation\n' + node_info = func_info + '\n\t- {}\n'.format(node.expression) - # Add the result in result - json = self.generate_json_result(info) - self.add_nodes_to_json(ret, json) - results.append(json) + # Add the result in result + json = self.generate_json_result(node_info) + self.add_node_to_json(node, json) + results.append(json) return results