Use symbol_factory (#1533)

* Use symbol_factory

* Black
pull/1537/head
Nikhil Parasaram 3 years ago committed by GitHub
parent 9d922fe9f4
commit 2212e565a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      mythril/laser/ethereum/state/constraints.py

@ -1,7 +1,7 @@
"""This module contains the class used to represent state-change constraints in """This module contains the class used to represent state-change constraints in
the call graph.""" the call graph."""
from mythril.exceptions import UnsatError from mythril.exceptions import UnsatError
from mythril.laser.smt import Bool, simplify from mythril.laser.smt import symbol_factory, simplify, Bool
from mythril.support.model import get_model from mythril.support.model import get_model
from typing import Iterable, List, Optional, Union from typing import Iterable, List, Optional, Union
@ -40,7 +40,9 @@ class Constraints(list):
:param constraint: The constraint to be appended :param constraint: The constraint to be appended
""" """
constraint = ( constraint = (
simplify(constraint) if isinstance(constraint, Bool) else Bool(constraint) simplify(constraint)
if isinstance(constraint, Bool)
else symbol_factory.Bool(constraint)
) )
super(Constraints, self).append(constraint) super(Constraints, self).append(constraint)
@ -100,7 +102,9 @@ class Constraints(list):
@staticmethod @staticmethod
def _get_smt_bool_list(constraints: Iterable[Union[bool, Bool]]) -> List[Bool]: def _get_smt_bool_list(constraints: Iterable[Union[bool, Bool]]) -> List[Bool]:
return [ return [
constraint if isinstance(constraint, Bool) else Bool(constraint) constraint
if isinstance(constraint, Bool)
else symbol_factory.Bool(constraint)
for constraint in constraints for constraint in constraints
] ]

Loading…
Cancel
Save