Use solver translate

pull/534/head
Nikhil Parasaram 6 years ago
parent 6178befedd
commit 13300d8913
  1. 8
      mythril/laser/ethereum/state.py

@ -147,7 +147,7 @@ class Constraints(list):
def append(self, constraint): def append(self, constraint):
self.__possibility = None self.__possibility = None
super(Constraints, self).append(constraint) super(Constraints, self).append(constraint)
self.solver = copy(self.solver) self.solver = self.solver.translate(self.solver.ctx)
self.solver.add(constraint) self.solver.add(constraint)
def pop(self, index=-1): def pop(self, index=-1):
@ -162,14 +162,16 @@ class Constraints(list):
def __add__(self, constraints): def __add__(self, constraints):
constraints_list = super(Constraints, self).__add__(constraints) constraints_list = super(Constraints, self).__add__(constraints)
new_solver = copy(self.solver) new_solver = self.solver.translate(self.solver.ctx)
for constraint in constraints: for constraint in constraints:
new_solver.add(constraint) new_solver.add(constraint)
return Constraints(constraint_list=constraints_list, solver=new_solver) return Constraints(constraint_list=constraints_list, solver=new_solver)
def __iadd__(self, constraints): def __iadd__(self, constraints):
super(Constraints, self).__iadd__(constraints) super(Constraints, self).__iadd__(constraints)
self.solver = copy(self.solver) self.solver = self.solver.translate(self.solver.ctx)
for constraint in constraints: for constraint in constraints:
self.solver.add(constraint) self.solver.add(constraint)
return self return self

Loading…
Cancel
Save