[SMTChecker] Remember verification targets from trusted external calls

Previously, we did not remember trusted external calls for later phase
when we compute possible verification targets for each function.
This led to false negative in cases where verification target can be
violated, but not by calling a public function directly, but only when
it is called as an external function from other function.

The added test cases witnesses this behaviour. The underflow in
`dec` cannot happen in any other way except what the `dec` is called
from `f`.

The same problem did not occur when the functions are called internally,
because for such cases, we have already been remembering these calls in
the callgraph in the CHC engine.
This commit is contained in:
Martin Blicha
2023-05-26 13:03:44 +02:00
parent bb16f61e1c
commit b0419da654
4 changed files with 31 additions and 5 deletions
+6
View File
@@ -1000,6 +1000,12 @@ void CHC::externalFunctionCallToTrustedCode(FunctionCall const& _funCall)
if (!function)
return;
// Remember the external call in the call graph to properly detect verification targets for the current function
if (m_currentFunction && !m_currentFunction->isConstructor())
m_callGraph[m_currentFunction].insert(function);
else
m_callGraph[m_currentContract].insert(function);
// External call creates a new transaction.
auto originalTx = state().tx();
Expression const* value = valueOption(callOptions);