diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-07-27 22:42:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-27 22:42:55 +0800 |
commit | 5faa60e8834b5302f8d58f719c6962ed3affb50f (patch) | |
tree | 8d463a692f32811f1b5c4f98676b1f778c8c1afc | |
parent | c633ebe2e6abb9799458c5e1730bd8919232f916 (diff) | |
parent | b356f6a7f9e4fcdfa0f7df2e938ad735d231e599 (diff) | |
download | dexon-solidity-5faa60e8834b5302f8d58f719c6962ed3affb50f.tar.gz dexon-solidity-5faa60e8834b5302f8d58f719c6962ed3affb50f.tar.zst dexon-solidity-5faa60e8834b5302f8d58f719c6962ed3affb50f.zip |
Merge pull request #4593 from ethereum/smt_timeout
Set query timeout in SMT
-rw-r--r-- | libsolidity/formal/CVC4Interface.cpp | 1 | ||||
-rw-r--r-- | libsolidity/formal/SolverInterface.h | 5 | ||||
-rw-r--r-- | libsolidity/formal/Z3Interface.cpp | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/formal/CVC4Interface.cpp b/libsolidity/formal/CVC4Interface.cpp index 0cb70d2f..0530e940 100644 --- a/libsolidity/formal/CVC4Interface.cpp +++ b/libsolidity/formal/CVC4Interface.cpp @@ -37,6 +37,7 @@ void CVC4Interface::reset() m_functions.clear(); m_solver.reset(); m_solver.setOption("produce-models", true); + m_solver.setTimeLimit(queryTimeout); } void CVC4Interface::push() diff --git a/libsolidity/formal/SolverInterface.h b/libsolidity/formal/SolverInterface.h index 16796684..a6d65ce2 100644 --- a/libsolidity/formal/SolverInterface.h +++ b/libsolidity/formal/SolverInterface.h @@ -231,8 +231,11 @@ public: /// is available. Throws SMTSolverError on error. virtual std::pair<CheckResult, std::vector<std::string>> check(std::vector<Expression> const& _expressionsToEvaluate) = 0; -}; +protected: + // SMT query timeout in milliseconds. + static int const queryTimeout = 10000; +}; } } diff --git a/libsolidity/formal/Z3Interface.cpp b/libsolidity/formal/Z3Interface.cpp index 7e0788b3..b57bcb94 100644 --- a/libsolidity/formal/Z3Interface.cpp +++ b/libsolidity/formal/Z3Interface.cpp @@ -28,7 +28,10 @@ using namespace dev::solidity::smt; Z3Interface::Z3Interface(): m_solver(m_context) { + // This needs to be set globally. z3::set_param("rewriter.pull_cheap_ite", true); + // This needs to be set in the context. + m_context.set("timeout", queryTimeout); } void Z3Interface::reset() |