|
|
|
@ -81,12 +81,8 @@ def compare( |
|
|
|
|
tainted-contracts: list[TaintedExternalContract] |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
order_vars1 = [ |
|
|
|
|
v for v in v1.state_variables_ordered if not v.is_constant and not v.is_immutable |
|
|
|
|
] |
|
|
|
|
order_vars2 = [ |
|
|
|
|
v for v in v2.state_variables_ordered if not v.is_constant and not v.is_immutable |
|
|
|
|
] |
|
|
|
|
order_vars1 = v1.stored_state_variables_ordered |
|
|
|
|
order_vars2 = v2.stored_state_variables_ordered |
|
|
|
|
func_sigs1 = [function.solidity_signature for function in v1.functions] |
|
|
|
|
func_sigs2 = [function.solidity_signature for function in v2.functions] |
|
|
|
|
|
|
|
|
@ -206,7 +202,7 @@ def tainted_external_contracts(funcs: List[Function]) -> List[TaintedExternalCon |
|
|
|
|
elif ( |
|
|
|
|
isinstance(target, StateVariable) |
|
|
|
|
and target not in (v for v in tainted_contracts[contract.name].tainted_variables) |
|
|
|
|
and not (target.is_constant or target.is_immutable) |
|
|
|
|
and target.is_stored |
|
|
|
|
): |
|
|
|
|
# Found a new high-level call to a public state variable getter |
|
|
|
|
tainted_contracts[contract.name].add_tainted_variable(target) |
|
|
|
@ -304,12 +300,8 @@ def get_missing_vars(v1: Contract, v2: Contract) -> List[StateVariable]: |
|
|
|
|
List of StateVariables from v1 missing in v2 |
|
|
|
|
""" |
|
|
|
|
results = [] |
|
|
|
|
order_vars1 = [ |
|
|
|
|
v for v in v1.state_variables_ordered if not v.is_constant and not v.is_immutable |
|
|
|
|
] |
|
|
|
|
order_vars2 = [ |
|
|
|
|
v for v in v2.state_variables_ordered if not v.is_constant and not v.is_immutable |
|
|
|
|
] |
|
|
|
|
order_vars1 = v1.stored_state_variables_ordered |
|
|
|
|
order_vars2 = v2.stored_state_variables_ordered |
|
|
|
|
if len(order_vars2) < len(order_vars1): |
|
|
|
|
for variable in order_vars1: |
|
|
|
|
if variable.name not in [v.name for v in order_vars2]: |
|
|
|
@ -366,7 +358,7 @@ def get_proxy_implementation_slot(proxy: Contract) -> Optional[SlotInfo]: |
|
|
|
|
|
|
|
|
|
delegate = get_proxy_implementation_var(proxy) |
|
|
|
|
if isinstance(delegate, StateVariable): |
|
|
|
|
if not delegate.is_constant and not delegate.is_immutable: |
|
|
|
|
if delegate.is_stored: |
|
|
|
|
srs = SlitherReadStorage([proxy], 20) |
|
|
|
|
return srs.get_storage_slot(delegate, proxy) |
|
|
|
|
if delegate.is_constant and delegate.type.name == "bytes32": |
|
|
|
|