Document when a newly created variable can be returned

pull/1757/head
webthethird 2 years ago
parent 1a54d0d325
commit 24dad035f4
  1. 3
      slither/utils/upgradeability.py

@ -344,6 +344,7 @@ def get_proxy_implementation_var(proxy: Contract) -> Optional[Variable]:
""" """
Gets the Variable that stores a proxy's implementation address. Uses data dependency to trace any LocalVariable Gets the Variable that stores a proxy's implementation address. Uses data dependency to trace any LocalVariable
that is passed into a delegatecall as the target address back to its data source, ideally a StateVariable. that is passed into a delegatecall as the target address back to its data source, ideally a StateVariable.
Can return a newly created StateVariable if an `sload` from a hardcoded storage slot is found in assembly.
Args: Args:
proxy: A Contract object (proxy.is_upgradeable_proxy should be true). proxy: A Contract object (proxy.is_upgradeable_proxy should be true).
@ -366,6 +367,7 @@ def get_proxy_implementation_var(proxy: Contract) -> Optional[Variable]:
def find_delegate_in_fallback(proxy: Contract) -> Optional[Variable]: def find_delegate_in_fallback(proxy: Contract) -> Optional[Variable]:
""" """
Searches a proxy's fallback function for a delegatecall, then extracts the Variable being passed in as the target. Searches a proxy's fallback function for a delegatecall, then extracts the Variable being passed in as the target.
Can return a newly created StateVariable if an `sload` from a hardcoded storage slot is found in assembly.
Should typically be called by get_proxy_implementation_var(proxy). Should typically be called by get_proxy_implementation_var(proxy).
Args: Args:
proxy: A Contract object (should have a fallback function). proxy: A Contract object (should have a fallback function).
@ -416,6 +418,7 @@ def extract_delegate_from_asm(contract: Contract, node: Node) -> Optional[Variab
""" """
Finds a Variable with a name matching the argument passed into a delegatecall, when all we have is an Assembly node Finds a Variable with a name matching the argument passed into a delegatecall, when all we have is an Assembly node
with a block of code as one long string. Usually only the case for solc versions < 0.6.0. with a block of code as one long string. Usually only the case for solc versions < 0.6.0.
Can return a newly created StateVariable if an `sload` from a hardcoded storage slot is found in assembly.
Should typically be called by find_delegate_in_fallback(proxy). Should typically be called by find_delegate_in_fallback(proxy).
Args: Args:
contract: The parent Contract. contract: The parent Contract.

Loading…
Cancel
Save