Merge pull request #332 from JoranHonig/features/solver_timeout_logging

Add timeout logging to solver
pull/339/head
JoranHonig 6 years ago committed by GitHub
commit e57ef0d361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mythril/analysis/solver.py

@ -1,6 +1,6 @@
from z3 import Solver, simplify, sat
from z3 import Solver, simplify, sat, unknown
from mythril.exceptions import UnsatError
import logging
def get_model(constraints):
s = Solver()
@ -8,13 +8,12 @@ def get_model(constraints):
for constraint in constraints:
s.add(constraint)
if (s.check() == sat):
result = s.check()
if result == sat:
return s.model()
else:
raise UnsatError
elif result == unknown:
logging.info("Timeout encountered while solving expression using z3")
raise UnsatError
def pretty_print_model(model):

Loading…
Cancel
Save