Pylint and black

pull/1816/head
webthethird 2 years ago
parent cba0dc9511
commit 386c3e14a3
  1. 10
      slither/utils/upgradeability.py

@ -266,9 +266,12 @@ def tainted_inheriting_contracts(
contract = tainted["contract"] contract = tainted["contract"]
if contracts is None: if contracts is None:
contracts = contract.compilation_unit.contracts contracts = contract.compilation_unit.contracts
contracts = [
c
for c in contracts
if c.name not in tainted_contracts and c.name in [i.name for i in c.inheritance]
]
for c in contracts: for c in contracts:
inheritance = [i.name for i in c.inheritance]
if contract.name in inheritance and c.name not in tainted_contracts:
new_taint = TaintedExternalContract(contract=c, functions=[], variables=[]) new_taint = TaintedExternalContract(contract=c, functions=[], variables=[])
for f in c.functions_declared: for f in c.functions_declared:
internal_calls = f.all_internal_calls() internal_calls = f.all_internal_calls()
@ -280,10 +283,10 @@ def tainted_inheriting_contracts(
for var in f.all_state_variables_read() + f.all_state_variables_written() for var in f.all_state_variables_read() + f.all_state_variables_written()
): ):
new_taint["functions"].append(f) new_taint["functions"].append(f)
for f in new_taint["functions"]:
for var in f.all_state_variables_read() + f.all_state_variables_written(): for var in f.all_state_variables_read() + f.all_state_variables_written():
if not (var in tainted["variables"] or var in new_taint["variables"]): if not (var in tainted["variables"] or var in new_taint["variables"]):
new_taint["variables"].append(var) new_taint["variables"].append(var)
if len(new_taint["functions"]) > 0:
for var in new_taint["variables"]: for var in new_taint["variables"]:
read_write = set( read_write = set(
contract.get_functions_reading_from_variable(var) contract.get_functions_reading_from_variable(var)
@ -294,6 +297,7 @@ def tainted_inheriting_contracts(
f.is_constructor or f.is_fallback or f.is_receive f.is_constructor or f.is_fallback or f.is_receive
): ):
new_taint["functions"].append(f) new_taint["functions"].append(f)
if len(new_taint["functions"]) > 0:
tainted_contracts.append(new_taint) tainted_contracts.append(new_taint)
return tainted_contracts return tainted_contracts

Loading…
Cancel
Save