Make some changes

state_merge
Nikhil Parasaram 5 years ago
parent db947207f2
commit bb6d2e17ab
  1. 3
      mythril/laser/ethereum/plugins/implementations/state_merge/__init__.py
  2. 2
      mythril/laser/ethereum/plugins/implementations/state_merge/merge_states.py
  3. 4
      mythril/laser/smt/bitvec_helper.py

@ -16,13 +16,12 @@ log = logging.getLogger(__name__)
class MergeAnnotation(StateAnnotation): class MergeAnnotation(StateAnnotation):
def __init__(self):
pass pass
class StateMerge(LaserPlugin): class StateMerge(LaserPlugin):
def initialize(self, symbolic_vm: LaserEVM): def initialize(self, symbolic_vm: LaserEVM):
"""Initializes the mutation pruner """Initializes the State merging plugin
Introduces hooks for SSTORE operations Introduces hooks for SSTORE operations
:param symbolic_vm: :param symbolic_vm:

@ -97,7 +97,7 @@ def merge_storage(storage1: Storage, storage2: Storage, path_condition: Bool):
path_condition, storage1.printable_storage[key], value path_condition, storage1.printable_storage[key], value
) )
else: else:
storage1.printable_storage[key] = value storage1.printable_storage[key] = If(path_condition, 0, value)
def _merge_annotations(state1: "WorldState", state2: "WorldState"): def _merge_annotations(state1: "WorldState", state2: "WorldState"):

@ -47,9 +47,7 @@ def If(
""" """
if not isinstance(a, Bool): if not isinstance(a, Bool):
a = Bool(z3.BoolVal(a)) a = Bool(z3.BoolVal(a))
if (isinstance(b, K) or isinstance(b, Array)) and ( if isinstance(b, BaseArray) and isinstance(c, BaseArray):
isinstance(c, Array) or isinstance(c, K)
):
array = z3.If(a.raw, b.raw, c.raw) array = z3.If(a.raw, b.raw, c.raw)
return z3_array_converter(array) return z3_array_converter(array)

Loading…
Cancel
Save