[SMTChecker] Do not create targets for contracts that cannot be deployed

This commit is contained in:
Martin Blicha
2021-03-25 15:38:37 +01:00
parent 7e1be52281
commit 85358dfe30
10 changed files with 35 additions and 17 deletions
+1 -1
View File
@@ -841,7 +841,7 @@ void BMC::addVerificationTarget(
Expression const* _expression
)
{
if (!m_settings.targets.has(_type))
if (!m_settings.targets.has(_type) || (m_currentContract && !m_currentContract->canBeDeployed()))
return;
BMCVerificationTarget target{
+12 -7
View File
@@ -197,13 +197,17 @@ void CHC::endVisit(ContractDefinition const& _contract)
connectBlocks(m_currentBlock, summary(_contract));
setCurrentBlock(*m_constructorSummaries.at(&_contract));
auto constructor = _contract.constructor();
auto txConstraints = state().txTypeConstraints();
if (!constructor || !constructor->isPayable())
txConstraints = txConstraints && state().txNonPayableConstraint();
m_queryPlaceholders[&_contract].push_back({txConstraints, errorFlag().currentValue(), m_currentBlock});
connectBlocks(m_currentBlock, interface(), txConstraints && errorFlag().currentValue() == 0);
solAssert(&_contract == m_currentContract, "");
if (_contract.canBeDeployed())
{
auto constructor = _contract.constructor();
auto txConstraints = state().txTypeConstraints();
if (!constructor || !constructor->isPayable())
txConstraints = txConstraints && state().txNonPayableConstraint();
m_queryPlaceholders[&_contract].push_back({txConstraints, errorFlag().currentValue(), m_currentBlock});
connectBlocks(m_currentBlock, interface(), txConstraints && errorFlag().currentValue() == 0);
}
SMTEncoder::endVisit(_contract);
}
@@ -262,7 +266,8 @@ void CHC::endVisit(FunctionDefinition const& _function)
if (
!_function.isConstructor() &&
_function.isPublic() &&
contractFunctions(*m_currentContract).count(&_function)
contractFunctions(*m_currentContract).count(&_function) &&
m_currentContract->canBeDeployed()
)
{
auto sum = summary(_function);