Unconstrained storage (#1366)

* Add unconstrained storage flag

* Dont take from onchain
pull/1367/head
Nikhil Parasaram 5 years ago committed by GitHub
parent 805ecdadc5
commit 1cf4df9b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      mythril/interfaces/cli.py
  2. 4
      mythril/laser/ethereum/state/account.py
  3. 2
      mythril/mythril/mythril_analyzer.py
  4. 1
      mythril/support/support_args.py

@ -455,6 +455,12 @@ def create_analyzer_parser(analyzer_parser: ArgumentParser):
action="store_true",
help="Checks for reachability after the end of tx. Recommended for short execution timeouts < 1 min",
)
options.add_argument(
"--unconstrained-storage",
action="store_true",
help="Default storage value is symbolic, turns off the on-chain storage loading",
)
options.add_argument(
"--phrack", action="store_true", help="Phrack-style call graph"
)
@ -683,6 +689,7 @@ def execute_command(
if args.custom_modules_directory
else "",
sparse_pruning=args.sparse_pruning,
unconstrained_storage=args.unconstrained_storage,
)
if not disassembler.contracts:

@ -10,6 +10,7 @@ from typing import Any, Dict, Union, Set
from mythril.laser.smt import Array, K, BitVec, simplify, BaseArray
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.smt import symbol_factory
from mythril.support.support_args import args
log = logging.getLogger(__name__)
@ -22,7 +23,7 @@ class Storage:
:param concrete: bool indicating whether to interpret uninitialized storage as concrete versus symbolic
"""
if concrete:
if concrete and args.unconstrained_storage is False:
self._standard_storage = K(256, 256, 0) # type: BaseArray
else:
self._standard_storage = Array("Storage", 256, 256)
@ -41,6 +42,7 @@ class Storage:
and item.symbolic is False
and int(item.value) not in self.storage_keys_loaded
and (self.dynld and self.dynld.active)
and args.unconstrained_storage is False
):
try:
storage[item] = symbol_factory.BitVecVal(

@ -46,6 +46,7 @@ class MythrilAnalyzer:
enable_coverage_strategy: bool = False,
custom_modules_directory: str = "",
sparse_pruning: bool = False,
unconstrained_storage: bool = False,
):
"""
@ -69,6 +70,7 @@ class MythrilAnalyzer:
self.custom_modules_directory = custom_modules_directory
args.sparse_pruning = sparse_pruning
args.solver_timeout = solver_timeout
args.unconstrained_storage = unconstrained_storage
def dump_statespace(self, contract: EVMContract = None) -> str:
"""

@ -7,6 +7,7 @@ class Args:
def __init__(self):
self.solver_timeout = 10000
self.sparse_pruning = True
self.unconstrained_storage = False
args = Args()

Loading…
Cancel
Save